feat: multi-worktree watch and daemon support#115
feat: multi-worktree watch and daemon support#115yoanbernabeu merged 9 commits intoyoanbernabeu:mainfrom
Conversation
Add git.Detect() for worktree awareness and zero-config auto-init when running grepai in a linked worktree: - New git/ package with Detect(path) returning worktree info (GitRoot, GitCommonDir, IsWorktree, MainWorktree, WorktreeID) - FindProjectRoot() auto-initializes .grepai/ in linked worktrees by copying config + index from main worktree as seed data - grepai init --inherit flag for non-interactive worktree config inheritance - WorktreeID = hex(sha256(GitCommonDir))[:12] as stable identifier - Config auto-init validates config.yaml presence in main worktree Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add worktree-aware daemon PID management and multi-worktree parallel watching with errgroup: - Worktree-specific PID/ready/log files in daemon package - discoverWorktreesForWatch() for automatic linked worktree detection - watchProject() extracted for single-project watch loop - Multi-worktree parallel watching via errgroup - Platform-specific liveness detection (pipe on Unix, poll on Windows) - Fix: lock file handle leak in WriteWorktreePIDFile - Fix: deduplicate watchProject logic for no-worktree path - Fix: remove duplicate doc comment on watchProject Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 27.16% 35.67% +8.51%
==========================================
Files 32 42 +10
Lines 3711 6755 +3044
==========================================
+ Hits 1008 2410 +1402
- Misses 2620 4136 +1516
- Partials 83 209 +126 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Review & Testing Summary ✅Full local testing completed — everything looks great. Tests performed1. Backward compatibility (PR binary on main-indexed project)
2. New worktree features
3. Unit tests
Action neededThere's a merge conflict with |
…at/multi-worktree-watch # Conflicts: # config/config_worktree_test.go
|
Follow-up: merged latest upstream main as well (commit afa2aac) and resolved the only merge conflict in config/config_worktree_test.go.\n\nRe-validation:\n- go test ./... (all passing locally)\n\nCurrent PR merge state is no longer DIRTY (now UNSTABLE while checks update). |
|
Great work! 🎉 Conflict resolved, all CI checks green, code reviewed — merging. |
Summary
Split from #109 (4/4). Adds worktree-aware daemon PID management and multi-worktree parallel watching. Includes PR 3 commits (feat/worktree-detection) - merge PR 3 first.
discoverWorktreesForWatch()for automatic linked worktree detection with auto-initwatchProject()extracted for single-project watch looperrgroupWriteWorktreePIDFile(defer close after lock)watchProject()instead of inline copywatchProjectTest plan
go build ./...passes (linux, windows, darwin)go vet ./...cleango test ./daemon/... ./cli/...all pass with-raceMerge order: PR 3 (#114) → this PR
Part of #109 split. See also: PR 1 (#112), PR 2 (#113), PR 3 (#114, dependency)
🤖 Generated with Claude Code