@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/_regex.d.ts CHANGED
@@ -1,39 +1,11 @@
1
1
  /**
2
2
  * Compile a user-supplied regex with conservative bounds against ReDoS.
3
3
  *
4
- * Node's regex engine (V8) is backtracking-based and cannot interrupt a
5
- * synchronous match a pattern like `(a+)+$` against a sufficiently long
6
- * line will pin a worker for seconds. The executor's outer `timeoutMs` only
7
- * fires between async boundaries, so a long regex eval inside a sync loop
8
- * is uninterruptible.
9
- *
10
- * We can't fully prevent ReDoS without an alternative engine (re2-wasm), but
11
- * we can sharply limit the blast radius:
12
- *
13
- * 1. Cap pattern length — practically all legitimate user patterns are
14
- * under 256 characters. A 4 KB pattern is almost certainly malicious
15
- * or a copy-paste accident.
16
- * 2. Reject patterns containing the most obvious super-linear structures.
17
- * This is a coarse filter (false-positives are likely; we accept that
18
- * for hostile-input contexts).
19
- *
20
- * Callers should additionally bound the *subject* length (e.g. by capping
21
- * line size before matching).
22
- */
23
- export interface CompileResult {
24
- ok: true;
25
- regex: RegExp;
26
- }
27
- export interface CompileFail {
28
- ok: false;
29
- reason: string;
30
- }
31
- export declare function compileUserRegex(pattern: string, flags: string): CompileResult | CompileFail;
32
- /**
33
- * Truncate a subject line to a safe length for synchronous regex eval.
34
- * The cap is conservative; tools that need exact-line matching against very
35
- * long lines should use ripgrep externally rather than the native walker.
4
+ * Canonical home since card #5: `@wrongstack/primitives/src/regex-guard.ts`.
5
+ * This module is now a re-export shim kept for its four importers
6
+ * (grep.ts, json.ts, logs.ts, replace.ts); `tools/tests/regex-guard-parity.test.ts`
7
+ * still pins the three historical entry points to identical verdicts
8
+ * now trivially true, because all three resolve to the same code path.
36
9
  */
37
- export declare const MAX_SUBJECT_LEN: number;
38
- export declare function capSubject(line: string): string;
10
+ export { type CompileFail, type CompileResult, capSubject, compileUserRegex, MAX_SUBJECT_LEN, } from '@wrongstack/primitives';
39
11
  //# sourceMappingURL=_regex.d.ts.map
package/dist/audit.js CHANGED
@@ -138,12 +138,12 @@ function resolveWin32Command(cmd) {
138
138
  }
139
139
  return cmd;
140
140
  }
141
- var WIN32_SHELL_META = /[&|<>"\r\n\0]/;
141
+ var WIN32_SHELL_META = /[&|<>"%\r\n\0]/;
142
142
  function assertSafeWin32ShellArgs(args) {
143
143
  for (const arg of args) {
144
144
  if (typeof arg === "string" && WIN32_SHELL_META.test(arg)) {
145
145
  throw new Error(
146
- '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)
146
+ '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)
147
147
  );
148
148
  }
149
149
  }
@@ -374,7 +374,7 @@ var SENSITIVE_FLAG_PATTERNS = [
374
374
  // redaction function. Synced with core copy.
375
375
  /(?<![-\w])-(?:password|p|a)(?:[=\s]+)?[^\s,-]+/gi,
376
376
  // env var–style secrets: TOKEN=x, API_KEY=y, etc.
377
- /(?:TOKEN|API_KEY|API_SECRET|AUTH_TOKEN|GITHUB_TOKEN|GH_TOKEN|BEARER|JWT|OAUTH|CREDENTIAL|SECRET|PRIVATE_KEY|PASSWORD|PASSWD)\s*[=:]\s*[^\s,]+/gi,
377
+ /(?: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,
378
378
  // Generic high-entropy look: base64 strings >32 chars or hex strings >32 digits — but only
379
379
  // when preceded by a flag name (e.g. --github-token=EyJ...). Global flag so
380
380
  // every such flag in the command line is redacted, not just the first.
package/dist/bash.js CHANGED
@@ -405,7 +405,7 @@ var SENSITIVE_FLAG_PATTERNS = [
405
405
  // redaction function. Synced with core copy.
406
406
  /(?<![-\w])-(?:password|p|a)(?:[=\s]+)?[^\s,-]+/gi,
407
407
  // env var–style secrets: TOKEN=x, API_KEY=y, etc.
408
- /(?:TOKEN|API_KEY|API_SECRET|AUTH_TOKEN|GITHUB_TOKEN|GH_TOKEN|BEARER|JWT|OAUTH|CREDENTIAL|SECRET|PRIVATE_KEY|PASSWORD|PASSWD)\s*[=:]\s*[^\s,]+/gi,
408
+ /(?: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,
409
409
  // Generic high-entropy look: base64 strings >32 chars or hex strings >32 digits — but only
410
410
  // when preceded by a flag name (e.g. --github-token=EyJ...). Global flag so
411
411
  // every such flag in the command line is redacted, not just the first.
@@ -1826,10 +1826,10 @@ function resolvePowerShell(cmd) {
1826
1826
  if (lower !== "pwsh" && lower !== "powershell" && lower !== "pwsh.exe" && lower !== "powershell.exe") {
1827
1827
  return resolveWin32Command(cmd);
1828
1828
  }
1829
- const primary = lower.startsWith("pwsh") ? "pwsh.exe" : "powershell.exe";
1830
- const fallback = lower.startsWith("pwsh") ? "powershell.exe" : "pwsh.exe";
1829
+ const primary = lower.startsWith("pwsh") ? "pwsh" : "powershell";
1830
+ const fallback = lower.startsWith("pwsh") ? "powershell" : "pwsh";
1831
1831
  const resolved = resolveWin32Command(primary);
1832
- if (resolved !== primary) {
1832
+ if (resolved === primary) {
1833
1833
  const fb = resolveWin32Command(fallback);
1834
1834
  return fb === fallback ? cmd : fb;
1835
1835
  }