@wrongstack/tools 0.316.2 → 0.317.2

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 (109) hide show
  1. package/dist/_spawn-stream.d.ts +1 -1
  2. package/dist/audit.d.ts +37 -2
  3. package/dist/audit.js +4 -4
  4. package/dist/bash.js +1 -1
  5. package/dist/batch-tool-use.js +1 -1
  6. package/dist/browser/index.js +1 -1
  7. package/dist/browser/tools.d.ts +16 -1
  8. package/dist/builtin.js +43 -43
  9. package/dist/{chunk-SDLVH5RZ.js → chunk-3QQSBUXR.js} +6 -5
  10. package/dist/{chunk-K3WNSHUF.js → chunk-45JPRMC2.js} +62 -36
  11. package/dist/{chunk-EJWSCQ6D.js → chunk-4AEZIFOW.js} +6 -5
  12. package/dist/{chunk-PQKK5JH7.js → chunk-4E42D7UF.js} +2 -2
  13. package/dist/{chunk-JRJJX3L5.js → chunk-5WNDJHT6.js} +3 -2
  14. package/dist/{chunk-7EY5DCRO.js → chunk-5ZYEGP2P.js} +4 -4
  15. package/dist/{chunk-MZZN7VCD.js → chunk-6RR5VX6U.js} +35 -17
  16. package/dist/{chunk-HYX2TZ7O.js → chunk-A2PX7M7A.js} +5 -5
  17. package/dist/{chunk-L25CVUVR.js → chunk-AK2K4KHR.js} +30 -22
  18. package/dist/{chunk-VFKPWSOX.js → chunk-BANPF4LY.js} +11 -7
  19. package/dist/{chunk-RGISBZBD.js → chunk-CPSAF2AU.js} +3 -2
  20. package/dist/{chunk-BSLVR56S.js → chunk-CPVLVQYT.js} +6 -5
  21. package/dist/{chunk-VJNHFZ7J.js → chunk-CVALEVGA.js} +6 -5
  22. package/dist/{chunk-PY2IOS7C.js → chunk-CWALNI6K.js} +5 -5
  23. package/dist/{chunk-LIJQMYYX.js → chunk-ELFFQ4RU.js} +7 -3
  24. package/dist/{chunk-JNNVRHMV.js → chunk-FJEQZHZN.js} +8 -8
  25. package/dist/{chunk-S5CCLZL3.js → chunk-FRN7TIAA.js} +2 -2
  26. package/dist/{chunk-I64BS3VC.js → chunk-FYDKHXN7.js} +2 -2
  27. package/dist/{chunk-NKJW5GFO.js → chunk-H6AWAZ2Y.js} +3 -3
  28. package/dist/{chunk-IVWV2UM6.js → chunk-HTYEO67J.js} +6 -5
  29. package/dist/{chunk-UNSKG6DC.js → chunk-ICAXDRP6.js} +10 -15
  30. package/dist/{chunk-IYK7XGDZ.js → chunk-JJQB6R7Y.js} +7 -7
  31. package/dist/{chunk-LWKUTMD5.js → chunk-MRZOVQ5D.js} +6 -5
  32. package/dist/{chunk-JOHXDF3D.js → chunk-NKX4SJ5R.js} +12 -9
  33. package/dist/{chunk-U4D5S3VQ.js → chunk-NWZ6XGBJ.js} +2 -1
  34. package/dist/{chunk-UKU2ZX4C.js → chunk-P7ZQ2FAJ.js} +27 -17
  35. package/dist/{chunk-4I4LWFOO.js → chunk-PQTONQ4P.js} +16 -11
  36. package/dist/{chunk-MQX2KXVW.js → chunk-RMB76PDS.js} +3 -3
  37. package/dist/{chunk-QZQSPUBF.js → chunk-RUOMW2I6.js} +4 -3
  38. package/dist/{chunk-553IQUMO.js → chunk-S2JRYDYG.js} +7 -6
  39. package/dist/{chunk-OUBDL3WH.js → chunk-SOG7XIRF.js} +11 -8
  40. package/dist/{chunk-ZJQ4IGXK.js → chunk-TDLZIDCY.js} +9 -7
  41. package/dist/{chunk-DA4KNE2H.js → chunk-TFEGJDH5.js} +303 -99
  42. package/dist/{chunk-AHHDWNXC.js → chunk-TKA4VEX2.js} +2 -2
  43. package/dist/{chunk-5H4GSJAI.js → chunk-UE3UBMCP.js} +7 -6
  44. package/dist/{chunk-IXMNTNW5.js → chunk-UKGMDCXT.js} +4 -3
  45. package/dist/{chunk-4UESMQDP.js → chunk-UOXX4SQZ.js} +7 -6
  46. package/dist/{chunk-T2F4S7U4.js → chunk-WI3VDXHD.js} +18 -8
  47. package/dist/{chunk-O4MBV4AX.js → chunk-WJYXMB2R.js} +6 -5
  48. package/dist/{chunk-U4VAATKP.js → chunk-WXJY3BKV.js} +16 -6
  49. package/dist/{chunk-DR7JOQTC.js → chunk-X5K3U6GI.js} +3 -3
  50. package/dist/{chunk-VXECAJJ7.js → chunk-XVGB6KYU.js} +37 -36
  51. package/dist/{chunk-TEBQ4VPZ.js → chunk-YOHO4DVT.js} +6 -5
  52. package/dist/{chunk-RXISBFR5.js → chunk-ZE6KLBUO.js} +5 -4
  53. package/dist/{chunk-22B7GE5T.js → chunk-ZHH3BEWU.js} +13 -12
  54. package/dist/codebase-index/bm25.d.ts +14 -1
  55. package/dist/codebase-index/index.js +8 -8
  56. package/dist/codebase-index/json-parser.d.ts +4 -0
  57. package/dist/codebase-index/parser-worker-script.js +2 -2
  58. package/dist/codebase-index/project-server.js +48 -9
  59. package/dist/codebase-index/worker.js +4 -4
  60. package/dist/codebase-index/writer-bulk-insert.d.ts +0 -1
  61. package/dist/codebase-index/writer-schema.d.ts +1 -1
  62. package/dist/codebase-index/writer.d.ts +38 -0
  63. package/dist/diff.js +1 -1
  64. package/dist/e2e.d.ts +40 -1
  65. package/dist/e2e.js +1 -1
  66. package/dist/edit.js +7 -7
  67. package/dist/exec.js +1 -1
  68. package/dist/fetch.js +1 -1
  69. package/dist/format.d.ts +42 -2
  70. package/dist/format.js +4 -4
  71. package/dist/git.d.ts +70 -1
  72. package/dist/git.js +1 -1
  73. package/dist/glob.js +3 -3
  74. package/dist/{go-parser-JXYKJHRC.js → go-parser-IKHW67WE.js} +2 -2
  75. package/dist/grep.js +3 -3
  76. package/dist/index.js +63 -45
  77. package/dist/install.d.ts +51 -2
  78. package/dist/install.js +4 -4
  79. package/dist/{json-parser-IBHZ4BZC.js → json-parser-2EOVP5MR.js} +81 -15
  80. package/dist/kanban.d.ts +19 -1
  81. package/dist/kanban.js +2 -2
  82. package/dist/languages/index.js +2 -2
  83. package/dist/{legacy-bridge-7M6QLUQN.js → legacy-bridge-SFNXIRAP.js} +4 -4
  84. package/dist/lint.js +4 -4
  85. package/dist/logs.js +1 -1
  86. package/dist/outdated.d.ts +25 -1
  87. package/dist/outdated.js +1 -1
  88. package/dist/pack.js +44 -44
  89. package/dist/{parser-dispatch-QH4XPGG6.js → parser-dispatch-X62UWXJS.js} +3 -3
  90. package/dist/patch.js +7 -7
  91. package/dist/plan.js +4 -4
  92. package/dist/{py-parser-IS4HKYMF.js → py-parser-TDXSQZBC.js} +2 -2
  93. package/dist/read.js +7 -7
  94. package/dist/replace.js +7 -7
  95. package/dist/{rs-parser-XHUUO2KZ.js → rs-parser-GIWPUA3T.js} +2 -2
  96. package/dist/scaffold.js +1 -1
  97. package/dist/search.js +1 -1
  98. package/dist/session-kanban.js +1 -1
  99. package/dist/task.js +4 -4
  100. package/dist/test.js +4 -4
  101. package/dist/todo.js +3 -3
  102. package/dist/tool-diff.js +1 -1
  103. package/dist/tool-tier.js +45 -45
  104. package/dist/tool-use.js +1 -1
  105. package/dist/{ts-parser-RCTYKSVI.js → ts-parser-7W26YB26.js} +2 -2
  106. package/dist/typecheck.js +4 -4
  107. package/dist/write.js +7 -7
  108. package/dist/{yaml-parser-4SAXV3PL.js → yaml-parser-RGBXEZE4.js} +2 -2
  109. package/package.json +5 -5
@@ -156,7 +156,7 @@ async function handleBuiltIn(name, templateFiles, cwd, ctx, dryRun, vars) {
156
156
  for (const [filePath, content] of Object.entries(templateFiles)) {
157
157
  const resolvedPath = substituteVars(filePath, name, vars);
158
158
  const joinedPath = path.join(cwd, resolvedPath);
159
- const root = path.resolve(ctx.projectRoot);
159
+ const root = path.resolve(ctx.projectRoot ?? ctx.cwd ?? process.cwd());
160
160
  const target = path.resolve(joinedPath);
161
161
  const rel = path.relative(root, target);
162
162
  if (rel.startsWith("..") || path.isAbsolute(rel)) {
@@ -197,4 +197,4 @@ function substituteVars(content, name, vars) {
197
197
  export {
198
198
  scaffoldTool
199
199
  };
200
- //# sourceMappingURL=chunk-AHHDWNXC.js.map
200
+ //# sourceMappingURL=chunk-TKA4VEX2.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyPackageOperation
3
- } from "./chunk-PQKK5JH7.js";
3
+ } from "./chunk-4E42D7UF.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-22B7GE5T.js";
6
+ } from "./chunk-ZHH3BEWU.js";
7
7
  import {
8
8
  detectPackageManager,
9
9
  normalizeCommandOutput,
@@ -73,6 +73,7 @@ var installTool = {
73
73
  },
74
74
  async *executeStream(input, ctx, opts) {
75
75
  const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
76
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
76
77
  if (!input.global) {
77
78
  const pkgList2 = input.packages ? Array.isArray(input.packages) ? input.packages : input.packages.split(",").map((p) => p.trim()) : [];
78
79
  const bridge = await tryLegacyPackageOperation(
@@ -80,7 +81,7 @@ var installTool = {
80
81
  {
81
82
  cwd,
82
83
  projectRoot: ctx.projectRoot,
83
- signal: opts.signal
84
+ signal
84
85
  },
85
86
  pkgList2
86
87
  );
@@ -162,7 +163,7 @@ var installTool = {
162
163
  cmd: pkgManager,
163
164
  args,
164
165
  cwd,
165
- signal: opts.signal,
166
+ signal,
166
167
  maxBytes: 1e5
167
168
  });
168
169
  const output = {
@@ -187,7 +188,7 @@ var installTool = {
187
188
  ecosystem: detectPackageEcosystem(manifestPath),
188
189
  agentId: ctx.agentId,
189
190
  agentName: ctx.agentName,
190
- sessionId: ctx.session.id
191
+ sessionId: ctx.session?.id
191
192
  });
192
193
  } catch {
193
194
  }
@@ -220,4 +221,4 @@ function resolveManifestPath(cwd, pkgManager) {
220
221
  export {
221
222
  installTool
222
223
  };
223
- //# sourceMappingURL=chunk-5H4GSJAI.js.map
224
+ //# sourceMappingURL=chunk-UE3UBMCP.js.map
@@ -106,6 +106,7 @@ var fetchTool = {
106
106
  }
107
107
  await assertNotPrivate(u.hostname);
108
108
  yield { type: "log", text: `GET ${input.url}` };
109
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
109
110
  const ctrl = new AbortController();
110
111
  const timer = setTimeout(
111
112
  () => ctrl.abort(
@@ -117,13 +118,13 @@ var fetchTool = {
117
118
  ),
118
119
  TIMEOUT_MS
119
120
  );
120
- const combined = combineSignals([opts.signal, ctrl.signal]);
121
+ const combined = combineSignals([signal, ctrl.signal]);
121
122
  try {
122
123
  let res;
123
124
  try {
124
125
  res = await guardedFetch(input.url, 5, combined);
125
126
  } catch (err) {
126
- if (opts.signal.aborted) throw err;
127
+ if (signal.aborted) throw err;
127
128
  throw describeFetchError(err, input.url, ctrl.signal.aborted);
128
129
  }
129
130
  const ct = res.headers.get("content-type") ?? "application/octet-stream";
@@ -235,4 +236,4 @@ function prettyJson(s) {
235
236
  export {
236
237
  fetchTool
237
238
  };
238
- //# sourceMappingURL=chunk-IXMNTNW5.js.map
239
+ //# sourceMappingURL=chunk-UKGMDCXT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveIndexDir
3
- } from "./chunk-DA4KNE2H.js";
3
+ } from "./chunk-TFEGJDH5.js";
4
4
 
5
5
  // src/codebase-index/binary-frame.ts
6
6
  import { decode, encode } from "@msgpack/msgpack";
@@ -12,10 +12,11 @@ function isBinaryFrame(firstByte) {
12
12
  }
13
13
  function encodeBinaryFrame(message) {
14
14
  const payload = encode(normalizeUndefined(message));
15
- const header = Buffer.allocUnsafe(5);
16
- header[0] = BINARY_FRAME_MAGIC;
17
- header.writeUInt32BE(payload.length, 1);
18
- return Buffer.concat([header, payload], 5 + payload.length);
15
+ const frame = Buffer.allocUnsafe(5 + payload.length);
16
+ frame[0] = BINARY_FRAME_MAGIC;
17
+ frame.writeUInt32BE(payload.length, 1);
18
+ frame.set(payload, 5);
19
+ return frame;
19
20
  }
20
21
  function normalizeUndefined(value) {
21
22
  if (value instanceof Date) {
@@ -119,4 +120,4 @@ export {
119
120
  PROJECT_INDEX_SERVER_MAX_FRAME_CHARS,
120
121
  encodeProjectServerMessage
121
122
  };
122
- //# sourceMappingURL=chunk-4UESMQDP.js.map
123
+ //# sourceMappingURL=chunk-UOXX4SQZ.js.map
@@ -34,24 +34,34 @@ import { toErrorMessage } from "@wrongstack/core/utils/error";
34
34
  // src/_danger-detect.ts
35
35
  var argHas = (args, value) => args.includes(value);
36
36
  var argMatches = (args, re) => args.some((a) => re.test(a));
37
- var hasShortFlags = (args, letters) => {
37
+ var flagLetters = (args) => {
38
38
  const seen = /* @__PURE__ */ new Set();
39
39
  for (const a of args) {
40
- if (!/^-[a-zA-Z]+$/.test(a)) continue;
41
- for (const ch of a.slice(1)) seen.add(ch);
40
+ if (/^-[a-zA-Z]+$/.test(a)) {
41
+ for (const ch of a.slice(1)) seen.add(ch);
42
+ } else if (a === "--recursive") {
43
+ seen.add("r");
44
+ } else if (a === "--force") {
45
+ seen.add("f");
46
+ }
42
47
  }
43
- return letters.split("").every((l) => seen.has(l));
48
+ return seen;
44
49
  };
45
50
  var RULES = [
46
51
  // ----- rm / rmdir: recursive force delete (any path) -----
47
52
  // Note: BLOCKED_ARG_PATTERNS already hard-denies root/home/glob paths,
48
53
  // but `rm -rf ./build` is a normal dev workflow that the user might
49
54
  // want to do intentionally. We downgrade it to 'destructive' so the
50
- // confirm prompt can approve.
55
+ // confirm prompt can approve. Short clusters, GNU long forms
56
+ // (`--recursive --force`), and mixed shapes all classify identically.
51
57
  {
52
58
  id: "rm-recursive",
53
59
  level: "destructive",
54
- test: (cmd, args) => (cmd === "rm" || cmd === "rmdir") && hasShortFlags(args, "rf"),
60
+ test: (cmd, args) => {
61
+ if (cmd !== "rm" && cmd !== "rmdir") return false;
62
+ const letters = flagLetters(args);
63
+ return letters.has("r") && letters.has("f");
64
+ },
55
65
  reason: "recursive force-delete"
56
66
  },
57
67
  // ----- Windows PowerShell Remove-Item: -Recurse -Force -----
@@ -1541,7 +1551,7 @@ var execTool = {
1541
1551
  danger
1542
1552
  };
1543
1553
  }
1544
- const signal = opts.signal;
1554
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
1545
1555
  return runCommand(cmd, args, cwd, timeout, signal, ctx.session?.id, danger);
1546
1556
  }
1547
1557
  };
@@ -1720,4 +1730,4 @@ export {
1720
1730
  getExecAllowlist,
1721
1731
  execTool
1722
1732
  };
1723
- //# sourceMappingURL=chunk-T2F4S7U4.js.map
1733
+ //# sourceMappingURL=chunk-WI3VDXHD.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
3
- } from "./chunk-PQKK5JH7.js";
3
+ } from "./chunk-4E42D7UF.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-22B7GE5T.js";
6
+ } from "./chunk-ZHH3BEWU.js";
7
7
  import {
8
8
  normalizeCommandOutput,
9
9
  safeResolveReal
@@ -48,12 +48,13 @@ var lintTool = {
48
48
  },
49
49
  async *executeStream(input, ctx, opts) {
50
50
  const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
51
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
51
52
  const linter = input.linter ?? "auto";
52
53
  if (linter === "auto" && !input.files) {
53
54
  const bridge = await tryLegacyCodeOperation("lint", {
54
55
  cwd,
55
56
  projectRoot: ctx.projectRoot,
56
- signal: opts.signal
57
+ signal
57
58
  });
58
59
  if (bridge?.run) {
59
60
  const run = bridge.run;
@@ -96,7 +97,7 @@ var lintTool = {
96
97
  args.push("--", ...files.map((f) => f.trim()));
97
98
  }
98
99
  const cmd = detected === "biome" ? "biome" : detected;
99
- const result = yield* spawnStream({ cmd, args, cwd, signal: opts.signal, maxBytes: 1e5 });
100
+ const result = yield* spawnStream({ cmd, args, cwd, signal, maxBytes: 1e5 });
100
101
  const errors = [...result.stdout.matchAll(/\berror\b/gi)].length;
101
102
  const warnings = [...result.stdout.matchAll(/\bwarning\b/gi)].length;
102
103
  yield {
@@ -131,4 +132,4 @@ async function detectLinter(cwd) {
131
132
  export {
132
133
  lintTool
133
134
  };
134
- //# sourceMappingURL=chunk-O4MBV4AX.js.map
135
+ //# sourceMappingURL=chunk-WJYXMB2R.js.map
@@ -99,14 +99,23 @@ var batchToolUseTool = {
99
99
  let succeeded = 0;
100
100
  let failed = 0;
101
101
  if (input.parallel !== false) {
102
+ let stopRequested = false;
102
103
  const allResults = await mapWithConcurrency(
103
104
  input.calls,
104
105
  MAX_PARALLEL_BATCH_CALLS,
105
- (call) => executeSingle(call, ctx, governedExecute)
106
+ async (call) => {
107
+ const result = await executeSingle(call, ctx, governedExecute);
108
+ if (input.stop_on_error && !result.success) stopRequested = true;
109
+ return result;
110
+ },
111
+ () => stopRequested
112
+ );
113
+ const executed = allResults.filter(
114
+ (r) => r !== void 0
106
115
  );
107
- results.push(...allResults);
108
- succeeded = allResults.filter((r) => r.success).length;
109
- failed = allResults.filter((r) => !r.success).length;
116
+ results.push(...executed);
117
+ succeeded = executed.filter((r) => r.success).length;
118
+ failed = executed.filter((r) => !r.success).length;
110
119
  } else {
111
120
  for (const call of input.calls) {
112
121
  const result = await executeSingle(call, ctx, governedExecute);
@@ -128,11 +137,12 @@ var batchToolUseTool = {
128
137
  };
129
138
  }
130
139
  };
131
- async function mapWithConcurrency(items, limit, run) {
140
+ async function mapWithConcurrency(items, limit, run, shouldStop) {
132
141
  const results = new Array(items.length);
133
142
  let nextIndex = 0;
134
143
  const worker = async () => {
135
144
  while (nextIndex < items.length) {
145
+ if (shouldStop?.()) return;
136
146
  const index = nextIndex++;
137
147
  results[index] = await run(items[index]);
138
148
  }
@@ -190,4 +200,4 @@ async function executeSingle(call, ctx, governedExecute) {
190
200
  export {
191
201
  batchToolUseTool
192
202
  };
193
- //# sourceMappingURL=chunk-U4VAATKP.js.map
203
+ //# sourceMappingURL=chunk-WXJY3BKV.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  todoTool
3
- } from "./chunk-7EY5DCRO.js";
3
+ } from "./chunk-5ZYEGP2P.js";
4
4
  import {
5
5
  mirrorSessionTasksToKanban
6
- } from "./chunk-PY2IOS7C.js";
6
+ } from "./chunk-CWALNI6K.js";
7
7
 
8
8
  // src/task.ts
9
9
  import { randomUUID } from "node:crypto";
@@ -517,4 +517,4 @@ ${formatTaskList(file.tasks)}` : file.tasks.length > 0 ? formatTaskList(file.tas
517
517
  export {
518
518
  taskTool
519
519
  };
520
- //# sourceMappingURL=chunk-DR7JOQTC.js.map
520
+ //# sourceMappingURL=chunk-X5K3U6GI.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  e2ePlanTool
3
- } from "./chunk-JRJJX3L5.js";
3
+ } from "./chunk-5WNDJHT6.js";
4
4
  import {
5
5
  codebaseAstReplaceTool,
6
6
  codebaseImpactAnalysisTool,
@@ -14,22 +14,22 @@ import {
14
14
  codebaseStatsTool,
15
15
  codebaseTargetedTestTool,
16
16
  deadCodeScanTool
17
- } from "./chunk-L25CVUVR.js";
17
+ } from "./chunk-AK2K4KHR.js";
18
18
  import {
19
19
  planTool
20
- } from "./chunk-NKJW5GFO.js";
20
+ } from "./chunk-H6AWAZ2Y.js";
21
21
  import {
22
22
  taskTool
23
- } from "./chunk-DR7JOQTC.js";
23
+ } from "./chunk-X5K3U6GI.js";
24
24
  import {
25
25
  toolSearchTool
26
26
  } from "./chunk-RJZQWEMS.js";
27
27
  import {
28
28
  toolUseTool
29
- } from "./chunk-S5CCLZL3.js";
29
+ } from "./chunk-FRN7TIAA.js";
30
30
  import {
31
31
  batchToolUseTool
32
- } from "./chunk-U4VAATKP.js";
32
+ } from "./chunk-WXJY3BKV.js";
33
33
  import {
34
34
  toolHelpTool
35
35
  } from "./chunk-QBV725YG.js";
@@ -38,73 +38,73 @@ import {
38
38
  } from "./chunk-6RNIFLG4.js";
39
39
  import {
40
40
  testTool
41
- } from "./chunk-BSLVR56S.js";
41
+ } from "./chunk-CPVLVQYT.js";
42
42
  import {
43
43
  installTool
44
- } from "./chunk-5H4GSJAI.js";
44
+ } from "./chunk-UE3UBMCP.js";
45
45
  import {
46
46
  auditTool
47
- } from "./chunk-VJNHFZ7J.js";
47
+ } from "./chunk-CVALEVGA.js";
48
48
  import {
49
49
  outdatedTool
50
- } from "./chunk-LWKUTMD5.js";
50
+ } from "./chunk-MRZOVQ5D.js";
51
51
  import {
52
52
  logsTool
53
- } from "./chunk-RGISBZBD.js";
53
+ } from "./chunk-CPSAF2AU.js";
54
54
  import {
55
55
  documentTool
56
56
  } from "./chunk-EMRGN4KM.js";
57
57
  import {
58
58
  scaffoldTool
59
- } from "./chunk-AHHDWNXC.js";
59
+ } from "./chunk-TKA4VEX2.js";
60
60
  import {
61
61
  gitTool
62
- } from "./chunk-RXISBFR5.js";
62
+ } from "./chunk-ZE6KLBUO.js";
63
63
  import {
64
64
  patchTool
65
- } from "./chunk-QZQSPUBF.js";
65
+ } from "./chunk-RUOMW2I6.js";
66
66
  import {
67
67
  jsonTool
68
68
  } from "./chunk-VB3MJGCV.js";
69
69
  import {
70
70
  diffTool
71
- } from "./chunk-UKU2ZX4C.js";
71
+ } from "./chunk-P7ZQ2FAJ.js";
72
72
  import {
73
73
  treeTool
74
74
  } from "./chunk-J5SKD6LN.js";
75
75
  import {
76
76
  lintTool
77
- } from "./chunk-O4MBV4AX.js";
77
+ } from "./chunk-WJYXMB2R.js";
78
78
  import {
79
79
  formatTool
80
- } from "./chunk-SDLVH5RZ.js";
80
+ } from "./chunk-3QQSBUXR.js";
81
81
  import {
82
82
  typecheckTool
83
- } from "./chunk-EJWSCQ6D.js";
83
+ } from "./chunk-4AEZIFOW.js";
84
84
  import {
85
85
  languageInfoTool,
86
86
  languagePackageTool,
87
87
  languageTool
88
- } from "./chunk-OUBDL3WH.js";
88
+ } from "./chunk-SOG7XIRF.js";
89
89
  import {
90
90
  replaceTool
91
- } from "./chunk-MZZN7VCD.js";
91
+ } from "./chunk-6RR5VX6U.js";
92
92
  import {
93
93
  globTool
94
- } from "./chunk-UNSKG6DC.js";
94
+ } from "./chunk-ICAXDRP6.js";
95
95
  import {
96
96
  grepTool
97
- } from "./chunk-553IQUMO.js";
97
+ } from "./chunk-S2JRYDYG.js";
98
98
  import {
99
99
  bashTool,
100
100
  checkAndBlockKillCommand,
101
101
  diagnoseBashism,
102
102
  shellArgs
103
- } from "./chunk-IVWV2UM6.js";
103
+ } from "./chunk-HTYEO67J.js";
104
104
  import {
105
105
  detectDanger,
106
106
  execTool
107
- } from "./chunk-T2F4S7U4.js";
107
+ } from "./chunk-WI3VDXHD.js";
108
108
  import {
109
109
  buildChildEnv
110
110
  } from "./chunk-BTSFTGIL.js";
@@ -118,28 +118,28 @@ import {
118
118
  } from "./chunk-3PVYQFRQ.js";
119
119
  import {
120
120
  fetchTool
121
- } from "./chunk-IXMNTNW5.js";
121
+ } from "./chunk-UKGMDCXT.js";
122
122
  import {
123
123
  searchTool
124
- } from "./chunk-4I4LWFOO.js";
124
+ } from "./chunk-PQTONQ4P.js";
125
125
  import {
126
126
  todoTool
127
- } from "./chunk-7EY5DCRO.js";
127
+ } from "./chunk-5ZYEGP2P.js";
128
128
  import {
129
129
  kanbanTool
130
- } from "./chunk-JNNVRHMV.js";
130
+ } from "./chunk-FJEQZHZN.js";
131
131
  import {
132
132
  browserTools
133
- } from "./chunk-K3WNSHUF.js";
133
+ } from "./chunk-45JPRMC2.js";
134
134
  import {
135
135
  readTool
136
- } from "./chunk-JOHXDF3D.js";
136
+ } from "./chunk-NKX4SJ5R.js";
137
137
  import {
138
138
  writeTool
139
- } from "./chunk-VFKPWSOX.js";
139
+ } from "./chunk-BANPF4LY.js";
140
140
  import {
141
141
  editTool
142
- } from "./chunk-ZJQ4IGXK.js";
142
+ } from "./chunk-TDLZIDCY.js";
143
143
  import {
144
144
  resolvePowerShell
145
145
  } from "./chunk-V43EQ6VR.js";
@@ -368,6 +368,7 @@ var pwshTool = {
368
368
  return;
369
369
  }
370
370
  const startedAt = Date.now();
371
+ const callerSignal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
371
372
  const detached = !isWin;
372
373
  if (isBackground) {
373
374
  const child2 = spawn(bin, args, {
@@ -525,8 +526,8 @@ Working directory: ${targetCwd}`,
525
526
  }, timeoutMs);
526
527
  timers.push(timer);
527
528
  const onAbort = () => killWithTimeout(2e3);
528
- if (opts.signal.aborted) onAbort();
529
- else opts.signal.addEventListener("abort", onAbort, { once: true });
529
+ if (callerSignal.aborted) onAbort();
530
+ else callerSignal.addEventListener("abort", onAbort, { once: true });
530
531
  const queue = [];
531
532
  let resolveNext = null;
532
533
  const push = (c) => {
@@ -825,7 +826,7 @@ var securityAstScanTool = {
825
826
  },
826
827
  async execute(input, ctx) {
827
828
  try {
828
- const projectRoot = ctx.projectRoot;
829
+ const projectRoot = ctx.projectRoot ?? ctx.cwd ?? process.cwd();
829
830
  let targetFile = input.file ?? "inline-code.ts";
830
831
  let content = input.content;
831
832
  if (!content && input.file) {
@@ -1088,4 +1089,4 @@ export {
1088
1089
  TIER3_TOOLS,
1089
1090
  builtinTools
1090
1091
  };
1091
- //# sourceMappingURL=chunk-VXECAJJ7.js.map
1092
+ //# sourceMappingURL=chunk-XVGB6KYU.js.map
@@ -1,5 +1,4 @@
1
1
  // src/codebase-index/languages.ts
2
- import * as path from "node:path";
3
2
  var EXT_TO_LANG = {
4
3
  // TypeScript / JavaScript (first-class TS compiler API)
5
4
  ".ts": "ts",
@@ -88,15 +87,17 @@ var SPECIAL_FILENAMES = {
88
87
  justfile: "other"
89
88
  };
90
89
  function detectLang(file) {
91
- const base = path.basename(file);
90
+ const lastSlash = Math.max(file.lastIndexOf("/"), file.lastIndexOf("\\"));
91
+ const base = lastSlash === -1 ? file : file.slice(lastSlash + 1);
92
92
  const lowerBase = base.toLowerCase();
93
93
  if (lowerBase.endsWith(".d.ts") || lowerBase.endsWith(".d.mts") || lowerBase.endsWith(".d.cts")) {
94
94
  return "ts";
95
95
  }
96
96
  const special = SPECIAL_FILENAMES[lowerBase];
97
97
  if (special) return special;
98
- const ext = path.extname(base).toLowerCase();
99
- if (!ext) return null;
98
+ const dot = lowerBase.lastIndexOf(".");
99
+ if (dot <= 0) return null;
100
+ const ext = lowerBase.slice(dot);
100
101
  return EXT_TO_LANG[ext] ?? null;
101
102
  }
102
103
  function isIndexablePath(file) {
@@ -160,4 +161,4 @@ export {
160
161
  LANG_FAMILY_ENTRIES,
161
162
  languageFamily
162
163
  };
163
- //# sourceMappingURL=chunk-TEBQ4VPZ.js.map
164
+ //# sourceMappingURL=chunk-YOHO4DVT.js.map
@@ -116,6 +116,7 @@ var gitTool = {
116
116
  };
117
117
  }
118
118
  const args = buildArgs(input);
119
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
119
120
  let safetyWarning;
120
121
  if (input.command === "commit") {
121
122
  try {
@@ -123,7 +124,7 @@ var gitTool = {
123
124
  cwd: ctx.cwd,
124
125
  projectRoot: ctx.projectRoot,
125
126
  sessionId: ctx.session?.id,
126
- signal: opts.signal
127
+ signal
127
128
  });
128
129
  if (report.warning) {
129
130
  const scopeNote = input.files ? "" : "\nNote: this commit has no explicit `files` list, so it will include ALL staged changes. Pass `files` to scope the commit to only what you changed.";
@@ -135,7 +136,7 @@ var gitTool = {
135
136
  let stagedDiff;
136
137
  if (input.command === "commit" && !input.dry_run) {
137
138
  try {
138
- const diffResult = await runGit(["diff", "--cached"], gitDir, opts.signal);
139
+ const diffResult = await runGit(["diff", "--cached"], gitDir, signal);
139
140
  if (diffResult.exitCode === 0) {
140
141
  const MAX_DIFF = 2e4;
141
142
  stagedDiff = diffResult.stdout.length > MAX_DIFF ? diffResult.stdout.slice(0, MAX_DIFF) + "\n\n... (diff truncated)" : diffResult.stdout;
@@ -143,7 +144,7 @@ var gitTool = {
143
144
  } catch {
144
145
  }
145
146
  }
146
- const result = await runGit(args, gitDir, opts.signal);
147
+ const result = await runGit(args, gitDir, signal);
147
148
  if (stagedDiff !== void 0) result.diff = stagedDiff;
148
149
  if (safetyWarning !== void 0) result.warning = safetyWarning;
149
150
  return result;
@@ -312,4 +313,4 @@ function runGit(args, cwd, signal) {
312
313
  export {
313
314
  gitTool
314
315
  };
315
- //# sourceMappingURL=chunk-RXISBFR5.js.map
316
+ //# sourceMappingURL=chunk-ZE6KLBUO.js.map
@@ -21,6 +21,7 @@ import {
21
21
  import { buildChildEnv } from "@wrongstack/core/utils";
22
22
  var isWin = process.platform === "win32";
23
23
  async function* spawnStream(opts) {
24
+ const signal = opts.signal;
24
25
  const max = opts.maxBytes ?? 999999999;
25
26
  const flushAt = opts.flushBytes ?? 4 * 1024;
26
27
  const maxQueue = opts.maxQueueSize ?? 500;
@@ -42,7 +43,7 @@ async function* spawnStream(opts) {
42
43
  env: buildChildEnv(),
43
44
  stdio: ["ignore", "pipe", "pipe"],
44
45
  windowsHide: true,
45
- ...isWin ? {} : { signal: opts.signal },
46
+ ...isWin || !signal ? {} : { signal },
46
47
  ...shim ? { windowsVerbatimArguments: shim.windowsVerbatimArguments } : {}
47
48
  });
48
49
  const registry = getProcessRegistry();
@@ -134,13 +135,13 @@ async function* spawnStream(opts) {
134
135
  queuedBytes += bytes;
135
136
  wake();
136
137
  });
137
- const completeTelemetry = (code, signal, timedOut = false) => {
138
+ const completeTelemetry = (code, signal2, timedOut = false) => {
138
139
  if (telemetryCompleted) return;
139
140
  telemetryCompleted = true;
140
141
  emitProcessCompleted({
141
142
  ...pid !== void 0 ? { pid } : {},
142
143
  exitCode: code,
143
- ...signal ? { signal } : {},
144
+ ...signal2 ? { signal: signal2 } : {},
144
145
  durationMs: Date.now() - processStartedAt,
145
146
  stdoutBytes,
146
147
  stderrBytes,
@@ -148,16 +149,16 @@ async function* spawnStream(opts) {
148
149
  endedAt: (/* @__PURE__ */ new Date()).toISOString()
149
150
  });
150
151
  };
151
- child.on("close", (code, signal) => {
152
+ child.on("close", (code, signal2) => {
152
153
  if (typeof pid === "number") registry.unregister(pid);
153
- const exitCode2 = code ?? (signal ? 1 : 0);
154
- completeTelemetry(exitCode2, signal ?? void 0);
154
+ const exitCode2 = code ?? (signal2 ? 1 : 0);
155
+ completeTelemetry(exitCode2, signal2 ?? void 0);
155
156
  queue.push({
156
157
  kind: "close",
157
158
  data: "",
158
159
  bytes: 0,
159
160
  code: exitCode2,
160
- ...signal ? { signal } : {}
161
+ ...signal2 ? { signal: signal2 } : {}
161
162
  });
162
163
  wake();
163
164
  });
@@ -174,9 +175,9 @@ async function* spawnStream(opts) {
174
175
  completeTelemetry(124, "SIGKILL", true);
175
176
  wake();
176
177
  };
177
- if (isWin) {
178
- if (opts.signal.aborted) onAbort();
179
- else opts.signal.addEventListener("abort", onAbort, { once: true });
178
+ if (isWin && signal) {
179
+ if (signal.aborted) onAbort();
180
+ else signal.addEventListener("abort", onAbort, { once: true });
180
181
  }
181
182
  let exitCode = 0;
182
183
  let spawnFailed = false;
@@ -222,7 +223,7 @@ async function* spawnStream(opts) {
222
223
  };
223
224
  } finally {
224
225
  spool.finalize();
225
- if (isWin) opts.signal.removeEventListener("abort", onAbort);
226
+ if (isWin && signal) signal.removeEventListener("abort", onAbort);
226
227
  child.stdout?.off("data", onOut);
227
228
  child.stderr?.off("data", onErr);
228
229
  child.stdout?.destroy();
@@ -257,4 +258,4 @@ function utf8Prefix(text, maxBytes) {
257
258
  export {
258
259
  spawnStream
259
260
  };
260
- //# sourceMappingURL=chunk-22B7GE5T.js.map
261
+ //# sourceMappingURL=chunk-ZHH3BEWU.js.map
@@ -21,11 +21,24 @@ interface IndexableDoc {
21
21
  id: number;
22
22
  text: string;
23
23
  }
24
+ /**
25
+ * Max chars of `signature` fed to the FTS index (P1, 2026-08-30).
26
+ *
27
+ * `signature` stores the full printed declaration — often including the whole
28
+ * function body, because `ts-parser`'s getSignature uses `printer.printNode`
29
+ * (capped at 500 chars). Measured on the live 131k-row index: ts+tsx signature
30
+ * text was ~70% of all trigram FTS input, and capping to the declaration
31
+ * header cut FTS size 47% and insert time 20-32%. Only the FTS *input* is
32
+ * capped; the stored `signature` column (display, embeddings fallback) is
33
+ * untouched.
34
+ */
35
+ export declare const FTS_SIGNATURE_MAX_CHARS = 300;
24
36
  /**
25
37
  * Build indexable text for BM25 from a symbol's fields.
26
38
  * The name is split into camelCase/SnakeCase words so that queries
27
39
  * like "complex" match "complexOperation". The verbatim name is
28
- * also included for exact-match queries.
40
+ * also included for exact-match queries. The signature contributes
41
+ * only its declaration header (see {@link ftsSignature}).
29
42
  */
30
43
  export declare function buildIndexableText(name: string, signature: string, docComment: string): string;
31
44
  export declare function buildBm25Index(docs: IndexableDoc[]): Bm25Index;