An open source design system that's fully customizable and agent ready
TypeScript
docs(spec): admit CLI surface by tier and keep commands thin over the API (#6604)
Joey3b75f17a8e25
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex fcf2cff06e..bddf5c5864 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -357,7 +357,7 @@ That matters because a hand-written declaration _shadows_ the JSDoc in its `.mjsAuthor the docs _before_ the handler: `defineCommand` builds the Commander command from the `CommandDoc`, so the handler needs it to exist.1. Add the behavior under `api/<name>/`, with a colocated `<name>.type.mjs` (the `Options` + `{ type, data }` response typedefs — the shape source of truth) and a test.-2. Author the docs — a `FunctionDoc` at `api/<name>/<fn>.doc.mjs` and a `CommandDoc` at `clients/cli/commands/<name>.doc.mjs`. Copy the `search` pair as a template.+2. Author the docs — a `FunctionDoc` at `api/<name>/<fn>.doc.mjs` and a `CommandDoc` at `clients/cli/commands/<name>.doc.mjs`. Copy the `blog` pair as a template.3. Write the thin handler in `clients/cli/commands/<name>.mjs`, registering it with `defineCommand(program, <name>Command, {fn: <name>Fn, action})` so `--help` and the manifest come from the doc. Call its `register<Name>` from `clients/cli/index.mjs`.4. Run the checks below. The drift harness catches a doc that disagrees with the live command, and `check:cli-structure` catches a missing typedef, doc, or test.diff --git a/docs/architecture/cli-surface.md b/docs/architecture/cli-surface.mdindex 602200c8d4..807199d54f 100644--- a/docs/architecture/cli-surface.md+++ b/docs/architecture/cli-surface.md@@ -31,7 +31,7 @@ verified_by:clients/cli/commands/upgrade.integration-policy.test.mjs,clients/cli/formatters/index.test.mjs,]-deciding_specs: [spec:AST-017/DEC-4]+deciding_specs: [spec:AST-017/DEC-4, spec:AST-042/DEC-1, spec:AST-042/DEC-2]---# CLI surface architecture@@ -66,10 +66,11 @@ rather than left to the command author.3. **Work.** The command parses its arguments and calls a function in `api/`.The command is a thin wrapper: parse, call, render. The API function is theunit that is scriptable and typed, and it is the source of truth for the- `type` discriminator on its own envelope.+ `type` discriminator on its own envelope. `spec:AST-042` FR1 makes this the+ contract; INV20–INV22 fix where each part lives.4. **Render.** Exactly one of two paths. In `--json` mode, `jsonOut` writes a- single envelope. Otherwise the formatters render the same values as text.- Nothing else may write to stdout.+ single envelope. Otherwise the formatters render the same values as text,+ from a closed set of blocks (INV23). Nothing else may write to stdout.Discovery of components, templates, themes, codemods and docs is not per-command. Itgoes through the `Project` seam in `foundation/config`, which resolves the@@ -171,6 +172,45 @@ test, applicable text, and consumer-documentation projections.verification preserves that identity; `theme list` retains package ownership;`theme add --package` copies every listed file, including nested palette/tokenmodules, before `theme build` compiles the consumer-owned copy.+- **INV20 — A command's API subject has one layout.** A command's behavior lives+ in `api/<subject>/`. `<subject>.mjs` is the subject's entry, and `api/index.mjs`+ re-exports what it exports. A subject with more than one operation puts each in+ a leaf, `<leaf>/<leaf>.mjs`, and the entry dispatches to the leaves. Every+ exported function has a colocated `FunctionDoc` — `<subject>.doc.mjs` for the+ entry function, `<function>.doc.mjs` for any other — and response typedefs in a+ `*.type.mjs` file. Tests sit beside the module they cover as+ `<module>.test.mjs`. A private helper is an underscore-prefixed file, such as+ `_site.mjs`. `api/blog` is the reference layout.+- **INV21 — An API subject reaches the environment only through its adapter.**+ Within `api/<subject>/`, reading or writing files, network requests,+ subprocesses, loading the project or its modules, and discovery that reads the+ disk happen in the subject's adapter: `_adapter.mjs` and any underscore-prefixed+ helper that only it imports. The adapter may call foundation seams such as the+ `Project` seam and `assertWithin`. The entry and the leaves shape inputs and+ results and call the adapter; they do not import filesystem, network, or+ subprocess modules, the `Project` seam, or discovery and loader functions. A+ subject that needs no environment access has no adapter.+ `api/blog/_adapter.mjs` is the reference adapter.+- **INV22 — A command handler parses, calls, and renders.** A handler in+ `clients/cli/commands/` registers through `defineCommand` with its+ `CommandDoc`, and an executable command's `CommandDoc` names in `fn` the API+ function it calls. The handler parses its arguments, calls that function, and+ renders the result through `jsonOut` or the formatter kit. It reads no files,+ loads no project, runs no discovery, and starts no subprocess or network+ request; it may phrase hints with how the CLI was invoked, such as the package+ manager's run prefix. Only command handlers, their `CommandDoc` files, and+ their tests live in that directory. `clients/cli/commands/blog.mjs` is the+ reference handler.+- **INV23 — The formatter kit is closed.** Text output is built only from the+ block constructors in `clients/cli/formatters/index.mjs` — `section`, `text`,+ `list`, `record`, `records`, and `code` — and printed through `emit`. A handler+ does not pad strings to a width, align columns, or draw tables, and it defines+ no renderer of its own; it maps its data onto records, lists, and sections. A+ block kind is added to the kit, with its tests and its line in the help+ "Output format" list, only as `spec:AST-042` FR3 allows.++Some modules predate INV20–INV23 and do not meet them yet; `spec:AST-042` lists+the known gaps.## Change coupling@@ -181,9 +221,11 @@ updated in the same pull request when it moves an invariant:- adding an error code, or changing what an existing code means;- a change to a stable JSON envelope or discriminated response-entry fieldfollows `spec:AST-017/DEC-4`;-- adding a formatter, or writing to stdout from anywhere other than `emit` and- `jsonOut`;+- adding a formatter or block kind (INV23, `spec:AST-042` FR3), or writing to+ stdout from anywhere other than `emit` and `jsonOut`;- changing the file layout under `clients/cli/commands`;+- adding an API subject, leaf, adapter, or exported function, or giving an API+ module access to the environment (INV20–INV21);- changing an integration writer's receipt, no-clobber/rollback behavior,package.json mutation policy, or public subpath spelling;- changing what `integration pack --check` executes, resolves, or proves about@@ -219,30 +261,42 @@ non-interactive guarantee.catalog discovery, package-aware selection, source copy, and build.- `foundation/agent-docs` — the shared expected-block renderer and managed-filewriter used by init and upgrade.-- `api/<subject>/…` — the scriptable functions the commands wrap; each owns the- `type` on its own envelope.+- `api/index.mjs` — the public programmatic API, `@astryxdesign/cli/api`, which+ re-exports every subject's functions.+- `api/<subject>/…` — the scriptable functions the commands wrap, laid out as+ INV20 describes; each owns the `type` on its own envelope.+- `api/<subject>/_adapter.mjs` — the subject's only access to the environment+ (INV21).## Deciding specs- `spec:AST-017/DEC-4` — stable response fields and their complete projectionsare current compatibility authority.+- `spec:AST-042/DEC-1` — every command is a thin layer over one programmatic+ function.+- `spec:AST-042/DEC-2` — every command's text output uses one shared block+ vocabulary.## Verification-| Invariant | Evidence | Failure signal |-| --------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |-| INV1 | `clients/cli/commands/interactive-guard.test.mjs` | The subprocess hangs: `signal === 'SIGTERM'` and `status === null`. |-| INV2 | `clients/cli/commands/json-contract.test.mjs` | `--json` stdout does not parse, or parses to a shape outside the two. |-| INV3 | `foundation/response/error-codes.test.mjs` | A shipped code disappears, or an envelope carries an unregistered one. |-| INV4 | `clients/cli/formatters/index.test.mjs`, type tests | `emit` accepts a bare string, or output varies between pipe and TTY. |-| INV6 | `pnpm check:cli-structure` | A command's file or its doc is missing, or sits at the wrong path. |-| INV8 | `clients/cli/cli-exit-codes.test.mjs` | The same condition exits differently with and without `--json`. |-| INV14 | `foundation/integrations/autolink.test.mjs`, `foundation/config/project.test.mjs` | An undeclared package contributes, or configured/local precedence changes. |-| INV15 | `api/integration/add-contribution.test.mjs`, `clients/cli/commands/integration-authoring.test.mjs` | Dry-run/write paths differ, a writer clobbers bytes, or the new contribution is not discoverable. |-| INV16 | `foundation/integrations/manifest-writer.test.mjs`, `api/integration/add-contribution.test.mjs` | A writer invents package policy, replaces an author entry, or local bytes lose precedence. |-| INV17 | `api/integration/pack-check.test.mjs` | Lifecycle output, packed files, identities, or public imports diverge without failing the gate. |-| INV18 | `api/integration/validate-integration.test.mjs`, `api/theme/integration-themes.test.mjs` | Diagnostics mutate files, or a selected broken theme package is reported as merely unknown. |-| INV19 | `clients/cli/commands/integration-real-world.test.mjs` | A CLI-authored theme, nested palette, or guides fail across pack, install, list, add, and build. |+| Invariant | Evidence | Failure signal |+| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |+| INV1 | `clients/cli/commands/interactive-guard.test.mjs` | The subprocess hangs: `signal === 'SIGTERM'` and `status === null`. |+| INV2 | `clients/cli/commands/json-contract.test.mjs` | `--json` stdout does not parse, or parses to a shape outside the two. |+| INV3 | `foundation/response/error-codes.test.mjs` | A shipped code disappears, or an envelope carries an unregistered one. |+| INV4 | `clients/cli/formatters/index.test.mjs`, type tests | `emit` accepts a bare string, or output varies between pipe and TTY. |+| INV6 | `pnpm check:cli-structure` | A command's file or its doc is missing, or sits at the wrong path. |+| INV8 | `clients/cli/cli-exit-codes.test.mjs` | The same condition exits differently with and without `--json`. |+| INV14 | `foundation/integrations/autolink.test.mjs`, `foundation/config/project.test.mjs` | An undeclared package contributes, or configured/local precedence changes. |+| INV15 | `api/integration/add-contribution.test.mjs`, `clients/cli/commands/integration-authoring.test.mjs` | Dry-run/write paths differ, a writer clobbers bytes, or the new contribution is not discoverable. |+| INV16 | `foundation/integrations/manifest-writer.test.mjs`, `api/integration/add-contribution.test.mjs` | A writer invents package policy, replaces an author entry, or local bytes lose precedence. |+| INV17 | `api/integration/pack-check.test.mjs` | Lifecycle output, packed files, identities, or public imports diverge without failing the gate. |+| INV18 | `api/integration/validate-integration.test.mjs`, `api/theme/integration-themes.test.mjs` | Diagnostics mutate files, or a selected broken theme package is reported as merely unknown. |+| INV19 | `clients/cli/commands/integration-real-world.test.mjs` | A CLI-authored theme, nested palette, or guides fail across pack, install, list, add, and build. |+| INV20 | `pnpm check:cli-structure` checks that each subject has a `FunctionDoc`, typedefs, and a test; per-function coverage and leaf layout are checked in review | A subject or exported function lacks its `FunctionDoc`, typedefs, or tests, or an operation sits outside its subject. |+| INV21 | Review of imports under `api/**`; no mechanical check yet | A module other than a subject's adapter reads or writes files, contacts the network, starts a subprocess, loads the project, or runs discovery. |+| INV22 | Review of imports under `clients/cli/commands/**`; the docs drift harness checks each `CommandDoc` against the live command | A handler reaches the environment itself, an executable command's `CommandDoc` names no `fn`, or a non-command file sits in the directory. |+| INV23 | `clients/cli/formatters/index.test.mjs` for the kit; review of handlers; no mechanical check yet | A handler pads, aligns, or draws text itself, or a block kind is missing from the help "Output format" list. |## Open questionsdiff --git a/docs/contributing/cli-conventions.md b/docs/contributing/cli-conventions.mdindex 9fbfdcd1c5..dee419f35d 100644--- a/docs/contributing/cli-conventions.md+++ b/docs/contributing/cli-conventions.md@@ -1,8 +1,9 @@# CLI conventions for contributors-This guide turns the CLI surface architecture into the steps you follow when-you change `packages/cli`. It does not create policy. Where it and-`docs/architecture/cli-surface.md` disagree, the architecture record wins.+This guide turns the CLI surface architecture (`docs/architecture/cli-surface.md`)+and the admission rules (`docs/specs/AST-042-cli-command-admission/spec.md`) into+the steps you follow when you change `packages/cli`. It does not create policy.+Where it disagrees with either record, the record wins.## Who the CLI is for@@ -29,11 +30,23 @@ commands on it. Most valuable work makes an existing command answer better.## Adding a command-**A new command needs approval from a code owner of `packages/cli` before you-write it.** `.github/CODEOWNERS` is the source of truth for who that is. Open-the proposal first: a command is a permanent concept — it appears in help, in-the manifest, in the README, and in every agent's cheat sheet, and removing one-is a breaking change.+The bar depends on the tier (`spec:AST-042` FR4):++- **A new top-level command** needs a current system spec that authorizes it,+ approved by an approval owner (an owner listed in the knowledge schema's+ `approvalOwners`). Write the spec first.+- **A new subcommand** stays inside its parent's one job. State its case in the+ pull request, and get approval from a code owner of `packages/cli`.+ `.github/CODEOWNERS` is the source of truth for who that is.+- **A new flag** follows the flag rules below and needs no extra approval.++Propose a command before you write it: a command is a permanent concept — it+appears in help, in the manifest, in the README, and in every agent's cheat+sheet, and removing one is a breaking change.++Every command is a thin layer over one exported `api/` function: parse the+arguments, call the function, render the result. The function does the work, so+an agent that scripts the API gets the same result as one that runs the command.A command earns its place when all four hold:@@ -51,9 +64,10 @@ topic.## Adding a flag-Flags are more forgiving than commands, and they do not need a proposal. They-are not free: every flag is a branch an agent has to know about, and a-combination somebody has to keep working.+Flags are more forgiving than commands, and they do not need a proposal, but+`spec:AST-042` FR5 makes the rules below binding. They are not free: every flag+is a branch an agent has to know about, and a combination somebody has to keep+working.A good flag:@@ -96,6 +110,19 @@ A name is a promise across the whole CLI. Two rules:- **No command is forced to carry a flag because a sibling has it.** Alignment is onmeaning, not on presence.+## Where the code goes++Copy `api/blog` and `clients/cli/commands/blog.mjs`. They are the reference+layout (`cli-surface` INV20–INV22).++- The behavior lives in `api/<subject>/`: an entry `<subject>.mjs`, one leaf+ folder per operation, a `FunctionDoc` and typedefs for each exported function,+ and tests beside the code they cover.+- Anything that touches the environment — files, the network, subprocesses,+ loading the project or running discovery — goes in the subject's+ `_adapter.mjs`. The leaves only shape the result.+- The handler in `clients/cli/commands/` only parses, calls, and renders.+## Output: use the shared functionsNever call `console.log`. Every path is provided:@@ -112,7 +139,9 @@ Never call `console.log`. Every path is provided:`emit` accepts only a renderer-produced `Block`, so a bare string will notcompile. Keep text field names identical to the JSON keys — the text output is-a view of the envelope, not a separate design.+a view of the envelope, not a separate design. Do not pad strings, align+columns, or draw tables yourself; map rows onto `records()`. A new block kind+needs the evidence that `spec:AST-042` FR3 asks for.## Errors: every failure carries a code@@ -146,11 +175,15 @@ change.## Checklist before you open the pull request-- [ ] For a new command: a code owner approved the proposal.+- [ ] For a new top-level command: a current spec authorizes it. For a new+ subcommand: a code owner approved its case.+- [ ] The handler only parses, calls one exported `api/` function, and renders;+ the subject's adapter does any file, network, or project access.- [ ] One file per command, with its sibling doc file.- [ ] `--json` returns one envelope; the `type` matches the API function.- [ ] Every failure path carries a code; new codes are appended, never edited.-- [ ] No `console.log`; all human output goes through the formatters.+- [ ] No `console.log`; all human output goes through the formatters, with no+ hand-padded columns.- [ ] Text field names match the JSON keys.- [ ] Exit code is the same with and without `--json`.- [ ] The composition matrix is closed: every pair composes with a test, is@@ -164,6 +197,8 @@ change.- **A flag that only a maintainer would pass.** It is a debugging affordance;keep it out of the surface.- **A new command whose summary contains "and".** Two commands.+- **A handler that reads files or loads the project.** That work belongs in the+ API subject's adapter.- **A flag added because another command has one.** Presence does not have toalign; meaning does.- **A composition cell nobody decided.** The most common defect in a flag PR.diff --git a/docs/specs/AST-042-cli-command-admission/spec.md b/docs/specs/AST-042-cli-command-admission/spec.mdnew file mode 100644index 0000000000..34d03f90ef--- /dev/null+++ b/docs/specs/AST-042-cli-command-admission/spec.md@@ -0,0 +1,215 @@+---+schema_version: 4+template_version: 1+kind: system-spec+id: spec:AST-042+authority: current+archive_reason: null+superseded_by: null+approved_by: josephfarina+approved_at: 2026-09-24+phase: accepted+owners: [josephfarina]+affects_architecture: [architecture:cli-surface]+affects_families: []+affects_contributing: [contributing:cli-conventions]+affects_consumer_docs: []+---++# CLI command admission and programmatic parity system spec++## Intent++Agents learn the Astryx CLI from its help, its manifest, and their own notes, and+they script the same operations through the programmatic API. Each command,+subcommand, and option that ships becomes surface that agents depend on, and+removing one is a breaking change. Before writing code, a contributor needs to+know whether new behavior belongs in an existing command, a new option, a new+subcommand, or a new top-level command, and what each of those needs.++This record owns what each kind of CLI surface needs before it is added, the rule+that every command is a thin layer over one documented and tested programmatic+function, and the vocabulary that human-readable output may use.++## Non-goals++- Where command, API, adapter, and formatter code lives, and which modules may+ read the environment. `architecture:cli-surface` INV20–INV23 own that+ structure.+- Discoverability, environment variables, global options, and configuration.+ `spec:AST-017` FR14–FR20 own those rules.+- Classifying a removal, rename, or behavior change. `spec:AST-017` FR1–FR8 own+ compatibility.+- The JSON envelope, error codes, and generated help. `architecture:cli-surface`+ INV2, INV3, and INV7 own them.+- Equivalent internal implementations remain valid when they satisfy this contract.++## Requirements++- **FR1 — Every command is a thin layer over one programmatic function.** Every+ command or subcommand that performs an operation MUST perform it by calling one+ function exported from `@astryxdesign/cli/api`. Called with the same inputs,+ that function MUST perform the same operation and return the same result that+ the command emits under `--json`. The command adds only argument parsing,+ rendering, and exit status; rendering MAY use how the CLI was invoked, such as+ the package manager's run prefix, to phrase hints. It MUST NOT read project+ state, change files, contact the network, or produce a result field or effect+ that the function does not produce. A command that only groups subcommands is exempt, and so is a+ command that only describes the CLI itself, such as help, the version, or the+ capability manifest. This requirement names `@astryxdesign/cli/api` because+ automation depends on it under `spec:AST-017` FR14.+- **FR2 — The programmatic API is documented and tested.** Every function+ exported from `@astryxdesign/cli/api` MUST have reference documentation that+ states its parameters, each option and its default, its result types, the error+ codes it can return, and at least one example. Tests MUST exercise each+ documented option, each result type, and each documented error code, and MUST+ fail when that behavior is removed. Every command MUST also have tests that run+ the CLI and check its `--json` result, its human-readable output, and its exit+ status, for at least one success and one failure.+- **FR3 — Human-readable output uses one shared vocabulary.** Human-readable+ output MUST use only the block kinds that generated help documents: Record,+ Section, List, Text, and Code. A Text block carries prose. Items and field+ values MUST use Record, Section, or List blocks, never columns or tables that a+ command builds from characters itself. Content authored in a documentation+ source, such as a heading or a table in a reference doc, follows the same rule.+ A command MUST NOT define an output format of its own. When no existing block+ can express an output without losing information a reader needs, such as a+ table too large to read as records, the answer is a new shared block kind, not+ a command-specific renderer. A new block kind changes the output of every+ command, so it MUST be justified by that evidence, MUST be available to every+ command, and MUST appear in generated help in the same change.+- **FR4 — New surface is admitted by tier.** Each addition MUST pass the test for+ its tier before it merges.+ - **Top-level command.** A new `astryx <command>` MUST cite a current system+ specification that authorizes it, approved by an approval owner (an owner listed in the knowledge schema's `approvalOwners`). That specification MUST state the+ question a consumer or agent has that no existing command answers; the+ existing command closest to answering it, and why extending that command is+ wrong; the one job the command does, stated without "and"; why its result is+ data rather than prose, which belongs in a docs topic; and the function that+ FR1 requires.+ - **Subcommand.** A new subcommand MUST stay inside its parent command's one+ job. Its pull request MUST state the question it answers, why an option on+ the parent or on an existing subcommand cannot answer it, and the function+ that FR1 requires. A code owner of the CLI package MUST approve it.+ - **Option.** A new option on an existing command MUST meet FR5 and+ `spec:AST-017` FR14–FR15. Normal review is enough.++ Behavior that fails the test for its tier is not admitted at that tier. It+ becomes an option, a subcommand, a docs topic, or an improvement to an existing+ command instead.++- **FR5 — Options change what a command produces, predictably.** An option MUST+ narrow or redirect work that its command already does, and MUST NOT give the+ command a second job. Its default MUST be the right result for most callers. A+ boolean option MUST default to off; behavior that is on by default gets a named+ opt-out, not a flag that defaults to true. An option that changes only how the+ same result is presented is a global presentation option and MUST meet+ `spec:AST-017` FR15. An option name MUST mean the same thing, spelled the same+ way, on every command that has it, and no command must carry an option because+ a sibling has it. An option MUST NOT exist to work around a defect. Every pair+ of options on a command MUST have a decided result: they compose and a test+ proves it, they are refused together with a stable error code, or another rule+ already prevents the pair.+- **FR6 — Moving surface is an admission.** Renaming a command, moving behavior+ into a new command, or promoting a subcommand to a top-level command is an+ admission at the new tier and MUST pass that tier's test. Removal and renaming+ also follow `spec:AST-017` FR1–FR8.++### Platform support++- Supported feature/engine floor: every supported CLI runtime.+- Unsupported behavior: none.+- Browser evidence: not applicable.++## Current-state impact++`architecture:cli-surface` INV20–INV23 carry FR1–FR3 into the code: the layout of+an API subject, the adapter as a subject's only access to the environment, thin+command handlers, and the closed formatter kit. `contributing:cli-conventions`+restates FR4 and FR5 for contributors.++The CLI has 17 top-level commands. The command docs of 28 commands and+subcommands name the function they call. Known gaps, for which this record does+not assign migrations:++- `theme template` calls a function that `@astryxdesign/cli/api` does not+ export (FR1);+- the component, discover, layout, search, template, and theme handlers read+ project state or files themselves (FR1);+- the theme handler draws its target table from characters, and the docs+ handler renders authored headings and tables with its own code (FR3); both+ are candidates for one shared block kind under FR3, not two command+ renderers;+- several API subjects read or write the environment outside an adapter, and the+ `integration` subject keeps flat modules without leaves+ (`architecture:cli-surface` INV20–INV21);+- the reference docs of 14 exported functions, most of them in the+ `integration` subject, do not state the error codes they can return (FR2);+- the structure check confirms that each API subject has at least one reference+ doc, typedef file, and test, but not that each exported function or command is+ covered (FR2).++No mechanical check enforces FR1, the per-function part of FR2, FR3, FR4, FR5,+`architecture:cli-surface` INV21, or most of INV22 and INV23 yet. Review applies+them to every new change; until mechanical checks land, a new violation fails+only in review. The checks and the closure of the gaps above land as separate+changes.++This specification change alters no runtime behavior or published package and+needs no Changeset.++## Verification++| Contract | Verification | Representative states | Mutation or failure expectation |+| -------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |+| FR1 | Command inventory from the manifest, matched to `@astryxdesign/cli/api` exports; paired CLI and API runs on one input | each executable command and subcommand; a group; the manifest | A command has no exported function, or emits a field or effect that its function does not |+| FR2 | Reference-doc inventory for every export; per-function tests; command-level CLI tests | each option, result type, and documented error code; one success and one failure per command | Removing a documented behavior leaves every test passing |+| FR3 | Text-output snapshots per command; the help snapshot | each block kind; a list of items; a result shaped like a table | A command prints a layout outside the documented blocks, or a new block kind is missing from help |+| FR4, FR6 | The admitting pull request and the authority it cites | top-level command, subcommand, option, rename, promotion | A top-level command lands without a current specification, or a subcommand lands without its stated case and code-owner approval |+| FR5 | Option composition tests per command | each option pair; a boolean default; a shared option name | A pair has no decided result, a boolean defaults to on, or one name has two meanings |++## Decision log++### DEC-1 — Commands are thin layers over the programmatic API++**Reference:** `spec:AST-042/DEC-1`+**Decider:** `josephfarina`, `2026-09-24`++One function owns each operation. An agent that runs the command and an agent+that scripts the API get the same result, and the behavior is tested once, where+it lives. The command only turns arguments into a call and a result into output.++Rejected: behavior implemented in the command handler, and features that only the+command offers. Both drift from the API, and automation cannot reach them.++### DEC-2 — One output vocabulary for every command++**Reference:** `spec:AST-042/DEC-2`+**Decider:** `josephfarina`, `2026-09-24`++Agents grep the text output and people read it. One small set of blocks keeps+every command's output predictable and keeps it a view of the JSON result.++Rejected: per-command renderers and tables drawn from characters. They drift from+the JSON result and from each other, and each one is a format that agents must+learn separately.++### DEC-3 — Admission bars scale with permanence++**Reference:** `spec:AST-042/DEC-3`+**Decider:** `josephfarina`, `2026-09-24`++A top-level command is a permanent concept in every agent's working set, so it+needs a current specification from an approval owner. A subcommand lives inside+one command's job, so a stated case and a code owner's approval are enough. An+option narrows work a command already does, so the option rules and normal review+are enough.++Rejected: one bar for every addition, which either blocks small options or lets+top-level commands in too easily; and adding a top-level command to make behavior+easier to find, because help and docs make behavior discoverable under+`spec:AST-017` FR14.++## Open questions++None.