Skip to content

Bug: multi-line post:open script collapsed to single line #26

Description

@tupe12334

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

  1. Add "post:open" as a triple-quoted multi-line value in ~/.config/worktree-runner/config.toml.
  2. Run worktree open <issue>.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions