@wrongstack/tools 0.306.3 → 0.307.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 (76) hide show
  1. package/dist/audit.js +50 -9
  2. package/dist/auto-proceed-loop-guard.js +8 -2
  3. package/dist/bash.js +57 -22
  4. package/dist/builtin.d.ts +6 -6
  5. package/dist/builtin.js +11315 -9317
  6. package/dist/clarify.d.ts +32 -0
  7. package/dist/codebase-index/ast-invariant-engine.d.ts +102 -0
  8. package/dist/codebase-index/ast-symbol-mutator.d.ts +28 -0
  9. package/dist/codebase-index/background-indexer.d.ts +9 -0
  10. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +31 -0
  11. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +40 -0
  12. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +23 -0
  13. package/dist/codebase-index/codebase-repo-map-tool.d.ts +22 -0
  14. package/dist/codebase-index/codebase-skeleton-tool.d.ts +36 -0
  15. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +30 -0
  16. package/dist/codebase-index/index.d.ts +11 -1
  17. package/dist/codebase-index/index.js +4141 -1479
  18. package/dist/codebase-index/project-server-client-state.d.ts +79 -0
  19. package/dist/codebase-index/project-server-client.d.ts +3 -71
  20. package/dist/codebase-index/project-server-protocol.d.ts +1 -0
  21. package/dist/codebase-index/project-server.js +751 -909
  22. package/dist/codebase-index/repo-map.d.ts +20 -0
  23. package/dist/codebase-index/skeleton-extractor.d.ts +64 -0
  24. package/dist/codebase-index/tree-sitter-parser.d.ts +11 -0
  25. package/dist/codebase-index/worker.js +723 -891
  26. package/dist/codebase-index/writer-mutations.d.ts +26 -0
  27. package/dist/codebase-index/writer-refs.d.ts +50 -0
  28. package/dist/codebase-index/writer-search.d.ts +30 -0
  29. package/dist/codebase-index/writer.d.ts +2 -320
  30. package/dist/diff.js +3 -2
  31. package/dist/document.js +37 -2
  32. package/dist/e2e.js +3 -2
  33. package/dist/edit.js +8558 -348
  34. package/dist/exec.js +76 -22
  35. package/dist/fetch.js +11 -9
  36. package/dist/format.js +50 -9
  37. package/dist/glob.js +8 -3
  38. package/dist/grep.js +22 -10
  39. package/dist/index.d.ts +3 -1
  40. package/dist/index.js +11411 -9440
  41. package/dist/install.js +50 -9
  42. package/dist/json.js +91 -17
  43. package/dist/kanban-board-actions.d.ts +4 -0
  44. package/dist/kanban-lifecycle-actions.d.ts +4 -0
  45. package/dist/kanban-serializer.d.ts +21 -0
  46. package/dist/kanban.js +985 -1034
  47. package/dist/languages/index.js +17 -10
  48. package/dist/lint.js +50 -9
  49. package/dist/logs.js +17 -6
  50. package/dist/next-steps.d.ts +8 -0
  51. package/dist/next-steps.js +18 -0
  52. package/dist/outdated.js +18 -11
  53. package/dist/pack.js +11308 -9317
  54. package/dist/patch.js +8301 -77
  55. package/dist/plan.js +1231 -1281
  56. package/dist/process-registry.js +14 -8
  57. package/dist/ps-slash.js +65 -30
  58. package/dist/read.js +754 -912
  59. package/dist/replace.js +8456 -195
  60. package/dist/scaffold.js +36 -1
  61. package/dist/search.js +21 -15
  62. package/dist/security-ast-scan-tool.d.ts +43 -0
  63. package/dist/session-kanban-graph.d.ts +9 -0
  64. package/dist/session-kanban-sync.d.ts +31 -0
  65. package/dist/session-kanban.d.ts +5 -141
  66. package/dist/session-kanban.js +367 -360
  67. package/dist/task.js +1157 -1207
  68. package/dist/test.js +50 -9
  69. package/dist/todo.js +2187 -2237
  70. package/dist/tool-diff.js +6 -1
  71. package/dist/tool-summary.js +4 -2
  72. package/dist/tool-tier.js +11315 -9317
  73. package/dist/tree.js +36 -1
  74. package/dist/typecheck.js +51 -10
  75. package/dist/write.js +8374 -152
  76. package/package.json +7 -7
package/dist/test.js CHANGED
@@ -425,13 +425,16 @@ function killWin32Tree(pid, opts = {}) {
425
425
  };
426
426
  child.on("error", settle);
427
427
  child.on("close", settle);
428
- timeout = setTimeout(() => {
429
- try {
430
- child.kill();
431
- } catch {
432
- }
433
- settle();
434
- }, Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS));
428
+ timeout = setTimeout(
429
+ () => {
430
+ try {
431
+ child.kill();
432
+ } catch {
433
+ }
434
+ settle();
435
+ },
436
+ Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS)
437
+ );
435
438
  timeout.unref?.();
436
439
  child.unref();
437
440
  return true;
@@ -605,7 +608,10 @@ var ProcessRegistryImpl = class {
605
608
  getBreakerCountdown() {
606
609
  if (this.autoKillArmedAt === null || this.autoKillResetMs <= 0) return null;
607
610
  const elapsed = Date.now() - this.autoKillArmedAt;
608
- return { remainingMs: Math.max(0, this.autoKillResetMs - elapsed), totalMs: this.autoKillResetMs };
611
+ return {
612
+ remainingMs: Math.max(0, this.autoKillResetMs - elapsed),
613
+ totalMs: this.autoKillResetMs
614
+ };
609
615
  }
610
616
  /**
611
617
  * Subscribe to countdown arm/cancel events. Returns an unsubscribe function.
@@ -1044,6 +1050,7 @@ function utf8Prefix(text, maxBytes) {
1044
1050
  }
1045
1051
 
1046
1052
  // src/_util.ts
1053
+ import * as fsp2 from "node:fs/promises";
1047
1054
  import * as path3 from "node:path";
1048
1055
  import * as Core from "@wrongstack/core/utils";
1049
1056
  function resolvePath(input, ctx) {
@@ -1067,6 +1074,40 @@ function ensureInsideRoot(absPath, ctx) {
1067
1074
  function safeResolve(input, ctx) {
1068
1075
  return ensureInsideRoot(resolvePath(input, ctx), ctx);
1069
1076
  }
1077
+ async function resolveRealInsideRoot(absPath, ctx) {
1078
+ if (ctx.allowOutsideProjectRoot) return absPath;
1079
+ const realRoots = await Promise.all(
1080
+ allowedRoots(ctx).map((r) => fsp2.realpath(r).catch(() => path3.resolve(r)))
1081
+ );
1082
+ let probe = absPath;
1083
+ const pendingTail = [];
1084
+ for (; ; ) {
1085
+ let real;
1086
+ try {
1087
+ real = await fsp2.realpath(probe);
1088
+ } catch (err) {
1089
+ if (err.code === "ENOENT") {
1090
+ const parent = path3.dirname(probe);
1091
+ if (parent === probe) return absPath;
1092
+ pendingTail.unshift(path3.basename(probe));
1093
+ probe = parent;
1094
+ continue;
1095
+ }
1096
+ throw err;
1097
+ }
1098
+ const candidate = pendingTail.length > 0 ? path3.join(real, ...pendingTail) : real;
1099
+ if (isInsideAny(candidate, realRoots)) {
1100
+ return candidate;
1101
+ }
1102
+ throw new Error(
1103
+ `Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
1104
+ );
1105
+ }
1106
+ }
1107
+ async function safeResolveReal(input, ctx) {
1108
+ const abs = safeResolve(input, ctx);
1109
+ return await resolveRealInsideRoot(abs, ctx);
1110
+ }
1070
1111
  var COMMAND_OUTPUT_MAX_BYTES = 32768;
1071
1112
  var REPEAT_RUN_THRESHOLD = 3;
1072
1113
  function collapseCarriageReturns(text) {
@@ -3594,7 +3635,7 @@ var testTool = {
3594
3635
  return final;
3595
3636
  },
3596
3637
  async *executeStream(input, ctx, opts) {
3597
- const cwd = input.cwd ? safeResolve(input.cwd, ctx) : ctx.cwd;
3638
+ const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
3598
3639
  const runner = input.runner ?? "auto";
3599
3640
  if (runner === "auto") {
3600
3641
  const bridge = await tryLegacyCodeOperation("test", {