cli-lsp-client 1.2.0 → 1.4.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 cli-lsp-client
3
+ Copyright (c) 2025 cli-lsp-client
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -5,8 +5,11 @@ CLI tool for getting LSP diagnostics. Uses a background daemon to keep LSP serve
5
5
  ## Features
6
6
 
7
7
  - Get diagnostics from LSP servers
8
+ - Get hover information for symbols (functions, variables, types)
8
9
  - Background daemon for fast repeated requests
9
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
10
13
 
11
14
  ## Supported Languages
12
15
 
@@ -40,10 +43,21 @@ Get instant diagnostic feedback for TypeScript, Python, Go, JSON, CSS, YAML, Bas
40
43
 
41
44
  Configure Claude Code to use the built-in hook command:
42
45
 
43
- ```bash
46
+ ```json
44
47
  {
45
48
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
46
49
  "hooks": {
50
+ "SessionStart": [
51
+ {
52
+ "matcher": "startup|resume",
53
+ "hooks": [
54
+ {
55
+ "type": "command",
56
+ "command": "npx -y cli-lsp-client warmup"
57
+ }
58
+ ]
59
+ }
60
+ ],
47
61
  "PostToolUse": [
48
62
  {
49
63
  "matcher": "Edit|MultiEdit|Write",
@@ -61,7 +75,8 @@ Configure Claude Code to use the built-in hook command:
61
75
 
62
76
  #### How It Works
63
77
 
64
- - Automatically runs diagnostics after each file edit
78
+ - **SessionStart**: Automatically warms up LSP servers when Claude Code starts for faster initial diagnostics
79
+ - **PostToolUse**: Runs diagnostics after each file edit (Edit, MultiEdit, Write tools)
65
80
  - Built-in file filtering for all supported languages (11 file types)
66
81
  - Shows errors, warnings, and hints inline
67
82
  - Graceful error handling - never breaks your editing experience
@@ -103,16 +118,63 @@ ERROR at line 5, column 20:
103
118
  Code: 2345
104
119
  ```
105
120
 
106
- ### Other Commands
121
+ ### Get Hover Information
107
122
 
108
123
  ```bash
109
- # Check daemon status
124
+ # Get hover info for a function
125
+ npx cli-lsp-client hover src/main.ts myFunction
126
+
127
+ # Get hover info for a variable or type
128
+ npx cli-lsp-client hover app.py MyClass
129
+ ```
130
+
131
+ ```bash
132
+ $ npx cli-lsp-client hover src/client.ts runCommand
133
+ Location: src/client.ts:370:17
134
+ ```typescript
135
+ export function runCommand(command: string, commandArgs: string[]): Promise<void>
136
+ ```
137
+ ```
138
+
139
+ ### Daemon Management
140
+
141
+ ```bash
142
+ # Check daemon status and memory usage
110
143
  npx cli-lsp-client status
111
144
 
112
- # Stop daemon (it will auto-restart when needed)
145
+ # List all running daemons across directories
146
+ npx cli-lsp-client list
147
+
148
+ # Stop current directory's daemon
113
149
  npx cli-lsp-client stop
150
+
151
+ # Stop all daemons across all directories (useful after package updates)
152
+ npx cli-lsp-client stop-all
153
+
154
+ # Show version
155
+ npx cli-lsp-client --version
156
+
157
+ # Show help
158
+ npx cli-lsp-client help
114
159
  ```
115
160
 
161
+ The `list` command shows all running daemon instances with their working directories, PIDs, and status:
162
+
163
+ ```bash
164
+ $ npx cli-lsp-client list
165
+
166
+ Running Daemons:
167
+ ================
168
+ Hash | PID | Status | Working Directory
169
+ ----------------------------------------------------------
170
+ h0gx9u | 12345 | ● Running | /Users/user/project-a
171
+ 94yi9w | 12346 | ● Running | /Users/user/project-b
172
+
173
+ 2/2 daemon(s) running
174
+ ```
175
+
176
+ Use `stop-all` when updating the CLI package to ensure all old daemon processes are terminated and fresh ones spawn with the updated code.
177
+
116
178
  ## Java Installation Guide
117
179
 
118
180
  Eclipse JDT Language Server requires Java 17+ and manual setup:
@@ -159,11 +221,33 @@ pacman -S jdtls
159
221
 
160
222
  For detailed setup instructions, see the [official Eclipse JDT.LS documentation](https://github.com/eclipse-jdtls/eclipse.jdt.ls).
161
223
 
224
+ ### Additional Commands
225
+
226
+ ```bash
227
+ # Warm up LSP servers for current directory (faster subsequent requests)
228
+ npx cli-lsp-client warmup
229
+
230
+ # Warm up for specific directory
231
+ npx cli-lsp-client warmup /path/to/project
232
+
233
+ # View daemon logs
234
+ npx cli-lsp-client logs
235
+ ```
236
+
162
237
  ## Examples
163
238
 
164
239
  ```bash
165
240
  # Check a specific file
166
241
  npx cli-lsp-client diagnostics src/main.ts
242
+
243
+ # Get hover info for a symbol
244
+ npx cli-lsp-client hover src/main.ts myFunction
245
+
246
+ # List all daemon instances
247
+ npx cli-lsp-client list
248
+
249
+ # Stop all daemons after package update
250
+ npx cli-lsp-client stop-all
167
251
  ```
168
252
 
169
253
  ## Development
package/cli-lsp-client CHANGED
Binary file
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "cli-lsp-client",
3
- "version": "1.2.0",
4
- "description": "A Bun CLI daemon application",
3
+ "version": "1.4.0",
4
+ "description": "CLI tool for fast LSP diagnostics with background daemon and multi-project support",
5
5
  "type": "module",
6
6
  "main": "src/cli.ts",
7
+ "license": "MIT",
7
8
  "bin": {
8
9
  "cli-lsp-client": "cli-lsp-client"
9
10
  },
package/src/cli.ts CHANGED
@@ -2,12 +2,14 @@
2
2
 
3
3
  import path from 'path';
4
4
  import { startDaemon } from './daemon.js';
5
- import { runCommand } from './client.js';
5
+ import { runCommand, sendToExistingDaemon } from './client.js';
6
6
  import { formatDiagnosticsPlain } from './lsp/formatter.js';
7
7
  import type { Diagnostic } from './lsp/types.js';
8
8
  import { HELP_MESSAGE } from './constants.js';
9
+ import { ensureDaemonRunning } from './utils.js';
10
+ import packageJson from '../package.json' with { type: 'json' };
9
11
 
10
- export async function handleClaudeCodeHook(filePath: string): Promise<{ hasIssues: boolean; output: string }> {
12
+ export async function handleClaudeCodeHook(filePath: string): Promise<{ hasIssues: boolean; output: string; daemonFailed?: boolean }> {
11
13
  // Check if file exists
12
14
  if (!await Bun.file(filePath).exists()) {
13
15
  return { hasIssues: false, output: '' };
@@ -33,7 +35,18 @@ export async function handleClaudeCodeHook(filePath: string): Promise<{ hasIssue
33
35
 
34
36
  // Get diagnostics (suppress errors to stdout)
35
37
  try {
36
- const { sendToExistingDaemon } = await import('./client.js');
38
+ // Ensure daemon is running
39
+ const daemonStarted = await ensureDaemonRunning();
40
+
41
+ if (!daemonStarted) {
42
+ // Failed to start daemon - return with flag so caller can handle
43
+ return {
44
+ hasIssues: false,
45
+ output: 'Failed to start LSP daemon. Please try running "cli-lsp-client stop" and retry.',
46
+ daemonFailed: true
47
+ };
48
+ }
49
+
37
50
  const result = await sendToExistingDaemon('diagnostics', [filePath]);
38
51
 
39
52
  // The diagnostics command returns an array of diagnostics
@@ -73,6 +86,12 @@ async function run(): Promise<void> {
73
86
  return;
74
87
  }
75
88
 
89
+ // Handle version command directly (no daemon needed)
90
+ if (command === 'version' || command === '--version' || command === '-v') {
91
+ console.log(packageJson.version);
92
+ return;
93
+ }
94
+
76
95
  // Handle claude-code-hook command directly (reads JSON from stdin)
77
96
  if (command === 'claude-code-hook') {
78
97
  try {
@@ -102,6 +121,11 @@ async function run(): Promise<void> {
102
121
  }
103
122
 
104
123
  const result = await handleClaudeCodeHook(filePath);
124
+ if (result.daemonFailed) {
125
+ // Daemon failed to start - exit with status 1 to show error to user
126
+ console.error(result.output);
127
+ process.exit(1);
128
+ }
105
129
  if (result.hasIssues) {
106
130
  console.error(result.output);
107
131
  process.exit(2);