Skip to content

fix(cli): resolve init --video short-flag collision with global -V#704

Merged
miguel-heygen merged 2 commits into
heygen-com:mainfrom
WadydX:fix/init-video-short-flag-conflict
May 10, 2026
Merged

fix(cli): resolve init --video short-flag collision with global -V#704
miguel-heygen merged 2 commits into
heygen-com:mainfrom
WadydX:fix/init-video-short-flag-conflict

Conversation

@WadydX
Copy link
Copy Markdown

@WadydX WadydX commented May 10, 2026

Summary

  • changes init short flag for --video from -V to -v
  • avoids collision with top-level -V version fast-path in cli.ts
  • adds a regression test that verifies -v is parsed as the video flag

Why

cli.ts exits early on -V for version output, so init -V <file> can never reach init argument parsing. This patch removes the flag collision at the command surface.

Validation

  • Static verification of source conflict and flag parsing path
  • Added test in packages/cli/src/commands/init.test.ts:
    • -v works as the short alias for --video

Notes

  • Runtime tests were not executed in this environment because bun is unavailable (bun: command not found).

Closes #702

Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. It changes the forward-looking short alias to -v, but init ... -V missing.mp4 still silently prints the version and exits 0 on this branch. If -V is no longer supported for init --video, we should not leave the old invocation looking successful while doing nothing. Please either narrow the global -V fast-path so it only applies at the root command, or reject init -V with a clear conflict/rename error.

  2. 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.ts fails, and oxfmt only wants to wrap the new runInit([...]) argument list.

Validation I ran on head e61d1fe0024423de5e6a82ef7de5ec1b9aa489b3:

  • bun install --frozen-lockfile
  • bun run build:hyperframes-runtime
  • bun run --filter @hyperframes/cli test -- src/commands/init.test.ts -> passed, 15 tests
  • bun run packages/cli/src/cli.ts init /tmp/hf-pr704-short-v --example blank --non-interactive --skip-skills -v missing.mp4 -> reaches video path with Video file not found: missing.mp4
  • bun run packages/cli/src/cli.ts init /tmp/hf-pr704-long-video --example blank --non-interactive --skip-skills --video missing.mp4 -> reaches video path with Video file not found: missing.mp4
  • bunx oxlint packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts -> passed
  • bunx oxfmt --check packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts -> failed

@WadydX
Copy link
Copy Markdown
Author

WadydX commented May 10, 2026

Thanks — addressed both points in commit 2778845.

What changed:

  • narrowed root -V/--version fast-path so subcommands can parse their own flags
  • added hidden legacy -V mapping in init that now fails with a clear migration error (use --video or -v)
  • formatted the new test argument list and added coverage for the init -V migration-error path

Net effect:

  • hyperframes -V still prints version fast
  • hyperframes init -V file.mp4 no longer silently succeeds; it now exits non-zero with explicit guidance
  • hyperframes init -v file.mp4 continues to map to --video

Please re-review when convenient.

Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked head 2778845bd3a18c0d12b26036d0e0e2efa2891279; the blockers from my previous review are addressed.

What changed correctly:

  • init --video keeps the long flag.
  • init -v now reaches the video path.
  • init -V no longer silently prints the root CLI version; it exits non-zero with a clear migration message to use --video or -v.
  • The added test formatting is now clean.

Local validation:

  • bun install --frozen-lockfile
  • bun run build:hyperframes-runtime
  • bun run --filter @hyperframes/cli test -- src/commands/init.test.ts -> passed, 16 tests
  • bun run packages/cli/src/cli.ts init /tmp/hf-pr704-recheck-short-v --example blank --non-interactive --skip-skills -v missing.mp4 -> expected Video file not found: missing.mp4
  • bun run packages/cli/src/cli.ts init /tmp/hf-pr704-recheck-capital-v --example blank --non-interactive --skip-skills -V missing.mp4 -> expected migration error
  • bun run packages/cli/src/cli.ts --version and bun run packages/cli/src/cli.ts -V -> still print version
  • bunx oxlint packages/cli/src/cli.ts packages/cli/src/commands/init.ts packages/cli/src/commands/init.test.ts -> passed
  • bunx 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.

@miguel-heygen miguel-heygen merged commit d4ba908 into heygen-com:main May 10, 2026
35 checks passed
@WadydX WadydX deleted the fix/init-video-short-flag-conflict branch May 11, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI flag conflict: init -V (video alias) is intercepted by global version fast-path

2 participants