opentrain instructions is the agent-first authoring surface for instruction manuals. Every command wraps the corresponding Instructions API endpoint, supports --json for the raw response, and accepts - for stdin on file inputs. --key <idempotency-key> is available on workspace/manual creation, direct and stored changeset apply, changeset submit, revision restore, publish, and docs-as-code sync—not on update, archive, permission, reviewer-decision, or asset commands. Requires CLI 0.3.0 or later (npm install -g @opentrain-ai/cli@latest).
Changeset-backed page authoring helpers and sync accept --dry-run to validate without writing and --submit to store the changeset for human review. Those flags do not apply to metadata, permission, reviewer-decision, asset, or publication commands. Whole-document replacement always demands the explicit --confirm-replace flag.
Discovery and search
Workspaces and permissions
OWNER permission record. Permission listing needs both instructions:read and instructions:publish; list/grant/revoke require workspace OWNER. Granting an existing principal updates their role.
Manuals and trees
OWNER. They retain rows but make the archived workspace/manual inaccessible through the current public API. tree --audience is an exact-match draft filter.
Pages
--format markdown always prints the machine-readable loss report alongside the render — nothing is silently down-converted. Content files accept a full canonical envelope or a bare doc node (the CLI wraps and checksums it locally).
Changesets
CREATE_PAGE operation with clientPageKey: "x" can be referenced by other operations in the same file as parentPageId: "new:x", in any order. Conflicted applies print structured conflicts and exit non-zero.
Versions and publications
instructions:publish plus workspace OWNER. Omitting every --audience publishes to all four audiences; pass one or more flags for a narrower release.
Private media
Docs-as-code: checkout, status, diff, sync
checkout writes each page as canonical JSON plus a manifest of page IDs, revisions, and checksums. Edit the files, inspect drift with status/diff, then sync pushes every modified page back as one revision-guarded changeset and advances the manifest. --dry-run validates first; --submit routes the sync through human review.