From bfd3fe644bbbf1df2d059059b7c5b311f6b80601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 12 Nov 2026 17:37:28 +0000 Subject: [PATCH] fix(cli): add --dir names the exact init command for a missing folder (#7615) --- CONTRIBUTING.md | 2 +- packages/cli/src/commands/add.test.ts | 4 +++- packages/cli/src/commands/add.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8631b0b07c..0a9a99df64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -142,7 +142,7 @@ before merge, listed at the end. 1. Create `registry///registry-item.json` following the [schema](packages/core/schemas/registry-item.json) 2. For components: include a `demo.html` 3. Run `npx hyperframes lint` and `npx hyperframes validate` on your HTML -4. Test the install flow: `hyperframes add --dir /tmp/test-project` +4. Test the install flow: `hyperframes init /tmp/test-project`, then `hyperframes add --dir /tmp/test-project` 5. Generate and validate the catalog: `bun run check:catalog-drift` ### Generated catalog files diff --git a/packages/cli/src/commands/add.test.ts b/packages/cli/src/commands/add.test.ts index b75c60cce7..bd681c5e76 100644 --- a/packages/cli/src/commands/add.test.ts +++ b/packages/cli/src/commands/add.test.ts @@ -606,7 +606,9 @@ describe("add command run() — several names", () => { const out = JSON.parse(String(log.mock.calls[0]?.[0])); expect(out.error.message).toContain(`Project folder not found: ${missing}`); expect(out.error.message).toContain("--dir is the project root"); - expect(out.error.message).toContain("hyperframes init"); + expect(out.error.message).toContain( + `Create one with \`hyperframes init ${JSON.stringify(missing)}\``, + ); expect(existsSync(missing)).toBe(false); }); diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts index bd2968114f..d9b9205222 100644 --- a/packages/cli/src/commands/add.ts +++ b/packages/cli/src/commands/add.ts @@ -566,7 +566,7 @@ export default defineCommand({ if (!existsSync(projectDir)) { failCaught( new Error( - `Project folder not found: ${projectDir}. --dir is the project root, not where the block lands (that is its compositions/ folder), and it must already exist. Create one with \`hyperframes init \`.`, + `Project folder not found: ${projectDir}. --dir is the project root, not where the block lands (that is its compositions/ folder), and it must already exist. Create one with \`hyperframes init ${JSON.stringify(args.dir)}\`.`, ), json, c.error,