mincut-context 1.3.0 → 1.4.1
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/README.md +104 -50
- package/dist/adapters/cli/bin.js +5 -1
- package/dist/adapters/cli/bin.js.map +1 -1
- package/dist/adapters/mcp/index.js +1 -1
- package/dist/index/builder.d.ts +10 -0
- package/dist/index/builder.d.ts.map +1 -1
- package/dist/index/builder.js +37 -7
- package/dist/index/builder.js.map +1 -1
- package/dist/lsp/resolver.d.ts +24 -0
- package/dist/lsp/resolver.d.ts.map +1 -0
- package/dist/lsp/resolver.js +78 -0
- package/dist/lsp/resolver.js.map +1 -0
- package/dist/lsp/stdio-client.d.ts +31 -0
- package/dist/lsp/stdio-client.d.ts.map +1 -0
- package/dist/lsp/stdio-client.js +182 -0
- package/dist/lsp/stdio-client.js.map +1 -0
- package/dist/lsp/types.d.ts +35 -0
- package/dist/lsp/types.d.ts.map +1 -0
- package/dist/lsp/types.js +7 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/lsp/typescript.d.ts +16 -0
- package/dist/lsp/typescript.d.ts.map +1 -0
- package/dist/lsp/typescript.js +29 -0
- package/dist/lsp/typescript.js.map +1 -0
- package/dist/parsers/chunking.d.ts +34 -0
- package/dist/parsers/chunking.d.ts.map +1 -0
- package/dist/parsers/chunking.js +74 -0
- package/dist/parsers/chunking.js.map +1 -0
- package/dist/parsers/parser.d.ts +4 -0
- package/dist/parsers/parser.d.ts.map +1 -1
- package/dist/parsers/parser.js.map +1 -1
- package/dist/parsers/php.d.ts +2 -2
- package/dist/parsers/php.d.ts.map +1 -1
- package/dist/parsers/php.js +35 -3
- package/dist/parsers/php.js.map +1 -1
- package/dist/parsers/py.d.ts +2 -2
- package/dist/parsers/py.d.ts.map +1 -1
- package/dist/parsers/py.js +21 -4
- package/dist/parsers/py.js.map +1 -1
- package/dist/parsers/ts.d.ts.map +1 -1
- package/dist/parsers/ts.js +35 -84
- package/dist/parsers/ts.js.map +1 -1
- package/dist/select/pack.d.ts +12 -0
- package/dist/select/pack.d.ts.map +1 -1
- package/dist/select/pack.js +49 -2
- package/dist/select/pack.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
/**
|
|
4
|
+
* Use an LSP client to refine ambiguous call edges. For each call site,
|
|
5
|
+
* ask the language server "where is this symbol defined?". If the answer
|
|
6
|
+
* lands inside a known graph node, add (or upgrade) the edge.
|
|
7
|
+
*
|
|
8
|
+
* Existing edges are left alone; this is purely additive / refinement.
|
|
9
|
+
*/
|
|
10
|
+
export async function resolveCallsWithLsp(graph, callSites, lsp, repoRoot) {
|
|
11
|
+
let resolved = 0;
|
|
12
|
+
let added = 0;
|
|
13
|
+
for (const cs of callSites) {
|
|
14
|
+
if (!graph.hasNode(cs.from))
|
|
15
|
+
continue;
|
|
16
|
+
let result;
|
|
17
|
+
try {
|
|
18
|
+
result = await lsp.definition(cs.file, { line: cs.line - 1, character: cs.character });
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (result.locations.length === 0)
|
|
24
|
+
continue;
|
|
25
|
+
let mappedAny = false;
|
|
26
|
+
for (const loc of result.locations) {
|
|
27
|
+
const targetFile = lspUriToRelPath(loc.uri, repoRoot);
|
|
28
|
+
if (!targetFile)
|
|
29
|
+
continue;
|
|
30
|
+
const targetLine = loc.range.start.line + 1;
|
|
31
|
+
const targetId = findNodeAt(graph, targetFile, targetLine);
|
|
32
|
+
if (!targetId || targetId === cs.from)
|
|
33
|
+
continue;
|
|
34
|
+
mappedAny = true;
|
|
35
|
+
if (graph.hasEdge(cs.from, targetId))
|
|
36
|
+
continue;
|
|
37
|
+
graph.addEdge(cs.from, targetId, { weight: 1.5, kind: 'call' });
|
|
38
|
+
added += 1;
|
|
39
|
+
}
|
|
40
|
+
if (mappedAny)
|
|
41
|
+
resolved += 1;
|
|
42
|
+
}
|
|
43
|
+
return { resolved, added };
|
|
44
|
+
}
|
|
45
|
+
function lspUriToRelPath(uri, repoRoot) {
|
|
46
|
+
let abs;
|
|
47
|
+
try {
|
|
48
|
+
abs = uri.startsWith('file://') ? fileURLToPath(uri) : uri;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (!abs.startsWith(repoRoot))
|
|
54
|
+
return null;
|
|
55
|
+
const rel = path.relative(repoRoot, abs).split(path.sep).join('/');
|
|
56
|
+
if (rel.startsWith('..'))
|
|
57
|
+
return null;
|
|
58
|
+
return rel;
|
|
59
|
+
}
|
|
60
|
+
function findNodeAt(graph, file, line) {
|
|
61
|
+
// Prefer the smallest range containing the line (innermost symbol wins).
|
|
62
|
+
let best = null;
|
|
63
|
+
for (const id of graph.nodes()) {
|
|
64
|
+
if (!id.startsWith(`${file}:`))
|
|
65
|
+
continue;
|
|
66
|
+
const data = graph.getNode(id);
|
|
67
|
+
if (!data?.startLine || !data.endLine)
|
|
68
|
+
continue;
|
|
69
|
+
if (line < data.startLine || line > data.endLine)
|
|
70
|
+
continue;
|
|
71
|
+
const span = data.endLine - data.startLine;
|
|
72
|
+
if (!best || span < best.span) {
|
|
73
|
+
best = { id, span };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return best?.id ?? null;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/lsp/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAmBzC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAAkB,EAClB,SAAqB,EACrB,GAAc,EACd,QAAgB;IAEhB,IAA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,IAAI,CAAC,OAAO;YAAE,SAAS;QAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3C,IAAI,CAAC,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9B,IAAI,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,EAAE,EAAE,IAAI,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LspClient, LspDefinitionResult, LspPosition } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bare-metal JSON-RPC client speaking the LSP wire protocol (Content-Length
|
|
4
|
+
* framed messages) over stdio. Spawns the language-server binary, sends
|
|
5
|
+
* initialize, and exposes definition() for our resolver.
|
|
6
|
+
*
|
|
7
|
+
* Designed to be small, dep-free, and fully decoupled from any specific
|
|
8
|
+
* language server. The TypeScript adapter just wires the right command +
|
|
9
|
+
* languageId on top of this.
|
|
10
|
+
*/
|
|
11
|
+
export declare class StdioLspClient implements LspClient {
|
|
12
|
+
private readonly command;
|
|
13
|
+
private readonly args;
|
|
14
|
+
private child;
|
|
15
|
+
private buffer;
|
|
16
|
+
private nextId;
|
|
17
|
+
private pending;
|
|
18
|
+
private openFiles;
|
|
19
|
+
private rootPath;
|
|
20
|
+
constructor(command: string, args: string[]);
|
|
21
|
+
initialize(rootPath: string): Promise<void>;
|
|
22
|
+
didOpen(file: string, source: string, languageId: string): Promise<void>;
|
|
23
|
+
definition(file: string, position: LspPosition): Promise<LspDefinitionResult>;
|
|
24
|
+
shutdown(): Promise<void>;
|
|
25
|
+
private request;
|
|
26
|
+
private notify;
|
|
27
|
+
private send;
|
|
28
|
+
private onData;
|
|
29
|
+
private flushPendingAsErrors;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=stdio-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-client.d.ts","sourceRoot":"","sources":["../../src/lsp/stdio-client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAe,WAAW,EAAE,MAAM,YAAY,CAAC;AAsB3F;;;;;;;;GAQG;AACH,qBAAa,cAAe,YAAW,SAAS;IAQlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAAU,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPnE,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,OAAO,CAAoF;IACnG,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,QAAQ,CAAM;gBAEO,OAAO,EAAE,MAAM,EAAmB,IAAI,EAAE,MAAM,EAAE;IAEvE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C3C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAU7E,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB/B,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,MAAM;IA8Bd,OAAO,CAAC,oBAAoB;CAI7B"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Bare-metal JSON-RPC client speaking the LSP wire protocol (Content-Length
|
|
6
|
+
* framed messages) over stdio. Spawns the language-server binary, sends
|
|
7
|
+
* initialize, and exposes definition() for our resolver.
|
|
8
|
+
*
|
|
9
|
+
* Designed to be small, dep-free, and fully decoupled from any specific
|
|
10
|
+
* language server. The TypeScript adapter just wires the right command +
|
|
11
|
+
* languageId on top of this.
|
|
12
|
+
*/
|
|
13
|
+
export class StdioLspClient {
|
|
14
|
+
command;
|
|
15
|
+
args;
|
|
16
|
+
child = null;
|
|
17
|
+
buffer = Buffer.alloc(0);
|
|
18
|
+
nextId = 1;
|
|
19
|
+
pending = new Map();
|
|
20
|
+
openFiles = new Set();
|
|
21
|
+
rootPath = '';
|
|
22
|
+
constructor(command, args) {
|
|
23
|
+
this.command = command;
|
|
24
|
+
this.args = args;
|
|
25
|
+
}
|
|
26
|
+
async initialize(rootPath) {
|
|
27
|
+
this.rootPath = rootPath;
|
|
28
|
+
try {
|
|
29
|
+
this.child = spawn(this.command, this.args, { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
throw new Error(`lsp: could not spawn '${this.command}' (${e.message})`);
|
|
33
|
+
}
|
|
34
|
+
if (!this.child.stdout || !this.child.stdin)
|
|
35
|
+
throw new Error('lsp: no stdio on spawned process');
|
|
36
|
+
let spawnFailed = null;
|
|
37
|
+
let spawnReady = false;
|
|
38
|
+
this.child.on('error', (err) => {
|
|
39
|
+
spawnFailed = err;
|
|
40
|
+
this.flushPendingAsErrors(`lsp spawn error: ${err.message}`);
|
|
41
|
+
});
|
|
42
|
+
this.child.on('spawn', () => {
|
|
43
|
+
spawnReady = true;
|
|
44
|
+
});
|
|
45
|
+
this.child.stdout.on('data', (chunk) => this.onData(chunk));
|
|
46
|
+
this.child.on('exit', () => this.flushPendingAsErrors('lsp server exited'));
|
|
47
|
+
this.child.stderr?.on('data', () => {
|
|
48
|
+
/* swallow — many LSPs are chatty on stderr */
|
|
49
|
+
});
|
|
50
|
+
// Wait up to ~250ms for either 'spawn' or 'error' to settle. If neither
|
|
51
|
+
// fires we treat it as a startup failure rather than send to a possibly-
|
|
52
|
+
// doomed stdin.
|
|
53
|
+
const deadline = Date.now() + 250;
|
|
54
|
+
while (!spawnReady && !spawnFailed && Date.now() < deadline) {
|
|
55
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
56
|
+
}
|
|
57
|
+
if (spawnFailed || !spawnReady) {
|
|
58
|
+
throw new Error(`lsp: could not start '${this.command}' — install it or omit --lsp`);
|
|
59
|
+
}
|
|
60
|
+
await this.request('initialize', {
|
|
61
|
+
processId: process.pid,
|
|
62
|
+
rootUri: pathToFileURL(rootPath).toString(),
|
|
63
|
+
capabilities: { textDocument: { definition: { dynamicRegistration: false } } },
|
|
64
|
+
});
|
|
65
|
+
this.notify('initialized', {});
|
|
66
|
+
}
|
|
67
|
+
async didOpen(file, source, languageId) {
|
|
68
|
+
if (this.openFiles.has(file))
|
|
69
|
+
return;
|
|
70
|
+
this.openFiles.add(file);
|
|
71
|
+
const uri = pathToFileURL(path.resolve(this.rootPath, file)).toString();
|
|
72
|
+
this.notify('textDocument/didOpen', {
|
|
73
|
+
textDocument: { uri, languageId, version: 1, text: source },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async definition(file, position) {
|
|
77
|
+
const uri = pathToFileURL(path.resolve(this.rootPath, file)).toString();
|
|
78
|
+
const result = (await this.request('textDocument/definition', {
|
|
79
|
+
textDocument: { uri },
|
|
80
|
+
position,
|
|
81
|
+
}));
|
|
82
|
+
if (!result)
|
|
83
|
+
return { locations: [] };
|
|
84
|
+
return { locations: Array.isArray(result) ? result : [result] };
|
|
85
|
+
}
|
|
86
|
+
async shutdown() {
|
|
87
|
+
if (!this.child)
|
|
88
|
+
return;
|
|
89
|
+
const child = this.child;
|
|
90
|
+
this.child = null;
|
|
91
|
+
// If stdin is gone, the server is dead — skip the polite handshake.
|
|
92
|
+
if (child.stdin && !child.stdin.destroyed && !child.stdin.writableEnded) {
|
|
93
|
+
try {
|
|
94
|
+
await Promise.race([
|
|
95
|
+
this.request('shutdown', null),
|
|
96
|
+
new Promise((r) => setTimeout(r, 500)),
|
|
97
|
+
]);
|
|
98
|
+
this.notify('exit', null);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// ignore
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
child.kill('SIGTERM');
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// ignore
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
request(method, params) {
|
|
112
|
+
const id = this.nextId++;
|
|
113
|
+
const req = { jsonrpc: '2.0', id, method, params };
|
|
114
|
+
this.send(req);
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
this.pending.set(id, { resolve, reject });
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
if (this.pending.has(id)) {
|
|
119
|
+
this.pending.delete(id);
|
|
120
|
+
reject(new Error(`lsp: timeout on ${method}`));
|
|
121
|
+
}
|
|
122
|
+
}, 10000);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
notify(method, params) {
|
|
126
|
+
const n = { jsonrpc: '2.0', method, params };
|
|
127
|
+
this.send(n);
|
|
128
|
+
}
|
|
129
|
+
send(message) {
|
|
130
|
+
const stdin = this.child?.stdin;
|
|
131
|
+
if (!stdin || stdin.destroyed || stdin.writableEnded)
|
|
132
|
+
return;
|
|
133
|
+
const body = JSON.stringify(message);
|
|
134
|
+
const header = `Content-Length: ${Buffer.byteLength(body, 'utf8')}\r\n\r\n`;
|
|
135
|
+
try {
|
|
136
|
+
stdin.write(header + body);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
/* writes to a dead LSP — ignored */
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
onData(chunk) {
|
|
143
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
144
|
+
while (true) {
|
|
145
|
+
const headerEnd = this.buffer.indexOf('\r\n\r\n');
|
|
146
|
+
if (headerEnd < 0)
|
|
147
|
+
return;
|
|
148
|
+
const headerText = this.buffer.slice(0, headerEnd).toString('utf8');
|
|
149
|
+
const m = headerText.match(/Content-Length:\s*(\d+)/i);
|
|
150
|
+
if (!m) {
|
|
151
|
+
this.buffer = this.buffer.slice(headerEnd + 4);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const len = Number(m[1]);
|
|
155
|
+
const total = headerEnd + 4 + len;
|
|
156
|
+
if (this.buffer.length < total)
|
|
157
|
+
return;
|
|
158
|
+
const body = this.buffer.slice(headerEnd + 4, total).toString('utf8');
|
|
159
|
+
this.buffer = this.buffer.slice(total);
|
|
160
|
+
try {
|
|
161
|
+
const msg = JSON.parse(body);
|
|
162
|
+
if (typeof msg.id === 'number' && this.pending.has(msg.id)) {
|
|
163
|
+
const cb = this.pending.get(msg.id);
|
|
164
|
+
this.pending.delete(msg.id);
|
|
165
|
+
if (msg.error)
|
|
166
|
+
cb.reject(new Error(msg.error.message));
|
|
167
|
+
else
|
|
168
|
+
cb.resolve(msg.result);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// ignore non-JSON server output
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
flushPendingAsErrors(reason) {
|
|
177
|
+
for (const [, cb] of this.pending)
|
|
178
|
+
cb.reject(new Error(reason));
|
|
179
|
+
this.pending.clear();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=stdio-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio-client.js","sourceRoot":"","sources":["../../src/lsp/stdio-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAuB7B;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IAQI;IAAkC;IA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AgC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,MAAc;QACzC,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO;YAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal LSP types we use. Faithful subset of the LSP spec
|
|
3
|
+
* (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/),
|
|
4
|
+
* just the bits the resolver needs.
|
|
5
|
+
*/
|
|
6
|
+
export interface LspPosition {
|
|
7
|
+
line: number;
|
|
8
|
+
character: number;
|
|
9
|
+
}
|
|
10
|
+
export interface LspRange {
|
|
11
|
+
start: LspPosition;
|
|
12
|
+
end: LspPosition;
|
|
13
|
+
}
|
|
14
|
+
export interface LspLocation {
|
|
15
|
+
uri: string;
|
|
16
|
+
range: LspRange;
|
|
17
|
+
}
|
|
18
|
+
export interface LspDefinitionResult {
|
|
19
|
+
/** Either a single Location or an array of Locations. */
|
|
20
|
+
locations: LspLocation[];
|
|
21
|
+
}
|
|
22
|
+
export interface LspClient {
|
|
23
|
+
/** Initialize the LSP server with the given root path. */
|
|
24
|
+
initialize(rootPath: string): Promise<void>;
|
|
25
|
+
/** Tell the server the file is open (some servers require this before definition queries). */
|
|
26
|
+
didOpen(file: string, source: string, languageId: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Ask the server "where is the symbol at this position defined?"
|
|
29
|
+
* Returns 0+ locations.
|
|
30
|
+
*/
|
|
31
|
+
definition(file: string, position: LspPosition): Promise<LspDefinitionResult>;
|
|
32
|
+
/** Gracefully shut down. */
|
|
33
|
+
shutdown(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lsp/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,WAAW,CAAC;IACnB,GAAG,EAAE,WAAW,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACxB,0DAA0D;IAC1D,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,8FAA8F;IAC9F,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC9E,4BAA4B;IAC5B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lsp/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LspClient } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Spawn typescript-language-server for the given repo.
|
|
4
|
+
*
|
|
5
|
+
* Requires the binary to be installed (peerOptional dep — we don't bundle).
|
|
6
|
+
* npm install -g typescript-language-server
|
|
7
|
+
* or per-project: npm install --save-dev typescript-language-server
|
|
8
|
+
*
|
|
9
|
+
* If the binary is missing, `initialize()` will throw with a helpful message
|
|
10
|
+
* and the caller should fall back to syntactic resolution.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createTypeScriptLsp(opts?: {
|
|
13
|
+
command?: string;
|
|
14
|
+
}): LspClient;
|
|
15
|
+
export declare function tsLanguageIdFor(file: string): string;
|
|
16
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/lsp/typescript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,SAAS,CAG9E;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StdioLspClient } from './stdio-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Spawn typescript-language-server for the given repo.
|
|
4
|
+
*
|
|
5
|
+
* Requires the binary to be installed (peerOptional dep — we don't bundle).
|
|
6
|
+
* npm install -g typescript-language-server
|
|
7
|
+
* or per-project: npm install --save-dev typescript-language-server
|
|
8
|
+
*
|
|
9
|
+
* If the binary is missing, `initialize()` will throw with a helpful message
|
|
10
|
+
* and the caller should fall back to syntactic resolution.
|
|
11
|
+
*/
|
|
12
|
+
export function createTypeScriptLsp(opts = {}) {
|
|
13
|
+
const command = opts.command ?? 'typescript-language-server';
|
|
14
|
+
return new StdioLspClient(command, ['--stdio']);
|
|
15
|
+
}
|
|
16
|
+
export function tsLanguageIdFor(file) {
|
|
17
|
+
if (file.endsWith('.tsx'))
|
|
18
|
+
return 'typescriptreact';
|
|
19
|
+
if (file.endsWith('.jsx'))
|
|
20
|
+
return 'javascriptreact';
|
|
21
|
+
if (file.endsWith('.ts'))
|
|
22
|
+
return 'typescript';
|
|
23
|
+
if (file.endsWith('.js'))
|
|
24
|
+
return 'javascript';
|
|
25
|
+
if (file.endsWith('.mjs') || file.endsWith('.cjs'))
|
|
26
|
+
return 'javascript';
|
|
27
|
+
return 'plaintext';
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/lsp/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B,EAAE;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,4BAA4B,CAAC;IAC7D,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,iBAAiB,CAAC;IACpD,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,iBAAiB,CAAC;IACpD,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAC9C,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAC9C,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,YAAY,CAAC;IACxE,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type Parser from 'tree-sitter';
|
|
2
|
+
import { type ChunkOptions, type ParsedSymbol, type NodeKind } from './parser.js';
|
|
3
|
+
/**
|
|
4
|
+
* Language-agnostic chunking helper.
|
|
5
|
+
*
|
|
6
|
+
* Each parser's visit-function calls this whenever it enters a function-like
|
|
7
|
+
* node. We split the body's top-level statements (whatever `bodyNode`'s
|
|
8
|
+
* named children are) into chunks whose token sum is roughly maxTokens.
|
|
9
|
+
*
|
|
10
|
+
* Returns `null` if the function should NOT be chunked (small enough, or
|
|
11
|
+
* chunking disabled). Returns the emitted chunk symbols if it WAS chunked,
|
|
12
|
+
* along with a `visitStmt` callback the caller invokes per statement so that
|
|
13
|
+
* call edges attribute to the correct chunk id.
|
|
14
|
+
*/
|
|
15
|
+
export interface ChunkResult {
|
|
16
|
+
symbols: ParsedSymbol[];
|
|
17
|
+
/** Per-statement walker for the caller — must be invoked in order. */
|
|
18
|
+
walkStatements: (visitStmt: (stmt: Parser.SyntaxNode) => void) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function tryChunkBody(args: {
|
|
21
|
+
file: string;
|
|
22
|
+
source: string;
|
|
23
|
+
qualifiedName: string;
|
|
24
|
+
bareName: string;
|
|
25
|
+
kind: NodeKind;
|
|
26
|
+
body: Parser.SyntaxNode | null;
|
|
27
|
+
chunkOptions?: ChunkOptions;
|
|
28
|
+
/**
|
|
29
|
+
* Push/pop caller stack around each chunk walk so the body's calls
|
|
30
|
+
* attribute to the chunk id instead of the parent.
|
|
31
|
+
*/
|
|
32
|
+
callerStack: string[];
|
|
33
|
+
}): ChunkResult | null;
|
|
34
|
+
//# sourceMappingURL=chunking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunking.d.ts","sourceRoot":"","sources":["../../src/parsers/chunking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAgB,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEhG;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,sEAAsE;IACtE,cAAc,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,KAAK,IAAI,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE;IACJ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,GACA,WAAW,GAAG,IAAI,CA+EpB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { approxTokens } from './parser.js';
|
|
2
|
+
export function tryChunkBody(args) {
|
|
3
|
+
const { file, source, qualifiedName, body, chunkOptions, callerStack, kind } = args;
|
|
4
|
+
if (!chunkOptions?.enabled || !body)
|
|
5
|
+
return null;
|
|
6
|
+
const bodyText = source.slice(body.startIndex, body.endIndex);
|
|
7
|
+
if (approxTokens(bodyText) <= chunkOptions.maxTokens)
|
|
8
|
+
return null;
|
|
9
|
+
const statements = [];
|
|
10
|
+
for (let i = 0; i < body.namedChildCount; i++) {
|
|
11
|
+
const c = body.namedChild(i);
|
|
12
|
+
if (c)
|
|
13
|
+
statements.push(c);
|
|
14
|
+
}
|
|
15
|
+
if (statements.length < 2)
|
|
16
|
+
return null;
|
|
17
|
+
const stmtTokens = statements.map((s) => approxTokens(source.slice(s.startIndex, s.endIndex)));
|
|
18
|
+
const stmtsTotal = stmtTokens.reduce((a, b) => a + b, 0);
|
|
19
|
+
// Use the larger of (maxTokens) and (stmtsTotal / 2) so we always split at
|
|
20
|
+
// least once when the body is over threshold.
|
|
21
|
+
const target = Math.max(chunkOptions.maxTokens, Math.ceil(stmtsTotal / 2));
|
|
22
|
+
const groups = [];
|
|
23
|
+
let current = [];
|
|
24
|
+
let currentTokens = 0;
|
|
25
|
+
for (let i = 0; i < statements.length; i++) {
|
|
26
|
+
const stmt = statements[i];
|
|
27
|
+
if (currentTokens + stmtTokens[i] > target && current.length > 0) {
|
|
28
|
+
groups.push({ start: current[0], end: current[current.length - 1], members: current });
|
|
29
|
+
current = [];
|
|
30
|
+
currentTokens = 0;
|
|
31
|
+
}
|
|
32
|
+
current.push(stmt);
|
|
33
|
+
currentTokens += stmtTokens[i];
|
|
34
|
+
}
|
|
35
|
+
if (current.length > 0) {
|
|
36
|
+
groups.push({ start: current[0], end: current[current.length - 1], members: current });
|
|
37
|
+
}
|
|
38
|
+
if (groups.length < 2) {
|
|
39
|
+
// Body exceeded threshold but greedy packing put everything in one group.
|
|
40
|
+
// Fall back to a midpoint split so the user still gets >=2 chunks.
|
|
41
|
+
const mid = Math.ceil(statements.length / 2);
|
|
42
|
+
const a = statements.slice(0, mid);
|
|
43
|
+
const b = statements.slice(mid);
|
|
44
|
+
if (a.length === 0 || b.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
groups.length = 0;
|
|
47
|
+
groups.push({ start: a[0], end: a[a.length - 1], members: a });
|
|
48
|
+
groups.push({ start: b[0], end: b[b.length - 1], members: b });
|
|
49
|
+
}
|
|
50
|
+
const symbols = groups.map((g, index) => {
|
|
51
|
+
const text = source.slice(g.start.startIndex, g.end.endIndex);
|
|
52
|
+
const baseLeaf = qualifiedName.split('.').pop() ?? qualifiedName;
|
|
53
|
+
return {
|
|
54
|
+
id: `${file}:${qualifiedName}#${index}`,
|
|
55
|
+
name: `${baseLeaf}#${index}`,
|
|
56
|
+
file,
|
|
57
|
+
kind,
|
|
58
|
+
startLine: g.start.startPosition.row + 1,
|
|
59
|
+
endLine: g.end.endPosition.row + 1,
|
|
60
|
+
tokens: approxTokens(text),
|
|
61
|
+
chunk: { parent: qualifiedName, index },
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
const walkStatements = (visitStmt) => {
|
|
65
|
+
groups.forEach((g, index) => {
|
|
66
|
+
callerStack.push(symbols[index].id);
|
|
67
|
+
for (const member of g.members)
|
|
68
|
+
visitStmt(member);
|
|
69
|
+
callerStack.pop();
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return { symbols, walkStatements };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=chunking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunking.js","sourceRoot":"","sources":["../../src/parsers/chunking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAuD,MAAM,aAAa,CAAC;AAoBhG,MAAM,UAAU,YAAY,CAC1B,IAaC;IAED,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACpF,IAAI,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEjD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9D,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,YAAY,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAElE,MAAM,UAAU,GAAwB,EAAE,CAAC;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC;YAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,I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C,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,aAAa,CAAC;QACjE,OAAO;YACL,EAAE,EAAE,GAAG,IAAI,IAAI,aAAa,IAAI,KAAK,EAAE;YACvC,IAAI,EAAE,GAAG,QAAQ,IAAI,KAAK,EAAE;YAC5B,IAAI;YACJ,IAAI;YACJ,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC;YACxC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;YAClC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC;YAC1B,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,CAAC,SAA4C,EAAQ,EAAE;QAC5E,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YAC1B,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YACpC,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC,OAAO;gBAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YAClD,WAAW,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;AACrC,CAAC"}
|
package/dist/parsers/parser.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NodeKind } from '../core/graph.js';
|
|
2
|
+
export type { NodeKind } from '../core/graph.js';
|
|
2
3
|
export interface ParsedSymbol {
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
@@ -26,6 +27,9 @@ export interface ParsedImport {
|
|
|
26
27
|
export interface ParsedCall {
|
|
27
28
|
from: string;
|
|
28
29
|
toName: string;
|
|
30
|
+
/** Optional source position of the callee identifier (1-based line, 0-based col). */
|
|
31
|
+
line?: number;
|
|
32
|
+
character?: number;
|
|
29
33
|
}
|
|
30
34
|
export interface ParseResult {
|
|
31
35
|
symbols: ParsedSymbol[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parsers/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parsers/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAA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":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/parsers/parser.ts"],"names":[],"mappings":"AA+CA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/parsers/php.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type ParseResult } from './parser.js';
|
|
2
|
-
export declare function parsePhp(file: string, source: string): ParseResult;
|
|
1
|
+
import { type ChunkOptions, type ParseResult } from './parser.js';
|
|
2
|
+
export declare function parsePhp(file: string, source: string, chunkOptions?: ChunkOptions): ParseResult;
|
|
3
3
|
//# sourceMappingURL=php.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/parsers/php.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/parsers/php.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EAGjB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AASrB,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,YAAY,GAC1B,WAAW,CAoBb"}
|