Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(cli): point agent docs at the layout doc instead of naming a shell (#4772)

Joeyf6cba819a7bf
diff --git a/.changeset/cli-agent-docs-layout-pointer.md b/.changeset/cli-agent-docs-layout-pointer.md
new file mode 100644
index 0000000000..81dd03e9cf
--- /dev/null
+++ b/.changeset/cli-agent-docs-layout-pointer.md
@@ -0,0 +1,8 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[fix] The generated agent cheat sheet hardcoded a shell recommendation ("Full page → AppShell; sidebar nav → SideNav", "pick the shell (AppShell / Layout+LayoutPanel)"), which answers a question that depends on the app archetype and duplicates guidance `astryx docs layout` already maintains. The two layout rules now send agents to that doc instead, so shell choice, region budgets, and the responsive contract have one source of truth.
+
+The rule cites the command rather than the docsite URL, in the block's established `astryx <cmd>` form that the header maps to the project's real invocation (`pnpm exec astryx`, `npx @astryxdesign/cli`, …). `astryx docs` reads the docs shipped inside the installed version, so an agent can't be shown an API that release doesn't have.
+@josephfarina
diff --git a/packages/cli/foundation/agent-docs/agent-docs.mjs b/packages/cli/foundation/agent-docs/agent-docs.mjs
index e6f1d9b131..eef9829bf8 100644
--- a/packages/cli/foundation/agent-docs/agent-docs.mjs
+++ b/packages/cli/foundation/agent-docs/agent-docs.mjs
@@ -341,10 +341,9 @@ export function generateCompressedIndex(version, {coreDir, invocation = getCliIn
// Rules — the top error-preventers.
lines.push('RULES:');
- lines.push('- No <div> — components do all layout/spacing. Full page → AppShell; sidebar nav → SideNav.');
- lines.push('- Frame first: pick the shell (AppShell / Layout+LayoutPanel) and budget regions in px BEFORE writing content (`astryx docs layout`).');
- lines.push('- Dense data = rows (Table, List/Item) edge-to-edge — never Card-wrapped list items. Card = dashboard widgets, galleries, settings groups only.');
- lines.push('- Status → StatusDot/Token; Badge only for counts and enumerated states, never decoration.');
+ lines.push('- No <div> — components do all layout/spacing, page frame included.');
+ lines.push('- Frame first: read `astryx docs layout` before writing any page or screen — page frame, region widths, breakpoint behavior.');
+ lines.push('- Dense data = rows (Table, List/Item), never Card-wrapped list items; Card is for standalone widgets. Status = StatusDot/Token; Badge = counts only.');
// Styling guidance tailored to the project's configured system — never
// recommend a path that isn't compiled here (xstyle needs the StyleX compiler;
// utilities need Tailwind). Tokens are always the source of truth.
diff --git a/packages/cli/foundation/agent-docs/agent-docs.test.mjs b/packages/cli/foundation/agent-docs/agent-docs.test.mjs
index 9b82745667..466968a6d4 100644
--- a/packages/cli/foundation/agent-docs/agent-docs.test.mjs
+++ b/packages/cli/foundation/agent-docs/agent-docs.test.mjs
@@ -46,6 +46,14 @@ describe('generateCompressedIndex', () => {
expect(result).toMatch(/never override --color-/);
});
+ it('sends frame choice to the layout doc rather than naming a shell', () => {
+ const result = generateCompressedIndex('1.0.0');
+ const frameRule = result.split('\n').find(l => l.includes('Frame first'));
+ expect(frameRule).toContain('astryx docs layout');
+ expect(result).not.toMatch(/AppShell/);
+ expect(frameRule).not.toMatch(/https?:/);
+ });
+
it('includes the post-generation self-check rule', () => {
const result = generateCompressedIndex('1.0.0');
expect(result).toContain('SELF-CHECK before you finish');