@wrongstack/tools 0.309.0 → 0.310.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 (67) hide show
  1. package/dist/_regex.d.ts +6 -34
  2. package/dist/audit.js +3 -3
  3. package/dist/bash.js +4 -4
  4. package/dist/builtin.js +3020 -1680
  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 +2784 -1464
  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 +8 -6
  39. package/dist/format.js +3 -3
  40. package/dist/git.js +6 -0
  41. package/dist/grep.js +5 -124
  42. package/dist/index.js +3016 -1739
  43. package/dist/install.js +3 -3
  44. package/dist/json.js +5 -124
  45. package/dist/kanban.js +130 -0
  46. package/dist/languages/index.js +3 -3
  47. package/dist/lint.js +3 -3
  48. package/dist/logs.js +5 -121
  49. package/dist/outdated.js +3 -3
  50. package/dist/pack.js +3020 -1680
  51. package/dist/patch.js +2524 -1216
  52. package/dist/plan.js +106 -0
  53. package/dist/process-registry.js +1 -1
  54. package/dist/read.js +2506 -1198
  55. package/dist/replace.js +2487 -1295
  56. package/dist/search.js +6 -2
  57. package/dist/session-kanban.js +24 -16
  58. package/dist/task.js +106 -0
  59. package/dist/test.js +3 -3
  60. package/dist/todo.js +106 -0
  61. package/dist/tool-tier.d.ts +11 -0
  62. package/dist/tool-tier.js +3028 -1680
  63. package/dist/tree.js +14 -3
  64. package/dist/typecheck.js +3 -3
  65. package/dist/win32.js +5 -5
  66. package/dist/write.js +2513 -1205
  67. 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/typecheck.js CHANGED
@@ -141,12 +141,12 @@ function resolveWin32Command(cmd) {
141
141
  }
142
142
  return cmd;
143
143
  }
144
- var WIN32_SHELL_META = /[&|<>"\r\n\0]/;
144
+ var WIN32_SHELL_META = /[&|<>"%\r\n\0]/;
145
145
  function assertSafeWin32ShellArgs(args) {
146
146
  for (const arg of args) {
147
147
  if (typeof arg === "string" && WIN32_SHELL_META.test(arg)) {
148
148
  throw new Error(
149
- 'win32 cmd shim spawn: argument contains a shell metacharacter (one of & | < > ", or a newline) that could enable command injection through the .cmd/.bat wrapper - refusing to run. Offending argument: ' + JSON.stringify(arg)
149
+ 'win32 cmd shim spawn: argument contains a shell metacharacter (one of & | < > " %, or a newline) that could enable command injection through the .cmd/.bat wrapper - refusing to run. Offending argument: ' + JSON.stringify(arg)
150
150
  );
151
151
  }
152
152
  }
@@ -377,7 +377,7 @@ var SENSITIVE_FLAG_PATTERNS = [
377
377
  // redaction function. Synced with core copy.
378
378
  /(?<![-\w])-(?:password|p|a)(?:[=\s]+)?[^\s,-]+/gi,
379
379
  // env var–style secrets: TOKEN=x, API_KEY=y, etc.
380
- /(?:TOKEN|API_KEY|API_SECRET|AUTH_TOKEN|GITHUB_TOKEN|GH_TOKEN|BEARER|JWT|OAUTH|CREDENTIAL|SECRET|PRIVATE_KEY|PASSWORD|PASSWD)\s*[=:]\s*[^\s,]+/gi,
380
+ /(?:TOKEN|API_KEY|API_SECRET|AUTH_TOKEN|GITHUB_TOKEN|GH_TOKEN|BEARER|JWT|OAUTH|CREDENTIAL|SECRET|PRIVATE_KEY|PASSWORD|PASSWD|PASSPHRASE)\s*[=:]\s*[^\s,]+/gi,
381
381
  // Generic high-entropy look: base64 strings >32 chars or hex strings >32 digits — but only
382
382
  // when preceded by a flag name (e.g. --github-token=EyJ...). Global flag so
383
383
  // every such flag in the command line is redacted, not just the first.
package/dist/win32.js CHANGED
@@ -27,21 +27,21 @@ 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
  }
37
37
  return resolved;
38
38
  }
39
- var WIN32_SHELL_META = /[&|<>"\r\n\0]/;
39
+ var WIN32_SHELL_META = /[&|<>"%\r\n\0]/;
40
40
  function assertSafeWin32ShellArgs(args) {
41
41
  for (const arg of args) {
42
42
  if (typeof arg === "string" && WIN32_SHELL_META.test(arg)) {
43
43
  throw new Error(
44
- 'win32 cmd shim spawn: argument contains a shell metacharacter (one of & | < > ", or a newline) that could enable command injection through the .cmd/.bat wrapper - refusing to run. Offending argument: ' + JSON.stringify(arg)
44
+ 'win32 cmd shim spawn: argument contains a shell metacharacter (one of & | < > " %, or a newline) that could enable command injection through the .cmd/.bat wrapper - refusing to run. Offending argument: ' + JSON.stringify(arg)
45
45
  );
46
46
  }
47
47
  }