An open source design system that's fully customizable and agent ready
TypeScript
[CLI] fix: suppress empty template headers + add brief import-hint tests (#7177)
Joeyee02ce262ae6
diff --git a/.changeset/fix-template-empty-header.md b/.changeset/fix-template-empty-header.mdnew file mode 100644index 0000000000..d2bed96c2c--- /dev/null+++ b/.changeset/fix-template-empty-header.md@@ -0,0 +1,6 @@+---+'@astryxdesign/cli': patch+---++[fix] template: bare `template --type` no longer prints an empty group header+@josephfarinadiff --git a/packages/cli/clients/cli/commands/import-hint-correctness.test.mjs b/packages/cli/clients/cli/commands/import-hint-correctness.test.mjsindex 9fa8bd3906..fba81765fe 100644--- a/packages/cli/clients/cli/commands/import-hint-correctness.test.mjs+++ b/packages/cli/clients/cli/commands/import-hint-correctness.test.mjs@@ -248,4 +248,27 @@ describe('import hint correctness', () => {});}});++ describe('CLI --detail brief text output for a single component', () => {+ it('brief text output names the component and its package', async () => {+ const result = await runCli(['component', 'Button', '--detail', 'brief'], REPO_ROOT);+ expect(result.code).toBe(0);+ expect(result.stdout).toContain('Button');+ expect(result.stdout).toContain('@astryxdesign/core');+ });++ it('brief text is shorter than compact text', async () => {+ const brief = await runCli(['component', 'Button', '--detail', 'brief'], REPO_ROOT);+ const compact = await runCli(['component', 'Button', '--detail', 'compact'], REPO_ROOT);+ expect(brief.code).toBe(0);+ expect(compact.code).toBe(0);+ expect(brief.stdout.length).toBeLessThan(compact.stdout.length);+ });++ it('brief text shows the import path in the signature line', async () => {+ const result = await runCli(['component', 'Button', '--detail', 'brief'], REPO_ROOT);+ expect(result.code).toBe(0);+ expect(result.stdout).toContain('@astryxdesign/core/Button');+ });+ });});diff --git a/packages/cli/clients/cli/commands/template.mjs b/packages/cli/clients/cli/commands/template.mjsindex 4b0cdbd925..8b9560cea1 100644--- a/packages/cli/clients/cli/commands/template.mjs+++ b/packages/cli/clients/cli/commands/template.mjs@@ -137,9 +137,9 @@ export function registerTemplate(program) {return lines.join('\n');};emit(- section(`Page Templates (${pages.length})`),+ pages.length > 0 && section(`Page Templates (${pages.length})`),pages.length > 0 && text(grouped(pages)),- section(`Block Templates (${blocks.length})`),+ blocks.length > 0 && section(`Block Templates (${blocks.length})`),blocks.length > 0 && text(grouped(blocks)),section('Usage'),text(