@wrongstack/tools 1.0.10 → 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.
Files changed (80) hide show
  1. package/dist/builtin.js +17 -17
  2. package/dist/{chunk-6I6RXQFG.js → chunk-2BCRQAIW.js} +9 -9
  3. package/dist/{chunk-XRNN44QY.js → chunk-2IRHFHZY.js} +235 -71
  4. package/dist/{chunk-5RBUYFRV.js → chunk-4IMNVQRB.js} +8 -2
  5. package/dist/{chunk-NEYUPZL6.js → chunk-6D3UIQMF.js} +651 -303
  6. package/dist/chunk-BJ5LXLKE.js +351 -0
  7. package/dist/{chunk-C6ZOXNXV.js → chunk-CSS42GRP.js} +2 -2
  8. package/dist/{chunk-SKRMUHTU.js → chunk-HSLDY55L.js} +41 -8
  9. package/dist/{chunk-ENE22I5W.js → chunk-K37AKCTN.js} +884 -362
  10. package/dist/{chunk-V25Q6TQ7.js → chunk-K3VX6V5P.js} +3 -3
  11. package/dist/chunk-OIFY4XNP.js +855 -0
  12. package/dist/{chunk-OUERRFEM.js → chunk-OMQDKZOT.js} +17 -8
  13. package/dist/{chunk-7GOE2ZTZ.js → chunk-OMWC2OGT.js} +2 -2
  14. package/dist/{chunk-IE4KDAOB.js → chunk-OYQE2UNT.js} +3 -3
  15. package/dist/chunk-R3HR3QI3.js +97 -0
  16. package/dist/{chunk-XPVYZ2S6.js → chunk-RYLMSGR5.js} +2 -2
  17. package/dist/{chunk-HYHE4VNA.js → chunk-UMOP3VGK.js} +79 -45
  18. package/dist/{chunk-FVSMTEO3.js → chunk-VMNWQI4V.js} +2 -2
  19. package/dist/{chunk-2UVAIS5O.js → chunk-YPSVPCIE.js} +2 -2
  20. package/dist/{chunk-PWZUHZP7.js → chunk-Z77XMU3U.js} +2 -2
  21. package/dist/codebase-index/ast-invariant-engine.d.ts +19 -2
  22. package/dist/codebase-index/atlas-projection.d.ts +19 -0
  23. package/dist/codebase-index/background-indexer.d.ts +14 -0
  24. package/dist/codebase-index/circuit-breaker.d.ts +7 -0
  25. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +1 -1
  26. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +6 -0
  27. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +2 -0
  28. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +26 -0
  29. package/dist/codebase-index/dead-code-scan.d.ts +4 -0
  30. package/dist/codebase-index/go-parser.d.ts +23 -3
  31. package/dist/codebase-index/graph-rank-pass.d.ts +10 -0
  32. package/dist/codebase-index/graph-rank.d.ts +8 -0
  33. package/dist/codebase-index/index.d.ts +1 -1
  34. package/dist/codebase-index/index.js +9 -9
  35. package/dist/codebase-index/lsp-kind.d.ts +3 -1
  36. package/dist/codebase-index/module-resolver.d.ts +21 -1
  37. package/dist/codebase-index/parser-batch.d.ts +6 -8
  38. package/dist/codebase-index/parser-output.d.ts +5 -1
  39. package/dist/codebase-index/parser-worker-script.js +4 -4
  40. package/dist/codebase-index/project-server-framing.d.ts +1 -17
  41. package/dist/codebase-index/project-server-watcher.d.ts +6 -0
  42. package/dist/codebase-index/project-server.js +72 -26
  43. package/dist/codebase-index/py-parser.d.ts +4 -4
  44. package/dist/codebase-index/rs-parser.d.ts +7 -0
  45. package/dist/codebase-index/toolchain-scripts.d.ts +64 -0
  46. package/dist/codebase-index/tree-sitter/queries.d.ts +14 -0
  47. package/dist/codebase-index/tree-sitter/util.d.ts +6 -1
  48. package/dist/codebase-index/tree-sitter-parser.d.ts +7 -0
  49. package/dist/codebase-index/worker.js +23 -16
  50. package/dist/codebase-index/writer-refs.d.ts +17 -2
  51. package/dist/codebase-index/writer-search-helpers.d.ts +9 -0
  52. package/dist/codebase-index/writer.d.ts +20 -1
  53. package/dist/edit.js +8 -8
  54. package/dist/{generic-parser-N2PLGBC2.js → generic-parser-IVWLFKMR.js} +2 -2
  55. package/dist/go-parser-LWV3L5V7.js +197 -0
  56. package/dist/index.js +19 -19
  57. package/dist/json-parser-PERV2JHX.js +204 -0
  58. package/dist/pack.js +18 -18
  59. package/dist/parser-dispatch-ZSWCQB6M.js +14 -0
  60. package/dist/patch.js +8 -8
  61. package/dist/{py-parser-4PFZYAJ7.js → py-parser-B6D6RGH7.js} +4 -4
  62. package/dist/read.js +8 -8
  63. package/dist/replace.js +8 -8
  64. package/dist/rs-parser-L7SP4GWJ.js +182 -0
  65. package/dist/test.d.ts +1 -0
  66. package/dist/test.js +1 -1
  67. package/dist/tool-tier.js +19 -19
  68. package/dist/{tree-sitter-parser-GILYQLS4.js → tree-sitter-parser-KU6JF3ZC.js} +6 -4
  69. package/dist/{ts-parser-7W26YB26.js → ts-parser-PML6QIH7.js} +55 -23
  70. package/dist/typecheck.js +1 -1
  71. package/dist/write.js +8 -8
  72. package/dist/{yaml-parser-DFBC5FWH.js → yaml-parser-7BJN544B.js} +41 -6
  73. package/package.json +5 -5
  74. package/dist/chunk-4CE3RKEP.js +0 -390
  75. package/dist/chunk-KHUCKLOR.js +0 -899
  76. package/dist/chunk-ZKC5UNGD.js +0 -167
  77. package/dist/go-parser-Z4H6SR3R.js +0 -474
  78. package/dist/json-parser-IJD77VL4.js +0 -256
  79. package/dist/parser-dispatch-WG4DNBHH.js +0 -14
  80. package/dist/rs-parser-GIWPUA3T.js +0 -81
@@ -34,7 +34,6 @@ var testTool = {
34
34
  enum: ["vitest", "jest", "mocha", "auto"],
35
35
  description: "Test runner (default: auto-detect)"
36
36
  },
37
- watch: { type: "boolean", description: "Run in watch mode (default: false)" },
38
37
  coverage: { type: "boolean", description: "Generate coverage report (default: false)" },
39
38
  cwd: { type: "string", description: "Working directory (default: cwd)" },
40
39
  grep: { type: "string", description: "Filter tests by name pattern (default: none)" },
@@ -80,21 +79,32 @@ var testTool = {
80
79
  `test: ${bridge.language} test runner unavailable: ${run.error || run.output || "no detail"}`
81
80
  );
82
81
  }
82
+ if (run.status === "cancelled") {
83
+ signal.throwIfAborted();
84
+ throw new Error(`test: ${bridge.language} test run was cancelled`);
85
+ }
86
+ if (run.status === "failed" && run.exitCode === null) {
87
+ throw new Error(
88
+ `test: ${bridge.language} test runner failed to run: ${run.error || "no detail"}`
89
+ );
90
+ }
83
91
  const passed = run.summary.passed ?? 0;
84
92
  const failed = run.summary.failed ?? 0;
85
- const exitCode = run.exitCode ?? 0;
86
93
  const rawOutput = run.output || run.error || "";
94
+ const status = run.status === "passed" && run.exitCode === 0 ? resolveStatus(0, passed + failed, rawOutput) : "failed";
95
+ const timedOutNote = run.status === "timed_out" ? `Test run timed out before completing.
96
+ ` : "";
87
97
  yield {
88
98
  type: "final",
89
99
  output: {
90
100
  runner: bridge.language,
91
- status: resolveStatus(exitCode, passed + failed, rawOutput),
92
- exit_code: exitCode,
101
+ status,
102
+ exit_code: run.exitCode,
93
103
  tests_run: passed + failed,
94
104
  passed,
95
105
  failed,
96
106
  duration_ms: run.durationMs,
97
- output: normalizeCommandOutput(rawOutput),
107
+ output: normalizeCommandOutput(timedOutNote + rawOutput),
98
108
  truncated: run.truncated
99
109
  }
100
110
  };
@@ -171,7 +181,7 @@ function buildArgs(runner, input) {
171
181
  const timeout = Math.max(100, rawTimeout);
172
182
  switch (runner) {
173
183
  case "vitest":
174
- args.push(input.watch ? "watch" : "run");
184
+ args.push("run");
175
185
  if (input.verbose) args.push("--reporter=verbose");
176
186
  if (input.coverage) args.push("--coverage");
177
187
  if (input.grep) args.push("--testNamePattern", input.grep);
@@ -179,7 +189,6 @@ function buildArgs(runner, input) {
179
189
  break;
180
190
  case "jest":
181
191
  if (input.verbose) args.push("--verbose");
182
- if (input.watch) args.push("--watch");
183
192
  if (input.coverage) args.push("--coverage");
184
193
  if (input.grep) args.push("--testNamePattern", input.grep);
185
194
  args.push("--testTimeout", String(timeout));
@@ -252,4 +261,4 @@ ${result.stderr}` : result.stdout || result.stderr || result.error || "";
252
261
  export {
253
262
  testTool
254
263
  };
255
- //# sourceMappingURL=chunk-OUERRFEM.js.map
264
+ //# sourceMappingURL=chunk-OMQDKZOT.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MSOAX3GC.js";
4
4
  import {
5
5
  enqueueReindex
6
- } from "./chunk-HYHE4VNA.js";
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-7GOE2ZTZ.js.map
521
+ //# sourceMappingURL=chunk-OMWC2OGT.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getIndexState,
3
3
  searchCodebaseIndex
4
- } from "./chunk-HYHE4VNA.js";
4
+ } from "./chunk-UMOP3VGK.js";
5
5
  import {
6
6
  codebaseIndexDirOverride
7
- } from "./chunk-NEYUPZL6.js";
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-IE4KDAOB.js.map
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-NEYUPZL6.js";
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-XPVYZ2S6.js.map
161
+ //# sourceMappingURL=chunk-RYLMSGR5.js.map
@@ -13,11 +13,12 @@ import {
13
13
  projectIndexServerMetadataPath,
14
14
  projectIndexServerStderrPath,
15
15
  readProjectIndexServerStderrTail
16
- } from "./chunk-XPVYZ2S6.js";
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
- } from "./chunk-NEYUPZL6.js";
31
+ symbolGraphService,
32
+ vectorSearchService
33
+ } from "./chunk-6D3UIQMF.js";
32
34
  import {
33
35
  recordIpcPending
34
- } from "./chunk-ZKC5UNGD.js";
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 message2;
516
+ let decoded;
515
517
  try {
516
- message2 = decodeBinaryFrame(payload);
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
- this.onMessage(message2);
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 message;
544
+ let parsed;
539
545
  try {
540
- message = JSON.parse(line);
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
- this.onMessage(message);
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?.lastError ?? _lastError,
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
- const result = await withMutex(() => {
1187
- _currentFile = 0;
1188
- _totalFiles = 0;
1189
- _lastError = null;
1190
- return callIndexOp(
1191
- "index",
1192
- {
1193
- projectRoot: opts.projectRoot,
1194
- indexDir: opts.indexDir,
1195
- force: opts.force,
1196
- langs: opts.langs
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
- _lastError = err instanceof Error ? err.message : String(err);
1210
- const originalError = _lastError;
1211
- if (isRecoverableConstraintError(err) && !opts.force) {
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 (!opts.signal?.aborted) indexCircuitBreaker.recordFailure(err);
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-HYHE4VNA.js.map
1389
+ //# sourceMappingURL=chunk-UMOP3VGK.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtinTools
3
- } from "./chunk-6I6RXQFG.js";
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-FVSMTEO3.js.map
15
+ //# sourceMappingURL=chunk-VMNWQI4V.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  enqueueReindex
3
- } from "./chunk-HYHE4VNA.js";
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-2UVAIS5O.js.map
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-HYHE4VNA.js";
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-PWZUHZP7.js.map
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
- * Catches breaking changes across TypeScript/JavaScript, Python, Go, Rust, Java, etc.:
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, Java, etc.) via Tree-sitter WASM.
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 { Tool } from '@wrongstack/core/types';
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