Skip to content

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

TypeScript

fix(cli): use JSON key names in the manifest's text output (#6552)

Joey6e85d64632c3
diff --git a/.changeset/cli-spec-manifest-text-fields.md b/.changeset/cli-spec-manifest-text-fields.md
new file mode 100644
index 0000000000..c0543a8e81
--- /dev/null
+++ b/.changeset/cli-spec-manifest-text-fields.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[fix] `astryx manifest` without `--json` now labels each command's name `name:`, the same key the JSON manifest uses, instead of `command:`.
+
+@josephfarina
diff --git a/packages/cli/clients/cli/index.mjs b/packages/cli/clients/cli/index.mjs
index a9679d451f..fc92ab87ef 100644
--- a/packages/cli/clients/cli/index.mjs
+++ b/packages/cli/clients/cli/index.mjs
@@ -601,16 +601,16 @@ export async function createProgram() {
}
// Human-readable summary as greppable records (agents should use --json).
// One record per command: name, whether it supports --json, and the
- // description.
+ // description. Field names are the manifest entry's own keys.
emit(
section(`${manifest.name} v${manifest.version} (${manifest.commands.length} commands)`),
records(
manifest.commands.map(c => ({
- command: c.name,
+ name: c.name,
json: c.json ? 'yes' : '',
description: c.description || '',
})),
- {fields: ['command', 'json', 'description']},
+ {fields: ['name', 'json', 'description']},
),
text(`Run \`${getCliInvocation()} manifest --json\` for the full structured manifest.`),
);
diff --git a/packages/cli/clients/cli/lib/manifest.test.mjs b/packages/cli/clients/cli/lib/manifest.test.mjs
index 88a005e8cf..42fbc50451 100644
--- a/packages/cli/clients/cli/lib/manifest.test.mjs
+++ b/packages/cli/clients/cli/lib/manifest.test.mjs
@@ -196,3 +196,20 @@ describe('manifest: e2e', () => {
.toContain('component.list');
});
});
+
+describe('manifest: text projection', () => {
+ it('astryx manifest (text) uses the JSON entry keys as its field names', async () => {
+ const text = await runCli(['manifest']);
+ expect(text.status).toBe(0);
+ const json = JSON.parse((await runCli(['manifest', '--json'])).stdout);
+ const jsonKeys = new Set(json.data.commands.flatMap((c) => Object.keys(c)));
+ const textKeys = new Set(
+ text.stdout
+ .split('\n')
+ .map((line) => /^([A-Za-z]+):\s/.exec(line)?.[1])
+ .filter(Boolean),
+ );
+ expect(textKeys).toContain('name');
+ for (const key of textKeys) expect(jsonKeys).toContain(key);
+ });
+});