When a user writes post:open using a TOML triple-quoted multi-line string:
"post:open" = """#!/usr/bin/env bash
pnpm i --frozen-lockfile --prefer-offline
cargo build
claude --dangerously-skip-permissions "pull from main and work on issue: {{issue}} and pr to main"
echo "Worktree ready: {{owner}}/{{repo}}#{{issue}} ({{branch}})"
"""
the runner collapses it to a single escaped line before passing it to the shell:
#!/usr/bin/env bash\npnpm i --frozen-lockfile --prefer-offline\ncargo build\n...
The shell receives this as one line, so only the shebang runs; the remaining commands are silently ignored.
Expected behavior
Multi-line hook scripts should execute with newlines preserved — identical to writing them as single-line strings with explicit \n escapes.
Steps to reproduce
- Add
"post:open" as a triple-quoted multi-line value in ~/.config/worktree-runner/config.toml.
- Run
worktree open <issue>.
- Observe that only the first line of the script executes.
Possible fix
The TOML parser already delivers the string with real newline characters. The bug is downstream — likely in how the script is passed to sh -c or written to a temp file. Ensure the raw string (with real \n characters) is used rather than a debug/display representation.
When a user writes
post:openusing a TOML triple-quoted multi-line string:the runner collapses it to a single escaped line before passing it to the shell:
The shell receives this as one line, so only the shebang runs; the remaining commands are silently ignored.
Expected behavior
Multi-line hook scripts should execute with newlines preserved — identical to writing them as single-line strings with explicit
\nescapes.Steps to reproduce
"post:open"as a triple-quoted multi-line value in~/.config/worktree-runner/config.toml.worktree open <issue>.Possible fix
The TOML parser already delivers the string with real newline characters. The bug is downstream — likely in how the script is passed to
sh -cor written to a temp file. Ensure the raw string (with real\ncharacters) is used rather than a debug/display representation.