[AAASM-421] ✨ (aa-cli): aasm docs export — CLI reference auto-generation#1050
[AAASM-421] ✨ (aa-cli): aasm docs export — CLI reference auto-generation#1050Chisanan232 wants to merge 3 commits into
Conversation
Walk the live `clap::Command` tree (never a hand-listed set) and emit one Markdown file per command — synopsis, usage, options table, subcommand links, and examples sourced from `#[command(after_help)]`. Each page carries a stable `#cmd-aasm-<path>` anchor for durable cross-links. `--check` re-renders in memory and compares against the on-disk `docs/cli/` tree, exiting non-zero (and listing stale/missing/orphaned files) when they differ, so the committed reference cannot drift from the CLI definitions. Refs AAASM-421 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Output of `aasm docs export --format markdown --out docs/cli/` — one Markdown page per command (81 files). Committed so `aasm docs export --check` (and the CI job) has a baseline to diff against. Refs AAASM-421 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Runs `aasm docs export --check` on every PR touching aa-cli/ or docs/cli/. A clap definition change that forgets to regenerate the committed reference fails the build instead of silently drifting. Refs AAASM-421 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 Claude Code — PR reviewTicket: AAASM-421 — Implement CI — ✅ all greenAll required checks pass, including the new Scope vs. acceptance criteria
Core feature is fully delivered and self-validating. The two ⏸️ items are genuinely blocked on docs-sync infra that doesn't exist yet — correctly deferred and noted in the PR body, with subtask AAASM-583 carrying the release-dispatch wiring. Lane / conflict check — ✅ cleanOnly Note for reviewer (non-blocking)
ReadinessReady to merge pending one Pioneer-team approval. CI green, real Rust validated ( Recorded as a review note; no formal approval submitted. |
|
🏷️ Held open — This documentation is written out in full detail and the review is green/ready, but the team is still deliberating on the documentation content/structure. Per maintainer decision, keep this PR open and do not merge until that discussion concludes. The — Claude Code |
Description
Adds an
aasm docs exportsubcommand that auto-generates theaasmCLI reference from the liveclapcommand tree — never a hand-maintained list — so the docs cannot drift from the actual CLI surface.aasm docs export --format markdown --out docs/cli/walkscrate::Cli::command()recursively (get_subcommands()), emitting one Markdown file per command with: synopsis (fromabout/long_about), usage (clap's own rendered usage, rewritten to the full command path), an options table (flags, value placeholders + enumerated possible values, defaults, required markers), a subcommands table linking children by stable anchor, and an examples block sourced from#[command(after_help = …)].#cmd-aasm-<path>(e.g.#cmd-aasm-agent-list) for durable cross-links.aasm docs export --checkre-renders in memory and diffs against the on-diskdocs/cli/tree, exiting non-zero (and listing stale / missing / orphaned files) when they differ. This is what CI runs.docs/cli/so--checkhas a baseline.Type of Change
Breaking Changes
Related Issues
Deferred follow-up (depends on AAASM-303)
The stretch goal — firing
repository_dispatch(event_type: docs-release, payload{ tag, paths: ["docs/cli/"] }) toagent-assembly-docson release — is deferred to AAASM-303. The docs-sync infra it depends on is not present in this repo (the only existingrepository_dispatchwiring inrelease.ymltargets the SDK repos withagent-assembly-release-published, not adocs-releaseevent toagent-assembly-docs). Per the ticket, rather than invent cross-repo wiring, the export +--check+ PR CI job are implemented now and the release-dispatch is left as a dependent follow-up under AAASM-303.Testing
12 unit tests in
aa-cli/src/commands/docs/export.rscover: a page per root + nested command, thehelppseudo-command being skipped, stable anchor derivation, synopsis/options/subcommands sections, examples surfaced fromafter_help, subcommand links using stable anchors, and--checkpassing on fresh output / failing on modified / missing / orphaned pages.Validation (scoped to
-p aa-cliand deps; some workspace crates e.g. eBPF don't build on macOS):cargo build -p aa-cli— passcargo clippy -p aa-cli --all-targets -- -D warnings— cleancargo fmt -p aa-cli --check— cleancargo nextest run -p aa-cli— 597 passed (incl. 12 new docs tests)aasm docs exportthenaasm docs export --check→ exit 0 on fresh output; verified exit 1 (listing the exact stale files) when a clapaboutis changed without regenerating.CI
New workflow
.github/workflows/cli-reference.ymlbuildsaasmand runsaasm docs export --check --out docs/cli/on every PR (and master push) touchingaa-cli/**ordocs/cli/**. Note: org GitHub Actions billing has been intermittently blocked, so CI may not execute on this PR — validated locally as above (actionlintclean on the workflow).Checklist
cargo fmt,cargo clippy)Held for review.
🤖 Generated with Claude Code