cli-lsp-client 1.19.2 → 1.19.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,63 +1,28 @@
1
1
  {
2
2
  "name": "cli-lsp-client",
3
- "version": "1.19.2",
3
+ "version": "1.19.4",
4
+ "description": "CLI tool supporting claude code hooks for fast LSP diagnostics with background daemon and multi-project support",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "git+https://github.com/eli0shin/cli-lsp-client.git"
7
8
  },
8
- "main": "src/cli.ts",
9
- "devDependencies": {
10
- "@commander-js/extra-typings": "^14.0.0",
11
- "@eslint/js": "^9.33.0",
12
- "@modelcontextprotocol/sdk": "^1.17.3",
13
- "@types/bun": "latest",
14
- "@types/node": "latest",
15
- "@typescript-eslint/eslint-plugin": "^8.46.2",
16
- "commander": "^14.0.1",
17
- "eslint": "^9.33.0",
18
- "eslint-config-prettier": "10.1.8",
19
- "eslint-for-ai": "^1.0.6",
20
- "eslint-import-resolver-typescript": "^4.4.4",
21
- "eslint-plugin-es": "^4.1.0",
22
- "eslint-plugin-import": "^2.32.0",
23
- "eslint-plugin-import-x": "^4.16.1",
24
- "eslint-plugin-unused-imports": "^4.1.4",
25
- "globals": "^16.3.0",
26
- "prettier": "3.6.2",
27
- "typescript": "latest",
28
- "typescript-eslint": "^8.39.1",
29
- "vscode-jsonrpc": "^8.2.1",
30
- "vscode-languageserver-types": "^3.17.5",
31
- "zod": "3.25"
32
- },
33
- "bin": {
34
- "cli-lsp-client": "./bin/cli-lsp-client"
35
- },
36
9
  "bugs": {
37
10
  "url": "https://github.com/eli0shin/cli-lsp-client/issues"
38
11
  },
39
- "description": "CLI tool supporting claude code hooks for fast LSP diagnostics with background daemon and multi-project support",
40
- "files": [
41
- "bin/",
42
- "script/preinstall.mjs",
43
- "script/postinstall.mjs"
44
- ],
45
12
  "homepage": "https://github.com/eli0shin/cli-lsp-client#readme",
46
13
  "license": "MIT",
14
+ "bin": {
15
+ "cli-lsp-client": "./bin/cli-lsp-client"
16
+ },
47
17
  "scripts": {
48
- "build": "./script/build.ts",
49
- "release": "./script/release.ts",
50
- "dev": "bun run src/cli.ts",
51
- "typecheck": "bun tsc --noEmit",
52
- "lint": "eslint .",
53
- "lint:fix": "eslint . --fix",
54
- "format": "prettier --check .",
55
- "format:fix": "prettier --write .",
56
- "test": "bun test",
57
- "test:watch": "bun test tests/ --watch",
58
- "validate:plugin": "claude plugin validate .",
59
- "preinstall": "node ./script/preinstall.mjs",
60
- "postinstall": "node ./script/postinstall.mjs"
18
+ "preinstall": "node ./preinstall.mjs",
19
+ "postinstall": "node ./postinstall.mjs"
61
20
  },
62
- "type": "module"
63
- }
21
+ "optionalDependencies": {
22
+ "cli-lsp-client-windows-x64": "1.19.4",
23
+ "cli-lsp-client-linux-arm64": "1.19.4",
24
+ "cli-lsp-client-linux-x64": "1.19.4",
25
+ "cli-lsp-client-darwin-x64": "1.19.4",
26
+ "cli-lsp-client-darwin-arm64": "1.19.4"
27
+ }
28
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 cli-lsp-client
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,580 +0,0 @@
1
- # cli-lsp-client
2
-
3
- CLI tool for getting LSP diagnostics. Uses a background daemon to keep LSP servers running.
4
-
5
- ## Features
6
-
7
- - Get diagnostics from LSP servers
8
- - Get hover information for symbols (functions, variables, types)
9
- - Background daemon for fast repeated requests
10
- - Built in Claude Code hook to provide feedback on file edit tool calls
11
- - Comprehensive daemon management (`list`, `stop-all` commands)
12
- - Multi-project support with isolated daemon instances per directory
13
- - [Custom language server support via config files](#custom-language-servers-config-file)
14
-
15
- ## Supported Languages
16
-
17
- | Language | LSP Server | Auto-installed | Notes |
18
- | --------------------- | ------------------------------ | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
19
- | TypeScript/JavaScript | `typescript-language-server` | ✓ (via bunx) | `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.mts`, `.cts` |
20
- | Python | `pyright-langserver` | ✓ (via bunx) | `.py`, `.pyi` |
21
- | JSON | `vscode-json-language-server` | ✓ (via vscode-langservers-extracted) | `.json`, `.jsonc` - includes schema validation |
22
- | CSS | `vscode-css-language-server` | ✓ (via vscode-langservers-extracted) | `.css`, `.scss`, `.sass`, `.less` |
23
- | YAML | `yaml-language-server` | ✓ (via bunx) | `.yaml`, `.yml` - includes schema validation |
24
- | Bash/Shell | `bash-language-server` | ✓ (via bunx) | `.sh`, `.bash`, `.zsh` - **requires shellcheck** (`brew install shellcheck`) |
25
- | GraphQL | `graphql-language-service-cli` | ✓ (via bunx) | `.graphql`, `.gql` |
26
- | **R** | **R languageserver** | **✗** | **`.r`, `.R`, `.rmd`, `.Rmd` - see [R Installation](#r-installation-guide) below** |
27
- | **C#** | **OmniSharp-Roslyn** | **✗** | **`.cs` - see [C# Installation](#c-installation-guide) below** |
28
- | **Swift** | **SourceKit-LSP** | **✗** | **`.swift` - see [Swift Configuration](#swift-configuration) below** |
29
- | Go | `gopls` | ✗ | Requires manual install: `go install golang.org/x/tools/gopls@latest` |
30
- | Java | `jdtls` (Eclipse JDT) | ✗ | `.java` - see [Java Installation](#java-installation-guide) below |
31
- | Lua | `lua-language-server` | ✗ | `.lua` - requires manual install via package manager (brew, scoop) or from [releases](https://github.com/LuaLS/lua-language-server/releases) |
32
-
33
- ## How It Works
34
-
35
- - Daemon starts automatically when needed
36
- - LSP servers spawn based on file type
37
- - Finds project roots using config files (tsconfig.json, etc.)
38
- - Servers stay running for subsequent requests
39
-
40
- ## Claude Code Integration
41
-
42
- ### Plugin Installation (Recommended)
43
-
44
- The easiest way to integrate with Claude Code is via the official plugin:
45
-
46
- ```bash
47
- # Add the plugin marketplace
48
- /plugin marketplace add eli0shin/cli-lsp-client
49
-
50
- # Install the plugin
51
- /plugin install lsp-plugin
52
- ```
53
-
54
- This automatically configures:
55
-
56
- - **SessionStart hook**: Starts the LSP daemon when Claude Code starts
57
- - **PostToolUse hook**: Runs diagnostics after file edits (Edit, Write, MultiEdit)
58
-
59
- No manual configuration needed - the plugin handles everything!
60
-
61
- **Additional plugins available:**
62
-
63
- - `eslint-plugin`: Automatically runs ESLint checks on file edits and blocks on linting errors
64
- - `prettier-plugin`: Automatically formats files with Prettier after edits
65
-
66
- ### MCP Server
67
-
68
- Add as an MCP server to enable Claude to access symbol definitions and hover information:
69
-
70
- ```bash
71
- claude mcp add lsp --scope user -- bunx cli-lsp-client mcp-server
72
- ```
73
-
74
- ### Manual Hook Configuration
75
-
76
- For advanced users who want to customize their hook setup, you can manually configure Claude Code to use the built-in hook commands.
77
-
78
- Get instant diagnostic feedback for TypeScript, Python, JSON, CSS, YAML, Bash, GraphQL, R, C#, Swift, Go, Java, and Lua files as you edit in Claude Code.
79
-
80
- #### Setup
81
-
82
- Add the following to your Claude Code settings.json:
83
-
84
- ```json
85
- {
86
- "$schema": "https://json.schemastore.org/claude-code-settings.json",
87
- "hooks": {
88
- "SessionStart": [
89
- {
90
- "matcher": "startup|resume",
91
- "hooks": [
92
- {
93
- "type": "command",
94
- "command": "bunx cli-lsp-client start"
95
- }
96
- ]
97
- }
98
- ],
99
- "PostToolUse": [
100
- {
101
- "matcher": "Edit|MultiEdit|Write",
102
- "hooks": [
103
- {
104
- "type": "command",
105
- "command": "bunx cli-lsp-client claude-code-hook"
106
- }
107
- ]
108
- }
109
- ]
110
- }
111
- }
112
- ```
113
-
114
- #### How It Works
115
-
116
- - **SessionStart**: Automatically starts LSP servers when Claude Code starts for faster initial diagnostics
117
- - **PostToolUse**: Runs diagnostics after each file edit (Edit, MultiEdit, Write tools)
118
- - Built-in file filtering for all supported languages (16 file types)
119
- - Shows errors, warnings, and hints inline
120
- - Graceful error handling - never breaks your editing experience
121
- - Uses the same fast daemon as the regular diagnostics command
122
-
123
- #### Example Output
124
-
125
- When you save a file with errors, you'll see immediate feedback:
126
-
127
- ```
128
- Edit operation feedback:
129
- - [bunx cli-lsp-client claude-code-hook]:
130
- ERROR at line 3, column 9:
131
- Type 'number' is not assignable to type 'string'.
132
- Source: typescript
133
- Code: 2322
134
- ```
135
-
136
- ## Custom Language Servers (Config File)
137
-
138
- You can extend the built-in language servers by creating a custom configuration file. This allows you to add support for any LSP server not included by default.
139
-
140
- ### Configuration File
141
-
142
- Create a config file at `~/.config/cli-lsp-client/settings.json` (default location) or use `--config-file` to specify a custom path:
143
-
144
- ```json
145
- {
146
- "servers": [
147
- {
148
- "id": "svelte",
149
- "extensions": [".svelte"],
150
- "rootPatterns": ["svelte.config.js", "package.json"],
151
- "command": ["bunx", "svelte-language-server", "--stdio"],
152
- "env": {
153
- "NODE_ENV": "development"
154
- },
155
- "initialization": {
156
- "settings": {
157
- "svelte": {
158
- "compilerWarnings": true
159
- }
160
- }
161
- }
162
- }
163
- ],
164
- "languageExtensions": {
165
- ".svelte": "svelte"
166
- }
167
- }
168
- ```
169
-
170
- ### Using Custom Config
171
-
172
- **Default config file location:**
173
-
174
- ```bash
175
- # Uses ~/.config/cli-lsp-client/settings.json automatically
176
- npx cli-lsp-client diagnostics Component.svelte
177
- ```
178
-
179
- **Custom config file location:**
180
-
181
- ```bash
182
- # Specify custom config file path
183
- npx cli-lsp-client --config-file ./my-config.json diagnostics Component.svelte
184
- npx cli-lsp-client --config-file ./my-config.json hover Component.svelte myFunction
185
- npx cli-lsp-client --config-file ./my-config.json status
186
- ```
187
-
188
- **Important:** When using `--config-file`, you must include it on every command. The CLI automatically restarts the daemon when switching between different config files to ensure the correct language servers are loaded.
189
-
190
- ### Config File Schema
191
-
192
- - `servers`: Array of custom language server definitions
193
- - `id`: Unique identifier for the server
194
- - `extensions`: File extensions this server handles (e.g. `[".svelte"]`)
195
- - `rootPatterns`: Files/patterns used to detect project root (e.g. `["package.json"]`)
196
- - `command`: Command array to start the LSP server (e.g. `["bunx", "svelte-language-server", "--stdio"]`)
197
- - `env`: Optional environment variables for the server process
198
- - `initialization`: Optional LSP initialization parameters
199
-
200
- - `languageExtensions`: Maps file extensions to LSP language identifiers
201
-
202
- ## Usage
203
-
204
- ### Get Diagnostics
205
-
206
- ```bash
207
- # Check a TypeScript file
208
- npx cli-lsp-client diagnostics src/example.ts
209
-
210
- # Check any supported file type
211
- npx cli-lsp-client diagnostics app.py
212
- npx cli-lsp-client diagnostics main.go
213
- npx cli-lsp-client diagnostics analysis.R
214
- npx cli-lsp-client diagnostics Program.cs
215
-
216
- # Check Swift files (requires config file)
217
- npx cli-lsp-client diagnostics Sources/App/main.swift
218
- ```
219
-
220
- Exit codes: 0 for no issues, 2 for issues found.
221
-
222
- ```bash
223
- $ npx cli-lsp-client diagnostics error.ts
224
- ERROR at line 5, column 20:
225
- Argument of type 'string' is not assignable to parameter of type 'number'.
226
- Source: typescript
227
- Code: 2345
228
- ```
229
-
230
- ### Get Hover Information
231
-
232
- ```bash
233
- # Get hover info for a function
234
- npx cli-lsp-client hover src/main.ts myFunction
235
-
236
- # Get hover info for a variable or type
237
- npx cli-lsp-client hover app.py MyClass
238
- npx cli-lsp-client hover analysis.R mean
239
- npx cli-lsp-client hover Program.cs Console
240
-
241
- # Get hover info for Swift symbols (requires config file)
242
- npx cli-lsp-client hover Sources/App/main.swift greetUser
243
- ```
244
-
245
- ````bash
246
- $ npx cli-lsp-client hover src/client.ts runCommand
247
- Location: src/client.ts:370:17
248
- ```typescript
249
- export function runCommand(command: string, commandArgs: string[]): Promise<void>
250
- ````
251
-
252
- ````
253
-
254
- ### Daemon Management
255
-
256
- ```bash
257
- # Check daemon status with uptime and running language servers
258
- npx cli-lsp-client status
259
-
260
- # List all running daemons across directories
261
- npx cli-lsp-client list
262
-
263
- # Stop current directory's daemon
264
- npx cli-lsp-client stop
265
-
266
- # Stop all daemons across all directories (useful after package updates)
267
- npx cli-lsp-client stop-all
268
-
269
- # Show version
270
- npx cli-lsp-client --version
271
-
272
- # Show help
273
- npx cli-lsp-client help
274
- ````
275
-
276
- The `status` command shows the current daemon's uptime and running language servers:
277
-
278
- ```bash
279
- $ npx cli-lsp-client status
280
- LSP Daemon Status
281
- ================
282
- PID: 33502
283
- Uptime: 1m 38s
284
-
285
- Language Servers:
286
- - typescript (.) - running 1m 33s
287
- - pyright (.) - running 1m 10s
288
-
289
- Total: 2 language servers running
290
- ```
291
-
292
- The `list` command shows all running daemon instances with their working directories, PIDs, and status:
293
-
294
- ```bash
295
- $ npx cli-lsp-client list
296
-
297
- Running Daemons:
298
- ================
299
- Hash | PID | Status | Working Directory
300
- ----------------------------------------------------------
301
- h0gx9u | 12345 | ● Running | /Users/user/project-a
302
- 94yi9w | 12346 | ● Running | /Users/user/project-b
303
-
304
- 2/2 daemon(s) running
305
- ```
306
-
307
- Use `stop-all` when updating the CLI package to ensure all old daemon processes are terminated and fresh ones spawn with the updated code.
308
-
309
- ## Java Installation Guide
310
-
311
- Eclipse JDT Language Server requires Java 17+ and manual setup:
312
-
313
- ### Installation Steps
314
-
315
- 1. **Download**: Get the latest server from [Eclipse JDT.LS downloads](http://download.eclipse.org/jdtls/snapshots/)
316
- 2. **Extract**: Unpack to your preferred location (e.g., `/opt/jdtls/`)
317
- 3. **Create wrapper script** named `jdtls` in your PATH:
318
-
319
- ```bash
320
- #!/bin/bash
321
- java -Declipse.application=org.eclipse.jdt.ls.core.id1 \
322
- -Dosgi.bundles.defaultStartLevel=4 \
323
- -Declipse.product=org.eclipse.jdt.ls.core.product \
324
- -Xms1g -Xmx2G \
325
- -jar /opt/jdtls/plugins/org.eclipse.equinox.launcher_*.jar \
326
- -configuration /opt/jdtls/config_linux \
327
- -data "${1:-$HOME/workspace}" \
328
- --add-modules=ALL-SYSTEM \
329
- --add-opens java.base/java.util=ALL-UNNAMED \
330
- --add-opens java.base/java.lang=ALL-UNNAMED "$@"
331
- ```
332
-
333
- 4. **Make executable**: `chmod +x /usr/local/bin/jdtls`
334
-
335
- ### Alternative Installation Methods
336
-
337
- **Homebrew (macOS/Linux)**:
338
-
339
- ```bash
340
- brew install jdtls
341
- ```
342
-
343
- **Arch Linux**:
344
-
345
- ```bash
346
- pacman -S jdtls
347
- ```
348
-
349
- ### Configuration Notes
350
-
351
- - Replace `config_linux` with `config_mac` on macOS or `config_win` on Windows
352
- - Adjust the `-data` workspace path as needed
353
- - Requires Java 17 or higher to run
354
-
355
- For detailed setup instructions, see the [official Eclipse JDT.LS documentation](https://github.com/eclipse-jdtls/eclipse.jdt.ls).
356
-
357
- ## R Installation Guide
358
-
359
- The R language server requires R runtime and the `languageserver` package:
360
-
361
- ### Installation Steps
362
-
363
- 1. **Install R**: Download and install R from [CRAN](https://cran.r-project.org/) or use a package manager:
364
-
365
- **macOS (Homebrew)**:
366
-
367
- ```bash
368
- brew install r
369
- ```
370
-
371
- **Ubuntu/Debian**:
372
-
373
- ```bash
374
- sudo apt-get update
375
- sudo apt-get install r-base
376
- ```
377
-
378
- **Windows**: Download installer from [CRAN Windows](https://cran.r-project.org/bin/windows/base/)
379
-
380
- 2. **Install R languageserver package**: Open R and run:
381
-
382
- ```r
383
- install.packages("languageserver")
384
- ```
385
-
386
- Or from command line:
387
-
388
- ```bash
389
- R --slave -e 'install.packages("languageserver", repos="https://cran.rstudio.com/")'
390
- ```
391
-
392
- ### Verification
393
-
394
- Test that the language server works:
395
-
396
- ```bash
397
- R --slave -e 'languageserver::run()'
398
- ```
399
-
400
- ### Project Detection
401
-
402
- The R LSP automatically detects R projects based on these files:
403
-
404
- - `DESCRIPTION` (R packages)
405
- - `NAMESPACE` (R packages)
406
- - `.Rproj` (RStudio projects)
407
- - `renv.lock` (renv dependency management)
408
- - Any `.r`, `.R`, `.rmd`, `.Rmd` files
409
-
410
- For more information, see the [R languageserver documentation](https://github.com/REditorSupport/languageserver).
411
-
412
- ## C# Installation Guide
413
-
414
- The C# language server requires .NET SDK and OmniSharp-Roslyn:
415
-
416
- ### Installation Steps
417
-
418
- 1. **Install .NET SDK**: Download .NET 6.0+ from [Microsoft .NET](https://dotnet.microsoft.com/download) or use a package manager:
419
-
420
- **macOS (Homebrew)**:
421
-
422
- ```bash
423
- brew install dotnet
424
- ```
425
-
426
- **Ubuntu/Debian**:
427
-
428
- ```bash
429
- # Add Microsoft package repository
430
- wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
431
- sudo dpkg -i packages-microsoft-prod.deb
432
- sudo apt-get update
433
- sudo apt-get install -y dotnet-sdk-8.0
434
- ```
435
-
436
- **Windows**: Download installer from [.NET Downloads](https://dotnet.microsoft.com/download)
437
-
438
- 2. **Install OmniSharp-Roslyn**: Download the latest release from [OmniSharp releases](https://github.com/OmniSharp/omnisharp-roslyn/releases):
439
-
440
- **Automatic script** (recommended):
441
-
442
- ```bash
443
- # Download and extract OmniSharp to ~/.omnisharp/
444
- mkdir -p ~/.omnisharp
445
- curl -L https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-osx-arm64-net6.0.tar.gz | tar -xz -C ~/.omnisharp/
446
-
447
- # Create symlink to make omnisharp available in PATH
448
- sudo ln -sf ~/.omnisharp/OmniSharp /usr/local/bin/omnisharp
449
- ```
450
-
451
- **Manual installation**:
452
- - Download the appropriate release for your platform (Windows: `omnisharp-win-x64-net6.0.zip`, Linux: `omnisharp-linux-x64-net6.0.tar.gz`)
453
- - Extract to a directory (e.g., `~/.omnisharp/`)
454
- - Add the executable to your PATH or create a symlink
455
-
456
- 3. **Set environment variables**:
457
-
458
- **Fish shell**:
459
-
460
- ```bash
461
- set -Ux DOTNET_ROOT ~/.dotnet
462
- ```
463
-
464
- **Bash/Zsh**:
465
-
466
- ```bash
467
- echo 'export DOTNET_ROOT=~/.dotnet' >> ~/.bashrc # or ~/.zshrc
468
- source ~/.bashrc # or ~/.zshrc
469
- ```
470
-
471
- **Note**: `DOTNET_ROOT` must be set in your shell environment for the C# language server to work. The CLI will only load OmniSharp if this environment variable is defined. Restart your terminal after setting the environment variable to ensure it's available.
472
-
473
- ### Verification
474
-
475
- Test that OmniSharp works:
476
-
477
- ```bash
478
- # Verify DOTNET_ROOT is set
479
- echo $DOTNET_ROOT
480
-
481
- # Test OmniSharp command
482
- omnisharp --help
483
- ```
484
-
485
- ### Project Detection
486
-
487
- The C# LSP automatically detects C# projects based on these files:
488
-
489
- - `*.sln` (Solution files)
490
- - `*.csproj` (Project files)
491
- - `project.json` (Legacy project files)
492
- - `global.json` (.NET global configuration)
493
- - Any `.cs` files
494
-
495
- For more information, see the [OmniSharp documentation](https://github.com/OmniSharp/omnisharp-roslyn).
496
-
497
- ## Swift Configuration
498
-
499
- Swift language support is available through SourceKit-LSP, which is included with Xcode Command Line Tools. Support for swift and other LSPs can be added via a config file.
500
-
501
- ### Prerequisites
502
-
503
- **macOS (with Xcode Command Line Tools)**:
504
-
505
- ```bash
506
- # Check if SourceKit-LSP is available
507
- xcrun --find sourcekit-lsp
508
- ```
509
-
510
- **Alternative toolchains**: If using Swift toolchains from swift.org, SourceKit-LSP is included and can be run with:
511
-
512
- ```bash
513
- xcrun --toolchain swift sourcekit-lsp
514
- ```
515
-
516
- ### Configuration
517
-
518
- Create a config file at `~/.config/cli-lsp-client/settings.json`:
519
-
520
- ```json
521
- {
522
- "servers": [
523
- {
524
- "id": "sourcekit_lsp",
525
- "extensions": [".swift"],
526
- "rootPatterns": ["Package.swift", ".xcodeproj", ".xcworkspace"],
527
- "command": ["xcrun", "sourcekit-lsp"],
528
- "env": {}
529
- }
530
- ],
531
- "languageExtensions": {
532
- ".swift": "swift"
533
- }
534
- }
535
- ```
536
-
537
- For more information about SourceKit-LSP, see the [official documentation](https://github.com/swiftlang/sourcekit-lsp).
538
-
539
- ### Additional Commands
540
-
541
- ```bash
542
- # Start LSP servers for current directory (faster subsequent requests)
543
- npx cli-lsp-client start
544
-
545
- # Start servers for specific directory
546
- npx cli-lsp-client start /path/to/project
547
-
548
- # View daemon log file path
549
- npx cli-lsp-client logs
550
- ```
551
-
552
- ## Examples
553
-
554
- ```bash
555
- # Check a specific file
556
- npx cli-lsp-client diagnostics src/main.ts
557
-
558
- # Get hover info for a symbol
559
- npx cli-lsp-client hover src/main.ts myFunction
560
-
561
- # List all daemon instances
562
- npx cli-lsp-client list
563
-
564
- # Stop all daemons after package update
565
- npx cli-lsp-client stop-all
566
- ```
567
-
568
- ## Development
569
-
570
- ### Installation
571
-
572
- ```bash
573
- # Install dependencies and build
574
- bun install
575
- bun run build # Build executable
576
- bun run typecheck
577
- bun test
578
- ```
579
-
580
- Add new LSP servers in `src/lsp/servers.ts`.
package/src/cli.ts DELETED
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import { Command } from '@commander-js/extra-typings';
4
- import { startDaemon } from './daemon.js';
5
- import packageJson from '../package.json' with { type: 'json' };
6
- import { registerVersionCommand } from './commands/version.js';
7
- import { registerStatusCommand } from './commands/status.js';
8
- import { registerListCommand } from './commands/list.js';
9
- import { registerDiagnosticsCommand } from './commands/diagnostics.js';
10
- import { registerHoverCommand } from './commands/hover.js';
11
- import { registerStartCommand } from './commands/start.js';
12
- import { registerLogsCommand } from './commands/logs.js';
13
- import { registerStopCommand } from './commands/stop.js';
14
- import { registerStopAllCommand } from './commands/stop-all.js';
15
- import { registerMcpServerCommand } from './commands/mcp-server.js';
16
- import { registerClaudeCodeHookCommand } from './commands/claude-code-hook.js';
17
-
18
- async function run(): Promise<void> {
19
- // Check if we're being invoked to run as daemon
20
- if (process.env.LSPCLI_DAEMON_MODE === '1') {
21
- await startDaemon();
22
- return;
23
- }
24
-
25
- const program = new Command()
26
- .name('cli-lsp-client')
27
- .description('CLI tool for fast LSP diagnostics with background daemon')
28
- .version(packageJson.version)
29
- .option('--config-file <path>', 'path to configuration file')
30
- .addHelpText(
31
- 'after',
32
- `
33
- Examples:
34
- cli-lsp-client status # Check daemon status
35
- cli-lsp-client list # List all running daemons
36
- cli-lsp-client diagnostics src/main.ts # Get TypeScript diagnostics
37
- cli-lsp-client diagnostics ./script.py # Get Python diagnostics
38
- cli-lsp-client hover src/client.ts runCommand # Get hover info for runCommand function
39
- cli-lsp-client start # Start servers for current directory
40
- cli-lsp-client start /path/to/project # Start servers for specific directory
41
- cli-lsp-client logs # Get log file location
42
- cli-lsp-client stop # Stop the daemon
43
- cli-lsp-client stop-all # Stop all daemons (useful after package updates)
44
- cli-lsp-client mcp-server # Start MCP server
45
-
46
- The daemon automatically starts when needed and caches LSP servers for fast diagnostics.
47
- Use 'cli-lsp-client logs' to find the log file for debugging.
48
- `
49
- );
50
-
51
- // Register all commands
52
- registerVersionCommand(program);
53
- registerStatusCommand(program);
54
- registerListCommand(program);
55
- registerDiagnosticsCommand(program);
56
- registerHoverCommand(program);
57
- registerStartCommand(program);
58
- registerLogsCommand(program);
59
- registerStopCommand(program);
60
- registerStopAllCommand(program);
61
- registerMcpServerCommand(program);
62
- registerClaudeCodeHookCommand(program);
63
-
64
- // Set default command to status
65
- if (process.argv.length === 2) {
66
- process.argv.push('status');
67
- }
68
-
69
- await program.parseAsync(process.argv);
70
- }
71
-
72
- if (import.meta.main) {
73
- run();
74
- }
File without changes
File without changes