@wrongstack/tools 0.320.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 (191) 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 +6 -6
  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 +4 -4
  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 +50 -50
  15. package/dist/{chunk-T77XOX7E.js → chunk-24T5XIJU.js} +1 -1
  16. package/dist/{chunk-DTQ75VBC.js → chunk-2CTZW6JQ.js} +2 -2
  17. package/dist/chunk-37QKUQ2Z.js +171 -0
  18. package/dist/{chunk-KWXIKGE3.js → chunk-3D5DJWOE.js} +3 -3
  19. package/dist/{chunk-XSSFBS5I.js → chunk-4ERMPDHV.js} +11 -6
  20. package/dist/{chunk-QSNVDHOZ.js → chunk-4WPBS45A.js} +4 -5
  21. package/dist/{chunk-4CQWNZ62.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-DFQDJT22.js → chunk-6GOZTS6F.js} +3 -3
  25. package/dist/{chunk-34VLZ35Z.js → chunk-7HL23T3T.js} +63 -10
  26. package/dist/{chunk-HFXSNKCV.js → chunk-7JJFC6CT.js} +1 -1
  27. package/dist/{chunk-NDIT3SBZ.js → chunk-7N5U2RAU.js} +2 -2
  28. package/dist/{chunk-QBV725YG.js → chunk-7ODZTPCU.js} +2 -2
  29. package/dist/{chunk-4BABEJC2.js → chunk-AB2CAUOP.js} +64 -53
  30. package/dist/{chunk-6AAOT4PW.js → chunk-AQ5YBURX.js} +16 -4
  31. package/dist/{chunk-ZMW6WJFT.js → chunk-ASEXQRA7.js} +3 -3
  32. package/dist/{chunk-FRN7TIAA.js → chunk-B3MGJBFI.js} +1 -1
  33. package/dist/{chunk-JLYA4X7K.js → chunk-CGXTR34H.js} +21 -6
  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-Z6IHMJMC.js → chunk-DK4J2WMH.js} +11 -11
  37. package/dist/{chunk-OYP27E3I.js → chunk-DRRY6SCM.js} +47 -20
  38. package/dist/{chunk-BK732J7I.js → chunk-FBUP524S.js} +4 -4
  39. package/dist/{chunk-NYRLWDT5.js → chunk-FVM3O4JQ.js} +1 -1
  40. package/dist/chunk-FYDBUVQD.js +244 -0
  41. package/dist/{chunk-PV6HIZQD.js → chunk-GDDXX27P.js} +50 -50
  42. package/dist/{chunk-3GIKYHLA.js → chunk-GKSG5CPH.js} +6 -6
  43. package/dist/{chunk-ESLPBT5A.js → chunk-HDYUBRMF.js} +4 -3
  44. package/dist/{chunk-ELRRTWNP.js → chunk-IXIS7RSG.js} +2 -2
  45. package/dist/{chunk-HR67OWEP.js → chunk-IYH4OHBP.js} +5 -5
  46. package/dist/{chunk-W232EFEM.js → chunk-JDOO4P6Z.js} +7 -4
  47. package/dist/{chunk-OTPTQBYE.js → chunk-KDEXUQY7.js} +19 -8
  48. package/dist/{chunk-2OXHS3KZ.js → chunk-KLJZ4WV4.js} +4 -3
  49. package/dist/{chunk-3M7LLN7W.js → chunk-LQSOU63Z.js} +12 -11
  50. package/dist/{chunk-JVRLTEO7.js → chunk-M6UV67BH.js} +2 -2
  51. package/dist/{chunk-C2DQKVLO.js → chunk-MJSJWXBF.js} +1 -1
  52. package/dist/{chunk-NSPNFOJ7.js → chunk-MK2JK35J.js} +25 -10
  53. package/dist/{chunk-JSNSMG5R.js → chunk-MSOAX3GC.js} +1 -1
  54. package/dist/{chunk-J43O3BOX.js → chunk-N3K2SFEI.js} +532 -492
  55. package/dist/{chunk-J74TMK4M.js → chunk-NJX2RXKJ.js} +50 -7
  56. package/dist/{chunk-5UFVCIUB.js → chunk-NN2SNP2R.js} +4 -4
  57. package/dist/{chunk-WAQASTXB.js → chunk-O6BY43ZB.js} +29 -8
  58. package/dist/{chunk-QGF2C7TF.js → chunk-PVCB7RUZ.js} +2 -2
  59. package/dist/{chunk-YTKSNTT4.js → chunk-QA6IASYX.js} +8 -8
  60. package/dist/{chunk-VPALDFYM.js → chunk-RV7BVTDG.js} +1 -1
  61. package/dist/chunk-S57CDR2H.js +288 -0
  62. package/dist/{chunk-W2CECGTG.js → chunk-SMARDKAC.js} +1 -1
  63. package/dist/{chunk-QWKSKFKZ.js → chunk-SOR7OCYP.js} +1 -1
  64. package/dist/{chunk-I7FBZOEP.js → chunk-T3SMFF5Q.js} +11 -5
  65. package/dist/{chunk-4BHUSMNL.js → chunk-UI3ZJIG3.js} +1 -1
  66. package/dist/{chunk-WXJY3BKV.js → chunk-VBF2YXUW.js} +2 -2
  67. package/dist/{chunk-FQNXYA6W.js → chunk-VU3QBYL4.js} +36 -5
  68. package/dist/{chunk-VD2LV5WO.js → chunk-VZGPASGD.js} +37 -12
  69. package/dist/{chunk-UZFY3CKD.js → chunk-WEEVSWQB.js} +17 -6
  70. package/dist/chunk-XXRMF2BC.js +186 -0
  71. package/dist/{chunk-LRDIRJJL.js → chunk-YEISRT4S.js} +5 -11
  72. package/dist/{chunk-Q5JPPCZC.js → chunk-YJTXRH5Y.js} +3 -2
  73. package/dist/{chunk-23EX5WDO.js → chunk-YULVUTK5.js} +3 -3
  74. package/dist/{chunk-Z5Q3TXRY.js → chunk-ZTCJCYLN.js} +3 -3
  75. package/dist/circuit-breaker.d.ts +1 -0
  76. package/dist/circuit-breaker.js +1 -1
  77. package/dist/clarify.d.ts +1 -0
  78. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +2 -3
  79. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +5 -4
  80. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +4 -3
  81. package/dist/codebase-index/codebase-index-tool.d.ts +2 -3
  82. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +2 -3
  83. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +4 -3
  84. package/dist/codebase-index/codebase-repo-map-tool.d.ts +2 -3
  85. package/dist/codebase-index/codebase-search-tool.d.ts +2 -3
  86. package/dist/codebase-index/codebase-skeleton-tool.d.ts +2 -3
  87. package/dist/codebase-index/codebase-stats-tool.d.ts +9 -3
  88. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +4 -3
  89. package/dist/codebase-index/index.d.ts +11 -11
  90. package/dist/codebase-index/index.js +8 -8
  91. package/dist/codebase-index/project-server-framing.d.ts +29 -0
  92. package/dist/codebase-index/project-server-lifecycle.d.ts +20 -0
  93. package/dist/codebase-index/project-server-operations.d.ts +37 -0
  94. package/dist/codebase-index/project-server-types.d.ts +30 -0
  95. package/dist/codebase-index/project-server-watcher.d.ts +25 -0
  96. package/dist/codebase-index/project-server.js +448 -391
  97. package/dist/codebase-index/worker.js +2 -2
  98. package/dist/codebase-index/writer-init.d.ts +13 -0
  99. package/dist/codebase-index/writer-maintenance.d.ts +14 -0
  100. package/dist/codebase-index/writer.d.ts +0 -15
  101. package/dist/design.d.ts +2 -2
  102. package/dist/design.js +1 -1
  103. package/dist/diff.d.ts +4 -4
  104. package/dist/diff.js +1 -1
  105. package/dist/document.d.ts +3 -4
  106. package/dist/document.js +1 -1
  107. package/dist/e2e.d.ts +1 -1
  108. package/dist/e2e.js +1 -1
  109. package/dist/edit.d.ts +3 -3
  110. package/dist/edit.js +6 -6
  111. package/dist/exec.d.ts +2 -3
  112. package/dist/exec.js +4 -4
  113. package/dist/fetch.d.ts +4 -3
  114. package/dist/fetch.js +1 -1
  115. package/dist/format.d.ts +17 -45
  116. package/dist/format.js +12 -8
  117. package/dist/git.d.ts +3 -3
  118. package/dist/git.js +1 -1
  119. package/dist/glob.d.ts +2 -3
  120. package/dist/glob.js +2 -2
  121. package/dist/grep.d.ts +7 -5
  122. package/dist/grep.js +3 -3
  123. package/dist/index.d.ts +54 -45
  124. package/dist/index.js +118 -59
  125. package/dist/install.d.ts +7 -55
  126. package/dist/install.js +6 -6
  127. package/dist/json.d.ts +3 -4
  128. package/dist/json.js +2 -2
  129. package/dist/kanban-tool-types.d.ts +1 -2
  130. package/dist/kanban.d.ts +3 -19
  131. package/dist/kanban.js +1 -1
  132. package/dist/languages/execute-tool.d.ts +2 -3
  133. package/dist/languages/index.d.ts +2 -2
  134. package/dist/languages/index.js +4 -4
  135. package/dist/languages/tool.d.ts +3 -4
  136. package/dist/{legacy-bridge-FOV5ODDI.js → legacy-bridge-YXANP5QB.js} +6 -6
  137. package/dist/lint.d.ts +5 -4
  138. package/dist/lint.js +6 -6
  139. package/dist/logs.d.ts +3 -4
  140. package/dist/logs.js +2 -2
  141. package/dist/memory.d.ts +7 -8
  142. package/dist/memory.js +1 -1
  143. package/dist/mode.d.ts +3 -4
  144. package/dist/mode.js +1 -1
  145. package/dist/next-steps-tool.d.ts +2 -3
  146. package/dist/next-steps.d.ts +4 -0
  147. package/dist/next-steps.js +9 -175
  148. package/dist/outdated.d.ts +5 -29
  149. package/dist/outdated.js +3 -3
  150. package/dist/pack.js +51 -51
  151. package/dist/patch.d.ts +2 -3
  152. package/dist/patch.js +5 -5
  153. package/dist/plan.d.ts +4 -4
  154. package/dist/plan.js +3 -3
  155. package/dist/process-registry.js +2 -2
  156. package/dist/ps-slash.js +4 -4
  157. package/dist/pwsh.d.ts +1 -0
  158. package/dist/read.d.ts +5 -5
  159. package/dist/read.js +5 -5
  160. package/dist/replace.d.ts +2 -3
  161. package/dist/replace.js +6 -6
  162. package/dist/scaffold.d.ts +7 -3
  163. package/dist/scaffold.js +3 -1
  164. package/dist/search.d.ts +17 -3
  165. package/dist/search.js +5 -1
  166. package/dist/set-working-dir.d.ts +2 -3
  167. package/dist/skill.d.ts +4 -5
  168. package/dist/skill.js +1 -1
  169. package/dist/task.d.ts +6 -6
  170. package/dist/task.js +3 -3
  171. package/dist/test.d.ts +5 -4
  172. package/dist/test.js +6 -6
  173. package/dist/todo.d.ts +8 -8
  174. package/dist/todo.js +2 -2
  175. package/dist/tool-diff.js +11 -230
  176. package/dist/tool-help.d.ts +2 -3
  177. package/dist/tool-help.js +1 -1
  178. package/dist/tool-search.d.ts +2 -3
  179. package/dist/tool-search.js +1 -1
  180. package/dist/tool-summary.js +5 -281
  181. package/dist/tool-tier.js +52 -52
  182. package/dist/tool-use.d.ts +2 -3
  183. package/dist/tool-use.js +1 -1
  184. package/dist/tree.d.ts +5 -3
  185. package/dist/tree.js +5 -1
  186. package/dist/typecheck.d.ts +3 -3
  187. package/dist/typecheck.js +6 -6
  188. package/dist/write.d.ts +2 -3
  189. package/dist/write.js +6 -6
  190. package/package.json +5 -5
  191. package/dist/spawn-background.d.ts +0 -80
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  todoTool
3
- } from "./chunk-BK732J7I.js";
3
+ } from "./chunk-FBUP524S.js";
4
4
  import {
5
5
  mirrorSessionTasksToKanban
6
6
  } from "./chunk-X6KXNHUO.js";
@@ -17,13 +17,13 @@ import {
17
17
  import { ToolValidationError } from "@wrongstack/core/types";
18
18
  import { computeTaskItemProgress, formatTaskList } from "@wrongstack/core/utils";
19
19
  function findTaskIndex(tasks, query) {
20
- const asNum = Number.parseInt(query, 10);
21
- if (!Number.isNaN(asNum)) {
22
- const idx = asNum - 1;
23
- if (tasks[idx]) return idx;
24
- }
25
20
  const byId = tasks.findIndex((t) => t.id === query);
26
21
  if (byId >= 0) return byId;
22
+ const trimmed = query.trim();
23
+ if (/^[1-9]\d*$/.test(trimmed)) {
24
+ const idx = Number.parseInt(trimmed, 10) - 1;
25
+ if (tasks[idx]) return idx;
26
+ }
27
27
  const lower = query.toLowerCase();
28
28
  return tasks.findIndex((t) => t.title.toLowerCase().includes(lower));
29
29
  }
@@ -384,7 +384,7 @@ var taskTool = {
384
384
  break;
385
385
  }
386
386
  case "promote": {
387
- const target = input.target?.trim();
387
+ const target = (input.target ?? input.id)?.trim();
388
388
  if (!target) {
389
389
  early = {
390
390
  ok: false,
@@ -438,11 +438,12 @@ var taskTool = {
438
438
  promotedFromTask: match.id
439
439
  });
440
440
  }
441
- if (input.subtasks && input.subtasks.length > 0) {
441
+ if (Array.isArray(input.subtasks) && input.subtasks.length > 0) {
442
442
  for (const st of input.subtasks) {
443
+ if (typeof st !== "string" || !st.trim()) continue;
443
444
  todos.push({
444
445
  id: `todo_${ts}_${randomUUID().slice(0, 6)}`,
445
- content: st,
446
+ content: st.trim(),
446
447
  status: "pending",
447
448
  promotedFromTask: match.id
448
449
  });
@@ -454,7 +455,7 @@ var taskTool = {
454
455
  break;
455
456
  }
456
457
  case "planify": {
457
- const target = input.target?.trim();
458
+ const target = (input.target ?? input.id)?.trim();
458
459
  if (!target) {
459
460
  early = {
460
461
  ok: false,
@@ -581,4 +582,4 @@ ${formatTaskList(file.tasks)}` : file.tasks.length > 0 ? formatTaskList(file.tas
581
582
  export {
582
583
  taskTool
583
584
  };
584
- //# sourceMappingURL=chunk-3M7LLN7W.js.map
585
+ //# sourceMappingURL=chunk-LQSOU63Z.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtinTools
3
- } from "./chunk-4BABEJC2.js";
3
+ } from "./chunk-AB2CAUOP.js";
4
4
 
5
5
  // src/pack.ts
6
6
  var builtinToolsPack = {
@@ -12,4 +12,4 @@ var builtinToolsPack = {
12
12
  export {
13
13
  builtinToolsPack
14
14
  };
15
- //# sourceMappingURL=chunk-JVRLTEO7.js.map
15
+ //# sourceMappingURL=chunk-M6UV67BH.js.map
@@ -269,4 +269,4 @@ function prettyJson(s) {
269
269
  export {
270
270
  fetchTool
271
271
  };
272
- //# sourceMappingURL=chunk-C2DQKVLO.js.map
272
+ //# sourceMappingURL=chunk-MJSJWXBF.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getIndexState,
3
3
  searchCodebaseIndex
4
- } from "./chunk-Z5Q3TXRY.js";
4
+ } from "./chunk-ZTCJCYLN.js";
5
5
  import {
6
6
  codebaseIndexDirOverride
7
- } from "./chunk-J43O3BOX.js";
7
+ } from "./chunk-N3K2SFEI.js";
8
8
  import {
9
9
  isBinaryBuffer,
10
10
  safeResolveReal,
@@ -71,7 +71,7 @@ var readTool = {
71
71
  const signal = execOpts?.signal ?? ctx?.signal;
72
72
  signal?.throwIfAborted();
73
73
  const absPath = await safeResolveReal(input.path, ctx);
74
- const shouldIncludeSymbols = input.includeSymbols === true || input.includeSymbols !== false && ctx.meta[ADVANCED_MODE_META_KEY] === true;
74
+ const shouldIncludeSymbols = input.includeSymbols === true || input.includeSymbols !== false && ctx.meta?.[ADVANCED_MODE_META_KEY] === true;
75
75
  let stat2;
76
76
  try {
77
77
  stat2 = await fs.stat(absPath);
@@ -116,7 +116,7 @@ var readTool = {
116
116
  const prior = getReadRangeRecord(ctx, absPath);
117
117
  const requestedEnd = prior ? Math.min(offset + limit - 1, prior.totalLines) : offset + limit - 1;
118
118
  if (input.mode !== "summary" && limit > 0 && prior && offset <= requestedEnd && coversRange(prior, stat2.mtimeMs, stat2.size, offset, requestedEnd)) {
119
- ctx.recordRead(absPath, stat2.mtimeMs, "user", ctx.lastReadHash?.(absPath));
119
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "user", ctx.lastReadHash?.(absPath));
120
120
  const symResult2 = shouldIncludeSymbols ? await fetchSymbolsForFile(absPath, ctx, signal) : void 0;
121
121
  return {
122
122
  text: `[unchanged since previous read: "${input.path}" mtime=${Math.round(stat2.mtimeMs)}; requested lines ${offset}-${requestedEnd} were already shown. Use offset/limit for a new range if needed.]`,
@@ -140,10 +140,22 @@ var readTool = {
140
140
  }
141
141
  const text = buf.toString("utf8");
142
142
  const contentHash = sha256hex(text);
143
- const allLines = text.split(/\r?\n/);
143
+ const allLines = text.length === 0 ? [] : text.split(/\r?\n/);
144
144
  const total = allLines.length;
145
+ if (total === 0) {
146
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "user", contentHash);
147
+ const symResult2 = shouldIncludeSymbols ? await fetchSymbolsForFile(absPath, ctx, signal) : void 0;
148
+ return {
149
+ text: "",
150
+ total_lines: 0,
151
+ encoding: "utf8",
152
+ truncated: false,
153
+ ...symResult2?.symbols ? { symbols: symResult2.symbols } : {},
154
+ ...symResult2?.note ? { note: symResult2.note } : {}
155
+ };
156
+ }
145
157
  if (input.mode === "summary") {
146
- ctx.recordRead(absPath, stat2.mtimeMs, "user", contentHash);
158
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "user", contentHash);
147
159
  rememberReadRange(ctx, absPath, stat2.mtimeMs, stat2.size, total, 1, Math.min(total, 200));
148
160
  const symResult2 = shouldIncludeSymbols ? await fetchSymbolsForFile(absPath, ctx, signal) : void 0;
149
161
  const summary = summarizeFile(input.path, stat2.size, allLines);
@@ -160,7 +172,7 @@ var readTool = {
160
172
  };
161
173
  }
162
174
  if (limit === 0) {
163
- ctx.recordRead(absPath, stat2.mtimeMs, "user", contentHash);
175
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "user", contentHash);
164
176
  rememberReadRange(ctx, absPath, stat2.mtimeMs, stat2.size, total, 1, 0);
165
177
  const symResult2 = shouldIncludeSymbols ? await fetchSymbolsForFile(absPath, ctx, signal) : void 0;
166
178
  return {
@@ -173,7 +185,7 @@ var readTool = {
173
185
  };
174
186
  }
175
187
  if (offset > total) {
176
- ctx.recordRead(absPath, stat2.mtimeMs, "user", contentHash);
188
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "user", contentHash);
177
189
  const symResult2 = shouldIncludeSymbols ? await fetchSymbolsForFile(absPath, ctx, signal) : void 0;
178
190
  return {
179
191
  text: `[offset ${offset} is past end of file "${input.path}" \u2014 file has ${total} line(s). Do not retry this offset.]`,
@@ -196,7 +208,7 @@ var readTool = {
196
208
  parts[i] = `${pad}${numStr}\u2192${slice[i]}`;
197
209
  }
198
210
  const numbered = parts.join("\n");
199
- ctx.recordRead(absPath, stat2.mtimeMs, "user", contentHash);
211
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "user", contentHash);
200
212
  rememberReadRange(
201
213
  ctx,
202
214
  absPath,
@@ -255,6 +267,9 @@ function mergeSymbolNote(note, symNote) {
255
267
  }
256
268
  var READ_RANGES_META_KEY = "tools.read.ranges.v1";
257
269
  function getReadRanges(ctx) {
270
+ if (!ctx.meta) {
271
+ ctx.meta = {};
272
+ }
258
273
  const existing = ctx.meta[READ_RANGES_META_KEY];
259
274
  if (existing && typeof existing === "object" && !Array.isArray(existing)) {
260
275
  return existing;
@@ -325,4 +340,4 @@ ${interesting.join("\n")}` : "symbols/imports: (none detected)"
325
340
  export {
326
341
  readTool
327
342
  };
328
- //# sourceMappingURL=chunk-NSPNFOJ7.js.map
343
+ //# sourceMappingURL=chunk-MK2JK35J.js.map
@@ -87,4 +87,4 @@ function formatDiag(ts, diag, content, sourceFile) {
87
87
  export {
88
88
  checkSyntax
89
89
  };
90
- //# sourceMappingURL=chunk-JSNSMG5R.js.map
90
+ //# sourceMappingURL=chunk-MSOAX3GC.js.map