@wrongstack/tools 0.305.1 → 0.306.2

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 (63) hide show
  1. package/dist/_shell-pick.d.ts +4 -5
  2. package/dist/_util.d.ts +22 -5
  3. package/dist/audit.d.ts +0 -1
  4. package/dist/audit.js +135 -46
  5. package/dist/bash.js +61 -37
  6. package/dist/browser/index.js +29 -9
  7. package/dist/browser/types.d.ts +7 -1
  8. package/dist/builtin.js +1294 -726
  9. package/dist/codebase-index/codebase-search-tool.d.ts +5 -0
  10. package/dist/codebase-index/index.js +223 -152
  11. package/dist/codebase-index/project-server.js +10 -11
  12. package/dist/diff.d.ts +5 -0
  13. package/dist/diff.js +78 -12
  14. package/dist/document.js +18 -6
  15. package/dist/edit.js +69 -16
  16. package/dist/exec.js +44 -22
  17. package/dist/fetch.js +13 -1
  18. package/dist/format.d.ts +4 -2
  19. package/dist/format.js +81 -31
  20. package/dist/glob.js +12 -4
  21. package/dist/grep.d.ts +2 -0
  22. package/dist/grep.js +15 -4
  23. package/dist/index.js +1359 -762
  24. package/dist/install.js +96 -37
  25. package/dist/kanban-tool-types.d.ts +6 -1
  26. package/dist/kanban.js +60 -0
  27. package/dist/languages/index.js +28 -13
  28. package/dist/lint.js +28 -13
  29. package/dist/logs.d.ts +0 -1
  30. package/dist/logs.js +44 -13
  31. package/dist/memory.d.ts +8 -0
  32. package/dist/memory.js +23 -3
  33. package/dist/mode.d.ts +1 -1
  34. package/dist/mode.js +3 -0
  35. package/dist/next-steps.d.ts +2 -3
  36. package/dist/next-steps.js +3 -3
  37. package/dist/outdated.d.ts +0 -3
  38. package/dist/outdated.js +89 -48
  39. package/dist/pack.js +1294 -726
  40. package/dist/plan.js +91 -3
  41. package/dist/process-registry.d.ts +8 -2
  42. package/dist/process-registry.js +28 -13
  43. package/dist/ps-slash.js +22 -12
  44. package/dist/read.js +10 -3
  45. package/dist/replace.d.ts +4 -0
  46. package/dist/replace.js +104 -7
  47. package/dist/search.d.ts +6 -0
  48. package/dist/search.js +47 -26
  49. package/dist/session-kanban.js +3 -1
  50. package/dist/skill.d.ts +6 -0
  51. package/dist/skill.js +9 -10
  52. package/dist/task.js +81 -2
  53. package/dist/test.js +28 -13
  54. package/dist/todo.js +79 -2
  55. package/dist/tool-icons.js +4 -2
  56. package/dist/tool-summary.d.ts +1 -1
  57. package/dist/tool-summary.js +76 -1
  58. package/dist/tool-tier.js +1294 -726
  59. package/dist/tree.js +9 -10
  60. package/dist/typecheck.d.ts +0 -2
  61. package/dist/typecheck.js +98 -31
  62. package/dist/write.js +58 -10
  63. package/package.json +4 -4
@@ -60,13 +60,15 @@ var TOOL_ICON_MAP = {
60
60
  replace: "edit",
61
61
  str_replace: "edit",
62
62
  multi_edit: "edit",
63
- patch: "diff",
63
+ // Matches patchTool's own `icon: 'edit'` (tool-icon-map.ts agrees).
64
+ patch: "edit",
64
65
  // ── search ──
65
66
  grep: "search",
66
67
  search: "search",
67
68
  rg: "search",
68
69
  ripgrep: "search",
69
- glob: "search",
70
+ // Matches globTool's own `icon: 'folder'` (tool-icon-map.ts agrees).
71
+ glob: "folder",
70
72
  find: "search",
71
73
  // ── navigation ──
72
74
  folder: "folder",
@@ -1,5 +1,5 @@
1
1
  /** Head-field lookup order for the generic fallback. */
2
- export declare const FALLBACK_HEAD_FIELDS: readonly ['path', 'file_path', 'pattern', 'command', 'cmd', 'url', 'query', 'description', 'content'];
2
+ export declare const FALLBACK_HEAD_FIELDS: readonly ['path', 'file_path', 'pattern', 'symbol', 'command', 'cmd', 'url', 'query', 'description', 'content'];
3
3
  /**
4
4
  * One-line, tool-aware summary of a tool call's input.
5
5
  *
@@ -3,6 +3,7 @@ var FALLBACK_HEAD_FIELDS = [
3
3
  "path",
4
4
  "file_path",
5
5
  "pattern",
6
+ "symbol",
6
7
  "command",
7
8
  "cmd",
8
9
  "url",
@@ -71,6 +72,11 @@ function summarizeToolInput(toolName, input) {
71
72
  return `${list.length} sub-tool${list.length === 1 ? "" : "s"}${preview ? ` \xB7 ${preview}${more}` : ""}`;
72
73
  }
73
74
  }
75
+ if (name === "patch" && typeof obj.patch === "string" && obj.patch) {
76
+ const fileCount = (obj.patch.match(/^\+\+\+ /gm) ?? []).length;
77
+ if (fileCount > 0) return `patch \xB7 ${fileCount} file${fileCount === 1 ? "" : "s"}`;
78
+ return `patch \xB7 ${obj.patch.split("\n").length} lines`;
79
+ }
74
80
  if (/^(edit|str_replace|edit_file|patch)$/.test(name)) {
75
81
  const fp = pickPath(obj);
76
82
  const oldS = typeof obj.old_string === "string" ? obj.old_string : "";
@@ -107,6 +113,40 @@ function summarizeToolInput(toolName, input) {
107
113
  const p = obj.pattern ?? obj.glob;
108
114
  if (typeof p === "string") return `glob ${clip(p, 80)}`;
109
115
  }
116
+ if (/^tree$/.test(name)) {
117
+ const p = typeof obj.path === "string" ? obj.path : "";
118
+ const d = typeof obj.depth === "number" ? obj.depth : null;
119
+ return `tree ${p || "."}${d !== null ? ` (depth ${d})` : ""}`;
120
+ }
121
+ if (/^diff$/.test(name)) {
122
+ const a = typeof obj.a === "string" ? obj.a : "";
123
+ const b = typeof obj.b === "string" ? obj.b : "";
124
+ if (a || b) return `diff ${a && b ? `${a}..${b}` : a || b}`;
125
+ const fl = [];
126
+ if (Array.isArray(obj.files)) {
127
+ for (const f of obj.files) if (typeof f === "string") fl.push(f);
128
+ } else if (typeof obj.files === "string") {
129
+ for (const part of obj.files.split(",")) {
130
+ const t = part.trim();
131
+ if (t) fl.push(t);
132
+ }
133
+ }
134
+ if (fl.length === 1) return `diff ${clip(String(fl[0]), 80)}`;
135
+ if (fl.length > 1) return `diff ${fl.length} files`;
136
+ }
137
+ if (/^replace$/.test(name)) {
138
+ const pattern = typeof obj.pattern === "string" ? obj.pattern : "";
139
+ if (pattern) {
140
+ let scope = "";
141
+ if (typeof obj.files === "string") {
142
+ const parts = obj.files.split(",").map((s) => s.trim()).filter(Boolean);
143
+ scope = parts.length > 1 ? `${parts.length} files` : parts[0] ?? "";
144
+ } else if (Array.isArray(obj.files) && obj.files.length > 0) {
145
+ scope = obj.files.length === 1 ? String(obj.files[0]) : `${obj.files.length} files`;
146
+ }
147
+ return `replace ${clip(pattern, 60)}${scope ? ` in ${clip(scope, 50)}` : ""}`;
148
+ }
149
+ }
110
150
  if (/^(read|read_file|cat|view)$/.test(name)) {
111
151
  const fp = pickPath(obj);
112
152
  const offset = obj.offset;
@@ -158,6 +198,12 @@ var SUMMARIZE_TOOL_INPUT_BROWSER_SRC = [
158
198
  " }",
159
199
  " }",
160
200
  " var fp;",
201
+ ' if(n==="patch" && typeof obj.patch==="string" && obj.patch){',
202
+ " var pfm=obj.patch.match(/^\\+\\+\\+ /gm);",
203
+ " var pfc=pfm?pfm.length:0;",
204
+ ' if(pfc>0) return "patch \\u00b7 "+pfc+" file"+(pfc===1?"":"s");',
205
+ ' return "patch \\u00b7 "+obj.patch.split("\\n").length+" lines";',
206
+ " }",
161
207
  " if(/^(edit|str_replace|edit_file|patch)$/.test(n)){",
162
208
  " fp=(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:obj.filepath));",
163
209
  ' var oldS=typeof obj.old_string==="string"?obj.old_string:"";',
@@ -188,6 +234,35 @@ var SUMMARIZE_TOOL_INPUT_BROWSER_SRC = [
188
234
  " var gp=(obj.pattern!=null?obj.pattern:obj.glob);",
189
235
  ' if(typeof gp==="string") return "glob "+__clip(gp,80);',
190
236
  " }",
237
+ " if(/^tree$/.test(n)){",
238
+ ' var trp=typeof obj.path==="string"?obj.path:"";',
239
+ ' var trd=typeof obj.depth==="number"?obj.depth:null;',
240
+ ' return "tree "+(trp||".")+(trd!==null?(" (depth "+trd+")"):"");',
241
+ " }",
242
+ " if(/^diff$/.test(n)){",
243
+ ' var da=typeof obj.a==="string"?obj.a:"", db=typeof obj.b==="string"?obj.b:"";',
244
+ ' if(da||db) return "diff "+((da&&db)?(da+".."+db):(da||db));',
245
+ " var dfl=[], dfi, dpi;",
246
+ ' if(Array.isArray(obj.files)){ for(dfi=0; dfi<obj.files.length; dfi++){ if(typeof obj.files[dfi]==="string") dfl.push(obj.files[dfi]); } }',
247
+ ' else if(typeof obj.files==="string"){ var dparts=obj.files.split(","); for(dpi=0; dpi<dparts.length; dpi++){ var dt=dparts[dpi].trim(); if(dt) dfl.push(dt); } }',
248
+ ' if(dfl.length===1) return "diff "+__clip(String(dfl[0]),80);',
249
+ ' if(dfl.length>1) return "diff "+dfl.length+" files";',
250
+ " }",
251
+ " if(/^replace$/.test(n)){",
252
+ ' var rpat=typeof obj.pattern==="string"?obj.pattern:"";',
253
+ " if(rpat){",
254
+ ' var rscope="";',
255
+ ' if(typeof obj.files==="string"){',
256
+ " var rparts=[], rsi;",
257
+ ' var rraw=obj.files.split(",");',
258
+ " for(rsi=0; rsi<rraw.length; rsi++){ var rt=rraw[rsi].trim(); if(rt) rparts.push(rt); }",
259
+ ' rscope=rparts.length>1?(rparts.length+" files"):(rparts.length===1?rparts[0]:"");',
260
+ " } else if(Array.isArray(obj.files) && obj.files.length>0){",
261
+ ' rscope=obj.files.length===1?String(obj.files[0]):(obj.files.length+" files");',
262
+ " }",
263
+ ' return "replace "+__clip(rpat,60)+(rscope?(" in "+__clip(rscope,50)):"");',
264
+ " }",
265
+ " }",
191
266
  " if(/^(read|read_file|cat|view)$/.test(n)){",
192
267
  " fp=(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:obj.filepath));",
193
268
  ' if(typeof fp==="string" && fp){',
@@ -196,7 +271,7 @@ var SUMMARIZE_TOOL_INPUT_BROWSER_SRC = [
196
271
  ' return "read "+fp;',
197
272
  " }",
198
273
  " }",
199
- ' var HEAD=["path","file_path","pattern","command","cmd","url","query","description","content"], hi;',
274
+ ' var HEAD=["path","file_path","pattern","symbol","command","cmd","url","query","description","content"], hi;',
200
275
  ' for(hi=0; hi<HEAD.length; hi++){ var hv=obj[HEAD[hi]]; if(typeof hv==="string" && hv.length>0){ return HEAD[hi]+": "+__clip(hv,100); } }',
201
276
  " var jsonStr; try{ jsonStr=JSON.stringify(raw); }catch(_e2){ jsonStr=String(raw); }",
202
277
  " return __clip(jsonStr,120);",