feat: add worktree isolation support and hook event display

Closes #152, closes #150

- Add use_worktree bool to ClaudeStartOptions and HikariConfig (Rust + TS)
- Pass --worktree flag to claude in both WSL and non-WSL command paths
- Detect WorktreeCreate/WorktreeRemove hook events in stderr handler
- Emit worktree events with distinct line_type instead of error
- Add worktree line type to TerminalLine union, Terminal rendering, and tests
- Display worktree events in green with [worktree] prefix
- Add worktree isolation toggle to Agent Settings section of ConfigSidebar
- Thread use_worktree through all seven start_claude call sites
This commit is contained in:
2026-02-24 17:39:09 -08:00
committed by Naomi Carrigan
parent 108a1b16b2
commit 54280b3920
14 changed files with 83 additions and 5 deletions
+19 -2
View File
@@ -265,6 +265,11 @@ impl WslBridge {
}
}
// Add worktree flag if requested
if options.use_worktree {
cmd.arg("--worktree");
}
cmd.current_dir(working_dir);
// Set API key as environment variable if specified
@@ -351,6 +356,11 @@ impl WslBridge {
}
}
// Add worktree flag if requested
if options.use_worktree {
claude_cmd.push_str(" --worktree");
}
// Use bash -lc to load login profile (ensures PATH includes claude)
cmd.args(["-e", "bash", "-lc", &claude_cmd]);
@@ -751,11 +761,18 @@ fn handle_stderr(
}
}
// Still emit the stderr line as output
// Worktree hook events are informational — emit with a distinct type
let is_worktree_event = line.contains("[WorktreeCreate Hook]")
|| line.contains("[WorktreeRemove Hook]");
let _ = app.emit(
"claude:output",
OutputEvent {
line_type: "error".to_string(),
line_type: if is_worktree_event {
"worktree".to_string()
} else {
"error".to_string()
},
content: line,
tool_name: None,
conversation_id: conversation_id.clone(),