@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.
- package/dist/audit.js +50 -9
- package/dist/auto-proceed-loop-guard.js +8 -2
- package/dist/bash.js +57 -22
- package/dist/builtin.d.ts +6 -6
- package/dist/builtin.js +11315 -9317
- package/dist/clarify.d.ts +32 -0
- package/dist/codebase-index/ast-invariant-engine.d.ts +102 -0
- package/dist/codebase-index/ast-symbol-mutator.d.ts +28 -0
- package/dist/codebase-index/background-indexer.d.ts +9 -0
- package/dist/codebase-index/codebase-ast-replace-tool.d.ts +31 -0
- package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +40 -0
- package/dist/codebase-index/codebase-invariant-check-tool.d.ts +23 -0
- package/dist/codebase-index/codebase-repo-map-tool.d.ts +22 -0
- package/dist/codebase-index/codebase-skeleton-tool.d.ts +36 -0
- package/dist/codebase-index/codebase-targeted-test-tool.d.ts +30 -0
- package/dist/codebase-index/index.d.ts +11 -1
- package/dist/codebase-index/index.js +4141 -1479
- package/dist/codebase-index/project-server-client-state.d.ts +79 -0
- package/dist/codebase-index/project-server-client.d.ts +3 -71
- package/dist/codebase-index/project-server-protocol.d.ts +1 -0
- package/dist/codebase-index/project-server.js +751 -909
- package/dist/codebase-index/repo-map.d.ts +20 -0
- package/dist/codebase-index/skeleton-extractor.d.ts +64 -0
- package/dist/codebase-index/tree-sitter-parser.d.ts +11 -0
- package/dist/codebase-index/worker.js +723 -891
- package/dist/codebase-index/writer-mutations.d.ts +26 -0
- package/dist/codebase-index/writer-refs.d.ts +50 -0
- package/dist/codebase-index/writer-search.d.ts +30 -0
- package/dist/codebase-index/writer.d.ts +2 -320
- package/dist/diff.js +3 -2
- package/dist/document.js +37 -2
- package/dist/e2e.js +3 -2
- package/dist/edit.js +8558 -348
- package/dist/exec.js +76 -22
- package/dist/fetch.js +11 -9
- package/dist/format.js +50 -9
- package/dist/glob.js +8 -3
- package/dist/grep.js +22 -10
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11411 -9440
- package/dist/install.js +50 -9
- package/dist/json.js +91 -17
- package/dist/kanban-board-actions.d.ts +4 -0
- package/dist/kanban-lifecycle-actions.d.ts +4 -0
- package/dist/kanban-serializer.d.ts +21 -0
- package/dist/kanban.js +985 -1034
- package/dist/languages/index.js +17 -10
- package/dist/lint.js +50 -9
- package/dist/logs.js +17 -6
- package/dist/next-steps.d.ts +8 -0
- package/dist/next-steps.js +18 -0
- package/dist/outdated.js +18 -11
- package/dist/pack.js +11308 -9317
- package/dist/patch.js +8301 -77
- package/dist/plan.js +1231 -1281
- package/dist/process-registry.js +14 -8
- package/dist/ps-slash.js +65 -30
- package/dist/read.js +754 -912
- package/dist/replace.js +8456 -195
- package/dist/scaffold.js +36 -1
- package/dist/search.js +21 -15
- package/dist/security-ast-scan-tool.d.ts +43 -0
- package/dist/session-kanban-graph.d.ts +9 -0
- package/dist/session-kanban-sync.d.ts +31 -0
- package/dist/session-kanban.d.ts +5 -141
- package/dist/session-kanban.js +367 -360
- package/dist/task.js +1157 -1207
- package/dist/test.js +50 -9
- package/dist/todo.js +2187 -2237
- package/dist/tool-diff.js +6 -1
- package/dist/tool-summary.js +4 -2
- package/dist/tool-tier.js +11315 -9317
- package/dist/tree.js +36 -1
- package/dist/typecheck.js +51 -10
- package/dist/write.js +8374 -152
- package/package.json +7 -7
package/dist/tree.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as path2 from "node:path";
|
|
|
4
4
|
import { DEFAULT_WALK_IGNORE_DIRS, expectDefined } from "@wrongstack/core/utils";
|
|
5
5
|
|
|
6
6
|
// src/_util.ts
|
|
7
|
+
import * as fsp from "node:fs/promises";
|
|
7
8
|
import * as path from "node:path";
|
|
8
9
|
import * as Core from "@wrongstack/core/utils";
|
|
9
10
|
function resolvePath(input, ctx) {
|
|
@@ -27,6 +28,40 @@ function ensureInsideRoot(absPath, ctx) {
|
|
|
27
28
|
function safeResolve(input, ctx) {
|
|
28
29
|
return ensureInsideRoot(resolvePath(input, ctx), ctx);
|
|
29
30
|
}
|
|
31
|
+
async function resolveRealInsideRoot(absPath, ctx) {
|
|
32
|
+
if (ctx.allowOutsideProjectRoot) return absPath;
|
|
33
|
+
const realRoots = await Promise.all(
|
|
34
|
+
allowedRoots(ctx).map((r) => fsp.realpath(r).catch(() => path.resolve(r)))
|
|
35
|
+
);
|
|
36
|
+
let probe = absPath;
|
|
37
|
+
const pendingTail = [];
|
|
38
|
+
for (; ; ) {
|
|
39
|
+
let real;
|
|
40
|
+
try {
|
|
41
|
+
real = await fsp.realpath(probe);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
if (err.code === "ENOENT") {
|
|
44
|
+
const parent = path.dirname(probe);
|
|
45
|
+
if (parent === probe) return absPath;
|
|
46
|
+
pendingTail.unshift(path.basename(probe));
|
|
47
|
+
probe = parent;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
const candidate = pendingTail.length > 0 ? path.join(real, ...pendingTail) : real;
|
|
53
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function safeResolveReal(input, ctx) {
|
|
62
|
+
const abs = safeResolve(input, ctx);
|
|
63
|
+
return await resolveRealInsideRoot(abs, ctx);
|
|
64
|
+
}
|
|
30
65
|
|
|
31
66
|
// src/tree.ts
|
|
32
67
|
var DEFAULT_IGNORE = /* @__PURE__ */ new Set([
|
|
@@ -102,7 +137,7 @@ var treeTool = {
|
|
|
102
137
|
return final;
|
|
103
138
|
},
|
|
104
139
|
async *executeStream(input, ctx, opts) {
|
|
105
|
-
const basePath = input.path ?
|
|
140
|
+
const basePath = input.path ? await safeResolveReal(input.path, ctx) : ctx.cwd;
|
|
106
141
|
const maxDepth = input.depth ?? 3;
|
|
107
142
|
const showFiles = input.show_files ?? true;
|
|
108
143
|
const showDirs = input.show_dirs ?? true;
|
package/dist/typecheck.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
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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 {
|
|
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
|
async function detectPackageManager(cwd, stopAt) {
|
|
@@ -1110,6 +1117,40 @@ function ensureInsideRoot(absPath, ctx) {
|
|
|
1110
1117
|
function safeResolve(input, ctx) {
|
|
1111
1118
|
return ensureInsideRoot(resolvePath(input, ctx), ctx);
|
|
1112
1119
|
}
|
|
1120
|
+
async function resolveRealInsideRoot(absPath, ctx) {
|
|
1121
|
+
if (ctx.allowOutsideProjectRoot) return absPath;
|
|
1122
|
+
const realRoots = await Promise.all(
|
|
1123
|
+
allowedRoots(ctx).map((r) => fsp2.realpath(r).catch(() => path3.resolve(r)))
|
|
1124
|
+
);
|
|
1125
|
+
let probe = absPath;
|
|
1126
|
+
const pendingTail = [];
|
|
1127
|
+
for (; ; ) {
|
|
1128
|
+
let real;
|
|
1129
|
+
try {
|
|
1130
|
+
real = await fsp2.realpath(probe);
|
|
1131
|
+
} catch (err) {
|
|
1132
|
+
if (err.code === "ENOENT") {
|
|
1133
|
+
const parent = path3.dirname(probe);
|
|
1134
|
+
if (parent === probe) return absPath;
|
|
1135
|
+
pendingTail.unshift(path3.basename(probe));
|
|
1136
|
+
probe = parent;
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
throw err;
|
|
1140
|
+
}
|
|
1141
|
+
const candidate = pendingTail.length > 0 ? path3.join(real, ...pendingTail) : real;
|
|
1142
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
1143
|
+
return candidate;
|
|
1144
|
+
}
|
|
1145
|
+
throw new Error(
|
|
1146
|
+
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
async function safeResolveReal(input, ctx) {
|
|
1151
|
+
const abs = safeResolve(input, ctx);
|
|
1152
|
+
return await resolveRealInsideRoot(abs, ctx);
|
|
1153
|
+
}
|
|
1113
1154
|
var COMMAND_OUTPUT_MAX_BYTES = 32768;
|
|
1114
1155
|
var REPEAT_RUN_THRESHOLD = 3;
|
|
1115
1156
|
function collapseCarriageReturns(text) {
|
|
@@ -3629,7 +3670,7 @@ var typecheckTool = {
|
|
|
3629
3670
|
return final;
|
|
3630
3671
|
},
|
|
3631
3672
|
async *executeStream(input, ctx, opts) {
|
|
3632
|
-
const cwd = input.cwd ?
|
|
3673
|
+
const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
|
|
3633
3674
|
const bridge = await tryLegacyCodeOperation("semantic", {
|
|
3634
3675
|
cwd,
|
|
3635
3676
|
projectRoot: ctx.projectRoot,
|
|
@@ -3666,7 +3707,7 @@ var typecheckTool = {
|
|
|
3666
3707
|
cmdArgs = ["tsc", ...tscArgs];
|
|
3667
3708
|
}
|
|
3668
3709
|
} else {
|
|
3669
|
-
const tsconfig = input.project ?
|
|
3710
|
+
const tsconfig = input.project ? await safeResolveReal(input.project, ctx) : await findTsConfig(cwd);
|
|
3670
3711
|
const tscArgs = ["--noEmit"];
|
|
3671
3712
|
if (input.strict) tscArgs.push("--strict");
|
|
3672
3713
|
if (tsconfig) tscArgs.push("--project", tsconfig);
|