diff --git a/src-tauri/src/wsl_bridge.rs b/src-tauri/src/wsl_bridge.rs index ebd97c1..4220f11 100644 --- a/src-tauri/src/wsl_bridge.rs +++ b/src-tauri/src/wsl_bridge.rs @@ -1666,7 +1666,10 @@ fn process_json_line( // Helper function to check if a tool is a system tool that should never require permission let is_system_tool = |tool_name: &str| -> bool { - matches!(tool_name, "ExitPlanMode" | "EnterPlanMode") + matches!( + tool_name, + "ExitPlanMode" | "EnterPlanMode" | "EnterWorktree" | "ExitWorktree" + ) }; for denial in denials { @@ -2041,6 +2044,14 @@ fn format_tool_description(name: &str, input: &serde_json::Value) -> String { "Running command...".to_string() } } + "EnterWorktree" => { + if let Some(path) = input.get("path").and_then(|v| v.as_str()) { + format!("Entering worktree: {}", path) + } else { + "Entering worktree session...".to_string() + } + } + "ExitWorktree" => "Exiting worktree session...".to_string(), "CronCreate" => { if let Some(prompt) = input.get("prompt").and_then(|v| v.as_str()) { format!("Scheduling: {}", prompt) @@ -2222,6 +2233,27 @@ mod tests { assert_eq!(desc, "Using tool: CustomTool"); } + #[test] + fn test_format_tool_description_enter_worktree() { + let input = serde_json::json!({"path": "/home/naomi/worktrees/feature-branch"}); + let desc = format_tool_description("EnterWorktree", &input); + assert_eq!(desc, "Entering worktree: /home/naomi/worktrees/feature-branch"); + } + + #[test] + fn test_format_tool_description_enter_worktree_no_path() { + let input = serde_json::json!({}); + let desc = format_tool_description("EnterWorktree", &input); + assert_eq!(desc, "Entering worktree session..."); + } + + #[test] + fn test_format_tool_description_exit_worktree() { + let input = serde_json::json!({}); + let desc = format_tool_description("ExitWorktree", &input); + assert_eq!(desc, "Exiting worktree session..."); + } + #[test] fn test_format_tool_description_cron_create() { let input = serde_json::json!({"prompt": "run tests", "schedule": "*/5 * * * *"});