You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Lock File Discovery**: Tokens stored in `~/.claude/ide/[port].lock` for Claude CLI
66
+
-**MCP Compliance**: Follows official Claude Code IDE authentication protocol
67
+
53
68
### MCP Tools Architecture
54
69
55
70
Tools are registered with JSON schemas and handlers. MCP-exposed tools include:
@@ -76,14 +91,125 @@ Tests are organized in three layers:
76
91
77
92
Test files follow the pattern `*_spec.lua` or `*_test.lua` and use the busted framework.
78
93
94
+
### Test Organization Principles
95
+
96
+
-**Isolation**: Each test should be independent and not rely on external state
97
+
-**Mocking**: Use comprehensive mocking for vim APIs and external dependencies
98
+
-**Coverage**: Aim for both positive and negative test cases, edge cases included
99
+
-**Performance**: Tests should run quickly to encourage frequent execution
100
+
-**Clarity**: Test names should clearly describe what behavior is being verified
101
+
102
+
## Authentication Testing
103
+
104
+
The plugin implements authentication using UUID v4 tokens that are generated for each server session and stored in lock files. This ensures secure connections between Claude CLI and the Neovim WebSocket server.
-**Connection Events**: Use DEBUG level for routine connection establishment/teardown
183
+
-**Authentication Flow**: Use DEBUG for successful auth, WARN for failures
184
+
-**User-Facing Events**: Use INFO sparingly for events users need to know about
185
+
-**System Errors**: Use ERROR for failures that require user attention
186
+
79
187
## Development Notes
80
188
189
+
### Technical Requirements
190
+
81
191
- Plugin requires Neovim >= 0.8.0
82
192
- Uses only Neovim built-ins for WebSocket implementation (vim.loop, vim.json, vim.schedule)
83
-
- Lock files are created at `~/.claude/ide/[port].lock` for Claude CLI discovery
84
-
- WebSocket server only accepts local connections for security
193
+
- Zero external dependencies for core functionality
194
+
195
+
### Security Considerations
196
+
197
+
- WebSocket server only accepts local connections (127.0.0.1) for security
198
+
- Authentication tokens are UUID v4 with enhanced entropy
199
+
- Lock files created at `~/.claude/ide/[port].lock` for Claude CLI discovery
200
+
- All authentication events are logged for security auditing
201
+
202
+
### Performance Optimizations
203
+
85
204
- Selection tracking is debounced to reduce overhead
205
+
- WebSocket frame processing optimized for JSON-RPC payload sizes
206
+
- Connection pooling and cleanup to prevent resource leaks
207
+
208
+
### Integration Support
209
+
86
210
- Terminal integration supports both snacks.nvim and native Neovim terminal
211
+
- Compatible with popular file explorers (nvim-tree, oil.nvim)
212
+
- Visual selection tracking across different selection modes
87
213
88
214
## Release Process
89
215
@@ -134,6 +260,23 @@ make
134
260
rg "0\.1\.0".# Should only show CHANGELOG.md historical entries
135
261
```
136
262
137
-
## CRITICAL: Pre-commit Requirements
263
+
## Development Workflow
264
+
265
+
### Pre-commit Requirements
138
266
139
267
**ALWAYS run `make` before committing any changes.** This runs code quality checks and formatting that must pass for CI to succeed. Never skip this step - many PRs fail CI because contributors don't run the build commands before committing.
268
+
269
+
### Recommended Development Flow
270
+
271
+
1.**Start Development**: Use existing tests and documentation to understand the system
272
+
2.**Make Changes**: Follow existing patterns and conventions in the codebase
273
+
3.**Validate Work**: Run `make` to ensure formatting, linting, and tests pass
Copy file name to clipboardExpand all lines: PROTOCOL.md
+21-2Lines changed: 21 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,8 @@ The IDE writes a discovery file to `~/.claude/ide/[port].lock`:
23
23
"pid": 12345, // IDE process ID
24
24
"workspaceFolders": ["/path/to/project"], // Open folders
25
25
"ideName": "VS Code", // or "Neovim", "IntelliJ", etc.
26
-
"transport": "ws"// WebSocket transport
26
+
"transport": "ws", // WebSocket transport
27
+
"authToken": "550e8400-e29b-41d4-a716-446655440000"// Random UUID for authentication
27
28
}
28
29
```
29
30
@@ -38,6 +39,16 @@ When launching Claude, the IDE sets:
38
39
39
40
Claude reads the lock files, finds the matching port from the environment, and connects to the WebSocket server.
40
41
42
+
## Authentication
43
+
44
+
When Claude connects to the IDE's WebSocket server, it must authenticate using the token from the lock file. The authentication happens via a custom WebSocket header:
0 commit comments