@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
  kanbanTool
3
- } from "./chunk-W2CECGTG.js";
3
+ } from "./chunk-SMARDKAC.js";
4
4
  import {
5
5
  applyManagedKanbanBoardToTodos,
6
6
  blockingTitles,
@@ -323,7 +323,7 @@ var todoTool = {
323
323
  field: "todos"
324
324
  });
325
325
  }
326
- if (item.status !== void 0 && !VALID_STATUSES.has(item.status)) {
326
+ if (!item.status || !VALID_STATUSES.has(item.status)) {
327
327
  throw new ToolValidationError({
328
328
  message: `todo: item "${item.id}" has invalid status "${item.status}". Allowed: pending, in_progress, completed`,
329
329
  field: "todos"
@@ -331,7 +331,7 @@ var todoTool = {
331
331
  }
332
332
  }
333
333
  const items = input.todos.filter((t) => Boolean(t?.id && t.content));
334
- const todoIdentity = (item) => item.kanbanBoardId && item.kanbanTaskId ? `kanban:${item.kanbanBoardId}:${item.kanbanTaskId}` : item.promotedFromTask ? `task:${item.promotedFromTask}` : item.promotedFromPlan ? `plan:${item.promotedFromPlan}` : `todo:${item.id}`;
334
+ const todoIdentity = (item) => item.kanbanBoardId && item.kanbanTaskId ? `kanban:${item.kanbanBoardId}:${item.kanbanTaskId}` : item.promotedFromTask ? `task:${item.promotedFromTask}:${item.id}` : item.promotedFromPlan ? `plan:${item.promotedFromPlan}:${item.id}` : `todo:${item.id}`;
335
335
  const requestedIdentities = new Set(items.map(todoIdentity));
336
336
  for (const previous of ctx.todos ?? []) {
337
337
  const identity = todoIdentity(previous);
@@ -476,4 +476,4 @@ var todoTool = {
476
476
  export {
477
477
  todoTool
478
478
  };
479
- //# sourceMappingURL=chunk-BK732J7I.js.map
479
+ //# sourceMappingURL=chunk-FBUP524S.js.map
@@ -224,4 +224,4 @@ export {
224
224
  searchMemoryTool,
225
225
  relatedMemoryTool
226
226
  };
227
- //# sourceMappingURL=chunk-NYRLWDT5.js.map
227
+ //# sourceMappingURL=chunk-FVM3O4JQ.js.map
@@ -0,0 +1,244 @@
1
+ // src/tool-diff.ts
2
+ var DIFF_MAX_LINES = 5e3;
3
+ function asObject(input) {
4
+ if (typeof input === "string") {
5
+ const s = input.trim();
6
+ if (s.startsWith("{") || s.startsWith("[")) {
7
+ try {
8
+ const parsed = JSON.parse(s);
9
+ if (parsed && typeof parsed === "object") return parsed;
10
+ } catch {
11
+ return null;
12
+ }
13
+ }
14
+ return null;
15
+ }
16
+ if (input && typeof input === "object") return input;
17
+ return null;
18
+ }
19
+ function diffFromToolInput(toolName, input) {
20
+ if (!toolName) return null;
21
+ const obj = asObject(input);
22
+ if (!obj) return null;
23
+ const name = toolName.toLowerCase();
24
+ const filePath = String(obj.file_path ?? obj.path ?? "");
25
+ switch (name) {
26
+ case "edit":
27
+ case "str_replace":
28
+ case "edit_file":
29
+ case "multi_edit": {
30
+ const oldText = typeof obj.old_string === "string" ? obj.old_string : "";
31
+ const newText = typeof obj.new_string === "string" ? obj.new_string : "";
32
+ if (!oldText && !newText) return null;
33
+ return { mode: "lcs", oldText, newText, caption: `edit ${filePath}`.trim() };
34
+ }
35
+ case "write":
36
+ case "write_file":
37
+ case "create_file": {
38
+ const content = typeof obj.content === "string" ? obj.content : "";
39
+ if (!content) return null;
40
+ return {
41
+ mode: "lcs",
42
+ oldText: "",
43
+ newText: content,
44
+ caption: `write ${filePath} (new)`.trim()
45
+ };
46
+ }
47
+ case "patch": {
48
+ const patchText = typeof obj.patch === "string" ? obj.patch : "";
49
+ if (!patchText.trim()) return null;
50
+ return { mode: "unified", patchText, caption: filePath ? `patch ${filePath}` : "patch" };
51
+ }
52
+ default:
53
+ return null;
54
+ }
55
+ }
56
+ function computeLineDiff(oldText, newText) {
57
+ const a = oldText.split("\n").map((l) => l.replace(/\r$/, ""));
58
+ const b = newText.split("\n").map((l) => l.replace(/\r$/, ""));
59
+ if (a.length > DIFF_MAX_LINES || b.length > DIFF_MAX_LINES) return null;
60
+ const n = a.length;
61
+ const m = b.length;
62
+ const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
63
+ for (let i2 = n - 1; i2 >= 0; i2--) {
64
+ for (let j2 = m - 1; j2 >= 0; j2--) {
65
+ dp[i2][j2] = a[i2] === b[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
66
+ }
67
+ }
68
+ const rows = [];
69
+ let i = 0;
70
+ let j = 0;
71
+ while (i < n && j < m) {
72
+ if (a[i] === b[j]) {
73
+ rows.push({ kind: "ctx", text: a[i] });
74
+ i++;
75
+ j++;
76
+ } else if (dp[i + 1][j] >= dp[i][j + 1]) {
77
+ rows.push({ kind: "del", text: a[i] });
78
+ i++;
79
+ } else {
80
+ rows.push({ kind: "add", text: b[j] });
81
+ j++;
82
+ }
83
+ }
84
+ while (i < n) rows.push({ kind: "del", text: a[i++] });
85
+ while (j < m) rows.push({ kind: "add", text: b[j++] });
86
+ return rows;
87
+ }
88
+ function parseUnifiedDiff(patchText) {
89
+ const rows = [];
90
+ const lines = patchText.split("\n");
91
+ for (const r of lines) {
92
+ const raw = r.replace(/\r$/, "");
93
+ if (raw.startsWith("@@") || raw.startsWith("--- ") || raw.startsWith("+++ ") || raw.startsWith("diff ") || raw.startsWith("index ") || raw.startsWith("\\ ")) {
94
+ rows.push({ kind: "meta", text: raw });
95
+ } else if (raw.startsWith("+")) {
96
+ rows.push({ kind: "add", text: raw.slice(1) });
97
+ } else if (raw.startsWith("-")) {
98
+ rows.push({ kind: "del", text: raw.slice(1) });
99
+ } else {
100
+ rows.push({ kind: "ctx", text: raw.startsWith(" ") ? raw.slice(1) : raw });
101
+ }
102
+ }
103
+ if (rows.length > 0 && rows[rows.length - 1].kind === "ctx" && rows[rows.length - 1].text === "") {
104
+ rows.pop();
105
+ }
106
+ return rows;
107
+ }
108
+ function diffRowsFromToolInput(toolName, input) {
109
+ const d = diffFromToolInput(toolName, input);
110
+ if (!d) return null;
111
+ if (d.mode === "unified") return { caption: d.caption, rows: parseUnifiedDiff(d.patchText) };
112
+ return { caption: d.caption, rows: computeLineDiff(d.oldText, d.newText) };
113
+ }
114
+ var DIFF_LINE_SAFETY_CAP = 4e3;
115
+ function truncMid(s, max) {
116
+ if (s.length <= max) return s;
117
+ return `${s.slice(0, max - 1)}\u2026`;
118
+ }
119
+ function parseUnifiedDiffPreview(diff, maxLines, lineCap = DIFF_LINE_SAFETY_CAP) {
120
+ const all = [];
121
+ let oldLn = 0;
122
+ let newLn = 0;
123
+ for (const raw of diff.split("\n")) {
124
+ const line = raw.replace(/\r$/, "");
125
+ if (line.startsWith("+++") || line.startsWith("---")) continue;
126
+ if (line.startsWith("diff --git") || line.startsWith("index ")) continue;
127
+ if (line.startsWith("@@")) {
128
+ const m = line.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);
129
+ if (m) {
130
+ oldLn = Number.parseInt(m[1] ?? "0", 10) || 0;
131
+ newLn = Number.parseInt(m[2] ?? "0", 10) || 0;
132
+ }
133
+ all.push({ kind: "hunk", text: truncMid(line, 60) });
134
+ continue;
135
+ }
136
+ if (line.startsWith("+")) {
137
+ all.push({ kind: "add", text: truncMid(line, lineCap), newLine: newLn });
138
+ newLn++;
139
+ continue;
140
+ }
141
+ if (line.startsWith("-")) {
142
+ all.push({ kind: "del", text: truncMid(line, lineCap), oldLine: oldLn });
143
+ oldLn++;
144
+ continue;
145
+ }
146
+ if (line.startsWith("\\ No newline")) {
147
+ all.push({ kind: "meta", text: line });
148
+ continue;
149
+ }
150
+ if (line.length === 0) continue;
151
+ all.push({ kind: "ctx", text: truncMid(line, lineCap), oldLine: oldLn, newLine: newLn });
152
+ oldLn++;
153
+ newLn++;
154
+ }
155
+ const added = all.filter((row) => row.kind === "add").length;
156
+ const removed = all.filter((row) => row.kind === "del").length;
157
+ if (all.length === 0) {
158
+ return { rows: [], hidden: 0, added: 0, removed: 0, hiddenAdded: 0, hiddenRemoved: 0 };
159
+ }
160
+ if (all.length <= maxLines) {
161
+ return { rows: all, hidden: 0, added, removed, hiddenAdded: 0, hiddenRemoved: 0 };
162
+ }
163
+ const rows = all.slice(0, maxLines);
164
+ const hiddenRows = all.slice(maxLines);
165
+ return {
166
+ rows,
167
+ hidden: hiddenRows.length,
168
+ added,
169
+ removed,
170
+ hiddenAdded: hiddenRows.filter((row) => row.kind === "add").length,
171
+ hiddenRemoved: hiddenRows.filter((row) => row.kind === "del").length
172
+ };
173
+ }
174
+ var TOOL_DIFF_BROWSER_SRC = [
175
+ "var DIFF_MAX_LINES = 5000;",
176
+ "function __diffObj(input){",
177
+ ' if(typeof input==="string"){ var s=input.trim(); if(s.charAt(0)==="{"||s.charAt(0)==="["){ try{ var p=JSON.parse(s); if(p&&typeof p==="object") return p; }catch(_e){} } return null; }',
178
+ ' if(input&&typeof input==="object") return input; return null;',
179
+ "}",
180
+ "function diffFromToolInput(name, input){",
181
+ " if(!name) return null;",
182
+ " var obj=__diffObj(input); if(!obj) return null;",
183
+ " var n=String(name).toLowerCase();",
184
+ ' var fp=String(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:""));',
185
+ ' if(n==="edit"||n==="str_replace"||n==="edit_file"||n==="multi_edit"){',
186
+ ' var oldT=typeof obj.old_string==="string"?obj.old_string:"";',
187
+ ' var newT=typeof obj.new_string==="string"?obj.new_string:"";',
188
+ " if(!oldT&&!newT) return null;",
189
+ ' return { mode:"lcs", oldText:oldT, newText:newT, caption:("edit "+fp).replace(/\\s+$/,"") };',
190
+ " }",
191
+ ' if(n==="write"||n==="write_file"||n==="create_file"){',
192
+ ' var c=typeof obj.content==="string"?obj.content:"";',
193
+ " if(!c) return null;",
194
+ ' return { mode:"lcs", oldText:"", newText:c, caption:("write "+fp+" (new)").replace(/^\\s+/,"").replace(/\\s+$/,"") };',
195
+ " }",
196
+ ' if(n==="patch"){',
197
+ ' var pt=typeof obj.patch==="string"?obj.patch:"";',
198
+ ' if(!pt.replace(/\\s/g,"")) return null;',
199
+ ' return { mode:"unified", patchText:pt, caption: fp ? ("patch "+fp) : "patch" };',
200
+ " }",
201
+ " return null;",
202
+ "}",
203
+ "function computeLineDiff(oldText, newText){",
204
+ ' var a=oldText.split("\\n").map(function(l){return l.replace(/\\r$/,"");}), b=newText.split("\\n").map(function(l){return l.replace(/\\r$/,"");});',
205
+ " if(a.length>DIFF_MAX_LINES||b.length>DIFF_MAX_LINES) return null;",
206
+ " var nn=a.length, mm=b.length, i, j;",
207
+ " var dp=new Array(nn+1); for(i=0;i<=nn;i++){ dp[i]=new Array(mm+1); for(j=0;j<=mm;j++) dp[i][j]=0; }",
208
+ " for(i=nn-1;i>=0;i--){ for(j=mm-1;j>=0;j--){ dp[i][j]= a[i]===b[j] ? dp[i+1][j+1]+1 : Math.max(dp[i+1][j], dp[i][j+1]); } }",
209
+ " var rows=[]; i=0; j=0;",
210
+ ' while(i<nn&&j<mm){ if(a[i]===b[j]){ rows.push({kind:"ctx",text:a[i]}); i++; j++; } else if(dp[i+1][j]>=dp[i][j+1]){ rows.push({kind:"del",text:a[i]}); i++; } else { rows.push({kind:"add",text:b[j]}); j++; } }',
211
+ ' while(i<nn){ rows.push({kind:"del",text:a[i]}); i++; }',
212
+ ' while(j<mm){ rows.push({kind:"add",text:b[j]}); j++; }',
213
+ " return rows;",
214
+ "}",
215
+ "function parseUnifiedDiff(patchText){",
216
+ ' var rows=[], lines=patchText.split("\\n"), k, raw;',
217
+ ' for(k=0;k<lines.length;k++){ raw=lines[k].replace(/\\r$/,"");',
218
+ ' if(raw.indexOf("@@")===0||raw.indexOf("--- ")===0||raw.indexOf("+++ ")===0||raw.indexOf("diff ")===0||raw.indexOf("index ")===0||raw.indexOf("\\\\ ")===0){ rows.push({kind:"meta",text:raw}); }',
219
+ ' else if(raw.charAt(0)==="+"){ rows.push({kind:"add",text:raw.slice(1)}); }',
220
+ ' else if(raw.charAt(0)==="-"){ rows.push({kind:"del",text:raw.slice(1)}); }',
221
+ ' else { rows.push({kind:"ctx",text: raw.charAt(0)===" " ? raw.slice(1) : raw}); }',
222
+ " }",
223
+ ' if(rows.length>0 && rows[rows.length-1].kind==="ctx" && rows[rows.length-1].text===""){ rows.pop(); }',
224
+ " return rows;",
225
+ "}",
226
+ "function diffRowsFromToolInput(name, input){",
227
+ " var d=diffFromToolInput(name, input); if(!d) return null;",
228
+ ' if(d.mode==="unified") return { caption:d.caption, rows:parseUnifiedDiff(d.patchText) };',
229
+ " return { caption:d.caption, rows:computeLineDiff(d.oldText, d.newText) };",
230
+ "}"
231
+ ].join("\n");
232
+
233
+ export {
234
+ DIFF_MAX_LINES,
235
+ diffFromToolInput,
236
+ computeLineDiff,
237
+ parseUnifiedDiff,
238
+ diffRowsFromToolInput,
239
+ DIFF_LINE_SAFETY_CAP,
240
+ truncMid,
241
+ parseUnifiedDiffPreview,
242
+ TOOL_DIFF_BROWSER_SRC
243
+ };
244
+ //# sourceMappingURL=chunk-FYDBUVQD.js.map
@@ -1,6 +1,54 @@
1
1
  import {
2
2
  resolveIndexDir
3
- } from "./chunk-J43O3BOX.js";
3
+ } from "./chunk-N3K2SFEI.js";
4
+
5
+ // src/codebase-index/project-server-endpoint.ts
6
+ import { createHash } from "node:crypto";
7
+ import * as fs from "node:fs";
8
+ import * as os from "node:os";
9
+ import * as path from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+ var PROJECT_INDEX_SERVER_PROTOCOL_VERSION = 1;
12
+ var PROJECT_INDEX_SERVER_METADATA_FILE = "server.json";
13
+ var PROJECT_INDEX_SERVER_SOCKET_DIR = `wsci-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}`;
14
+ var buildIdCache;
15
+ function projectIndexServerBuildId(entrypoint) {
16
+ const href = entrypoint instanceof URL ? entrypoint.href : entrypoint;
17
+ const cleanHref = href.split(/[?#]/, 1)[0] ?? href;
18
+ const file = cleanHref.startsWith("file:") ? fileURLToPath(cleanHref) : path.resolve(cleanHref);
19
+ try {
20
+ const stat = fs.statSync(file);
21
+ if (buildIdCache?.file === file && buildIdCache.mtimeMs === stat.mtimeMs && buildIdCache.size === stat.size) {
22
+ return buildIdCache.buildId;
23
+ }
24
+ const buildId = createHash("sha256").update(fs.readFileSync(file)).digest("hex").slice(0, 24);
25
+ buildIdCache = { file, mtimeMs: stat.mtimeMs, size: stat.size, buildId };
26
+ return buildId;
27
+ } catch {
28
+ return `unreadable:${path.basename(file)}`;
29
+ }
30
+ }
31
+ function normalizeLocalPath(value) {
32
+ const resolved = path.resolve(value);
33
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
34
+ }
35
+ function projectIndexServerKey(projectRoot, indexDir) {
36
+ const resolvedIndexDir = normalizeLocalPath(resolveIndexDir(projectRoot, indexDir));
37
+ return createHash("sha256").update(resolvedIndexDir).digest("hex").slice(0, 24);
38
+ }
39
+ function projectIndexServerEndpoint(projectRoot, indexDir) {
40
+ const key = projectIndexServerKey(projectRoot, indexDir);
41
+ if (process.platform === "win32") {
42
+ return `\\\\.\\pipe\\wrongstack-codebase-index-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}-${key}`;
43
+ }
44
+ return path.join(os.tmpdir(), PROJECT_INDEX_SERVER_SOCKET_DIR, `${key}.sock`);
45
+ }
46
+ function projectIndexServerMetadataPath(projectRoot, indexDir) {
47
+ return path.join(
48
+ path.resolve(resolveIndexDir(projectRoot, indexDir)),
49
+ PROJECT_INDEX_SERVER_METADATA_FILE
50
+ );
51
+ }
4
52
 
5
53
  // src/codebase-index/binary-frame.ts
6
54
  import { decode, encode } from "@msgpack/msgpack";
@@ -53,54 +101,6 @@ function encodeJsonFrame(message) {
53
101
  `;
54
102
  }
55
103
 
56
- // src/codebase-index/project-server-endpoint.ts
57
- import { createHash } from "node:crypto";
58
- import * as fs from "node:fs";
59
- import * as os from "node:os";
60
- import * as path from "node:path";
61
- import { fileURLToPath } from "node:url";
62
- var PROJECT_INDEX_SERVER_PROTOCOL_VERSION = 1;
63
- var PROJECT_INDEX_SERVER_METADATA_FILE = "server.json";
64
- var PROJECT_INDEX_SERVER_SOCKET_DIR = `wsci-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}`;
65
- var buildIdCache;
66
- function projectIndexServerBuildId(entrypoint) {
67
- const href = entrypoint instanceof URL ? entrypoint.href : entrypoint;
68
- const cleanHref = href.split(/[?#]/, 1)[0] ?? href;
69
- const file = cleanHref.startsWith("file:") ? fileURLToPath(cleanHref) : path.resolve(cleanHref);
70
- try {
71
- const stat = fs.statSync(file);
72
- if (buildIdCache?.file === file && buildIdCache.mtimeMs === stat.mtimeMs && buildIdCache.size === stat.size) {
73
- return buildIdCache.buildId;
74
- }
75
- const buildId = createHash("sha256").update(fs.readFileSync(file)).digest("hex").slice(0, 24);
76
- buildIdCache = { file, mtimeMs: stat.mtimeMs, size: stat.size, buildId };
77
- return buildId;
78
- } catch {
79
- return `unreadable:${path.basename(file)}`;
80
- }
81
- }
82
- function normalizeLocalPath(value) {
83
- const resolved = path.resolve(value);
84
- return process.platform === "win32" ? resolved.toLowerCase() : resolved;
85
- }
86
- function projectIndexServerKey(projectRoot, indexDir) {
87
- const resolvedIndexDir = normalizeLocalPath(resolveIndexDir(projectRoot, indexDir));
88
- return createHash("sha256").update(resolvedIndexDir).digest("hex").slice(0, 24);
89
- }
90
- function projectIndexServerEndpoint(projectRoot, indexDir) {
91
- const key = projectIndexServerKey(projectRoot, indexDir);
92
- if (process.platform === "win32") {
93
- return `\\\\.\\pipe\\wrongstack-codebase-index-v${PROJECT_INDEX_SERVER_PROTOCOL_VERSION}-${key}`;
94
- }
95
- return path.join(os.tmpdir(), PROJECT_INDEX_SERVER_SOCKET_DIR, `${key}.sock`);
96
- }
97
- function projectIndexServerMetadataPath(projectRoot, indexDir) {
98
- return path.join(
99
- path.resolve(resolveIndexDir(projectRoot, indexDir)),
100
- PROJECT_INDEX_SERVER_METADATA_FILE
101
- );
102
- }
103
-
104
104
  // src/codebase-index/project-server-protocol.ts
105
105
  var PROJECT_INDEX_SERVER_MAX_FRAME_CHARS = 64 * 1024 * 1024;
106
106
  function encodeProjectServerMessage(message) {
@@ -120,4 +120,4 @@ export {
120
120
  PROJECT_INDEX_SERVER_MAX_FRAME_CHARS,
121
121
  encodeProjectServerMessage
122
122
  };
123
- //# sourceMappingURL=chunk-PV6HIZQD.js.map
123
+ //# sourceMappingURL=chunk-GDDXX27P.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,
@@ -114,8 +114,8 @@ async function prepareWrite(input, ctx) {
114
114
  existed = stat2.isFile();
115
115
  if (existed) {
116
116
  prev = await fs.readFile(absPath, "utf8");
117
- if (!ctx.hasRead(absPath)) {
118
- ctx.recordRead(absPath, stat2.mtimeMs, "write", sha256hex(prev));
117
+ if (ctx.hasRead ? !ctx.hasRead(absPath) : true) {
118
+ ctx.recordRead?.(absPath, stat2.mtimeMs, "write", sha256hex(prev));
119
119
  }
120
120
  }
121
121
  } catch (err) {
@@ -139,7 +139,7 @@ async function finishWrite(input, ctx, prepared, signal) {
139
139
  const { text: diff, truncated: diffTruncated } = truncateDiffPayload(rawDiff, MAX_DIFF_BYTES);
140
140
  const contentHash = sha256hex(content);
141
141
  const stat2 = await fs.stat(prepared.absPath);
142
- ctx.recordRead(prepared.absPath, stat2.mtimeMs, "write", contentHash);
142
+ ctx.recordRead?.(prepared.absPath, stat2.mtimeMs, "write", contentHash);
143
143
  ctx.session?.recordFileChange?.({
144
144
  path: prepared.absPath,
145
145
  action: prepared.existed ? "modified" : "created",
@@ -179,4 +179,4 @@ async function finishWrite(input, ctx, prepared, signal) {
179
179
  export {
180
180
  writeTool
181
181
  };
182
- //# sourceMappingURL=chunk-3GIKYHLA.js.map
182
+ //# sourceMappingURL=chunk-GKSG5CPH.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CircuitBreaker
3
- } from "./chunk-HFXSNKCV.js";
3
+ } from "./chunk-7JJFC6CT.js";
4
4
 
5
5
  // src/process-registry.ts
6
6
  import { spawn } from "node:child_process";
@@ -35,8 +35,9 @@ function redactCommand(cmd) {
35
35
  for (const pattern of SENSITIVE_FLAG_PATTERNS) {
36
36
  result = result.replace(pattern, (match) => {
37
37
  const eq = match.indexOf("=");
38
+ const colon = match.indexOf(":");
38
39
  const sp = match.search(/\s/);
39
- const delim = eq !== -1 ? "=" : sp !== -1 ? match[sp] : null;
40
+ const delim = eq !== -1 && (colon === -1 || eq < colon) ? "=" : colon !== -1 ? ":" : sp !== -1 ? match[sp] : null;
40
41
  if (delim !== null) {
41
42
  const flag = match.slice(0, match.indexOf(expectDefined(delim)) + 1);
42
43
  return `${flag}[REDACTED]`;
@@ -470,4 +471,4 @@ export {
470
471
  getProcessRegistry,
471
472
  _resetProcessRegistry
472
473
  };
473
- //# sourceMappingURL=chunk-ESLPBT5A.js.map
474
+ //# sourceMappingURL=chunk-HDYUBRMF.js.map
@@ -306,7 +306,7 @@ ${result.content}
306
306
  }
307
307
  signal?.throwIfAborted();
308
308
  const tokens = applyTokenOverrides(rawTokens, active.overrides);
309
- const normalizedFiles = input.files ? (Array.isArray(input.files) ? input.files : String(input.files).split(",")).map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean) : void 0;
309
+ const normalizedFiles = input.files ? (Array.isArray(input.files) ? input.files : String(input.files).split(",")).filter((f) => typeof f === "string").map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean) : void 0;
310
310
  const report = await runDesignVerify(ctx.projectRoot, tokens, normalizedFiles);
311
311
  const pct = Math.round(report.score * 100);
312
312
  const top = report.violations.slice(0, 25).map((v) => ` ${v.file}:${v.line} \u2014 ${v.reason}: ${v.snippet}`).join("\n");
@@ -334,4 +334,4 @@ Replace off-palette colors with kit tokens (or the materialized CSS vars / token
334
334
  export {
335
335
  designTool
336
336
  };
337
- //# sourceMappingURL=chunk-ELRRTWNP.js.map
337
+ //# sourceMappingURL=chunk-IXIS7RSG.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  compileUserRegex
3
- } from "./chunk-Q5JPPCZC.js";
3
+ } from "./chunk-YJTXRH5Y.js";
4
4
  import {
5
5
  mapWithConcurrency
6
6
  } from "./chunk-ZBMANLYH.js";
7
7
  import {
8
8
  enqueueReindex
9
- } from "./chunk-Z5Q3TXRY.js";
9
+ } from "./chunk-ZTCJCYLN.js";
10
10
  import {
11
11
  isBinaryBuffer,
12
12
  safeResolveReal,
@@ -275,7 +275,7 @@ function passesExtraGlob(extraGlob, name, full, base) {
275
275
  }
276
276
  async function resolveFiles(filesInput, ctx, extraGlob) {
277
277
  const base = ctx.cwd;
278
- const parts = Array.isArray(filesInput) ? filesInput.map((s) => s.trim()).filter(Boolean) : filesInput.trim().split(",").map((s) => s.trim()).filter(Boolean);
278
+ const parts = Array.isArray(filesInput) ? filesInput.filter((s) => typeof s === "string").map((s) => s.trim()).filter(Boolean) : filesInput.trim().split(",").map((s) => s.trim()).filter(Boolean);
279
279
  const resolved = [];
280
280
  for (const p of parts) {
281
281
  if (p.includes("*") || p.includes("?")) {
@@ -289,7 +289,7 @@ async function resolveFiles(filesInput, ctx, extraGlob) {
289
289
  resolved.push(absPath);
290
290
  }
291
291
  }
292
- return resolved;
292
+ return [...new Set(resolved)];
293
293
  }
294
294
  async function globFiles(pattern, base, extraGlob) {
295
295
  const rgAvailable = await checkRg();
@@ -413,4 +413,4 @@ export {
413
413
  replaceTool,
414
414
  __resetRgDetectionForTests
415
415
  };
416
- //# sourceMappingURL=chunk-HR67OWEP.js.map
416
+ //# sourceMappingURL=chunk-IYH4OHBP.js.map
@@ -13,7 +13,8 @@ var DEFAULT_IGNORE = /* @__PURE__ */ new Set([
13
13
  ".gnupg",
14
14
  ".aws"
15
15
  ]);
16
- var DEFAULT_MAX_ENTRIES = 5e3;
16
+ var DEFAULT_MAX_TREE_ENTRIES = 5e3;
17
+ var DEFAULT_MAX_ENTRIES = DEFAULT_MAX_TREE_ENTRIES;
17
18
  var MAX_TREE_OUTPUT_BYTES = 256 * 1024;
18
19
  var treeTool = {
19
20
  name: "tree",
@@ -88,7 +89,7 @@ var treeTool = {
88
89
  const exclude = /* @__PURE__ */ new Set([
89
90
  ...DEFAULT_IGNORE,
90
91
  ...rawExclude.filter((s) => typeof s === "string").map(
91
- (s) => s.trim().replace(/[\\/]+$/, "").replace(/^\.\//, "")
92
+ (s) => s.trim().replace(/\\/g, "/").replace(/\/+$/, "").replace(/^\.\//, "")
92
93
  ).filter(Boolean)
93
94
  ]);
94
95
  const globRe = input.glob ? compileGlob(input.glob) : void 0;
@@ -204,7 +205,7 @@ async function walkDir(dir, depth, opts) {
204
205
  opts.totalDirs.value += dirCount;
205
206
  opts.totalFiles.value += fileCount;
206
207
  opts.onProgress?.();
207
- const items = filtered.sort((a, b) => {
208
+ const items = filtered.filter((e) => e.isDirectory() || opts.showFiles).sort((a, b) => {
208
209
  if (a.isDirectory() && !b.isDirectory()) return -1;
209
210
  if (!a.isDirectory() && b.isDirectory()) return 1;
210
211
  return a.name.localeCompare(b.name);
@@ -243,6 +244,8 @@ async function walkDir(dir, depth, opts) {
243
244
  }
244
245
 
245
246
  export {
247
+ DEFAULT_MAX_TREE_ENTRIES,
248
+ MAX_TREE_OUTPUT_BYTES,
246
249
  treeTool
247
250
  };
248
- //# sourceMappingURL=chunk-W232EFEM.js.map
251
+ //# sourceMappingURL=chunk-JDOO4P6Z.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-BTSFTGIL.js";
4
4
  import {
5
5
  getPersistentProcessRegistry
6
- } from "./chunk-QGF2C7TF.js";
6
+ } from "./chunk-PVCB7RUZ.js";
7
7
  import {
8
8
  createOutputSpool,
9
9
  spoolNote
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  getProcessRegistry,
13
13
  redactCommand
14
- } from "./chunk-ESLPBT5A.js";
14
+ } from "./chunk-HDYUBRMF.js";
15
15
  import {
16
16
  buildWin32CmdShimInvocation,
17
17
  resolveWin32Command
@@ -47,6 +47,7 @@ var flagLetters = (args) => {
47
47
  }
48
48
  return seen;
49
49
  };
50
+ var isPowerShellCmd = (cmd) => /^(?:powershell|pwsh)(?:\.exe)?$/i.test(cmd);
50
51
  var RULES = [
51
52
  // ----- rm / rmdir: recursive force delete (any path) -----
52
53
  // Note: BLOCKED_ARG_PATTERNS already hard-denies root/home/glob paths,
@@ -85,7 +86,12 @@ var RULES = [
85
86
  id: "powershell-remove-item-recursive-force",
86
87
  level: "destructive",
87
88
  test: (cmd, args) => {
88
- if (cmd !== "powershell" && cmd !== "pwsh") return false;
89
+ const isPwsh = isPowerShellCmd(cmd);
90
+ const isRemoveItemCmd = /^(?:remove-item|ri)(?:\.exe)?$/i.test(cmd);
91
+ if (!isPwsh && !isRemoveItemCmd) return false;
92
+ if (isPwsh && !args.some((a) => /^(?:Remove-Item|ri|rm|del|erase|rd|rmdir)(?:\.exe)?$/i.test(a))) {
93
+ return false;
94
+ }
89
95
  const hasRecurse = argMatches(args, /^-(?:r|recurse)(?::\$true)?$/i);
90
96
  const hasForce = argMatches(args, /^-(?:f|force)(?::\$true)?$/i);
91
97
  if (argMatches(args, /^-whatif(?::\$true)?$/i)) return false;
@@ -98,7 +104,7 @@ var RULES = [
98
104
  id: "powershell-disk-volume-destroy",
99
105
  level: "destructive",
100
106
  test: (cmd, args) => {
101
- if (cmd !== "powershell" && cmd !== "pwsh") return false;
107
+ if (!isPowerShellCmd(cmd)) return false;
102
108
  return args.some(
103
109
  (a) => /^(?:Format-Volume|Clear-Disk|Initialize-Disk|Remove-Partition|Clear-Volume)(?:\s|$)/i.test(
104
110
  a
@@ -112,7 +118,7 @@ var RULES = [
112
118
  id: "powershell-stop-restart-computer",
113
119
  level: "destructive",
114
120
  test: (cmd, args) => {
115
- if (cmd !== "powershell" && cmd !== "pwsh") return false;
121
+ if (!isPowerShellCmd(cmd)) return false;
116
122
  return args.some((a) => /^(?:Stop-Computer|Restart-Computer)(?:\s|$)/i.test(a));
117
123
  },
118
124
  reason: "PowerShell system shutdown or restart"
@@ -122,7 +128,7 @@ var RULES = [
122
128
  id: "powershell-execution-policy-bypass",
123
129
  level: "caution",
124
130
  test: (cmd, args) => {
125
- if (cmd !== "powershell" && cmd !== "pwsh") return false;
131
+ if (!isPowerShellCmd(cmd)) return false;
126
132
  return args.some(
127
133
  (a) => /Set-ExecutionPolicy\s+(?:Bypass|Unrestricted)|-(?:EncodedCommand|enc)\b/i.test(a)
128
134
  );
@@ -269,7 +275,12 @@ var RULES = [
269
275
  level: "destructive",
270
276
  test: (cmd, args) => {
271
277
  if (!["npm", "pnpm", "yarn", "bun", "cargo"].includes(cmd)) return false;
272
- return args.includes("publish") || cmd === "cargo" && args.includes("yank");
278
+ const firstPositional = args.find((a) => !a.startsWith("-"));
279
+ if (!firstPositional) return false;
280
+ if (cmd === "cargo") {
281
+ return firstPositional === "publish" || firstPositional === "yank";
282
+ }
283
+ return firstPositional === "publish";
273
284
  },
274
285
  reason: "publishing to a public package registry (hard to reverse)"
275
286
  },
@@ -1821,4 +1832,4 @@ export {
1821
1832
  getExecAllowlist,
1822
1833
  execTool
1823
1834
  };
1824
- //# sourceMappingURL=chunk-OTPTQBYE.js.map
1835
+ //# sourceMappingURL=chunk-KDEXUQY7.js.map
@@ -100,7 +100,7 @@ describe('{{Name}}', () => {
100
100
  var scaffoldTool = {
101
101
  name: "scaffold",
102
102
  category: "Project",
103
- description: "Generate new files and folder structures from built-in templates or custom definitions. This is the recommended way to bootstrap new packages, components, or modules instead of creating files one by one with `write`.",
103
+ description: "Generate or preview files and folder structures from built-in templates or custom definitions. Writes files to disk unless dry_run is set. This is the recommended way to bootstrap new packages, components, or modules instead of creating files one by one with `write`.",
104
104
  usageHint: "PREFERRED FOR SCAFFOLDING:\n\n- Use built-in templates when they match your needs (e.g. react-component, npm-package).\n- Supports `dry_run` so you can preview exactly what will be created.\n- Has the powerful `fs.write.outside-project` capability \u2014 review paths carefully.\nMuch cleaner and safer than manually writing multiple files.",
105
105
  permission: "confirm",
106
106
  mutating: true,
@@ -195,7 +195,7 @@ function escapeRegexLiteral(value) {
195
195
  }
196
196
  function substituteVars(content, name, vars) {
197
197
  const kebab = name.toLowerCase().replace(/\s+/g, "-");
198
- const pascal = name.replace(/(?:^|[-_\s]+)([a-z])/g, (_, c) => c.toUpperCase());
198
+ const pascal = name.replace(/(?:^|[-_\s]+)([a-zA-Z])/g, (_, c) => c.toUpperCase());
199
199
  let result = content;
200
200
  result = result.replace(/\{\{name\}\}/g, () => kebab);
201
201
  result = result.replace(/\{\{Name\}\}/g, () => pascal);
@@ -207,6 +207,7 @@ function substituteVars(content, name, vars) {
207
207
  }
208
208
 
209
209
  export {
210
+ BUILT_IN_TEMPLATES,
210
211
  scaffoldTool
211
212
  };
212
- //# sourceMappingURL=chunk-2OXHS3KZ.js.map
213
+ //# sourceMappingURL=chunk-KLJZ4WV4.js.map