Skip to content

fix(cli): quote the project name in init's printed cd commands - #7608

Merged
miguel-heygen merged 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/init-hint-quote-dir
Nov 14, 2026
Merged

miguel-heygen merged 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/init-hint-quote-dir

Conversation

@wonjangcloud9

Copy link
Copy Markdown
Contributor

What

hyperframes init --non-interactive closes with cd <name> && npm run dev|check|render lines to paste. The name now goes into them as a single shell word, quoted when a shell would split or expand it. The hyperframes open / preview --stop hints use the same helper.

Why

The name was printed as typed, so any name with a space or quote printed a command that fails when pasted (bash, zsh, and /bin/sh on macOS):

name printed on main result
my first video cd my first video && npm run check bash/sh: cd: my: No such file or directory; zsh: cd: too many arguments
it's mine cd it's mine && npm run check bash/sh: unexpected EOF while looking for matching '; zsh: unmatched '
서울 여행 브이로그 cd 서울 여행 브이로그 && npm run check bash/sh: cd: 서울: No such file or directory; zsh: too many arguments

With this change they print cd "my first video", cd "it's mine" and cd "서울 여행 브이로그", and each runs as written in all three shells. Agents follow these lines verbatim, so a broken one costs them a turn.

Related work

desktopApp.ts's shownDir already quoted whitespace with JSON.stringify for hyperframes open "my film"; this generalises that rule and reuses it. I found no issue or PR about it (searched "init cd quote", "project name spaces", "cd command spaces", "shell quote").

How

utils/shellArg.ts: plain words (letters, digits, _ . / @ : + , = -, any script) stay bare. Others get double quotes, or POSIX single quotes when the text holds $, a backtick, \, " or !. On Windows they get double quotes, with \ paths left bare. init.ts uses it for its four cd lines and shownDir for its two commands. Existing openCommandFor / previewStopCommandFor expectations ("my film", films/a, .) are unchanged.

Test plan

  • shellArg.test.ts: ten names (plain, Hangul, path, spaces, it's mine, it's, a&b, $HOME, o'neil $x, Hangul with spaces), Windows cases, and a round trip that creates each directory and runs cd <shellArg(name)> && pwd -P through /bin/sh.
  • Manual: rebuilt the CLI, ran init --non-interactive for the three names in the table, and pasted the printed npm run check line (with pwd in place of npm) into /bin/sh, zsh and bash.
  • vitest --project unit src/commands/init src/utils/desktopApp.test.ts src/utils/shellArg.test.ts (138 passed), oxlint, oxfmt, tsc --noEmit, comment ratchet, fallow audit --base origin/main.

🤖 Generated with Claude Code

`hyperframes init --non-interactive` closes with `cd <name> && npm run …`
lines for the person or agent to paste. The name went in as typed, so a
name with a space or a quote printed a command that fails as written:
`cd my first video` (bash: "cd: my: No such file or directory", zsh: "too
many arguments") and `cd it's mine` (an unterminated quote).

A new `shellArg` quotes a word only when a shell would split or expand
it: double quotes, or single quotes when the text holds `$`, a backtick,
`\`, `"` or `!`; on Windows, double quotes, with `\` paths left bare.
`hyperframes open` / `preview --stop` hints (desktopApp's `shownDir`)
already quoted whitespace with JSON.stringify and now use it too, so a
name like `it's` or `a&b` is covered there as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified at ebd5aef: the bug reproduces on main, and the new tests fail without the fix and pass with it. Required CI is green.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 14, 2026
Merged via the queue into heygen-com:main with commit 213f7c5 Nov 14, 2026
84 checks passed
@heygengenesis heygengenesis Bot mentioned this pull request Nov 14, 2026
1 of 2 tasks
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.

2 participants