@wrongstack/tools 0.317.2 → 0.319.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/_util.d.ts +13 -0
  2. package/dist/audit.js +4 -4
  3. package/dist/bash.js +2 -2
  4. package/dist/builtin.js +38 -38
  5. package/dist/{chunk-TKA4VEX2.js → chunk-2472NT76.js} +2 -2
  6. package/dist/{chunk-UE3UBMCP.js → chunk-4Q7LFU4T.js} +3 -3
  7. package/dist/{chunk-RMB76PDS.js → chunk-65EMYN5G.js} +3 -3
  8. package/dist/{chunk-A6BRWIXN.js → chunk-6IEBD27U.js} +20 -5
  9. package/dist/{chunk-P7ZQ2FAJ.js → chunk-7WV3D4S3.js} +2 -2
  10. package/dist/{chunk-NKX4SJ5R.js → chunk-C3W3V54D.js} +4 -4
  11. package/dist/{chunk-RUOMW2I6.js → chunk-COUNXG4X.js} +3 -3
  12. package/dist/{chunk-VB3MJGCV.js → chunk-D4CXUZIF.js} +2 -2
  13. package/dist/{chunk-5WNDJHT6.js → chunk-DPKTXJQS.js} +2 -2
  14. package/dist/{chunk-ELFFQ4RU.js → chunk-DTQ75VBC.js} +2 -1
  15. package/dist/{chunk-EMRGN4KM.js → chunk-HBM4QNXU.js} +2 -2
  16. package/dist/{chunk-J5SKD6LN.js → chunk-HWDB2G7J.js} +2 -2
  17. package/dist/{chunk-ZLTFLC25.js → chunk-IIF5HIVF.js} +2 -2
  18. package/dist/{chunk-UKGMDCXT.js → chunk-KD5EHYA2.js} +2 -2
  19. package/dist/{chunk-A2PX7M7A.js → chunk-MRKWZCHZ.js} +3 -3
  20. package/dist/{chunk-BANPF4LY.js → chunk-MYRMD6PZ.js} +3 -3
  21. package/dist/{chunk-S2JRYDYG.js → chunk-N5O3FK5Q.js} +3 -3
  22. package/dist/{chunk-EEOFQDT6.js → chunk-OCUXN6Y3.js} +46 -2
  23. package/dist/{chunk-3QQSBUXR.js → chunk-ODFVG54U.js} +3 -3
  24. package/dist/{chunk-ICAXDRP6.js → chunk-OJ4FIBAN.js} +3 -3
  25. package/dist/{chunk-6RR5VX6U.js → chunk-OYVPBPCL.js} +3 -3
  26. package/dist/{chunk-WI3VDXHD.js → chunk-PMHVSHMU.js} +40 -10
  27. package/dist/{chunk-TDLZIDCY.js → chunk-PRXZOIEW.js} +3 -3
  28. package/dist/{chunk-D33S4RQG.js → chunk-QLF74MSV.js} +7 -1
  29. package/dist/{chunk-CVALEVGA.js → chunk-QZDOQRF7.js} +3 -3
  30. package/dist/{chunk-AK2K4KHR.js → chunk-RK47IWO3.js} +67 -68
  31. package/dist/{chunk-FYDKHXN7.js → chunk-SYXW3Y5Z.js} +2 -2
  32. package/dist/{chunk-TFEGJDH5.js → chunk-TFMVHYJI.js} +5 -4
  33. package/dist/{chunk-JJQB6R7Y.js → chunk-TX3R5NVV.js} +6 -6
  34. package/dist/{chunk-SOG7XIRF.js → chunk-UC3RKRIV.js} +2 -2
  35. package/dist/{chunk-ZE6KLBUO.js → chunk-UMXVT7ST.js} +2 -2
  36. package/dist/{chunk-XVGB6KYU.js → chunk-VALQFAY2.js} +109 -34
  37. package/dist/{chunk-4AEZIFOW.js → chunk-VFF3Q5Z3.js} +3 -3
  38. package/dist/{chunk-UOXX4SQZ.js → chunk-W4GAAI3M.js} +2 -2
  39. package/dist/{chunk-HTYEO67J.js → chunk-WNUJR3H4.js} +2 -2
  40. package/dist/{chunk-CPVLVQYT.js → chunk-Y7QXSE7N.js} +3 -3
  41. package/dist/{chunk-CPSAF2AU.js → chunk-YZHK4TLF.js} +2 -2
  42. package/dist/{chunk-MRZOVQ5D.js → chunk-Z4VBTVUM.js} +3 -3
  43. package/dist/{chunk-4E42D7UF.js → chunk-ZDUGI5BC.js} +2 -2
  44. package/dist/{chunk-WJYXMB2R.js → chunk-ZKSBHXVB.js} +3 -3
  45. package/dist/codebase-index/generic-parser.d.ts +8 -1
  46. package/dist/codebase-index/index.d.ts +1 -0
  47. package/dist/codebase-index/index.js +15 -10
  48. package/dist/codebase-index/parser-worker-script.js +3 -3
  49. package/dist/codebase-index/project-server.js +6 -6
  50. package/dist/codebase-index/worker.js +5 -5
  51. package/dist/codebase-index/writer-refs.d.ts +1 -1
  52. package/dist/diff.js +2 -2
  53. package/dist/document.js +2 -2
  54. package/dist/e2e.js +2 -2
  55. package/dist/edit.js +9 -9
  56. package/dist/exec.js +2 -2
  57. package/dist/fetch.js +2 -2
  58. package/dist/format.js +4 -4
  59. package/dist/{generic-parser-VUXDIAOZ.js → generic-parser-WFMIRHBX.js} +2 -2
  60. package/dist/git.js +2 -2
  61. package/dist/glob.js +3 -3
  62. package/dist/grep.js +3 -3
  63. package/dist/index.js +40 -40
  64. package/dist/install.js +4 -4
  65. package/dist/json.js +2 -2
  66. package/dist/languages/index.js +2 -2
  67. package/dist/{legacy-bridge-SFNXIRAP.js → legacy-bridge-EC7GM2IW.js} +4 -4
  68. package/dist/lint.js +4 -4
  69. package/dist/logs.js +2 -2
  70. package/dist/outdated.js +2 -2
  71. package/dist/pack.js +39 -39
  72. package/dist/{parser-dispatch-X62UWXJS.js → parser-dispatch-3PDBKIQ7.js} +4 -4
  73. package/dist/patch.js +9 -9
  74. package/dist/{py-parser-TDXSQZBC.js → py-parser-RFWG2HYI.js} +3 -3
  75. package/dist/read.js +9 -9
  76. package/dist/replace.js +9 -9
  77. package/dist/scaffold.js +2 -2
  78. package/dist/test.js +4 -4
  79. package/dist/tool-tier.js +40 -40
  80. package/dist/{tree-sitter-parser-AIERW3YI.js → tree-sitter-parser-FGKHJGSX.js} +2 -2
  81. package/dist/tree.js +2 -2
  82. package/dist/typecheck.js +4 -4
  83. package/dist/write.js +9 -9
  84. package/package.json +5 -5
package/dist/_util.d.ts CHANGED
@@ -69,6 +69,19 @@ export declare function resolveRealInsideRoot(absPath: string, ctx: Context): Pr
69
69
  * caller then opened.
70
70
  */
71
71
  export declare function safeResolveReal(input: string, ctx: Context): Promise<string>;
72
+ /**
73
+ * Project-root-relative variant of {@link safeResolveReal} for the codebase
74
+ * tools whose documented input contract is "relative to projectRoot or
75
+ * absolute" (codebase-skeleton, security-ast-scan, codebase-invariant-check,
76
+ * codebase-ast-replace). The sibling file tools (edit/grep/glob/…) resolve
77
+ * relative input against the session cwd — that is THEIR contract; these four
78
+ * always resolved against the project root and their schemas say so. Routing
79
+ * them through plain safeResolveReal silently changed that: with a nested
80
+ * workingDir (worktrees, set_working_dir) a relative input resolved to the
81
+ * wrong file. Containment is still enforced exactly as in safeResolveReal
82
+ * (realpath + allowOutsideProjectRoot honored).
83
+ */
84
+ export declare function safeResolveProjectPath(input: string, ctx: Context): Promise<string>;
72
85
  /**
73
86
  * Truncate a diff (or similar text payload) to `maxBytes`, cutting at a line
74
87
  * boundary and appending an explicit marker. Used by the mutating file tools
package/dist/audit.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  auditTool
3
- } from "./chunk-CVALEVGA.js";
4
- import "./chunk-4E42D7UF.js";
5
- import "./chunk-SOG7XIRF.js";
3
+ } from "./chunk-QZDOQRF7.js";
4
+ import "./chunk-ZDUGI5BC.js";
5
+ import "./chunk-UC3RKRIV.js";
6
6
  import "./chunk-ZHH3BEWU.js";
7
7
  import "./chunk-2VSZC6QM.js";
8
8
  import "./chunk-3PVYQFRQ.js";
9
9
  import "./chunk-HFXSNKCV.js";
10
10
  import "./chunk-V43EQ6VR.js";
11
- import "./chunk-D33S4RQG.js";
11
+ import "./chunk-QLF74MSV.js";
12
12
  export {
13
13
  auditTool
14
14
  };
package/dist/bash.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  bashTool
3
- } from "./chunk-HTYEO67J.js";
3
+ } from "./chunk-WNUJR3H4.js";
4
4
  import "./chunk-BTSFTGIL.js";
5
5
  import "./chunk-NKNOBUBU.js";
6
6
  import "./chunk-2VSZC6QM.js";
7
7
  import "./chunk-3PVYQFRQ.js";
8
8
  import "./chunk-HFXSNKCV.js";
9
9
  import "./chunk-V43EQ6VR.js";
10
- import "./chunk-D33S4RQG.js";
10
+ import "./chunk-QLF74MSV.js";
11
11
  export {
12
12
  bashTool
13
13
  };
package/dist/builtin.js CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  TIER2_TOOLS,
6
6
  TIER3_TOOLS,
7
7
  builtinTools
8
- } from "./chunk-XVGB6KYU.js";
9
- import "./chunk-5WNDJHT6.js";
10
- import "./chunk-AK2K4KHR.js";
11
- import "./chunk-EEOFQDT6.js";
8
+ } from "./chunk-VALQFAY2.js";
9
+ import "./chunk-DPKTXJQS.js";
10
+ import "./chunk-RK47IWO3.js";
11
+ import "./chunk-OCUXN6Y3.js";
12
12
  import "./chunk-H6AWAZ2Y.js";
13
13
  import "./chunk-X5K3U6GI.js";
14
14
  import "./chunk-RJZQWEMS.js";
@@ -16,58 +16,58 @@ import "./chunk-FRN7TIAA.js";
16
16
  import "./chunk-WXJY3BKV.js";
17
17
  import "./chunk-QBV725YG.js";
18
18
  import "./chunk-6RNIFLG4.js";
19
- import "./chunk-CPVLVQYT.js";
20
- import "./chunk-UE3UBMCP.js";
21
- import "./chunk-CVALEVGA.js";
22
- import "./chunk-MRZOVQ5D.js";
23
- import "./chunk-CPSAF2AU.js";
24
- import "./chunk-EMRGN4KM.js";
25
- import "./chunk-TKA4VEX2.js";
26
- import "./chunk-ZE6KLBUO.js";
27
- import "./chunk-RUOMW2I6.js";
28
- import "./chunk-VB3MJGCV.js";
29
- import "./chunk-P7ZQ2FAJ.js";
30
- import "./chunk-J5SKD6LN.js";
31
- import "./chunk-WJYXMB2R.js";
32
- import "./chunk-3QQSBUXR.js";
33
- import "./chunk-4AEZIFOW.js";
34
- import "./chunk-4E42D7UF.js";
35
- import "./chunk-SOG7XIRF.js";
19
+ import "./chunk-Y7QXSE7N.js";
20
+ import "./chunk-4Q7LFU4T.js";
21
+ import "./chunk-QZDOQRF7.js";
22
+ import "./chunk-Z4VBTVUM.js";
23
+ import "./chunk-YZHK4TLF.js";
24
+ import "./chunk-HBM4QNXU.js";
25
+ import "./chunk-2472NT76.js";
26
+ import "./chunk-UMXVT7ST.js";
27
+ import "./chunk-COUNXG4X.js";
28
+ import "./chunk-D4CXUZIF.js";
29
+ import "./chunk-7WV3D4S3.js";
30
+ import "./chunk-HWDB2G7J.js";
31
+ import "./chunk-ZKSBHXVB.js";
32
+ import "./chunk-ODFVG54U.js";
33
+ import "./chunk-VFF3Q5Z3.js";
34
+ import "./chunk-ZDUGI5BC.js";
35
+ import "./chunk-UC3RKRIV.js";
36
36
  import "./chunk-ZHH3BEWU.js";
37
- import "./chunk-6RR5VX6U.js";
38
- import "./chunk-ICAXDRP6.js";
39
- import "./chunk-S2JRYDYG.js";
37
+ import "./chunk-OYVPBPCL.js";
38
+ import "./chunk-OJ4FIBAN.js";
39
+ import "./chunk-N5O3FK5Q.js";
40
40
  import "./chunk-Q5JPPCZC.js";
41
41
  import "./chunk-NWZ6XGBJ.js";
42
- import "./chunk-HTYEO67J.js";
43
- import "./chunk-WI3VDXHD.js";
42
+ import "./chunk-WNUJR3H4.js";
43
+ import "./chunk-PMHVSHMU.js";
44
44
  import "./chunk-BTSFTGIL.js";
45
45
  import "./chunk-NKNOBUBU.js";
46
46
  import "./chunk-2VSZC6QM.js";
47
47
  import "./chunk-3PVYQFRQ.js";
48
48
  import "./chunk-HFXSNKCV.js";
49
- import "./chunk-UKGMDCXT.js";
49
+ import "./chunk-KD5EHYA2.js";
50
50
  import "./chunk-PQTONQ4P.js";
51
51
  import "./chunk-NBDZMMG2.js";
52
52
  import "./chunk-5ZYEGP2P.js";
53
53
  import "./chunk-FJEQZHZN.js";
54
54
  import "./chunk-CWALNI6K.js";
55
55
  import "./chunk-45JPRMC2.js";
56
- import "./chunk-NKX4SJ5R.js";
57
- import "./chunk-BANPF4LY.js";
58
- import "./chunk-TDLZIDCY.js";
56
+ import "./chunk-C3W3V54D.js";
57
+ import "./chunk-MYRMD6PZ.js";
58
+ import "./chunk-PRXZOIEW.js";
59
59
  import "./chunk-FQZOHLG3.js";
60
- import "./chunk-A2PX7M7A.js";
61
- import "./chunk-UOXX4SQZ.js";
62
- import "./chunk-TFEGJDH5.js";
63
- import "./chunk-JJQB6R7Y.js";
64
- import "./chunk-ZLTFLC25.js";
65
- import "./chunk-A6BRWIXN.js";
60
+ import "./chunk-MRKWZCHZ.js";
61
+ import "./chunk-W4GAAI3M.js";
62
+ import "./chunk-TFMVHYJI.js";
63
+ import "./chunk-TX3R5NVV.js";
64
+ import "./chunk-IIF5HIVF.js";
65
+ import "./chunk-6IEBD27U.js";
66
66
  import "./chunk-UCYQTZ7F.js";
67
67
  import "./chunk-YOHO4DVT.js";
68
- import "./chunk-ELFFQ4RU.js";
68
+ import "./chunk-DTQ75VBC.js";
69
69
  import "./chunk-V43EQ6VR.js";
70
- import "./chunk-D33S4RQG.js";
70
+ import "./chunk-QLF74MSV.js";
71
71
  export {
72
72
  OFF_ONLY_TOOLS,
73
73
  OPTIONAL_TOOLS,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  safeResolveReal
3
- } from "./chunk-D33S4RQG.js";
3
+ } from "./chunk-QLF74MSV.js";
4
4
 
5
5
  // src/scaffold.ts
6
6
  import * as fs from "node:fs/promises";
@@ -197,4 +197,4 @@ function substituteVars(content, name, vars) {
197
197
  export {
198
198
  scaffoldTool
199
199
  };
200
- //# sourceMappingURL=chunk-TKA4VEX2.js.map
200
+ //# sourceMappingURL=chunk-2472NT76.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tryLegacyPackageOperation
3
- } from "./chunk-4E42D7UF.js";
3
+ } from "./chunk-ZDUGI5BC.js";
4
4
  import {
5
5
  spawnStream
6
6
  } from "./chunk-ZHH3BEWU.js";
@@ -8,7 +8,7 @@ import {
8
8
  detectPackageManager,
9
9
  normalizeCommandOutput,
10
10
  safeResolveReal
11
- } from "./chunk-D33S4RQG.js";
11
+ } from "./chunk-QLF74MSV.js";
12
12
 
13
13
  // src/install.ts
14
14
  import { join } from "node:path";
@@ -221,4 +221,4 @@ function resolveManifestPath(cwd, pkgManager) {
221
221
  export {
222
222
  installTool
223
223
  };
224
- //# sourceMappingURL=chunk-UE3UBMCP.js.map
224
+ //# sourceMappingURL=chunk-4Q7LFU4T.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  builtinToolsPack
3
- } from "./chunk-FYDKHXN7.js";
3
+ } from "./chunk-SYXW3Y5Z.js";
4
4
  import {
5
5
  TIER1_TOOLS,
6
6
  TIER2_TOOLS
7
- } from "./chunk-XVGB6KYU.js";
7
+ } from "./chunk-VALQFAY2.js";
8
8
 
9
9
  // src/tool-tier.ts
10
10
  function toolNameSet(tools) {
@@ -51,4 +51,4 @@ export {
51
51
  selectBuiltinToolsForTier,
52
52
  registerBuiltinToolTier
53
53
  };
54
- //# sourceMappingURL=chunk-RMB76PDS.js.map
54
+ //# sourceMappingURL=chunk-65EMYN5G.js.map
@@ -2,7 +2,17 @@
2
2
  var C_LIKE = [
3
3
  { re: /\b(?:class|struct|enum|interface|union)\s+([A-Za-z_]\w*)/g, kind: "class" },
4
4
  {
5
- re: /\b(?:public|private|protected|static|final|async|override|virtual|inline|export)?\s*(?:[\w:<>[\]\s*&]+)\s+([A-Za-z_]\w*)\s*\([^;{]*\)\s*(?:const)?\s*[{;]/g,
5
+ // H-10 (security report VF-11): the old shape
6
+ // `(?:…modifiers…)?\s*(?:[\w:<>[\]\s*&]+)\s+name\(` had three adjacent
7
+ // quantifiers that could each consume whitespace (`\s*`, the class with
8
+ // `\s` inside, `\s+`) — catastrophic backtracking on whitespace runs
9
+ // (516 bytes = 4.5 s measured). Decomposed so whitespace is owned by
10
+ // exactly one position: modifiers each consume their own trailing
11
+ // whitespace, the type is a single no-whitespace class, one `\s+`
12
+ // separates type from name. Generic types with internal spaces
13
+ // (`Map<String, Integer> x;`) are no longer matched — tree-sitter is the
14
+ // primary parser for C/C++ and this is only its WASM-less fallback.
15
+ re: /\b(?:(?:public|private|protected|static|final|async|override|virtual|inline|export)\s+)?[\w:<>[\]*&]+\s+([A-Za-z_]\w*)\s*\([^;{]*\)\s*(?:const)?\s*[{;]/g,
6
16
  kind: "function"
7
17
  },
8
18
  { re: /\b(?:namespace)\s+([A-Za-z_]\w*)/g, kind: "namespace" }
@@ -33,7 +43,11 @@ var LANG_PATTERNS = {
33
43
  java: [
34
44
  { re: /\b(?:class|interface|enum|record)\s+([A-Za-z_]\w*)/g, kind: "class" },
35
45
  {
36
- re: /\b(?:public|private|protected|static|final|abstract|synchronized|native|default|\s)+\s*[\w.<>,[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
46
+ // H-10 (security report VF-11): same rewrite as C_LIKE above — the old
47
+ // `(?:…|\s)+\s*[\w.<>,[\]\s]+\s+` let three quantifiers compete for the
48
+ // same whitespace (800 bytes of padding measured at 42 s). Whitespace
49
+ // now has exactly one owner per position.
50
+ re: /\b(?:(?:public|private|protected|static|final|abstract|synchronized|native|default)\s+)*[\w.$,<>[\]]+\s+([A-Za-z_]\w*)\s*\(/g,
37
51
  kind: "method"
38
52
  }
39
53
  ],
@@ -41,7 +55,8 @@ var LANG_PATTERNS = {
41
55
  { re: /\b(?:class|interface|struct|enum|record)\s+([A-Za-z_]\w*)/g, kind: "class" },
42
56
  { re: /\bnamespace\s+([A-Za-z_.\w]+)/g, kind: "namespace" },
43
57
  {
44
- re: /\b(?:public|private|protected|internal|static|async|override|virtual|\s)+\s*[\w.<>,[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
58
+ // H-10: see java above.
59
+ re: /\b(?:(?:public|private|protected|internal|static|async|override|virtual)\s+)*[\w.$,<>[\]]+\s+([A-Za-z_]\w*)\s*\(/g,
45
60
  kind: "method"
46
61
  }
47
62
  ],
@@ -250,7 +265,7 @@ function lineColAt(offsets, index) {
250
265
  return { line: low + 1, col: index - lastNl };
251
266
  }
252
267
  var GENERIC_MAX_SYMBOLS_DEFAULT = 500;
253
- var GENERIC_MAX_FILE_CHARS = 512 * 1024;
268
+ var GENERIC_MAX_FILE_CHARS = 128 * 1024;
254
269
  function parseGeneric(opts) {
255
270
  const { file, lang } = opts;
256
271
  const maxSymbols = opts.maxSymbols ?? GENERIC_MAX_SYMBOLS_DEFAULT;
@@ -314,4 +329,4 @@ export {
314
329
  parseGeneric,
315
330
  parseSymbols
316
331
  };
317
- //# sourceMappingURL=chunk-A6BRWIXN.js.map
332
+ //# sourceMappingURL=chunk-6IEBD27U.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  safeResolveReal
3
- } from "./chunk-D33S4RQG.js";
3
+ } from "./chunk-QLF74MSV.js";
4
4
 
5
5
  // src/diff.ts
6
6
  import { spawn } from "node:child_process";
@@ -210,4 +210,4 @@ ${numbered}`;
210
210
  export {
211
211
  diffTool
212
212
  };
213
- //# sourceMappingURL=chunk-P7ZQ2FAJ.js.map
213
+ //# sourceMappingURL=chunk-7WV3D4S3.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  getIndexState,
3
3
  searchCodebaseIndex
4
- } from "./chunk-A2PX7M7A.js";
4
+ } from "./chunk-MRKWZCHZ.js";
5
5
  import {
6
6
  codebaseIndexDirOverride
7
- } from "./chunk-TFEGJDH5.js";
7
+ } from "./chunk-TFMVHYJI.js";
8
8
  import {
9
9
  isBinaryBuffer,
10
10
  safeResolveReal,
11
11
  sha256hex
12
- } from "./chunk-D33S4RQG.js";
12
+ } from "./chunk-QLF74MSV.js";
13
13
 
14
14
  // src/read.ts
15
15
  import * as fs from "node:fs/promises";
@@ -295,4 +295,4 @@ ${interesting.join("\n")}` : "symbols/imports: (none detected)"
295
295
  export {
296
296
  readTool
297
297
  };
298
- //# sourceMappingURL=chunk-NKX4SJ5R.js.map
298
+ //# sourceMappingURL=chunk-C3W3V54D.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  enqueueReindex
3
- } from "./chunk-A2PX7M7A.js";
3
+ } from "./chunk-MRKWZCHZ.js";
4
4
  import {
5
5
  resolveRealInsideRoot,
6
6
  safeResolveReal,
7
7
  sha256hex
8
- } from "./chunk-D33S4RQG.js";
8
+ } from "./chunk-QLF74MSV.js";
9
9
 
10
10
  // src/patch.ts
11
11
  import { spawn } from "node:child_process";
@@ -313,4 +313,4 @@ function extractPatchedFiles(output) {
313
313
  export {
314
314
  patchTool
315
315
  };
316
- //# sourceMappingURL=chunk-RUOMW2I6.js.map
316
+ //# sourceMappingURL=chunk-COUNXG4X.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-Q5JPPCZC.js";
5
5
  import {
6
6
  safeResolveReal
7
- } from "./chunk-D33S4RQG.js";
7
+ } from "./chunk-QLF74MSV.js";
8
8
 
9
9
  // src/json.ts
10
10
  import * as fs from "node:fs/promises";
@@ -607,4 +607,4 @@ function toYaml(data, indent = 0) {
607
607
  export {
608
608
  jsonTool
609
609
  };
610
- //# sourceMappingURL=chunk-VB3MJGCV.js.map
610
+ //# sourceMappingURL=chunk-D4CXUZIF.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  safeResolveReal
3
- } from "./chunk-D33S4RQG.js";
3
+ } from "./chunk-QLF74MSV.js";
4
4
 
5
5
  // src/e2e.ts
6
6
  import { open, readdir } from "node:fs/promises";
@@ -422,4 +422,4 @@ export {
422
422
  discoverE2EProjects,
423
423
  e2ePlanTool
424
424
  };
425
- //# sourceMappingURL=chunk-5WNDJHT6.js.map
425
+ //# sourceMappingURL=chunk-DPKTXJQS.js.map
@@ -58,6 +58,7 @@ async function loadGitignoreMatcher(projectRoot) {
58
58
  }
59
59
 
60
60
  export {
61
+ compileGitignore,
61
62
  loadGitignoreMatcher
62
63
  };
63
- //# sourceMappingURL=chunk-ELFFQ4RU.js.map
64
+ //# sourceMappingURL=chunk-DTQ75VBC.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ensureInsideRoot,
3
3
  safeResolveReal
4
- } from "./chunk-D33S4RQG.js";
4
+ } from "./chunk-QLF74MSV.js";
5
5
 
6
6
  // src/document.ts
7
7
  import * as fs from "node:fs/promises";
@@ -167,4 +167,4 @@ function processFile(content, absPath, _style, _overwrite, target) {
167
167
  export {
168
168
  documentTool
169
169
  };
170
- //# sourceMappingURL=chunk-EMRGN4KM.js.map
170
+ //# sourceMappingURL=chunk-HBM4QNXU.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  safeResolveReal
3
- } from "./chunk-D33S4RQG.js";
3
+ } from "./chunk-QLF74MSV.js";
4
4
 
5
5
  // src/tree.ts
6
6
  import * as fs from "node:fs/promises";
@@ -232,4 +232,4 @@ async function walkDir(dir, depth, opts) {
232
232
  export {
233
233
  treeTool
234
234
  };
235
- //# sourceMappingURL=chunk-J5SKD6LN.js.map
235
+ //# sourceMappingURL=chunk-HWDB2G7J.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseGeneric
3
- } from "./chunk-A6BRWIXN.js";
3
+ } from "./chunk-6IEBD27U.js";
4
4
  import {
5
5
  parseParserOutput,
6
6
  withSpawnGate
@@ -382,4 +382,4 @@ export {
382
382
  parseSymbols,
383
383
  resolvePythonBinary
384
384
  };
385
- //# sourceMappingURL=chunk-ZLTFLC25.js.map
385
+ //# sourceMappingURL=chunk-IIF5HIVF.js.map
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-NBDZMMG2.js";
6
6
  import {
7
7
  truncateMiddle
8
- } from "./chunk-D33S4RQG.js";
8
+ } from "./chunk-QLF74MSV.js";
9
9
 
10
10
  // src/fetch.ts
11
11
  import { FetchError, ToolError, ToolValidationError } from "@wrongstack/core/types";
@@ -236,4 +236,4 @@ function prettyJson(s) {
236
236
  export {
237
237
  fetchTool
238
238
  };
239
- //# sourceMappingURL=chunk-UKGMDCXT.js.map
239
+ //# sourceMappingURL=chunk-KD5EHYA2.js.map
@@ -9,7 +9,7 @@ import {
9
9
  projectIndexServerBuildId,
10
10
  projectIndexServerEndpoint,
11
11
  projectIndexServerMetadataPath
12
- } from "./chunk-UOXX4SQZ.js";
12
+ } from "./chunk-W4GAAI3M.js";
13
13
  import {
14
14
  CircuitOpenError,
15
15
  IndexTimeoutError,
@@ -24,7 +24,7 @@ import {
24
24
  searchService,
25
25
  statsService,
26
26
  symbolGraphService
27
- } from "./chunk-TFEGJDH5.js";
27
+ } from "./chunk-TFMVHYJI.js";
28
28
  import {
29
29
  isIndexablePath
30
30
  } from "./chunk-YOHO4DVT.js";
@@ -1269,4 +1269,4 @@ export {
1269
1269
  checkCodebaseIndexServerHealth,
1270
1270
  ensureCodebaseIndexServer
1271
1271
  };
1272
- //# sourceMappingURL=chunk-A2PX7M7A.js.map
1272
+ //# sourceMappingURL=chunk-MRKWZCHZ.js.map
@@ -3,12 +3,12 @@ import {
3
3
  } from "./chunk-FQZOHLG3.js";
4
4
  import {
5
5
  enqueueReindex
6
- } from "./chunk-A2PX7M7A.js";
6
+ } from "./chunk-MRKWZCHZ.js";
7
7
  import {
8
8
  safeResolveReal,
9
9
  sha256hex,
10
10
  truncateDiffPayload
11
- } from "./chunk-D33S4RQG.js";
11
+ } from "./chunk-QLF74MSV.js";
12
12
 
13
13
  // src/write.ts
14
14
  import * as fs from "node:fs/promises";
@@ -155,4 +155,4 @@ async function finishWrite(input, ctx, prepared, signal) {
155
155
  export {
156
156
  writeTool
157
157
  };
158
- //# sourceMappingURL=chunk-BANPF4LY.js.map
158
+ //# sourceMappingURL=chunk-MYRMD6PZ.js.map
@@ -7,11 +7,11 @@ import {
7
7
  } from "./chunk-NWZ6XGBJ.js";
8
8
  import {
9
9
  loadGitignoreMatcher
10
- } from "./chunk-ELFFQ4RU.js";
10
+ } from "./chunk-DTQ75VBC.js";
11
11
  import {
12
12
  isBinaryBuffer,
13
13
  safeResolveReal
14
- } from "./chunk-D33S4RQG.js";
14
+ } from "./chunk-QLF74MSV.js";
15
15
 
16
16
  // src/grep.ts
17
17
  import { spawn } from "node:child_process";
@@ -476,4 +476,4 @@ export {
476
476
  grepTool,
477
477
  __resetRgDetectionForTests
478
478
  };
479
- //# sourceMappingURL=chunk-S2JRYDYG.js.map
479
+ //# sourceMappingURL=chunk-N5O3FK5Q.js.map
@@ -1,4 +1,6 @@
1
1
  // src/codebase-index/tree-sitter-parser.ts
2
+ import { createHash } from "node:crypto";
3
+ import { readFileSync } from "node:fs";
2
4
  import * as path from "node:path";
3
5
  import { fileURLToPath } from "node:url";
4
6
 
@@ -759,6 +761,43 @@ function emitSymbol(node, kind, file, lang, scopeStack, content, nlOffsets, quer
759
761
  // src/codebase-index/tree-sitter-parser.ts
760
762
  var WASM_DIR = fileURLToPath(new URL("./wasm/", import.meta.url));
761
763
  var RUNTIME_WASM = path.join(WASM_DIR, "tree-sitter-runtime.wasm");
764
+ var CHECKSUMS_PATH = path.join(WASM_DIR, "checksums.json");
765
+ var cachedChecksums;
766
+ function expectedChecksums() {
767
+ if (cachedChecksums !== void 0) return cachedChecksums;
768
+ try {
769
+ cachedChecksums = JSON.parse(readFileSync(CHECKSUMS_PATH, "utf8"));
770
+ } catch (err) {
771
+ if (err.code === "ENOENT") {
772
+ cachedChecksums = null;
773
+ } else {
774
+ console.error(
775
+ `[tree-sitter] grammar checksum manifest is unreadable (${CHECKSUMS_PATH}): ${err instanceof Error ? err.message : String(err)}. Treating as an integrity failure \u2014 tree-sitter grammars will not load.`
776
+ );
777
+ cachedChecksums = {};
778
+ }
779
+ }
780
+ return cachedChecksums;
781
+ }
782
+ function verifyWasmIntegrity(wasmPath) {
783
+ const manifest = expectedChecksums();
784
+ if (manifest === null) return;
785
+ const rel = path.relative(WASM_DIR, wasmPath).split(path.sep).join("/");
786
+ const expected = manifest[rel];
787
+ if (expected === void 0) {
788
+ console.error(
789
+ `[tree-sitter] grammar ${rel} is not pinned in checksums.json. Refusing to load; falling back to the regex parser. If this change is intentional, regenerate wasm/checksums.json via scripts/check-tree-sitter-wasm.mjs --write and review the diff.`
790
+ );
791
+ throw new Error(`tree-sitter grammar not pinned: ${rel}`);
792
+ }
793
+ const actual = createHash("sha256").update(readFileSync(wasmPath)).digest("hex");
794
+ if (actual !== expected) {
795
+ console.error(
796
+ `[tree-sitter] grammar integrity FAILED for ${rel}: expected sha256 ${expected}, found ${actual}. Refusing to load; falling back to the regex parser. If this change is intentional, regenerate wasm/checksums.json via scripts/check-tree-sitter-wasm.mjs --write and review the diff.`
797
+ );
798
+ throw new Error(`tree-sitter grammar integrity failure: ${rel}`);
799
+ }
800
+ }
762
801
  var LANG_TO_GRAMMAR = {
763
802
  c: "c",
764
803
  cpp: "cpp",
@@ -786,7 +825,10 @@ function getRuntime() {
786
825
  if (!runtimePromise) {
787
826
  runtimePromise = (async () => {
788
827
  const mod = await import("web-tree-sitter");
789
- const init = () => mod.Parser.init({ locateFile: () => RUNTIME_WASM });
828
+ const init = () => {
829
+ verifyWasmIntegrity(RUNTIME_WASM);
830
+ return mod.Parser.init({ locateFile: () => RUNTIME_WASM });
831
+ };
790
832
  return { Parser: mod.Parser, Language: mod.Language, init };
791
833
  })();
792
834
  }
@@ -803,6 +845,7 @@ async function loadLanguage(lang) {
803
845
  const wasmPath = path.join(WASM_DIR, grammarName, `tree-sitter-${grammarName}.wasm`);
804
846
  const { Language, init } = await getRuntime();
805
847
  await init();
848
+ verifyWasmIntegrity(wasmPath);
806
849
  const languageObj = await Language.load(wasmPath);
807
850
  return { lang, Language: languageObj };
808
851
  })();
@@ -874,6 +917,7 @@ async function parseTreeSitterAst(opts) {
874
917
  const { Parser, Language, init } = await getRuntime();
875
918
  await init();
876
919
  const wasmPath = path.join(WASM_DIR, grammar, `tree-sitter-${grammar}.wasm`);
920
+ verifyWasmIntegrity(wasmPath);
877
921
  const languageObj = await Language.load(wasmPath);
878
922
  const parser = new Parser();
879
923
  parser.setLanguage(languageObj);
@@ -895,4 +939,4 @@ export {
895
939
  __smokeRootType,
896
940
  parseTreeSitterAst
897
941
  };
898
- //# sourceMappingURL=chunk-EEOFQDT6.js.map
942
+ //# sourceMappingURL=chunk-OCUXN6Y3.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
3
- } from "./chunk-4E42D7UF.js";
3
+ } from "./chunk-ZDUGI5BC.js";
4
4
  import {
5
5
  spawnStream
6
6
  } from "./chunk-ZHH3BEWU.js";
7
7
  import {
8
8
  normalizeCommandOutput,
9
9
  safeResolveReal
10
- } from "./chunk-D33S4RQG.js";
10
+ } from "./chunk-QLF74MSV.js";
11
11
 
12
12
  // src/format.ts
13
13
  var formatTool = {
@@ -176,4 +176,4 @@ async function detectFixer(cwd) {
176
176
  export {
177
177
  formatTool
178
178
  };
179
- //# sourceMappingURL=chunk-3QQSBUXR.js.map
179
+ //# sourceMappingURL=chunk-ODFVG54U.js.map
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-NWZ6XGBJ.js";
4
4
  import {
5
5
  loadGitignoreMatcher
6
- } from "./chunk-ELFFQ4RU.js";
6
+ } from "./chunk-DTQ75VBC.js";
7
7
  import {
8
8
  assertRealInsideRoot,
9
9
  safeResolveReal
10
- } from "./chunk-D33S4RQG.js";
10
+ } from "./chunk-QLF74MSV.js";
11
11
 
12
12
  // src/glob.ts
13
13
  import * as fs from "node:fs/promises";
@@ -151,4 +151,4 @@ var globTool = {
151
151
  export {
152
152
  globTool
153
153
  };
154
- //# sourceMappingURL=chunk-ICAXDRP6.js.map
154
+ //# sourceMappingURL=chunk-OJ4FIBAN.js.map
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-Q5JPPCZC.js";
4
4
  import {
5
5
  enqueueReindex
6
- } from "./chunk-A2PX7M7A.js";
6
+ } from "./chunk-MRKWZCHZ.js";
7
7
  import {
8
8
  isBinaryBuffer,
9
9
  safeResolveReal,
10
10
  sha256hex,
11
11
  truncateDiffPayload
12
- } from "./chunk-D33S4RQG.js";
12
+ } from "./chunk-QLF74MSV.js";
13
13
 
14
14
  // src/replace.ts
15
15
  import { spawn } from "node:child_process";
@@ -374,4 +374,4 @@ export {
374
374
  replaceTool,
375
375
  __resetRgDetectionForTests
376
376
  };
377
- //# sourceMappingURL=chunk-6RR5VX6U.js.map
377
+ //# sourceMappingURL=chunk-OYVPBPCL.js.map