@wrongstack/tools 0.309.1 → 0.310.1

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 (58) hide show
  1. package/dist/_regex.d.ts +6 -34
  2. package/dist/bash.js +3 -3
  3. package/dist/builtin.d.ts +17 -14
  4. package/dist/builtin.js +3028 -1675
  5. package/dist/codebase-index/binary-frame.d.ts +57 -8
  6. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +6 -0
  7. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +6 -0
  8. package/dist/codebase-index/codebase-search-tool.d.ts +15 -5
  9. package/dist/codebase-index/index-service.d.ts +3 -19
  10. package/dist/codebase-index/index.js +2735 -1415
  11. package/dist/codebase-index/indexer.d.ts +3 -0
  12. package/dist/codebase-index/parser-batch.d.ts +53 -0
  13. package/dist/codebase-index/parser-dispatch.d.ts +32 -0
  14. package/dist/codebase-index/parser-output.d.ts +14 -0
  15. package/dist/codebase-index/parser-worker-pool.d.ts +57 -4
  16. package/dist/codebase-index/parser-worker-script.d.ts +5 -2
  17. package/dist/codebase-index/parser-worker-script.js +4042 -0
  18. package/dist/codebase-index/project-server-cache.d.ts +16 -0
  19. package/dist/codebase-index/project-server-client.d.ts +2 -2
  20. package/dist/codebase-index/project-server-query-cache.d.ts +88 -0
  21. package/dist/codebase-index/project-server.js +2846 -1308
  22. package/dist/codebase-index/py-parser.d.ts +5 -0
  23. package/dist/codebase-index/schema.d.ts +14 -1
  24. package/dist/codebase-index/sqlite-runtime.d.ts +2 -2
  25. package/dist/codebase-index/tree-sitter/queries.d.ts +30 -3
  26. package/dist/codebase-index/tree-sitter/visitor.d.ts +2 -1
  27. package/dist/codebase-index/vector-search.d.ts +12 -0
  28. package/dist/codebase-index/wal-maintenance.d.ts +58 -0
  29. package/dist/codebase-index/worker-protocol/contracts.d.ts +44 -0
  30. package/dist/codebase-index/worker-protocol.d.ts +17 -1
  31. package/dist/codebase-index/worker.js +2300 -1020
  32. package/dist/codebase-index/writer-admin.d.ts +11 -0
  33. package/dist/codebase-index/writer-helpers.d.ts +31 -1
  34. package/dist/codebase-index/writer-mutations.d.ts +0 -6
  35. package/dist/codebase-index/writer-schema.d.ts +2 -2
  36. package/dist/codebase-index/writer.d.ts +15 -0
  37. package/dist/edit.js +2511 -1203
  38. package/dist/exec.js +5 -3
  39. package/dist/grep.js +5 -124
  40. package/dist/index.js +3028 -1738
  41. package/dist/json.js +5 -124
  42. package/dist/kanban.js +130 -0
  43. package/dist/logs.js +5 -121
  44. package/dist/pack.js +3028 -1675
  45. package/dist/patch.js +2524 -1216
  46. package/dist/plan.js +106 -0
  47. package/dist/read.js +2506 -1198
  48. package/dist/replace.js +2487 -1295
  49. package/dist/search.js +6 -2
  50. package/dist/session-kanban.js +24 -16
  51. package/dist/task.js +106 -0
  52. package/dist/todo.js +106 -0
  53. package/dist/tool-tier.d.ts +11 -0
  54. package/dist/tool-tier.js +3040 -1679
  55. package/dist/tree.js +14 -3
  56. package/dist/win32.js +3 -3
  57. package/dist/write.js +2513 -1205
  58. package/package.json +5 -4
package/dist/tree.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/tree.ts
2
2
  import * as fs from "node:fs/promises";
3
3
  import * as path2 from "node:path";
4
- import { DEFAULT_WALK_IGNORE_DIRS, expectDefined } from "@wrongstack/core/utils";
4
+ import { DEFAULT_WALK_IGNORE_DIRS, compileGlob, expectDefined } from "@wrongstack/core/utils";
5
5
 
6
6
  // src/_util.ts
7
7
  import * as fsp from "node:fs/promises";
@@ -143,7 +143,7 @@ var treeTool = {
143
143
  const showDirs = input.show_dirs ?? true;
144
144
  const showHidden = input.show_hidden ?? false;
145
145
  const exclude = /* @__PURE__ */ new Set([...DEFAULT_IGNORE, ...input.exclude ?? []]);
146
- const filterGlob = input.glob;
146
+ const globRe = input.glob ? compileGlob(input.glob) : void 0;
147
147
  const maxEntries = input.max_entries ?? DEFAULT_MAX_ENTRIES;
148
148
  const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
149
149
  const lines = [basePath];
@@ -175,7 +175,8 @@ var treeTool = {
175
175
  showFiles,
176
176
  showDirs,
177
177
  showHidden,
178
- filterGlob,
178
+ globRe,
179
+ basePath,
179
180
  lines,
180
181
  prefix: "",
181
182
  isLast: true,
@@ -222,6 +223,12 @@ var treeTool = {
222
223
  };
223
224
  }
224
225
  };
226
+ function matchesTreeGlob(globRe, fileName, absPath, basePath) {
227
+ if (globRe.test(fileName)) return true;
228
+ const rel = path2.relative(basePath, absPath);
229
+ const posixRel = !rel || rel.startsWith("..") || path2.isAbsolute(rel) ? absPath.split(path2.sep).join("/") : rel.split(path2.sep).join("/");
230
+ return globRe.test(posixRel);
231
+ }
225
232
  async function walkDir(dir, depth, opts) {
226
233
  opts.signal.throwIfAborted();
227
234
  if (opts.retention.truncated) return;
@@ -229,6 +236,10 @@ async function walkDir(dir, depth, opts) {
229
236
  const filtered = entries.filter((e) => {
230
237
  if (!opts.showHidden && e.name.startsWith(".")) return false;
231
238
  if (opts.exclude.has(e.name)) return false;
239
+ if (e.isFile() && opts.globRe) {
240
+ const abs = path2.join(dir, e.name);
241
+ if (!matchesTreeGlob(opts.globRe, e.name, abs, opts.basePath)) return false;
242
+ }
232
243
  return true;
233
244
  });
234
245
  let dirCount = 0;
package/dist/win32.js CHANGED
@@ -27,10 +27,10 @@ function resolvePowerShell(cmd) {
27
27
  if (lower !== "pwsh" && lower !== "powershell" && lower !== "pwsh.exe" && lower !== "powershell.exe") {
28
28
  return resolveWin32Command(cmd);
29
29
  }
30
- const primary = lower.startsWith("pwsh") ? "pwsh.exe" : "powershell.exe";
31
- const fallback = lower.startsWith("pwsh") ? "powershell.exe" : "pwsh.exe";
30
+ const primary = lower.startsWith("pwsh") ? "pwsh" : "powershell";
31
+ const fallback = lower.startsWith("pwsh") ? "powershell" : "pwsh";
32
32
  const resolved = resolveWin32Command(primary);
33
- if (resolved !== primary) {
33
+ if (resolved === primary) {
34
34
  const fb = resolveWin32Command(fallback);
35
35
  return fb === fallback ? cmd : fb;
36
36
  }