Repository navigation
fix(cli): component docs print their commands with the project's runner in text - #12212
Conversation
…er in text
A component doc's {@command} tokens and {@link} targets render to the bare
astryx command, which astryx docs shows with the project's command in text.
astryx component and discover's component detail printed it bare. Markdown
code blocks now carry their kind, and emit shows their commands with the
project's command through the same prefixCliCommands docs uses; JSON keeps
the bare command, and verbatim blocks keep their bytes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
Reopened: #12211 was closed in favor of this one, so this is the one change for component and |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Requesting changes: the fix restores the project's command in component and discover doc text and keeps --json bare, but one claim in the description does not hold.
packages/cli/api/component/doc-links.test.mjs:201also matches the bare`astryx docs acme-setup`and passes againstmain, so the test does not "expect the text read to show the runner" as the description says; addexpect(text.stdout).not.toContain('`astryx docs acme-setup`');after it (that fails onmainand passes here) or drop the claim.
CI's test jobs did not run on this head because the run was refused for capacity, so re-run all jobs with the next push.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim:
astryx docsalready shows doc commands with the project's command through the shared prefix helper: verified. - Claim:
astryx componentandastryx discover <package>/<Component>printed doc commands bare: verified onmain. - Claim: Markdown-marked code blocks are doc text and
emitprefixes only those: verified (formatters/index.mjs). - Claim: component detail at every level,
--props, the full list anddiscover's component detail print as Markdown blocks: verified. - Claim:
{@command …}tokens,{@link …}targets and bareastryxcode spans all get the project's command in text: verified by the new tests and a stricter{@link}check. - Claim:
--jsonkeeps the bare command: verified (test). - Claim: template source, skeletons and other verbatim blocks print as written: verified (test; no marker on those blocks).
- Claim: a Core prop doc's bare command shows the host door's command: verified (test fails on
main, passes here). - Claim: the new regression test fails on
mainfor the three detail levels: verified. - Claim:
doc-links.test.mjsnow expects the text read to show the runner: false (its assertion also matches the bare command). - Claim: template descriptions still print doc tokens as written (out of scope): verified.
- Claim: the CLI tests, ESLint and Prettier pass: verified, apart from three environment-bound test files that fail the same way on
main. - File:
.changeset/component-doc-commands-runner.md: clear. - File:
packages/cli/clients/cli/formatters/index.mjs: clear. - File:
packages/cli/clients/cli/commands/component.mjs: clear. - File:
packages/cli/clients/cli/commands/discover.mjs: clear. - File:
packages/cli/clients/cli/commands/command-tokens.text.test.mjs: clear. - File:
packages/cli/api/component/doc-links.test.mjs: finding above.
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
The earlier finding is fixed: the component-links test now also checks that text no longer prints the bare astryx docs acme-setup, and that check fails against main. Component and discover <package>/<Component> doc text now print commands with the project's command, and --json keeps them bare.
Two optional follow-ups: a picked command name that itself starts with astryx is applied twice to commands the formatter already picked (no conforming door has such a name), and one assertion on discover <package>/<Component> in command-tokens.text.test.mjs would pin that path.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules since the last review: changed rules (0): none.
- Claim:
astryx docsalready shows doc commands with the project's command through the shared prefix helper: verified. - Claim:
astryx componentandastryx discover <package>/<Component>printed doc commands bare: verified onmain. - Claim: doc tokens render bare so JSON carries one form, and text puts the project's command in front: verified.
- Claim: every printed command must start with the command the picker chooses: verified against the global-mode spec.
- Claim: Markdown-marked code blocks are doc text and
emitprefixes only those: verified (formatters/index.mjs). - Claim: component detail at every level,
--props, the brief-entry list anddiscover's component detail print as Markdown blocks: verified. - Claim: template source, skeletons and other verbatim blocks print as written, and prose blocks are unchanged: verified (test; no marker on those blocks).
- Claim: the
docscommand's header states the bare-in-docs, prefixed-in-text rule: verified. - Claim: no JSON change and no new option: verified.
- Claim: with an integration command, full, compact, brief and
--propsprinted the bare command and now print the integration's command: verified (tests fail onmain, pass here). - Claim: a Core prop doc's bare command shows the host door's command: verified (test fails on
main, passes here). - Claim:
--jsonkeeps the bare command andastryx templatekeeps the source comment: verified (tests). - Claim: the new regression test fails on
mainfor the three detail levels: verified. - Claim: the component-links test now expects the runner and no longer the bare command, and that assertion fails on
main: verified. - Claim: one defect, no tag-alongs, no new public API, no internal context: verified.
- Claim: template docs and
search/buildtext are out of scope and unchanged: verified. - Claim: the CLI tests, the repository checks, ESLint and Prettier pass: verified, apart from three environment-bound test files that fail the same way on
main. - Claim (release note): component and
discoverdoc commands print with the project's command,--jsonstays bare: verified. - File:
.changeset/component-doc-commands-runner.md: clear. - File:
packages/cli/clients/cli/formatters/index.mjs: clear (optional follow-up above). - File:
packages/cli/clients/cli/commands/component.mjs: clear. - File:
packages/cli/clients/cli/commands/discover.mjs: clear (optional follow-up above). - File:
packages/cli/clients/cli/commands/command-tokens.text.test.mjs: clear. - File:
packages/cli/api/component/doc-links.test.mjs: clear (earlier finding fixed).
User impact
A component doc can write a command with a doc token,
{@command docs icons}, or link to a doc with{@link …}.astryx docsshows such a command the way the project runs the CLI, for examplepnpm exec astryx docs iconsor the command an integration declares.astryx componentandastryx discover <package>/<Component>printed it as a bareastryx docs icons, which does not run in a project where the CLI is only reachable through the package manager. An agent that copies the command gets "command not found" and has to guess the runner.Problem and solution fit
astryx …command on purpose, so JSON readers get one runnable form. Text output then puts the project's command in front.astryx docsdoes that step (prefixCliCommands); the component text formatters print the rendered Markdown without it.astryxis right only where the global copy answers.code()blocks markedlang: 'markdown'are doc text.emitshows the bareastryxcommands in them with the project's command, through the sameprefixCliCommandsthatastryx docsuses. The component detail (all detail levels),--props, the brief list, anddiscover's component detail print as Markdown blocks. Any othercode()block, such as a template's source or a skeleton, still prints byte for byte, and prose blocks are unchanged.Expected behavior and authority
spec:AST-081FR5: every command the CLI prints for its caller to run starts with the command name the picker chooses.packages/cli/clients/cli/commands/docs.mjsheader: docs write commands as bareastryx …; text output prefixes them with the project's invocation, and JSON keeps them bare.Smallest restoration
packages/cli/clients/cli/formatters/index.mjs: aBlockknows whether it is doc Markdown;code(source, {lang: 'markdown'})marks it;emitprefixes only those blocks.component.mjsanddiscover.mjsmark their component Markdown.Evidence
{@command docs icons}, in a project whose integration declarescliCommand: 'acme astryx'.astryx component AcmeCard(full, compact, brief) printed`astryx docs icons`.`acme astryx docs icons`;--propsdoes too for a prop description.host astryx,astryx component CheckboxInput --propsprints "See`host astryx docs icons`" (it printed`astryx docs icons`).--jsonstill carries`astryx docs icons`;astryx template acme-boardprints the template's source with its`astryx docs icons`comment as written.packages/cli/clients/cli/commands/command-tokens.text.test.mjs(fails on the base for the three detail levels, passes here).api/component/doc-links.test.mjsnow expects the text read to show the runner and no longer the bare command (that assertion fails on the base).Scope
Components: CLI text formatters,
astryx component,astryx discoverOut of scope, same family: template docs do not render doc tokens at all yet (a
{@command …}in a template's description prints as written inastryx template,build, andsearch), andastryx search/astryx buildtext print component and template descriptions as their JSON does. Both need their own change.Testing
pnpm exec vitest run --project node packages/clipnpm check:repo; ESLint and Prettier on the changed files.