(project_path: &Path, event: DaemonHookEvent)
| 369 | |
| 370 | #[cfg(not(unix))] |
| 371 | async fn notify_shell_hook_event_without_daemon(project_path: &Path, event: DaemonHookEvent) { |
| 372 | let Some(command) = event.command.as_deref() else { |
| 373 | return; |
| 374 | }; |
| 375 | let cwd = event.cwd.as_deref().unwrap_or(project_path); |
| 376 | if !crate::hooks::cursor_shell_command_targets_project(command, cwd, project_path) { |
| 377 | return; |
| 378 | } |
| 379 | let current_branch = crate::branch::current_branch(project_path); |
| 380 | match crate::hooks::cursor_shell_sync_plan_with_current_branch( |
| 381 | command, |
| 382 | current_branch.as_deref(), |
| 383 | ) { |
| 384 | crate::hooks::CursorShellSyncPlan::BranchAdd(branch) => { |
| 385 | let _ = crate::tracedecay::TraceDecay::add_branch_tracking(project_path, &branch).await; |
| 386 | } |
| 387 | crate::hooks::CursorShellSyncPlan::WorktreeBranchAdd { |
| 388 | branch, |
| 389 | worktree_path, |
| 390 | } => { |
| 391 | let root = crate::hooks::resolve_worktree_add_root(command, cwd, &worktree_path); |
| 392 | let _ = crate::tracedecay::TraceDecay::add_branch_tracking(&root, &branch).await; |
| 393 | } |
| 394 | crate::hooks::CursorShellSyncPlan::CurrentBranchSync(branch) => { |
| 395 | if !matches!( |
| 396 | crate::tracedecay::TraceDecay::add_branch_tracking(project_path, &branch).await, |
| 397 | Ok(crate::branch::BranchAddOutcome::Added) |
| 398 | ) { |
| 399 | run_debounced_hook_sync_without_daemon( |
| 400 | project_path, |
| 401 | hook_marker_file(&event.agent), |
| 402 | ) |
| 403 | .await; |
| 404 | } |
| 405 | } |
| 406 | crate::hooks::CursorShellSyncPlan::IncrementalSync => { |
| 407 | run_debounced_hook_sync_without_daemon(project_path, hook_marker_file(&event.agent)) |
| 408 | .await; |
| 409 | } |
| 410 | crate::hooks::CursorShellSyncPlan::Noop => {} |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | #[cfg(not(unix))] |
| 415 | async fn run_debounced_hook_sync_without_daemon(project_path: &Path, marker_file: &str) { |
no test coverage detected