Repository navigation
fix(cli): return the build playbook as data, and render the text from it - #6566
Conversation
`build` with no query printed a whole playbook in the terminal while `--json`
and `build()` returned only `{playbook: true}`, so the text was not a
projection of the envelope. The steps, rules and related lookups now live in
the `build.help` data, with bare commands the renderer prefixes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
The build playbook is now returned as data, and the terminal output is rendered from it — this looks ready to approve.
build.helpkeepsplaybook: trueand itstype, and additively carries the title, steps with bare-subcommand commands, rules, and related lookups, so--jsonand programmatic callers get the same guidance the terminal shows.- The new fields land with their typedef, shape and text-projection tests (including exact command count/order and registered-command checks), FunctionDoc entry, and updated response-type/README documentation, as the stable-response contract requires.
- Compatibility is preserved for existing consumers, the composition-kit path is unchanged, and the one wording correction ("a recommended start" instead of a "Compose:" suggestion) matches what the kit actually prints.
[Automated review]
The playbook renderer padded its command lines into a comment column by hand. AST-042 FR3 and cli-surface INV23 keep layout in the formatter kit, so each step's commands are now records (command, purpose) whose field names match the JSON keys, the rules are a list, and the test reads the records instead of the padded lines.
There was a problem hiding this comment.
The build playbook is now returned as data, rendered with the shared formatter kit — this looks ready to approve.
build.helpkeepsplaybook: trueand itstype, and additively carries the title, steps with bare-subcommand commands, rules, and related lookups, so--jsonand programmatic callers get the same guidance the terminal shows.- The terminal rendering now uses shared records, list, and section blocks with field names matching the JSON keys, instead of a hand-padded comment column, which is what the shared-output-vocabulary rule requires.
- The new fields land with their typedef, shape and text-projection tests (including exact command count/order, registered-command, and no-hand-drawn-column checks), FunctionDoc entry, and updated response-type/README documentation, as the stable-response contract requires.
- Compatibility is preserved for existing consumers, the composition-kit path is unchanged, and the one wording correction ("a recommended start" instead of a "Compose:" suggestion) matches what the kit actually prints.
[Automated review]
PR Analysis Report
No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression19 of 420 shot(s) changed. View the report A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | View full report |









User impact
Any agent or script that asks
buildfor its playbook through the machine surfaces.astryx buildin a terminal prints a four-step workflow, the on-system rules and follow-up commands;astryx --json buildandbuild()from@astryxdesign/cli/apireturned only:{"apiVersion": 1, "type": "build.help", "data": {"playbook": true}}So the caller the CLI is designed for got a boolean, and anything that wanted the guidance had to copy the prose by hand and keep it in sync. After the change the envelope carries the playbook, and the terminal output is rendered from those same values.
Problem and solution fit
printPlaybook()in the command file, as hard-coded prose with the caller's package-manager invocation interpolated. The API leaf returned a marker for the renderer to expand.--jsonand the programmatic API could not answer the one questionbuildwith no query exists to answer.build.kitalready solves it forhint.commands: carry bare subcommands in the data and let the renderer prefix them.The API now returns
{playbook: true, title, steps, rules, related}. Each step has atitle, itscommands({command, purpose?}, bare subcommands) and an optionalreturns. The command renders those values; nothing in the text is absent from the envelope.Expected behavior and authority
docs/architecture/cli-surface.md(authority: current):--jsonmode,jsonOutwrites a single envelope. Otherwise the formatters render the same values as text."docs/specs/AST-017/spec.md(authority: current), DEC-4: every field in a stable response keeps "its canonical type, contract tests, applicable text output, and complete consumer documentation aligned in the same change." The new fields have a typedef, tests, the text projection, the FunctionDocreturnsentry and the README response-type row.Compatibility (AST-017 FR5/FR13): additive.
typeanddata.playbook: trueare unchanged; old consumers keep working.Smallest restoration
api/build/help/help.mjsreturns the playbook content;api/build/build.type.mjstypes it.clients/cli/commands/build.mjsrenders that data instead of its own copy.returnsentry, and the one-linebuild.helpdescription infoundation/response/response-types.doc.mjswith the regenerated README row. The old description ("a marker the renderer expands") would be false after this change.The content moved as written with three edits a structured shape forced or that would otherwise put a false statement into a new public field: the commands embedded in rule and tip prose (
docs tokens,search <query>) becamerelatedentries so they can be rendered with the caller's invocation; the tip's first sentence repeated step 1 and was dropped; step 1 promised a "Compose:" suggestion the kit no longer prints, and now says "a recommended start", which is what the kit shows.Evidence
astryx --json buildprinted{"playbook": true}as its entiredata, whileastryx buildprinted the full playbook.astryx --json buildcarries the title, three steps (five commands), three rules and two related lookups;astryx buildprints the same steps, commands, rules and lookups, each command prefixed with the project's own invocation.astryx build "<idea>"(the kit) is untouched; its tests pass unchanged.clients/cli/commands/build.playbook.test.mjschecks that the text prints exactly the envelope's commands (same count, same order), every step title,returns, rule and purpose, and that every command names a registered CLI command;api/build/build.test.mjschecks the data shape. Reverting the whole fix fails all three; reverting only the renderer fails the projection test; reverting only the data fails all three.Scope
Testing