oh-my-claude-sisyphus 1.0.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 +21 -0
- package/README.md +416 -0
- package/dist/agents/definitions.d.ts +48 -0
- package/dist/agents/definitions.d.ts.map +1 -0
- package/dist/agents/definitions.js +271 -0
- package/dist/agents/definitions.js.map +1 -0
- package/dist/agents/index.d.ts +5 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +5 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +280 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +49 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +329 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/features/continuation-enforcement.d.ts +34 -0
- package/dist/features/continuation-enforcement.d.ts.map +1 -0
- package/dist/features/continuation-enforcement.js +142 -0
- package/dist/features/continuation-enforcement.js.map +1 -0
- package/dist/features/index.d.ts +6 -0
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/index.js +6 -0
- package/dist/features/index.js.map +1 -0
- package/dist/features/magic-keywords.d.ts +22 -0
- package/dist/features/magic-keywords.d.ts.map +1 -0
- package/dist/features/magic-keywords.js +189 -0
- package/dist/features/magic-keywords.js.map +1 -0
- package/dist/index.d.ts +105 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +146 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/servers.d.ts +77 -0
- package/dist/mcp/servers.d.ts.map +1 -0
- package/dist/mcp/servers.js +122 -0
- package/dist/mcp/servers.js.map +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/types.d.ts +133 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tools/ast-tools.d.ts +63 -0
- package/dist/tools/ast-tools.d.ts.map +1 -0
- package/dist/tools/ast-tools.js +349 -0
- package/dist/tools/ast-tools.js.map +1 -0
- package/dist/tools/index.d.ts +52 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +120 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lsp/client.d.ts +201 -0
- package/dist/tools/lsp/client.d.ts.map +1 -0
- package/dist/tools/lsp/client.js +454 -0
- package/dist/tools/lsp/client.js.map +1 -0
- package/dist/tools/lsp/index.d.ts +9 -0
- package/dist/tools/lsp/index.d.ts.map +1 -0
- package/dist/tools/lsp/index.js +7 -0
- package/dist/tools/lsp/index.js.map +1 -0
- package/dist/tools/lsp/servers.d.ts +37 -0
- package/dist/tools/lsp/servers.d.ts.map +1 -0
- package/dist/tools/lsp/servers.js +148 -0
- package/dist/tools/lsp/servers.js.map +1 -0
- package/dist/tools/lsp/utils.d.ts +58 -0
- package/dist/tools/lsp/utils.d.ts.map +1 -0
- package/dist/tools/lsp/utils.js +236 -0
- package/dist/tools/lsp/utils.js.map +1 -0
- package/dist/tools/lsp-tools.d.ts +151 -0
- package/dist/tools/lsp-tools.d.ts.map +1 -0
- package/dist/tools/lsp-tools.js +358 -0
- package/dist/tools/lsp-tools.js.map +1 -0
- package/package.json +75 -0
- package/scripts/install.sh +765 -0
- package/scripts/uninstall.sh +47 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Client Implementation
|
|
3
|
+
*
|
|
4
|
+
* Manages connections to language servers using JSON-RPC 2.0 over stdio.
|
|
5
|
+
* Handles server lifecycle, message buffering, and request/response matching.
|
|
6
|
+
*/
|
|
7
|
+
import type { LspServerConfig } from './servers.js';
|
|
8
|
+
export interface Position {
|
|
9
|
+
line: number;
|
|
10
|
+
character: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Range {
|
|
13
|
+
start: Position;
|
|
14
|
+
end: Position;
|
|
15
|
+
}
|
|
16
|
+
export interface Location {
|
|
17
|
+
uri: string;
|
|
18
|
+
range: Range;
|
|
19
|
+
}
|
|
20
|
+
export interface TextDocumentIdentifier {
|
|
21
|
+
uri: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TextDocumentPositionParams {
|
|
24
|
+
textDocument: TextDocumentIdentifier;
|
|
25
|
+
position: Position;
|
|
26
|
+
}
|
|
27
|
+
export interface Hover {
|
|
28
|
+
contents: string | {
|
|
29
|
+
kind: string;
|
|
30
|
+
value: string;
|
|
31
|
+
} | Array<string | {
|
|
32
|
+
kind: string;
|
|
33
|
+
value: string;
|
|
34
|
+
}>;
|
|
35
|
+
range?: Range;
|
|
36
|
+
}
|
|
37
|
+
export interface Diagnostic {
|
|
38
|
+
range: Range;
|
|
39
|
+
severity?: number;
|
|
40
|
+
code?: string | number;
|
|
41
|
+
source?: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
export interface DocumentSymbol {
|
|
45
|
+
name: string;
|
|
46
|
+
kind: number;
|
|
47
|
+
range: Range;
|
|
48
|
+
selectionRange: Range;
|
|
49
|
+
children?: DocumentSymbol[];
|
|
50
|
+
}
|
|
51
|
+
export interface SymbolInformation {
|
|
52
|
+
name: string;
|
|
53
|
+
kind: number;
|
|
54
|
+
location: Location;
|
|
55
|
+
containerName?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface WorkspaceEdit {
|
|
58
|
+
changes?: Record<string, Array<{
|
|
59
|
+
range: Range;
|
|
60
|
+
newText: string;
|
|
61
|
+
}>>;
|
|
62
|
+
documentChanges?: Array<{
|
|
63
|
+
textDocument: TextDocumentIdentifier;
|
|
64
|
+
edits: Array<{
|
|
65
|
+
range: Range;
|
|
66
|
+
newText: string;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
export interface CodeAction {
|
|
71
|
+
title: string;
|
|
72
|
+
kind?: string;
|
|
73
|
+
diagnostics?: Diagnostic[];
|
|
74
|
+
isPreferred?: boolean;
|
|
75
|
+
edit?: WorkspaceEdit;
|
|
76
|
+
command?: {
|
|
77
|
+
title: string;
|
|
78
|
+
command: string;
|
|
79
|
+
arguments?: unknown[];
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* LSP Client class
|
|
84
|
+
*/
|
|
85
|
+
export declare class LspClient {
|
|
86
|
+
private process;
|
|
87
|
+
private requestId;
|
|
88
|
+
private pendingRequests;
|
|
89
|
+
private buffer;
|
|
90
|
+
private openDocuments;
|
|
91
|
+
private diagnostics;
|
|
92
|
+
private workspaceRoot;
|
|
93
|
+
private serverConfig;
|
|
94
|
+
private initialized;
|
|
95
|
+
constructor(workspaceRoot: string, serverConfig: LspServerConfig);
|
|
96
|
+
/**
|
|
97
|
+
* Start the LSP server and initialize the connection
|
|
98
|
+
*/
|
|
99
|
+
connect(): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Disconnect from the LSP server
|
|
102
|
+
*/
|
|
103
|
+
disconnect(): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Handle incoming data from the server
|
|
106
|
+
*/
|
|
107
|
+
private handleData;
|
|
108
|
+
/**
|
|
109
|
+
* Handle a parsed JSON-RPC message
|
|
110
|
+
*/
|
|
111
|
+
private handleMessage;
|
|
112
|
+
/**
|
|
113
|
+
* Handle server notifications
|
|
114
|
+
*/
|
|
115
|
+
private handleNotification;
|
|
116
|
+
/**
|
|
117
|
+
* Send a request to the server
|
|
118
|
+
*/
|
|
119
|
+
private request;
|
|
120
|
+
/**
|
|
121
|
+
* Send a notification to the server (no response expected)
|
|
122
|
+
*/
|
|
123
|
+
private notify;
|
|
124
|
+
/**
|
|
125
|
+
* Initialize the LSP connection
|
|
126
|
+
*/
|
|
127
|
+
private initialize;
|
|
128
|
+
/**
|
|
129
|
+
* Open a document for editing
|
|
130
|
+
*/
|
|
131
|
+
openDocument(filePath: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Close a document
|
|
134
|
+
*/
|
|
135
|
+
closeDocument(filePath: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* Get the language ID for a file
|
|
138
|
+
*/
|
|
139
|
+
private getLanguageId;
|
|
140
|
+
/**
|
|
141
|
+
* Convert file path to URI and ensure document is open
|
|
142
|
+
*/
|
|
143
|
+
private prepareDocument;
|
|
144
|
+
/**
|
|
145
|
+
* Get hover information at a position
|
|
146
|
+
*/
|
|
147
|
+
hover(filePath: string, line: number, character: number): Promise<Hover | null>;
|
|
148
|
+
/**
|
|
149
|
+
* Go to definition
|
|
150
|
+
*/
|
|
151
|
+
definition(filePath: string, line: number, character: number): Promise<Location | Location[] | null>;
|
|
152
|
+
/**
|
|
153
|
+
* Find all references
|
|
154
|
+
*/
|
|
155
|
+
references(filePath: string, line: number, character: number, includeDeclaration?: boolean): Promise<Location[] | null>;
|
|
156
|
+
/**
|
|
157
|
+
* Get document symbols
|
|
158
|
+
*/
|
|
159
|
+
documentSymbols(filePath: string): Promise<DocumentSymbol[] | SymbolInformation[] | null>;
|
|
160
|
+
/**
|
|
161
|
+
* Search workspace symbols
|
|
162
|
+
*/
|
|
163
|
+
workspaceSymbols(query: string): Promise<SymbolInformation[] | null>;
|
|
164
|
+
/**
|
|
165
|
+
* Get diagnostics for a file
|
|
166
|
+
*/
|
|
167
|
+
getDiagnostics(filePath: string): Diagnostic[];
|
|
168
|
+
/**
|
|
169
|
+
* Prepare rename (check if rename is valid)
|
|
170
|
+
*/
|
|
171
|
+
prepareRename(filePath: string, line: number, character: number): Promise<Range | null>;
|
|
172
|
+
/**
|
|
173
|
+
* Rename a symbol
|
|
174
|
+
*/
|
|
175
|
+
rename(filePath: string, line: number, character: number, newName: string): Promise<WorkspaceEdit | null>;
|
|
176
|
+
/**
|
|
177
|
+
* Get code actions
|
|
178
|
+
*/
|
|
179
|
+
codeActions(filePath: string, range: Range, diagnostics?: Diagnostic[]): Promise<CodeAction[] | null>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Client manager - maintains a pool of LSP clients per workspace/server
|
|
183
|
+
*/
|
|
184
|
+
declare class LspClientManager {
|
|
185
|
+
private clients;
|
|
186
|
+
/**
|
|
187
|
+
* Get or create a client for a file
|
|
188
|
+
*/
|
|
189
|
+
getClientForFile(filePath: string): Promise<LspClient | null>;
|
|
190
|
+
/**
|
|
191
|
+
* Find the workspace root for a file
|
|
192
|
+
*/
|
|
193
|
+
private findWorkspaceRoot;
|
|
194
|
+
/**
|
|
195
|
+
* Disconnect all clients
|
|
196
|
+
*/
|
|
197
|
+
disconnectAll(): Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
export declare const lspClientManager: LspClientManager;
|
|
200
|
+
export {};
|
|
201
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/tools/lsp/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,QAAQ,CAAC;IAChB,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WA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AO,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC;CAQhH;AAED;;GAEG;AACH,cAAM,gBAAgB;IACpB,OAAO,CAAC,OAAO,CAAgC;IAE/C;;OAEG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAwBnE;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAMrC;AAGD,eAAO,MAAM,gBAAgB,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Client Implementation
|
|
3
|
+
*
|
|
4
|
+
* Manages connections to language servers using JSON-RPC 2.0 over stdio.
|
|
5
|
+
* Handles server lifecycle, message buffering, and request/response matching.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from 'child_process';
|
|
8
|
+
import { readFileSync, existsSync } from 'fs';
|
|
9
|
+
import { resolve, dirname } from 'path';
|
|
10
|
+
import { getServerForFile, commandExists } from './servers.js';
|
|
11
|
+
/**
|
|
12
|
+
* LSP Client class
|
|
13
|
+
*/
|
|
14
|
+
export class LspClient {
|
|
15
|
+
process = null;
|
|
16
|
+
requestId = 0;
|
|
17
|
+
pendingRequests = new Map();
|
|
18
|
+
buffer = '';
|
|
19
|
+
openDocuments = new Set();
|
|
20
|
+
diagnostics = new Map();
|
|
21
|
+
workspaceRoot;
|
|
22
|
+
serverConfig;
|
|
23
|
+
initialized = false;
|
|
24
|
+
constructor(workspaceRoot, serverConfig) {
|
|
25
|
+
this.workspaceRoot = resolve(workspaceRoot);
|
|
26
|
+
this.serverConfig = serverConfig;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Start the LSP server and initialize the connection
|
|
30
|
+
*/
|
|
31
|
+
async connect() {
|
|
32
|
+
if (this.process) {
|
|
33
|
+
return; // Already connected
|
|
34
|
+
}
|
|
35
|
+
if (!commandExists(this.serverConfig.command)) {
|
|
36
|
+
throw new Error(`Language server '${this.serverConfig.command}' not found.\n` +
|
|
37
|
+
`Install with: ${this.serverConfig.installHint}`);
|
|
38
|
+
}
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
this.process = spawn(this.serverConfig.command, this.serverConfig.args, {
|
|
41
|
+
cwd: this.workspaceRoot,
|
|
42
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
43
|
+
});
|
|
44
|
+
this.process.stdout?.on('data', (data) => {
|
|
45
|
+
this.handleData(data.toString());
|
|
46
|
+
});
|
|
47
|
+
this.process.stderr?.on('data', (data) => {
|
|
48
|
+
// Log stderr for debugging but don't fail
|
|
49
|
+
console.error(`LSP stderr: ${data.toString()}`);
|
|
50
|
+
});
|
|
51
|
+
this.process.on('error', (error) => {
|
|
52
|
+
reject(new Error(`Failed to start LSP server: ${error.message}`));
|
|
53
|
+
});
|
|
54
|
+
this.process.on('exit', (code) => {
|
|
55
|
+
this.process = null;
|
|
56
|
+
this.initialized = false;
|
|
57
|
+
if (code !== 0) {
|
|
58
|
+
console.error(`LSP server exited with code ${code}`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
// Send initialize request
|
|
62
|
+
this.initialize()
|
|
63
|
+
.then(() => {
|
|
64
|
+
this.initialized = true;
|
|
65
|
+
resolve();
|
|
66
|
+
})
|
|
67
|
+
.catch(reject);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Disconnect from the LSP server
|
|
72
|
+
*/
|
|
73
|
+
async disconnect() {
|
|
74
|
+
if (!this.process)
|
|
75
|
+
return;
|
|
76
|
+
try {
|
|
77
|
+
await this.request('shutdown', null);
|
|
78
|
+
this.notify('exit', null);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Ignore errors during shutdown
|
|
82
|
+
}
|
|
83
|
+
this.process.kill();
|
|
84
|
+
this.process = null;
|
|
85
|
+
this.initialized = false;
|
|
86
|
+
this.pendingRequests.clear();
|
|
87
|
+
this.openDocuments.clear();
|
|
88
|
+
this.diagnostics.clear();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Handle incoming data from the server
|
|
92
|
+
*/
|
|
93
|
+
handleData(data) {
|
|
94
|
+
this.buffer += data;
|
|
95
|
+
while (true) {
|
|
96
|
+
// Look for Content-Length header
|
|
97
|
+
const headerEnd = this.buffer.indexOf('\r\n\r\n');
|
|
98
|
+
if (headerEnd === -1)
|
|
99
|
+
break;
|
|
100
|
+
const header = this.buffer.slice(0, headerEnd);
|
|
101
|
+
const contentLengthMatch = header.match(/Content-Length: (\d+)/i);
|
|
102
|
+
if (!contentLengthMatch) {
|
|
103
|
+
// Invalid header, try to recover
|
|
104
|
+
this.buffer = this.buffer.slice(headerEnd + 4);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const contentLength = parseInt(contentLengthMatch[1], 10);
|
|
108
|
+
const messageStart = headerEnd + 4;
|
|
109
|
+
const messageEnd = messageStart + contentLength;
|
|
110
|
+
if (this.buffer.length < messageEnd) {
|
|
111
|
+
break; // Not enough data yet
|
|
112
|
+
}
|
|
113
|
+
const messageJson = this.buffer.slice(messageStart, messageEnd);
|
|
114
|
+
this.buffer = this.buffer.slice(messageEnd);
|
|
115
|
+
try {
|
|
116
|
+
const message = JSON.parse(messageJson);
|
|
117
|
+
this.handleMessage(message);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Invalid JSON, skip
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Handle a parsed JSON-RPC message
|
|
126
|
+
*/
|
|
127
|
+
handleMessage(message) {
|
|
128
|
+
if ('id' in message && message.id !== undefined) {
|
|
129
|
+
// Response to a request
|
|
130
|
+
const pending = this.pendingRequests.get(message.id);
|
|
131
|
+
if (pending) {
|
|
132
|
+
clearTimeout(pending.timeout);
|
|
133
|
+
this.pendingRequests.delete(message.id);
|
|
134
|
+
if (message.error) {
|
|
135
|
+
pending.reject(new Error(message.error.message));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
pending.resolve(message.result);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if ('method' in message) {
|
|
143
|
+
// Notification from server
|
|
144
|
+
this.handleNotification(message);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Handle server notifications
|
|
149
|
+
*/
|
|
150
|
+
handleNotification(notification) {
|
|
151
|
+
if (notification.method === 'textDocument/publishDiagnostics') {
|
|
152
|
+
const params = notification.params;
|
|
153
|
+
this.diagnostics.set(params.uri, params.diagnostics);
|
|
154
|
+
}
|
|
155
|
+
// Handle other notifications as needed
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Send a request to the server
|
|
159
|
+
*/
|
|
160
|
+
async request(method, params, timeout = 15000) {
|
|
161
|
+
if (!this.process?.stdin) {
|
|
162
|
+
throw new Error('LSP server not connected');
|
|
163
|
+
}
|
|
164
|
+
const id = ++this.requestId;
|
|
165
|
+
const request = {
|
|
166
|
+
jsonrpc: '2.0',
|
|
167
|
+
id,
|
|
168
|
+
method,
|
|
169
|
+
params
|
|
170
|
+
};
|
|
171
|
+
const content = JSON.stringify(request);
|
|
172
|
+
const message = `Content-Length: ${Buffer.byteLength(content)}\r\n\r\n${content}`;
|
|
173
|
+
return new Promise((resolve, reject) => {
|
|
174
|
+
const timeoutHandle = setTimeout(() => {
|
|
175
|
+
this.pendingRequests.delete(id);
|
|
176
|
+
reject(new Error(`LSP request '${method}' timed out after ${timeout}ms`));
|
|
177
|
+
}, timeout);
|
|
178
|
+
this.pendingRequests.set(id, {
|
|
179
|
+
resolve: resolve,
|
|
180
|
+
reject,
|
|
181
|
+
timeout: timeoutHandle
|
|
182
|
+
});
|
|
183
|
+
this.process?.stdin?.write(message);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Send a notification to the server (no response expected)
|
|
188
|
+
*/
|
|
189
|
+
notify(method, params) {
|
|
190
|
+
if (!this.process?.stdin)
|
|
191
|
+
return;
|
|
192
|
+
const notification = {
|
|
193
|
+
jsonrpc: '2.0',
|
|
194
|
+
method,
|
|
195
|
+
params
|
|
196
|
+
};
|
|
197
|
+
const content = JSON.stringify(notification);
|
|
198
|
+
const message = `Content-Length: ${Buffer.byteLength(content)}\r\n\r\n${content}`;
|
|
199
|
+
this.process.stdin.write(message);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Initialize the LSP connection
|
|
203
|
+
*/
|
|
204
|
+
async initialize() {
|
|
205
|
+
await this.request('initialize', {
|
|
206
|
+
processId: process.pid,
|
|
207
|
+
rootUri: `file://${this.workspaceRoot}`,
|
|
208
|
+
rootPath: this.workspaceRoot,
|
|
209
|
+
capabilities: {
|
|
210
|
+
textDocument: {
|
|
211
|
+
hover: { contentFormat: ['markdown', 'plaintext'] },
|
|
212
|
+
definition: { linkSupport: true },
|
|
213
|
+
references: {},
|
|
214
|
+
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
215
|
+
codeAction: { codeActionLiteralSupport: { codeActionKind: { valueSet: [] } } },
|
|
216
|
+
rename: { prepareSupport: true }
|
|
217
|
+
},
|
|
218
|
+
workspace: {
|
|
219
|
+
symbol: {},
|
|
220
|
+
workspaceFolders: true
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
initializationOptions: this.serverConfig.initializationOptions || {}
|
|
224
|
+
});
|
|
225
|
+
this.notify('initialized', {});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Open a document for editing
|
|
229
|
+
*/
|
|
230
|
+
async openDocument(filePath) {
|
|
231
|
+
const uri = `file://${resolve(filePath)}`;
|
|
232
|
+
if (this.openDocuments.has(uri))
|
|
233
|
+
return;
|
|
234
|
+
if (!existsSync(filePath)) {
|
|
235
|
+
throw new Error(`File not found: ${filePath}`);
|
|
236
|
+
}
|
|
237
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
238
|
+
const languageId = this.getLanguageId(filePath);
|
|
239
|
+
this.notify('textDocument/didOpen', {
|
|
240
|
+
textDocument: {
|
|
241
|
+
uri,
|
|
242
|
+
languageId,
|
|
243
|
+
version: 1,
|
|
244
|
+
text: content
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
this.openDocuments.add(uri);
|
|
248
|
+
// Wait a bit for the server to process the document
|
|
249
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Close a document
|
|
253
|
+
*/
|
|
254
|
+
closeDocument(filePath) {
|
|
255
|
+
const uri = `file://${resolve(filePath)}`;
|
|
256
|
+
if (!this.openDocuments.has(uri))
|
|
257
|
+
return;
|
|
258
|
+
this.notify('textDocument/didClose', {
|
|
259
|
+
textDocument: { uri }
|
|
260
|
+
});
|
|
261
|
+
this.openDocuments.delete(uri);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get the language ID for a file
|
|
265
|
+
*/
|
|
266
|
+
getLanguageId(filePath) {
|
|
267
|
+
const ext = filePath.split('.').pop()?.toLowerCase() || '';
|
|
268
|
+
const langMap = {
|
|
269
|
+
'ts': 'typescript',
|
|
270
|
+
'tsx': 'typescriptreact',
|
|
271
|
+
'js': 'javascript',
|
|
272
|
+
'jsx': 'javascriptreact',
|
|
273
|
+
'mts': 'typescript',
|
|
274
|
+
'cts': 'typescript',
|
|
275
|
+
'mjs': 'javascript',
|
|
276
|
+
'cjs': 'javascript',
|
|
277
|
+
'py': 'python',
|
|
278
|
+
'rs': 'rust',
|
|
279
|
+
'go': 'go',
|
|
280
|
+
'c': 'c',
|
|
281
|
+
'h': 'c',
|
|
282
|
+
'cpp': 'cpp',
|
|
283
|
+
'cc': 'cpp',
|
|
284
|
+
'hpp': 'cpp',
|
|
285
|
+
'java': 'java',
|
|
286
|
+
'json': 'json',
|
|
287
|
+
'html': 'html',
|
|
288
|
+
'css': 'css',
|
|
289
|
+
'scss': 'scss',
|
|
290
|
+
'yaml': 'yaml',
|
|
291
|
+
'yml': 'yaml'
|
|
292
|
+
};
|
|
293
|
+
return langMap[ext] || ext;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Convert file path to URI and ensure document is open
|
|
297
|
+
*/
|
|
298
|
+
async prepareDocument(filePath) {
|
|
299
|
+
await this.openDocument(filePath);
|
|
300
|
+
return `file://${resolve(filePath)}`;
|
|
301
|
+
}
|
|
302
|
+
// LSP Request Methods
|
|
303
|
+
/**
|
|
304
|
+
* Get hover information at a position
|
|
305
|
+
*/
|
|
306
|
+
async hover(filePath, line, character) {
|
|
307
|
+
const uri = await this.prepareDocument(filePath);
|
|
308
|
+
return this.request('textDocument/hover', {
|
|
309
|
+
textDocument: { uri },
|
|
310
|
+
position: { line, character }
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Go to definition
|
|
315
|
+
*/
|
|
316
|
+
async definition(filePath, line, character) {
|
|
317
|
+
const uri = await this.prepareDocument(filePath);
|
|
318
|
+
return this.request('textDocument/definition', {
|
|
319
|
+
textDocument: { uri },
|
|
320
|
+
position: { line, character }
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Find all references
|
|
325
|
+
*/
|
|
326
|
+
async references(filePath, line, character, includeDeclaration = true) {
|
|
327
|
+
const uri = await this.prepareDocument(filePath);
|
|
328
|
+
return this.request('textDocument/references', {
|
|
329
|
+
textDocument: { uri },
|
|
330
|
+
position: { line, character },
|
|
331
|
+
context: { includeDeclaration }
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Get document symbols
|
|
336
|
+
*/
|
|
337
|
+
async documentSymbols(filePath) {
|
|
338
|
+
const uri = await this.prepareDocument(filePath);
|
|
339
|
+
return this.request('textDocument/documentSymbol', {
|
|
340
|
+
textDocument: { uri }
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Search workspace symbols
|
|
345
|
+
*/
|
|
346
|
+
async workspaceSymbols(query) {
|
|
347
|
+
return this.request('workspace/symbol', { query });
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Get diagnostics for a file
|
|
351
|
+
*/
|
|
352
|
+
getDiagnostics(filePath) {
|
|
353
|
+
const uri = `file://${resolve(filePath)}`;
|
|
354
|
+
return this.diagnostics.get(uri) || [];
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Prepare rename (check if rename is valid)
|
|
358
|
+
*/
|
|
359
|
+
async prepareRename(filePath, line, character) {
|
|
360
|
+
const uri = await this.prepareDocument(filePath);
|
|
361
|
+
try {
|
|
362
|
+
const result = await this.request('textDocument/prepareRename', {
|
|
363
|
+
textDocument: { uri },
|
|
364
|
+
position: { line, character }
|
|
365
|
+
});
|
|
366
|
+
if (!result)
|
|
367
|
+
return null;
|
|
368
|
+
return 'range' in result ? result.range : result;
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Rename a symbol
|
|
376
|
+
*/
|
|
377
|
+
async rename(filePath, line, character, newName) {
|
|
378
|
+
const uri = await this.prepareDocument(filePath);
|
|
379
|
+
return this.request('textDocument/rename', {
|
|
380
|
+
textDocument: { uri },
|
|
381
|
+
position: { line, character },
|
|
382
|
+
newName
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Get code actions
|
|
387
|
+
*/
|
|
388
|
+
async codeActions(filePath, range, diagnostics = []) {
|
|
389
|
+
const uri = await this.prepareDocument(filePath);
|
|
390
|
+
return this.request('textDocument/codeAction', {
|
|
391
|
+
textDocument: { uri },
|
|
392
|
+
range,
|
|
393
|
+
context: { diagnostics }
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Client manager - maintains a pool of LSP clients per workspace/server
|
|
399
|
+
*/
|
|
400
|
+
class LspClientManager {
|
|
401
|
+
clients = new Map();
|
|
402
|
+
/**
|
|
403
|
+
* Get or create a client for a file
|
|
404
|
+
*/
|
|
405
|
+
async getClientForFile(filePath) {
|
|
406
|
+
const serverConfig = getServerForFile(filePath);
|
|
407
|
+
if (!serverConfig) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
// Find workspace root
|
|
411
|
+
const workspaceRoot = this.findWorkspaceRoot(filePath);
|
|
412
|
+
const key = `${workspaceRoot}:${serverConfig.command}`;
|
|
413
|
+
let client = this.clients.get(key);
|
|
414
|
+
if (!client) {
|
|
415
|
+
client = new LspClient(workspaceRoot, serverConfig);
|
|
416
|
+
try {
|
|
417
|
+
await client.connect();
|
|
418
|
+
this.clients.set(key, client);
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
throw error;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return client;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Find the workspace root for a file
|
|
428
|
+
*/
|
|
429
|
+
findWorkspaceRoot(filePath) {
|
|
430
|
+
let dir = dirname(resolve(filePath));
|
|
431
|
+
const markers = ['package.json', 'tsconfig.json', 'pyproject.toml', 'Cargo.toml', 'go.mod', '.git'];
|
|
432
|
+
while (dir !== '/') {
|
|
433
|
+
for (const marker of markers) {
|
|
434
|
+
if (existsSync(`${dir}/${marker}`)) {
|
|
435
|
+
return dir;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
dir = dirname(dir);
|
|
439
|
+
}
|
|
440
|
+
return dirname(resolve(filePath));
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Disconnect all clients
|
|
444
|
+
*/
|
|
445
|
+
async disconnectAll() {
|
|
446
|
+
for (const client of this.clients.values()) {
|
|
447
|
+
await client.disconnect();
|
|
448
|
+
}
|
|
449
|
+
this.clients.clear();
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
// Export a singleton instance
|
|
453
|
+
export const lspClientManager = new LspClientManager();
|
|
454
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/tools/lsp/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA4F/D;;GAEG;AACH,MAAM,OAAO,SAAS;IACZ,OAAO,GAAwB,IAAI,CAAC;IACpC,SAAS,GAAG,CAAC,CAAC;IACd,eAAe,GAAG,IAAI,GAAG,EAI7B,CAAC;IACG,MAAM,GAAG,EAAE,CAAC;IACZ,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC9C,aAAa,CAAS;IACtB,YAAY,CAAkB;IAC9B,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAY,aAAqB,EAAE,YAA6B;QAC9D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,oBAAoB;QAC9B,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CACb,oBAAoB,IAAI,CAAC,YAAY,CAAC,OAAO,gBAAgB;gB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