multifile claude accept

This commit is contained in:
zolinthecow 2025-07-11 00:49:42 -07:00
parent dac46b9a93
commit 50c50b94cc
8 changed files with 411 additions and 248 deletions

188
tasks.md
View file

@ -23,22 +23,22 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [x] Test: Plugin loads without errors
#### 1.2 Configuration Management
- [ ] Define default configuration schema
- [ ] Implement config validation
- [ ] Support user config overrides
- [ ] Add config options for:
- [ ] Tmux pane split direction and size
- [ ] Agent work directory name
- [ ] Git worktree vs full clone preference
- [ ] Auto-gitignore behavior
- [ ] Test: Config changes apply correctly
- [x] Define default configuration schema
- [x] Implement config validation
- [x] Support user config overrides
- [x] Add config options for:
- [x] Tmux pane split direction and size
- [x] Agent work directory name
- [x] Git worktree vs full clone preference
- [x] Auto-gitignore behavior
- [x] Test: Config changes apply correctly
#### 1.3 Utility Functions
- [x] Create tmux interaction module
- [x] Add git operations wrapper (worktree, status, diff)
- [x] Implement filesystem utilities (create dirs, check paths)
- [ ] Add logging/debugging functions
- [ ] Test: Each utility function in isolation
- [x] Add logging/debugging functions (vim.notify)
- [x] Test: Each utility function in isolation
### 2. Basic Claude Chat Integration
@ -53,49 +53,85 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [x] Implement `:ClaudeChat` command
- [x] Open Claude in configured tmux split
- [x] Reuse existing pane if available
- [ ] Pass current file context if requested
- [ ] Test: Command opens Claude reliably
- [x] Pass current file context if requested
- [x] Test: Command opens Claude reliably
#### 2.3 Context Sharing
- [x] `:ClaudeSendBuffer` - Send current buffer
- [x] `:ClaudeSendSelection` - Send visual selection
- [ ] `:ClaudeSendHunk` - Send git hunk under cursor
- [x] `:ClaudeSendHunk` - Send git hunk under cursor
- [x] Add appropriate context headers
- [ ] Test: Each send command works correctly
- [x] Test: Each send command works correctly
### 3. Background Agent System
#### 3.1 Agent Work Directory Management
- [ ] Create `.agent-work/` in project root
- [ ] Auto-add to `.gitignore` if not present
- [ ] Generate timestamped subdirectories
- [ ] Clean up old agent directories (configurable)
- [ ] Test: Directory creation and gitignore updates
- [x] Create `.agent-work/` in project root
- [x] Auto-add to `.gitignore` if not present
- [x] Generate timestamped subdirectories
- [x] Clean up old agent directories (configurable)
- [x] Test: Directory creation and gitignore updates
#### 3.2 Git Worktree Integration
- [ ] Function to create worktree for agent
- [ ] Handle worktree naming (avoid conflicts)
- [ ] Support fallback to full clone if worktrees unavailable
- [ ] Track worktree <-> agent mapping
- [ ] Test: Worktree creation and tracking
- [x] Function to create worktree for agent
- [x] Handle worktree naming (avoid conflicts)
- [x] Support fallback to full clone if worktrees unavailable
- [x] Track worktree <-> agent mapping
- [x] Test: Worktree creation and tracking
#### 3.3 Agent Spawning
- [x] Implement `:ClaudeBg <task>` command
- [x] Create agent work directory
- [x] Set up git worktree
- [x] Spawn tmux window/session for agent
- [ ] Initialize Claude with task context
- [x] Initialize Claude with task context
- [x] Create mission log file
- [ ] Test: Full agent spawn workflow
- [x] Test: Full agent spawn workflow
#### 3.4 Agent Tracking
- [ ] Maintain registry of active agents
- [ ] Store agent metadata (task, start time, status)
- [ ] Persist registry across nvim sessions
- [ ] Auto-detect terminated agents
- [ ] Test: Registry operations and persistence
- [x] Maintain registry of active agents
- [x] Store agent metadata (task, start time, status)
- [x] Persist registry across nvim sessions
- [x] Auto-detect terminated agents
- [x] Test: Registry operations and persistence
### 4. Diff Viewing and Review
### 4. Inline Diff System (NEW - Major Feature)
#### 4.1 Claude Code Hooks Integration
- [x] Pre-tool-use hook for baseline creation
- [x] Post-tool-use hook for diff detection
- [x] Automatic inline diff display for open buffers
- [x] Claude file edit tracking
- [x] Git stash-based baseline management
#### 4.2 Inline Diff Display
- [x] Real-time diff visualization in buffers
- [x] Syntax highlighting for additions/deletions
- [x] Virtual text for removed lines
- [x] Hunk navigation (]h, [h)
- [x] Multi-file diff tracking
#### 4.3 Diff Actions
- [x] Accept hunk (<leader>ia)
- [x] Reject hunk (<leader>ir)
- [x] Accept all hunks (<leader>iA)
- [x] Reject all hunks (<leader>iR)
- [x] Close inline diff (<leader>iq)
#### 4.4 Multi-File Navigation
- [x] Navigate between files with diffs (]f, [f)
- [x] List all files with diffs (<leader>ci)
- [x] Telescope-like file picker
- [x] Show diff status for unopened files
- [x] Auto-show diffs when opening Claude-edited files
#### 4.5 Persistence and State
- [x] Save diff state across Neovim sessions
- [x] Restore inline diffs on startup
- [x] Track baseline references
- [x] Clean state management
### 5. Diff Viewing and Review (Original git-based)
#### 4.1 Fugitive Integration
- [ ] Function to diff agent worktree against main
@ -117,7 +153,7 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [ ] Bulk apply agent changes
- [ ] Test: Full review workflow
### 5. Telescope Integration
### 6. Telescope Integration
#### 5.1 Agent Browser
- [ ] Custom Telescope picker for agents
@ -132,7 +168,7 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [ ] Open files from agent in main nvim
- [ ] Test: File browsing and operations
### 6. Status and Monitoring
### 7. Status and Monitoring
#### 6.1 Status Line Integration
- [ ] Component showing active agent count
@ -153,19 +189,21 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [ ] Optional progress notifications
- [ ] Test: Notification system
### 7. Safety and Convenience Features
### 8. Safety and Convenience Features
#### 7.1 Snapshot System
#### 8.1 Snapshot System
- [ ] Auto-snapshot before applying changes
- [ ] Named snapshots for important states
- [ ] Snapshot browser/restore
- [ ] Test: Snapshot and restore
#### 7.2 Quick Commands
- [ ] `:ClaudeKill [agent]` - Terminate agent
- [ ] `:ClaudeClean` - Clean up old agents
#### 8.2 Quick Commands
- [x] `:ClaudeKill [agent]` - Terminate agent
- [x] `:ClaudeClean` - Clean up old agents
- [ ] `:ClaudeSwitch [agent]` - Switch to agent tmux
- [ ] Test: Each command functions correctly
- [x] `:ClaudeAgents` - List all agents
- [x] `:ClaudeResetBaseline` - Reset inline diff baseline
- [x] Test: Each command functions correctly
#### 7.3 Keybindings
- [ ] Default keybinding set
@ -173,7 +211,7 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [ ] User-customizable bindings
- [ ] Test: Keybindings work as expected
### 8. Advanced Features (Phase 2)
### 9. Advanced Features (Phase 2)
#### 8.1 Agent Templates
- [ ] Predefined agent configurations
@ -193,30 +231,27 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
- [ ] Oil.nvim for agent file management
- [ ] Test: Each integration
## Implementation Phases
## Implementation Status
### Phase 1: MVP (Week 1-2)
1. Core infrastructure (1.1-1.3)
2. Basic Claude chat (2.1-2.3)
3. Simple agent spawning (3.1-3.3)
4. Basic diff viewing (4.1)
### Completed Features
1. ✅ Core infrastructure - Plugin setup, config, utilities
2. ✅ Claude chat integration - All context sharing commands working
3. ✅ Background agent system - Full implementation with registry
4. ✅ Inline diff system - Major feature addition with full accept/reject workflow
5. ✅ Multi-file diff navigation - Complete with keybindings
6. ✅ Claude Code hooks - Automatic diff detection and display
7. ✅ Persistence - Diff state saved across sessions
### Phase 2: Core Features (Week 3-4)
1. Agent tracking (3.4)
2. Full diff/review workflow (4.2-4.3)
3. Telescope integration (5.1-5.2)
4. Basic monitoring (6.1-6.2)
### In Progress
1. 🔄 Telescope integration for agents
2. 🔄 Status line integration
3. 🔄 Advanced diff viewing (git-based)
### Phase 3: Polish (Week 5-6)
1. Safety features (7.1-7.2)
2. Keybindings and UX (7.3)
3. Notifications (6.3)
4. Documentation and tests
### Phase 4: Advanced (Future)
1. Agent templates (8.1)
2. Multi-agent features (8.2)
3. Deep plugin integrations (8.3)
### Future Work
1. 📋 Agent templates and behaviors
2. 📋 Multi-agent coordination
3. 📋 Deep plugin integrations
4. 📋 Snapshot system
## Technical Decisions
@ -257,5 +292,28 @@ Building a Claude Code integration for Neovim that works seamlessly with a tmux-
---
*Last Updated: [Current Date]*
*Status: Planning Phase*
*Last Updated: 2025-01-10*
*Status: Feature Complete for v1.0*
## Recent Accomplishments
### Inline Diff System (Major Feature)
- Complete implementation of inline diff visualization
- Real-time accept/reject functionality for individual hunks
- Multi-file navigation and management
- Persistence across Neovim sessions
- Integration with Claude Code hooks for automatic detection
### Background Agents
- Full agent spawning and management system
- Git worktree integration
- Agent registry with persistence
- Mission logging and tracking
### Next Steps for v1.1
- Polish Telescope integration for agent browsing
- Add status line components showing active diffs
- Improve documentation with examples
- Create demo videos showcasing inline diff system
- Add support for partial hunk acceptance
- TEST EDIT: Testing single file edit after accept all