Repository navigation
fix(cli): keep component detail text a projection of its JSON - #6574
josephfarina merged 1 commit into
Conversation
The text view of `component <Name>` appended related block templates that the command looked up on its own, so the text showed data the --json envelope never carried. The list stays available through --blocks.
|
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.
Approval recommended for this focused CLI fix.
astryx component <Name> text output no longer prints the "Related block templates" records that the --json envelope never carried, which restores the documented rule that human output is a projection of the JSON and that text field names mirror JSON keys. The JSON output, other views, and the existing --blocks view — which still returns the block list in both text and JSON — are unchanged, so this is a contract-restoring, nonbreaking change with a patch Changeset.
The added regression test covers both sides: the JSON contains no related-block records and the text contains no dirName: records or related-blocks heading. One note for transparency: the test suite results reported in the PR were not independently rerun in this review, though the code, the --blocks preservation path, and the test assertions were inspected directly.
[Automated review]
PR Analysis Report
The exact-head preview is not available yet. Generated by PR Enrichment workflow | View current CI run |
User impact
Anyone who reads
astryx component <Name>as text, and any agent that compares the text withastryx component <Name> --json. The text view printed a "Related block templates" section: adirName/descriptionrecord for every block that uses the component (about 20 forButton). The--jsonenvelope has no such field. So the two views of one command disagreed, and the text held data a machine caller cannot get from that call. After this change the text shows only what the envelope holds. The block list stays one flag away:astryx component <Name> --blocksreturns it in both text and JSON.Problem and solution fit
findRelatedBlocks()on its own, after the API returned, and rendered the result. The API result never contained it.--jsonas the source of truth and the text as a view of it. A section that exists only in text drifts from the JSON, and agents that read JSON never learn it exists. It also made text mode do extra block discovery that JSON mode skips, so the two modes did different work.The fix removes the text-only lookup and its section. The same data stays reachable through the existing
--blocksview, which returns it in the envelope.Expected behavior and authority
docs/architecture/cli-surface.md(current):(
dirNameis not a key anywhere in thecomponent.detailenvelope.)Compatibility (
spec:AST-017FR3, FR5): the--jsonschema does not change. Only text that the envelope never carried is removed.Smallest restoration
clients/cli/commands/component/index.mjs: thecomponent.detailtext branch emits the formatted doc and nothing else, and the unusedfindRelatedBlocksimport goes. The--blocksview, the other detail levels and every JSON path are untouched.Evidence
astryx component ButtonprintsRelated block templatesand records such asdirName: AppShellMobileHookUsage.astryx --json component Buttoncontains nodirNameand no related-block field.astryx component Button --blocksstill lists the showcase, examples and related blocks.--detail brief|compact|fulltext for a component,--props,--source,--showcase,--blocks, and every--jsonenvelope.clients/cli/commands/component.test.mjs> "component text output" checks that the JSON has no related-block data and that the text has nodirName:records and no related-blocks heading. It fails onmainand passes with the fix. Reverting onlycomponent/index.mjsturns it red again.Scope
Testing