@wrongstack/tools 0.319.1 → 1.0.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 (203) hide show
  1. package/dist/_danger-detect.d.ts +8 -0
  2. package/dist/_syntax-check.d.ts +1 -2
  3. package/dist/audit.d.ts +4 -5
  4. package/dist/audit.js +8 -8
  5. package/dist/auto-proceed-loop-guard.js +9 -160
  6. package/dist/bash-kill-guard.d.ts +2 -3
  7. package/dist/bash.d.ts +2 -3
  8. package/dist/bash.js +6 -6
  9. package/dist/batch-tool-use.d.ts +2 -3
  10. package/dist/batch-tool-use.js +1 -1
  11. package/dist/browser/index.d.ts +1 -1
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/tools.d.ts +56 -45
  14. package/dist/builtin.js +55 -55
  15. package/dist/{chunk-RJZQWEMS.js → chunk-24T5XIJU.js} +3 -2
  16. package/dist/{chunk-DTQ75VBC.js → chunk-2CTZW6JQ.js} +2 -2
  17. package/dist/chunk-37QKUQ2Z.js +171 -0
  18. package/dist/{chunk-LOBRWKCR.js → chunk-3D5DJWOE.js} +3 -3
  19. package/dist/{chunk-YOKD4GWJ.js → chunk-4ERMPDHV.js} +14 -8
  20. package/dist/{chunk-5EUJF3WC.js → chunk-4WPBS45A.js} +4 -5
  21. package/dist/{chunk-42BHI7TN.js → chunk-5ITQPCLC.js} +2 -2
  22. package/dist/{chunk-B4HTSV6Z.js → chunk-5KS24LTS.js} +11 -11
  23. package/dist/{chunk-QPNYDH5B.js → chunk-62OAECEQ.js} +29 -7
  24. package/dist/{chunk-IYKXK356.js → chunk-6GOZTS6F.js} +4 -4
  25. package/dist/{chunk-OG2BEUBY.js → chunk-7HL23T3T.js} +73 -16
  26. package/dist/{chunk-HFXSNKCV.js → chunk-7JJFC6CT.js} +1 -1
  27. package/dist/{chunk-TTZOK6IY.js → chunk-7N5U2RAU.js} +2 -2
  28. package/dist/{chunk-QBV725YG.js → chunk-7ODZTPCU.js} +2 -2
  29. package/dist/{chunk-OTINMOKK.js → chunk-AB2CAUOP.js} +66 -55
  30. package/dist/{chunk-6AAOT4PW.js → chunk-AQ5YBURX.js} +16 -4
  31. package/dist/{chunk-JDPQOR7C.js → chunk-ASEXQRA7.js} +19 -19
  32. package/dist/{chunk-FRN7TIAA.js → chunk-B3MGJBFI.js} +1 -1
  33. package/dist/{chunk-IWS56OY7.js → chunk-CGXTR34H.js} +63 -4
  34. package/dist/{chunk-IU4DV2PA.js → chunk-CHEK3ASV.js} +6 -3
  35. package/dist/{chunk-GOIZNNOA.js → chunk-DJYLI7EW.js} +1 -1
  36. package/dist/{chunk-CFLJFDYV.js → chunk-DK4J2WMH.js} +14 -11
  37. package/dist/{chunk-ZHH3BEWU.js → chunk-DRRY6SCM.js} +49 -22
  38. package/dist/{chunk-BK732J7I.js → chunk-FBUP524S.js} +4 -4
  39. package/dist/{chunk-WHIIIREL.js → chunk-FVM3O4JQ.js} +7 -3
  40. package/dist/chunk-FYDBUVQD.js +244 -0
  41. package/dist/{chunk-UDVKRX5R.js → chunk-GDDXX27P.js} +50 -50
  42. package/dist/{chunk-O44IMQCN.js → chunk-GKSG5CPH.js} +6 -6
  43. package/dist/{chunk-3PVYQFRQ.js → chunk-HDYUBRMF.js} +5 -3
  44. package/dist/{chunk-ELRRTWNP.js → chunk-IXIS7RSG.js} +2 -2
  45. package/dist/{chunk-X5FOFGXX.js → chunk-IYH4OHBP.js} +6 -6
  46. package/dist/{chunk-MNP3GE7H.js → chunk-JDOO4P6Z.js} +21 -16
  47. package/dist/{chunk-BSJSNVGA.js → chunk-KDEXUQY7.js} +24 -11
  48. package/dist/{chunk-V43EQ6VR.js → chunk-KE7A76VC.js} +3 -2
  49. package/dist/{chunk-2OXHS3KZ.js → chunk-KLJZ4WV4.js} +4 -3
  50. package/dist/{chunk-3M7LLN7W.js → chunk-LQSOU63Z.js} +12 -11
  51. package/dist/{chunk-DC4KMPJO.js → chunk-M6UV67BH.js} +2 -2
  52. package/dist/{chunk-C2DQKVLO.js → chunk-MJSJWXBF.js} +1 -1
  53. package/dist/{chunk-RNWUCZ2U.js → chunk-MK2JK35J.js} +29 -12
  54. package/dist/{chunk-FQZOHLG3.js → chunk-MSOAX3GC.js} +3 -2
  55. package/dist/{chunk-KY4PXYSO.js → chunk-N3K2SFEI.js} +534 -494
  56. package/dist/{chunk-EADULOZV.js → chunk-NJX2RXKJ.js} +50 -7
  57. package/dist/{chunk-AKHYMB4V.js → chunk-NN2SNP2R.js} +6 -6
  58. package/dist/{chunk-CMOUCKGC.js → chunk-NU2IZ72J.js} +6 -6
  59. package/dist/{chunk-RLMX75EM.js → chunk-O6BY43ZB.js} +29 -8
  60. package/dist/{chunk-NKNOBUBU.js → chunk-PVCB7RUZ.js} +2 -2
  61. package/dist/{chunk-UQQS3VNT.js → chunk-QA6IASYX.js} +8 -8
  62. package/dist/{chunk-VPALDFYM.js → chunk-RV7BVTDG.js} +1 -1
  63. package/dist/chunk-S57CDR2H.js +288 -0
  64. package/dist/{chunk-2VSZC6QM.js → chunk-SCMRM6NL.js} +6 -4
  65. package/dist/{chunk-W2CECGTG.js → chunk-SMARDKAC.js} +1 -1
  66. package/dist/{chunk-45JPRMC2.js → chunk-SOR7OCYP.js} +7 -3
  67. package/dist/{chunk-ATSKPZUK.js → chunk-T3SMFF5Q.js} +11 -5
  68. package/dist/{chunk-4BHUSMNL.js → chunk-UI3ZJIG3.js} +1 -1
  69. package/dist/{chunk-WXJY3BKV.js → chunk-VBF2YXUW.js} +2 -2
  70. package/dist/{chunk-FQNXYA6W.js → chunk-VU3QBYL4.js} +36 -5
  71. package/dist/{chunk-IIF5HIVF.js → chunk-VVZPQPTY.js} +2 -2
  72. package/dist/{chunk-VD2LV5WO.js → chunk-VZGPASGD.js} +37 -12
  73. package/dist/{chunk-64VIJPFV.js → chunk-WEEVSWQB.js} +17 -6
  74. package/dist/chunk-XXRMF2BC.js +186 -0
  75. package/dist/{chunk-RTZWBNTY.js → chunk-YEISRT4S.js} +7 -12
  76. package/dist/{chunk-Q5JPPCZC.js → chunk-YJTXRH5Y.js} +3 -2
  77. package/dist/{chunk-GMZYW52L.js → chunk-YULVUTK5.js} +6 -3
  78. package/dist/{chunk-NWZ6XGBJ.js → chunk-ZBMANLYH.js} +5 -3
  79. package/dist/{chunk-DP6CXMJZ.js → chunk-ZTCJCYLN.js} +3 -3
  80. package/dist/circuit-breaker.d.ts +1 -0
  81. package/dist/circuit-breaker.js +1 -1
  82. package/dist/clarify.d.ts +1 -0
  83. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +2 -3
  84. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +5 -4
  85. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +4 -3
  86. package/dist/codebase-index/codebase-index-tool.d.ts +2 -3
  87. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +2 -3
  88. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +4 -3
  89. package/dist/codebase-index/codebase-repo-map-tool.d.ts +2 -3
  90. package/dist/codebase-index/codebase-search-tool.d.ts +2 -3
  91. package/dist/codebase-index/codebase-skeleton-tool.d.ts +2 -3
  92. package/dist/codebase-index/codebase-stats-tool.d.ts +9 -3
  93. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +4 -3
  94. package/dist/codebase-index/index.d.ts +11 -11
  95. package/dist/codebase-index/index.js +12 -12
  96. package/dist/codebase-index/parser-worker-script.js +3 -3
  97. package/dist/codebase-index/project-server-framing.d.ts +29 -0
  98. package/dist/codebase-index/project-server-lifecycle.d.ts +20 -0
  99. package/dist/codebase-index/project-server-operations.d.ts +37 -0
  100. package/dist/codebase-index/project-server-types.d.ts +30 -0
  101. package/dist/codebase-index/project-server-watcher.d.ts +25 -0
  102. package/dist/codebase-index/project-server.js +451 -394
  103. package/dist/codebase-index/worker.js +5 -5
  104. package/dist/codebase-index/writer-init.d.ts +13 -0
  105. package/dist/codebase-index/writer-maintenance.d.ts +14 -0
  106. package/dist/codebase-index/writer.d.ts +0 -15
  107. package/dist/design.d.ts +2 -2
  108. package/dist/design.js +1 -1
  109. package/dist/diff.d.ts +4 -4
  110. package/dist/diff.js +2 -2
  111. package/dist/document.d.ts +3 -4
  112. package/dist/document.js +1 -1
  113. package/dist/e2e.d.ts +1 -1
  114. package/dist/e2e.js +1 -1
  115. package/dist/edit.d.ts +3 -3
  116. package/dist/edit.js +9 -9
  117. package/dist/exec.d.ts +2 -3
  118. package/dist/exec.js +6 -6
  119. package/dist/fetch.d.ts +4 -3
  120. package/dist/fetch.js +1 -1
  121. package/dist/format.d.ts +17 -45
  122. package/dist/format.js +14 -10
  123. package/dist/git.d.ts +3 -3
  124. package/dist/git.js +1 -1
  125. package/dist/glob.d.ts +2 -3
  126. package/dist/glob.js +3 -3
  127. package/dist/{go-parser-IKHW67WE.js → go-parser-D7ELWQ7F.js} +2 -2
  128. package/dist/grep.d.ts +7 -5
  129. package/dist/grep.js +4 -4
  130. package/dist/index.d.ts +54 -45
  131. package/dist/index.js +122 -63
  132. package/dist/install.d.ts +7 -55
  133. package/dist/install.js +8 -8
  134. package/dist/{json-parser-2EOVP5MR.js → json-parser-34DHYCPW.js} +1 -18
  135. package/dist/json.d.ts +3 -4
  136. package/dist/json.js +2 -2
  137. package/dist/kanban-tool-types.d.ts +1 -2
  138. package/dist/kanban.d.ts +3 -19
  139. package/dist/kanban.js +1 -1
  140. package/dist/languages/execute-tool.d.ts +2 -3
  141. package/dist/languages/index.d.ts +2 -2
  142. package/dist/languages/index.js +6 -6
  143. package/dist/languages/tool.d.ts +3 -4
  144. package/dist/legacy-bridge-YXANP5QB.js +18 -0
  145. package/dist/lint.d.ts +5 -4
  146. package/dist/lint.js +8 -8
  147. package/dist/logs.d.ts +3 -4
  148. package/dist/logs.js +2 -2
  149. package/dist/memory.d.ts +7 -8
  150. package/dist/memory.js +1 -1
  151. package/dist/mode.d.ts +3 -4
  152. package/dist/mode.js +1 -1
  153. package/dist/next-steps-tool.d.ts +2 -3
  154. package/dist/next-steps.d.ts +11 -0
  155. package/dist/next-steps.js +10 -132
  156. package/dist/outdated.d.ts +5 -29
  157. package/dist/outdated.js +4 -4
  158. package/dist/pack.js +56 -56
  159. package/dist/{parser-dispatch-QGC4HSP5.js → parser-dispatch-BDVCJXTV.js} +4 -4
  160. package/dist/patch.d.ts +2 -3
  161. package/dist/patch.js +8 -8
  162. package/dist/plan.d.ts +4 -4
  163. package/dist/plan.js +3 -3
  164. package/dist/process-registry.js +2 -2
  165. package/dist/ps-slash.js +4 -4
  166. package/dist/pwsh.d.ts +1 -0
  167. package/dist/{py-parser-RFWG2HYI.js → py-parser-QC6MR4GB.js} +3 -3
  168. package/dist/read.d.ts +5 -5
  169. package/dist/read.js +8 -8
  170. package/dist/replace.d.ts +2 -3
  171. package/dist/replace.js +10 -10
  172. package/dist/scaffold.d.ts +7 -3
  173. package/dist/scaffold.js +3 -1
  174. package/dist/search.d.ts +17 -3
  175. package/dist/search.js +5 -1
  176. package/dist/set-working-dir.d.ts +2 -3
  177. package/dist/skill.d.ts +4 -5
  178. package/dist/skill.js +1 -1
  179. package/dist/task.d.ts +6 -6
  180. package/dist/task.js +3 -3
  181. package/dist/test.d.ts +5 -4
  182. package/dist/test.js +8 -8
  183. package/dist/todo.d.ts +8 -8
  184. package/dist/todo.js +2 -2
  185. package/dist/tool-diff.js +11 -230
  186. package/dist/tool-help.d.ts +2 -3
  187. package/dist/tool-help.js +1 -1
  188. package/dist/tool-search.d.ts +2 -3
  189. package/dist/tool-search.js +1 -1
  190. package/dist/tool-summary.js +5 -281
  191. package/dist/tool-tier.js +57 -57
  192. package/dist/tool-use.d.ts +2 -3
  193. package/dist/tool-use.js +1 -1
  194. package/dist/tree.d.ts +5 -3
  195. package/dist/tree.js +5 -1
  196. package/dist/typecheck.d.ts +3 -3
  197. package/dist/typecheck.js +8 -8
  198. package/dist/win32.js +1 -1
  199. package/dist/write.d.ts +2 -3
  200. package/dist/write.js +9 -9
  201. package/package.json +5 -5
  202. package/dist/legacy-bridge-3T7SR4SK.js +0 -18
  203. package/dist/spawn-background.d.ts +0 -80
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  createOutputSpool,
3
3
  spoolNote
4
- } from "./chunk-2VSZC6QM.js";
4
+ } from "./chunk-SCMRM6NL.js";
5
5
  import {
6
6
  getProcessRegistry,
7
7
  redactCommand
8
- } from "./chunk-3PVYQFRQ.js";
8
+ } from "./chunk-HDYUBRMF.js";
9
9
  import {
10
10
  buildWin32CmdShimInvocation,
11
11
  resolveWin32Command
12
- } from "./chunk-V43EQ6VR.js";
12
+ } from "./chunk-KE7A76VC.js";
13
13
 
14
14
  // src/_spawn-stream.ts
15
15
  import { spawn } from "node:child_process";
16
+ import { StringDecoder } from "node:string_decoder";
16
17
  import {
17
18
  emitProcessCompleted,
18
19
  emitProcessOutput,
@@ -88,19 +89,23 @@ async function* spawnStream(opts) {
88
89
  child.stderr?.resume();
89
90
  }
90
91
  };
92
+ const stdoutDecoder = new StringDecoder("utf8");
93
+ const stderrDecoder = new StringDecoder("utf8");
91
94
  const onOut = (c) => {
92
- const s = c.toString();
95
+ const s = stdoutDecoder.write(c);
93
96
  stdoutBytes += c.byteLength;
94
97
  emitProcessOutput({ pid, stream: "stdout", chunk: c });
95
- if (stdoutRetainedBytes < max) {
96
- const retained = utf8Prefix(s, max - stdoutRetainedBytes);
97
- stdout += retained;
98
- stdoutRetainedBytes += Buffer.byteLength(retained, "utf8");
98
+ if (s.length > 0) {
99
+ if (stdoutRetainedBytes < max) {
100
+ const retained = utf8Prefix(s, max - stdoutRetainedBytes);
101
+ stdout += retained;
102
+ stdoutRetainedBytes += Buffer.byteLength(retained, "utf8");
103
+ }
104
+ spool.write(s);
105
+ queue.push({ kind: "out", data: s, bytes: c.byteLength });
106
+ queuedBytes += c.byteLength;
107
+ wake();
99
108
  }
100
- spool.write(s);
101
- queue.push({ kind: "out", data: s, bytes: c.byteLength });
102
- queuedBytes += c.byteLength;
103
- wake();
104
109
  if (!paused && (queue.length >= maxQueue || queuedBytes >= maxQueueBytes)) {
105
110
  paused = true;
106
111
  child.stdout?.pause();
@@ -108,18 +113,20 @@ async function* spawnStream(opts) {
108
113
  }
109
114
  };
110
115
  const onErr = (c) => {
111
- const s = c.toString();
116
+ const s = stderrDecoder.write(c);
112
117
  stderrBytes += c.byteLength;
113
118
  emitProcessOutput({ pid, stream: "stderr", chunk: c });
114
- if (stderrRetainedBytes < max) {
115
- const retained = utf8Prefix(s, max - stderrRetainedBytes);
116
- stderr += retained;
117
- stderrRetainedBytes += Buffer.byteLength(retained, "utf8");
119
+ if (s.length > 0) {
120
+ if (stderrRetainedBytes < max) {
121
+ const retained = utf8Prefix(s, max - stderrRetainedBytes);
122
+ stderr += retained;
123
+ stderrRetainedBytes += Buffer.byteLength(retained, "utf8");
124
+ }
125
+ spool.write(s);
126
+ queue.push({ kind: "err", data: s, bytes: c.byteLength });
127
+ queuedBytes += c.byteLength;
128
+ wake();
118
129
  }
119
- spool.write(s);
120
- queue.push({ kind: "err", data: s, bytes: c.byteLength });
121
- queuedBytes += c.byteLength;
122
- wake();
123
130
  if (!paused && (queue.length >= maxQueue || queuedBytes >= maxQueueBytes)) {
124
131
  paused = true;
125
132
  child.stdout?.pause();
@@ -151,6 +158,26 @@ async function* spawnStream(opts) {
151
158
  };
152
159
  child.on("close", (code, signal2) => {
153
160
  if (typeof pid === "number") registry.unregister(pid);
161
+ const restOut = stdoutDecoder.end();
162
+ if (restOut) {
163
+ if (stdoutRetainedBytes < max) {
164
+ const retained = utf8Prefix(restOut, max - stdoutRetainedBytes);
165
+ stdout += retained;
166
+ stdoutRetainedBytes += Buffer.byteLength(retained, "utf8");
167
+ }
168
+ spool.write(restOut);
169
+ queue.push({ kind: "out", data: restOut, bytes: 0 });
170
+ }
171
+ const restErr = stderrDecoder.end();
172
+ if (restErr) {
173
+ if (stderrRetainedBytes < max) {
174
+ const retained = utf8Prefix(restErr, max - stderrRetainedBytes);
175
+ stderr += retained;
176
+ stderrRetainedBytes += Buffer.byteLength(retained, "utf8");
177
+ }
178
+ spool.write(restErr);
179
+ queue.push({ kind: "err", data: restErr, bytes: 0 });
180
+ }
154
181
  const exitCode2 = code ?? (signal2 ? 1 : 0);
155
182
  completeTelemetry(exitCode2, signal2 ?? void 0);
156
183
  queue.push({
@@ -258,4 +285,4 @@ function utf8Prefix(text, maxBytes) {
258
285
  export {
259
286
  spawnStream
260
287
  };
261
- //# sourceMappingURL=chunk-ZHH3BEWU.js.map
288
+ //# sourceMappingURL=chunk-DRRY6SCM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  kanbanTool
3
- } from "./chunk-W2CECGTG.js";
3
+ } from "./chunk-SMARDKAC.js";
4
4
  import {
5
5
  applyManagedKanbanBoardToTodos,
6
6
  blockingTitles,
@@ -323,7 +323,7 @@ var todoTool = {
323
323
  field: "todos"
324
324
  });
325
325
  }
326
- if (item.status !== void 0 && !VALID_STATUSES.has(item.status)) {
326
+ if (!item.status || !VALID_STATUSES.has(item.status)) {
327
327
  throw new ToolValidationError({
328
328
  message: `todo: item "${item.id}" has invalid status "${item.status}". Allowed: pending, in_progress, completed`,
329
329
  field: "todos"
@@ -331,7 +331,7 @@ var todoTool = {
331
331
  }
332
332
  }
333
333
  const items = input.todos.filter((t) => Boolean(t?.id && t.content));
334
- const todoIdentity = (item) => item.kanbanBoardId && item.kanbanTaskId ? `kanban:${item.kanbanBoardId}:${item.kanbanTaskId}` : item.promotedFromTask ? `task:${item.promotedFromTask}` : item.promotedFromPlan ? `plan:${item.promotedFromPlan}` : `todo:${item.id}`;
334
+ const todoIdentity = (item) => item.kanbanBoardId && item.kanbanTaskId ? `kanban:${item.kanbanBoardId}:${item.kanbanTaskId}` : item.promotedFromTask ? `task:${item.promotedFromTask}:${item.id}` : item.promotedFromPlan ? `plan:${item.promotedFromPlan}:${item.id}` : `todo:${item.id}`;
335
335
  const requestedIdentities = new Set(items.map(todoIdentity));
336
336
  for (const previous of ctx.todos ?? []) {
337
337
  const identity = todoIdentity(previous);
@@ -476,4 +476,4 @@ var todoTool = {
476
476
  export {
477
477
  todoTool
478
478
  };
479
- //# sourceMappingURL=chunk-BK732J7I.js.map
479
+ //# sourceMappingURL=chunk-FBUP524S.js.map
@@ -109,6 +109,10 @@ function forgetTool(memory) {
109
109
  }
110
110
  };
111
111
  }
112
+ function normalizeMemoryLimit(value) {
113
+ const raw = typeof value === "number" && Number.isFinite(value) ? value : 5;
114
+ return Math.max(1, Math.min(Math.floor(raw), 20));
115
+ }
112
116
  function searchMemoryTool(memory) {
113
117
  return {
114
118
  name: "search_memory",
@@ -146,7 +150,7 @@ function searchMemoryTool(memory) {
146
150
  });
147
151
  }
148
152
  const scope = input.scope ?? "project-memory";
149
- const limit = Math.min(input.limit ?? 5, 20);
153
+ const limit = normalizeMemoryLimit(input.limit);
150
154
  const entries = await memory.search(input.query, scope, limit);
151
155
  return {
152
156
  results: entries.map((e) => ({
@@ -198,7 +202,7 @@ function relatedMemoryTool(memory) {
198
202
  });
199
203
  }
200
204
  const scope = input.scope ?? "project-memory";
201
- const limit = Math.min(input.limit ?? 5, 20);
205
+ const limit = normalizeMemoryLimit(input.limit);
202
206
  const entries = memory.findRelated ? await memory.findRelated(input.text, scope, limit) : await memory.search(input.text, scope, limit);
203
207
  return {
204
208
  results: entries.map((e) => ({
@@ -220,4 +224,4 @@ export {
220
224
  searchMemoryTool,
221
225
  relatedMemoryTool
222
226
  };
223
- //# sourceMappingURL=chunk-WHIIIREL.js.map
227
+ //# sourceMappingURL=chunk-FVM3O4JQ.js.map
@@ -0,0 +1,244 @@
1
+ // src/tool-diff.ts
2
+ var DIFF_MAX_LINES = 5e3;
3
+ function asObject(input) {
4
+ if (typeof input === "string") {
5
+ const s = input.trim();
6
+ if (s.startsWith("{") || s.startsWith("[")) {
7
+ try {
8
+ const parsed = JSON.parse(s);
9
+ if (parsed && typeof parsed === "object") return parsed;
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
14
+ return null;
15
+ }
16
+ if (input && typeof input === "object") return input;
17
+ return null;
18
+ }
19
+ function diffFromToolInput(toolName, input) {
20
+ if (!toolName) return null;
21
+ const obj = asObject(input);
22
+ if (!obj) return null;
23
+ const name = toolName.toLowerCase();
24
+ const filePath = String(obj.file_path ?? obj.path ?? "");
25
+ switch (name) {
26
+ case "edit":
27
+ case "str_replace":
28
+ case "edit_file":
29
+ case "multi_edit": {
30
+ const oldText = typeof obj.old_string === "string" ? obj.old_string : "";
31
+ const newText = typeof obj.new_string === "string" ? obj.new_string : "";
32
+ if (!oldText && !newText) return null;
33
+ return { mode: "lcs", oldText, newText, caption: `edit ${filePath}`.trim() };
34
+ }
35
+ case "write":
36
+ case "write_file":
37
+ case "create_file": {
38
+ const content = typeof obj.content === "string" ? obj.content : "";
39
+ if (!content) return null;
40
+ return {
41
+ mode: "lcs",
42
+ oldText: "",
43
+ newText: content,
44
+ caption: `write ${filePath} (new)`.trim()
45
+ };
46
+ }
47
+ case "patch": {
48
+ const patchText = typeof obj.patch === "string" ? obj.patch : "";
49
+ if (!patchText.trim()) return null;
50
+ return { mode: "unified", patchText, caption: filePath ? `patch ${filePath}` : "patch" };
51
+ }
52
+ default:
53
+ return null;
54
+ }
55
+ }
56
+ function computeLineDiff(oldText, newText) {
57
+ const a = oldText.split("\n").map((l) => l.replace(/\r$/, ""));
58
+ const b = newText.split("\n").map((l) => l.replace(/\r$/, ""));
59
+ if (a.length > DIFF_MAX_LINES || b.length > DIFF_MAX_LINES) return null;
60
+ const n = a.length;
61
+ const m = b.length;
62
+ const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
63
+ for (let i2 = n - 1; i2 >= 0; i2--) {
64
+ for (let j2 = m - 1; j2 >= 0; j2--) {
65
+ dp[i2][j2] = a[i2] === b[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
66
+ }
67
+ }
68
+ const rows = [];
69
+ let i = 0;
70
+ let j = 0;
71
+ while (i < n && j < m) {
72
+ if (a[i] === b[j]) {
73
+ rows.push({ kind: "ctx", text: a[i] });
74
+ i++;
75
+ j++;
76
+ } else if (dp[i + 1][j] >= dp[i][j + 1]) {
77
+ rows.push({ kind: "del", text: a[i] });
78
+ i++;
79
+ } else {
80
+ rows.push({ kind: "add", text: b[j] });
81
+ j++;
82
+ }
83
+ }
84
+ while (i < n) rows.push({ kind: "del", text: a[i++] });
85
+ while (j < m) rows.push({ kind: "add", text: b[j++] });
86
+ return rows;
87
+ }
88
+ function parseUnifiedDiff(patchText) {
89
+ const rows = [];
90
+ const lines = patchText.split("\n");
91
+ for (const r of lines) {
92
+ const raw = r.replace(/\r$/, "");
93
+ if (raw.startsWith("@@") || raw.startsWith("--- ") || raw.startsWith("+++ ") || raw.startsWith("diff ") || raw.startsWith("index ") || raw.startsWith("\\ ")) {
94
+ rows.push({ kind: "meta", text: raw });
95
+ } else if (raw.startsWith("+")) {
96
+ rows.push({ kind: "add", text: raw.slice(1) });
97
+ } else if (raw.startsWith("-")) {
98
+ rows.push({ kind: "del", text: raw.slice(1) });
99
+ } else {
100
+ rows.push({ kind: "ctx", text: raw.startsWith(" ") ? raw.slice(1) : raw });
101
+ }
102
+ }
103
+ if (rows.length > 0 && rows[rows.length - 1].kind === "ctx" && rows[rows.length - 1].text === "") {
104
+ rows.pop();
105
+ }
106
+ return rows;
107
+ }
108
+ function diffRowsFromToolInput(toolName, input) {
109
+ const d = diffFromToolInput(toolName, input);
110
+ if (!d) return null;
111
+ if (d.mode === "unified") return { caption: d.caption, rows: parseUnifiedDiff(d.patchText) };
112
+ return { caption: d.caption, rows: computeLineDiff(d.oldText, d.newText) };
113
+ }
114
+ var DIFF_LINE_SAFETY_CAP = 4e3;
115
+ function truncMid(s, max) {
116
+ if (s.length <= max) return s;
117
+ return `${s.slice(0, max - 1)}\u2026`;
118
+ }
119
+ function parseUnifiedDiffPreview(diff, maxLines, lineCap = DIFF_LINE_SAFETY_CAP) {
120
+ const all = [];
121
+ let oldLn = 0;
122
+ let newLn = 0;
123
+ for (const raw of diff.split("\n")) {
124
+ const line = raw.replace(/\r$/, "");
125
+ if (line.startsWith("+++") || line.startsWith("---")) continue;
126
+ if (line.startsWith("diff --git") || line.startsWith("index ")) continue;
127
+ if (line.startsWith("@@")) {
128
+ const m = line.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);
129
+ if (m) {
130
+ oldLn = Number.parseInt(m[1] ?? "0", 10) || 0;
131
+ newLn = Number.parseInt(m[2] ?? "0", 10) || 0;
132
+ }
133
+ all.push({ kind: "hunk", text: truncMid(line, 60) });
134
+ continue;
135
+ }
136
+ if (line.startsWith("+")) {
137
+ all.push({ kind: "add", text: truncMid(line, lineCap), newLine: newLn });
138
+ newLn++;
139
+ continue;
140
+ }
141
+ if (line.startsWith("-")) {
142
+ all.push({ kind: "del", text: truncMid(line, lineCap), oldLine: oldLn });
143
+ oldLn++;
144
+ continue;
145
+ }
146
+ if (line.startsWith("\\ No newline")) {
147
+ all.push({ kind: "meta", text: line });
148
+ continue;
149
+ }
150
+ if (line.length === 0) continue;
151
+ all.push({ kind: "ctx", text: truncMid(line, lineCap), oldLine: oldLn, newLine: newLn });
152
+ oldLn++;
153
+ newLn++;
154
+ }
155
+ const added = all.filter((row) => row.kind === "add").length;
156
+ const removed = all.filter((row) => row.kind === "del").length;
157
+ if (all.length === 0) {
158
+ return { rows: [], hidden: 0, added: 0, removed: 0, hiddenAdded: 0, hiddenRemoved: 0 };
159
+ }
160
+ if (all.length <= maxLines) {
161
+ return { rows: all, hidden: 0, added, removed, hiddenAdded: 0, hiddenRemoved: 0 };
162
+ }
163
+ const rows = all.slice(0, maxLines);
164
+ const hiddenRows = all.slice(maxLines);
165
+ return {
166
+ rows,
167
+ hidden: hiddenRows.length,
168
+ added,
169
+ removed,
170
+ hiddenAdded: hiddenRows.filter((row) => row.kind === "add").length,
171
+ hiddenRemoved: hiddenRows.filter((row) => row.kind === "del").length
172
+ };
173
+ }
174
+ var TOOL_DIFF_BROWSER_SRC = [
175
+ "var DIFF_MAX_LINES = 5000;",
176
+ "function __diffObj(input){",
177
+ ' if(typeof input==="string"){ var s=input.trim(); if(s.charAt(0)==="{"||s.charAt(0)==="["){ try{ var p=JSON.parse(s); if(p&&typeof p==="object") return p; }catch(_e){} } return null; }',
178
+ ' if(input&&typeof input==="object") return input; return null;',
179
+ "}",
180
+ "function diffFromToolInput(name, input){",
181
+ " if(!name) return null;",
182
+ " var obj=__diffObj(input); if(!obj) return null;",
183
+ " var n=String(name).toLowerCase();",
184
+ ' var fp=String(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:""));',
185
+ ' if(n==="edit"||n==="str_replace"||n==="edit_file"||n==="multi_edit"){',
186
+ ' var oldT=typeof obj.old_string==="string"?obj.old_string:"";',
187
+ ' var newT=typeof obj.new_string==="string"?obj.new_string:"";',
188
+ " if(!oldT&&!newT) return null;",
189
+ ' return { mode:"lcs", oldText:oldT, newText:newT, caption:("edit "+fp).replace(/\\s+$/,"") };',
190
+ " }",
191
+ ' if(n==="write"||n==="write_file"||n==="create_file"){',
192
+ ' var c=typeof obj.content==="string"?obj.content:"";',
193
+ " if(!c) return null;",
194
+ ' return { mode:"lcs", oldText:"", newText:c, caption:("write "+fp+" (new)").replace(/^\\s+/,"").replace(/\\s+$/,"") };',
195
+ " }",
196
+ ' if(n==="patch"){',
197
+ ' var pt=typeof obj.patch==="string"?obj.patch:"";',
198
+ ' if(!pt.replace(/\\s/g,"")) return null;',
199
+ ' return { mode:"unified", patchText:pt, caption: fp ? ("patch "+fp) : "patch" };',
200
+ " }",
201
+ " return null;",
202
+ "}",
203
+ "function computeLineDiff(oldText, newText){",
204
+ ' var a=oldText.split("\\n").map(function(l){return l.replace(/\\r$/,"");}), b=newText.split("\\n").map(function(l){return l.replace(/\\r$/,"");});',
205
+ " if(a.length>DIFF_MAX_LINES||b.length>DIFF_MAX_LINES) return null;",
206
+ " var nn=a.length, mm=b.length, i, j;",
207
+ " var dp=new Array(nn+1); for(i=0;i<=nn;i++){ dp[i]=new Array(mm+1); for(j=0;j<=mm;j++) dp[i][j]=0; }",
208
+ " for(i=nn-1;i>=0;i--){ for(j=mm-1;j>=0;j--){ dp[i][j]= a[i]===b[j] ? dp[i+1][j+1]+1 : Math.max(dp[i+1][j], dp[i][j+1]); } }",
209
+ " var rows=[]; i=0; j=0;",
210
+ ' while(i<nn&&j<mm){ if(a[i]===b[j]){ rows.push({kind:"ctx",text:a[i]}); i++; j++; } else if(dp[i+1][j]>=dp[i][j+1]){ rows.push({kind:"del",text:a[i]}); i++; } else { rows.push({kind:"add",text:b[j]}); j++; } }',
211
+ ' while(i<nn){ rows.push({kind:"del",text:a[i]}); i++; }',
212
+ ' while(j<mm){ rows.push({kind:"add",text:b[j]}); j++; }',
213
+ " return rows;",
214
+ "}",
215
+ "function parseUnifiedDiff(patchText){",
216
+ ' var rows=[], lines=patchText.split("\\n"), k, raw;',
217
+ ' for(k=0;k<lines.length;k++){ raw=lines[k].replace(/\\r$/,"");',
218
+ ' if(raw.indexOf("@@")===0||raw.indexOf("--- ")===0||raw.indexOf("+++ ")===0||raw.indexOf("diff ")===0||raw.indexOf("index ")===0||raw.indexOf("\\\\ ")===0){ rows.push({kind:"meta",text:raw}); }',
219
+ ' else if(raw.charAt(0)==="+"){ rows.push({kind:"add",text:raw.slice(1)}); }',
220
+ ' else if(raw.charAt(0)==="-"){ rows.push({kind:"del",text:raw.slice(1)}); }',
221
+ ' else { rows.push({kind:"ctx",text: raw.charAt(0)===" " ? raw.slice(1) : raw}); }',
222
+ " }",
223
+ ' if(rows.length>0 && rows[rows.length-1].kind==="ctx" && rows[rows.length-1].text===""){ rows.pop(); }',
224
+ " return rows;",
225
+ "}",
226
+ "function diffRowsFromToolInput(name, input){",
227
+ " var d=diffFromToolInput(name, input); if(!d) return null;",
228
+ ' if(d.mode==="unified") return { caption:d.caption, rows:parseUnifiedDiff(d.patchText) };',
229
+ " return { caption:d.caption, rows:computeLineDiff(d.oldText, d.newText) };",
230
+ "}"
231
+ ].join("\n");
232
+
233
+ export {
234
+ DIFF_MAX_LINES,
235
+ diffFromToolInput,
236
+ computeLineDiff,
237
+ parseUnifiedDiff,
238
+ diffRowsFromToolInput,
239
+ DIFF_LINE_SAFETY_CAP,
240
+ truncMid,
241
+ parseUnifiedDiffPreview,
242
+ TOOL_DIFF_BROWSER_SRC
243
+ };
244
+ //# sourceMappingURL=chunk-FYDBUVQD.js.map
@@ -1,6 +1,54 @@
1
1
  import {
2
2
  resolveIndexDir
3
- } from "./chunk-KY4PXYSO.js";
3
+ } from "./chunk-N3K2SFEI.js";
4
+
5
+ // src/codebase-index/project-server-endpoint.ts
6
+ import { createHash } from "node:crypto";
7
+ import * as fs from "node:fs";
8
+ import * as os from "node:os";
9
+ import * as path from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+ var PROJECT_INDEX_SERVER_PROTOCOL_VERSION = 1;
12
+ var PROJECT_INDEX_SERVER_METADATA_FILE = "server.json";
13
+ var PROJECT_INDEX_SERVER_SOCKET_DIR = `wsci-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}`;
14
+ var buildIdCache;
15
+ function projectIndexServerBuildId(entrypoint) {
16
+ const href = entrypoint instanceof URL ? entrypoint.href : entrypoint;
17
+ const cleanHref = href.split(/[?#]/, 1)[0] ?? href;
18
+ const file = cleanHref.startsWith("file:") ? fileURLToPath(cleanHref) : path.resolve(cleanHref);
19
+ try {
20
+ const stat = fs.statSync(file);
21
+ if (buildIdCache?.file === file && buildIdCache.mtimeMs === stat.mtimeMs && buildIdCache.size === stat.size) {
22
+ return buildIdCache.buildId;
23
+ }
24
+ const buildId = createHash("sha256").update(fs.readFileSync(file)).digest("hex").slice(0, 24);
25
+ buildIdCache = { file, mtimeMs: stat.mtimeMs, size: stat.size, buildId };
26
+ return buildId;
27
+ } catch {
28
+ return `unreadable:${path.basename(file)}`;
29
+ }
30
+ }
31
+ function normalizeLocalPath(value) {
32
+ const resolved = path.resolve(value);
33
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
34
+ }
35
+ function projectIndexServerKey(projectRoot, indexDir) {
36
+ const resolvedIndexDir = normalizeLocalPath(resolveIndexDir(projectRoot, indexDir));
37
+ return createHash("sha256").update(resolvedIndexDir).digest("hex").slice(0, 24);
38
+ }
39
+ function projectIndexServerEndpoint(projectRoot, indexDir) {
40
+ const key = projectIndexServerKey(projectRoot, indexDir);
41
+ if (process.platform === "win32") {
42
+ return `\\\\.\\pipe\\wrongstack-codebase-index-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}-${key}`;
43
+ }
44
+ return path.join(os.tmpdir(), PROJECT_INDEX_SERVER_SOCKET_DIR, `${key}.sock`);
45
+ }
46
+ function projectIndexServerMetadataPath(projectRoot, indexDir) {
47
+ return path.join(
48
+ path.resolve(resolveIndexDir(projectRoot, indexDir)),
49
+ PROJECT_INDEX_SERVER_METADATA_FILE
50
+ );
51
+ }
4
52
 
5
53
  // src/codebase-index/binary-frame.ts
6
54
  import { decode, encode } from "@msgpack/msgpack";
@@ -53,54 +101,6 @@ function encodeJsonFrame(message) {
53
101
  `;
54
102
  }
55
103
 
56
- // src/codebase-index/project-server-endpoint.ts
57
- import { createHash } from "node:crypto";
58
- import * as fs from "node:fs";
59
- import * as os from "node:os";
60
- import * as path from "node:path";
61
- import { fileURLToPath } from "node:url";
62
- var PROJECT_INDEX_SERVER_PROTOCOL_VERSION = 1;
63
- var PROJECT_INDEX_SERVER_METADATA_FILE = "server.json";
64
- var PROJECT_INDEX_SERVER_SOCKET_DIR = `wsci-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}`;
65
- var buildIdCache;
66
- function projectIndexServerBuildId(entrypoint) {
67
- const href = entrypoint instanceof URL ? entrypoint.href : entrypoint;
68
- const cleanHref = href.split(/[?#]/, 1)[0] ?? href;
69
- const file = cleanHref.startsWith("file:") ? fileURLToPath(cleanHref) : path.resolve(cleanHref);
70
- try {
71
- const stat = fs.statSync(file);
72
- if (buildIdCache?.file === file && buildIdCache.mtimeMs === stat.mtimeMs && buildIdCache.size === stat.size) {
73
- return buildIdCache.buildId;
74
- }
75
- const buildId = createHash("sha256").update(fs.readFileSync(file)).digest("hex").slice(0, 24);
76
- buildIdCache = { file, mtimeMs: stat.mtimeMs, size: stat.size, buildId };
77
- return buildId;
78
- } catch {
79
- return `unreadable:${path.basename(file)}`;
80
- }
81
- }
82
- function normalizeLocalPath(value) {
83
- const resolved = path.resolve(value);
84
- return process.platform === "win32" ? resolved.toLowerCase() : resolved;
85
- }
86
- function projectIndexServerKey(projectRoot, indexDir) {
87
- const resolvedIndexDir = normalizeLocalPath(resolveIndexDir(projectRoot, indexDir));
88
- return createHash("sha256").update(resolvedIndexDir).digest("hex").slice(0, 24);
89
- }
90
- function projectIndexServerEndpoint(projectRoot, indexDir) {
91
- const key = projectIndexServerKey(projectRoot, indexDir);
92
- if (process.platform === "win32") {
93
- return `\\\\.\\pipe\\wrongstack-codebase-index-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}-${key}`;
94
- }
95
- return path.join(os.tmpdir(), PROJECT_INDEX_SERVER_SOCKET_DIR, `${key}.sock`);
96
- }
97
- function projectIndexServerMetadataPath(projectRoot, indexDir) {
98
- return path.join(
99
- path.resolve(resolveIndexDir(projectRoot, indexDir)),
100
- PROJECT_INDEX_SERVER_METADATA_FILE
101
- );
102
- }
103
-
104
104
  // src/codebase-index/project-server-protocol.ts
105
105
  var PROJECT_INDEX_SERVER_MAX_FRAME_CHARS = 64 * 1024 * 1024;
106
106
  function encodeProjectServerMessage(message) {
@@ -120,4 +120,4 @@ export {
120
120
  PROJECT_INDEX_SERVER_MAX_FRAME_CHARS,
121
121
  encodeProjectServerMessage
122
122
  };
123
- //# sourceMappingURL=chunk-UDVKRX5R.js.map
123
+ //# sourceMappingURL=chunk-GDDXX27P.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  checkSyntax
3
- } from "./chunk-FQZOHLG3.js";
3
+ } from "./chunk-MSOAX3GC.js";
4
4
  import {
5
5
  enqueueReindex
6
- } from "./chunk-DP6CXMJZ.js";
6
+ } from "./chunk-ZTCJCYLN.js";
7
7
  import {
8
8
  safeResolveReal,
9
9
  sha256hex,
@@ -114,8 +114,8 @@ async function prepareWrite(input, ctx) {
114
114
  existed = stat2.isFile();
115
115
  if (existed) {
116
116
  prev = await fs.readFile(absPath, "utf8");
117
- if (!ctx.hasRead(absPath)) {
118
- ctx.recordRead(absPath, stat2.mtimeMs, "write", sha256hex(prev));
117
+ if (ctx.hasRead ? !ctx.hasRead(absPath) : true) {
118
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "write", sha256hex(prev));
119
119
  }
120
120
  }
121
121
  } catch (err) {
@@ -139,7 +139,7 @@ async function finishWrite(input, ctx, prepared, signal) {
139
139
  const { text: diff, truncated: diffTruncated } = truncateDiffPayload(rawDiff, MAX_DIFF_BYTES);
140
140
  const contentHash = sha256hex(content);
141
141
  const stat2 = await fs.stat(prepared.absPath);
142
- ctx.recordRead(prepared.absPath, stat2.mtimeMs, "write", contentHash);
142
+ ctx.recordRead?.(prepared.absPath, stat2.mtimeMs, "write", contentHash);
143
143
  ctx.session?.recordFileChange?.({
144
144
  path: prepared.absPath,
145
145
  action: prepared.existed ? "modified" : "created",
@@ -179,4 +179,4 @@ async function finishWrite(input, ctx, prepared, signal) {
179
179
  export {
180
180
  writeTool
181
181
  };
182
- //# sourceMappingURL=chunk-O44IMQCN.js.map
182
+ //# sourceMappingURL=chunk-GKSG5CPH.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CircuitBreaker
3
- } from "./chunk-HFXSNKCV.js";
3
+ } from "./chunk-7JJFC6CT.js";
4
4
 
5
5
  // src/process-registry.ts
6
6
  import { spawn } from "node:child_process";
@@ -30,12 +30,14 @@ var SENSITIVE_FLAG_PATTERNS = [
30
30
  /--\w*(?:token|key|secret|password|passwd|auth|credential)\w*[=\s,][A-Za-z0-9+/=]{32,}/g
31
31
  ];
32
32
  function redactCommand(cmd) {
33
+ if (typeof cmd !== "string") return "";
33
34
  let result = cmd;
34
35
  for (const pattern of SENSITIVE_FLAG_PATTERNS) {
35
36
  result = result.replace(pattern, (match) => {
36
37
  const eq = match.indexOf("=");
38
+ const colon = match.indexOf(":");
37
39
  const sp = match.search(/\s/);
38
- const delim = eq !== -1 ? "=" : sp !== -1 ? match[sp] : null;
40
+ const delim = eq !== -1 && (colon === -1 || eq < colon) ? "=" : colon !== -1 ? ":" : sp !== -1 ? match[sp] : null;
39
41
  if (delim !== null) {
40
42
  const flag = match.slice(0, match.indexOf(expectDefined(delim)) + 1);
41
43
  return `${flag}[REDACTED]`;
@@ -469,4 +471,4 @@ export {
469
471
  getProcessRegistry,
470
472
  _resetProcessRegistry
471
473
  };
472
- //# sourceMappingURL=chunk-3PVYQFRQ.js.map
474
+ //# sourceMappingURL=chunk-HDYUBRMF.js.map
@@ -306,7 +306,7 @@ ${result.content}
306
306
  }
307
307
  signal?.throwIfAborted();
308
308
  const tokens = applyTokenOverrides(rawTokens, active.overrides);
309
- const normalizedFiles = input.files ? (Array.isArray(input.files) ? input.files : String(input.files).split(",")).map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean) : void 0;
309
+ const normalizedFiles = input.files ? (Array.isArray(input.files) ? input.files : String(input.files).split(",")).filter((f) => typeof f === "string").map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean) : void 0;
310
310
  const report = await runDesignVerify(ctx.projectRoot, tokens, normalizedFiles);
311
311
  const pct = Math.round(report.score * 100);
312
312
  const top = report.violations.slice(0, 25).map((v) => ` ${v.file}:${v.line} \u2014 ${v.reason}: ${v.snippet}`).join("\n");
@@ -334,4 +334,4 @@ Replace off-palette colors with kit tokens (or the materialized CSS vars / token
334
334
  export {
335
335
  designTool
336
336
  };
337
- //# sourceMappingURL=chunk-ELRRTWNP.js.map
337
+ //# sourceMappingURL=chunk-IXIS7RSG.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  compileUserRegex
3
- } from "./chunk-Q5JPPCZC.js";
3
+ } from "./chunk-YJTXRH5Y.js";
4
4
  import {
5
5
  mapWithConcurrency
6
- } from "./chunk-NWZ6XGBJ.js";
6
+ } from "./chunk-ZBMANLYH.js";
7
7
  import {
8
8
  enqueueReindex
9
- } from "./chunk-DP6CXMJZ.js";
9
+ } from "./chunk-ZTCJCYLN.js";
10
10
  import {
11
11
  isBinaryBuffer,
12
12
  safeResolveReal,
@@ -275,7 +275,7 @@ function passesExtraGlob(extraGlob, name, full, base) {
275
275
  }
276
276
  async function resolveFiles(filesInput, ctx, extraGlob) {
277
277
  const base = ctx.cwd;
278
- const parts = Array.isArray(filesInput) ? filesInput.map((s) => s.trim()).filter(Boolean) : filesInput.trim().split(",").map((s) => s.trim()).filter(Boolean);
278
+ const parts = Array.isArray(filesInput) ? filesInput.filter((s) => typeof s === "string").map((s) => s.trim()).filter(Boolean) : filesInput.trim().split(",").map((s) => s.trim()).filter(Boolean);
279
279
  const resolved = [];
280
280
  for (const p of parts) {
281
281
  if (p.includes("*") || p.includes("?")) {
@@ -289,7 +289,7 @@ async function resolveFiles(filesInput, ctx, extraGlob) {
289
289
  resolved.push(absPath);
290
290
  }
291
291
  }
292
- return resolved;
292
+ return [...new Set(resolved)];
293
293
  }
294
294
  async function globFiles(pattern, base, extraGlob) {
295
295
  const rgAvailable = await checkRg();
@@ -413,4 +413,4 @@ export {
413
413
  replaceTool,
414
414
  __resetRgDetectionForTests
415
415
  };
416
- //# sourceMappingURL=chunk-X5FOFGXX.js.map
416
+ //# sourceMappingURL=chunk-IYH4OHBP.js.map