Skip to content

fix(cli): recommend --skeleton in the build kit payload, not just the prose - #6255

Merged
ernestt merged 1 commit into
mainfrom
cli-kit-skeleton-command
Sep 12, 2026
Merged

ernestt merged 1 commit into
mainfrom
cli-kit-skeleton-command

Conversation

@ernestt

@ernestt ernestt commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

The problem

build already decides whether the closest page template is a confident direct match, and on a loose match it tells a human to read the layout rather than scaffold it:

RECOMMENDED START
No exact match, but `settings-dialog` is the closest page template - run the above
to print its layout as a reference, then compose.
pnpm exec astryx template settings-dialog --skeleton

PAGE TEMPLATES
Closest full-page templates - use as a layout reference.

The page entries in the payload did not agree with any of that. Their command was always the scaffold command, whatever directMatch said:

$ astryx build "notifications" --json
directMatch: false
   settings-dialog -> "astryx template settings-dialog"
   table-inbox     -> "astryx template table-inbox"

So the recommendation and the records under it disagreed, in the same output. Prose is what a human weighs; command is what a program reads.

This is reachable often, not a corner: of 30 common one-word queries (inbox, metrics, billing, alerts, queue, timeline, …), 14 land on a loose match with pages, because single-concept queries have no coverage requirement to fail.

Why it matters more for agent callers

template <name> emits the whole page. An agent handed a full template it did not quite ask for will adapt it anyway — that is the cheapest thing to do with it — which is how a request for one screen comes back as a competent version of another. --skeleton gives the same layout without the invitation.

A human reads the sentence above the record and can disregard the command. A JSON consumer has only the field.

The change

buildKit appends --skeleton to its page commands when directMatch is false.

This is not CLI prefixing: the invocation is still applied by the renderer through formatCliCommand, and the payload stays package-manager-agnostic. Entries are copied rather than mutated, since they belong to search().

It also fixes the rendered output, where the PAGE TEMPLATES records now agree with the heading above them.

After

$ astryx build "notifications" --json
directMatch: false
   settings-dialog -> "astryx template settings-dialog --skeleton"
   table-inbox     -> "astryx template table-inbox --skeleton"

$ astryx build "contact form" --json
directMatch: true
   contact-form    -> "astryx template contact-form"
   form-two-column -> "astryx template form-two-column"
   payment-form    -> "astryx template payment-form"

Test plan

Three tests added to packages/cli/api/build/build.test.mjs:

  • a loose match (notifications) recommends --skeleton on every page entry;
  • a direct match (contact form) recommends none;
  • the appended flag does not turn into an invocation prefix — that stays the renderer's job.
✓ packages/cli/api/build/build.test.mjs (17 tests)
  ✓ recommends reading the layout, not scaffolding it, on a loose match
  ✓ recommends scaffolding on a direct match
  ✓ keeps the recommendation package-manager-agnostic

pnpm lint:strict — 0 errors (84 pre-existing no-raw-color warnings in packages/lab/Sankey, untouched here).

Verified end to end against the built CLI for both the --json and the human-rendered paths; the transcripts above are that output.

… prose

`build` decides whether the closest page template is a direct match, and on a
loose match it already tells a human to read the layout rather than scaffold
it: RECOMMENDED START prints `template <name> --skeleton` and the PAGE
TEMPLATES heading reads "use as a layout reference".

The page entries in the payload did not agree. Their `command` was always
`template <name>` — the scaffold — whatever `directMatch` said. Prose is what
a human weighs; `command` is what a program reads, so the two audiences were
handed opposite advice from the same kit.

It matters most for the caller least able to notice. `template <name>` emits
the whole page, and an agent given a full template it did not quite ask for
will adapt it anyway, which is how a request for one screen comes back as a
competent version of another. `--skeleton` offers the layout without the
invitation.

The kit now appends `--skeleton` to its page commands when `directMatch` is
false. This is not CLI prefixing — the invocation is still the renderer's job,
and the payload stays package-manager-agnostic. It also makes the rendered
PAGE TEMPLATES records agree with the heading above them.
@vercel

vercel Bot commented Sep 11, 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 Sep 11, 2026 7:26pm UTC

Request Review

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

astracat-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Sep 11, 2026, 8:00 PM UTC

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | View full report

@ernestt
ernestt marked this pull request as ready for review September 11, 2026 19:52
@josephfarina

Copy link
Copy Markdown
Contributor

Let's try it! Maybe also an option for build to force it eitehr way incase someone wants to bypass. Maybe something like --recommend-skelton=auto|true|false or something? that has guides in the --help menu and we default to auto which this PR is. wdyt?

@ernestt
ernestt merged commit 6ee849a into main Sep 12, 2026
35 checks passed
@github-actions
github-actions Bot deleted the cli-kit-skeleton-command branch September 12, 2026 06:20

This branch was successfully deployed

1 active deployment
Preview — aa1633af Deployed Sep 11, 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.

2 participants