Skip to content

[Feature Request] Support interactive post-create hooks without premature termination #79

@gander-vs

Description

@gander-vs

Problem Description

When running interactive commands in post_create hooks, wtp appears to ignore user prompts and terminates the hook process with exit code 130, even though the command expects interactive input. This makes it impossible to use wtp hooks for workflows that require user input right after worktree creation (for example, asking for a project-specific prefix or other configuration values).

Example output:

Executing post-create hooks...

→ Running hook 1 of 4...
  Copying: .idea → .idea
✓ Hook 1 completed

→ Running hook 2 of 4...
  Copying: .wtp.yml → .wtp.yml
✓ Hook 2 completed

→ Running hook 3 of 4...
  Running: prefix_wtp
ℹ Working directory: ~/project/.worktrees/playground

Enter PREFIX (alphanumeric, _, -, no spaces): Warning: Hook execution failed: failed to execute hook 3: command failed: exit status 130
✅ Worktree created successfully!

The prefix_wtp command is interactive and waits for user input, but wtp does not allow the interaction to complete and reports the hook as failed with exit status 130.

Proposed Feature

Introduce an explicit interactive flag (or similar mechanism) for hook commands that are expected to interact with the user. When this flag is set, wtp should:

  • Treat the hook as an interactive, foreground process.
  • Attach stdin/stdout/stderr so that prompts and user input work as expected.
  • Wait for the interactive command to finish instead of terminating it and marking the hook as failed.

This would allow defining hooks such as:

hooks:
  post_create:
    - type: command
      command: "prefix_wtp"
      interactive: true

Expected Behavior

  • If a hook is marked as interactive, wtp should:

    • Forward the terminal input/output to the hook process.
    • Wait until the interactive command exits on its own (user completes the flow or exits).
    • Only treat non-zero exit codes as failure after the process has had a chance to run interactively.
  • Non-interactive hooks should continue to behave exactly as they do today.

Actual Behavior

  • Interactive commands in post_create hooks are terminated with exit code 130 as soon as they try to prompt the user.
  • The user cannot respond to prompts because the interaction is effectively blocked.
  • wtp prints a warning similar to:
    Warning: Hook execution failed: failed to execute hook 3: command failed: exit status 130
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions