@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
  e2ePlanTool
3
- } from "./chunk-VPALDFYM.js";
3
+ } from "./chunk-RV7BVTDG.js";
4
4
  import {
5
5
  codebaseAstReplaceTool,
6
6
  codebaseImpactAnalysisTool,
@@ -14,97 +14,97 @@ import {
14
14
  codebaseStatsTool,
15
15
  codebaseTargetedTestTool,
16
16
  deadCodeScanTool
17
- } from "./chunk-LRDIRJJL.js";
17
+ } from "./chunk-YEISRT4S.js";
18
18
  import {
19
19
  planTool
20
- } from "./chunk-B4HTSV6Z.js";
20
+ } from "./chunk-5KS24LTS.js";
21
21
  import {
22
22
  taskTool
23
- } from "./chunk-3M7LLN7W.js";
23
+ } from "./chunk-LQSOU63Z.js";
24
24
  import {
25
25
  toolSearchTool
26
- } from "./chunk-T77XOX7E.js";
26
+ } from "./chunk-24T5XIJU.js";
27
27
  import {
28
28
  toolUseTool
29
- } from "./chunk-FRN7TIAA.js";
29
+ } from "./chunk-B3MGJBFI.js";
30
30
  import {
31
31
  batchToolUseTool
32
- } from "./chunk-WXJY3BKV.js";
32
+ } from "./chunk-VBF2YXUW.js";
33
33
  import {
34
34
  toolHelpTool
35
- } from "./chunk-QBV725YG.js";
35
+ } from "./chunk-7ODZTPCU.js";
36
36
  import {
37
37
  designTool
38
- } from "./chunk-ELRRTWNP.js";
38
+ } from "./chunk-IXIS7RSG.js";
39
39
  import {
40
40
  testTool
41
- } from "./chunk-YTKSNTT4.js";
41
+ } from "./chunk-QA6IASYX.js";
42
42
  import {
43
43
  installTool
44
- } from "./chunk-WAQASTXB.js";
44
+ } from "./chunk-O6BY43ZB.js";
45
45
  import {
46
46
  auditTool
47
- } from "./chunk-UZFY3CKD.js";
47
+ } from "./chunk-WEEVSWQB.js";
48
48
  import {
49
49
  outdatedTool
50
- } from "./chunk-DFQDJT22.js";
50
+ } from "./chunk-6GOZTS6F.js";
51
51
  import {
52
52
  logsTool
53
- } from "./chunk-FQNXYA6W.js";
53
+ } from "./chunk-VU3QBYL4.js";
54
54
  import {
55
55
  documentTool
56
- } from "./chunk-IU4DV2PA.js";
56
+ } from "./chunk-CHEK3ASV.js";
57
57
  import {
58
58
  scaffoldTool
59
- } from "./chunk-2OXHS3KZ.js";
59
+ } from "./chunk-KLJZ4WV4.js";
60
60
  import {
61
61
  gitTool
62
- } from "./chunk-6AAOT4PW.js";
62
+ } from "./chunk-AQ5YBURX.js";
63
63
  import {
64
64
  patchTool
65
- } from "./chunk-JLYA4X7K.js";
65
+ } from "./chunk-CGXTR34H.js";
66
66
  import {
67
67
  jsonTool
68
- } from "./chunk-VD2LV5WO.js";
68
+ } from "./chunk-VZGPASGD.js";
69
69
  import {
70
70
  diffTool
71
- } from "./chunk-34VLZ35Z.js";
71
+ } from "./chunk-7HL23T3T.js";
72
72
  import {
73
73
  treeTool
74
- } from "./chunk-W232EFEM.js";
74
+ } from "./chunk-JDOO4P6Z.js";
75
75
  import {
76
76
  lintTool
77
- } from "./chunk-KWXIKGE3.js";
77
+ } from "./chunk-3D5DJWOE.js";
78
78
  import {
79
79
  formatTool
80
- } from "./chunk-J74TMK4M.js";
80
+ } from "./chunk-NJX2RXKJ.js";
81
81
  import {
82
82
  typecheckTool
83
- } from "./chunk-QSNVDHOZ.js";
83
+ } from "./chunk-4WPBS45A.js";
84
84
  import {
85
85
  languageInfoTool,
86
86
  languagePackageTool,
87
87
  languageTool
88
- } from "./chunk-NDIT3SBZ.js";
88
+ } from "./chunk-7N5U2RAU.js";
89
89
  import {
90
90
  replaceTool
91
- } from "./chunk-HR67OWEP.js";
91
+ } from "./chunk-IYH4OHBP.js";
92
92
  import {
93
93
  globTool
94
- } from "./chunk-ZMW6WJFT.js";
94
+ } from "./chunk-ASEXQRA7.js";
95
95
  import {
96
96
  grepTool
97
- } from "./chunk-XSSFBS5I.js";
97
+ } from "./chunk-4ERMPDHV.js";
98
98
  import {
99
99
  bashTool,
100
100
  checkAndBlockKillCommand,
101
101
  diagnoseBashism,
102
102
  shellArgs
103
- } from "./chunk-5UFVCIUB.js";
103
+ } from "./chunk-NN2SNP2R.js";
104
104
  import {
105
105
  detectDanger,
106
106
  execTool
107
- } from "./chunk-OTPTQBYE.js";
107
+ } from "./chunk-KDEXUQY7.js";
108
108
  import {
109
109
  buildChildEnv
110
110
  } from "./chunk-BTSFTGIL.js";
@@ -115,31 +115,31 @@ import {
115
115
  import {
116
116
  getProcessRegistry,
117
117
  redactCommand
118
- } from "./chunk-ESLPBT5A.js";
118
+ } from "./chunk-HDYUBRMF.js";
119
119
  import {
120
120
  fetchTool
121
- } from "./chunk-C2DQKVLO.js";
121
+ } from "./chunk-MJSJWXBF.js";
122
122
  import {
123
123
  searchTool
124
- } from "./chunk-QPNYDH5B.js";
124
+ } from "./chunk-62OAECEQ.js";
125
125
  import {
126
126
  todoTool
127
- } from "./chunk-BK732J7I.js";
127
+ } from "./chunk-FBUP524S.js";
128
128
  import {
129
129
  kanbanTool
130
- } from "./chunk-W2CECGTG.js";
130
+ } from "./chunk-SMARDKAC.js";
131
131
  import {
132
132
  browserTools
133
- } from "./chunk-QWKSKFKZ.js";
133
+ } from "./chunk-SOR7OCYP.js";
134
134
  import {
135
135
  readTool
136
- } from "./chunk-NSPNFOJ7.js";
136
+ } from "./chunk-MK2JK35J.js";
137
137
  import {
138
138
  writeTool
139
- } from "./chunk-3GIKYHLA.js";
139
+ } from "./chunk-GKSG5CPH.js";
140
140
  import {
141
141
  editTool
142
- } from "./chunk-Z6IHMJMC.js";
142
+ } from "./chunk-DK4J2WMH.js";
143
143
  import {
144
144
  resolvePowerShell
145
145
  } from "./chunk-KE7A76VC.js";
@@ -204,12 +204,13 @@ var clarifyTool = {
204
204
  const hostAsk = ctx.askUserChoices;
205
205
  if (typeof hostAsk === "function") {
206
206
  const res = await hostAsk(input.question, options, input.isMultiSelect);
207
+ const selected = Array.isArray(res?.selected) ? res.selected : [];
207
208
  return {
208
209
  status: "answered",
209
210
  question: input.question,
210
- selectedOptions: res.selected,
211
- customResponse: res.custom,
212
- decisionSummary: `User selected: ${res.selected.join(", ")}${res.custom ? ` (Custom: ${res.custom})` : ""}`
211
+ selectedOptions: selected,
212
+ customResponse: res?.custom,
213
+ decisionSummary: `User selected: ${selected.join(", ")}${res?.custom ? ` (Custom: ${res.custom})` : ""}`
213
214
  };
214
215
  }
215
216
  const defaultChoice = input.recommendedOption ?? options[0] ?? "Default";
@@ -746,13 +747,15 @@ ${hint}` : "") + cautionText;
746
747
  outcome: timedOut ? `timed out (exit ${c.code})` : `exit ${c.code}`,
747
748
  risk: "shell"
748
749
  });
750
+ const isAborted = callerSignal.aborted;
749
751
  yield {
750
752
  type: "final",
751
753
  output: {
752
754
  output: finalResultText,
753
- exit_code: timedOut ? 1 : c.code,
754
- timed_out: timedOut,
755
- pid
755
+ exit_code: timedOut || isAborted ? 124 : c.code,
756
+ timed_out: timedOut || isAborted,
757
+ pid: pid ?? null,
758
+ ...timedOut ? { error: "Command timed out" } : isAborted ? { error: "Command aborted by user or signal" } : {}
756
759
  }
757
760
  };
758
761
  return;
@@ -765,6 +768,7 @@ ${hint}` : "") + cautionText;
765
768
  }
766
769
  } finally {
767
770
  for (const t of timers) clearTimeout(t);
771
+ callerSignal.removeEventListener("abort", onAbort);
768
772
  }
769
773
  }
770
774
  };
@@ -1034,8 +1038,13 @@ var setWorkingDirTool = {
1034
1038
  }
1035
1039
  if (!isDirectory) {
1036
1040
  try {
1037
- ctx.setWorkingDir(previous);
1041
+ if (typeof previous === "string") {
1042
+ ctx.setWorkingDir(previous);
1043
+ } else {
1044
+ ctx.workingDir = previous;
1045
+ }
1038
1046
  } catch {
1047
+ ctx.workingDir = previous;
1039
1048
  }
1040
1049
  return {
1041
1050
  current: ctx.workingDir,
@@ -1078,7 +1087,7 @@ var BUILTIN_TOOL_DESCRIPTIONS = {
1078
1087
  "codebase-stats": "Report codebase-index health, indexed file and symbol counts, languages, and freshness. Use it before relying on indexed discovery results.",
1079
1088
  "codebase-search": "Search indexed symbols, signatures, and documentation with optional language, kind, path, or LSP-kind filters. Use it for semantic discovery before broad text search.",
1080
1089
  "codebase-skeleton": "Extract a compact structural skeleton from a source file or directory, preserving declarations while omitting implementation detail. Use it to understand unfamiliar code quickly.",
1081
- "codebase-repo-map": "Generate a concise map of important files, symbols, and relationships in a project area. Use it for orientation before a cross-file change.",
1090
+ "codebase-repo-map": "Generate a reference-weighted, token-budgeted Repository Map of the codebase within ~1200 tokens by default. Use at the beginning of complex tasks or when navigating unfamiliar repositories to get a bird-eye view of the architecture.",
1082
1091
  "codebase-impact-analysis": "Find likely callers, dependents, related tests, and change risk for a named symbol. Use it before changing a public or widely used declaration.",
1083
1092
  "codebase-targeted-test": "Discover and run tests that cover a specified symbol, source file, or explicit test files. Use it for focused regression validation after a change.",
1084
1093
  "security-ast-scan": "Statically scan source code for supported security patterns and return findings with locations. Use it as a focused code check, not as a substitute for a full security assessment.",
@@ -1100,8 +1109,8 @@ var BUILTIN_TOOL_DESCRIPTIONS = {
1100
1109
  task: "Manage structured task records, dependencies, ownership, and promotion into actionable session work. Use it to organize bounded work before delegation or execution.",
1101
1110
  git: "Inspect or run scoped Git operations in the project, including status, diff, history, branches, and commits. Review the target and working tree before mutating operations.",
1102
1111
  patch: "Apply a unified diff to project files with patch-style context checking. Use it for a reviewed multi-file change when exact patch content is available.",
1103
- json: "Read, query, validate, or update JSON files while preserving valid structure. Use it instead of raw text edits when changing structured JSON data.",
1104
- diff: "Compare two files, revisions, or text inputs and return a readable unified diff. Use it to review intended changes before applying or committing them.",
1112
+ json: "Read, query, validate, or merge JSON/JSON5/YAML files while preserving valid structure (read-only \u2014 does not write). Use it instead of raw text edits when reading or querying structured data.",
1113
+ diff: "Show file content with line numbers, staged/working-tree diffs via git, or commit/branch diffs. A safer and more structured alternative to raw `git diff` via shell.",
1105
1114
  tree: "Render a bounded directory tree with depth, file, hidden-file, and ignore controls. Use it for repository orientation without reading every file.",
1106
1115
  lint: "Run the project\u2019s configured linter for a target path or working directory and return diagnostics. Use it after code edits to catch style and static-analysis issues.",
1107
1116
  format: "Run the project\u2019s configured formatter on selected files or directories. Use it after editing code, while reviewing the resulting diff for unintended formatting scope.",
@@ -1114,9 +1123,9 @@ var BUILTIN_TOOL_DESCRIPTIONS = {
1114
1123
  audit: "Run the package manager\u2019s dependency vulnerability audit and summarize actionable findings. Use it to assess known dependency advisories, not source-code vulnerabilities.",
1115
1124
  outdated: "List outdated project dependencies and available versions without changing manifests or lockfiles. Use it to plan dependency maintenance.",
1116
1125
  logs: "Read or tail configured local, container, or process logs with bounded output. Use it to investigate a known runtime failure or service behavior.",
1117
- document: "Generate or update project documentation from supplied scope and source context. Use it to record verified behavior; review generated text before treating it as authoritative.",
1118
- scaffold: "Preview or generate files from a built-in or custom scaffold template. Use dry_run first to inspect paths and content before creating project files.",
1119
- design: "Create a structured implementation design with goals, constraints, approach, and risks. Use it before a substantial change that needs an explicit technical decision.",
1126
+ document: "List undocumented symbols as read-only candidates; this deprecated preview stub does not generate docstrings or write files. Use the auto-doc plugin when it is enabled.",
1127
+ scaffold: "Preview or generate files from a built-in or custom scaffold template. Writes files to disk unless dry_run is set. Use dry_run first to inspect paths and content before creating project files.",
1128
+ design: "Choose, preview, or materialize a UI design kit (e.g. minimal-clarity, neo-brutalist) for the active stack. Lists available kits, previews tokens, or writes a design-token source file to the project.",
1120
1129
  tool_search: "Discover registered tools by name, description, tag, permission, or mutating status. Use it to find a lazy capability before calling it through tool-use.",
1121
1130
  tool_use: "Invoke a registered tool by name with its input object, including a tool discovered lazily. Use it only after confirming the target tool\u2019s schema and side effects.",
1122
1131
  batch_tool_use: "Invoke several independent registered tools as a batch and return each result. Use it for parallel read-only discovery; avoid batching dependent or destructive operations.",
@@ -1266,9 +1275,11 @@ var builtinTools = rawBuiltinTools.map((tool) => {
1266
1275
  export {
1267
1276
  clarifyTool,
1268
1277
  PWSH_TOOL_DESCRIPTION,
1278
+ PWSH_TOOL_USAGE_HINT,
1269
1279
  pwshTool,
1270
1280
  analyzeSecurityAndPerformance,
1271
1281
  securityAstScanTool,
1282
+ setWorkingDirTool,
1272
1283
  BUILTIN_TOOL_DESCRIPTIONS,
1273
1284
  OPTIONAL_TOOLS,
1274
1285
  OFF_ONLY_TOOLS,
@@ -1277,4 +1288,4 @@ export {
1277
1288
  TIER3_TOOLS,
1278
1289
  builtinTools
1279
1290
  };
1280
- //# sourceMappingURL=chunk-4BABEJC2.js.map
1291
+ //# sourceMappingURL=chunk-AB2CAUOP.js.map
@@ -103,6 +103,12 @@ var gitTool = {
103
103
  field: "command"
104
104
  });
105
105
  }
106
+ if (input.limit !== void 0 && (typeof input.limit !== "number" || !Number.isFinite(input.limit) || input.limit <= 0)) {
107
+ throw new ToolValidationError({
108
+ message: "git: limit must be a positive integer",
109
+ field: "limit"
110
+ });
111
+ }
106
112
  if (input.command === "commit" && !input.message) {
107
113
  return {
108
114
  command: "commit",
@@ -214,7 +220,8 @@ function findGitDir(cwd, projectRoot) {
214
220
  function buildArgs(input) {
215
221
  const rawLimit = typeof input.limit === "number" && Number.isFinite(input.limit) && input.limit > 0 ? Math.floor(input.limit) : 20;
216
222
  const limit = Math.max(1, rawLimit);
217
- const files = input.files ? (Array.isArray(input.files) ? input.files : input.files.split(",")).map((s) => s.trim().replace(/\\/g, "/")).filter(Boolean) : [];
223
+ const rawFiles = input.files ? (Array.isArray(input.files) ? input.files : input.files.split(",")).filter((s) => typeof s === "string").map((s) => s.trim().replace(/\\/g, "/")).filter(Boolean) : [];
224
+ const files = [...new Set(rawFiles)];
218
225
  switch (input.command) {
219
226
  case "status":
220
227
  return ["status", ...files.length ? ["--", ...files] : []];
@@ -247,9 +254,14 @@ function buildArgs(input) {
247
254
  case "stash":
248
255
  return input.message ? ["stash", "push", "-m", input.message] : ["stash", "push"];
249
256
  case "push":
250
- return ["push"];
257
+ return [
258
+ "push",
259
+ ...input.dry_run ? ["--dry-run"] : [],
260
+ ...input.force ? ["--force"] : [],
261
+ ...input.branch ? ["origin", input.branch] : []
262
+ ];
251
263
  case "pull":
252
- return ["pull"];
264
+ return ["pull", ...input.branch ? ["origin", input.branch] : []];
253
265
  case "fetch":
254
266
  return ["fetch", ...input.branch ? [input.branch] : ["--all"]];
255
267
  case "reset":
@@ -361,4 +373,4 @@ function runGit(args, cwd, signal) {
361
373
  export {
362
374
  gitTool
363
375
  };
364
- //# sourceMappingURL=chunk-6AAOT4PW.js.map
376
+ //# sourceMappingURL=chunk-AQ5YBURX.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ZBMANLYH.js";
4
4
  import {
5
5
  loadGitignoreMatcher
6
- } from "./chunk-DTQ75VBC.js";
6
+ } from "./chunk-2CTZW6JQ.js";
7
7
  import {
8
8
  assertRealInsideRoot,
9
9
  safeResolveReal
@@ -144,7 +144,7 @@ var globTool = {
144
144
  } catch {
145
145
  }
146
146
  }
147
- if (truncated) return;
147
+ if (signal?.aborted) return;
148
148
  }
149
149
  await mapWithConcurrency(matchedFiles, WALK_CONCURRENCY, pushResult);
150
150
  await mapWithConcurrency(subdirs, WALK_CONCURRENCY, ({ full, rel }) => walk(full, rel));
@@ -158,4 +158,4 @@ var globTool = {
158
158
  export {
159
159
  globTool
160
160
  };
161
- //# sourceMappingURL=chunk-ZMW6WJFT.js.map
161
+ //# sourceMappingURL=chunk-ASEXQRA7.js.map
@@ -96,4 +96,4 @@ var toolUseTool = {
96
96
  export {
97
97
  toolUseTool
98
98
  };
99
- //# sourceMappingURL=chunk-FRN7TIAA.js.map
99
+ //# sourceMappingURL=chunk-B3MGJBFI.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  enqueueReindex
3
- } from "./chunk-Z5Q3TXRY.js";
3
+ } from "./chunk-ZTCJCYLN.js";
4
4
  import {
5
5
  resolveRealInsideRoot,
6
6
  safeResolveReal,
@@ -50,12 +50,12 @@ var patchTool = {
50
50
  writeTargets(input) {
51
51
  if (!input?.patch || typeof input.patch !== "string" || !input.patch.trim()) return [];
52
52
  const strip = typeof input.strip === "number" && Number.isFinite(input.strip) && input.strip >= 0 ? Math.floor(input.strip) : 1;
53
- const out = [];
53
+ const out = /* @__PURE__ */ new Set();
54
54
  for (const target of extractDiffTargets(input.patch)) {
55
55
  const stripped = stripPathComponents(target.raw, strip);
56
- if (stripped) out.push(stripped);
56
+ if (stripped) out.add(stripped);
57
57
  }
58
- return out;
58
+ return [...out];
59
59
  },
60
60
  async execute(input, ctx, opts) {
61
61
  if (!input?.patch || typeof input.patch !== "string" || !input.patch.trim()) {
@@ -66,6 +66,12 @@ var patchTool = {
66
66
  }
67
67
  const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
68
68
  signal.throwIfAborted();
69
+ if (input.strip !== void 0 && (typeof input.strip !== "number" || !Number.isFinite(input.strip) || input.strip < 0)) {
70
+ throw new ToolValidationError({
71
+ message: "patch: strip must be a non-negative integer",
72
+ field: "strip"
73
+ });
74
+ }
69
75
  const strip = typeof input.strip === "number" && Number.isFinite(input.strip) && input.strip >= 0 ? Math.floor(input.strip) : 1;
70
76
  const dryRun = input.dry_run ?? false;
71
77
  const refuse = (message) => ({
@@ -108,6 +114,11 @@ var patchTool = {
108
114
  }
109
115
  resolvedTargets.push({ raw: t.raw, deleted: t.deleted, abs: real });
110
116
  }
117
+ if (resolvedTargets.length === 0) {
118
+ return refuse(
119
+ "patch refused: no file target could be resolved from the patch (fail-closed containment \u2014 target paths stripped to empty)"
120
+ );
121
+ }
111
122
  const beforeContents = /* @__PURE__ */ new Map();
112
123
  const beforeExisted = /* @__PURE__ */ new Set();
113
124
  if (!dryRun) {
@@ -180,7 +191,11 @@ var patchTool = {
180
191
  message: `patch failed: ${result.stderr || result.stdout}${partial}`
181
192
  };
182
193
  }
183
- const wouldPatch = extractPatchedFiles(result.stdout);
194
+ const wouldPatch = result.engine === "git" ? [
195
+ ...new Set(
196
+ resolvedTargets.map((target) => path.relative(dir, target.abs) || target.abs)
197
+ )
198
+ ] : extractPatchedFiles(result.stdout);
184
199
  return {
185
200
  applied: wouldPatch.length,
186
201
  rejected: 1,
@@ -380,4 +395,4 @@ function extractPatchedFiles(output) {
380
395
  export {
381
396
  patchTool
382
397
  };
383
- //# sourceMappingURL=chunk-JLYA4X7K.js.map
398
+ //# sourceMappingURL=chunk-CGXTR34H.js.map
@@ -29,7 +29,10 @@ var documentTool = {
29
29
  description: "Specific file path to document"
30
30
  },
31
31
  files: {
32
- type: "string",
32
+ oneOf: [
33
+ { type: "string" },
34
+ { type: "array", items: { type: "string" } }
35
+ ],
33
36
  description: "File(s) to process: single path, comma-separated list, or glob"
34
37
  },
35
38
  style: {
@@ -111,7 +114,7 @@ async function resolveFiles(filesInput, cwd, ctx) {
111
114
  } catch {
112
115
  }
113
116
  }
114
- return resolved;
117
+ return [...new Set(resolved)];
115
118
  }
116
119
  function processFile(content, absPath, _style, _overwrite, target) {
117
120
  const results = [];
@@ -177,4 +180,4 @@ function processFile(content, absPath, _style, _overwrite, target) {
177
180
  export {
178
181
  documentTool
179
182
  };
180
- //# sourceMappingURL=chunk-IU4DV2PA.js.map
183
+ //# sourceMappingURL=chunk-CHEK3ASV.js.map
@@ -218,4 +218,4 @@ async function walk(root, dir, out) {
218
218
  export {
219
219
  makeSkillTool
220
220
  };
221
- //# sourceMappingURL=chunk-GOIZNNOA.js.map
221
+ //# sourceMappingURL=chunk-DJYLI7EW.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  checkSyntax
3
- } from "./chunk-JSNSMG5R.js";
3
+ } from "./chunk-MSOAX3GC.js";
4
4
  import {
5
5
  enqueueReindex
6
- } from "./chunk-Z5Q3TXRY.js";
6
+ } from "./chunk-ZTCJCYLN.js";
7
7
  import {
8
8
  safeResolveReal,
9
9
  sha256hex,
@@ -140,6 +140,10 @@ function fuzzyScan(fileLines, needleLines, offsets, includeTrailingNewline = fal
140
140
  if (fileTrimmed[i + n - 1] !== lastNeedle) continue;
141
141
  const windowInterior = fileTrimmed.slice(i + 1, i + n - 1).join("\n");
142
142
  if (windowInterior.length > FUZZY_MAX_INTERIOR_CHARS) continue;
143
+ const maxLen = Math.max(needleInterior.length, windowInterior.length);
144
+ if (maxLen > 0 && Math.abs(needleInterior.length - windowInterior.length) / maxLen > 1 - FUZZY_MIN_SIMILARITY) {
145
+ continue;
146
+ }
143
147
  const score = similarity(needleInterior, windowInterior);
144
148
  if (score >= FUZZY_MIN_SIMILARITY) {
145
149
  candidates.push({
@@ -166,10 +170,6 @@ function similarity(a, b) {
166
170
  if (a === b) return 1;
167
171
  const max = Math.max(a.length, b.length);
168
172
  if (max === 0) return 1;
169
- const lenDiff = Math.abs(a.length - b.length);
170
- if (lenDiff / max > 1 - FUZZY_MIN_SIMILARITY) {
171
- return 1 - lenDiff / max;
172
- }
173
173
  return 1 - levenshtein(a, b) / max;
174
174
  }
175
175
  function levenshtein(a, b) {
@@ -362,7 +362,7 @@ var editTool = {
362
362
  field: "path"
363
363
  });
364
364
  }
365
- const autoRead = !ctx.hasRead(absPath);
365
+ const autoRead = ctx.hasRead ? !ctx.hasRead(absPath) : false;
366
366
  const original = await fs.readFile(absPath, "utf8");
367
367
  const updated = await fs.stat(absPath);
368
368
  const mtimeTolerance = process.platform === "win32" ? 2e3 : 1;
@@ -377,7 +377,7 @@ var editTool = {
377
377
  });
378
378
  }
379
379
  } else {
380
- const lastReadMtime = ctx.lastReadMtime(absPath);
380
+ const lastReadMtime = ctx.lastReadMtime?.(absPath);
381
381
  if (lastReadMtime !== void 0 && updated.mtimeMs > lastReadMtime + mtimeTolerance) {
382
382
  throw new ToolValidationError({
383
383
  message: `edit: file "${input.path}" was modified externally. Re-read it first.`,
@@ -402,7 +402,7 @@ var editTool = {
402
402
  if (!fileLf.includes(oldLf)) {
403
403
  throw noMatchError(input.path, fileLf, oldLf);
404
404
  }
405
- if (autoRead) ctx.recordRead(absPath, updated.mtimeMs, "user", originalHash);
405
+ if (autoRead) ctx.recordRead?.(absPath, updated.mtimeMs, "user", originalHash);
406
406
  return {
407
407
  path: absPath,
408
408
  replacements: 0,
@@ -473,7 +473,7 @@ var editTool = {
473
473
  } catch {
474
474
  }
475
475
  const written = await fs.stat(absPath);
476
- ctx.recordRead(absPath, written.mtimeMs, "write", sha256hex(newFile));
476
+ ctx.recordRead?.(absPath, written.mtimeMs, "write", sha256hex(newFile));
477
477
  ctx.session?.recordFileChange?.({
478
478
  path: absPath,
479
479
  action: "modified",
@@ -518,4 +518,4 @@ Compare this against your old_string and retry with the file's actual text.` : "
518
518
  export {
519
519
  editTool
520
520
  };
521
- //# sourceMappingURL=chunk-Z6IHMJMC.js.map
521
+ //# sourceMappingURL=chunk-DK4J2WMH.js.map
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  getProcessRegistry,
7
7
  redactCommand
8
- } from "./chunk-ESLPBT5A.js";
8
+ } from "./chunk-HDYUBRMF.js";
9
9
  import {
10
10
  buildWin32CmdShimInvocation,
11
11
  resolveWin32Command
@@ -13,6 +13,7 @@ import {
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-OYP27E3I.js.map
288
+ //# sourceMappingURL=chunk-DRRY6SCM.js.map