Skip to content

feat(cli): name a template's components for one component read - #12389

Merged
josephfarina merged 6 commits into
mainfrom
josephfarina/template-components-line
Nov 18, 2026
Merged

josephfarina merged 6 commits into
mainfrom
josephfarina/template-components-line

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User need

After astryx build names a template and an agent scaffolds it with astryx template <name> <path>, the agent still has to learn the components the file uses: the shell, navigation, layout and table parts. Today it looks them up one astryx component <Name> call at a time, because nothing tells it which set to read. astryx component A B C already answers several names in one call; the scaffold just does not name them.

Problem and solution fit

  • The template.copy receipt gains components: the components the written file uses that astryx component answers in this project (Core's and each configured integration's), in the order the file first renders them, each once.
  • Text prints one line right after Copied template to ...: Read the components it uses in one call: `<cli> component A B C` , with the same CLI invocation other commands print.
  • astryx template <name> (no path; stdout is the source) prints the same line to stderr with its other notes. template.show already has components, a sorted summary of the component names the source composes that leaves out the components almost every template uses (such as Text and Button); changing it would change its JSON, so the full, first-use-ordered list is a new additive field, componentsToRead.
  • Nothing prints when the list is empty. One plain ASCII line. astryx build output is unchanged.

Current specification

architecture:cli-surface gains INV40 ("A template names its components for one read"), with a verification row. JSON stays additive under spec:AST-017.

Public delta and caller burden

  • JSON: template.copy data.components: string[] and template.show data.componentsToRead: string[] (both always present, possibly empty). Every existing field keeps its name, type and value.
  • Text: one new line on the copy receipt (stdout) and one on stderr for a printed template.
  • Example (template table src/x.tsx):
    Copied template to src/x.tsx
    
    Read the components it uses in one call: `npx astryx component HStack Avatar Text StatusDot VisuallyHidden DropdownMenu Icon Layout LayoutHeader VStack StackItem Heading Button TableSelectionToolbar MoreMenu LayoutContent Table AlertDialog`
    
  • No caller decision is added.

Design and alternatives

  • A tag counts only when a named import binds it to an Astryx package or to the component's own package, and astryx component answers the name: a name the component list (component --list, the same kept gather) holds, or one astryx component <name> finds on its own, such as a part a family doc documents (ResizeHandle, StackItem). So every component astryx component answers is kept, Text, Button and Stack included, and part names such as InputGroupText or AvatarGroup stay as written.
  • Tags come from the parsed source, so text in a comment never counts. A tag no import binds (a helper the file declares), and one from another module (a chart library's Tooltip, XAxis, Bar, or a helper from a local file), do not count.
  • A part no doc answers counts as its family root when it is imported from that root's own module (TableHeader from @astryxdesign/core/Table names Table).
  • In a project with any configured integration, every name is written as <package>/<Name> for the package its import names (@astryxdesign/core/SideNav, @acme/widgets/AcmeBadge), which astryx component reads exactly; there a bare name could open another package's component (a replacement, or a second package with that name). A Core-only project gets bare names. A name counts only when the package its import names documents it, so an undocumented Core export is left out even when an integration documents that name.
  • Order is first use in the file: each name sits where the file first renders it, so helpers the file declares above the page come first.
  • Rejected: filtering template.show's existing components in place (it would change released JSON).

Evidence

  • template table, shell-top-nav, dashboard, dashboard-progress, table-page, InputGroupBasic and AvatarGroup print the line. dashboard leaves out its chart parts. dashboard-progress and table-page import only a hover-card hook, so they do not list HoverCard. InputGroupBasic lists InputGroup InputGroupText TextInput, AvatarGroup lists AvatarGroup, and ResizableSidebar lists ResizeHandle.
  • A batch astryx component call with the copied dashboard receipt's components finds every name, and the printed command, run as printed, reads every name it lists in one call. Its prefix is the one the CLI prints in its other commands.
  • Agent runs: in a blind comparison over a set of page-building tasks, agents given this line succeeded as often as without it. They read the components in one batched call after a scaffold much more often, made fewer component calls, and read slightly less CLI text overall.
  • Added time, packed CLI in a Core-only project, template table src/x.tsx: about 50 ms on a loaded shared machine (the component list plus one parse of the file).

Scope

Components: CLI template (copy and show), template discovery's component scan

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

CI=1 pnpm exec vitest run --project node packages/cli/api/template packages/cli/clients/cli/commands/template packages/cli/test

  • New api/template/copy/copy.components.test.mjs: the field with Core, a part only its family doc documents, an integration fixture (every name as <package>/<Name>), an integration component under a Core name (the bare name is ambiguous; @astryxdesign/core/Button reads Core's), a replacement of SideNav (bare reads the replacement; @astryxdesign/core/SideNav reads Core's), an undocumented Core export an integration documents (left out), and a Core-only project (bare names, all read in one call) (an integration component plus Core components, Text and a part kept); unbound, chart-library, local-file and comment-only names dropped; a part folded into its own family root; first-use order and no duplicates; template.show's componentsToRead and its unchanged components; the text line right after the copy line and on stderr for a printed template (stdout stays the source); no line for an empty list; the printed command runs and reads every name in one call, with the CLI's own prefix; --json carries the field and prints no line.
  • Goldens updated only for the new field and line: test/__golden__/template.json, test/__golden__/no-icon-set/template-copy.{json,txt}, test/__golden__/no-icon-set/template-show.json.
  • Every other file in that run passes; failures seen locally were time-outs on a loaded machine (they pass when re-run with fewer workers) and the two locale example tests that fail on this machine on the base branch too.
  • Both fields are in the response-types reference (foundation/response/response-types.doc.mjs) and the README table it generates (pnpm -F @astryxdesign/cli readme:check). The template entries there are shorter, so the whole reference read is under 32 KB again.
  • pnpm check:knowledge, pnpm -F @astryxdesign/cli typecheck:strict (no new errors; two pre-existing missing-build errors in templates), node .github/scripts/cli-api-types-verify.mjs, pnpm sync:api-types.

Writing rubric results

Record: architecture:cli-surface (new INV40 and its verification row).

  • R1 narration: none; INV40 states what the receipt, the show response and the text carry, in the present tense.
  • R2 research: none in the record; the timing lives in this description.
  • R3 evidence: the row cites the test file, no pull request.
  • R4 rejected alternatives: none in the record; the one alternative is in this description.
  • R5 change references: none.
  • R6 open questions: none added.
  • R7 project status: none.

@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 18, 2026 3:18pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 3:28 PM UTC

@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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner, and on four fixes.

This pull request adds INV40 to architecture:cli-surface, a requirement the current record does not state, so the new components / componentsToRead fields and the "Read the components it uses in one call" line have no current authority yet. An engineering owner approves or amends INV40, including whether the ubiquitous components stay out of the list, and records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

  • The list leaves out or renames components astryx component answers, against the changeset, the typedefs and INV40: catalogComponentsInSource sends each tag through catalogNames (packages/cli/foundation/discovery/template-adapter.mjs:2195), which drops Text, Heading, Button, HStack, VStack, Link, StackItem and Icon (Text in 376 of the 788 shipped templates, Button in 199, Heading in 120) and strips part suffixes, so InputGroupBasic names InputGroupText TextInput but not InputGroup, and the AvatarGroup blocks name Avatar instead of AvatarGroup.
  • A tag that no import binds counts as an Astryx component (template-adapter.mjs:2200, module === undefined), and the tag scan also reads comments, so the dashboard-progress and table-page lines tell the agent to read HoverCard although both pages import only useHoverCard.
  • The consumer schema reference omits both new fields: packages/cli/foundation/response/response-types.doc.mjs:342-354 (and the README table it generates) lists every other template.show and template.copy field, which spec:AST-017 FR13 and DEC-4 require to be complete in the same change.
  • The description's claim that "the shell and layout come before inner parts" is false, because the order is each name's first tag offset in the text: its own table example puts Layout fifth, and Layout is not first in 70 of the 88 lists that hold it.

One non-blocking nit: the topLevelBindings JSDoc now reads "maps AstryxText to Text. Both importedFrom maps …", so the stray "Both" wants dropping.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Changeset: one line follows the copy line — verified (astryx template table out/table on this head).
  • Changeset: a printed template gets the same line on stderr and stdout stays the source — verified.
  • Changeset: the names are the ones astryx component answers in the project, each once, in first-render order — false for the names it answers (376 templates omit Text; InputGroup and AvatarGroup are folded away).
  • Changeset: a chart library's parts and the file's own helpers are left out — verified (dashboard drops the chart parts; the new unit test covers it).
  • Changeset: nothing prints for an empty list — verified (HeadingShowcase).
  • Changeset: --json carries the fields and every existing field is unchanged — verified (goldens and the focused test run).
  • Description: architecture:cli-surface gains INV40 and a verification row — verified, and unapproved at this head.
  • Description: JSON stays additive — verified for compatibility; the documentation leg of the current release claim is not met (third finding).
  • Description: the worked template table src/x.tsx output — verified, name for name.
  • Description: order puts the shell and layout before inner parts — false (fourth finding).
  • Description: names come from the existing in-source list, kept only when the project's component list holds them — verified.
  • Description: a tag imported from another module does not count — verified for an imported tag; a tag with no import still counts (second finding).
  • Description: the added time is about 50 ms — not re-measured in this review.
  • Description: the named test selection passes — verified (76 files, 357 passed, 4 skipped).
  • Description: knowledge check, strict typecheck, the API-types verifier and the type sync — not re-run in this review.
  • Description: the change ships consumer docs with the feature — false (third finding).
  • Description: no internal context in public text or artifacts — verified over every added line, the title, body, branch and commit message.
  • Files: .changeset/template-components-line.md (claim finding), docs/architecture/cli-surface.md (unapproved INV40 and its row), packages/cli/api/template/_adapter.mjs (clear), packages/cli/api/template/copy/copy.mjs (clear), packages/cli/api/template/show/show.mjs (clear), packages/cli/api/template/template.mjs (clear), packages/cli/api/template/template.doc.mjs (clear), packages/cli/api/template/template.type.mjs (clear), packages/cli/api/template/copy/copy.components.test.mjs (no case covers an omitted catalog component), packages/cli/clients/cli/commands/template.mjs (clear), packages/cli/foundation/discovery/template-adapter.mjs (first, second and nit findings), the four golden snapshots under packages/cli/test/__golden__/ (clear; each adds only the new field or line), and the untouched packages/cli/foundation/response/response-types.doc.mjs that the third finding names.

Automated review (maintainer link)

@josephfarina
josephfarina marked this pull request as ready for review November 18, 2026 03:46
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): after a template is written, the template.copy receipt gains an additive components field and the text answer prints one line naming those components for a single component call. template.show gains an additive componentsToRead, and its existing components stays unchanged. When standard output carries the template source, the line goes to standard error, so piping stays clean. The line uses the same command prefix the user ran, component answers several names in one call (with a test), and architecture:cli-surface INV40 states this. If another INV40 lands first, this one takes the next number.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 7a5a43a

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the owner approval settles INV40 and the three earlier findings are fixed, but two problems remain in the new component list.

  • Miss: the list leaves out components that astryx component answers with their own docs (ResizeHandle, StackItem from @astryxdesign/core/Layout, SyntaxTheme, NavHeadingMenu) in 39 of the 788 shipped templates, for example ResizableSidebar never names ResizeHandle, because the catalog is only component --list (packages/cli/api/template/_adapter.mjs:48-74), so the field, INV40, both typedefs, template.doc.mjs, the changeset and the description over-claim; let the catalog hold every name astryx component resolves and add those cases to the test.
  • The new parse and tree walk in catalogComponentsInSource (packages/cli/foundation/discovery/template-adapter.mjs:2186-2284) copy parseTemplateSource and walk from template-source-tree.mjs, which this file already imports from, so call those and delete the local copies.

The ordering, the stderr placement, the empty case, --json and the response documentation all check out on this head.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: the copy receipt gains components, the components the written file uses that astryx component answers, in first-render order, each once: false for 39 templates (finding 1).
  • Claim: every component astryx component answers is kept, with Text, Button and Stack included: false for sub-component docs such as ResizeHandle and StackItem (finding 1); Text, Button and Stack are kept.
  • Claim: one line prints right after the copy line with the same command prefix: verified (clients/cli/commands/template.mjs:361-368, head CLI run).
  • Claim: a printed template sends the line to stderr and keeps components while adding componentsToRead: verified (commands/template.mjs:326-327, new test).
  • Claim: nothing prints for an empty list, the line is plain ASCII, and astryx build output is unchanged: verified (new test; only the template command calls copy and show).
  • Claim: INV40 and a verification row are added and the JSON stays additive: verified (docs/architecture/cli-surface.md:627, :1090; goldens).
  • Claim: both fields are always present and every existing field is unchanged: verified (copy.mjs:191, show.mjs:67, goldens).
  • Claim: the example output for the table template: verified (same 17 names on a head run).
  • Claim: unbound tags, other modules' tags and comments never count, and a part folds to its root only from that root's module: verified (new test; no chart parts for the dashboard template).
  • Claim: order is first use, so helpers declared above the page come first: verified (tags sorted by source position).
  • Claim: the named templates print the line, the dashboard leaves out chart parts, two pages no longer list HoverCard, InputGroupBasic lists InputGroup InputGroupText TextInput and AvatarGroup lists AvatarGroup: verified (sweep of all templates).
  • Claim: one batch component call with a receipt's names finds every name: verified for every shipped template (at most 44 names).
  • Claim: an agent study showed more batched reads: not checkable here (no data in the pull request).
  • Claim: about 50 ms added: consistent (48 to 85 ms for the component list load in this run).
  • Claim: goldens change only for the new field and line: verified (diff).
  • Claim: both fields are in the response-types reference and the generated README table: verified (readme:check in sync).
  • Claim: the knowledge check passes: verified.
  • Changeset: the line follows the copy line and goes to stderr for a printed template: verified.
  • Changeset: the names are the ones astryx component answers in the project: false (finding 1).
  • Changeset: chart parts and local helpers are left out, nothing prints when none are left, --json carries both fields and existing fields are unchanged: verified.
  • File .changeset/template-components-line.md: finding 1 (membership wording).
  • File docs/architecture/cli-surface.md: clear.
  • File packages/cli/README.md: clear.
  • File packages/cli/api/template/_adapter.mjs: finding 1.
  • File packages/cli/api/template/copy/copy.components.test.mjs: finding 1 (no sub-component case).
  • File packages/cli/api/template/copy/copy.mjs: clear.
  • File packages/cli/api/template/show/show.mjs: clear.
  • File packages/cli/api/template/template.doc.mjs: finding 1 (membership wording).
  • File packages/cli/api/template/template.mjs: clear.
  • File packages/cli/api/template/template.type.mjs: finding 1 (membership wording).
  • File packages/cli/clients/cli/commands/template.mjs: clear.
  • File packages/cli/foundation/discovery/template-adapter.mjs: findings 1 and 2.
  • File packages/cli/foundation/response/response-types.doc.mjs: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-copy.json: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-copy.txt: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-show.json: clear.
  • File packages/cli/test/__golden__/template.json: clear.

Automated review (maintainer link)

Comment thread packages/cli/api/template/_adapter.mjs Resolved
@josephfarina
josephfarina changed the base branch from josephfarina/component-short-answer to main November 18, 2026 10:18
The template.copy receipt gains components and template.show gains
componentsToRead: the components the source renders that astryx
component answers in the project, in first-use order, each once. A tag
counts when a named import binds it to an Astryx package or to the
component's own package. Text prints one line naming them in a single
component call: after the copy line, and on stderr for a printed
template. Both fields join the response-types reference, whose template
entries are shorter so the whole read stays under 32 KB.
@josephfarina
josephfarina force-pushed the josephfarina/template-components-line branch from 7a5a43a to 61b637a Compare November 18, 2026 10:36
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 61b637a

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e193c22

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.44 MB packed (+3.1 kB); no new dependencies.

API changes: cli +0 · ~2 · −0

2 API changes (advisory)
Package Where Signature Usage
~ cli ./api · Types · type TemplateCopyResponse data: { template: string; outputDir: string; fileName: string; filesCopied: number; demoMediaReplaced: number; demoContentReplaced: number; notes: string[]; missingPa … #88078946 → data: { template: string; outputDir: string; fileName: string; filesCopied: number; demoMediaReplaced: number; demoContentReplaced: number; notes: string[]; missingPa … #96f73985 import type {TemplateCopyResponse} from '@astryxdesign/cli/api'; const x: TemplateCopyResponse = {data: …}
~ cli ./api · Types · type TemplateShowResponse data: { template: string; description: string; type: "page" | "block"; components: string[]; source: string; demoMediaReplaced: number; demoContentReplaced: number; i … #997816e9 → data: { template: string; description: string; type: "page" | "block"; components: string[]; componentsToRead: string[]; source: string; demoMediaReplaced: number; de … #7fe3ecad import type {TemplateShowResponse} from '@astryxdesign/cli/api'; const x: TemplateShowResponse = {data: …}

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the owner approval settles INV40 and the five earlier findings are fixed, but four problems remain.

  • When a configured integration ships its own component under a Core name, such as Button, the list keeps the bare name, so the printed component command exits 1 with ERR_AMBIGUOUS_COMPONENT (packages/cli/foundation/discovery/template-adapter.mjs:2238-2254); list such a name as the selector for the package its import names, such as @astryxdesign/core/Button, and add that case to the test.
  • The required lint check fails on packages/cli/api/template/_adapter.mjs:89 (no-useless-assignment), because let found = [] is overwritten in both the try and the catch before it is read, so declare it without a value.
  • packages/cli/foundation/response/response-types.doc.mjs:344 and the README row it generates describe template.show's components as every name the template composes, but it is a sorted summary without Text, Button and the other common components, so describe it as that summary and regenerate the README (the description's sentence about it needs the same fix).
  • The description's template table example leaves out StackItem, which this head prints between VStack and Heading, so update that line.

Ordering, the stderr placement, the empty case, --json, and the documentation of the two new fields check out on this head.

Claims and files checked

Review mode: full; reason: rebase

  • Claim: the copy receipt gains components, the components the written file uses that astryx component answers, in first-render order, each once: verified in a Core-only project (every shipped template) and in the test's integration fixture; fails where two packages answer a name (first finding).
  • Claim: one line prints right after the copy line, with the CLI invocation other commands print: verified (clients/cli/commands/template.mjs:361-368, new test, head run).
  • Claim: a printed template sends the line to stderr and keeps stdout to the source: verified (commands/template.mjs:326-327, new test, head run).
  • Claim: template.show's existing components lists every rendered name, sorted and unfiltered: false, it leaves out the common components and folds parts (third finding).
  • Claim: componentsToRead is a new additive field and components is unchanged: verified (api/template/show/show.mjs:67, goldens).
  • Claim: nothing prints for an empty list, the line is plain ASCII, and astryx build output is unchanged: verified (new test; build reads only template discovery).
  • Claim: INV40 and its verification row are added and JSON stays additive: verified (docs/architecture/cli-surface.md:653-660, :1162).
  • Claim: both fields are always present and every existing field keeps its name, type and value: verified (copy.mjs:189, show.mjs:67, goldens).
  • Claim: the text adds one stdout line for a copy and one stderr line for a printed template: verified.
  • Claim: the example output for template table src/x.tsx: false, the head also prints StackItem (fourth finding).
  • Claim: no caller decision is added: verified.
  • Claim: a tag counts only when a named import binds it to an Astryx package or the component's own package and astryx component answers the name: verified (foundation/discovery/template-adapter.mjs:2186-2254, new test).
  • Claim: every component astryx component answers is kept, with Text, Button and Stack included and part names as written: verified, no answered component the file renders is missing in any shipped template.
  • Claim: comment text, unbound tags and other modules' tags never count: verified (new test; no chart parts for dashboard).
  • Claim: a part with no doc of its own counts as its family root when imported from that root's module: verified (new test).
  • Claim: the order is first use in the file: verified (tags sorted by source position).
  • Claim: filtering components in place was rejected because it would change released JSON: consistent with the code, which leaves it unchanged.
  • Claim: the named templates print the line, dashboard leaves out chart parts, dashboard-progress and table-page do not list HoverCard, InputGroupBasic lists InputGroup InputGroupText TextInput, AvatarGroup lists AvatarGroup and ResizableSidebar lists ResizeHandle: verified (sweep of every shipped template).
  • Claim: a batch call with the copied receipt's names finds every name, and the printed command reads every name in one call with the CLI's own prefix: verified in a Core-only project (at most 46 names, under the limit of 100); fails where two packages answer a name (first finding).
  • Claim: agents given the line made fewer component calls with the same success: not checkable here (no data in the pull request).
  • Claim: about 50 ms added: consistent (58 ms warm and 103 ms cold for the owner lookup in this run).
  • Claim: the new test covers the listed cases: verified (15 tests, passing), with no case where two packages answer a name.
  • Claim: goldens change only for the new field and line: verified (diff).
  • Claim: the other test files in that run pass: consistent (78 files in the template, command and golden suites pass).
  • Claim: both fields are in the response-types reference and its generated README table, and that read stays under 32 KB: verified (readme:check in sync; 31,894 bytes).
  • Claim: the knowledge check, the strict typecheck with two pre-existing missing-build errors, and the API types check pass: verified (both errors are in unchanged templates); the API types sync was not run.
  • Claim: the writing rubric finds no narration, research, references, open questions or status in the record: verified (INV40 is present-tense contract text).
  • Changeset: the copy prints one line after the copy line naming the components: verified.
  • Changeset: a printed template sends the line to stderr: verified.
  • Changeset: the names are the ones astryx component answers, in first-render order, each once: verified except where two packages answer a name (first finding).
  • Changeset: chart parts and local helpers are left out, and nothing prints when none are left: verified.
  • Changeset: --json carries both fields and every existing field is unchanged: verified.
  • File .changeset/template-components-line.md: clear.
  • File docs/architecture/cli-surface.md: clear.
  • File packages/cli/README.md: third finding.
  • File packages/cli/api/template/_adapter.mjs: first and second findings.
  • File packages/cli/api/template/copy/copy.components.test.mjs: first finding (no case where two packages answer a name).
  • File packages/cli/api/template/copy/copy.mjs: clear.
  • File packages/cli/api/template/show/show.mjs: clear.
  • File packages/cli/api/template/template.doc.mjs: clear.
  • File packages/cli/api/template/template.mjs: clear.
  • File packages/cli/api/template/template.type.mjs: clear.
  • File packages/cli/clients/cli/commands/template.mjs: clear.
  • File packages/cli/foundation/discovery/template-adapter.mjs: first finding.
  • File packages/cli/foundation/response/response-types.doc.mjs: third finding.
  • File packages/cli/test/__golden__/no-icon-set/template-copy.json: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-copy.txt: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-show.json: clear.
  • File packages/cli/test/__golden__/template.json: clear.

Automated review (maintainer link)

…ort names

A name an integration also ships under a Core name is written as
<package>/<Name>, so the printed component read never stops on an
ambiguous name. The response-types reference describes template.show's
components as the sorted summary it is.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d68a930

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec a1a82a2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the owner approval settles INV40 and the four earlier findings are fixed, but one case still prints a list that reads the wrong component or fails.

  • When a template imports a component from @astryxdesign/core that Core does not document but a configured integration ships under the same name (Core's table-tree renders SizeProvider from @astryxdesign/core/SizeContext), answeredName in packages/cli/foundation/discovery/template-adapter.mjs:2252-2253 lists the bare name, so the printed command reads that integration's component, and with two such integrations it exits 1 as ambiguous; count a name only when one of its owners is the package the import names, and add that fixture to copy.components.test.mjs.

The ordering, the stderr placement, the empty case, --json, the @astryxdesign/core/Button selector and the docs for both fields check out on this head, and every shipped template's list reads in one call in a project with Core alone. The required CI jobs did not run on this head because CI had no room, so they need a re-run.

Claims and files checked

Review mode: full; reason: spec-record

  • Claim: the copy receipt gains components, the components the written file uses that astryx component answers (Core's and each integration's), in first-render order, each once: verified with Core alone (all 788 shipped templates) and in the test's integration fixture; false where only integrations answer a name a Core import binds (the finding).
  • Claim: one line prints right after the copy line, with the CLI invocation other commands print: verified (clients/cli/commands/template.mjs:367-368, new test, run).
  • Claim: a printed template prints the same line on stderr with its other notes: verified (commands/template.mjs:326-327, run).
  • Claim: template.show's components stays a sorted summary without the common components, and the full first-use list is the new componentsToRead: verified (api/template/show/show.mjs:66-67, goldens).
  • Claim: nothing prints for an empty list, the line is plain ASCII, and astryx build output is unchanged: verified (new test; two shipped templates print no line; build reads only template discovery).
  • Claim: the record gains INV40 with a verification row, and the JSON stays additive: verified (docs/architecture/cli-surface.md:653-662, :1164).
  • Claim: both fields are always present, possibly empty, and every existing field keeps its name, type and value: verified (copy.mjs:189, show.mjs:67, goldens).
  • Claim: the text adds one stdout line for a copy and one stderr line for a printed template: verified.
  • Claim: the example output for template table src/x.tsx: verified (the same 18 names in the same order; the prefix follows how the CLI is run).
  • Claim: no caller decision is added: verified.
  • Claim: a tag counts only when a named import binds it to an Astryx package or the component's own package and astryx component answers the name: verified as written; that rule is what lets an integration's component stand in for a Core import (the finding).
  • Claim: every component astryx component answers is kept, Text, Button and Stack included, and part names stay as written: verified (sweep of every shipped template; InputGroupText, AvatarGroup).
  • Claim: comment text, unbound tags and other modules' tags never count: verified (new test; dashboard lists no chart parts).
  • Claim: a part with no doc of its own counts as its family root when imported from that root's module: verified (new test).
  • Claim: a name more than one package answers is written as the selector of the package the import names: verified when one of its owners is that package (new test; an integration's own Button reads as @acme/widgets/Button); false when none is (the finding).
  • Claim: the order is first use in the file: verified (template-adapter.mjs:2219).
  • Claim: filtering components in place was rejected because it would change released JSON: consistent; components is unchanged.
  • Claim: the named templates print the line, dashboard without chart parts, dashboard-progress and table-page without HoverCard, InputGroupBasic with InputGroup InputGroupText TextInput, AvatarGroup with AvatarGroup and ResizableSidebar with ResizeHandle: verified (sweep).
  • Claim: a batch call with the copied receipt's names finds every name, and the printed command reads them in one call with the CLI's own prefix: verified with Core alone (at most 46 names, under the limit of 100) and in the test fixture; fails in the finding's state.
  • Claim: agents given the line made fewer component calls with the same success: not checkable (no data in the pull request).
  • Claim: about 50 ms added: consistent (45-49 ms warm and 90 ms cold for the owner lookup in this run).
  • Claim: the new test covers the listed cases: verified (16 tests pass); it has no case where only integrations answer a Core-bound name.
  • Claim: goldens change only for the new field and line: verified.
  • Claim: the other files in that run pass: verified (77 files, 365 tests).
  • Claim: both fields are in the response-types reference and its README table, and that reference stays under its read budget: verified (README generator check in sync; the docs budget tests pass).
  • Claim: the knowledge check, strict typecheck, API types check and API types sync pass: the knowledge check and the packaged API types check pass here; the strict typecheck and the types sync were not run.
  • Claim: the writing rubric finds no narration, research, references, open questions or status in the record: verified (INV40 is present-tense contract text).
  • Changeset: the copy prints one line after the copy line naming the components: verified.
  • Changeset: a printed template sends the line to stderr: verified.
  • Changeset: the names are the ones astryx component answers, in first-render order, each once: verified except in the finding's state.
  • Changeset: a name more than one package answers is written <package>/<Name>, so the read is never ambiguous: false when no owner is the import's package (the finding).
  • Changeset: chart parts and local helpers are left out, and nothing prints when none are left: verified.
  • Changeset: --json carries both fields and every existing field is unchanged: verified.
  • File .changeset/template-components-line.md: the finding (its never-ambiguous claim).
  • File docs/architecture/cli-surface.md: clear.
  • File packages/cli/README.md: clear.
  • File packages/cli/api/template/_adapter.mjs: clear.
  • File packages/cli/api/template/copy/copy.components.test.mjs: the finding (no fixture for it).
  • File packages/cli/api/template/copy/copy.mjs: clear.
  • File packages/cli/api/template/show/show.mjs: clear.
  • File packages/cli/api/template/template.doc.mjs: clear.
  • File packages/cli/api/template/template.mjs: clear.
  • File packages/cli/api/template/template.type.mjs: clear.
  • File packages/cli/clients/cli/commands/template.mjs: clear.
  • File packages/cli/foundation/discovery/template-adapter.mjs: the finding.
  • File packages/cli/foundation/response/response-types.doc.mjs: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-copy.json: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-copy.txt: clear.
  • File packages/cli/test/__golden__/no-icon-set/template-show.json: clear.
  • File packages/cli/test/__golden__/template.json: clear.

Automated review (maintainer link)

…ents it

A tag counts only when one of the packages that answer its name is the
package its import names, so a Core export Core does not document is
left out even when an integration documents that name.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 7225cee

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the previous finding is fixed (a Core-bound tag that only an integration documents is no longer listed), but one case still lists a selector that reads the wrong component, and the description no longer states the matching rule.

  • Miss: in a project whose integration replaces a Core component under its own name (an AcmeSideNav that declares replaces: 'SideNav'), loadComponentOwners in packages/cli/api/template/_adapter.mjs:99-101 does not see the replacement, so a copy of shell-side-nav lists bare SideNav, which astryx component resolves to the replacement while the written file renders Core's SideNav; count an active replacement's package as a second owner so the line names @astryxdesign/core/SideNav, and add a replaces fixture to copy.components.test.mjs.
  • The description's "Design and alternatives" bullet says a tag counts when its import names an Astryx package or the component's own package, but at this head it counts only when one of the packages that answer the name is the one the import names (foundation/discovery/template-adapter.mjs:2249-2252); reword that bullet.

INV40 is owner-approved for this head. With Core alone, every one of the 788 shipped templates prints a list that one astryx component call reads, and the new SizeProvider test fails on the previous head and passes here. The failing docs-gate status does not reproduce on this head: astryx search selector still lists the Selector component first.

Claims and files checked

Review mode: incremental; reason: none

  • Changeset: the copy prints the line right after the copy line — verified (copy.components.test.mjs).
  • Changeset: a printed template prints it on stderr and stdout stays the source — verified (test).
  • Changeset and description: the names are the ones astryx component answers, Core's and each integration's, in first-render order, each once — verified with Core alone and with same-name integration components; false for a renamed component replacement (first finding).
  • Changeset and description: a name several packages answer is written as <package>/<Name> from the import's package — verified (Button test).
  • Changeset and description: chart-library parts, the file's own helpers, unbound and comment-only tags are left out, and nothing prints for an empty list — verified (tests; dashboard in the template sweep).
  • Changeset and description: --json carries components on the copy receipt and componentsToRead on show, both always present, and every existing field is unchanged — verified (types, goldens).
  • Description: the line uses the same CLI invocation as other commands and is one ASCII line — verified (test).
  • Description: show's existing components is a sorted summary without common components such as Text and Button — verified (template-adapter.mjs UBIQUITOUS, componentsInSource).
  • Description: astryx build output is unchanged — verified (no build file changes).
  • Description: the record gains INV40 with a verification row — verified (cli-surface.md).
  • Description: the template table src/x.tsx example names those 18 components in that order — verified (sweep).
  • Description: a tag counts when bound to an Astryx package or to the component's own package — false at this head (second finding).
  • Description: part names stay as written and Text, Button and Stack are kept — verified (InputGroupBasic, AvatarGroup, sweep).
  • Description: a part with no doc folds to its family root only from that root's own module — verified (test).
  • Description: order is first use in the file — verified (test).
  • Description: the named templates print the line; dashboard drops its chart parts; dashboard-progress and table-page do not list HoverCard; InputGroupBasic, AvatarGroup and ResizableSidebar list the names given — verified (sweep).
  • Description: one batch read of the dashboard receipt's list finds every name — verified (test and sweep).
  • Description: the agent comparison — not checkable; no data ships with the pull request.
  • Description: about 50 ms added — consistent (63-68 ms warm in this review's run).
  • Description: tests cover the listed cases, goldens change only for the new field and line, the README table is in sync, the reference read stays under 32 KB, and the knowledge and API-type checks pass — verified (17 tests pass, readme check, self-docs audit, knowledge check, API-type check).
  • .changeset/template-components-line.md — clear.
  • docs/architecture/cli-surface.md — clear.
  • packages/cli/README.md — clear (generated, in sync).
  • packages/cli/api/template/_adapter.mjs — first finding.
  • packages/cli/api/template/copy/copy.components.test.mjs — clear apart from the missing replacement fixture (first finding).
  • packages/cli/api/template/copy/copy.mjs — clear.
  • packages/cli/api/template/show/show.mjs — clear.
  • packages/cli/api/template/template.doc.mjs — clear.
  • packages/cli/api/template/template.mjs — clear.
  • packages/cli/api/template/template.type.mjs — clear.
  • packages/cli/clients/cli/commands/template.mjs — clear.
  • packages/cli/foundation/discovery/template-adapter.mjs — clear; its rule is what the second finding's bullet misstates.
  • packages/cli/foundation/response/response-types.doc.mjs — clear.
  • packages/cli/test/__golden__/no-icon-set/template-copy.json, template-copy.txt, template-show.json and test/__golden__/template.json — clear.

Automated review (maintainer link)

Comment thread packages/cli/api/template/_adapter.mjs Resolved
…s import's package

There a bare name can read another package's component (a replacement,
or a second package with that name), so each name is written as
<package>/<Name> for the package its import names, and counts only when
that package documents it. A Core-only project keeps bare names. The
template docs no longer call the form a selector.
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 4aaa486

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one blocking finding remains, a copy of an existing helper; both findings from the previous review are fixed.

  • packageOfModule in packages/cli/foundation/discovery/template-adapter.mjs:2259-2262 repeats packageOf from packages/cli/foundation/render/served-packages.mjs:32-36, which swizzle already imports, so import packageOf there and delete the copy to keep one rule for mapping an import specifier to its package.

The rest checks out: with an integration loaded, every listed name reads the component the file imports (a replaced SideNav included), and every shipped template's list reads in one astryx component call in both Core-only and integration projects. CI's test jobs did not run on this head because the CI queue was full, so they need a re-run after the fix.

Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • Changeset: a copy prints one line right after the copy line that names the components for one component call: verified (clients/cli/commands/template.mjs:361-368, test "prints the line right after the copy line").
  • Changeset: a printed template prints the line on stderr and stdout stays the source: verified (commands/template.mjs:326-327; a printed table writes only source to stdout).
  • Changeset: the names are the ones astryx component answers, in first-render order, each once, as <package>/<Name> in a project with an integration, without chart parts or local helpers, and no line when none are left: verified (template-adapter.mjs:2190-2251, the new tests, and all 788 shipped templates in both kinds of project).
  • Changeset: --json carries components on the copy receipt and componentsToRead on show, with every existing field unchanged: verified (goldens and the JSON keys before and after).
  • Description: the copy receipt gains components, and show gains componentsToRead beside its unchanged sorted components: verified (copy.mjs:189, show.mjs:69-70, test "names the same components and leaves components as it was").
  • Description: the line uses the CLI invocation other commands print, is plain ASCII, is absent for an empty list, and astryx build output is unchanged: verified (tests; nothing outside the template command calls the new code).
  • Description: the example list for the table page: verified (the same 18 names in a Core-only project; the prefix depends on how the CLI runs).
  • Description: the matching rules (named import, the package the import names documents the name, comments ignored, unbound and other-module tags dropped, family-root fold, first-use order): verified (template-adapter.mjs:2190-2251, tests).
  • Description: with any integration every name is <package>/<Name> and a Core-only project gets bare names: verified (api/template/_adapter.mjs:92, :117; the shipped templates read in one call both ways).
  • Description: the listed templates print the lists it names (dashboard without chart parts, no HoverCard for the two hover-card-hook pages, InputGroup InputGroupText TextInput, AvatarGroup, ResizeHandle): verified.
  • Description: the printed command, run as printed, reads every name in one call: verified (test, and a run in a project whose integration replaces SideNav).
  • Description: about 50 ms added in a Core-only project: consistent (63-77 ms warm here; about 200 ms with one integration).
  • Description: the agent comparison: the author's report, not checked.
  • Description: the new test's cases, goldens changed only for the new field and line, readme:check, check:knowledge and the API types check: verified; typecheck:strict and sync:api-types were not run here.

Files:

  • .changeset/template-components-line.md: clear
  • docs/architecture/cli-surface.md: clear (INV40 and its verification row, owner-approved for this head)
  • packages/cli/README.md: clear (generated rows in sync)
  • packages/cli/api/template/_adapter.mjs: clear
  • packages/cli/api/template/copy/copy.components.test.mjs: clear
  • packages/cli/api/template/copy/copy.mjs: clear
  • packages/cli/api/template/show/show.mjs: clear
  • packages/cli/api/template/template.doc.mjs: clear
  • packages/cli/api/template/template.mjs: clear
  • packages/cli/api/template/template.type.mjs: clear
  • packages/cli/clients/cli/commands/template.mjs: clear
  • packages/cli/foundation/discovery/template-adapter.mjs: finding (copied package helper)
  • packages/cli/foundation/response/response-types.doc.mjs: clear
  • packages/cli/test/__golden__/no-icon-set/template-copy.json: clear
  • packages/cli/test/__golden__/no-icon-set/template-copy.txt: clear
  • packages/cli/test/__golden__/no-icon-set/template-show.json: clear
  • packages/cli/test/__golden__/template.json: clear

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec e193c22

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: some of CI's test shards were still running on this head when it was reviewed.

The one blocking finding from the previous review is fixed: the template component list now imports the shared packageOf from foundation/render/served-packages.mjs instead of keeping its own copy, and the printed line and both JSON fields are unchanged. INV40 has an engineering owner's approval for this exact head, and nothing else needs to change.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Changeset: a copy prints one line right after the copy line that names the components for one component call: verified (clients/cli/commands/template.mjs:361-368, test "prints the line right after the copy line").
  • Changeset: a printed template prints the line on stderr and stdout stays the source: verified (commands/template.mjs:326-327; a printed table writes only its source to stdout).
  • Changeset: the names are the ones astryx component answers, in first-render order, each once, as <package>/<Name> in a project with an integration, without chart parts or local helpers, and no line when none are left: verified (template-adapter.mjs:2191-2252 and the new tests).
  • Changeset: --json carries components on the copy receipt and componentsToRead on show, with every existing field unchanged: verified (goldens, and the JSON keys before and after).
  • Description: the copy receipt gains components, and show gains componentsToRead beside its unchanged sorted components: verified (copy.mjs:189, show.mjs:69-70, test "names the same components and leaves components as it was").
  • Description: the line uses the CLI invocation other commands print, is plain ASCII, is absent for an empty list, and astryx build output is unchanged: verified (tests; nothing outside the template command calls the new code).
  • Description: the example list for the table page: verified (the same 18 names in a Core-only project; the prefix depends on how the CLI runs).
  • Description: the matching rules (named import, the package the import names documents the name, comments ignored, unbound and other-module tags dropped, family-root fold, first-use order): verified (template-adapter.mjs:2191-2252, tests).
  • Description: with any integration every name is <package>/<Name>, and a Core-only project gets bare names: verified (api/template/_adapter.mjs:92, :117; tests).
  • Description: the listed templates print the lists it names (dashboard without chart parts, no HoverCard for the two hover-card-hook pages, InputGroup InputGroupText TextInput, AvatarGroup, ResizeHandle): verified.
  • Description: the printed command, run as printed, reads every name in one call: verified (test).
  • Description: about 50 ms added in a Core-only project: consistent (about 65 ms warm; the lookup code is unchanged since it was measured).
  • Description: the agent comparison: the author's report; the pull request carries no data to check it.
  • Description: the new test's cases, goldens changed only for the new field and line, readme:check, check:knowledge, the API types check, and typecheck:strict with only two pre-existing errors in templates that need a theme build: verified.
  • Description: both fields are in the response-types reference and its generated README table, and the reference stays inside its 32 KB read budget: verified (readme:check in sync; the self-doc audit reports nothing oversized).

Files:

  • .changeset/template-components-line.md: clear
  • docs/architecture/cli-surface.md: clear (INV40 and its verification row, owner-approved for this head)
  • packages/cli/README.md: clear (generated rows in sync)
  • packages/cli/api/template/_adapter.mjs: clear
  • packages/cli/api/template/copy/copy.components.test.mjs: clear
  • packages/cli/api/template/copy/copy.mjs: clear
  • packages/cli/api/template/show/show.mjs: clear
  • packages/cli/api/template/template.doc.mjs: clear
  • packages/cli/api/template/template.mjs: clear
  • packages/cli/api/template/template.type.mjs: clear
  • packages/cli/clients/cli/commands/template.mjs: clear
  • packages/cli/foundation/discovery/template-adapter.mjs: clear (now imports the shared packageOf)
  • packages/cli/foundation/response/response-types.doc.mjs: clear
  • packages/cli/test/__golden__/no-icon-set/template-copy.json: clear
  • packages/cli/test/__golden__/no-icon-set/template-copy.txt: clear
  • packages/cli/test/__golden__/no-icon-set/template-show.json: clear
  • packages/cli/test/__golden__/template.json: clear

Automated review (maintainer link)

@josephfarina
josephfarina merged commit bbc0435 into main Nov 18, 2026
81 checks passed
@github-actions
github-actions Bot deleted the josephfarina/template-components-line branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — e193c22b Deployed Nov 18, 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