Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/cli-build-first-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@astryxdesign/cli': patch
---

[feat] Make generated agent docs build-first and restructure `init` output.

The generated `CLAUDE.md` now leads with the `build` workflow (search reframed as
a neutral universal find), and includes a required-CSS setup note
(`reset.css` + `astryx.css`) so components never render unstyled. `init` now
points agents at `astryx build`/`astryx search` instead of dumping page-template
names.
@joeyfarina
29 changes: 23 additions & 6 deletions packages/cli/src/commands/agent-docs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,29 @@ export function generateCompressedIndex(version, {coreDir, runPrefix = getRunPre
lines.push(`Astryx v${version} β€” ${componentCount} components`);
lines.push('');

// Behavioral workflow β€” templates first, then component lookup
// One-time project setup β€” components ship precompiled CSS that MUST be
// imported, or everything renders unstyled. Stated as text (the CLI does not
// edit your files). The Theme provider is OPTIONAL (a default theme ships in
// astryx.css); only the CSS imports are required.
lines.push('SETUP (required, once) β€” in your app entry (e.g. main.tsx):');
lines.push(' import "@astryxdesign/core/reset.css";');
lines.push(' import "@astryxdesign/core/astryx.css";');
Comment on lines +129 to +130

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a big failing point where an agent forgets to add the required css. Adding instructions in the init output seem to solve it.

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.

Is it better to put it in agent docs or have it link a getting started doc?

lines.push('Without these CSS imports, components render completely unstyled.');
lines.push(`Optional: apply a specific theme with <Theme> β€” see \`${run} docs theme\`.`);
lines.push('');

// Behavioral workflow β€” `build` is the front door for making pages: it returns
// a composition kit, and `build` with no args prints the full how-to playbook.
lines.push('Before writing any UI code:');
lines.push(`1. \`${run} template --list\` β€” find a related page pattern`);
lines.push(`2. \`${run} template <name> --skeleton\` β€” study layout structure (gap, padding, nesting)`);
lines.push(`3. \`${run} component <Name>\` β€” read props + examples for EVERY component you use`);
lines.push(
`1. \`${run} build "<what you're building>"\` β€” START HERE. Returns a composition kit: the closest [page] recipe (scaffold it, or use as a layout reference), the [block]s that cover parts, and the [component]s to fill gaps. (Run \`${run} build\` with no args for the full how-to-build playbook.)`,
);
lines.push(`2. \`${run} template <name> --skeleton\` β€” scaffold a matched [page], or study its layout (gap, padding, nesting)`);
lines.push(`3. \`${run} template <BlockName>\` β€” drop in each [block] the kit surfaced (ready-made multi-component patterns) instead of hand-building`);
lines.push(`4. \`${run} component <Name>\` β€” read props + examples for EVERY component you use`);
lines.push('');
lines.push('Templates are reference code β€” read them for composition patterns, not just scaffolding.');
lines.push('Full pages β†’ dashboard (uses AppShell). Forms β†’ contact-form. Tables β†’ data-table. Settings β†’ settings-sidebar.');
lines.push('Templates and blocks are reference code β€” read them for composition patterns, not just scaffolding.');
lines.push(`(\`${run} search <query>\` is a neutral find across components/hooks/docs/templates when you just need to look something up.)`);
lines.push('');

// Rules β€” inline, compact, prevents the top error categories
Expand All @@ -141,6 +156,8 @@ export function generateCompressedIndex(version, {coreDir, runPrefix = getRunPre
lines.push('');

// CLI quick reference
lines.push(`${run} build "<idea>" START HERE for pages β€” kit: closest page + blocks + components (\`build\` = how-to playbook)`);
lines.push(`${run} search "<query>" find anything: components, hooks, docs, templates, blocks`);
lines.push(`${run} component --list ${componentCount} components by category`);
lines.push(`${run} component <Name> props, types, examples`);

Expand Down
10 changes: 9 additions & 1 deletion packages/cli/src/commands/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ async function runTemplate(targetDir, {interactive = true, templateName} = {}) {

if (!interactive) {
if (!templateName) {
humanLog(`βœ“ Available templates: ${templates.join(', ')}. Use ${run} astryx template <name> [path].`);
// Point agents at the build workflow rather than dumping page-template
// names β€” `build` surfaces pages AND blocks AND components for an idea,
// and `build` with no args is the full how-to-build playbook.
humanLog('βœ“ To build UI, use these commands:');
humanLog('');
humanLog(` ${run} astryx build "<what you're building>" build a page β€” kit: closest template + blocks + components`);
humanLog(` ${run} astryx build the how-to-build workflow (read this first)`);
humanLog(` ${run} astryx search <query> find anything β€” components, docs, templates, blocks`);
humanLog('');
return;
}

Expand Down
Loading