@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
package/dist/index.js CHANGED
@@ -46,10 +46,10 @@ import "./chunk-Z6DAKQ3U.js";
46
46
  import {
47
47
  registerBuiltinToolTier,
48
48
  selectBuiltinToolsForTier
49
- } from "./chunk-V25Q6TQ7.js";
49
+ } from "./chunk-K3VX6V5P.js";
50
50
  import {
51
51
  builtinToolsPack
52
- } from "./chunk-FVSMTEO3.js";
52
+ } from "./chunk-VMNWQI4V.js";
53
53
  import {
54
54
  OFF_ONLY_TOOLS,
55
55
  OPTIONAL_TOOLS,
@@ -64,7 +64,7 @@ import {
64
64
  pwshTool,
65
65
  readUrlContentTool,
66
66
  securityAstScanTool
67
- } from "./chunk-6I6RXQFG.js";
67
+ } from "./chunk-2BCRQAIW.js";
68
68
  import {
69
69
  discoverE2EProjects,
70
70
  e2ePlanTool
@@ -98,8 +98,8 @@ import {
98
98
  runDeadCodeScan,
99
99
  setContextQueryEmbedder,
100
100
  writeProjectAtlas
101
- } from "./chunk-ENE22I5W.js";
102
- import "./chunk-XRNN44QY.js";
101
+ } from "./chunk-K37AKCTN.js";
102
+ import "./chunk-2IRHFHZY.js";
103
103
  import {
104
104
  designTool
105
105
  } from "./chunk-MRXWOOOR.js";
@@ -111,7 +111,7 @@ import {
111
111
  } from "./chunk-OKZJJDOG.js";
112
112
  import {
113
113
  testTool
114
- } from "./chunk-OUERRFEM.js";
114
+ } from "./chunk-OMQDKZOT.js";
115
115
  import {
116
116
  installTool
117
117
  } from "./chunk-ULI2J6TX.js";
@@ -131,7 +131,7 @@ import {
131
131
  } from "./chunk-SPNXDTCJ.js";
132
132
  import {
133
133
  patchTool
134
- } from "./chunk-2UVAIS5O.js";
134
+ } from "./chunk-YPSVPCIE.js";
135
135
  import {
136
136
  jsonTool
137
137
  } from "./chunk-D6RQZMZS.js";
@@ -151,7 +151,7 @@ import {
151
151
  } from "./chunk-4SUGLJLO.js";
152
152
  import {
153
153
  typecheckTool
154
- } from "./chunk-5RBUYFRV.js";
154
+ } from "./chunk-4IMNVQRB.js";
155
155
  import "./chunk-E7A4SLKR.js";
156
156
  import {
157
157
  ADDITIONAL_LANGUAGE_PROFILES,
@@ -174,7 +174,7 @@ import {
174
174
  import "./chunk-UVYRQKPZ.js";
175
175
  import {
176
176
  replaceTool
177
- } from "./chunk-C6ZOXNXV.js";
177
+ } from "./chunk-CSS42GRP.js";
178
178
  import {
179
179
  globTool
180
180
  } from "./chunk-ON6ET5ER.js";
@@ -284,13 +284,13 @@ import {
284
284
  } from "./chunk-O2MHULBO.js";
285
285
  import {
286
286
  readTool
287
- } from "./chunk-IE4KDAOB.js";
287
+ } from "./chunk-OYQE2UNT.js";
288
288
  import {
289
289
  writeTool
290
- } from "./chunk-PWZUHZP7.js";
290
+ } from "./chunk-Z77XMU3U.js";
291
291
  import {
292
292
  editTool
293
- } from "./chunk-7GOE2ZTZ.js";
293
+ } from "./chunk-OMWC2OGT.js";
294
294
  import {
295
295
  checkSyntax
296
296
  } from "./chunk-MSOAX3GC.js";
@@ -313,8 +313,8 @@ import {
313
313
  shutdownCodebaseIndexHost,
314
314
  shutdownCodebaseIndexServer,
315
315
  symbolGraphService
316
- } from "./chunk-HYHE4VNA.js";
317
- import "./chunk-XPVYZ2S6.js";
316
+ } from "./chunk-UMOP3VGK.js";
317
+ import "./chunk-RYLMSGR5.js";
318
318
  import {
319
319
  CONCEPT_RELATIONS,
320
320
  CircuitOpenError,
@@ -322,11 +322,11 @@ import {
322
322
  IndexTimeoutError,
323
323
  indexCircuitBreaker,
324
324
  resetIndexCircuitBreaker
325
- } from "./chunk-NEYUPZL6.js";
326
- import "./chunk-KHUCKLOR.js";
327
- import "./chunk-4CE3RKEP.js";
328
- import "./chunk-SKRMUHTU.js";
329
- import "./chunk-ZKC5UNGD.js";
325
+ } from "./chunk-6D3UIQMF.js";
326
+ import "./chunk-BJ5LXLKE.js";
327
+ import "./chunk-R3HR3QI3.js";
328
+ import "./chunk-HSLDY55L.js";
329
+ import "./chunk-OIFY4XNP.js";
330
330
  import "./chunk-YOHO4DVT.js";
331
331
  import "./chunk-XHSHNOAF.js";
332
332
  import "./chunk-XZLVJD56.js";
@@ -0,0 +1,204 @@
1
+ import {
2
+ detectLang
3
+ } from "./chunk-YOHO4DVT.js";
4
+
5
+ // src/codebase-index/json-parser.ts
6
+ import { expectDefined } from "@wrongstack/core/utils";
7
+ import * as path from "node:path";
8
+ var JSON_MAX_SYMBOLS_DEFAULT = 1e3;
9
+ function parseSymbols(opts) {
10
+ const { file, content, lang } = opts;
11
+ try {
12
+ return scanParse({ file, content, lang, maxSymbols: opts.maxSymbols });
13
+ } catch {
14
+ return { file, lang, symbols: [], mtimeMs: Date.now() };
15
+ }
16
+ }
17
+ function skipTrivia(content, from) {
18
+ let i = from;
19
+ while (i < content.length) {
20
+ const ch = content[i];
21
+ if (ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\uFEFF") {
22
+ i++;
23
+ continue;
24
+ }
25
+ if (ch === "/" && content[i + 1] === "/") {
26
+ const newline = content.indexOf("\n", i);
27
+ i = newline === -1 ? content.length : newline + 1;
28
+ continue;
29
+ }
30
+ if (ch === "/" && content[i + 1] === "*") {
31
+ const end = content.indexOf("*/", i + 2);
32
+ i = end === -1 ? content.length : end + 2;
33
+ continue;
34
+ }
35
+ break;
36
+ }
37
+ return i;
38
+ }
39
+ function objectKeys(content, open) {
40
+ const keys = [];
41
+ let depth = 0;
42
+ for (let i = open; i < content.length; i++) {
43
+ const ch = content[i];
44
+ if (ch === '"') {
45
+ let j = i + 1;
46
+ while (j < content.length && content[j] !== '"') {
47
+ if (content[j] === "\\") j++;
48
+ j++;
49
+ }
50
+ if (j >= content.length) break;
51
+ if (depth === 1) {
52
+ const colon = skipTrivia(content, j + 1);
53
+ if (content[colon] === ":") {
54
+ keys.push({
55
+ key: content.slice(i + 1, j),
56
+ offset: i,
57
+ valueStart: skipTrivia(content, colon + 1)
58
+ });
59
+ }
60
+ }
61
+ i = j;
62
+ continue;
63
+ }
64
+ if (ch === "/" && (content[i + 1] === "/" || content[i + 1] === "*")) {
65
+ i = skipTrivia(content, i) - 1;
66
+ continue;
67
+ }
68
+ if (ch === "{" || ch === "[") {
69
+ depth++;
70
+ } else if (ch === "}" || ch === "]") {
71
+ depth--;
72
+ if (depth === 0) break;
73
+ }
74
+ }
75
+ return keys;
76
+ }
77
+ var DEFINITION_CONTAINERS = /* @__PURE__ */ new Set(["$defs", "definitions", "schemas"]);
78
+ var BLOCK_CONTAINERS = /* @__PURE__ */ new Set([...DEFINITION_CONTAINERS, "components"]);
79
+ var DEFINITION_SEARCH_DEPTH = 4;
80
+ function scanParse(opts) {
81
+ const { file, content, lang } = opts;
82
+ const maxSymbols = opts.maxSymbols ?? JSON_MAX_SYMBOLS_DEFAULT;
83
+ const symbols = [];
84
+ const basename2 = path.basename(file).toLowerCase();
85
+ const isPackageJson = basename2 === "package.json";
86
+ const isTsconfig = basename2 === "tsconfig.json" || basename2 === "tsconfig.build.json";
87
+ const isJsonSchema = content.includes("$schema") || content.includes("$id") || content.includes("$ref") || content.includes("$defs");
88
+ const isOpenApi = content.includes("openapi") || content.includes("swagger");
89
+ const lines = content.split("\n");
90
+ const lineOffsets = [0];
91
+ for (let i = 0; i < lines.length; i++) {
92
+ lineOffsets.push((lineOffsets[i] ?? 0) + (lines[i]?.length ?? 0) + 1);
93
+ }
94
+ function lineFromOffset(offset) {
95
+ let lo = 0;
96
+ let hi = lineOffsets.length - 1;
97
+ while (lo < hi) {
98
+ const mid = lo + hi + 1 >>> 1;
99
+ if (expectDefined(lineOffsets[mid]) <= offset) lo = mid;
100
+ else hi = mid - 1;
101
+ }
102
+ return lo + 1;
103
+ }
104
+ const push = (name, kind, offset, signature) => {
105
+ if (symbols.length >= maxSymbols) return;
106
+ const line = lineFromOffset(offset);
107
+ symbols.push(
108
+ makeSymbol({
109
+ name,
110
+ kind,
111
+ line,
112
+ col: offset - (lineOffsets[line - 1] ?? 0),
113
+ signature,
114
+ file,
115
+ lang
116
+ })
117
+ );
118
+ };
119
+ const rootOpen = skipTrivia(content, 0);
120
+ if (content[rootOpen] !== "{") {
121
+ return { file, lang, symbols, mtimeMs: Date.now() };
122
+ }
123
+ const rootLine = lineFromOffset(rootOpen);
124
+ symbols.push(
125
+ makeSymbol({
126
+ name: path.basename(file),
127
+ kind: "object",
128
+ line: rootLine,
129
+ col: 0,
130
+ signature: `"${path.basename(file)}" = { ... }`,
131
+ file,
132
+ lang
133
+ })
134
+ );
135
+ for (const { key, offset, valueStart } of objectKeys(content, rootOpen)) {
136
+ if (symbols.length >= maxSymbols) break;
137
+ let kind = "property";
138
+ let signature = `"${key}": ...`;
139
+ if (isPackageJson) {
140
+ if (key === "scripts" || key === "dependencies" || key === "devDependencies" || key === "peerDependencies" || key === "optionalDependencies") {
141
+ kind = "const";
142
+ signature = `"${key}": { ... }`;
143
+ }
144
+ } else if (isTsconfig && key === "compilerOptions") {
145
+ signature = `"compilerOptions": { ... }`;
146
+ }
147
+ if ((isJsonSchema || isOpenApi) && (key === "$schema" || key === "$id" || key === "$ref")) {
148
+ kind = "schema";
149
+ signature = `"${key}": "..."`;
150
+ }
151
+ push(key, kind, offset, signature);
152
+ const objectValue = content[valueStart] === "{";
153
+ if (isPackageJson && key === "scripts" && objectValue) {
154
+ for (const script of objectKeys(content, valueStart)) {
155
+ push(script.key, "function", script.offset, `"${script.key}": "..."`);
156
+ }
157
+ }
158
+ if (isTsconfig && key === "compilerOptions" && objectValue) {
159
+ for (const option of objectKeys(content, valueStart)) {
160
+ push(option.key, "property", option.offset, `"${option.key}": ...`);
161
+ }
162
+ }
163
+ }
164
+ if (isJsonSchema || isOpenApi) {
165
+ const visit = (open, depth) => {
166
+ for (const entry of objectKeys(content, open)) {
167
+ if (symbols.length >= maxSymbols) return;
168
+ if (content[entry.valueStart] !== "{") continue;
169
+ if (BLOCK_CONTAINERS.has(entry.key)) {
170
+ push(entry.key, "property", entry.offset, `"${entry.key}": { ... }`);
171
+ }
172
+ if (DEFINITION_CONTAINERS.has(entry.key)) {
173
+ for (const definition of objectKeys(content, entry.valueStart)) {
174
+ push(definition.key, "schema", definition.offset, `"${definition.key}": { ... }`);
175
+ }
176
+ }
177
+ if (depth < DEFINITION_SEARCH_DEPTH) visit(entry.valueStart, depth + 1);
178
+ }
179
+ };
180
+ visit(rootOpen, 0);
181
+ }
182
+ return { file, lang, symbols, mtimeMs: Date.now() };
183
+ }
184
+ function makeSymbol(opts) {
185
+ return {
186
+ id: 0,
187
+ lang: opts.lang,
188
+ kind: opts.kind,
189
+ name: opts.name,
190
+ file: opts.file,
191
+ line: opts.line,
192
+ col: opts.col,
193
+ signature: opts.signature,
194
+ docComment: "",
195
+ scope: "",
196
+ text: `${opts.name} ${opts.signature}`.trim()
197
+ };
198
+ }
199
+ export {
200
+ JSON_MAX_SYMBOLS_DEFAULT,
201
+ detectLang,
202
+ parseSymbols
203
+ };
204
+ //# sourceMappingURL=json-parser-PERV2JHX.js.map
package/dist/pack.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  builtinToolsPack
3
- } from "./chunk-FVSMTEO3.js";
4
- import "./chunk-6I6RXQFG.js";
3
+ } from "./chunk-VMNWQI4V.js";
4
+ import "./chunk-2BCRQAIW.js";
5
5
  import "./chunk-BVHKBBGA.js";
6
- import "./chunk-ENE22I5W.js";
7
- import "./chunk-XRNN44QY.js";
6
+ import "./chunk-K37AKCTN.js";
7
+ import "./chunk-2IRHFHZY.js";
8
8
  import "./chunk-MRXWOOOR.js";
9
9
  import "./chunk-7V33PHT6.js";
10
10
  import "./chunk-OKZJJDOG.js";
11
- import "./chunk-OUERRFEM.js";
11
+ import "./chunk-OMQDKZOT.js";
12
12
  import "./chunk-ULI2J6TX.js";
13
13
  import "./chunk-YKSOSI2N.js";
14
14
  import "./chunk-DOAHONOS.js";
@@ -16,17 +16,17 @@ import "./chunk-C3WP6ZOT.js";
16
16
  import "./chunk-JPK2HHBK.js";
17
17
  import "./chunk-KS2OEZWV.js";
18
18
  import "./chunk-SPNXDTCJ.js";
19
- import "./chunk-2UVAIS5O.js";
19
+ import "./chunk-YPSVPCIE.js";
20
20
  import "./chunk-D6RQZMZS.js";
21
21
  import "./chunk-2OCAAFAT.js";
22
22
  import "./chunk-M4ZHHCCW.js";
23
23
  import "./chunk-KPDCKSN5.js";
24
24
  import "./chunk-4SUGLJLO.js";
25
- import "./chunk-5RBUYFRV.js";
25
+ import "./chunk-4IMNVQRB.js";
26
26
  import "./chunk-E7A4SLKR.js";
27
27
  import "./chunk-G7CYW5EP.js";
28
28
  import "./chunk-UVYRQKPZ.js";
29
- import "./chunk-C6ZOXNXV.js";
29
+ import "./chunk-CSS42GRP.js";
30
30
  import "./chunk-ON6ET5ER.js";
31
31
  import "./chunk-DLZCOEVG.js";
32
32
  import "./chunk-YJTXRH5Y.js";
@@ -45,17 +45,17 @@ import "./chunk-DBG7UQGK.js";
45
45
  import "./chunk-VMJY6FYJ.js";
46
46
  import "./chunk-YZECCW3F.js";
47
47
  import "./chunk-O2MHULBO.js";
48
- import "./chunk-IE4KDAOB.js";
49
- import "./chunk-PWZUHZP7.js";
50
- import "./chunk-7GOE2ZTZ.js";
48
+ import "./chunk-OYQE2UNT.js";
49
+ import "./chunk-Z77XMU3U.js";
50
+ import "./chunk-OMWC2OGT.js";
51
51
  import "./chunk-MSOAX3GC.js";
52
- import "./chunk-HYHE4VNA.js";
53
- import "./chunk-XPVYZ2S6.js";
54
- import "./chunk-NEYUPZL6.js";
55
- import "./chunk-KHUCKLOR.js";
56
- import "./chunk-4CE3RKEP.js";
57
- import "./chunk-SKRMUHTU.js";
58
- import "./chunk-ZKC5UNGD.js";
52
+ import "./chunk-UMOP3VGK.js";
53
+ import "./chunk-RYLMSGR5.js";
54
+ import "./chunk-6D3UIQMF.js";
55
+ import "./chunk-BJ5LXLKE.js";
56
+ import "./chunk-R3HR3QI3.js";
57
+ import "./chunk-HSLDY55L.js";
58
+ import "./chunk-OIFY4XNP.js";
59
59
  import "./chunk-YOHO4DVT.js";
60
60
  import "./chunk-XHSHNOAF.js";
61
61
  import "./chunk-XZLVJD56.js";
@@ -0,0 +1,14 @@
1
+ import {
2
+ parseFileContent,
3
+ parseFilesContent
4
+ } from "./chunk-BJ5LXLKE.js";
5
+ import "./chunk-R3HR3QI3.js";
6
+ import "./chunk-HSLDY55L.js";
7
+ import "./chunk-OIFY4XNP.js";
8
+ import "./chunk-YOHO4DVT.js";
9
+ import "./chunk-XZLVJD56.js";
10
+ export {
11
+ parseFileContent,
12
+ parseFilesContent
13
+ };
14
+ //# sourceMappingURL=parser-dispatch-ZSWCQB6M.js.map
package/dist/patch.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  patchTool
3
- } from "./chunk-2UVAIS5O.js";
4
- import "./chunk-HYHE4VNA.js";
5
- import "./chunk-XPVYZ2S6.js";
6
- import "./chunk-NEYUPZL6.js";
7
- import "./chunk-KHUCKLOR.js";
8
- import "./chunk-4CE3RKEP.js";
9
- import "./chunk-SKRMUHTU.js";
10
- import "./chunk-ZKC5UNGD.js";
3
+ } from "./chunk-YPSVPCIE.js";
4
+ import "./chunk-UMOP3VGK.js";
5
+ import "./chunk-RYLMSGR5.js";
6
+ import "./chunk-6D3UIQMF.js";
7
+ import "./chunk-BJ5LXLKE.js";
8
+ import "./chunk-R3HR3QI3.js";
9
+ import "./chunk-HSLDY55L.js";
10
+ import "./chunk-OIFY4XNP.js";
11
11
  import "./chunk-YOHO4DVT.js";
12
12
  import "./chunk-XHSHNOAF.js";
13
13
  import "./chunk-XZLVJD56.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSymbols,
3
3
  resolvePythonBinary
4
- } from "./chunk-4CE3RKEP.js";
5
- import "./chunk-SKRMUHTU.js";
6
- import "./chunk-ZKC5UNGD.js";
4
+ } from "./chunk-R3HR3QI3.js";
5
+ import "./chunk-HSLDY55L.js";
6
+ import "./chunk-OIFY4XNP.js";
7
7
  import {
8
8
  detectLang
9
9
  } from "./chunk-YOHO4DVT.js";
@@ -13,4 +13,4 @@ export {
13
13
  parseSymbols,
14
14
  resolvePythonBinary
15
15
  };
16
- //# sourceMappingURL=py-parser-4PFZYAJ7.js.map
16
+ //# sourceMappingURL=py-parser-B6D6RGH7.js.map
package/dist/read.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  readTool
3
- } from "./chunk-IE4KDAOB.js";
4
- import "./chunk-HYHE4VNA.js";
5
- import "./chunk-XPVYZ2S6.js";
6
- import "./chunk-NEYUPZL6.js";
7
- import "./chunk-KHUCKLOR.js";
8
- import "./chunk-4CE3RKEP.js";
9
- import "./chunk-SKRMUHTU.js";
10
- import "./chunk-ZKC5UNGD.js";
3
+ } from "./chunk-OYQE2UNT.js";
4
+ import "./chunk-UMOP3VGK.js";
5
+ import "./chunk-RYLMSGR5.js";
6
+ import "./chunk-6D3UIQMF.js";
7
+ import "./chunk-BJ5LXLKE.js";
8
+ import "./chunk-R3HR3QI3.js";
9
+ import "./chunk-HSLDY55L.js";
10
+ import "./chunk-OIFY4XNP.js";
11
11
  import "./chunk-YOHO4DVT.js";
12
12
  import "./chunk-XHSHNOAF.js";
13
13
  import "./chunk-XZLVJD56.js";
package/dist/replace.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  __resetRgDetectionForTests,
3
3
  replaceTool
4
- } from "./chunk-C6ZOXNXV.js";
4
+ } from "./chunk-CSS42GRP.js";
5
5
  import "./chunk-YJTXRH5Y.js";
6
6
  import "./chunk-ZBMANLYH.js";
7
- import "./chunk-HYHE4VNA.js";
8
- import "./chunk-XPVYZ2S6.js";
9
- import "./chunk-NEYUPZL6.js";
10
- import "./chunk-KHUCKLOR.js";
11
- import "./chunk-4CE3RKEP.js";
12
- import "./chunk-SKRMUHTU.js";
13
- import "./chunk-ZKC5UNGD.js";
7
+ import "./chunk-UMOP3VGK.js";
8
+ import "./chunk-RYLMSGR5.js";
9
+ import "./chunk-6D3UIQMF.js";
10
+ import "./chunk-BJ5LXLKE.js";
11
+ import "./chunk-R3HR3QI3.js";
12
+ import "./chunk-HSLDY55L.js";
13
+ import "./chunk-OIFY4XNP.js";
14
14
  import "./chunk-YOHO4DVT.js";
15
15
  import "./chunk-XHSHNOAF.js";
16
16
  import "./chunk-XZLVJD56.js";
@@ -0,0 +1,182 @@
1
+ import {
2
+ detectLang
3
+ } from "./chunk-YOHO4DVT.js";
4
+
5
+ // src/codebase-index/rs-parser.ts
6
+ import { expectDefined } from "@wrongstack/core/utils";
7
+ async function parseSymbols(opts) {
8
+ const { file, content, lang } = opts;
9
+ return regexParse({ file, content, lang });
10
+ }
11
+ var RS_PATTERNS = [
12
+ { regex: /\bfn\s+(\w+)\s*[<(]/dg, kind: "function" },
13
+ { regex: /\bstruct\s+(\w+)/dg, kind: "struct" },
14
+ { regex: /\benum\s+(\w+)/dg, kind: "enum" },
15
+ { regex: /\btrait\s+(\w+)/dg, kind: "trait" },
16
+ {
17
+ // Item position only (line start, optional `unsafe`); generic parameter
18
+ // lists may nest one level (`impl<T: Into<String>> Foo`).
19
+ regex: /^[ \t]*(?:unsafe\s+)?impl\b\s*(?:<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?\s*(?:[\w]+::)*(\w+)/dgm,
20
+ kind: "impl"
21
+ },
22
+ { regex: /\btype\s+(\w+)\s*(?:<[^=;]*>)?\s*=/dg, kind: "type" },
23
+ { regex: /(?<![\w'])const\s+(?!(?:fn|unsafe|extern|async)\b)(\w+)\s*:/dg, kind: "const" },
24
+ { regex: /(?<![\w'])static\s+(?:mut\s+)?(\w+)\s*:/dg, kind: "static" },
25
+ { regex: /\bmod\s+(\w+)\s*[;{]/dg, kind: "mod" }
26
+ ];
27
+ function maskRustNonCode(src) {
28
+ const blank = (text) => text.replace(/[^\n]/g, " ");
29
+ let out = "";
30
+ let i = 0;
31
+ const n = src.length;
32
+ while (i < n) {
33
+ const c = src[i];
34
+ const next = src[i + 1];
35
+ if (c === "/" && next === "/") {
36
+ const newline = src.indexOf("\n", i);
37
+ const stop = newline === -1 ? n : newline;
38
+ out += blank(src.slice(i, stop));
39
+ i = stop;
40
+ continue;
41
+ }
42
+ if (c === "/" && next === "*") {
43
+ let depth = 1;
44
+ let j = i + 2;
45
+ while (j < n && depth > 0) {
46
+ if (src[j] === "/" && src[j + 1] === "*") {
47
+ depth++;
48
+ j += 2;
49
+ } else if (src[j] === "*" && src[j + 1] === "/") {
50
+ depth--;
51
+ j += 2;
52
+ } else {
53
+ j++;
54
+ }
55
+ }
56
+ out += blank(src.slice(i, j));
57
+ i = j;
58
+ continue;
59
+ }
60
+ const prev = src[i - 1] ?? "";
61
+ const rawPrefixOk = !/\w/.test(prev) || prev === "b" && !/\w/.test(src[i - 2] ?? "");
62
+ if (c === "r" && (next === '"' || next === "#") && rawPrefixOk) {
63
+ let j = i + 1;
64
+ let hashes = 0;
65
+ while (src[j] === "#") {
66
+ hashes++;
67
+ j++;
68
+ }
69
+ if (src[j] === '"') {
70
+ const closer = `"${"#".repeat(hashes)}`;
71
+ const end = src.indexOf(closer, j + 1);
72
+ const stop = end === -1 ? n : end + closer.length;
73
+ out += `r${blank(src.slice(i + 1, stop))}`;
74
+ i = stop;
75
+ continue;
76
+ }
77
+ }
78
+ if (c === '"') {
79
+ let j = i + 1;
80
+ while (j < n && src[j] !== '"') j += src[j] === "\\" ? 2 : 1;
81
+ if (j >= n) {
82
+ out += `"${blank(src.slice(i + 1, n))}`;
83
+ i = n;
84
+ } else {
85
+ out += `"${blank(src.slice(i + 1, j))}"`;
86
+ i = j + 1;
87
+ }
88
+ continue;
89
+ }
90
+ if (c === "'") {
91
+ let end = -1;
92
+ if (next === "\\") {
93
+ const close = src.indexOf("'", i + 2);
94
+ if (close !== -1 && close - i <= 12) end = close;
95
+ } else if (next !== void 0) {
96
+ const width = (src.codePointAt(i + 1) ?? 0) > 65535 ? 2 : 1;
97
+ if (src[i + 1 + width] === "'") end = i + 1 + width;
98
+ }
99
+ if (end !== -1) {
100
+ out += `'${blank(src.slice(i + 1, end))}'`;
101
+ i = end + 1;
102
+ continue;
103
+ }
104
+ }
105
+ out += c;
106
+ i++;
107
+ }
108
+ return out;
109
+ }
110
+ function rustDocAbove(lines, lineIdx) {
111
+ const doc = [];
112
+ for (let i = lineIdx - 1; i >= 0; i--) {
113
+ const trimmed = (lines[i] ?? "").trim();
114
+ if (trimmed.startsWith("///")) doc.unshift(trimmed.slice(3).trim());
115
+ else if (trimmed.startsWith("#[")) continue;
116
+ else break;
117
+ }
118
+ return (doc.find((line) => line.length > 0) ?? "").slice(0, 200);
119
+ }
120
+ function regexParse(opts) {
121
+ const { file, content, lang } = opts;
122
+ const symbols = [];
123
+ const lines = content.split("\n");
124
+ const code = maskRustNonCode(content);
125
+ const lineOffsets = [0];
126
+ for (let i = 0; i < lines.length; i++) {
127
+ lineOffsets.push((lineOffsets[i] ?? 0) + (lines[i]?.length ?? 0) + 1);
128
+ }
129
+ function lineFromOffset(offset) {
130
+ let lo = 0;
131
+ let hi = lineOffsets.length - 1;
132
+ while (lo < hi) {
133
+ const mid = lo + hi + 1 >>> 1;
134
+ if (expectDefined(lineOffsets[mid]) <= offset) lo = mid;
135
+ else hi = mid - 1;
136
+ }
137
+ return lo + 1;
138
+ }
139
+ function extractDeclaration(lineIdx, _match) {
140
+ const line = lines[lineIdx] ?? "";
141
+ return line.trim().slice(0, 500);
142
+ }
143
+ for (const pattern of RS_PATTERNS) {
144
+ pattern.regex.lastIndex = 0;
145
+ for (let match = pattern.regex.exec(code); match !== null; match = pattern.regex.exec(code)) {
146
+ const name = expectDefined(match[1]);
147
+ const offset = match.indices?.[1]?.[0] ?? match.index ?? 0;
148
+ const line = lineFromOffset(offset);
149
+ const col = offset - (lineOffsets[line - 1] ?? 0);
150
+ const lineIdx = line - 1;
151
+ const signature = extractDeclaration(lineIdx, match);
152
+ const docComment = rustDocAbove(lines, lineIdx);
153
+ symbols.push({
154
+ id: 0,
155
+ lang,
156
+ kind: pattern.kind,
157
+ name,
158
+ file,
159
+ line,
160
+ col,
161
+ signature,
162
+ docComment,
163
+ scope: "",
164
+ text: [name, signature, docComment].filter(Boolean).join(" ").trim()
165
+ });
166
+ }
167
+ }
168
+ const seen = /* @__PURE__ */ new Set();
169
+ const deduped = symbols.filter((s) => {
170
+ const key = `${s.name}:${s.line}`;
171
+ if (seen.has(key)) return false;
172
+ seen.add(key);
173
+ return true;
174
+ });
175
+ return { file, lang, symbols: deduped, mtimeMs: Date.now() };
176
+ }
177
+ export {
178
+ detectLang,
179
+ maskRustNonCode,
180
+ parseSymbols
181
+ };
182
+ //# sourceMappingURL=rs-parser-L7SP4GWJ.js.map
package/dist/test.d.ts CHANGED
@@ -3,6 +3,7 @@ export type TestRunnerName = 'vitest' | 'jest' | 'mocha' | 'auto';
3
3
  export interface TestInput {
4
4
  files?: string | string[] | undefined;
5
5
  runner?: TestRunnerName | undefined;
6
+ /** @deprecated Ignored — a watch-mode runner never exits inside a tool call. */
6
7
  watch?: boolean | undefined;
7
8
  coverage?: boolean | undefined;
8
9
  cwd?: string | undefined;