Repository navigation
fix(cli): template docs never print a raw {@command} or {@pm} token; build and search text show doc commands with the project's command - #12214
Conversation
|
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.
Changes requested: template doc tokens now render on every surface the new test covers, but one text view still prints a bare command, and the title promises more than the fix does.
astryx build <query> --verboseprints the chosen TEMPLATE's description withoutdocText(packages/cli/clients/cli/commands/build.mjs:274), so a project whose integration declares its own CLI command still sees a bare`astryx …`command there; adddescription: docTextto that record and a--verbosecase totemplate-doc-tokens.test.mjs.- The title says template docs "never print a raw doc token", but a
{@link …}token in a template description still prints as written intemplate,buildandsearch; narrow the title to the{@command}and{@pm}tokens the changeset names, or resolve links in those views too.
The rest checks out: JSON stays bare with an unchanged shape, a template's source still prints byte for byte, and the new test fails on the base as described.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a template doc's command and package-manager tokens no longer print as written in template list, skeleton, build and search. Verified: the new test, and a package-manager token checked on each surface.
- Claim: text shows those commands with the project's command, as the docs command does. Verified for template list, skeleton, plain build and search; false for
build --verbose(build.mjs:274). - Claim: JSON carries the bare
astryx …command and keeps its shape. Verified: the test's JSON assertions; the diff changes values only. - Claim: build and search text show every description's commands with the project's command. Verified for search (
search.test.mjs); false forbuild --verbose(build.mjs:274). - Claim: a template's source still prints byte for byte. Verified: the source case passes on base and head.
- Claim: before the change, the four surfaces printed the raw token in text and JSON. Verified: 4 of the new test's 5 cases fail on the base.
- Claim: component docs and topics already render their tokens, and template docs did not. Verified in the docs adapter and the base template APIs.
- Claim: template discovery keeps the authored text, so a docs link to a template renders its summary once and an escaped token stays written. Verified: discovery is unchanged and the docs adapter renders a linked template's summary once.
- Claim: no new option and no JSON shape change. Verified: no command doc changes.
- Claim: every printed command starts with the picked command and JSON stays bare (the global-mode spec, FR5, and the docs command's header). Verified against both.
- Claim: the new test fails 4 of 5 cases on the base and the source case passes on both. Verified by running it on the base.
- Claim: the search field-mirror test now expects prefixed commands in text. Verified: it passes on the head.
- Claim: the listed test, lint and format commands pass. The template, build, search, API and formatter suites pass on the head; ESLint is clean on the changed files; Prettier differs only on an unchanged
search.mjsline that fails on the base too. - Claim (title): template docs never print a raw doc token. False: a
{@link …}token still prints as written. - File
.changeset/template-doc-tokens.md: finding (its build claim is false under--verbose). - File
packages/cli/api/build/_adapter.mjs: clear. - File
packages/cli/api/search/_gather-templates.mjs: clear. - File
packages/cli/api/template/list/list.mjs: clear. - File
packages/cli/api/template/show/show.mjs: clear. - File
packages/cli/api/template/skeleton/skeleton.mjs: clear. - File
packages/cli/clients/cli/commands/build.mjs: finding (verbose TEMPLATE record, line 274). - File
packages/cli/clients/cli/commands/search.mjs: clear. - File
packages/cli/clients/cli/commands/search.test.mjs: clear. - File
packages/cli/clients/cli/commands/template-doc-tokens.test.mjs: clear (the verbose build case belongs with the build fix). - File
packages/cli/clients/cli/commands/template.mjs: clear. - File
packages/cli/clients/cli/formatters/index.mjs: clear.
There was a problem hiding this comment.
Changes requested: the build --verbose record and the {@link} title claim from the last review are fixed, and template tokens now render in template, build and search, but the title's guarantee still reaches one command this change does not cover.
- Miss: the title says template docs "never print a raw
{@command}or{@pm}token", butastryx component <Name> --blocksstill prints a block template's description as written, raw token included, in text and--json(packages/cli/api/component/detail/blocks/blocks.mjs:29,packages/cli/clients/cli/commands/component.mjs:200and:212); name the commands in the title, or render that description withrenderTokens, format those two records withdocText, and add acomponent --blockscase totemplate-doc-tokens.test.mjs.
The rest checks out: JSON keeps its shape and carries bare commands, a template's source prints byte for byte, and the new test fails 4 of its 5 cases on the base and its new --verbose case on the previous revision.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules (0): none.
- Claim (title): template docs never print a raw command or package-manager token. False:
astryx component <Name> --blocksprints one (blocks.mjs:29,component.mjs:200,:212). - Claim (title): build and search text show doc commands with the project's command. Verified:
build.mjs:216,:225-226,:274;search.mjs:198-199; a probe of each text view. - Claim: a template doc can write a command or package-manager token the way component and topic docs do. Verified: the global-mode spec's FR5 has integration docs write tokens, and template descriptions now compile like other docs.
- Claim: before the change, template list, skeleton, build and search printed the token as written, in text and JSON. Verified: a probe on the base, and 4 of the new test's 5 cases fail there.
- Claim: build and search text printed every description's commands bare. Verified on the base:
build.mjsformatted onlycommand, andsearch.mjsonly cut the first sentence. - Claim: component docs and topics render tokens when the API reads them; template docs did not. Verified in the docs adapter and the base template APIs.
- Claim: the template, build and search APIs render description tokens, so JSON carries bare commands and keeps its shape. Verified: five API projections change values only; probe JSON.
- Claim:
docTextapplies the prefix ruleemituses for doc Markdown, in template list, skeleton, build (with and without verbose) and search text. Verified:formatters/index.mjs:420-425and:436-449; probe. - Claim: discovery keeps the authored text, so a docs link to a template renders its summary once and an escaped token stays written. Verified: discovery is unchanged and the docs adapter renders once.
- Claim: a template's source prints byte for byte. Verified: the source case passes on the base and the head.
- Claim: every printed command starts with the picked command and JSON stays bare (the global-mode spec's FR5 and the docs command's header). Verified against both.
- Claim: no new option and no JSON shape change. Verified: no command doc or result type changes.
- Claim: after the change, text prints the project's command, JSON the bare command, and no output of the four commands holds the token. Verified: probe and test.
- Claim: the new test fails 4 of 5 cases on the base and the source case passes on both. Verified by running it on the base.
- Claim: the search field-mirror test expects prefixed commands in text. Verified: 33 tests pass on the head.
- Claim: a link token in a template description still prints as written (scope). Verified: consistent with the code.
- Claim: no hidden public API, default or interaction change, and no internal context in public text. Verified.
- Claim: the listed test, repository, type, lint and format checks pass. Partly verified: the template, build, search, API and formatter suites pass on the head (141 files); ESLint is clean on the changed files; Prettier flags only an unchanged
search.mjsline that fails on the base too; the strict typecheck reports only two unbuilt theme imports in unchanged templates; the repository checks pass apart from three that need a git working tree. - Changeset: template list and skeleton, build and search show tokens as commands, with the project's command in text and bare in JSON, shape unchanged. Verified, including
build --verbose. - Changeset: build and search text show every description's commands with the project's command. Verified.
- Changeset: a template's source still prints byte for byte. Verified.
- File
.changeset/template-doc-tokens.md: clear. - File
packages/cli/api/build/_adapter.mjs: clear. - File
packages/cli/api/search/_gather-templates.mjs: clear. - File
packages/cli/api/template/list/list.mjs: clear. - File
packages/cli/api/template/show/show.mjs: clear. - File
packages/cli/api/template/skeleton/skeleton.mjs: clear. - File
packages/cli/clients/cli/commands/build.mjs: clear (the verbose TEMPLATE record is fixed at line 274). - File
packages/cli/clients/cli/commands/search.mjs: clear. - File
packages/cli/clients/cli/commands/search.test.mjs: clear. - File
packages/cli/clients/cli/commands/template-doc-tokens.test.mjs: clear (acomponent --blockscase belongs with the fix, if the fix extends to that command). - File
packages/cli/clients/cli/commands/template.mjs: clear. - File
packages/cli/clients/cli/formatters/index.mjs: clear.
… text show doc commands with the project's command
A template doc's {@command} and {@pm} tokens printed as written in template,
build and search output, in text and JSON. The template, build and search
APIs now render them, so JSON carries the bare astryx command, and the text
views show each description's commands with the project's command through
docText, the same rule emit applies to doc Markdown. A template's source
still prints byte for byte.
…mands with the project's command
… shows its commands with the project's command
eac553a to
345c3e6
Compare
There was a problem hiding this comment.
Changes requested: component <Name> --blocks and build --verbose now render and prefix template doc commands as the last reviews asked, but two things remain.
- Miss:
template()andbuild()from@astryxdesign/cli/apirender a description's{@pm …}step for the process's working folder instead of thecwdthey are given (packages/cli/api/template/list/list.mjs:54,show/show.mjs:58,skeleton/skeleton.mjs:261,packages/cli/api/build/_adapter.mjs:120,:129,:149), so a Yarn project read from a pnpm folder getspnpm add …and onebuild()answer showspnpm addinstartandyarn addinpagesfor the same template; run both insiderunWithDocPackageManager(docPackageManager(cwd), …)assearch()does, and add a{@pm}case with a differingcwd. - The description says the new test fails 4 of its 5 cases on the base, but it now has 6 cases and 5 fail there (the
component --blockscase), so update that line and namecomponent --blocksamong the fixed surfaces.
Everything else checks out: JSON keeps its shape with bare commands, text carries the picked command name on every surface, escaped tokens stay written, and a template's source prints byte for byte.
Claims and files checked
Review mode: full; reason: rebase
- Claim (title): template docs never print a raw command or package-manager token. Verified: template list and skeleton, build, search and component --blocks render it (new test, 6 cases).
- Claim (title): build and search text show doc commands with the project's command. Verified:
build.mjs:216,:225-226,:274;search.mjs:198-199. - Claim: a template doc can write a command or package-manager token the way component and topic docs do. Verified: the global-mode spec has integration docs write tokens, and one renderer serves every doc.
- Claim: before the change, template list, skeleton, build and search printed the token as written, in text and JSON. Verified: the new test's cases fail on the base.
- Claim: build and search text printed every description's commands bare. Verified on the base: build formatted only
command, and search only cut the first sentence. - Claim: component docs and topics render tokens when read, and template docs did not. Verified in the docs adapter, the component API and the base template APIs.
- Claim: the template, build and search APIs render description tokens, JSON carries bare commands, and its shape does not change. Verified for the keys and command tokens; package-manager tokens follow the process's folder when
template()orbuild()gets anothercwd(finding above). - Claim:
docTextapplies the prefix ruleemituses, in template list, skeleton, build (with and without verbose) and search text. Verified:formatters/index.mjs:420-425. - Claim: discovery keeps the authored text, so a docs link renders a template's summary once and an escaped token stays written. Verified: discovery is unchanged, and a probe shows an escaped token written once on every surface.
- Claim: a template's source prints byte for byte. Verified: the source case passes on the base and the head.
- Claim: the regression test fails 4 of its 5 cases on the base. False: it has 6 cases and 5 fail on the base.
- Claim: the search field-mirror test expects a description's commands with the project's command in text. Verified:
search.test.mjs:397-403. - Claim: a link token in a template description still prints as written. Verified: the token renderer leaves link tokens alone.
- Claim: no new option and no JSON shape change. Verified.
- Changeset: tokens no longer print as written; template, build and search show the picked command in text and the bare command in JSON with an unchanged shape; build and search text prefix every description; a template's source prints byte for byte. Verified by the new test and
build.mjs,search.mjs. - Claim (testing): the CLI node tests and ESLint pass on the changed files. Verified: the CLI suites around the change and ESLint pass on the head.
- File
.changeset/template-doc-tokens.md: clear. - File
packages/cli/api/build/_adapter.mjs: finding (package-manager token follows the process's folder). - File
packages/cli/api/component/detail/blocks/blocks.mjs: clear (the component API sets the scope fromcwd). - File
packages/cli/api/search/_gather-templates.mjs: clear. - File
packages/cli/api/template/list/list.mjs: finding (same). - File
packages/cli/api/template/show/show.mjs: finding (same). - File
packages/cli/api/template/skeleton/skeleton.mjs: finding (same). - File
packages/cli/clients/cli/commands/build.mjs: clear. - File
packages/cli/clients/cli/commands/component.mjs: clear. - File
packages/cli/clients/cli/commands/search.mjs: clear. - File
packages/cli/clients/cli/commands/search.test.mjs: clear. - File
packages/cli/clients/cli/commands/template-doc-tokens.test.mjs: clear (no package-manager token case; the description's count is stale). - File
packages/cli/clients/cli/commands/template.mjs: clear. - File
packages/cli/clients/cli/formatters/index.mjs: clear.
…r the cwd they are given
There was a problem hiding this comment.
Approved pending CI: some test-node shards and other required checks have not finished on this head yet.
Template and block descriptions now render {@command …} and {@pm …} on every surface that prints them, and template() and build() follow their cwd for package-manager steps, which fixes both points from the last review. The new tests fail before each fix and pass here.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules (0): none.
- Claim (title): template docs never print a raw command or package-manager token. Verified: every reader of a template or block description in the API and CLI renders it (template list, show and skeleton, the build adapter, search's template gatherer, component detail blocks); the new test's surface cases pass.
- Claim (title): build and search text show doc commands with the project's command. Verified:
build.mjs:216,:225-226,:274;search.mjs:198-199. - Claim: a template doc can write a command or package-manager token the way component and topic docs do. Verified: the global-mode spec's FR5 has integration docs write tokens, and one renderer serves every doc.
- Claim: before the change, template list, skeleton, build, search and component --blocks printed the token as written, in text and JSON. Verified: those cases fail on the base.
- Claim: build and search text printed every description's commands bare. Verified on the base: build formatted only
command, search only cut the first sentence, and the search field-mirror test fails there. - Claim: component docs and topics render tokens when read, and template docs did not. Verified in the component and docs APIs and the base template projections.
- Claim: the template, build and search APIs render description tokens, JSON carries bare commands, and its shape does not change. Verified: the projections change values only; probe and test JSON.
- Claim:
docTextapplies the prefix ruleemituses, in template list, skeleton, build (with and without verbose) and search text. Verified:formatters/index.mjs:420-425besideemitat:435-449. - Claim:
template()andbuild()render a package-manager step for the project theircwdnames, assearch()does, so one answer never mixes package managers. Verified for package-manager steps:api/template/template.mjs:119-126,api/build/build.mjs:62-79; the two new cases fail on the previous revision and pass here. The build answer's StyleX setup note still names the CLI runner of the process's folder, unchanged from main. - Claim: discovery keeps the authored text, so a docs link renders a template's summary once and an escaped token stays written. Verified: discovery is unchanged, and a probe shows an escaped token written once.
- Claim: a template's source prints byte for byte. Verified: the source case passes on the base and the head.
- Claim: the CLI must print every command with the picked command name and keep JSON bare (the global-mode spec's FR5 and the docs command's header). Verified against both.
- Claim: the smallest restoration lists the projections,
docTextand the three text commands. Verified, though narrower than the change: it leaves out component --blocks and thecwdscope, which the fix and evidence sections name. - Claim: the regression test has 8 cases; 7 fail on the base and the template-source case passes on both. Verified by a red-first run.
- Claim: the search field-mirror test expects a description's commands with the project's command in text. Verified:
search.test.mjs:397-407; 33 tests pass. - Claim: a link token in a template description still prints as written. Verified: the token renderer leaves link tokens alone.
- Claim: no new option, no JSON shape change, no hidden public API, and no internal context in public text. Verified.
- Claim (testing): the CLI tests, repository checks, strict typecheck, ESLint and Prettier pass. Partly verified: 160 related CLI test files pass; ESLint is clean; Prettier flags only unchanged lines in two changed files that fail on the base too; the strict typecheck reports only an unbuilt theme in two unchanged templates, as on the base; the changeset, CLI-structure, sync and manifest checks pass.
- Changeset: template, build and search show tokens as the project's command in text and the bare command in JSON with an unchanged shape; build and search text prefix every description; a template's source prints byte for byte. Verified by the new test,
build.mjsandsearch.mjs. - File
.changeset/template-doc-tokens.md: clear. - File
packages/cli/api/build/_adapter.mjs: clear. - File
packages/cli/api/build/build.mjs: clear (sets the package-manager scope fromcwd). - File
packages/cli/api/component/detail/blocks/blocks.mjs: clear. - File
packages/cli/api/search/_gather-templates.mjs: clear. - File
packages/cli/api/template/list/list.mjs: clear. - File
packages/cli/api/template/show/show.mjs: clear. - File
packages/cli/api/template/skeleton/skeleton.mjs: clear. - File
packages/cli/api/template/template.mjs: clear (sets the package-manager scope fromcwd). - File
packages/cli/clients/cli/commands/build.mjs: clear. - File
packages/cli/clients/cli/commands/component.mjs: clear. - File
packages/cli/clients/cli/commands/search.mjs: clear. - File
packages/cli/clients/cli/commands/search.test.mjs: clear. - File
packages/cli/clients/cli/commands/template-doc-tokens.test.mjs: clear (8 cases, including thecwdpackage-manager cases). - File
packages/cli/clients/cli/commands/template.mjs: clear. - File
packages/cli/clients/cli/formatters/index.mjs: clear.
PR Analysis Report🔎 Preview ·
|
User impact
A template's doc can write a command with a doc token,
{@command docs icons}or{@pm …}, the same way a component's or a topic's doc does.astryx template --list,astryx template <name> --skeleton,astryx build,astryx searchandastryx component <Name> --blocksprinted that token as written, in text and in--json, so a reader saw{@command docs icons}instead of a command, and an agent could not run it.buildandsearchtext also printed every description's commands bare, which does not run where the CLI is reached through the package manager.Problem and solution fit
buildandsearchtext print descriptions as their JSON carries them.renderTokens), so--jsoncarries the bareastryx …command. The JSON shape does not change.docText(formatters) shows a doc text field's bare commands with the project's command, by the sameprefixCliCommandsrule thatemitapplies to doc Markdown.template --list,--skeleton,build(with and without--verbose) andsearchtext use it for descriptions.template()andbuild()render a{@pm}step for the project theircwdnames, assearch()does (runWithDocPackageManager), so one answer never mixes package managers.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
api/template/{list,show,skeleton},api/build/_adapter.mjs,api/search/_gather-templates.mjs: render the description's tokens.formatters/index.mjs:docText.template.mjs,build.mjs,search.mjs: text descriptions throughdocText.Evidence
cliCommand: 'acme astryx'and ships a template whose description writes{@command docs icons}): the four surfaces printed{@command docs icons}in text and JSON.`acme astryx docs icons`; JSON prints`astryx docs icons`; no output contains{@command.astryx template <name>prints the template's source, including a`astryx docs icons`comment, byte for byte, in text and indata.source.packages/cli/clients/cli/commands/template-doc-tokens.test.mjs(8 cases; 7 fail on the base, and the template-source case passes on both). It coverstemplatelist and skeleton,buildwith and without--verbose,search,component --blocks, andtemplate()/build()called with a Yarn project'scwdfrom a pnpm folder.search.test.mjs's field-mirror test now expects a description's commands with the project's command in text.Scope
Not in this change: a
{@link …}in a template's description still prints as written intemplate,buildandsearch. Resolving it needs the docs catalog on those paths, which is its own change.Components: CLI
template,build,search,component --blocks, text formattersTesting
pnpm exec vitest run --project node packages/clipnpm check:repo,pnpm -F @astryxdesign/cli typecheck:strict, ESLint and Prettier on the changed files.