fix(cli): resolve init --video short-flag collision with global -V#704
Conversation
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks for the fix. The issue is real: I reproduced hyperframes@0.5.5 treating init ... -V missing.mp4 as the global version fast-path while --video missing.mp4 reaches init's video handling.
I don't think this PR is merge-ready yet for two reasons:
-
It changes the forward-looking short alias to
-v, butinit ... -V missing.mp4still silently prints the version and exits 0 on this branch. If-Vis no longer supported forinit --video, we should not leave the old invocation looking successful while doing nothing. Please either narrow the global-Vfast-path so it only applies at the root command, or rejectinit -Vwith a clear conflict/rename error. -
The added test is not formatted according to repo checks.
bunx oxfmt --check packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.tsfails, andoxfmtonly wants to wrap the newrunInit([...])argument list.
Validation I ran on head e61d1fe0024423de5e6a82ef7de5ec1b9aa489b3:
bun install --frozen-lockfilebun run build:hyperframes-runtimebun run --filter @hyperframes/cli test -- src/commands/init.test.ts-> passed, 15 testsbun run packages/cli/src/cli.ts init /tmp/hf-pr704-short-v --example blank --non-interactive --skip-skills -v missing.mp4-> reaches video path withVideo file not found: missing.mp4bun run packages/cli/src/cli.ts init /tmp/hf-pr704-long-video --example blank --non-interactive --skip-skills --video missing.mp4-> reaches video path withVideo file not found: missing.mp4bunx oxlint packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts-> passedbunx oxfmt --check packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts-> failed
|
Thanks — addressed both points in commit 2778845. What changed:
Net effect:
Please re-review when convenient. |
miguel-heygen
left a comment
There was a problem hiding this comment.
Rechecked head 2778845bd3a18c0d12b26036d0e0e2efa2891279; the blockers from my previous review are addressed.
What changed correctly:
init --videokeeps the long flag.init -vnow reaches the video path.init -Vno longer silently prints the root CLI version; it exits non-zero with a clear migration message to use--videoor-v.- The added test formatting is now clean.
Local validation:
bun install --frozen-lockfilebun run build:hyperframes-runtimebun run --filter @hyperframes/cli test -- src/commands/init.test.ts-> passed, 16 testsbun run packages/cli/src/cli.ts init /tmp/hf-pr704-recheck-short-v --example blank --non-interactive --skip-skills -v missing.mp4-> expectedVideo file not found: missing.mp4bun run packages/cli/src/cli.ts init /tmp/hf-pr704-recheck-capital-v --example blank --non-interactive --skip-skills -V missing.mp4-> expected migration errorbun run packages/cli/src/cli.ts --versionandbun run packages/cli/src/cli.ts -V-> still print versionbunx oxlint packages/cli/src/cli.ts packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts-> passedbunx oxfmt --check packages/cli/src/cli.ts packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts-> passed
CI at review time has the relevant CLI/build/test/typecheck/format checks passing; render regression shards are still pending, but I do not see a remaining code-level blocker for this CLI fix.
Summary
initshort flag for--videofrom-Vto-v-Vversion fast-path incli.ts-vis parsed as the video flagWhy
cli.tsexits early on-Vfor version output, soinit -V <file>can never reachinitargument parsing. This patch removes the flag collision at the command surface.Validation
packages/cli/src/commands/init.test.ts:-v works as the short alias for --videoNotes
bunis unavailable (bun: command not found).Closes #702