Skip to content

fix(cli): component and template show their doc text's commands with the reader's runner - #12211

Closed
josephfarina wants to merge 1 commit into
mainfrom
josephfarina/doc-text-commands-runner
Closed

josephfarina wants to merge 1 commit into
mainfrom
josephfarina/doc-text-commands-runner

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

User impact

astryx docs shows every command a doc names with the name the reader runs the CLI by: npx astryx …, pnpm exec astryx …, or the command a tool that runs the CLI declares. astryx component and astryx template did not. They printed the commands in a component's or a template's own doc text as written, bare:

$ npx astryx component CheckboxInput --props
- `labelIcon`: `ReactNode | IconType` - … See `astryx docs icons` for valid semantic names.

In a project without a global install, or through a tool that runs the CLI for you, a bare astryx may not run, and the same output's own pointer lines (npx astryx component CheckboxInput --props prints them whole) already used the right name. A {@command} token in that text was not rendered at all.

After this change, that text shows each command with the same name the rest of the output uses:

- `labelIcon`: `ReactNode | IconType` - … See `npx astryx docs icons` for valid semantic names.

JSON output keeps the doc text as written, as docs --json does.

Problem and solution fit

  1. Why does it happen? docs passes a doc's text through prefixCliCommands with the run's invocation when it prints it (clients/cli/commands/docs.mjs). component and template print their docs' text without that step, and component never renders tokens.
  2. Why does it harm the task? A command the CLI prints for its reader must start with the name that reaches the same version, and a bare astryx can fail or reach another version.
  3. Why does that matter? Agents run the commands they read, and this text points them to the docs they need next.

Expected behavior and authority

  • spec:AST-081 FR5: every command the CLI prints or writes for its caller to run starts with the command name the one picker chooses.
  • spec:AST-047 FR9: a link inside a doc's text reads as the command that opens its doc. It still does; in text, that command now starts with the picker's name.

Smallest restoration

  • foundation/doc-compiler/links.mjs: showDocText(text, stem) renders a text's tokens, then starts each CLI command with stem (prefixCliCommands), the two steps docs applies.
  • clients/cli/commands/component.mjs: the full, compact, brief and props views print the doc's text through it, with the run's invocation.
  • clients/cli/commands/template.mjs: the template descriptions it prints (the list and the skeleton header) go through it.

Evidence

  • An npm project with its own CLI, npx astryx component CheckboxInput --props: "See astryx docs icons" before, "See npx astryx docs icons" after. The --json output is the same before and after.
  • Regression tests: through a host's door (host astryx), component CheckboxInput --props shows "See host astryx docs icons" (fails before, passes after); showDocText starts a bare command and a token's command with the runner, leaves a code example and a non-command word alone, and changes nothing for the global command. The component doc-link test now reads its link as the door's command in text, and as written in JSON.

Scope

Components: CLI (component and template text output)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run --project node over clients/cli/commands/component*, clients/cli/commands/template*, foundation/doc-compiler, api/component, api/template, test/golden-reads.test.mjs and test/global-local*: 109 files; 1,023 passed and 2 failed, then both passed on a rerun (the doc-link test, updated above, and one test that timed out under load).
  • tsc --project tsconfig.strict.json, ESLint and Prettier on the changed files.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 17, 2026 2:10am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Nov 17, 2026, 2:09 AM UTC

@josephfarina

Copy link
Copy Markdown
Contributor Author

Closing in favor of #12212, which fixes the same bug in one place: emit starts the commands in a component's doc Markdown with the run's command, for component and discover. No template doc names a command today, so nothing here is lost.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Closed in favor of #12212, which fixes the same thing by prefixing the already-rendered doc text, so an escaped command token stays as written.

@github-actions
github-actions Bot deleted the josephfarina/doc-text-commands-runner branch November 17, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 5c9752ed Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant