cli-lsp-client 1.3.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 +1 -1
- package/README.md +22 -0
- package/cli-lsp-client +0 -0
- package/package.json +3 -2
- package/src/cli.ts +20 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ 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
|
|
10
11
|
- Comprehensive daemon management (`list`, `stop-all` commands)
|
|
@@ -117,6 +118,24 @@ ERROR at line 5, column 20:
|
|
|
117
118
|
Code: 2345
|
|
118
119
|
```
|
|
119
120
|
|
|
121
|
+
### Get Hover Information
|
|
122
|
+
|
|
123
|
+
```bash
|
|
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
|
+
|
|
120
139
|
### Daemon Management
|
|
121
140
|
|
|
122
141
|
```bash
|
|
@@ -221,6 +240,9 @@ npx cli-lsp-client logs
|
|
|
221
240
|
# Check a specific file
|
|
222
241
|
npx cli-lsp-client diagnostics src/main.ts
|
|
223
242
|
|
|
243
|
+
# Get hover info for a symbol
|
|
244
|
+
npx cli-lsp-client hover src/main.ts myFunction
|
|
245
|
+
|
|
224
246
|
# List all daemon instances
|
|
225
247
|
npx cli-lsp-client list
|
|
226
248
|
|
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.
|
|
4
|
-
"description": "
|
|
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,13 +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';
|
|
9
10
|
import packageJson from '../package.json' with { type: 'json' };
|
|
10
11
|
|
|
11
|
-
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 }> {
|
|
12
13
|
// Check if file exists
|
|
13
14
|
if (!await Bun.file(filePath).exists()) {
|
|
14
15
|
return { hasIssues: false, output: '' };
|
|
@@ -34,7 +35,18 @@ export async function handleClaudeCodeHook(filePath: string): Promise<{ hasIssue
|
|
|
34
35
|
|
|
35
36
|
// Get diagnostics (suppress errors to stdout)
|
|
36
37
|
try {
|
|
37
|
-
|
|
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
|
+
|
|
38
50
|
const result = await sendToExistingDaemon('diagnostics', [filePath]);
|
|
39
51
|
|
|
40
52
|
// The diagnostics command returns an array of diagnostics
|
|
@@ -109,6 +121,11 @@ async function run(): Promise<void> {
|
|
|
109
121
|
}
|
|
110
122
|
|
|
111
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
|
+
}
|
|
112
129
|
if (result.hasIssues) {
|
|
113
130
|
console.error(result.output);
|
|
114
131
|
process.exit(2);
|