@wrongstack/tools 0.284.1 → 0.286.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 (330) hide show
  1. package/README.md +19 -0
  2. package/dist/_concurrency.d.ts +16 -0
  3. package/dist/_concurrency.d.ts.map +1 -0
  4. package/dist/_danger-detect.d.ts +54 -0
  5. package/dist/_danger-detect.d.ts.map +1 -0
  6. package/dist/_edit-match.d.ts +86 -0
  7. package/dist/_edit-match.d.ts.map +1 -0
  8. package/dist/_env.d.ts +6 -0
  9. package/dist/_env.d.ts.map +1 -0
  10. package/dist/_fetch-guard.d.ts +31 -0
  11. package/dist/_fetch-guard.d.ts.map +1 -0
  12. package/dist/_output-spool.d.ts +38 -0
  13. package/dist/_output-spool.d.ts.map +1 -0
  14. package/dist/_redact-command.d.ts +6 -0
  15. package/dist/_redact-command.d.ts.map +1 -0
  16. package/dist/_regex.d.ts +39 -0
  17. package/dist/_regex.d.ts.map +1 -0
  18. package/dist/_session-shell.d.ts +73 -0
  19. package/dist/_session-shell.d.ts.map +1 -0
  20. package/dist/_shell-pick.d.ts +158 -0
  21. package/dist/_shell-pick.d.ts.map +1 -0
  22. package/dist/_spawn-stream.d.ts +32 -0
  23. package/dist/_spawn-stream.d.ts.map +1 -0
  24. package/dist/_syntax-check.d.ts +16 -0
  25. package/dist/_syntax-check.d.ts.map +1 -0
  26. package/dist/_util.d.ts +68 -0
  27. package/dist/_util.d.ts.map +1 -0
  28. package/dist/_win32-resolve.d.ts +42 -0
  29. package/dist/_win32-resolve.d.ts.map +1 -0
  30. package/dist/audit.d.ts +4 -5
  31. package/dist/audit.d.ts.map +1 -0
  32. package/dist/audit.js +2743 -28
  33. package/dist/audit.js.map +7 -1
  34. package/dist/bash-kill-guard.d.ts +62 -0
  35. package/dist/bash-kill-guard.d.ts.map +1 -0
  36. package/dist/bash.d.ts +4 -5
  37. package/dist/bash.d.ts.map +1 -0
  38. package/dist/bash.js +59 -30
  39. package/dist/bash.js.map +7 -1
  40. package/dist/batch-tool-use.d.ts +4 -5
  41. package/dist/batch-tool-use.d.ts.map +1 -0
  42. package/dist/batch-tool-use.js +3 -3
  43. package/dist/batch-tool-use.js.map +7 -1
  44. package/dist/browser/artifacts.d.ts +13 -0
  45. package/dist/browser/artifacts.d.ts.map +1 -0
  46. package/dist/browser/index.d.ts +7 -0
  47. package/dist/browser/index.d.ts.map +1 -0
  48. package/dist/browser/index.js +1264 -0
  49. package/dist/browser/index.js.map +7 -0
  50. package/dist/browser/manager.d.ts +57 -0
  51. package/dist/browser/manager.d.ts.map +1 -0
  52. package/dist/browser/network-guard-proxy.d.ts +23 -0
  53. package/dist/browser/network-guard-proxy.d.ts.map +1 -0
  54. package/dist/browser/security.d.ts +29 -0
  55. package/dist/browser/security.d.ts.map +1 -0
  56. package/dist/browser/tools.d.ts +62 -0
  57. package/dist/browser/tools.d.ts.map +1 -0
  58. package/dist/browser/types.d.ts +60 -0
  59. package/dist/browser/types.d.ts.map +1 -0
  60. package/dist/builtin.d.ts +11 -12
  61. package/dist/builtin.d.ts.map +1 -0
  62. package/dist/builtin.js +8099 -2178
  63. package/dist/builtin.js.map +7 -1
  64. package/dist/circuit-breaker.d.ts +4 -5
  65. package/dist/circuit-breaker.d.ts.map +1 -0
  66. package/dist/circuit-breaker.js +3 -3
  67. package/dist/circuit-breaker.js.map +7 -1
  68. package/dist/codebase-index/background-indexer.d.ts +116 -0
  69. package/dist/codebase-index/background-indexer.d.ts.map +1 -0
  70. package/dist/codebase-index/bm25.d.ts +40 -0
  71. package/dist/codebase-index/bm25.d.ts.map +1 -0
  72. package/dist/codebase-index/circuit-breaker.d.ts +94 -0
  73. package/dist/codebase-index/circuit-breaker.d.ts.map +1 -0
  74. package/dist/codebase-index/codebase-index-tool.d.ts +17 -0
  75. package/dist/codebase-index/codebase-index-tool.d.ts.map +1 -0
  76. package/dist/codebase-index/codebase-search-tool.d.ts +43 -0
  77. package/dist/codebase-index/codebase-search-tool.d.ts.map +1 -0
  78. package/dist/codebase-index/codebase-stats-tool.d.ts +23 -0
  79. package/dist/codebase-index/codebase-stats-tool.d.ts.map +1 -0
  80. package/dist/codebase-index/gitignore.d.ts +22 -0
  81. package/dist/codebase-index/gitignore.d.ts.map +1 -0
  82. package/dist/codebase-index/go-parser.d.ts +16 -0
  83. package/dist/codebase-index/go-parser.d.ts.map +1 -0
  84. package/dist/codebase-index/index-service.d.ts +25 -0
  85. package/dist/codebase-index/index-service.d.ts.map +1 -0
  86. package/dist/codebase-index/index.d.ts +23 -271
  87. package/dist/codebase-index/index.d.ts.map +1 -0
  88. package/dist/codebase-index/index.js +136 -68
  89. package/dist/codebase-index/index.js.map +7 -1
  90. package/dist/codebase-index/indexer.d.ts +28 -0
  91. package/dist/codebase-index/indexer.d.ts.map +1 -0
  92. package/dist/codebase-index/json-parser.d.ts +8 -0
  93. package/dist/codebase-index/json-parser.d.ts.map +1 -0
  94. package/dist/codebase-index/lsp-kind.d.ts +53 -0
  95. package/dist/codebase-index/lsp-kind.d.ts.map +1 -0
  96. package/dist/codebase-index/py-parser.d.ts +16 -0
  97. package/dist/codebase-index/py-parser.d.ts.map +1 -0
  98. package/dist/codebase-index/refs-extractor.d.ts +25 -0
  99. package/dist/codebase-index/refs-extractor.d.ts.map +1 -0
  100. package/dist/codebase-index/rs-parser.d.ts +8 -0
  101. package/dist/codebase-index/rs-parser.d.ts.map +1 -0
  102. package/dist/codebase-index/schema.d.ts +82 -0
  103. package/dist/codebase-index/schema.d.ts.map +1 -0
  104. package/dist/codebase-index/ts-parser.d.ts +30 -0
  105. package/dist/codebase-index/ts-parser.d.ts.map +1 -0
  106. package/dist/codebase-index/worker-protocol.d.ts +77 -0
  107. package/dist/codebase-index/worker-protocol.d.ts.map +1 -0
  108. package/dist/codebase-index/worker.d.ts +16 -2
  109. package/dist/codebase-index/worker.d.ts.map +1 -0
  110. package/dist/codebase-index/worker.js +103 -65
  111. package/dist/codebase-index/worker.js.map +7 -1
  112. package/dist/codebase-index/writer.d.ts +189 -0
  113. package/dist/codebase-index/writer.d.ts.map +1 -0
  114. package/dist/codebase-index/yaml-parser.d.ts +8 -0
  115. package/dist/codebase-index/yaml-parser.d.ts.map +1 -0
  116. package/dist/design.d.ts +38 -0
  117. package/dist/design.d.ts.map +1 -0
  118. package/dist/design.js +270 -0
  119. package/dist/design.js.map +7 -0
  120. package/dist/diff.d.ts +4 -5
  121. package/dist/diff.d.ts.map +1 -0
  122. package/dist/diff.js +14 -12
  123. package/dist/diff.js.map +7 -1
  124. package/dist/document.d.ts +4 -5
  125. package/dist/document.d.ts.map +1 -0
  126. package/dist/document.js +8 -7
  127. package/dist/document.js.map +7 -1
  128. package/dist/e2e.d.ts +56 -0
  129. package/dist/e2e.d.ts.map +1 -0
  130. package/dist/edit.d.ts +5 -36
  131. package/dist/edit.d.ts.map +1 -0
  132. package/dist/edit.js +28 -16
  133. package/dist/edit.js.map +7 -1
  134. package/dist/exec.d.ts +67 -2
  135. package/dist/exec.d.ts.map +1 -0
  136. package/dist/exec.js +51 -26
  137. package/dist/exec.js.map +7 -1
  138. package/dist/fetch.d.ts +4 -32
  139. package/dist/fetch.d.ts.map +1 -0
  140. package/dist/fetch.js +89 -77
  141. package/dist/fetch.js.map +7 -1
  142. package/dist/format.d.ts +4 -5
  143. package/dist/format.d.ts.map +1 -0
  144. package/dist/format.js +2415 -28
  145. package/dist/format.js.map +7 -1
  146. package/dist/git.d.ts +4 -5
  147. package/dist/git.d.ts.map +1 -0
  148. package/dist/git.js +10 -9
  149. package/dist/git.js.map +7 -1
  150. package/dist/glob.d.ts +4 -5
  151. package/dist/glob.d.ts.map +1 -0
  152. package/dist/glob.js +15 -12
  153. package/dist/glob.js.map +7 -1
  154. package/dist/grep.d.ts +4 -5
  155. package/dist/grep.d.ts.map +1 -0
  156. package/dist/grep.js +13 -10
  157. package/dist/grep.js.map +7 -1
  158. package/dist/index.d.ts +21 -724
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +8955 -2866
  161. package/dist/index.js.map +7 -1
  162. package/dist/install.d.ts +4 -5
  163. package/dist/install.d.ts.map +1 -0
  164. package/dist/install.js +2680 -31
  165. package/dist/install.js.map +7 -1
  166. package/dist/json.d.ts +4 -5
  167. package/dist/json.d.ts.map +1 -0
  168. package/dist/json.js +13 -11
  169. package/dist/json.js.map +7 -1
  170. package/dist/kanban.d.ts +107 -0
  171. package/dist/kanban.d.ts.map +1 -0
  172. package/dist/kanban.js +845 -0
  173. package/dist/kanban.js.map +7 -0
  174. package/dist/languages/detect.d.ts +3 -0
  175. package/dist/languages/detect.d.ts.map +1 -0
  176. package/dist/languages/diagnostics.d.ts +15 -0
  177. package/dist/languages/diagnostics.d.ts.map +1 -0
  178. package/dist/languages/execute-tool.d.ts +34 -0
  179. package/dist/languages/execute-tool.d.ts.map +1 -0
  180. package/dist/languages/execute.d.ts +18 -0
  181. package/dist/languages/execute.d.ts.map +1 -0
  182. package/dist/languages/index.d.ts +12 -0
  183. package/dist/languages/index.d.ts.map +1 -0
  184. package/dist/languages/index.js +4457 -0
  185. package/dist/languages/index.js.map +7 -0
  186. package/dist/languages/legacy-bridge.d.ts +29 -0
  187. package/dist/languages/legacy-bridge.d.ts.map +1 -0
  188. package/dist/languages/package-tool.d.ts +29 -0
  189. package/dist/languages/package-tool.d.ts.map +1 -0
  190. package/dist/languages/plan.d.ts +4 -0
  191. package/dist/languages/plan.d.ts.map +1 -0
  192. package/dist/languages/profile-helpers.d.ts +14 -0
  193. package/dist/languages/profile-helpers.d.ts.map +1 -0
  194. package/dist/languages/profiles/additional.d.ts +3 -0
  195. package/dist/languages/profiles/additional.d.ts.map +1 -0
  196. package/dist/languages/profiles/primary.d.ts +3 -0
  197. package/dist/languages/profiles/primary.d.ts.map +1 -0
  198. package/dist/languages/registry.d.ts +11 -0
  199. package/dist/languages/registry.d.ts.map +1 -0
  200. package/dist/languages/tool.d.ts +32 -0
  201. package/dist/languages/tool.d.ts.map +1 -0
  202. package/dist/languages/types.d.ts +207 -0
  203. package/dist/languages/types.d.ts.map +1 -0
  204. package/dist/lint.d.ts +4 -5
  205. package/dist/lint.d.ts.map +1 -0
  206. package/dist/lint.js +2415 -27
  207. package/dist/lint.js.map +7 -1
  208. package/dist/logs.d.ts +4 -5
  209. package/dist/logs.d.ts.map +1 -0
  210. package/dist/logs.js +16 -10
  211. package/dist/logs.js.map +7 -1
  212. package/dist/memory.d.ts +7 -8
  213. package/dist/memory.d.ts.map +1 -0
  214. package/dist/memory.js +7 -5
  215. package/dist/memory.js.map +7 -1
  216. package/dist/mode.d.ts +4 -5
  217. package/dist/mode.d.ts.map +1 -0
  218. package/dist/mode.js +3 -3
  219. package/dist/mode.js.map +7 -1
  220. package/dist/next-steps.d.ts +5 -6
  221. package/dist/next-steps.d.ts.map +1 -0
  222. package/dist/next-steps.js +5 -4
  223. package/dist/next-steps.js.map +7 -1
  224. package/dist/outdated.d.ts +4 -5
  225. package/dist/outdated.d.ts.map +1 -0
  226. package/dist/outdated.js +4777 -68
  227. package/dist/outdated.js.map +7 -1
  228. package/dist/pack.d.ts +3 -6
  229. package/dist/pack.d.ts.map +1 -0
  230. package/dist/pack.js +8134 -2204
  231. package/dist/pack.js.map +7 -1
  232. package/dist/patch.d.ts +4 -5
  233. package/dist/patch.d.ts.map +1 -0
  234. package/dist/patch.js +18 -16
  235. package/dist/patch.js.map +7 -1
  236. package/dist/plan.d.ts +55 -0
  237. package/dist/plan.d.ts.map +1 -0
  238. package/dist/plan.js +280 -0
  239. package/dist/plan.js.map +7 -0
  240. package/dist/process-guardian.d.ts +100 -0
  241. package/dist/process-guardian.d.ts.map +1 -0
  242. package/dist/process-registry-persistent.d.ts +121 -0
  243. package/dist/process-registry-persistent.d.ts.map +1 -0
  244. package/dist/process-registry.d.ts +13 -17
  245. package/dist/process-registry.d.ts.map +1 -0
  246. package/dist/process-registry.js +15 -9
  247. package/dist/process-registry.js.map +7 -1
  248. package/dist/ps-slash.d.ts +106 -0
  249. package/dist/ps-slash.d.ts.map +1 -0
  250. package/dist/ps-slash.js +1291 -0
  251. package/dist/ps-slash.js.map +7 -0
  252. package/dist/read.d.ts +4 -5
  253. package/dist/read.d.ts.map +1 -0
  254. package/dist/read.js +13 -11
  255. package/dist/read.js.map +7 -1
  256. package/dist/replace.d.ts +4 -5
  257. package/dist/replace.d.ts.map +1 -0
  258. package/dist/replace.js +26 -13
  259. package/dist/replace.js.map +7 -1
  260. package/dist/scaffold.d.ts +4 -5
  261. package/dist/scaffold.d.ts.map +1 -0
  262. package/dist/scaffold.js +16 -14
  263. package/dist/scaffold.js.map +7 -1
  264. package/dist/search.d.ts +5 -6
  265. package/dist/search.d.ts.map +1 -0
  266. package/dist/search.js +32 -27
  267. package/dist/search.js.map +7 -1
  268. package/dist/set-working-dir.d.ts +18 -0
  269. package/dist/set-working-dir.d.ts.map +1 -0
  270. package/dist/shim/node-sqlite.d.ts +3 -0
  271. package/dist/shim/node-sqlite.d.ts.map +1 -0
  272. package/dist/skill.d.ts +45 -0
  273. package/dist/skill.d.ts.map +1 -0
  274. package/dist/skill.js +175 -0
  275. package/dist/skill.js.map +7 -0
  276. package/dist/spawn-background.d.ts +80 -0
  277. package/dist/spawn-background.d.ts.map +1 -0
  278. package/dist/task.d.ts +35 -0
  279. package/dist/task.d.ts.map +1 -0
  280. package/dist/task.js +380 -0
  281. package/dist/task.js.map +7 -0
  282. package/dist/test.d.ts +4 -5
  283. package/dist/test.d.ts.map +1 -0
  284. package/dist/test.js +2419 -27
  285. package/dist/test.js.map +7 -1
  286. package/dist/todo.d.ts +4 -5
  287. package/dist/todo.d.ts.map +1 -0
  288. package/dist/todo.js +5 -5
  289. package/dist/todo.js.map +7 -1
  290. package/dist/tool-diff.d.ts +16 -17
  291. package/dist/tool-diff.d.ts.map +1 -0
  292. package/dist/tool-diff.js +11 -3
  293. package/dist/tool-diff.js.map +7 -1
  294. package/dist/tool-help.d.ts +4 -5
  295. package/dist/tool-help.d.ts.map +1 -0
  296. package/dist/tool-help.js +3 -3
  297. package/dist/tool-help.js.map +7 -1
  298. package/dist/tool-icon-map.d.ts +46 -0
  299. package/dist/tool-icon-map.d.ts.map +1 -0
  300. package/dist/tool-icons.d.ts +5 -6
  301. package/dist/tool-icons.d.ts.map +1 -0
  302. package/dist/tool-icons.js +16 -4
  303. package/dist/tool-icons.js.map +7 -1
  304. package/dist/tool-search.d.ts +4 -5
  305. package/dist/tool-search.d.ts.map +1 -0
  306. package/dist/tool-search.js +3 -3
  307. package/dist/tool-search.js.map +7 -1
  308. package/dist/tool-summary.d.ts +4 -5
  309. package/dist/tool-summary.d.ts.map +1 -0
  310. package/dist/tool-summary.js +5 -3
  311. package/dist/tool-summary.js.map +7 -1
  312. package/dist/tool-use.d.ts +4 -5
  313. package/dist/tool-use.d.ts.map +1 -0
  314. package/dist/tool-use.js +3 -3
  315. package/dist/tool-use.js.map +7 -1
  316. package/dist/tree.d.ts +4 -5
  317. package/dist/tree.d.ts.map +1 -0
  318. package/dist/tree.js +11 -9
  319. package/dist/tree.js.map +7 -1
  320. package/dist/typecheck.d.ts +4 -5
  321. package/dist/typecheck.d.ts.map +1 -0
  322. package/dist/typecheck.js +2416 -28
  323. package/dist/typecheck.js.map +7 -1
  324. package/dist/write.d.ts +4 -5
  325. package/dist/write.d.ts.map +1 -0
  326. package/dist/write.js +21 -16
  327. package/dist/write.js.map +7 -1
  328. package/package.json +39 -6
  329. package/dist/background-indexer-BeDBxfSh.d.ts +0 -371
  330. package/dist/exec-2OKoT6tk.d.ts +0 -121
@@ -1,16 +1,5 @@
1
- import { resolveWstackPaths, expectDefined, compileGlob, truncate } from '@wrongstack/core';
2
- import { toErrorMessage } from '@wrongstack/core/utils';
3
- import { createRequire } from 'node:module';
4
- import * as fs from 'node:fs';
5
- import * as path4 from 'node:path';
6
- import { fileURLToPath } from 'node:url';
7
- import { Worker } from 'node:worker_threads';
8
- import * as fs2 from 'node:fs/promises';
9
- import * as ts from 'typescript';
10
- import { execFileSync, spawn } from 'node:child_process';
11
- import * as os from 'node:os';
12
-
13
1
  // src/codebase-index/writer.ts
2
+ import { expectDefined } from "@wrongstack/core";
14
3
 
15
4
  // src/codebase-index/circuit-breaker.ts
16
5
  var CircuitOpenError = class extends Error {
@@ -95,6 +84,13 @@ function resetIndexCircuitBreaker() {
95
84
  indexCircuitBreaker.reset();
96
85
  }
97
86
 
87
+ // src/codebase-index/writer.ts
88
+ import { toErrorMessage } from "@wrongstack/core/utils";
89
+ import { createRequire } from "node:module";
90
+ import * as fs from "node:fs";
91
+ import * as path from "node:path";
92
+ import { resolveWstackPaths } from "@wrongstack/core";
93
+
98
94
  // src/codebase-index/schema.ts
99
95
  var SCHEMA_VERSION = 2;
100
96
 
@@ -368,7 +364,7 @@ var IndexStore = class {
368
364
  this.indexDir = resolveIndexDir(projectRoot, opts.indexDir);
369
365
  fs.mkdirSync(this.indexDir, { recursive: true });
370
366
  const Database = loadDatabaseSync();
371
- this.db = new Database(path4.join(this.indexDir, DB_FILE));
367
+ this.db = new Database(path.join(this.indexDir, DB_FILE));
372
368
  try {
373
369
  this.db.exec("PRAGMA journal_mode = WAL");
374
370
  this.db.exec("PRAGMA busy_timeout = 5000");
@@ -947,7 +943,7 @@ var IndexStore = class {
947
943
  }));
948
944
  }
949
945
  sizeBytes() {
950
- const dbPath = path4.join(this.indexDir, DB_FILE);
946
+ const dbPath = path.join(this.indexDir, DB_FILE);
951
947
  try {
952
948
  return fs.statSync(dbPath).size;
953
949
  } catch {
@@ -962,6 +958,20 @@ var IndexStore = class {
962
958
  }
963
959
  }
964
960
  };
961
+
962
+ // src/codebase-index/background-indexer.ts
963
+ import * as fs7 from "node:fs";
964
+ import { fileURLToPath } from "node:url";
965
+ import { Worker } from "node:worker_threads";
966
+
967
+ // src/codebase-index/indexer.ts
968
+ import { expectDefined as expectDefined5 } from "@wrongstack/core";
969
+ import * as fs6 from "node:fs/promises";
970
+ import * as path7 from "node:path";
971
+ import { compileGlob as compileGlob2 } from "@wrongstack/core";
972
+
973
+ // src/codebase-index/ts-parser.ts
974
+ import * as ts from "@typescript/typescript6";
965
975
  var KIND_MAP = {
966
976
  [ts.SyntaxKind.ClassDeclaration]: "class",
967
977
  [ts.SyntaxKind.InterfaceDeclaration]: "interface",
@@ -1146,6 +1156,12 @@ function detectLang(file) {
1146
1156
  if (idx < 0) return null;
1147
1157
  return extToLang(file.slice(idx));
1148
1158
  }
1159
+
1160
+ // src/codebase-index/go-parser.ts
1161
+ import { spawn } from "node:child_process";
1162
+ import * as os from "node:os";
1163
+ import * as path2 from "node:path";
1164
+ import * as fs2 from "node:fs/promises";
1149
1165
  async function parseSymbols2(opts) {
1150
1166
  const { file, content, lang } = opts;
1151
1167
  try {
@@ -1446,9 +1462,9 @@ func formatType(t ast.Expr) string {
1446
1462
  }
1447
1463
  `;
1448
1464
  async function syncGoParse(filePath, content, lang) {
1449
- const tmpDir = await fs2.mkdtemp(path4.join(os.tmpdir(), "ws-go-parse-"));
1465
+ const tmpDir = await fs2.mkdtemp(path2.join(os.tmpdir(), "ws-go-parse-"));
1450
1466
  try {
1451
- const scriptPath = path4.join(tmpDir, "parse.go");
1467
+ const scriptPath = path2.join(tmpDir, "parse.go");
1452
1468
  await fs2.writeFile(scriptPath, GO_PARSE_SCRIPT, "utf8");
1453
1469
  const proc = spawn("go", ["run", scriptPath], {
1454
1470
  stdio: ["pipe", "pipe", "pipe"],
@@ -1495,6 +1511,12 @@ async function syncGoParse(filePath, content, lang) {
1495
1511
  await fs2.rm(tmpDir, { recursive: true, force: true });
1496
1512
  }
1497
1513
  }
1514
+
1515
+ // src/codebase-index/py-parser.ts
1516
+ import { spawn as spawn2 } from "node:child_process";
1517
+ import * as fs3 from "node:fs/promises";
1518
+ import * as os2 from "node:os";
1519
+ import * as path3 from "node:path";
1498
1520
  async function parseSymbols3(opts) {
1499
1521
  const { file, content, lang } = opts;
1500
1522
  try {
@@ -1710,12 +1732,12 @@ var _cachedScriptPath = null;
1710
1732
  async function syncPyParse(filePath, content, lang) {
1711
1733
  try {
1712
1734
  if (!_cachedScriptPath) {
1713
- const tmpDir = path4.join(os.tmpdir(), "ws-py-parse");
1714
- await fs2.mkdir(tmpDir, { recursive: true });
1715
- _cachedScriptPath = path4.join(tmpDir, "parse.py");
1716
- await fs2.writeFile(_cachedScriptPath, PY_PARSE_SCRIPT, "utf8");
1735
+ const tmpDir = path3.join(os2.tmpdir(), "ws-py-parse");
1736
+ await fs3.mkdir(tmpDir, { recursive: true });
1737
+ _cachedScriptPath = path3.join(tmpDir, "parse.py");
1738
+ await fs3.writeFile(_cachedScriptPath, PY_PARSE_SCRIPT, "utf8");
1717
1739
  }
1718
- const proc = spawn("python", [_cachedScriptPath, filePath], {
1740
+ const proc = spawn2("python", [_cachedScriptPath, filePath], {
1719
1741
  stdio: ["pipe", "pipe", "pipe"],
1720
1742
  windowsHide: true
1721
1743
  });
@@ -1758,6 +1780,12 @@ async function syncPyParse(filePath, content, lang) {
1758
1780
  return { file: filePath, lang, symbols: [], mtimeMs: Date.now() };
1759
1781
  }
1760
1782
  }
1783
+
1784
+ // src/codebase-index/rs-parser.ts
1785
+ import { expectDefined as expectDefined2 } from "@wrongstack/core";
1786
+ import { execFileSync, spawn as spawn3 } from "node:child_process";
1787
+ import * as fs4 from "node:fs/promises";
1788
+ import * as path4 from "node:path";
1761
1789
  async function parseSymbols4(opts) {
1762
1790
  const { file, content, lang } = opts;
1763
1791
  const nativeAvailable = checkNativeParser();
@@ -1797,8 +1825,8 @@ async function tryNativeParse(file, content) {
1797
1825
  const toolsDir = path4.join(process.cwd(), "tools");
1798
1826
  const crateDir = path4.join(toolsDir, "syn-parser");
1799
1827
  const tmpFile = path4.join(crateDir, "src", "input.rs");
1800
- await fs2.writeFile(tmpFile, content, "utf8");
1801
- const proc = spawn(
1828
+ await fs4.writeFile(tmpFile, content, "utf8");
1829
+ const proc = spawn3(
1802
1830
  "cargo",
1803
1831
  ["run", "--manifest-path", path4.join(toolsDir, "Cargo.toml")],
1804
1832
  {
@@ -1859,7 +1887,7 @@ function regexParse(opts) {
1859
1887
  let hi = lineOffsets.length - 1;
1860
1888
  while (lo < hi) {
1861
1889
  const mid = lo + hi + 1 >>> 1;
1862
- if (expectDefined(lineOffsets[mid]) <= offset) lo = mid;
1890
+ if (expectDefined2(lineOffsets[mid]) <= offset) lo = mid;
1863
1891
  else hi = mid - 1;
1864
1892
  }
1865
1893
  return lo + 1;
@@ -1871,12 +1899,12 @@ function regexParse(opts) {
1871
1899
  for (const pattern of RS_PATTERNS) {
1872
1900
  pattern.regex.lastIndex = 0;
1873
1901
  for (let match = pattern.regex.exec(content); match !== null; match = pattern.regex.exec(content)) {
1874
- const name = expectDefined(match[1]);
1902
+ const name = expectDefined2(match[1]);
1875
1903
  const offset = match.index ?? 0;
1876
1904
  const line = lineFromOffset(offset);
1877
1905
  const col = offset - (lineOffsets[line - 1] ?? 0);
1878
1906
  const lineIdx = line - 1;
1879
- const signature = extractDeclaration(lineIdx);
1907
+ const signature = extractDeclaration(lineIdx, match);
1880
1908
  symbols.push({
1881
1909
  id: 0,
1882
1910
  lang,
@@ -1901,6 +1929,10 @@ function regexParse(opts) {
1901
1929
  });
1902
1930
  return { file, lang, symbols: deduped, mtimeMs: Date.now() };
1903
1931
  }
1932
+
1933
+ // src/codebase-index/json-parser.ts
1934
+ import { expectDefined as expectDefined3 } from "@wrongstack/core";
1935
+ import * as path5 from "node:path";
1904
1936
  function parseSymbols5(opts) {
1905
1937
  const { file, content, lang } = opts;
1906
1938
  try {
@@ -1912,7 +1944,7 @@ function parseSymbols5(opts) {
1912
1944
  function regexParse2(opts) {
1913
1945
  const { file, content, lang } = opts;
1914
1946
  const symbols = [];
1915
- const basename2 = path4.basename(file).toLowerCase();
1947
+ const basename2 = path5.basename(file).toLowerCase();
1916
1948
  const isPackageJson = basename2 === "package.json";
1917
1949
  const isTsconfig = basename2 === "tsconfig.json" || basename2 === "tsconfig.build.json";
1918
1950
  const isJsonSchema = content.includes("$schema") || content.includes("$id") || content.includes("$ref");
@@ -1927,22 +1959,22 @@ function regexParse2(opts) {
1927
1959
  let hi = lineOffsets.length - 1;
1928
1960
  while (lo < hi) {
1929
1961
  const mid = lo + hi + 1 >>> 1;
1930
- if (expectDefined(lineOffsets[mid]) <= offset) lo = mid;
1962
+ if (expectDefined3(lineOffsets[mid]) <= offset) lo = mid;
1931
1963
  else hi = mid - 1;
1932
1964
  }
1933
1965
  return lo + 1;
1934
1966
  }
1935
1967
  const rootMatch = content.match(/^\s*\{/m);
1936
1968
  if (rootMatch) {
1937
- const offset = expectDefined(rootMatch.index);
1969
+ const offset = expectDefined3(rootMatch.index);
1938
1970
  const line = lineFromOffset(offset);
1939
1971
  symbols.push(
1940
1972
  makeSymbol({
1941
- name: path4.basename(file),
1973
+ name: path5.basename(file),
1942
1974
  kind: "object",
1943
1975
  line,
1944
1976
  col: 0,
1945
- signature: `"${path4.basename(file)}" = { ... }`,
1977
+ signature: `"${path5.basename(file)}" = { ... }`,
1946
1978
  file,
1947
1979
  lang
1948
1980
  })
@@ -1950,7 +1982,7 @@ function regexParse2(opts) {
1950
1982
  }
1951
1983
  const topLevelKeyRegex = /^\s*"([^"]+)"\s*:/gm;
1952
1984
  for (let match = topLevelKeyRegex.exec(content); match !== null; match = topLevelKeyRegex.exec(content)) {
1953
- const key = expectDefined(match[1]);
1985
+ const key = expectDefined3(match[1]);
1954
1986
  const offset = match.index ?? 0;
1955
1987
  const line = lineFromOffset(offset);
1956
1988
  const col = offset - (lineOffsets[line - 1] ?? 0);
@@ -1997,7 +2029,7 @@ function regexParse2(opts) {
1997
2029
  const defsRegex = /"\$defs"\s*:|"\$defs"\s*:/g;
1998
2030
  const defsMatch = defsRegex.exec(content);
1999
2031
  if (defsMatch !== null) {
2000
- const offset = expectDefined(defsMatch.index);
2032
+ const offset = expectDefined3(defsMatch.index);
2001
2033
  const line = lineFromOffset(offset);
2002
2034
  symbols.push(
2003
2035
  makeSymbol({
@@ -2022,7 +2054,7 @@ function regexParse2(opts) {
2022
2054
  for (let match = pat.exec(content); match !== null; match = pat.exec(content)) {
2023
2055
  const offset = match.index ?? 0;
2024
2056
  const line = lineFromOffset(offset);
2025
- const key = match[0]?.match(/"([^"]+)"/)?.[1] ?? expectDefined(match[0]);
2057
+ const key = match[0]?.match(/"([^"]+)"/)?.[1] ?? expectDefined3(match[0]);
2026
2058
  symbols.push(
2027
2059
  makeSymbol({
2028
2060
  name: key,
@@ -2041,12 +2073,12 @@ function regexParse2(opts) {
2041
2073
  function extractPackageScripts(content, symbols, file, lang, lineOffsets, lineFromOffset) {
2042
2074
  const scriptsBlockRegex = /"scripts"\s*:\s*\{([^}]+)\}/g;
2043
2075
  for (let match = scriptsBlockRegex.exec(content); match !== null; match = scriptsBlockRegex.exec(content)) {
2044
- const blockContent = expectDefined(match[0]);
2076
+ const blockContent = expectDefined3(match[0]);
2045
2077
  const blockOffset = match.index ?? 0;
2046
2078
  const scriptKeyRegex = /"(\w[\w-]*)"\s*:/g;
2047
2079
  for (let scriptMatch = scriptKeyRegex.exec(blockContent); scriptMatch !== null; scriptMatch = scriptKeyRegex.exec(blockContent)) {
2048
- const key = expectDefined(scriptMatch[1]);
2049
- const keyOffset = blockOffset + expectDefined(scriptMatch.index);
2080
+ const key = expectDefined3(scriptMatch[1]);
2081
+ const keyOffset = blockOffset + expectDefined3(scriptMatch.index);
2050
2082
  const line = lineFromOffset(keyOffset);
2051
2083
  symbols.push(
2052
2084
  makeSymbol({
@@ -2065,12 +2097,12 @@ function extractPackageScripts(content, symbols, file, lang, lineOffsets, lineFr
2065
2097
  function extractCompilerOptions(content, symbols, file, lang, lineOffsets, parentLine, lineFromOffset) {
2066
2098
  const optsBlockRegex = /"compilerOptions"\s*:\s*\{([^}]+)\}/g;
2067
2099
  for (let match = optsBlockRegex.exec(content); match !== null; match = optsBlockRegex.exec(content)) {
2068
- const blockContent = expectDefined(match[0]);
2100
+ const blockContent = expectDefined3(match[0]);
2069
2101
  const blockOffset = match.index ?? 0;
2070
2102
  const optKeyRegex = /"(\w[\w]*)"\s*:/g;
2071
2103
  for (let optMatch = optKeyRegex.exec(blockContent); optMatch !== null; optMatch = optKeyRegex.exec(blockContent)) {
2072
- const key = expectDefined(optMatch[1]);
2073
- const keyOffset = blockOffset + expectDefined(optMatch.index);
2104
+ const key = expectDefined3(optMatch[1]);
2105
+ const keyOffset = blockOffset + expectDefined3(optMatch.index);
2074
2106
  const line = lineFromOffset(keyOffset);
2075
2107
  if (line <= parentLine) continue;
2076
2108
  symbols.push(
@@ -2102,6 +2134,9 @@ function makeSymbol(opts) {
2102
2134
  text: `${opts.name} ${opts.signature}`.trim()
2103
2135
  };
2104
2136
  }
2137
+
2138
+ // src/codebase-index/yaml-parser.ts
2139
+ import { expectDefined as expectDefined4, truncate } from "@wrongstack/core";
2105
2140
  function parseSymbols6(opts) {
2106
2141
  const { file, content, lang } = opts;
2107
2142
  try {
@@ -2123,14 +2158,14 @@ function regexParse3(opts) {
2123
2158
  let hi = lineOffsets.length - 1;
2124
2159
  while (lo < hi) {
2125
2160
  const mid = lo + hi + 1 >>> 1;
2126
- if (expectDefined(lineOffsets[mid]) <= offset) lo = mid;
2161
+ if (expectDefined4(lineOffsets[mid]) <= offset) lo = mid;
2127
2162
  else hi = mid - 1;
2128
2163
  }
2129
2164
  return lo + 1;
2130
2165
  }
2131
2166
  const anchorRegex = /&(\w[\w-]*)/g;
2132
2167
  for (let match = anchorRegex.exec(content); match !== null; match = anchorRegex.exec(content)) {
2133
- const name = expectDefined(match[1]);
2168
+ const name = expectDefined4(match[1]);
2134
2169
  const offset = match.index ?? 0;
2135
2170
  const line = lineFromOffset(offset);
2136
2171
  const col = offset - (lineOffsets[line - 1] ?? 0);
@@ -2148,7 +2183,7 @@ function regexParse3(opts) {
2148
2183
  }
2149
2184
  const aliasRegex = /\*(\w[\w-]*)/g;
2150
2185
  for (let match = aliasRegex.exec(content); match !== null; match = aliasRegex.exec(content)) {
2151
- const name = expectDefined(match[1]);
2186
+ const name = expectDefined4(match[1]);
2152
2187
  const offset = match.index ?? 0;
2153
2188
  const line = lineFromOffset(offset);
2154
2189
  const col = offset - (lineOffsets[line - 1] ?? 0);
@@ -2183,7 +2218,7 @@ function regexParse3(opts) {
2183
2218
  }
2184
2219
  const listItemRegex = /^-(\s+)([^:#\s][^:#\s]*)\s*:/gm;
2185
2220
  for (let match = listItemRegex.exec(content); match !== null; match = listItemRegex.exec(content)) {
2186
- const key = expectDefined(match[2]);
2221
+ const key = expectDefined4(match[2]);
2187
2222
  const offset = match.index ?? 0;
2188
2223
  const line = lineFromOffset(offset);
2189
2224
  const col = offset - (lineOffsets[line - 1] ?? 0);
@@ -2203,7 +2238,7 @@ function regexParse3(opts) {
2203
2238
  }
2204
2239
  const blockScalarRegex = /^(\s*)([^:#\s][^:#\s]*)\s*:\s*[|>](\s|$)/gm;
2205
2240
  for (let match = blockScalarRegex.exec(content); match !== null; match = blockScalarRegex.exec(content)) {
2206
- const key = expectDefined(match[2]);
2241
+ const key = expectDefined4(match[2]);
2207
2242
  const offset = match.index ?? 0;
2208
2243
  const line = lineFromOffset(offset);
2209
2244
  const col = offset - (lineOffsets[line - 1] ?? 0);
@@ -2248,6 +2283,11 @@ function makeSymbol2(opts) {
2248
2283
  text: `${opts.name} ${opts.signature}`.trim()
2249
2284
  };
2250
2285
  }
2286
+
2287
+ // src/codebase-index/gitignore.ts
2288
+ import * as fs5 from "node:fs/promises";
2289
+ import * as path6 from "node:path";
2290
+ import { compileGlob } from "@wrongstack/core";
2251
2291
  function globBody(glob) {
2252
2292
  return compileGlob(glob).source.replace(/^\^/, "").replace(/\$$/, "");
2253
2293
  }
@@ -2292,7 +2332,7 @@ function compileGitignore(lines) {
2292
2332
  async function loadGitignoreMatcher(projectRoot) {
2293
2333
  let lines = [];
2294
2334
  try {
2295
- const raw = await fs2.readFile(path4.join(projectRoot, ".gitignore"), "utf8");
2335
+ const raw = await fs5.readFile(path6.join(projectRoot, ".gitignore"), "utf8");
2296
2336
  lines = raw.split("\n");
2297
2337
  } catch {
2298
2338
  }
@@ -2330,16 +2370,16 @@ async function findSourceFiles(projectRoot, ignore, isGitIgnored, signal) {
2330
2370
  const results = [];
2331
2371
  const ignoreSet = /* @__PURE__ */ new Set([...DEFAULT_IGNORE, ...ignore]);
2332
2372
  const globs = [
2333
- { ext: ".ts", pat: compileGlob("**/*.ts") },
2334
- { ext: ".tsx", pat: compileGlob("**/*.tsx") },
2335
- { ext: ".js", pat: compileGlob("**/*.js") },
2336
- { ext: ".jsx", pat: compileGlob("**/*.jsx") },
2337
- { ext: ".go", pat: compileGlob("**/*.go") },
2338
- { ext: ".py", pat: compileGlob("**/*.py") },
2339
- { ext: ".rs", pat: compileGlob("**/*.rs") },
2340
- { ext: ".json", pat: compileGlob("**/*.json") },
2341
- { ext: ".yaml", pat: compileGlob("**/*.yaml") },
2342
- { ext: ".yml", pat: compileGlob("**/*.yml") }
2373
+ { ext: ".ts", pat: compileGlob2("**/*.ts") },
2374
+ { ext: ".tsx", pat: compileGlob2("**/*.tsx") },
2375
+ { ext: ".js", pat: compileGlob2("**/*.js") },
2376
+ { ext: ".jsx", pat: compileGlob2("**/*.jsx") },
2377
+ { ext: ".go", pat: compileGlob2("**/*.go") },
2378
+ { ext: ".py", pat: compileGlob2("**/*.py") },
2379
+ { ext: ".rs", pat: compileGlob2("**/*.rs") },
2380
+ { ext: ".json", pat: compileGlob2("**/*.json") },
2381
+ { ext: ".yaml", pat: compileGlob2("**/*.yaml") },
2382
+ { ext: ".yml", pat: compileGlob2("**/*.yml") }
2343
2383
  ];
2344
2384
  let dirCount = 0;
2345
2385
  const walk = async (dir) => {
@@ -2350,21 +2390,21 @@ async function findSourceFiles(projectRoot, ignore, isGitIgnored, signal) {
2350
2390
  }
2351
2391
  let entries;
2352
2392
  try {
2353
- entries = await fs2.readdir(dir, { withFileTypes: true });
2393
+ entries = await fs6.readdir(dir, { withFileTypes: true });
2354
2394
  } catch {
2355
2395
  return;
2356
2396
  }
2357
2397
  dirCount++;
2358
2398
  for (const e of entries) {
2359
2399
  if (ignoreSet.has(e.name)) continue;
2360
- const full = path4.join(dir, e.name);
2361
- const rel = path4.relative(projectRoot, full).replace(/\\/g, "/");
2400
+ const full = path7.join(dir, e.name);
2401
+ const rel = path7.relative(projectRoot, full).replace(/\\/g, "/");
2362
2402
  if (e.isDirectory()) {
2363
2403
  if (isGitIgnored(rel, true)) continue;
2364
2404
  await walk(full);
2365
2405
  } else if (e.isFile()) {
2366
2406
  if (isGitIgnored(rel, false)) continue;
2367
- const ext = path4.extname(e.name);
2407
+ const ext = path7.extname(e.name);
2368
2408
  for (const { ext: extName, pat } of globs) {
2369
2409
  if (ext === extName && (pat.test(rel) || pat.test(e.name))) {
2370
2410
  results.push(full);
@@ -2420,7 +2460,7 @@ async function runIndexerWithStore(store, opts) {
2420
2460
  let files;
2421
2461
  let discoveredFiles = null;
2422
2462
  if (opts.files && opts.files.length > 0) {
2423
- files = opts.files.map((f) => path4.resolve(projectRoot, f)).filter((f) => !isGitIgnored(path4.relative(projectRoot, f).replace(/\\/g, "/"), false));
2463
+ files = opts.files.map((f) => path7.resolve(projectRoot, f)).filter((f) => !isGitIgnored(path7.relative(projectRoot, f).replace(/\\/g, "/"), false));
2424
2464
  } else {
2425
2465
  files = await findSourceFiles(projectRoot, ignore, isGitIgnored, signal);
2426
2466
  discoveredFiles = new Set(files);
@@ -2450,7 +2490,7 @@ async function runIndexerWithStore(store, opts) {
2450
2490
  batchFiles.map(async (file) => {
2451
2491
  let stat2;
2452
2492
  try {
2453
- stat2 = await fs2.stat(file, statOpts);
2493
+ stat2 = await fs6.stat(file, statOpts);
2454
2494
  } catch (e) {
2455
2495
  if (isAbortError(e)) throw e;
2456
2496
  return { file, stat: null, lang: "", parsed: null, error: `stat error: ${e instanceof Error ? e.message : String(e)}` };
@@ -2464,7 +2504,7 @@ async function runIndexerWithStore(store, opts) {
2464
2504
  }
2465
2505
  let content;
2466
2506
  try {
2467
- content = await fs2.readFile(file, { encoding: "utf8", signal });
2507
+ content = await fs6.readFile(file, { encoding: "utf8", signal });
2468
2508
  } catch (e) {
2469
2509
  if (isAbortError(e)) throw e;
2470
2510
  return { file, stat: stat2, lang, parsed: null, error: `read error: ${e instanceof Error ? e.message : String(e)}` };
@@ -2482,7 +2522,7 @@ async function runIndexerWithStore(store, opts) {
2482
2522
  const deleteForFiles = [];
2483
2523
  for (let fi = 0; fi < statReadParse.length; fi++) {
2484
2524
  const settled = statReadParse[fi];
2485
- const file = expectDefined(batchFiles[fi]);
2525
+ const file = expectDefined5(batchFiles[fi]);
2486
2526
  if (settled.status === "rejected") {
2487
2527
  const err = settled.reason;
2488
2528
  if (err instanceof Error && isAbortError(err)) throw err;
@@ -2733,7 +2773,7 @@ function resolveWorkerUrl() {
2733
2773
  for (const rel of ["./worker.js", "./codebase-index/worker.js"]) {
2734
2774
  try {
2735
2775
  const url = new URL(rel, import.meta.url);
2736
- if (url.protocol === "file:" && fs.existsSync(fileURLToPath(url))) return url;
2776
+ if (url.protocol === "file:" && fs7.existsSync(fileURLToPath(url))) return url;
2737
2777
  } catch {
2738
2778
  }
2739
2779
  }
@@ -3200,7 +3240,35 @@ var codebaseStatsTool = {
3200
3240
  };
3201
3241
  }
3202
3242
  };
3203
-
3204
- export { CircuitOpenError, IndexCircuitBreaker, IndexStore, IndexTimeoutError, SCHEMA_VERSION, buildBm25Index, buildIndexableText, cancelPendingReindexes, codebaseIndexDirOverride, codebaseIndexStats, codebaseIndexTool, codebaseSearchTool, codebaseStatsTool, enqueueReindex, getIndexState, indexCircuitBreaker, internalKindToLspKind, isIndexReady, isIndexableFile, isIndexing, lspKindToInternalKind, onIndexStateChange, resetIndexCircuitBreaker, resolveIndexDir, runIndexer, runStartupIndex, searchCodebaseIndex, shutdownCodebaseIndexHost, tokenise };
3243
+ export {
3244
+ CircuitOpenError,
3245
+ IndexCircuitBreaker,
3246
+ IndexStore,
3247
+ IndexTimeoutError,
3248
+ SCHEMA_VERSION,
3249
+ buildBm25Index,
3250
+ buildIndexableText,
3251
+ cancelPendingReindexes,
3252
+ codebaseIndexDirOverride,
3253
+ codebaseIndexStats,
3254
+ codebaseIndexTool,
3255
+ codebaseSearchTool,
3256
+ codebaseStatsTool,
3257
+ enqueueReindex,
3258
+ getIndexState,
3259
+ indexCircuitBreaker,
3260
+ internalKindToLspKind,
3261
+ isIndexReady,
3262
+ isIndexableFile,
3263
+ isIndexing,
3264
+ lspKindToInternalKind,
3265
+ onIndexStateChange,
3266
+ resetIndexCircuitBreaker,
3267
+ resolveIndexDir,
3268
+ runIndexer,
3269
+ runStartupIndex,
3270
+ searchCodebaseIndex,
3271
+ shutdownCodebaseIndexHost,
3272
+ tokenise
3273
+ };
3205
3274
  //# sourceMappingURL=index.js.map
3206
- //# sourceMappingURL=index.js.map