@wrongstack/tools 0.305.1 → 0.306.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 (61) 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 +1279 -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/diff.d.ts +5 -0
  12. package/dist/diff.js +78 -12
  13. package/dist/document.js +18 -6
  14. package/dist/edit.js +69 -16
  15. package/dist/exec.js +44 -22
  16. package/dist/fetch.js +13 -1
  17. package/dist/format.d.ts +4 -2
  18. package/dist/format.js +81 -31
  19. package/dist/glob.js +12 -4
  20. package/dist/grep.d.ts +2 -0
  21. package/dist/grep.js +15 -4
  22. package/dist/index.js +1342 -761
  23. package/dist/install.js +96 -37
  24. package/dist/kanban-tool-types.d.ts +6 -1
  25. package/dist/kanban.js +60 -0
  26. package/dist/languages/index.js +28 -13
  27. package/dist/lint.js +28 -13
  28. package/dist/logs.d.ts +0 -1
  29. package/dist/logs.js +44 -13
  30. package/dist/memory.d.ts +8 -0
  31. package/dist/memory.js +23 -3
  32. package/dist/mode.d.ts +1 -1
  33. package/dist/mode.js +3 -0
  34. package/dist/next-steps.d.ts +2 -3
  35. package/dist/next-steps.js +3 -3
  36. package/dist/outdated.d.ts +0 -3
  37. package/dist/outdated.js +89 -48
  38. package/dist/pack.js +1279 -726
  39. package/dist/plan.js +76 -3
  40. package/dist/process-registry.d.ts +8 -2
  41. package/dist/process-registry.js +28 -13
  42. package/dist/ps-slash.js +22 -12
  43. package/dist/read.js +10 -3
  44. package/dist/replace.d.ts +4 -0
  45. package/dist/replace.js +104 -7
  46. package/dist/search.d.ts +6 -0
  47. package/dist/search.js +47 -26
  48. package/dist/skill.d.ts +6 -0
  49. package/dist/skill.js +9 -10
  50. package/dist/task.js +66 -2
  51. package/dist/test.js +28 -13
  52. package/dist/todo.js +64 -2
  53. package/dist/tool-icons.js +4 -2
  54. package/dist/tool-summary.d.ts +1 -1
  55. package/dist/tool-summary.js +76 -1
  56. package/dist/tool-tier.js +1279 -726
  57. package/dist/tree.js +9 -10
  58. package/dist/typecheck.d.ts +0 -2
  59. package/dist/typecheck.js +98 -31
  60. package/dist/write.js +58 -10
  61. package/package.json +4 -4
package/dist/glob.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import * as fs2 from "node:fs/promises";
3
3
  import * as path3 from "node:path";
4
4
  import { compileGlob as compileGlob2, DEFAULT_WALK_IGNORE_DIRS } from "@wrongstack/core/utils";
5
+ import { ToolValidationError } from "@wrongstack/core/types";
5
6
 
6
7
  // src/_concurrency.ts
7
8
  async function mapWithConcurrency(items, limit, fn) {
@@ -143,7 +144,7 @@ var WALK_CONCURRENCY = 16;
143
144
  var globTool = {
144
145
  name: "glob",
145
146
  category: "Filesystem",
146
- description: "Find files by path pattern. Use index-backed `codebase-search` first for code symbols or concepts when it is live.",
147
+ description: "Find files by path pattern. Results are sorted by modification time, newest first, so when the list is truncated at `limit` it is the oldest files that are dropped (recency-biased). Use index-backed `codebase-search` first for code symbols or concepts when it is live.",
147
148
  usageHint: "PATH DISCOVERY AND SEARCH SCOPING:\n\n- When `codebase-search` is live, use it first for code concepts; use `glob` for filenames, path patterns, and non-indexed files.\n- Combine with `path` and `limit`.\n- Default ignores common build/dependency directories.\nMuch more efficient than shell `find` for most use cases inside the agent.",
148
149
  selection: {
149
150
  doNotUseWhen: "you need to search inside file contents.",
@@ -154,7 +155,7 @@ var globTool = {
154
155
  capabilities: ["fs.read"],
155
156
  icon: "folder",
156
157
  maxOutputBytes: 65536,
157
- timeoutMs: 5e3,
158
+ timeoutMs: 15e3,
158
159
  inputSchema: {
159
160
  type: "object",
160
161
  properties: {
@@ -168,13 +169,20 @@ var globTool = {
168
169
  },
169
170
  limit: {
170
171
  type: "integer",
171
- description: "Maximum number of results to return (default 1000, max 5000)."
172
+ minimum: 1,
173
+ maximum: 5e3,
174
+ description: "Maximum number of results to return (default 1000, max 5000). Results are sorted by mtime descending, so truncation keeps the most recently modified files."
172
175
  }
173
176
  },
174
177
  required: ["pattern"]
175
178
  },
176
179
  async execute(input, ctx, opts) {
177
- if (!input?.pattern) throw new Error("glob: pattern is required");
180
+ if (!input?.pattern) {
181
+ throw new ToolValidationError({
182
+ message: "glob: pattern is required",
183
+ field: "pattern"
184
+ });
185
+ }
178
186
  const signal = opts?.signal;
179
187
  const base = input.path ? await safeResolveReal(input.path, ctx) : ctx.cwd;
180
188
  const limit = Math.max(1, Math.min(input.limit ?? 1e3, 5e3));
package/dist/grep.d.ts CHANGED
@@ -15,5 +15,7 @@ interface GrepOutput {
15
15
  used: 'rg' | 'native';
16
16
  }
17
17
  export declare const grepTool: Tool<GrepInput, GrepOutput>;
18
+ /** Test-only: forget the cached rg availability so mocks can vary per test. */
19
+ export declare function __resetRgDetectionForTests(): void;
18
20
  export {};
19
21
  //# sourceMappingURL=grep.d.ts.map
package/dist/grep.js CHANGED
@@ -358,7 +358,7 @@ var grepTool = {
358
358
  field: "pattern"
359
359
  });
360
360
  }
361
- const rgAvailable = await detectRg(opts.signal);
361
+ const rgAvailable = await detectRg();
362
362
  if (rgAvailable) {
363
363
  try {
364
364
  yield* runRgStream(input, base, mode, limit, opts.signal);
@@ -371,16 +371,26 @@ var grepTool = {
371
371
  yield { type: "final", output: out };
372
372
  }
373
373
  };
374
- async function detectRg(signal) {
375
- return new Promise((resolve2) => {
374
+ var rgAvailabilityCache;
375
+ function __resetRgDetectionForTests() {
376
+ rgAvailabilityCache = void 0;
377
+ }
378
+ function detectRg() {
379
+ rgAvailabilityCache ??= new Promise((resolve2) => {
376
380
  try {
377
- const p = spawn("rg", ["--version"], { env: buildChildEnv(), stdio: "ignore", signal, windowsHide: true });
381
+ const p = spawn("rg", ["--version"], {
382
+ env: buildChildEnv(),
383
+ stdio: "ignore",
384
+ signal: AbortSignal.timeout(1e4),
385
+ windowsHide: true
386
+ });
378
387
  p.on("error", () => resolve2(false));
379
388
  p.on("close", (code) => resolve2(code === 0));
380
389
  } catch {
381
390
  resolve2(false);
382
391
  }
383
392
  });
393
+ return rgAvailabilityCache;
384
394
  }
385
395
  async function* runRgStream(input, base, mode, limit, signal) {
386
396
  const args = ["--no-heading"];
@@ -701,6 +711,7 @@ async function runNative(input, base, mode, limit, signal) {
701
711
  };
702
712
  }
703
713
  export {
714
+ __resetRgDetectionForTests,
704
715
  grepTool
705
716
  };
706
717
  //# sourceMappingURL=grep.js.map