Quick guide for contributors to the claudecode.nvim project.
claudecode.nvim/
├── .github/workflows/ # CI workflow definitions
├── lua/claudecode/ # Plugin implementation
│ ├── server/ # WebSocket server implementation
│ ├── tools/ # MCP tool implementations and schema management
│ ├── config.lua # Configuration management
│ ├── diff.lua # Diff provider system (native Neovim support)
│ ├── init.lua # Plugin entry point
│ ├── lockfile.lua # Lock file management
│ ├── selection.lua # Selection tracking
│ └── terminal.lua # Terminal management
├── plugin/ # Plugin loader
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ ├── component/ # Component tests
│ ├── integration/ # Integration tests
│ └── mocks/ # Test mocks
├── README.md # User documentation
├── ARCHITECTURE.md # Architecture documentation
└── DEVELOPMENT.md # Development guide
| Component | Status | Priority | Notes |
|---|---|---|---|
| Basic plugin structure | ✅ Done | - | Initial setup complete |
| Configuration system | ✅ Done | - | Support for user configuration |
| WebSocket server | ✅ Done | - | Pure Lua RFC 6455 compliant |
| Lock file management | ✅ Done | - | Basic implementation complete |
| Selection tracking | ✅ Done | - | Enhanced with multi-mode support |
| MCP tools framework | ✅ Done | - | Dynamic tool registration and schema system |
| Core MCP tools | ✅ Done | - | openFile, openDiff, getCurrentSelection, getOpenEditors |
| Diff integration | ✅ Done | - | Native Neovim diff with configurable options |
| Terminal integration | ✅ Done | - | Snacks.nvim and native terminal support |
| Tests | ✅ Done | - | Comprehensive test suite with unit, component, and integration tests |
| CI pipeline | ✅ Done | - | GitHub Actions configured |
| Documentation | ✅ Done | - | Complete documentation |
-
Advanced MCP Tools
- Add Neovim-specific tools (LSP integration, diagnostics, Telescope integration)
- Implement diffview.nvim integration for the diff provider system
- Add Git integration tools (branch info, status, etc.)
-
Performance Optimization
- Monitor WebSocket server performance under load
- Optimize selection tracking for large files
- Fine-tune debouncing and event handling
-
User Experience
- Add more user commands and keybindings
- Improve error messages and user feedback
- Create example configurations for popular setups
-
Integration Testing
- Test with real Claude Code CLI
- Validate compatibility across Neovim versions
- Create end-to-end test scenarios
Run tests using:
# Run all tests
make test
# Run specific test file
nvim --headless -u tests/minimal_init.lua -c "lua require('tests.unit.config_spec')"
# Run linting
make check
# Format code
make format-
Error Handling
- All public functions should have error handling
- Return
success, result_or_errorpattern - Log meaningful error messages
-
Performance
- Minimize impact on editor performance
- Debounce event handlers
- Use asynchronous operations where possible
-
Compatibility
- Support Neovim >= 0.8.0
- Zero external dependencies (pure Lua implementation)
- Follow Neovim plugin best practices
-
Testing
- Write tests before implementation (TDD)
- Aim for high code coverage
- Mock external dependencies
- Fork the repository
- Create a feature branch
- Implement your changes with tests
- Run the test suite to ensure all tests pass
- Submit a pull request
The WebSocket server is implemented in pure Lua with zero external dependencies:
- Pure Neovim Implementation: Uses
vim.loop(libuv) for TCP operations - RFC 6455 Compliant: Full WebSocket protocol implementation
- JSON-RPC 2.0: MCP message handling with proper framing
- Security: Pure Lua SHA-1 implementation for WebSocket handshake
- Performance: Optimized with lookup tables and efficient algorithms
The plugin implements a sophisticated tool system following MCP 2025-03-26:
Current Tools:
openFile- Opens files with optional line/text selectionopenDiff- Native Neovim diff views with configurable optionsgetCurrentSelection- Gets current text selectiongetOpenEditors- Lists currently open files
Tool Architecture:
- Dynamic registration:
M.register(name, schema, handler) - Automatic MCP exposure based on schema presence
- JSON schema validation for parameters
- Centralized tool definitions in
tools/init.lua
Future Tools:
- Neovim-specific diagnostics
- LSP integration (hover, references, definitions)
- Telescope integration for file finding
- Git integration (status, branch info, blame)
- Implement diffview.nvim integration for the diff provider system
- Add advanced MCP tools (LSP integration, Telescope, Git)
- Add integration tests with real Claude Code CLI
- Optimize performance for large codebases
- Create example configurations for popular Neovim setups (LazyVim, NvChad, etc.)