Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Refactor: Change `post-start-commands` to `post-start-command`

Maximilian Roos82b7809ad77e
diff --git a/.config/wt.toml b/.config/wt.toml
index c652fe7ca..ed58ebcdf 100644
--- a/.config/wt.toml
+++ b/.config/wt.toml
@@ -6,11 +6,14 @@
# {branch} - Branch name with slashes replaced by dashes
# {worktree} - Path to the new worktree
# {repo_root} - Path to the main repository root
-post-start-commands = [
- # Seed target/ from base worktree using CoW (copy-on-write)
- # Each worktree gets its own target/ (avoids incremental build corruption)
- # but seeded from base to warm-start builds (low disk usage)
- # macOS: uses cp -c (clonefile on APFS)
- # Linux: would need cp --reflink=auto (GNU coreutils) or rsync 3.2.3+ with --reflink
- "[ -d {repo_root}/target ] && [ ! -e {worktree}/target ] && cp -cR {repo_root}/target/. {worktree}/target/ && echo '✓ CoW seeded target/'"
-]
+# Seed target/ from base worktree using CoW (copy-on-write)
+# Each worktree gets its own target/ (avoids incremental build corruption)
+# but seeded from base to warm-start builds (low disk usage)
+# macOS: uses cp -c (clonefile on APFS)
+# Linux: would need cp --reflink=auto (GNU coreutils) or rsync 3.2.3+ with --reflink
+post-start-command = """
+[ -d {repo_root}/target ] &&
+[ ! -e {worktree}/target ] &&
+cp -cR {repo_root}/target/. {worktree}/target/ &&
+echo '✓ CoW seeded target/'
+"""
diff --git a/src/commands/worktree.rs b/src/commands/worktree.rs
index 213323283..3175e668a 100644
--- a/src/commands/worktree.rs
+++ b/src/commands/worktree.rs
@@ -363,6 +363,7 @@ fn expand_command_template(
/// Prompt the user to approve a command for execution
fn prompt_for_approval(command: &str, project_id: &str) -> io::Result<bool> {
use anstyle::Style;
+ use std::io::Write;
use worktrunk::styling::{HINT_EMOJI, eprint};
// Extract project name from project_id (e.g., "worktrunk" from "github.com/max-sixty/worktrunk")
@@ -378,10 +379,11 @@ fn prompt_for_approval(command: &str, project_id: &str) -> io::Result<bool> {
eprintln!(" {dim}{command}{dim:#}");
eprintln!();
eprint!("{HINT_EMOJI} Allow and remember? {bold}[y/N]{bold:#} ");
- io::stderr().flush()?;
+ anstream::stderr().flush()?;
let mut input = String::new();
io::stdin().read_line(&mut input)?;
+ eprintln!(); // Move to next line after user input
let response = input.trim().to_lowercase();
Ok(response == "y" || response == "yes")