Skip to content

[fix] Template and build tell you what the template needs that your project lacks - #7183

Merged
josephfarina merged 4 commits into
mainfrom
fix/template-setup-notes
Oct 8, 2026
Merged

josephfarina merged 4 commits into
mainfrom
fix/template-setup-notes

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

When astryx template scaffolds a file that imports packages the project does not have, the receipt now says what is missing and prints a ready-to-run install command.

Before: scaffolding table-filter into a fresh Vite app with no extra deps gives no hint that lucide-react is needed or that StyleX requires a compiler plugin. The template crashes at runtime.

After: the scaffold output includes:

  • Install missing dependencies: npm install lucide-react@"^1.18.0"
  • This template uses StyleX. Your project needs a StyleX compiler plugin — see astryx docs styling-overview for setup steps.

astryx build shows the same notes on its start template. Projects that already have everything installed see no change.

What changed

Area Change
template copy Derives external imports from the template source at copy time. Checks each against the project deps. Reports missing ones with version ranges from the CLI workspace, using the detected package manager.
build kit The start template carries the same notes (via the adapter, per INV21).
agent-docs The no-compiler guidance now acknowledges that some templates use StyleX and points to styling-overview.
detectStylingSystem Covers the official @stylexjs/rollup-plugin, webpack-plugin, and nextjs-plugin the setup doc recommends.
styling-overview doc Notes that some built-in templates use StyleX.

JSON

template.copy receipt gains notes: string[], missingPackages: string[], installCommand: string | null. All additive, always present. BuildStart gains optional notes?: string[] (AST-048 DEC-5: additive JSON). No existing field changes shape.

Tests

  • 12 new tests for template-needs (import extraction, missing-package detection, StyleX compiler, package-manager detection).
  • Updated agent-docs tests for the templates mention and the 3 new official compiler plugins.
  • 6107 existing tests pass (385 files).
  • Build kit tests pass (88 tests) — start/alternatives byte-identical when deps are present.

Proof

Fresh Vite React app with only react + core installed:

  • astryx template table-filter → notes: lucide-react install + StyleX warning
  • astryx template dashboard-scorecard → notes: recharts + heroicons install + StyleX warning
  • Same project with all deps + @stylexjs/rollup-plugin → notes: empty

Base: 9613feb

…roject lacks

When astryx template scaffolds a file that imports packages the project
does not have (heroicons, recharts, lucide-react, etc.), the receipt now
includes a ready-to-run install command with version ranges from the CLI
workspace. astryx build shows the same notes on its start template.

When the template uses StyleX and the project has no compiler plugin, the
receipt warns and points to astryx docs styling-overview. The agent-docs
block stops saying "do not use xstyle" flat-out and acknowledges that
some templates need it.

detectStylingSystem now covers @stylexjs/rollup-plugin, webpack-plugin,
and nextjs-plugin alongside the existing entries.
@vercel

vercel Bot commented Oct 8, 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 Oct 8, 2026 11:08pm UTC

Request Review

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

astracat-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
⏳ Queued (for maintainers only) Oct 8, 2026, 11:21 PM UTC

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@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.

Thanks — the setup notes themselves work as described. I reproduced the examples locally: table-filter in a fresh project now reports the lucide-react install command (with the workspace version range) plus the StyleX compiler note, dashboard-scorecard reports recharts/@heroicons/react, and a project that already has everything gets no notes. Targeted template/build/agent-docs tests and the JSON-API typecheck pass.

Two changes are needed before this can be approved:

  • Document the new response fields for consumers. notes, missingPackages, and installCommand (and the build start's optional notes) are now part of stable JSON responses, but the consumer-facing descriptions that enumerate those receipts — in response-types.doc.mjs, template.doc.mjs, and build.doc.mjs — still list only the old fields. Please name the new fields there so JSON consumers can discover them; the type files alone don't reach that audience.
  • Don't report Node builtins as installable packages. A template importing node:fs or path currently yields npm install node:fs path. No built-in template does this today, but excluding node: specifiers and builtin module names (with a small test) keeps the advice trustworthy for integration templates.

Everything else checks out, including the additive shape of the JSON changes and the adapter routing on the build side.

[Automated review]

- Name notes, missingPackages, installCommand (and BuildStart notes)
  in response-types.doc.mjs, template.doc.mjs, build.doc.mjs.
- Exclude node: prefixed imports and builtinModules from the package
  scanner, with tests for both and for subpath-to-root mapping.
- Regenerate README tables.
@josephfarina

Copy link
Copy Markdown
Contributor Author

Both addressed in 656efa8:

  • Consumer docs: Named notes, missingPackages, installCommand (and the build start's optional notes) in response-types.doc.mjs, template.doc.mjs, and build.doc.mjs. README generated tables regenerated.
  • Node builtins: The import scanner now skips node:-prefixed specifiers and every name in builtinModules (including subpaths like fs/promises). Added tests for both, plus a subpath-to-package-root mapping test.

@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.

Both items from the last review are addressed; one thing from the merge needs fixing before approval.

  • The new fields are now described where JSON consumers look: response-types.doc.mjs and template.doc.mjs name notes, missingPackages and installCommand, and build.doc.mjs names the start template's optional notes.
  • Node builtins are excluded: node:fs, path and fs/promises no longer appear in missingPackages (checked with extractImportedPackages on this head; recharts, @heroicons/react and @astryxdesign/core still do). The template-needs and agent-docs suites pass 116/116.
  • Fix the packages/cli/README.md merge resolution. The merge from main conflicted in the generated README and was resolved to this branch's copy, which drops the [DEPRECATED: DEP-0006 …] marker that main added to the layout command row (#7175). pnpm -F @astryxdesign/cli readme --check fails at this head, and CI does not run that check, so it would land as-is. Run pnpm -F @astryxdesign/cli readme on the merged tree and commit the result; the response-types rows are already right.

The Changeset reads accurately for the shipped behavior.

[Automated review]

@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.

Approving. The README is regenerated on the merged tree, and that is the only change since the last review.

  • generate-cli-readme.mjs --check passes at this head ("README generated tables are in sync"); the layout command row carries the DEP-0006 deprecation marker from main again, and the template.copy row names the new fields. The diff from d0988c3 is packages/cli/README.md only (18 lines changed).
  • Everything verified on the previous head stands: the new JSON fields are described in response-types.doc.mjs, template.doc.mjs and build.doc.mjs; Node builtins (node: specifiers and builtin module names) are excluded from missingPackages; template-needs and agent-docs suites pass 116/116; the fields are additive beside existing ones and build reads project deps through its adapter.

[Automated review]

@josephfarina
josephfarina merged commit f9a0f47 into main Oct 8, 2026
42 of 43 checks passed
@github-actions
github-actions Bot deleted the fix/template-setup-notes branch October 9, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 0808807b Deployed Oct 8, 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