From e61d1fe0024423de5e6a82ef7de5ec1b9aa489b3 Mon Sep 17 00:00:00 2001 From: WadydX <8077337604+WadydX@users.noreply.github.com> Date: Sun, 10 May 2026 19:01:31 +0100 Subject: [PATCH 1/2] fix(cli): avoid -V collision for init video flag --- packages/cli/src/commands/init.test.ts | 12 ++++++++++++ packages/cli/src/commands/init.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/init.test.ts b/packages/cli/src/commands/init.test.ts index 59cfa7ca4..08c6614d0 100644 --- a/packages/cli/src/commands/init.test.ts +++ b/packages/cli/src/commands/init.test.ts @@ -132,6 +132,18 @@ describe("hyperframes init flag rename", () => { expect(injected).not.toContain("setTimeout"); }); + it("-v works as the short alias for --video", () => { + const dir = mkdtempSync(join(tmpdir(), "hf-init-test-")); + const target = join(dir, "proj"); + try { + const res = runInit([target, "--example", "blank", "--non-interactive", "--skip-skills", "-v", "missing.mp4"]); + expect(res.status).toBe(1); + expect(res.stderr).toContain("Video file not found: missing.mp4"); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); + it("--template prints a rename hint and exits non-zero", () => { const dir = mkdtempSync(join(tmpdir(), "hf-init-test-")); const target = join(dir, "proj"); diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index 443368619..dc79bb8c2 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -588,7 +588,7 @@ export default defineCommand({ video: { type: "string", description: "Path to a video file (MP4, WebM, MOV)", - alias: "V", + alias: "v", }, audio: { type: "string", From 2778845bd3a18c0d12b26036d0e0e2efa2891279 Mon Sep 17 00:00:00 2001 From: WadydX <8077337604+WadydX@users.noreply.github.com> Date: Sun, 10 May 2026 21:31:17 +0100 Subject: [PATCH 2/2] fix(cli): handle init -V with explicit migration error --- packages/cli/src/cli.ts | 13 ++++++++--- packages/cli/src/commands/init.test.ts | 30 +++++++++++++++++++++++++- packages/cli/src/commands/init.ts | 14 ++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 29f4a09fc..81b83b69f 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -5,7 +5,14 @@ // `hyperframes --version` near-instant (~10ms vs ~80ms). import { VERSION } from "./version.js"; -if (process.argv.includes("--version") || process.argv.includes("-V")) { +const argv = process.argv.slice(2); +const commandArg = argv[0]; +const rootVersionRequested = + commandArg === "--version" || + commandArg === "-V" || + (commandArg === undefined && (argv.includes("--version") || argv.includes("-V"))); + +if (rootVersionRequested) { console.log(VERSION); process.exit(0); } @@ -64,8 +71,8 @@ const main = defineCommand({ // Telemetry — lazy-loaded, captured references for exit handlers // --------------------------------------------------------------------------- -const commandArg = process.argv[2]; -const command = commandArg && commandArg in subCommands ? commandArg : "unknown"; +const cliCommandArg = process.argv[2]; +const command = cliCommandArg && cliCommandArg in subCommands ? cliCommandArg : "unknown"; const hasJsonFlag = process.argv.includes("--json"); // Captured references — populated when the lazy imports resolve. diff --git a/packages/cli/src/commands/init.test.ts b/packages/cli/src/commands/init.test.ts index 08c6614d0..392b0a936 100644 --- a/packages/cli/src/commands/init.test.ts +++ b/packages/cli/src/commands/init.test.ts @@ -136,7 +136,15 @@ describe("hyperframes init flag rename", () => { const dir = mkdtempSync(join(tmpdir(), "hf-init-test-")); const target = join(dir, "proj"); try { - const res = runInit([target, "--example", "blank", "--non-interactive", "--skip-skills", "-v", "missing.mp4"]); + const res = runInit([ + target, + "--example", + "blank", + "--non-interactive", + "--skip-skills", + "-v", + "missing.mp4", + ]); expect(res.status).toBe(1); expect(res.stderr).toContain("Video file not found: missing.mp4"); } finally { @@ -144,6 +152,26 @@ describe("hyperframes init flag rename", () => { } }); + it("-V prints a migration error instead of version fast-path", () => { + const dir = mkdtempSync(join(tmpdir(), "hf-init-test-")); + const target = join(dir, "proj"); + try { + const res = runInit([ + target, + "--example", + "blank", + "--non-interactive", + "--skip-skills", + "-V", + "missing.mp4", + ]); + expect(res.status).toBe(1); + expect(res.stderr).toContain("The -V short flag no longer maps to --video"); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); + it("--template prints a rename hint and exits non-zero", () => { const dir = mkdtempSync(join(tmpdir(), "hf-init-test-")); const target = join(dir, "proj"); diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index dc79bb8c2..6136cdaa5 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -590,6 +590,12 @@ export default defineCommand({ description: "Path to a video file (MP4, WebM, MOV)", alias: "v", }, + "video-legacy": { + type: "string", + description: "[renamed] Use --video (or -v) instead of -V.", + alias: "V", + hidden: true, + }, audio: { type: "string", description: "Path to an audio file (MP3, WAV, M4A)", @@ -638,6 +644,14 @@ export default defineCommand({ ); process.exit(1); } + if (args["video-legacy"] !== undefined) { + console.error( + c.error( + `The -V short flag no longer maps to --video. Use --video (or -v). Example:\n npx hyperframes init ${args.name ?? "my-video"} --video "${args["video-legacy"]}"`, + ), + ); + process.exit(1); + } const exampleFlag = args.example; const videoFlag = args.video; const audioFlag = args.audio;