@wrongstack/tools 0.306.2 → 0.306.4
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 +36 -1
- package/dist/builtin.js +258 -153
- package/dist/codebase-index/index.js +241 -137
- package/dist/codebase-index/project-server.js +224 -114
- package/dist/codebase-index/worker.js +210 -107
- package/dist/codebase-index/writer.d.ts +18 -0
- package/dist/diff.js +3 -2
- package/dist/document.js +37 -2
- package/dist/e2e.js +3 -2
- package/dist/edit.js +3 -2
- package/dist/exec.js +3 -2
- package/dist/format.js +36 -1
- package/dist/glob.js +3 -2
- package/dist/grep.js +3 -2
- package/dist/index.js +258 -153
- package/dist/install.js +36 -1
- package/dist/json.js +3 -2
- package/dist/languages/index.js +3 -2
- package/dist/lint.js +36 -1
- package/dist/logs.js +4 -3
- package/dist/outdated.js +4 -3
- package/dist/pack.js +258 -153
- package/dist/patch.js +3 -2
- package/dist/read.js +213 -112
- package/dist/replace.js +36 -1
- package/dist/scaffold.js +36 -1
- package/dist/test.js +36 -1
- package/dist/tool-tier.js +258 -153
- package/dist/tree.js +36 -1
- package/dist/typecheck.js +37 -2
- package/dist/write.js +3 -2
- package/package.json +4 -4
package/dist/audit.js
CHANGED
|
@@ -1041,6 +1041,7 @@ function utf8Prefix(text, maxBytes) {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
1043
|
// src/_util.ts
|
|
1044
|
+
import * as fsp2 from "node:fs/promises";
|
|
1044
1045
|
import * as path3 from "node:path";
|
|
1045
1046
|
import * as Core from "@wrongstack/core/utils";
|
|
1046
1047
|
async function detectPackageManager(cwd, stopAt) {
|
|
@@ -1107,6 +1108,40 @@ function ensureInsideRoot(absPath, ctx) {
|
|
|
1107
1108
|
function safeResolve(input, ctx) {
|
|
1108
1109
|
return ensureInsideRoot(resolvePath(input, ctx), ctx);
|
|
1109
1110
|
}
|
|
1111
|
+
async function resolveRealInsideRoot(absPath, ctx) {
|
|
1112
|
+
if (ctx.allowOutsideProjectRoot) return absPath;
|
|
1113
|
+
const realRoots = await Promise.all(
|
|
1114
|
+
allowedRoots(ctx).map((r) => fsp2.realpath(r).catch(() => path3.resolve(r)))
|
|
1115
|
+
);
|
|
1116
|
+
let probe = absPath;
|
|
1117
|
+
const pendingTail = [];
|
|
1118
|
+
for (; ; ) {
|
|
1119
|
+
let real;
|
|
1120
|
+
try {
|
|
1121
|
+
real = await fsp2.realpath(probe);
|
|
1122
|
+
} catch (err) {
|
|
1123
|
+
if (err.code === "ENOENT") {
|
|
1124
|
+
const parent = path3.dirname(probe);
|
|
1125
|
+
if (parent === probe) return absPath;
|
|
1126
|
+
pendingTail.unshift(path3.basename(probe));
|
|
1127
|
+
probe = parent;
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
throw err;
|
|
1131
|
+
}
|
|
1132
|
+
const candidate = pendingTail.length > 0 ? path3.join(real, ...pendingTail) : real;
|
|
1133
|
+
if (isInsideAny(candidate, realRoots)) {
|
|
1134
|
+
return candidate;
|
|
1135
|
+
}
|
|
1136
|
+
throw new Error(
|
|
1137
|
+
`Path "${absPath}" resolves through a symlink outside project root "${realRoots[0]}"`
|
|
1138
|
+
);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
async function safeResolveReal(input, ctx) {
|
|
1142
|
+
const abs = safeResolve(input, ctx);
|
|
1143
|
+
return await resolveRealInsideRoot(abs, ctx);
|
|
1144
|
+
}
|
|
1110
1145
|
var COMMAND_OUTPUT_MAX_BYTES = 32768;
|
|
1111
1146
|
var REPEAT_RUN_THRESHOLD = 3;
|
|
1112
1147
|
function collapseCarriageReturns(text) {
|
|
@@ -3890,7 +3925,7 @@ var auditTool = {
|
|
|
3890
3925
|
"audit: `fix: true` is not supported \u2014 this tool is read-only (mutating: false). To remediate vulnerabilities, upgrade the affected packages with the `install` tool (or `language_package` for non-JS ecosystems)."
|
|
3891
3926
|
);
|
|
3892
3927
|
}
|
|
3893
|
-
const cwd = input.cwd ?
|
|
3928
|
+
const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
|
|
3894
3929
|
const bridge = await tryLegacyPackageOperation("package-audit", {
|
|
3895
3930
|
cwd,
|
|
3896
3931
|
projectRoot: ctx.projectRoot,
|