@wrongstack/tools 1.0.11 → 1.0.12
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/dist/builtin.js +15 -15
- package/dist/{chunk-GU7TZE6Z.js → chunk-2BCRQAIW.js} +7 -7
- package/dist/{chunk-XRNN44QY.js → chunk-2IRHFHZY.js} +235 -71
- package/dist/{chunk-NEYUPZL6.js → chunk-6D3UIQMF.js} +651 -303
- package/dist/chunk-BJ5LXLKE.js +351 -0
- package/dist/{chunk-C6ZOXNXV.js → chunk-CSS42GRP.js} +2 -2
- package/dist/{chunk-SKRMUHTU.js → chunk-HSLDY55L.js} +41 -8
- package/dist/{chunk-ENE22I5W.js → chunk-K37AKCTN.js} +884 -362
- package/dist/{chunk-DKXMDO5F.js → chunk-K3VX6V5P.js} +3 -3
- package/dist/chunk-OIFY4XNP.js +855 -0
- package/dist/{chunk-7GOE2ZTZ.js → chunk-OMWC2OGT.js} +2 -2
- package/dist/{chunk-IE4KDAOB.js → chunk-OYQE2UNT.js} +3 -3
- package/dist/chunk-R3HR3QI3.js +97 -0
- package/dist/{chunk-XPVYZ2S6.js → chunk-RYLMSGR5.js} +2 -2
- package/dist/{chunk-HYHE4VNA.js → chunk-UMOP3VGK.js} +79 -45
- package/dist/{chunk-6OIEYJM4.js → chunk-VMNWQI4V.js} +2 -2
- package/dist/{chunk-2UVAIS5O.js → chunk-YPSVPCIE.js} +2 -2
- package/dist/{chunk-PWZUHZP7.js → chunk-Z77XMU3U.js} +2 -2
- package/dist/codebase-index/ast-invariant-engine.d.ts +19 -2
- package/dist/codebase-index/atlas-projection.d.ts +19 -0
- package/dist/codebase-index/background-indexer.d.ts +14 -0
- package/dist/codebase-index/circuit-breaker.d.ts +7 -0
- package/dist/codebase-index/codebase-ast-replace-tool.d.ts +1 -1
- package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +6 -0
- package/dist/codebase-index/codebase-invariant-check-tool.d.ts +2 -0
- package/dist/codebase-index/codebase-targeted-test-tool.d.ts +26 -0
- package/dist/codebase-index/dead-code-scan.d.ts +4 -0
- package/dist/codebase-index/go-parser.d.ts +23 -3
- package/dist/codebase-index/graph-rank-pass.d.ts +10 -0
- package/dist/codebase-index/graph-rank.d.ts +8 -0
- package/dist/codebase-index/index.d.ts +1 -1
- package/dist/codebase-index/index.js +9 -9
- package/dist/codebase-index/lsp-kind.d.ts +3 -1
- package/dist/codebase-index/module-resolver.d.ts +21 -1
- package/dist/codebase-index/parser-batch.d.ts +6 -8
- package/dist/codebase-index/parser-output.d.ts +5 -1
- package/dist/codebase-index/parser-worker-script.js +4 -4
- package/dist/codebase-index/project-server-framing.d.ts +1 -17
- package/dist/codebase-index/project-server-watcher.d.ts +6 -0
- package/dist/codebase-index/project-server.js +72 -26
- package/dist/codebase-index/py-parser.d.ts +4 -4
- package/dist/codebase-index/rs-parser.d.ts +7 -0
- package/dist/codebase-index/toolchain-scripts.d.ts +64 -0
- package/dist/codebase-index/tree-sitter/queries.d.ts +14 -0
- package/dist/codebase-index/tree-sitter/util.d.ts +6 -1
- package/dist/codebase-index/tree-sitter-parser.d.ts +7 -0
- package/dist/codebase-index/worker.js +23 -16
- package/dist/codebase-index/writer-refs.d.ts +17 -2
- package/dist/codebase-index/writer-search-helpers.d.ts +9 -0
- package/dist/codebase-index/writer.d.ts +20 -1
- package/dist/edit.js +8 -8
- package/dist/{generic-parser-N2PLGBC2.js → generic-parser-IVWLFKMR.js} +2 -2
- package/dist/go-parser-LWV3L5V7.js +197 -0
- package/dist/index.js +17 -17
- package/dist/json-parser-PERV2JHX.js +204 -0
- package/dist/pack.js +16 -16
- package/dist/parser-dispatch-ZSWCQB6M.js +14 -0
- package/dist/patch.js +8 -8
- package/dist/{py-parser-4PFZYAJ7.js → py-parser-B6D6RGH7.js} +4 -4
- package/dist/read.js +8 -8
- package/dist/replace.js +8 -8
- package/dist/rs-parser-L7SP4GWJ.js +182 -0
- package/dist/tool-tier.js +17 -17
- package/dist/{tree-sitter-parser-GILYQLS4.js → tree-sitter-parser-KU6JF3ZC.js} +6 -4
- package/dist/{ts-parser-7W26YB26.js → ts-parser-PML6QIH7.js} +55 -23
- package/dist/write.js +8 -8
- package/dist/{yaml-parser-DFBC5FWH.js → yaml-parser-7BJN544B.js} +41 -6
- package/package.json +5 -5
- package/dist/chunk-4CE3RKEP.js +0 -390
- package/dist/chunk-KHUCKLOR.js +0 -899
- package/dist/chunk-ZKC5UNGD.js +0 -167
- package/dist/go-parser-Z4H6SR3R.js +0 -474
- package/dist/json-parser-IJD77VL4.js +0 -256
- package/dist/parser-dispatch-WG4DNBHH.js +0 -14
- package/dist/rs-parser-GIWPUA3T.js +0 -81
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-MSOAX3GC.js";
|
|
4
4
|
import {
|
|
5
5
|
enqueueReindex
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UMOP3VGK.js";
|
|
7
7
|
import {
|
|
8
8
|
safeResolveReal,
|
|
9
9
|
sha256hex,
|
|
@@ -518,4 +518,4 @@ Compare this against your old_string and retry with the file's actual text.` : "
|
|
|
518
518
|
export {
|
|
519
519
|
editTool
|
|
520
520
|
};
|
|
521
|
-
//# sourceMappingURL=chunk-
|
|
521
|
+
//# sourceMappingURL=chunk-OMWC2OGT.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getIndexState,
|
|
3
3
|
searchCodebaseIndex
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UMOP3VGK.js";
|
|
5
5
|
import {
|
|
6
6
|
codebaseIndexDirOverride
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6D3UIQMF.js";
|
|
8
8
|
import {
|
|
9
9
|
isBinaryBuffer,
|
|
10
10
|
safeResolveReal,
|
|
@@ -340,4 +340,4 @@ ${interesting.join("\n")}` : "symbols/imports: (none detected)"
|
|
|
340
340
|
export {
|
|
341
341
|
readTool
|
|
342
342
|
};
|
|
343
|
-
//# sourceMappingURL=chunk-
|
|
343
|
+
//# sourceMappingURL=chunk-OYQE2UNT.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseGeneric
|
|
3
|
+
} from "./chunk-HSLDY55L.js";
|
|
4
|
+
import {
|
|
5
|
+
PY_PARSE_SCRIPT,
|
|
6
|
+
parseParserOutput,
|
|
7
|
+
privateScriptPath,
|
|
8
|
+
pySpawnOptions,
|
|
9
|
+
runToolchainChild,
|
|
10
|
+
toIndexSymbols,
|
|
11
|
+
withSpawnGate
|
|
12
|
+
} from "./chunk-OIFY4XNP.js";
|
|
13
|
+
import {
|
|
14
|
+
resolveWin32Command
|
|
15
|
+
} from "./chunk-XZLVJD56.js";
|
|
16
|
+
|
|
17
|
+
// src/codebase-index/py-parser.ts
|
|
18
|
+
import { spawn } from "node:child_process";
|
|
19
|
+
async function parseSymbols(opts) {
|
|
20
|
+
const { file, content, lang } = opts;
|
|
21
|
+
try {
|
|
22
|
+
const native = await withSpawnGate(() => syncPyParse(file, content, lang));
|
|
23
|
+
if (native !== null) return native;
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
return parseGeneric({ file, content, lang: lang === "py" ? "py" : lang });
|
|
27
|
+
}
|
|
28
|
+
async function resolvePython() {
|
|
29
|
+
const candidates = process.platform === "win32" ? ["python3", "python", "py"] : ["python3", "python"];
|
|
30
|
+
for (const name of candidates) {
|
|
31
|
+
const resolved = resolveWin32Command(name);
|
|
32
|
+
if (!await commandIsAvailable(resolved)) continue;
|
|
33
|
+
return resolved;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function commandIsAvailable(command) {
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
let settled = false;
|
|
40
|
+
const proc = spawn(command, ["--version"], {
|
|
41
|
+
stdio: "ignore",
|
|
42
|
+
windowsHide: true
|
|
43
|
+
});
|
|
44
|
+
const finish = (available) => {
|
|
45
|
+
if (settled) return;
|
|
46
|
+
settled = true;
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
resolve(available);
|
|
49
|
+
};
|
|
50
|
+
const timer = setTimeout(() => {
|
|
51
|
+
proc.kill("SIGKILL");
|
|
52
|
+
finish(false);
|
|
53
|
+
}, 5e3);
|
|
54
|
+
timer.unref?.();
|
|
55
|
+
proc.once("error", () => finish(false));
|
|
56
|
+
proc.once("close", (code) => finish(code === 0));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
var cachedPyBinary;
|
|
60
|
+
function resolvePythonBinary() {
|
|
61
|
+
cachedPyBinary ??= resolvePython();
|
|
62
|
+
return cachedPyBinary;
|
|
63
|
+
}
|
|
64
|
+
async function syncPyParse(filePath, content, lang) {
|
|
65
|
+
try {
|
|
66
|
+
const scriptPath = await privateScriptPath("ws-py-parse-", "parse.py", PY_PARSE_SCRIPT);
|
|
67
|
+
const pyBinary = await resolvePythonBinary();
|
|
68
|
+
if (!pyBinary) return null;
|
|
69
|
+
const result = await runToolchainChild(
|
|
70
|
+
pyBinary,
|
|
71
|
+
[scriptPath, filePath],
|
|
72
|
+
content,
|
|
73
|
+
15e3,
|
|
74
|
+
pySpawnOptions(scriptPath)
|
|
75
|
+
);
|
|
76
|
+
if (!result) return null;
|
|
77
|
+
if (result.code !== 0 || !result.stdout.trim()) {
|
|
78
|
+
return { file: filePath, lang, symbols: [], mtimeMs: Date.now() };
|
|
79
|
+
}
|
|
80
|
+
const { symbols, refs } = parseParserOutput(result.stdout, lang);
|
|
81
|
+
return {
|
|
82
|
+
file: filePath,
|
|
83
|
+
lang,
|
|
84
|
+
symbols: toIndexSymbols(symbols, filePath, lang),
|
|
85
|
+
refs,
|
|
86
|
+
mtimeMs: Date.now()
|
|
87
|
+
};
|
|
88
|
+
} catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
parseSymbols,
|
|
95
|
+
resolvePythonBinary
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=chunk-R3HR3QI3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveIndexDir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6D3UIQMF.js";
|
|
4
4
|
|
|
5
5
|
// src/codebase-index/project-server-endpoint.ts
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
@@ -158,4 +158,4 @@ export {
|
|
|
158
158
|
PROJECT_INDEX_SERVER_MAX_FRAME_CHARS,
|
|
159
159
|
encodeProjectServerMessage
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-RYLMSGR5.js.map
|
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
projectIndexServerMetadataPath,
|
|
14
14
|
projectIndexServerStderrPath,
|
|
15
15
|
readProjectIndexServerStderrTail
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RYLMSGR5.js";
|
|
17
17
|
import {
|
|
18
18
|
CircuitOpenError,
|
|
19
19
|
IndexTimeoutError,
|
|
20
20
|
LockError,
|
|
21
|
+
contextService,
|
|
21
22
|
fileGraphService,
|
|
22
23
|
incomingCallsService,
|
|
23
24
|
indexCircuitBreaker,
|
|
@@ -27,11 +28,12 @@ import {
|
|
|
27
28
|
packageGraphService,
|
|
28
29
|
searchService,
|
|
29
30
|
statsService,
|
|
30
|
-
symbolGraphService
|
|
31
|
-
|
|
31
|
+
symbolGraphService,
|
|
32
|
+
vectorSearchService
|
|
33
|
+
} from "./chunk-6D3UIQMF.js";
|
|
32
34
|
import {
|
|
33
35
|
recordIpcPending
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-OIFY4XNP.js";
|
|
35
37
|
import {
|
|
36
38
|
isIndexablePath
|
|
37
39
|
} from "./chunk-YOHO4DVT.js";
|
|
@@ -511,14 +513,18 @@ var ProjectServerConnection = class {
|
|
|
511
513
|
if (this.readBuffer.length < 5 + frameLen) return;
|
|
512
514
|
const payload = this.readBuffer.subarray(5, 5 + frameLen);
|
|
513
515
|
this.readBuffer = this.readBuffer.subarray(5 + frameLen);
|
|
514
|
-
let
|
|
516
|
+
let decoded;
|
|
515
517
|
try {
|
|
516
|
-
|
|
518
|
+
decoded = decodeBinaryFrame(payload);
|
|
517
519
|
} catch {
|
|
518
520
|
socket.destroy(new Error("invalid binary codebase-index server response"));
|
|
519
521
|
return;
|
|
520
522
|
}
|
|
521
|
-
|
|
523
|
+
if (!isServerMessage(decoded)) {
|
|
524
|
+
socket.destroy(new Error("invalid binary codebase-index server response"));
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
this.onMessage(decoded);
|
|
522
528
|
continue;
|
|
523
529
|
}
|
|
524
530
|
const newline = this.readBuffer.indexOf(10);
|
|
@@ -535,14 +541,18 @@ var ProjectServerConnection = class {
|
|
|
535
541
|
const line = this.readBuffer.subarray(0, newline).toString("utf8");
|
|
536
542
|
this.readBuffer = this.readBuffer.subarray(newline + 1);
|
|
537
543
|
if (!line) continue;
|
|
538
|
-
let
|
|
544
|
+
let parsed;
|
|
539
545
|
try {
|
|
540
|
-
|
|
546
|
+
parsed = JSON.parse(line);
|
|
541
547
|
} catch {
|
|
542
548
|
socket.destroy(new Error("invalid codebase-index server response"));
|
|
543
549
|
return;
|
|
544
550
|
}
|
|
545
|
-
|
|
551
|
+
if (!isServerMessage(parsed)) {
|
|
552
|
+
socket.destroy(new Error("invalid codebase-index server response"));
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
this.onMessage(parsed);
|
|
546
556
|
}
|
|
547
557
|
}
|
|
548
558
|
onMessage(message) {
|
|
@@ -722,6 +732,9 @@ var ProjectServerConnection = class {
|
|
|
722
732
|
var connections = /* @__PURE__ */ new Map();
|
|
723
733
|
var MAX_CACHED_CONNECTIONS = 8;
|
|
724
734
|
var heartbeatTimer;
|
|
735
|
+
function isServerMessage(value) {
|
|
736
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && typeof value.type === "string";
|
|
737
|
+
}
|
|
725
738
|
function binaryFramingEnabled() {
|
|
726
739
|
const flag = process.env["WRONGSTACK_INDEX_BINARY"];
|
|
727
740
|
return flag === "1" || flag === "true";
|
|
@@ -826,6 +839,12 @@ var _indexing = false;
|
|
|
826
839
|
var _currentFile = 0;
|
|
827
840
|
var _totalFiles = 0;
|
|
828
841
|
var _lastError = null;
|
|
842
|
+
var _lastErrorAt = 0;
|
|
843
|
+
function resolveLastError(remote, local, localAt) {
|
|
844
|
+
if (!remote) return local;
|
|
845
|
+
if (local !== null && localAt > (remote.updatedAt ?? 0)) return local;
|
|
846
|
+
return remote.lastError;
|
|
847
|
+
}
|
|
829
848
|
function isIndexReady() {
|
|
830
849
|
return _ready;
|
|
831
850
|
}
|
|
@@ -841,7 +860,7 @@ function getIndexState() {
|
|
|
841
860
|
indexing: _indexing || remoteIndexing,
|
|
842
861
|
currentFile: remoteIndexing ? remoteActivity?.currentFile ?? 0 : _currentFile,
|
|
843
862
|
totalFiles: remoteIndexing ? remoteActivity?.totalFiles ?? 0 : _totalFiles,
|
|
844
|
-
lastError: remoteActivity
|
|
863
|
+
lastError: resolveLastError(remoteActivity, _lastError, _lastErrorAt),
|
|
845
864
|
server,
|
|
846
865
|
circuit: indexCircuitBreaker.snapshot()
|
|
847
866
|
};
|
|
@@ -1051,6 +1070,14 @@ async function callInline(op, args, opts) {
|
|
|
1051
1070
|
});
|
|
1052
1071
|
case "search":
|
|
1053
1072
|
return searchService(args);
|
|
1073
|
+
// `context` and `vectorSearch` were served by the worker and the project
|
|
1074
|
+
// server but missing here, so inline mode (WRONGSTACK_INDEX_INLINE=1, or
|
|
1075
|
+
// no worker build) failed every codebase-context call with
|
|
1076
|
+
// "unknown index op".
|
|
1077
|
+
case "context":
|
|
1078
|
+
return contextService(args);
|
|
1079
|
+
case "vectorSearch":
|
|
1080
|
+
return vectorSearchService(args);
|
|
1054
1081
|
case "stats":
|
|
1055
1082
|
return statsService(args);
|
|
1056
1083
|
case "packageGraph":
|
|
@@ -1183,51 +1210,58 @@ async function runStartupIndex(opts) {
|
|
|
1183
1210
|
_indexing = true;
|
|
1184
1211
|
emitState();
|
|
1185
1212
|
try {
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
timeoutMs: opts.timeoutMs ?? DEFAULT_FULL_INDEX_TIMEOUT_MS,
|
|
1200
|
-
signal: opts.signal,
|
|
1201
|
-
onProgress: setIndexProgress
|
|
1202
|
-
}
|
|
1203
|
-
);
|
|
1204
|
-
});
|
|
1213
|
+
let result;
|
|
1214
|
+
try {
|
|
1215
|
+
result = await runIndexPass(opts);
|
|
1216
|
+
} catch (err) {
|
|
1217
|
+
if (!isRecoverableConstraintError(err) || opts.force || opts.signal?.aborted) throw err;
|
|
1218
|
+
const failure = err instanceof Error ? err.message : String(err);
|
|
1219
|
+
result = {
|
|
1220
|
+
...await runIndexPass({ ...opts, force: true }),
|
|
1221
|
+
// Tag the result so callers can distinguish a normal run from a
|
|
1222
|
+
// corruption-triggered recovery.
|
|
1223
|
+
autoRecovered: { failure, rebuiltWithForce: true }
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1205
1226
|
_ready = true;
|
|
1206
1227
|
indexCircuitBreaker.recordSuccess();
|
|
1207
1228
|
return result;
|
|
1208
1229
|
} catch (err) {
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
_lastError = null;
|
|
1213
|
-
const rebuildResult = await runStartupIndex({
|
|
1214
|
-
...opts,
|
|
1215
|
-
force: true
|
|
1216
|
-
});
|
|
1217
|
-
_ready = true;
|
|
1218
|
-
return {
|
|
1219
|
-
...rebuildResult,
|
|
1220
|
-
autoRecovered: { failure: originalError, rebuiltWithForce: true }
|
|
1221
|
-
};
|
|
1230
|
+
if (!opts.signal?.aborted) {
|
|
1231
|
+
_lastError = err instanceof Error ? err.message : String(err);
|
|
1232
|
+
_lastErrorAt = Date.now();
|
|
1222
1233
|
}
|
|
1223
1234
|
_ready = true;
|
|
1224
|
-
if (
|
|
1235
|
+
if (opts.signal?.aborted) indexCircuitBreaker.abandonProbe();
|
|
1236
|
+
else indexCircuitBreaker.recordFailure(err);
|
|
1225
1237
|
throw err;
|
|
1226
1238
|
} finally {
|
|
1227
1239
|
_indexing = false;
|
|
1228
1240
|
emitState();
|
|
1229
1241
|
}
|
|
1230
1242
|
}
|
|
1243
|
+
function runIndexPass(opts) {
|
|
1244
|
+
return withMutex(() => {
|
|
1245
|
+
_currentFile = 0;
|
|
1246
|
+
_totalFiles = 0;
|
|
1247
|
+
_lastError = null;
|
|
1248
|
+
_lastErrorAt = 0;
|
|
1249
|
+
return callIndexOp(
|
|
1250
|
+
"index",
|
|
1251
|
+
{
|
|
1252
|
+
projectRoot: opts.projectRoot,
|
|
1253
|
+
indexDir: opts.indexDir,
|
|
1254
|
+
force: opts.force,
|
|
1255
|
+
langs: opts.langs
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
timeoutMs: opts.timeoutMs ?? DEFAULT_FULL_INDEX_TIMEOUT_MS,
|
|
1259
|
+
signal: opts.signal,
|
|
1260
|
+
onProgress: setIndexProgress
|
|
1261
|
+
}
|
|
1262
|
+
);
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1231
1265
|
function enqueueReindex(opts) {
|
|
1232
1266
|
const files = opts.files.filter(isIndexableFile);
|
|
1233
1267
|
if (files.length === 0) return Promise.resolve();
|
|
@@ -1352,4 +1386,4 @@ export {
|
|
|
1352
1386
|
checkCodebaseIndexServerHealth,
|
|
1353
1387
|
ensureCodebaseIndexServer
|
|
1354
1388
|
};
|
|
1355
|
-
//# sourceMappingURL=chunk-
|
|
1389
|
+
//# sourceMappingURL=chunk-UMOP3VGK.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
builtinTools
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2BCRQAIW.js";
|
|
4
4
|
|
|
5
5
|
// src/pack.ts
|
|
6
6
|
var builtinToolsPack = {
|
|
@@ -12,4 +12,4 @@ var builtinToolsPack = {
|
|
|
12
12
|
export {
|
|
13
13
|
builtinToolsPack
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-VMNWQI4V.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
enqueueReindex
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UMOP3VGK.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveRealInsideRoot,
|
|
6
6
|
safeResolveReal,
|
|
@@ -390,4 +390,4 @@ function extractPatchedFiles(output) {
|
|
|
390
390
|
export {
|
|
391
391
|
patchTool
|
|
392
392
|
};
|
|
393
|
-
//# sourceMappingURL=chunk-
|
|
393
|
+
//# sourceMappingURL=chunk-YPSVPCIE.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-MSOAX3GC.js";
|
|
4
4
|
import {
|
|
5
5
|
enqueueReindex
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UMOP3VGK.js";
|
|
7
7
|
import {
|
|
8
8
|
safeResolveReal,
|
|
9
9
|
sha256hex,
|
|
@@ -179,4 +179,4 @@ async function finishWrite(input, ctx, prepared, signal) {
|
|
|
179
179
|
export {
|
|
180
180
|
writeTool
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-Z77XMU3U.js.map
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* Deterministic backward-compatibility & invariant validator that checks AST
|
|
5
5
|
* diffs between original code and LLM mutations before changes are written to disk.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Rules are implemented for TypeScript/JavaScript, Python, Go and Rust:
|
|
8
8
|
* - INV-001: Export / Public Symbol Deletion or Rename
|
|
9
9
|
* - INV-002: Mandatory / Non-Default Parameter Addition
|
|
10
10
|
* - INV-003: Mandatory Interface / Trait / Model Property Addition
|
|
11
11
|
* - INV-004: Incompatible Return Type Alteration
|
|
12
|
+
*
|
|
13
|
+
* Any other language has no contract extractor: the result says so through
|
|
14
|
+
* `supported: false` instead of reporting an empty diff as "compatible".
|
|
12
15
|
*/
|
|
13
16
|
import type { SymbolLang } from './schema.js';
|
|
14
17
|
export type InvariantRuleId = 'INV-001' | 'INV-002' | 'INV-003' | 'INV-004';
|
|
@@ -29,6 +32,13 @@ export interface InvariantViolation {
|
|
|
29
32
|
export interface InvariantEvaluationResult {
|
|
30
33
|
valid: boolean;
|
|
31
34
|
violations: InvariantViolation[];
|
|
35
|
+
/** Language the rules were evaluated as. */
|
|
36
|
+
lang: SymbolLang;
|
|
37
|
+
/**
|
|
38
|
+
* False when no contract extractor exists for `lang` (or its grammar failed
|
|
39
|
+
* to load). `valid: true` then means "nothing was checked", not "compatible".
|
|
40
|
+
*/
|
|
41
|
+
supported: boolean;
|
|
32
42
|
stats: {
|
|
33
43
|
originalSymbols: number;
|
|
34
44
|
modifiedSymbols: number;
|
|
@@ -68,8 +78,15 @@ interface InterfaceContract {
|
|
|
68
78
|
export interface ModuleContract {
|
|
69
79
|
lang: SymbolLang;
|
|
70
80
|
exports: Set<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Keyed by SCOPED name (`Class.method`, `Receiver.Method`, `Type.fn`): a
|
|
83
|
+
* bare-name key let `impl A { fn new }` overwrite `impl B { fn new }`, so the
|
|
84
|
+
* rules compared unrelated functions and missed the real change.
|
|
85
|
+
*/
|
|
71
86
|
functions: Map<string, FunctionContract>;
|
|
72
87
|
interfaces: Map<string, InterfaceContract>;
|
|
88
|
+
/** False when this language has no extractor or its grammar did not load. */
|
|
89
|
+
supported: boolean;
|
|
73
90
|
}
|
|
74
91
|
/**
|
|
75
92
|
* Universal AST Invariant Engine for deterministic backward compatibility validation.
|
|
@@ -93,7 +110,7 @@ export declare class PolyglotInvariantEngine {
|
|
|
93
110
|
*/
|
|
94
111
|
private extractTsContract;
|
|
95
112
|
/**
|
|
96
|
-
* Polyglot extraction (Python, Go, Rust
|
|
113
|
+
* Polyglot extraction (Python, Go, Rust) via Tree-sitter WASM.
|
|
97
114
|
*/
|
|
98
115
|
private extractTreeSitterContract;
|
|
99
116
|
}
|
|
@@ -43,6 +43,25 @@ export declare const ATLAS_SCHEMA = 2;
|
|
|
43
43
|
* small enough to read in a diff — the full 8k-file list would be neither.
|
|
44
44
|
*/
|
|
45
45
|
export declare const ATLAS_FILE_LIMIT = 300;
|
|
46
|
+
/**
|
|
47
|
+
* Code-unit string order. `localeCompare` follows the host's ICU locale, so
|
|
48
|
+
* the same index sorted `B`/`a` (or `I`/`ı` under tr-TR) differently on two
|
|
49
|
+
* machines — a committed atlas that must be byte-identical everywhere
|
|
50
|
+
* churned on every regeneration by someone with another locale.
|
|
51
|
+
*/
|
|
52
|
+
export declare function compareText(a: string, b: string): number;
|
|
53
|
+
/**
|
|
54
|
+
* The package a file is shown under. Single source for the projection AND the
|
|
55
|
+
* brief: a file with an empty `package` label is grouped by its first path
|
|
56
|
+
* segment.
|
|
57
|
+
*/
|
|
58
|
+
export declare function atlasPackageName(packageLabel: string | undefined, relativePath: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Indexed files per displayed package name. Counting by the raw label gave
|
|
61
|
+
* every path-derived package the total of ALL unlabelled files (they share
|
|
62
|
+
* the '' label), and counted '' itself as a package.
|
|
63
|
+
*/
|
|
64
|
+
export declare function atlasPackageFileCounts(store: IndexStore, relativeOf: (file: string) => string): Map<string, number>;
|
|
46
65
|
export type { AtlasDocument, AtlasEdge, AtlasFile, AtlasManifest, AtlasPackage, AtlasProjection, AtlasSymbol, };
|
|
47
66
|
/**
|
|
48
67
|
* Build the projection from the index. Pure with respect to the filesystem —
|
|
@@ -31,6 +31,20 @@ import { type IncomingCallsResult, type OutgoingCallsResult } from './index-serv
|
|
|
31
31
|
import { type ProjectIndexServerClientHealth, type ProjectIndexServerConnectionState, type ProjectIndexServerShutdownResult } from './project-server-client.js';
|
|
32
32
|
import type { CodeMapGraph, IndexResult, IndexStats } from './schema.js';
|
|
33
33
|
import type { CallRefsOpArgs, ContextOpArgs, FileGraphOpArgs, SearchOpArgs, SearchOpResult, StatsOpArgs, SymbolGraphOpArgs, VectorSearchOpArgs, VectorSearchOpResult } from './worker-protocol.js';
|
|
34
|
+
/**
|
|
35
|
+
* The error read tools gate on, from this process's own runs and the shared
|
|
36
|
+
* project server's activity.
|
|
37
|
+
*
|
|
38
|
+
* `remote?.lastError ?? local` let a stale local failure outlive the server's
|
|
39
|
+
* later successful generation (`null ?? local` is `local`), so search,
|
|
40
|
+
* incoming/outgoing calls and impact analysis kept refusing with "Index build
|
|
41
|
+
* failed" against a healthy index. The newer report wins; a tie trusts the
|
|
42
|
+
* server, which owns the index.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveLastError(remote: {
|
|
45
|
+
lastError: string | null;
|
|
46
|
+
updatedAt: number | null;
|
|
47
|
+
} | null | undefined, local: string | null, localAt: number): string | null;
|
|
34
48
|
/** True once the first full-project index has completed (success or failure). */
|
|
35
49
|
export declare function isIndexReady(): boolean;
|
|
36
50
|
/**
|
|
@@ -78,6 +78,13 @@ export declare class IndexCircuitBreaker {
|
|
|
78
78
|
allowRequest(): boolean;
|
|
79
79
|
recordSuccess(): void;
|
|
80
80
|
recordFailure(err: unknown): void;
|
|
81
|
+
/**
|
|
82
|
+
* Release a probe that ended without a verdict (the caller aborted it).
|
|
83
|
+
* Neither success nor failure is recorded, but a half-open circuit must be
|
|
84
|
+
* able to admit the next probe — otherwise it refuses every request until a
|
|
85
|
+
* manual reset.
|
|
86
|
+
*/
|
|
87
|
+
abandonProbe(): void;
|
|
81
88
|
/** Force-close the circuit (manual recovery: `/codebase-reindex`). */
|
|
82
89
|
reset(): void;
|
|
83
90
|
snapshot(): CircuitSnapshot;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* target?: 'body' | 'full', // whether to replace only the body (default) or the full declaration
|
|
9
9
|
* })
|
|
10
10
|
*/
|
|
11
|
-
import type
|
|
11
|
+
import { type Tool } from '@wrongstack/core/types';
|
|
12
12
|
import { type MutateSymbolOptions } from './ast-symbol-mutator.js';
|
|
13
13
|
export interface CodebaseAstReplaceInput extends MutateSymbolOptions {
|
|
14
14
|
}
|
|
@@ -24,6 +24,8 @@ export interface ImpactCallSite {
|
|
|
24
24
|
callerKind: string;
|
|
25
25
|
callType: string;
|
|
26
26
|
isTest: boolean;
|
|
27
|
+
/** A caller of a caller: reached through the transitive tree, not a direct use. */
|
|
28
|
+
indirect?: boolean | undefined;
|
|
27
29
|
}
|
|
28
30
|
export interface ImpactAnalysisOutput {
|
|
29
31
|
status: 'ok';
|
|
@@ -37,7 +39,11 @@ export interface ImpactAnalysisOutput {
|
|
|
37
39
|
recommendedActionPlan: string[];
|
|
38
40
|
/** False when the symbol could not be resolved in the index. */
|
|
39
41
|
symbolFound?: boolean;
|
|
42
|
+
/** True when a previous generation's cached answer was served during a refresh. */
|
|
43
|
+
stale?: boolean | undefined;
|
|
40
44
|
}
|
|
41
45
|
export type CodebaseImpactAnalysisOutput = ImpactAnalysisOutput;
|
|
46
|
+
/** Whether a project-relative path looks like a test, fixture, mock, or bench file. */
|
|
47
|
+
export declare function isTestFilePath(relPath: string): boolean;
|
|
42
48
|
export declare const codebaseImpactAnalysisTool: Tool<ImpactAnalysisInput, ImpactAnalysisOutput>;
|
|
43
49
|
//# sourceMappingURL=codebase-impact-analysis-tool.d.ts.map
|
|
@@ -15,6 +15,8 @@ export interface CodebaseInvariantCheckInput {
|
|
|
15
15
|
}
|
|
16
16
|
export interface CodebaseInvariantCheckOutput {
|
|
17
17
|
valid: boolean;
|
|
18
|
+
/** False when the language has no invariant rules — `valid` then proves nothing. */
|
|
19
|
+
verified: boolean;
|
|
18
20
|
violations: InvariantViolation[];
|
|
19
21
|
summary: string;
|
|
20
22
|
}
|
|
@@ -27,5 +27,31 @@ export interface TargetedTestOutput {
|
|
|
27
27
|
output: string;
|
|
28
28
|
}
|
|
29
29
|
export type CodebaseTargetedTestOutput = TargetedTestOutput;
|
|
30
|
+
/**
|
|
31
|
+
* Pull pass/fail counts out of a runner's (ANSI-stripped) output.
|
|
32
|
+
*
|
|
33
|
+
* Vitest prints `Test Files 1 passed (1)` BEFORE `Tests 5 passed (5)`; the
|
|
34
|
+
* old first-match regex reported the suite count as the test count. Scope to
|
|
35
|
+
* the vitest `Tests` summary line when present, otherwise take the LAST
|
|
36
|
+
* summary (pytest prints `== 3 passed, 1 failed in 0.2s ==` at the end).
|
|
37
|
+
* Returns null when no counts are printed (e.g. `go test`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseTestCounts(output: string): {
|
|
40
|
+
passed: number;
|
|
41
|
+
failed: number;
|
|
42
|
+
} | null;
|
|
43
|
+
/**
|
|
44
|
+
* Pick the runner for the discovered suites.
|
|
45
|
+
*
|
|
46
|
+
* - `go test` takes PACKAGES: handed `pkg/foo_test.go` it compiles that one
|
|
47
|
+
* file without the package's sources and fails on every undefined symbol.
|
|
48
|
+
* - A jest project was run with `npx vitest run`, which is not installed there.
|
|
49
|
+
* - Suites of different runners cannot share one command line; the old
|
|
50
|
+
* fallback handed `.py` files to vitest.
|
|
51
|
+
*/
|
|
52
|
+
export declare function selectTestRunner(projectRoot: string, suites: readonly string[]): Promise<{
|
|
53
|
+
cmd: string;
|
|
54
|
+
args: string[];
|
|
55
|
+
}>;
|
|
30
56
|
export declare const codebaseTargetedTestTool: Tool<TargetedTestInput, TargetedTestOutput>;
|
|
31
57
|
//# sourceMappingURL=codebase-targeted-test-tool.d.ts.map
|
|
@@ -69,6 +69,10 @@ export interface DeadCodeScanOutput {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
export declare const deadCodeScanTool: Tool<DeadCodeScanInput, DeadCodeScanOutput>;
|
|
72
|
+
/**
|
|
73
|
+
* Walk the workspace and discover entry-point files from package.json(s).
|
|
74
|
+
*/
|
|
75
|
+
export declare function discoverEntryPoints(projectRoot: string, userEntryPoints: string[] | undefined): string[];
|
|
72
76
|
export declare function runDeadCodeScan(projectRoot: string, opts?: {
|
|
73
77
|
indexDir?: string | undefined;
|
|
74
78
|
userEntryPoints?: string[] | undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Go source symbol extraction using `go/parser`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Runs the extraction program from `toolchain-scripts.ts` under `go run`, with
|
|
5
|
+
* the source on stdin, and decodes its JSON. When the toolchain is missing or
|
|
6
|
+
* the run yields nothing, a line-based extractor keeps the file indexed.
|
|
6
7
|
*
|
|
7
|
-
* Extracts:
|
|
8
|
+
* Extracts: func, method, type, const, var
|
|
8
9
|
*/
|
|
9
10
|
import type { FileSymbols, SymbolLang } from './schema.js';
|
|
10
11
|
export declare function parseSymbols(opts: {
|
|
@@ -13,4 +14,23 @@ export declare function parseSymbols(opts: {
|
|
|
13
14
|
lang: SymbolLang;
|
|
14
15
|
}): Promise<FileSymbols>;
|
|
15
16
|
export { detectLang } from './languages.js';
|
|
17
|
+
/**
|
|
18
|
+
* Blank comment and string/rune literal contents, keeping offsets and newlines.
|
|
19
|
+
* Quote characters survive so the line structure stays readable.
|
|
20
|
+
*/
|
|
21
|
+
export declare function maskGoNonCode(src: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Line-based extraction for when `go run` is unavailable or failed.
|
|
24
|
+
*
|
|
25
|
+
* Runs over {@link maskGoNonCode} output and only reads declarations at the top
|
|
26
|
+
* level. Previously it scanned every trimmed line of the raw source, so:
|
|
27
|
+
* - a `(` or `}` inside a string or comment tripped the delimiter check and
|
|
28
|
+
* the whole file indexed empty (`strings.Split(s, "(")` is enough);
|
|
29
|
+
* - every `var x` / `type t` local inside a function body became a
|
|
30
|
+
* package-level symbol;
|
|
31
|
+
* - generic functions (`func Map[T any](`) were missing, grouped
|
|
32
|
+
* `const ( … )` / `var ( … )` members were missing, and methods were
|
|
33
|
+
* scoped `pkg.Name` instead of the native parser's `pkg.Recv.Name`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseGoWithoutToolchain(filePath: string, content: string, lang?: SymbolLang): FileSymbols;
|
|
16
36
|
//# sourceMappingURL=go-parser.d.ts.map
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
* watcher run, which is what {@link shouldRefreshRanks} arbitrates.
|
|
12
12
|
*/
|
|
13
13
|
import type { IndexStore } from './writer.js';
|
|
14
|
+
/**
|
|
15
|
+
* Build the `implicitlyVisible` predicate for one rank pass.
|
|
16
|
+
*
|
|
17
|
+
* Without it every same-package Go/Java/C# reference — code that needs no
|
|
18
|
+
* import by the language's own rules — was scored as a contradicted
|
|
19
|
+
* misresolution (weight 0.02), as was every call into a Go package other than
|
|
20
|
+
* the one file the resolver picked to represent it. Centrality for those
|
|
21
|
+
* languages was computed on a graph with its package-internal wiring erased.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createImplicitVisibility(): (sourceFile: string, targetFile: string, imports: ReadonlySet<string> | undefined) => boolean;
|
|
14
24
|
/**
|
|
15
25
|
* Data-version marker for the rank layer, in the same spirit as
|
|
16
26
|
* `relation_graph_version`: bumping it forces every index to recompute ranks
|