Valkyrian Labs

CLI Reference

Commands and flags for the native pmdocs CLI.

CLI Reference

The supported operator CLI is the native system-level pmdocs binary. Install it through Homebrew or the Valkyrian Labs Debian repository.

The npm package payload-markdown-docs installs the Payload plugin and runtime helpers only. It does not provide the supported CLI surface.

Examples use main-docs as a sample docs set slug. Replace it with the Payload docs set slug for your upstream docs package.

install

Debian/Ubuntu:

1sudo install -d -m 0755 /etc/apt/keyrings2sudo curl -fsSL https://apt.valkyrianlabs.com/pubkey.gpg \3  -o /etc/apt/keyrings/valkyrianlabs.gpg4sudo chmod 0644 /etc/apt/keyrings/valkyrianlabs.gpg5 6echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/valkyrianlabs.gpg] https://apt.valkyrianlabs.com stable main" | \7  sudo tee /etc/apt/sources.list.d/valkyrianlabs.list > /dev/null8 9sudo apt-get update10sudo apt-get install -y pmdocs11 12pmdocs --version13pmdocs --help

The packages recommend valkyrianlabs-archive-keyring (APT installs it by default), which puts the repository key at /usr/share/keyrings/valkyrianlabs.gpg and keeps it current through normal upgrades (for example when its expiry changes). When the key downloaded above is unmodified, the package replaces it with a symlink to the packaged key, so the source line above keeps working and you never need to download the key again. Removing the package turns the symlink back into a plain copy. Signing key fingerprint: 494D 71A1 EEDD F87B D48E 5048 6D64 CB7B DFC3 0EC6.

Homebrew:

1brew install valkyrianlabs/tap/pmdocs2 3pmdocs --version4pmdocs --help

Use the full name valkyrianlabs/tap/pmdocs. Homebrew taps valkyrianlabs/tap if needed and trusts only the pmdocs formula, so there is no separate brew tap or brew trust step. Afterwards brew upgrade (or brew upgrade pmdocs) keeps it current.

Installed it earlier with brew tap valkyrianlabs/tap and brew install pmdocs? Current Homebrew refuses to load formulae from a tap you have not trusted, so brew upgrade skips pmdocs. Run brew upgrade valkyrianlabs/tap/pmdocs once; the full name trusts it from then on.

doctor

1pmdocs doctor

Prints local native CLI diagnostics. It does not check networking, Payload server configuration, auth, OIDC, or signing.

doctor exits 0 with status: ok when both skills pmdocs install skill installs are available, and 1 with status: degraded when either is missing. The payload-markdown-docs skill comes from the bundled skill data. The payload-markdown skill comes from the project's installed payload-markdown package when there is one (companion_skill_source: project: ...), and from the bundled copy otherwise; the Debian package and the Homebrew formula both bundle it.

validate

1pmdocs validate --source main-docs2pmdocs validate ./docs --source main-docs

Validates the conventional docs package by building and validating an in-memory manifest. By default this includes Markdown docs from ./docs, skill artifacts from ./skills/<source> when that directory exists, and optional custom llms.txt / llms-full.txt fallback assets when present. The default ./skills directory is optional; only an explicitly supplied missing --skills <path> fails validation.

What the docs walk includes:

  • every lowercase .md file below the docs root, at any depth
  • hidden files and directories (names starting with .), each reported as a warning; pass --skip-hidden to leave them out

What it leaves out, always reported as a skipped_path warning:

  • .git and node_modules directories at any depth
  • build, dist, and .next directories directly below the docs root (the same names deeper in the tree are ordinary docs sections)
  • symbolic links (not followed)
  • Markdown-like files that are not lowercase .md, such as README.MD or notes.markdown

Files that are not valid UTF-8 fail validation with an invalid_encoding error that names the file.

stack.toml at the docs root is project metadata, not a page: the walk never publishes it as a doc. When it exists, validate checks it and prints stack.toml: present with the title/description it sets and its categories (missing without the file, invalid with errors). Its errors fail validation like any other. Each one has the path stack.toml and names the key to fix, such as stack.languages[0].name. A file without a [stack] table produces a missing_stack warning because it clears the synchronized stack. With --json, package.stackToml reports the state and project summarizes the metadata. See stack.toml.

Two files that derive the same route (index.md and Index.md, or guide.md and guide/index.md) fail validation with a route_collision error on each file; the sync endpoint would reject them. Routes that differ only in letter case produce a route_case_collision warning. push reports local collisions as warnings and leaves the decision to the server, which knows the docs set's real route base.

Size limits: --max-file-bytes (500,000) applies to each docs file and asset, --max-total-bytes (5,000,000) to the sum of all docs and asset contents, and --max-body-bytes (5,000,000) to the serialized JSON request body. The body limit is the one the server enforces first (maxBodyBytes, HTTP 413), and JSON escaping can make the body noticeably larger than the content, so validate, manifest, and plan check the largest body push could send and push checks the exact body. Pass --max-body-bytes when the server is configured with a different maxBodyBytes. Skill packages follow the same walk rules and report files other than .md, .txt, .json, .yaml, and .yml.

manifest

1pmdocs manifest --source main-docs --pretty2pmdocs manifest ./docs --source main-docs --pretty

Prints manifest JSON. Docs records remain under files; skill artifacts and optional custom static fallback files are emitted under assets. A valid stack.toml becomes the project object right after source. Without the file there is no project key, and the docs set's project metadata stays as it is.

plan

1pmdocs plan --source main-docs2pmdocs plan ./docs --source main-docs

Plans against optional local existing-records JSON files. Without --existing, all valid docs are planned as creates; without --existing-assets, all assets are planned as creates.

The plan is a local approximation of the server's dry-run. To match it:

  • pass --publish when the push will use --publish (otherwise existing published records are planned as status updates)
  • pass --route-base for docs sets that are not served at /<source>: a grouped docs set uses /<group-route>/<source>, a product-nested one /<group-route>/<source>/docs (also pass --asset-route-base /<group-route>/<source> so skill asset routes match)
  • export current records with the --existing (docs) and --existing-assets (assets) shapes: arrays of { "sourcePath", "route", "sourceHash", "status", "archived" } and { "sourcePath", "kind", "contentType", "route", "sourceHash", "archived" }

The text and --json output also show the stack.toml summary.

validate accepts --route-base and --asset-route-base too, so route collision checks use the same routes.

Server plan (--endpoint)

1pmdocs plan ./docs --source main-docs \2  --endpoint "$DOCS_SYNC_ENDPOINT" \3  --key-id local-docs \4  --private-key-env DOCS_SYNC_PRIVATE_KEY

With --endpoint (and the same credential flags as push: --key-id with --private-key-file or --private-key-env, or --github-oidc), plan sends a signed dry run and prints the server's plan against its current records, then its Markdown diagnostics: what payload-markdown reports for each checked page, and broken links and anchors, one line each as path:line:col severity code message (Markdown diagnostics). Nothing is written. --existing and --existing-assets cannot be combined with --endpoint.

  • --strict: exit 1 when any page has a warning or error (the server checks every page). Without it, plan still exits 1 when the docs set has Strict Markdown checks on and the checks fail, because the sync would be rejected.
  • --full-check: check every page, not only the pages this sync creates or changes. Servers ignore it for GitHub OIDC pull-request tokens unless they allow it, and the output then says Ignored by the server: checks.full.

Both need --endpoint; without it plan stays local and says so. pmdocs push --dry-run sends the same request.

keygen

1pmdocs keygen --out .docs-sync

Generates Ed25519 PEM keys for signed sync. The private key file is created with mode 0600 (and a newly created --out directory with 0700), whatever the current umask, including when --force replaces an existing key. push warns when --private-key-file is readable by group or other users. Add the public key to an Ed25519 record in Docs Globals > Access. push also accepts unencrypted OpenSSH Ed25519 private keys when the matching ssh-ed25519 ... public key is stored in Access.

push

push uploads the conventional docs package by default:

  • docs from ./docs as manifest files
  • skills from ./skills/<source> as manifest assets when that directory exists
  • ./llms.txt and ./llms-full.txt as optional custom static fallback assets when present
  • stack.toml from the docs root as the manifest project object when present (stack.toml)

Projects do not need to ship native skills. A missing default ./skills directory is skipped during push; pass --no-skills to opt out explicitly or --skills <path> when skills live somewhere else.

Ed25519:

1pmdocs push \2  --endpoint "$DOCS_SYNC_ENDPOINT" \3  --source main-docs \4  --key-id local-docs \5  --private-key-env DOCS_SYNC_PRIVATE_KEY

Explicit dry-run:

1pmdocs push \2  --endpoint "$DOCS_SYNC_ENDPOINT" \3  --source main-docs \4  --key-id local-docs \5  --private-key-env DOCS_SYNC_PRIVATE_KEY \6  --dry-run

GitHub OIDC:

1pmdocs push \2  --endpoint "$DOCS_SYNC_ENDPOINT" \3  --source <docs-set-slug> \4  --github-oidc

push defaults to sync mode. --dry-run submits a validation-only request.

--endpoint must use https://. Plain http:// is accepted only for loopback hosts (localhost, 127.x.x.x, ::1) so a GitHub OIDC bearer token or a signed manifest never crosses a network in clear text; pass --allow-insecure-http only for a trusted private network. --publish is separate from sync mode and requests published output. Publishing and writes remain server-owned.

When the server rejects a push, pmdocs prints the error message followed by every detail the server returns: validation issues (with path, code, and severity), routeCollisions, and manual-edit conflicts. With --json, the output adds a normalized failure object with code, message, issues, routeCollisions, and conflicts (empty arrays when an older server does not send them).

When the push sent stack.toml, the server reports what it did with it, and the output prints a line like Project metadata: stack updated, title manual, description not_provided. (not applied) is added for dry runs. Servers older than payload-markdown-docs 1.3.0 ignore project metadata without saying so. push then still succeeds, because the docs were synced, but it prints a warning that the stack, title and description were not synchronized. With --json the output carries project: { "sent": true, "acknowledged": false } and a project_not_acknowledged warning.

After the summary, push prints the server's Markdown diagnostics, one line per finding (path:line:col severity code message, grouped by file), and --json adds the server's report as diagnostics and the verdict as diagnosticsFailed. Findings do not fail a push unless strict checks apply:

  • --strict asks for strict checks: the server checks every page and rejects the sync (diagnostics_failed, nothing is written) when any page has a warning or error; with --dry-run the plan is shown and push exits 1. The docs set setting Strict Markdown checks has the same effect for every client.
  • --full-check checks every page, not only the pages this sync creates or changes.
  • Servers older than payload-markdown-docs 1.4 do not check. Without --strict, nothing changes. A --strict request is sent as manifest version 2, which such servers refuse before doing anything: push reports diagnostics_unavailable, exits 1, and nothing was written. This works with every kind of credential, including single-use OIDC tokens.

If assets are included and public Next asset route files are missing from the current working tree, push prints a warning. Add --strict-routes in CI to turn that warning into a failure.

Common push flags:

  • --endpoint <url>
  • --allow-insecure-http
  • --source <id>
  • --docs <path>
  • --skills <path>
  • --llms <path>
  • --llms-full <path>
  • --no-docs
  • --no-skills
  • --no-llms
  • --no-llms-full
  • --skip-hidden
  • --dry-run
  • --strict
  • --full-check
  • --strict-routes
  • --publish
  • --delete-behavior <archive|delete|draft|ignore>

OIDC-specific flags:

  • --github-oidc
  • --oidc-token-env <env-name>

Pass --source explicitly in CI. The CLI can derive it from GITHUB_REPOSITORY only when the docs set slug matches the repository name, but copied workflow templates should not rely on that fallback.

--repository, --branch, and --commit are optional source metadata flags. They are not required for GitHub OIDC authentication because Payload verifies repository, ref, and SHA from the OIDC token claims.

install skill

1pmdocs install skill --agent codex2pmdocs install skill --agent claude

Installs the bundled payload-markdown-docs AI-agent guidance plus the companion payload-markdown authoring skill for Codex or Claude. Codex defaults to .agents/skills/payload-markdown-docs/ and .agents/skills/payload-markdown/; Claude defaults to .claude/skills/payload-markdown-docs/ and .claude/skills/payload-markdown/. pmdocs skill install remains as a Codex compatibility alias.

Useful flags:

  • --out <path>
  • --docs-root <path>
  • --package-manager <pnpm|npm|yarn|bun>
  • --agent <codex|claude>
  • --codex
  • --claude
  • --force
  • --dry-run

The payload-markdown skill is taken from the project's installed payload-markdown package (node_modules/payload-markdown or node_modules/payload-markdown, searched upwards from the working directory) so it matches the version the site renders with; otherwise from the copy bundled with pmdocs. Its files are copied unchanged, so npx payload-markdown skill check accepts them. If neither is available the command fails instead of installing half the guidance.

Each installed skill carries a skill.json manifest (version and content hash). Re-running install skill replaces an install that nobody edited without --force; edited files are reported as conflicts.

The installer writes Markdown guidance files only. It does not sync docs or run package manager commands.

skill check

1pmdocs skill check2pmdocs skill check --agent claude --json

Reports each installed skill (payload-markdown-docs and payload-markdown, for every agent installed in the project, or --agent) as:

Status Meaning
current Matches what this pmdocs (or the project's payload-markdown) installs.
outdated Installed from an older version, or before manifests existed.
modified Edited since it was installed.
missing Not installed.

Exits 0 only when every skill is current.

skill update

1pmdocs skill update2pmdocs skill update --agent codex --dry-run

Replaces outdated or missing skills for every installed agent (or --agent), keeping the --docs-root and --package-manager they were installed with (override either with the same flag). Skills that were edited since install are left alone and the command fails; pass --force to replace them too.

pmdocs validate and pmdocs plan print a reminder on stderr when an installed skill is outdated; they never change their exit code for it. Set PMDOCS_SKILL_CHECK=0 to silence it. The installed skill tells agents to run pmdocs skill update when they see outdated, and to ask first when it says modified.

install routes

1pmdocs install routes --payload-app "src/app/(payload)"

Installs public Next App Router files that delegate raw AI asset requests to the plugin-owned asset handlers. Commit and deploy these files when a site should serve canonical public routes outside /api:

1/llms.txt2/llms-full.txt3/plugins/<docs-set>/llms.txt4/plugins/<docs-set>/llms-full.txt5/plugins/<docs-set>/skills/<agent>6/plugins/<docs-set>/skills/<agent>/SKILL.md7/plugins/<docs-set>/skills/<agent>.zip8/plugins/<docs-set>/skills/<agent>/<path...>

Useful flags:

  • --payload-app <path>
  • --force
  • --dry-run

install routes does not publish assets. It only creates Next route files. install skill does not publish assets either; it only installs local agent guidance.

facts

1pmdocs facts ls cli:remote2pmdocs facts show "cli:remote create --retries"3pmdocs facts scaffold "cli:remote create"4pmdocs facts fill --dry-run5pmdocs facts fill --fix docs/reference/remote.md6pmdocs facts check7pmdocs facts check --json8pmdocs facts unused --exit-code9pmdocs facts export

Source-backed reference tables: docs-table blocks bound to facts that the sources in docs/facts.toml extract from the code, afresh on every command. See Source-Backed Reference Tables for the model, the extractor protocol, the @fact scanner and the check rules.

Command Does
ls [<prefix>] Fact ids (sorted) with the start of their summary.
show <id> One fact's fields, _source, and where the docs bind it (exit 1 for an unknown id).
scaffold <id-or-prefix> Prints a ::docs-table and pipe table for the facts directly below an id. --kind <kind>, --columns <a,b>.
fill [<path>…] Writes blank bound cells. --fix also rewrites drifted cells; --dry-run writes nothing.
check [<path>…] Fresh extraction, then drift, unknown-fact, unknown-source, incomplete, invalid-binding and duplicate-key errors and fillable and unchecked-fact notes.
unused [<prefix>] Facts bound nowhere in the docs. --exit-code exits 1 when there are any.
export The extracted facts as JSON Lines.

Bindings are docs-table rows (implicit through from, or explicit through a fact column or fact="…"; - marks a row as not bound) and inline :fact[value]{id="…" field="…"} values in prose and cells. A scan source can set literal = "<field>" to choose the field a marked line's plain literal fills (value otherwise):

1[[source]]2name = "config"3scan = ["src/config.hpp"]4literal = "default"

Options of every facts command:

  • --docs <dir>: docs directory, default ./docs.
  • --config <file>: facts.toml, default <docs>/facts.toml.
  • --root <dir>: directory the sources run in, overriding root.
  • --json: JSON output (ls, show, check, unused, export).

Exit codes: 0 success; 1 findings; 2 usage or configuration error; 3 a source failed (nothing is reported or written). CLI usage errors keep CLI11's own codes.

Common flags
  • --source <id>
  • --docs <path>
  • --skills <path>
  • --llms <path>
  • --llms-full <path>
  • --no-docs
  • --no-skills
  • --no-llms
  • --no-llms-full
  • --skip-hidden
  • --repository <repo>
  • --branch <branch>
  • --commit <sha>
  • --json
  • --pretty
  • --max-files <number>
  • --max-file-bytes <number>
  • --max-total-bytes <number>
  • --max-body-bytes <number>
  • --route-base <path> and --asset-route-base <path> (validate and plan)

--strict-routes is a push flag only. Without --source, the docs set slug comes from GITHUB_REPOSITORY (the repository name) when it is set, otherwise from the docs root directory name, or local-docs when that directory is named docs.