@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,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,135 +14,135 @@ import {
14
14
  codebaseStatsTool,
15
15
  codebaseTargetedTestTool,
16
16
  deadCodeScanTool
17
- } from "./chunk-RTZWBNTY.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-RJZQWEMS.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-UQQS3VNT.js";
41
+ } from "./chunk-QA6IASYX.js";
42
42
  import {
43
43
  installTool
44
- } from "./chunk-RLMX75EM.js";
44
+ } from "./chunk-O6BY43ZB.js";
45
45
  import {
46
46
  auditTool
47
- } from "./chunk-64VIJPFV.js";
47
+ } from "./chunk-WEEVSWQB.js";
48
48
  import {
49
49
  outdatedTool
50
- } from "./chunk-IYKXK356.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-IWS56OY7.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-OG2BEUBY.js";
71
+ } from "./chunk-7HL23T3T.js";
72
72
  import {
73
73
  treeTool
74
- } from "./chunk-MNP3GE7H.js";
74
+ } from "./chunk-JDOO4P6Z.js";
75
75
  import {
76
76
  lintTool
77
- } from "./chunk-LOBRWKCR.js";
77
+ } from "./chunk-3D5DJWOE.js";
78
78
  import {
79
79
  formatTool
80
- } from "./chunk-EADULOZV.js";
80
+ } from "./chunk-NJX2RXKJ.js";
81
81
  import {
82
82
  typecheckTool
83
- } from "./chunk-5EUJF3WC.js";
83
+ } from "./chunk-4WPBS45A.js";
84
84
  import {
85
85
  languageInfoTool,
86
86
  languagePackageTool,
87
87
  languageTool
88
- } from "./chunk-TTZOK6IY.js";
88
+ } from "./chunk-7N5U2RAU.js";
89
89
  import {
90
90
  replaceTool
91
- } from "./chunk-X5FOFGXX.js";
91
+ } from "./chunk-IYH4OHBP.js";
92
92
  import {
93
93
  globTool
94
- } from "./chunk-JDPQOR7C.js";
94
+ } from "./chunk-ASEXQRA7.js";
95
95
  import {
96
96
  grepTool
97
- } from "./chunk-YOKD4GWJ.js";
97
+ } from "./chunk-4ERMPDHV.js";
98
98
  import {
99
99
  bashTool,
100
100
  checkAndBlockKillCommand,
101
101
  diagnoseBashism,
102
102
  shellArgs
103
- } from "./chunk-AKHYMB4V.js";
103
+ } from "./chunk-NN2SNP2R.js";
104
104
  import {
105
105
  detectDanger,
106
106
  execTool
107
- } from "./chunk-BSJSNVGA.js";
107
+ } from "./chunk-KDEXUQY7.js";
108
108
  import {
109
109
  buildChildEnv
110
110
  } from "./chunk-BTSFTGIL.js";
111
111
  import {
112
112
  createOutputSpool,
113
113
  spoolNote
114
- } from "./chunk-2VSZC6QM.js";
114
+ } from "./chunk-SCMRM6NL.js";
115
115
  import {
116
116
  getProcessRegistry,
117
117
  redactCommand
118
- } from "./chunk-3PVYQFRQ.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-45JPRMC2.js";
133
+ } from "./chunk-SOR7OCYP.js";
134
134
  import {
135
135
  readTool
136
- } from "./chunk-RNWUCZ2U.js";
136
+ } from "./chunk-MK2JK35J.js";
137
137
  import {
138
138
  writeTool
139
- } from "./chunk-O44IMQCN.js";
139
+ } from "./chunk-GKSG5CPH.js";
140
140
  import {
141
141
  editTool
142
- } from "./chunk-CFLJFDYV.js";
142
+ } from "./chunk-DK4J2WMH.js";
143
143
  import {
144
144
  resolvePowerShell
145
- } from "./chunk-V43EQ6VR.js";
145
+ } from "./chunk-KE7A76VC.js";
146
146
  import {
147
147
  normalizeCommandOutput,
148
148
  safeResolveProjectPath,
@@ -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-OTINMOKK.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
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  mapWithConcurrency
3
- } from "./chunk-NWZ6XGBJ.js";
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
@@ -71,18 +71,28 @@ var globTool = {
71
71
  const visitedRealDirs = /* @__PURE__ */ new Set();
72
72
  let truncated = false;
73
73
  const pushResult = async (full) => {
74
- if (signal?.aborted || truncated || results.length >= limit) {
74
+ if (signal?.aborted) {
75
75
  truncated = true;
76
76
  return;
77
77
  }
78
78
  try {
79
79
  const st = await fs.stat(full);
80
- if (truncated || results.length >= limit) {
80
+ if (signal?.aborted) {
81
81
  truncated = true;
82
82
  return;
83
83
  }
84
- results.push({ rel: full, mtime: st.mtimeMs });
85
- if (results.length >= limit) truncated = true;
84
+ if (results.length < limit) {
85
+ results.push({ rel: full, mtime: st.mtimeMs });
86
+ return;
87
+ }
88
+ truncated = true;
89
+ let oldestIndex = 0;
90
+ for (let i = 1; i < results.length; i++) {
91
+ if (results[i].mtime < results[oldestIndex].mtime) oldestIndex = i;
92
+ }
93
+ if (st.mtimeMs > results[oldestIndex].mtime) {
94
+ results[oldestIndex] = { rel: full, mtime: st.mtimeMs };
95
+ }
86
96
  } catch {
87
97
  }
88
98
  };
@@ -94,10 +104,6 @@ var globTool = {
94
104
  const realDir = await fs.realpath(dir).catch(() => dir);
95
105
  if (visitedRealDirs.has(realDir)) return;
96
106
  visitedRealDirs.add(realDir);
97
- if (results.length >= limit) {
98
- truncated = true;
99
- return;
100
- }
101
107
  let entries;
102
108
  try {
103
109
  entries = await fs.readdir(dir, { withFileTypes: true });
@@ -138,16 +144,10 @@ var globTool = {
138
144
  } catch {
139
145
  }
140
146
  }
141
- if (truncated) return;
147
+ if (signal?.aborted) return;
142
148
  }
143
149
  await mapWithConcurrency(matchedFiles, WALK_CONCURRENCY, pushResult);
144
- if (truncated) return;
145
- const remainingSubdirs = truncated ? [] : subdirs;
146
- await mapWithConcurrency(
147
- remainingSubdirs,
148
- WALK_CONCURRENCY,
149
- ({ full, rel }) => walk(full, rel)
150
- );
150
+ await mapWithConcurrency(subdirs, WALK_CONCURRENCY, ({ full, rel }) => walk(full, rel));
151
151
  };
152
152
  await walk(base, "");
153
153
  results.sort((a, b) => b.mtime - a.mtime);
@@ -158,4 +158,4 @@ var globTool = {
158
158
  export {
159
159
  globTool
160
160
  };
161
- //# sourceMappingURL=chunk-JDPQOR7C.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-DP6CXMJZ.js";
3
+ } from "./chunk-ZTCJCYLN.js";
4
4
  import {
5
5
  resolveRealInsideRoot,
6
6
  safeResolveReal,
@@ -42,6 +42,21 @@ var patchTool = {
42
42
  },
43
43
  required: ["patch"]
44
44
  },
45
+ // VULN-001 Phase 2: the permission layer's input-key heuristic cannot see
46
+ // destinations encoded in the diff body, so the confirm prompt keyed on
47
+ // `directory` (".") while the patch wrote elsewhere. Declares the stripped
48
+ // relative destinations; execute()'s realpath containment above remains
49
+ // the authority on whether they are allowed.
50
+ writeTargets(input) {
51
+ if (!input?.patch || typeof input.patch !== "string" || !input.patch.trim()) return [];
52
+ const strip = typeof input.strip === "number" && Number.isFinite(input.strip) && input.strip >= 0 ? Math.floor(input.strip) : 1;
53
+ const out = /* @__PURE__ */ new Set();
54
+ for (const target of extractDiffTargets(input.patch)) {
55
+ const stripped = stripPathComponents(target.raw, strip);
56
+ if (stripped) out.add(stripped);
57
+ }
58
+ return [...out];
59
+ },
45
60
  async execute(input, ctx, opts) {
46
61
  if (!input?.patch || typeof input.patch !== "string" || !input.patch.trim()) {
47
62
  throw new ToolValidationError({
@@ -51,6 +66,12 @@ var patchTool = {
51
66
  }
52
67
  const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
53
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
+ }
54
75
  const strip = typeof input.strip === "number" && Number.isFinite(input.strip) && input.strip >= 0 ? Math.floor(input.strip) : 1;
55
76
  const dryRun = input.dry_run ?? false;
56
77
  const refuse = (message) => ({
@@ -68,6 +89,11 @@ var patchTool = {
68
89
  }
69
90
  const realRoot = await fs.realpath(ctx.projectRoot).catch(() => path.resolve(ctx.projectRoot));
70
91
  const targets = extractDiffTargets(input.patch);
92
+ if (targets.length === 0) {
93
+ return refuse(
94
+ "patch refused: no file target could be parsed from the patch (fail-closed containment \u2014 refusing an unparseable diff)"
95
+ );
96
+ }
71
97
  const resolvedTargets = [];
72
98
  for (const t of targets) {
73
99
  const stripped = stripPathComponents(t.raw, strip);
@@ -88,6 +114,11 @@ var patchTool = {
88
114
  }
89
115
  resolvedTargets.push({ raw: t.raw, deleted: t.deleted, abs: real });
90
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
+ }
91
122
  const beforeContents = /* @__PURE__ */ new Map();
92
123
  const beforeExisted = /* @__PURE__ */ new Set();
93
124
  if (!dryRun) {
@@ -160,7 +191,11 @@ var patchTool = {
160
191
  message: `patch failed: ${result.stderr || result.stdout}${partial}`
161
192
  };
162
193
  }
163
- 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);
164
199
  return {
165
200
  applied: wouldPatch.length,
166
201
  rejected: 1,
@@ -233,6 +268,31 @@ function extractDiffTargets(patch) {
233
268
  if (oldLinesLeft <= 0 && newLinesLeft <= 0) inHunk = false;
234
269
  continue;
235
270
  }
271
+ if (line.startsWith("diff --git ")) {
272
+ const rest = line.slice("diff --git ".length);
273
+ if (rest.startsWith('"')) {
274
+ const quoted = /^"((?:[^"\\]|\\.)*)"\s+"((?:[^"\\]|\\.)*)"$/.exec(rest);
275
+ if (quoted) {
276
+ for (const half of [quoted[1], quoted[2]]) {
277
+ const p = clean(half);
278
+ if (p) out.push({ raw: p, deleted: false });
279
+ }
280
+ }
281
+ } else {
282
+ const bIdx = rest.lastIndexOf(" b/");
283
+ if (rest.startsWith("a/") && bIdx !== -1) {
284
+ out.push({ raw: rest.slice(0, bIdx), deleted: false });
285
+ out.push({ raw: rest.slice(bIdx + 1), deleted: false });
286
+ }
287
+ }
288
+ continue;
289
+ }
290
+ const extended = /^(?:rename|copy) (?:from|to) (.+)$/.exec(line);
291
+ if (extended) {
292
+ const p = clean(extended[1]);
293
+ if (p && p !== "/dev/null") out.push({ raw: p, deleted: false });
294
+ continue;
295
+ }
236
296
  const oldMatch = /^---\s+([^\t\r\n]+)/.exec(line);
237
297
  if (oldMatch) {
238
298
  lastOld = clean(oldMatch[1]);
@@ -269,7 +329,6 @@ function runPatch(args, cwd, signal, fallback) {
269
329
  if (!result.unavailable) return { ...result, engine: "patch" };
270
330
  const gitArgs = [
271
331
  "apply",
272
- "--unsafe-paths",
273
332
  `-p${fallback.strip}`,
274
333
  "--verbose",
275
334
  ...fallback.dryRun ? ["--check"] : [],
@@ -336,4 +395,4 @@ function extractPatchedFiles(output) {
336
395
  export {
337
396
  patchTool
338
397
  };
339
- //# sourceMappingURL=chunk-IWS56OY7.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-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,
@@ -39,6 +39,9 @@ var FUZZY_MIN_SIMILARITY = 0.9;
39
39
  var FUZZY_AMBIGUITY_MARGIN = 0.05;
40
40
  var FUZZY_MAX_INTERIOR_CHARS = 2e3;
41
41
  function findLadderMatches(fileLf, oldLf) {
42
+ if (typeof fileLf !== "string" || typeof oldLf !== "string" || oldLf.length === 0) {
43
+ return void 0;
44
+ }
42
45
  const exact = [];
43
46
  let idx = fileLf.indexOf(oldLf);
44
47
  let currentLine = 1;
@@ -137,6 +140,10 @@ function fuzzyScan(fileLines, needleLines, offsets, includeTrailingNewline = fal
137
140
  if (fileTrimmed[i + n - 1] !== lastNeedle) continue;
138
141
  const windowInterior = fileTrimmed.slice(i + 1, i + n - 1).join("\n");
139
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
+ }
140
147
  const score = similarity(needleInterior, windowInterior);
141
148
  if (score >= FUZZY_MIN_SIMILARITY) {
142
149
  candidates.push({
@@ -163,10 +170,6 @@ function similarity(a, b) {
163
170
  if (a === b) return 1;
164
171
  const max = Math.max(a.length, b.length);
165
172
  if (max === 0) return 1;
166
- const lenDiff = Math.abs(a.length - b.length);
167
- if (lenDiff / max > 1 - FUZZY_MIN_SIMILARITY) {
168
- return 1 - lenDiff / max;
169
- }
170
173
  return 1 - levenshtein(a, b) / max;
171
174
  }
172
175
  function levenshtein(a, b) {
@@ -359,7 +362,7 @@ var editTool = {
359
362
  field: "path"
360
363
  });
361
364
  }
362
- const autoRead = !ctx.hasRead(absPath);
365
+ const autoRead = ctx.hasRead ? !ctx.hasRead(absPath) : false;
363
366
  const original = await fs.readFile(absPath, "utf8");
364
367
  const updated = await fs.stat(absPath);
365
368
  const mtimeTolerance = process.platform === "win32" ? 2e3 : 1;
@@ -374,7 +377,7 @@ var editTool = {
374
377
  });
375
378
  }
376
379
  } else {
377
- const lastReadMtime = ctx.lastReadMtime(absPath);
380
+ const lastReadMtime = ctx.lastReadMtime?.(absPath);
378
381
  if (lastReadMtime !== void 0 && updated.mtimeMs > lastReadMtime + mtimeTolerance) {
379
382
  throw new ToolValidationError({
380
383
  message: `edit: file "${input.path}" was modified externally. Re-read it first.`,
@@ -399,7 +402,7 @@ var editTool = {
399
402
  if (!fileLf.includes(oldLf)) {
400
403
  throw noMatchError(input.path, fileLf, oldLf);
401
404
  }
402
- if (autoRead) ctx.recordRead(absPath, updated.mtimeMs, "user", originalHash);
405
+ if (autoRead) ctx.recordRead?.(absPath, updated.mtimeMs, "user", originalHash);
403
406
  return {
404
407
  path: absPath,
405
408
  replacements: 0,
@@ -470,7 +473,7 @@ var editTool = {
470
473
  } catch {
471
474
  }
472
475
  const written = await fs.stat(absPath);
473
- ctx.recordRead(absPath, written.mtimeMs, "write", sha256hex(newFile));
476
+ ctx.recordRead?.(absPath, written.mtimeMs, "write", sha256hex(newFile));
474
477
  ctx.session?.recordFileChange?.({
475
478
  path: absPath,
476
479
  action: "modified",
@@ -515,4 +518,4 @@ Compare this against your old_string and retry with the file's actual text.` : "
515
518
  export {
516
519
  editTool
517
520
  };
518
- //# sourceMappingURL=chunk-CFLJFDYV.js.map
521
+ //# sourceMappingURL=chunk-DK4J2WMH.js.map