@plune-ai/cli 0.40.0 → 0.40.2
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/README.md +32 -2
- package/dist/cli.cjs +477 -293
- package/dist/index.cjs +12 -3
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -3
- package/dist/reporter-core.cjs +7 -0
- package/dist/reporter-core.d.cts +13 -1
- package/dist/reporter-core.d.ts +13 -1
- package/dist/reporter-core.js +6 -0
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -324,13 +324,13 @@ function reportOutputs(flags2, cwd = process.cwd(), extra = {}) {
|
|
|
324
324
|
named2[1] ?? "",
|
|
325
325
|
extra.sarif === true ? [...FILE_FORMATS, "sarif"] : FILE_FORMATS
|
|
326
326
|
);
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
return { format: fileFormat, path:
|
|
327
|
+
const path29 = named2 === null ? raw : named2[2] ?? "";
|
|
328
|
+
if (path29 === "") throw new UsageError(`--out ${raw}: the file name is missing.`);
|
|
329
|
+
return { format: fileFormat, path: path29, raw };
|
|
330
330
|
});
|
|
331
331
|
const seen = /* @__PURE__ */ new Map();
|
|
332
|
-
for (const { path:
|
|
333
|
-
const full2 = (0, import_node_path2.resolve)(cwd,
|
|
332
|
+
for (const { path: path29, raw } of files) {
|
|
333
|
+
const full2 = (0, import_node_path2.resolve)(cwd, path29);
|
|
334
334
|
const key = process.platform === "win32" ? full2.toLowerCase() : full2;
|
|
335
335
|
const first2 = seen.get(key);
|
|
336
336
|
if (first2 !== void 0) throw new UsageError(`--out ${raw}: the same file as --out ${first2}.`);
|
|
@@ -338,9 +338,9 @@ function reportOutputs(flags2, cwd = process.cwd(), extra = {}) {
|
|
|
338
338
|
if ((0, import_node_fs.statSync)(full2, { throwIfNoEntry: false })?.isDirectory() === true)
|
|
339
339
|
throw new UsageError(`--out ${raw}: a folder, not a file.`);
|
|
340
340
|
if ((0, import_node_fs.statSync)((0, import_node_path2.dirname)(full2), { throwIfNoEntry: false })?.isDirectory() !== true)
|
|
341
|
-
throw new UsageError(`--out ${raw}: the folder ${(0, import_node_path2.dirname)(
|
|
341
|
+
throw new UsageError(`--out ${raw}: the folder ${(0, import_node_path2.dirname)(path29)} does not exist.`);
|
|
342
342
|
}
|
|
343
|
-
return { format, files: files.map(({ format: f, path:
|
|
343
|
+
return { format, files: files.map(({ format: f, path: path29 }) => ({ format: f, path: path29 })) };
|
|
344
344
|
}
|
|
345
345
|
var import_node_fs, import_node_path2, STDOUT_FORMATS, FILE_FORMATS, REPORTERS, collect2;
|
|
346
346
|
var init_options2 = __esm({
|
|
@@ -796,41 +796,41 @@ function readMarker(exp) {
|
|
|
796
796
|
}
|
|
797
797
|
function validateExpected(expected) {
|
|
798
798
|
const issues = [];
|
|
799
|
-
const visit2 = (exp,
|
|
799
|
+
const visit2 = (exp, path29, depth, literal) => {
|
|
800
800
|
if (depth > MAX_EXPECTED_DEPTH) {
|
|
801
|
-
issues.push({ path:
|
|
801
|
+
issues.push({ path: path29, message: `expected is nested deeper than ${MAX_EXPECTED_DEPTH} levels` });
|
|
802
802
|
} else if (Array.isArray(exp)) {
|
|
803
|
-
exp.forEach((item, i) => visit2(item, `${
|
|
803
|
+
exp.forEach((item, i) => visit2(item, `${path29}[${i}]`, depth + 1, literal));
|
|
804
804
|
} else if (isObject(exp)) {
|
|
805
805
|
const proto = Object.getPrototypeOf(exp);
|
|
806
806
|
const marker = literal ? void 0 : readMarker(exp);
|
|
807
807
|
if (proto !== Object.prototype && proto !== null)
|
|
808
|
-
issues.push({ path:
|
|
808
|
+
issues.push({ path: path29, message: "an object that is not plain JSON data" });
|
|
809
809
|
else if (own(exp, "__proto__"))
|
|
810
|
-
issues.push({ path: keyPath(
|
|
811
|
-
else if (typeof marker === "string") issues.push({ path:
|
|
810
|
+
issues.push({ path: keyPath(path29, "__proto__"), message: "the key __proto__ is not supported in expected" });
|
|
811
|
+
else if (typeof marker === "string") issues.push({ path: path29, message: marker });
|
|
812
812
|
else if (marker === void 0)
|
|
813
|
-
for (const key of Object.keys(exp)) visit2(exp[key], keyPath(
|
|
814
|
-
else visit2(marker.value,
|
|
813
|
+
for (const key of Object.keys(exp)) visit2(exp[key], keyPath(path29, key), depth + 1, literal);
|
|
814
|
+
else visit2(marker.value, path29, depth + 1, marker.literal);
|
|
815
815
|
} else if (!literal && typeof exp === "string") {
|
|
816
816
|
try {
|
|
817
817
|
parseExpectedString(exp);
|
|
818
818
|
} catch (err) {
|
|
819
|
-
issues.push({ path:
|
|
819
|
+
issues.push({ path: path29, message: err.message });
|
|
820
820
|
}
|
|
821
821
|
} else if (!JSON_LEAF.has(typeof exp) || typeof exp === "number" && !Number.isFinite(exp)) {
|
|
822
822
|
const what = typeof exp === "number" || exp === void 0 ? String(exp) : `a ${typeof exp}`;
|
|
823
|
-
issues.push({ path:
|
|
823
|
+
issues.push({ path: path29, message: `${what} is not a JSON value` });
|
|
824
824
|
}
|
|
825
825
|
};
|
|
826
826
|
visit2(expected, "$", 0, false);
|
|
827
827
|
return issues;
|
|
828
828
|
}
|
|
829
|
-
function walk(exp, act, mode,
|
|
829
|
+
function walk(exp, act, mode, path29, sink, literal) {
|
|
830
830
|
if (!literal && isObject(exp)) {
|
|
831
831
|
const marker = readMarker(exp);
|
|
832
832
|
if (marker !== void 0) {
|
|
833
|
-
walk(marker.value, act, marker.mode ?? mode,
|
|
833
|
+
walk(marker.value, act, marker.mode ?? mode, path29, sink, marker.literal);
|
|
834
834
|
return;
|
|
835
835
|
}
|
|
836
836
|
}
|
|
@@ -840,7 +840,7 @@ function walk(exp, act, mode, path28, sink, literal) {
|
|
|
840
840
|
const failed2 = firstFailedCheck(parsed4.checks, act);
|
|
841
841
|
if (failed2 !== void 0)
|
|
842
842
|
sink.list.push({
|
|
843
|
-
path:
|
|
843
|
+
path: path29,
|
|
844
844
|
reason: "function",
|
|
845
845
|
expected: exp,
|
|
846
846
|
actual: act,
|
|
@@ -851,35 +851,35 @@ function walk(exp, act, mode, path28, sink, literal) {
|
|
|
851
851
|
exp = parsed4.literal;
|
|
852
852
|
}
|
|
853
853
|
if (typeOf(exp) !== typeOf(act)) {
|
|
854
|
-
sink.list.push({ path:
|
|
854
|
+
sink.list.push({ path: path29, reason: "type", expected: exp, actual: act });
|
|
855
855
|
} else if (Array.isArray(exp)) {
|
|
856
|
-
(mode === "exact" ? walkInOrder : walkAnyOrder)(exp, act, mode,
|
|
856
|
+
(mode === "exact" ? walkInOrder : walkAnyOrder)(exp, act, mode, path29, sink, literal);
|
|
857
857
|
} else if (isObject(exp)) {
|
|
858
|
-
walkObject(exp, act, mode,
|
|
858
|
+
walkObject(exp, act, mode, path29, sink, literal);
|
|
859
859
|
} else if (exp !== act) {
|
|
860
|
-
sink.list.push({ path:
|
|
860
|
+
sink.list.push({ path: path29, reason: "value", expected: exp, actual: act });
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
|
-
function walkObject(exp, act, mode,
|
|
863
|
+
function walkObject(exp, act, mode, path29, sink, literal) {
|
|
864
864
|
const keys = Object.keys(exp);
|
|
865
865
|
if (sink.limit === 1) keys.sort((a, b) => Number(!isScalar(exp[a])) - Number(!isScalar(exp[b])));
|
|
866
866
|
for (const key of keys) {
|
|
867
867
|
if (done(sink)) return;
|
|
868
|
-
const at2 = keyPath(
|
|
868
|
+
const at2 = keyPath(path29, key);
|
|
869
869
|
if (own(act, key)) walk(exp[key], act[key], mode, at2, sink, literal);
|
|
870
870
|
else sink.list.push({ path: at2, reason: "missing-key", expected: exp[key] });
|
|
871
871
|
}
|
|
872
872
|
if (mode === "contains") return;
|
|
873
873
|
for (const key of Object.keys(act))
|
|
874
|
-
if (!own(exp, key)) sink.list.push({ path: keyPath(
|
|
874
|
+
if (!own(exp, key)) sink.list.push({ path: keyPath(path29, key), reason: "extra-key", actual: act[key] });
|
|
875
875
|
}
|
|
876
|
-
function walkInOrder(exp, act, mode,
|
|
876
|
+
function walkInOrder(exp, act, mode, path29, sink, literal) {
|
|
877
877
|
const shared = Math.min(exp.length, act.length);
|
|
878
|
-
for (let i = 0; i < shared && !done(sink); i++) walk(exp[i], act[i], mode, `${
|
|
878
|
+
for (let i = 0; i < shared && !done(sink); i++) walk(exp[i], act[i], mode, `${path29}[${i}]`, sink, literal);
|
|
879
879
|
for (let i = shared; i < exp.length; i++)
|
|
880
|
-
sink.list.push({ path: `${
|
|
880
|
+
sink.list.push({ path: `${path29}[${i}]`, reason: "missing-element", expected: exp[i] });
|
|
881
881
|
for (let i = shared; i < act.length; i++)
|
|
882
|
-
sink.list.push({ path: `${
|
|
882
|
+
sink.list.push({ path: `${path29}[${i}]`, reason: "extra-element", actual: act[i] });
|
|
883
883
|
}
|
|
884
884
|
function plainScalar(e, literal) {
|
|
885
885
|
if (!isScalar(e)) return void 0;
|
|
@@ -887,10 +887,10 @@ function plainScalar(e, literal) {
|
|
|
887
887
|
const parsed4 = parseExpectedString(e);
|
|
888
888
|
return "literal" in parsed4 ? { value: parsed4.literal } : void 0;
|
|
889
889
|
}
|
|
890
|
-
function walkAnyOrder(exp, act, mode,
|
|
890
|
+
function walkAnyOrder(exp, act, mode, path29, sink, literal) {
|
|
891
891
|
const probing = sink.limit === 1;
|
|
892
892
|
if (probing && (mode === "unordered" ? exp.length !== act.length : exp.length > act.length)) {
|
|
893
|
-
sink.list.push({ path:
|
|
893
|
+
sink.list.push({ path: path29, reason: "no-match" });
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
896
|
const { budget } = sink;
|
|
@@ -922,14 +922,14 @@ function walkAnyOrder(exp, act, mode, path28, sink, literal) {
|
|
|
922
922
|
if (known2 === void 0) {
|
|
923
923
|
if (--budget.steps < 0) {
|
|
924
924
|
budget.spent = {
|
|
925
|
-
path:
|
|
925
|
+
path: path29,
|
|
926
926
|
reason: "too-large",
|
|
927
927
|
detail: `matching arrays in any order took more than ${MAX_MATCH_STEPS} comparisons of elements`
|
|
928
928
|
};
|
|
929
929
|
return false;
|
|
930
930
|
}
|
|
931
931
|
const probe3 = { list: [], limit: 1, budget };
|
|
932
|
-
walk(exp[rest[e]], act[open2[c]], mode,
|
|
932
|
+
walk(exp[rest[e]], act[open2[c]], mode, path29, probe3, literal);
|
|
933
933
|
known2 = probe3.list.length === 0;
|
|
934
934
|
fits.set(at2, known2);
|
|
935
935
|
}
|
|
@@ -1015,10 +1015,10 @@ function walkAnyOrder(exp, act, mode, path28, sink, literal) {
|
|
|
1015
1015
|
});
|
|
1016
1016
|
}
|
|
1017
1017
|
for (const i of unmatched.sort((a, b) => a - b))
|
|
1018
|
-
sink.list.push({ path: `${
|
|
1018
|
+
sink.list.push({ path: `${path29}[${i}]`, reason: "no-match", expected: exp[i] });
|
|
1019
1019
|
if (mode === "contains") return;
|
|
1020
1020
|
for (let j = 0; j < act.length; j++)
|
|
1021
|
-
if (taken[j] === 0) sink.list.push({ path: `${
|
|
1021
|
+
if (taken[j] === 0) sink.list.push({ path: `${path29}[${j}]`, reason: "extra-element", actual: act[j] });
|
|
1022
1022
|
}
|
|
1023
1023
|
function compareJson(expected, actual, options = {}) {
|
|
1024
1024
|
const issue = validateExpected(expected)[0];
|
|
@@ -1035,9 +1035,9 @@ var init_compare = __esm({
|
|
|
1035
1035
|
init_functions();
|
|
1036
1036
|
COMPARE_MODES = ["exact", "unordered", "contains"];
|
|
1037
1037
|
ExpectedJsonError = class extends Error {
|
|
1038
|
-
constructor(
|
|
1039
|
-
super(`${
|
|
1040
|
-
this.path =
|
|
1038
|
+
constructor(path29, message2) {
|
|
1039
|
+
super(`${path29}: ${message2}`);
|
|
1040
|
+
this.path = path29;
|
|
1041
1041
|
this.name = "ExpectedJsonError";
|
|
1042
1042
|
}
|
|
1043
1043
|
path;
|
|
@@ -1048,7 +1048,7 @@ var init_compare = __esm({
|
|
|
1048
1048
|
own = (o, key) => Object.prototype.hasOwnProperty.call(o, key);
|
|
1049
1049
|
typeOf = (v) => v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
|
|
1050
1050
|
PLAIN_KEY = /^[A-Za-z_$][\w$]*$/;
|
|
1051
|
-
keyPath = (
|
|
1051
|
+
keyPath = (path29, key) => PLAIN_KEY.test(key) ? `${path29}.${key}` : `${path29}[${JSON.stringify(key)}]`;
|
|
1052
1052
|
MAX_EXPECTED_DEPTH = 100;
|
|
1053
1053
|
JSON_LEAF = /* @__PURE__ */ new Set(["string", "number", "boolean", "object"]);
|
|
1054
1054
|
done = (sink) => sink.list.length >= sink.limit || sink.budget.spent !== void 0;
|
|
@@ -1354,11 +1354,11 @@ var init_schema = __esm({
|
|
|
1354
1354
|
});
|
|
1355
1355
|
const server2 = evalConfig.mcp?.server;
|
|
1356
1356
|
if (server2 === void 0) {
|
|
1357
|
-
const misplaced = (assertions,
|
|
1357
|
+
const misplaced = (assertions, path29) => assertions.forEach((a, j) => {
|
|
1358
1358
|
if (TOOL_CALL_TYPES.has(a.type))
|
|
1359
1359
|
ctx.addIssue({
|
|
1360
1360
|
code: "custom",
|
|
1361
|
-
path: [...
|
|
1361
|
+
path: [...path29, j, "type"],
|
|
1362
1362
|
message: `"${a.type}" reads the tool calls of an eval with mcp, and eval "${evalConfig.id}" has no mcp block`
|
|
1363
1363
|
});
|
|
1364
1364
|
});
|
|
@@ -3975,20 +3975,20 @@ function noteValue(out, v, at2) {
|
|
|
3975
3975
|
where3.add(at2);
|
|
3976
3976
|
out.values.set(h, where3);
|
|
3977
3977
|
}
|
|
3978
|
-
function walk2(value2,
|
|
3978
|
+
function walk2(value2, path29, depth, out) {
|
|
3979
3979
|
if (depth > SCAN_DEPTH) return;
|
|
3980
3980
|
if (typeof value2 === "string" && UUID.test(value2)) {
|
|
3981
|
-
const at2 = cap(
|
|
3981
|
+
const at2 = cap(path29 === "" ? "(root)" : path29);
|
|
3982
3982
|
out.paths.add(at2);
|
|
3983
3983
|
noteValue(out, value2, at2);
|
|
3984
3984
|
}
|
|
3985
3985
|
if (Array.isArray(value2)) {
|
|
3986
|
-
for (const item of value2.slice(0, SCAN_ITEMS)) walk2(item, `${
|
|
3986
|
+
for (const item of value2.slice(0, SCAN_ITEMS)) walk2(item, `${path29}[]`, depth + 1, out);
|
|
3987
3987
|
return;
|
|
3988
3988
|
}
|
|
3989
3989
|
if (!isRecord3(value2)) return;
|
|
3990
3990
|
for (const [key, v] of Object.entries(value2)) {
|
|
3991
|
-
const at2 = cap(
|
|
3991
|
+
const at2 = cap(path29 === "" ? segment(key) : `${path29}.${segment(key)}`);
|
|
3992
3992
|
if (isIdKey(key) && (isScalar2(v) || Array.isArray(v) && v.length > 0 && v.every(isScalar2))) {
|
|
3993
3993
|
out.paths.add(at2);
|
|
3994
3994
|
for (const x of Array.isArray(v) ? v : [v]) noteValue(out, x, at2);
|
|
@@ -4166,7 +4166,7 @@ var init_friction = __esm({
|
|
|
4166
4166
|
isRecord3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4167
4167
|
isScalar2 = (v) => typeof v === "string" && v !== "" || typeof v === "number" && Number.isFinite(v);
|
|
4168
4168
|
EMAIL = /@/;
|
|
4169
|
-
cap = (
|
|
4169
|
+
cap = (path29) => path29.length > MAX_PATH ? path29.slice(0, MAX_PATH) : path29;
|
|
4170
4170
|
hashOf = (v) => sha256(v).slice(0, 16);
|
|
4171
4171
|
ID_MARK = "<id>";
|
|
4172
4172
|
UUID_IN_TEXT = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
|
|
@@ -4696,7 +4696,7 @@ var init_schema2 = __esm({
|
|
|
4696
4696
|
failure: failureSchema.optional()
|
|
4697
4697
|
}).superRefine((stub, ctx) => {
|
|
4698
4698
|
const { response, failure: failure2 } = stub;
|
|
4699
|
-
const need = (message2, ...
|
|
4699
|
+
const need = (message2, ...path29) => ctx.addIssue({ code: "custom", message: message2, path: ["response", ...path29] });
|
|
4700
4700
|
if (failure2 === void 0) {
|
|
4701
4701
|
if (response === void 0) need("give a response or a failure");
|
|
4702
4702
|
} else if (failure2.type === "truncated_json") {
|
|
@@ -5602,12 +5602,12 @@ function pathMatcher(pattern) {
|
|
|
5602
5602
|
for (let i = 0; i < n; i += 1)
|
|
5603
5603
|
if (at2[i] && (tokens2[i] === "*" || tokens2[i] === "**")) at2[i + 1] = 1;
|
|
5604
5604
|
};
|
|
5605
|
-
return (
|
|
5605
|
+
return (path29) => {
|
|
5606
5606
|
let at2 = new Uint8Array(n + 1);
|
|
5607
5607
|
at2[0] = 1;
|
|
5608
5608
|
skipWildcards(at2);
|
|
5609
|
-
for (let c = 0; c <
|
|
5610
|
-
const ch =
|
|
5609
|
+
for (let c = 0; c < path29.length; c += 1) {
|
|
5610
|
+
const ch = path29[c];
|
|
5611
5611
|
const next = new Uint8Array(n + 1);
|
|
5612
5612
|
for (let i = 0; i < n; i += 1) {
|
|
5613
5613
|
if (!at2[i]) continue;
|
|
@@ -5663,7 +5663,9 @@ function notLocal(req, port2, bound = "127.0.0.1") {
|
|
|
5663
5663
|
const hosts = names.flatMap((name) => port2 === 80 ? [name, `${name}:80`] : [`${name}:${port2}`]);
|
|
5664
5664
|
const host = (req.headers.host ?? "").toLowerCase();
|
|
5665
5665
|
const { origin } = req.headers;
|
|
5666
|
-
|
|
5666
|
+
const site = req.headers["sec-fetch-site"];
|
|
5667
|
+
return !hosts.includes(host) || origin !== void 0 && !hosts.some((h) => origin.toLowerCase() === `http://${h}`) || // Fail closed: of the four values a browser sends, `cross-site` and `same-site` are another origin.
|
|
5668
|
+
site !== void 0 && !["same-origin", "none"].includes(String(site).toLowerCase());
|
|
5667
5669
|
}
|
|
5668
5670
|
function maskedHeaders(headers) {
|
|
5669
5671
|
const out = {};
|
|
@@ -5759,11 +5761,11 @@ async function start(options = {}) {
|
|
|
5759
5761
|
const badTarget = segments[0] !== "" || segments.length < 2 || segments[1] === "" && segments.length > 2 || segments.some((segment3) => DOT_SEGMENT.test(segment3));
|
|
5760
5762
|
const name = badTarget ? "" : segments[1];
|
|
5761
5763
|
const method = req.method ?? "GET";
|
|
5762
|
-
const
|
|
5764
|
+
const path29 = badTarget ? rawPath : rawPath.slice(name.length + 1) || "/";
|
|
5763
5765
|
const entry2 = {
|
|
5764
5766
|
scope: name,
|
|
5765
5767
|
method,
|
|
5766
|
-
path:
|
|
5768
|
+
path: path29,
|
|
5767
5769
|
query: maskedQuery(new URLSearchParams(queryAt === -1 ? "" : target4.slice(queryAt + 1))),
|
|
5768
5770
|
headers: maskedHeaders(req.headers),
|
|
5769
5771
|
body: body.subarray(0, journalBodyCap).toString("utf8"),
|
|
@@ -5796,7 +5798,7 @@ async function start(options = {}) {
|
|
|
5796
5798
|
const live = scope.stubs.find(({ stub, matches: matches2, calls }) => {
|
|
5797
5799
|
if (stub.times !== "always" && calls >= (stub.times === "once" ? 1 : stub.times))
|
|
5798
5800
|
return false;
|
|
5799
|
-
if (stub.method !== method || !matches2(
|
|
5801
|
+
if (stub.method !== method || !matches2(path29)) return false;
|
|
5800
5802
|
const exact = stub.match === "exact";
|
|
5801
5803
|
if (stub.body === void 0 && !exact) return true;
|
|
5802
5804
|
if (!parsed4) {
|
|
@@ -5956,7 +5958,7 @@ async function start(options = {}) {
|
|
|
5956
5958
|
throw new Error(`Invalid stub: ${formatIssues(result2.error).join("; ")}`);
|
|
5957
5959
|
state2.stubs.push({
|
|
5958
5960
|
stub: result2.data,
|
|
5959
|
-
matches: result2.data.match === "exact" ? (
|
|
5961
|
+
matches: result2.data.match === "exact" ? (path29) => maskedTextMatches(result2.data.path, path29) : pathMatcher(result2.data.path),
|
|
5960
5962
|
calls: 0
|
|
5961
5963
|
});
|
|
5962
5964
|
}
|
|
@@ -6003,7 +6005,7 @@ var init_server = __esm({
|
|
|
6003
6005
|
SCOPE_NAME = /^(?!\.{1,2}$)[A-Za-z0-9._-]+$/;
|
|
6004
6006
|
DOT_SEGMENT = /^(\.|%2e){1,2}$/i;
|
|
6005
6007
|
MAX_BODY_BYTES = 16 * 1024 * 1024;
|
|
6006
|
-
NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a
|
|
6008
|
+
NOT_LOCAL_MESSAGE = "This server answers only a request addressed to 127.0.0.1, localhost or [::1] with its own port, and none a browser marks as sent from another origin";
|
|
6007
6009
|
providerError = (type, code, message2) => ({
|
|
6008
6010
|
type: "error",
|
|
6009
6011
|
error: { type, code, message: message2 }
|
|
@@ -6058,12 +6060,12 @@ function machineless(raw, repoRoot, home) {
|
|
|
6058
6060
|
if (repoRoot === void 0) text6 = text6.replace(ANY_HOME, "~");
|
|
6059
6061
|
return text6;
|
|
6060
6062
|
}
|
|
6061
|
-
function pathIn(
|
|
6062
|
-
const parts =
|
|
6063
|
+
function pathIn(path29) {
|
|
6064
|
+
const parts = path29.split(/[\\/]+/);
|
|
6063
6065
|
while (parts.length > 1 && parts.at(-1) === "") parts.pop();
|
|
6064
6066
|
if (!parts.some((part) => part !== "" && !/^[A-Za-z]:$/.test(part))) return void 0;
|
|
6065
6067
|
const joined2 = parts.map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("[\\\\/]+");
|
|
6066
|
-
const escaped = /^\/(?!\/)/.test(
|
|
6068
|
+
const escaped = /^\/(?!\/)/.test(path29) ? joined2.replace("[\\\\/]+", "\\\\*\\/") : joined2;
|
|
6067
6069
|
const url = "(?:(?:file|webpack|webpack-internal):(?:\\\\*\\/){2,3})?";
|
|
6068
6070
|
return new RegExp(`${url}${escaped}`, /^[A-Za-z]:$/.test(parts[0]) ? "gi" : "g");
|
|
6069
6071
|
}
|
|
@@ -6087,6 +6089,11 @@ function chosen({ status: status2, errors: errors2 }) {
|
|
|
6087
6089
|
}
|
|
6088
6090
|
return errors2[0];
|
|
6089
6091
|
}
|
|
6092
|
+
function stepTitlesOf(attempt) {
|
|
6093
|
+
if (attempt.status !== "passed") return void 0;
|
|
6094
|
+
const titles = attempt.steps.map((s) => s.title.trim()).filter((t) => t !== "");
|
|
6095
|
+
return titles.length > 0 ? titles : void 0;
|
|
6096
|
+
}
|
|
6090
6097
|
function chainOf(steps) {
|
|
6091
6098
|
const chain = [];
|
|
6092
6099
|
for (let failed2 = steps.find((s) => s.failed); failed2 !== void 0; failed2 = failed2.steps.find((s) => s.failed)) {
|
|
@@ -6109,12 +6116,12 @@ function placeOf(error, testFile) {
|
|
|
6109
6116
|
}
|
|
6110
6117
|
function fileOf(raw) {
|
|
6111
6118
|
if (!raw.startsWith("file://")) return raw;
|
|
6112
|
-
let
|
|
6119
|
+
let path29 = raw.slice("file://".length);
|
|
6113
6120
|
try {
|
|
6114
|
-
|
|
6121
|
+
path29 = decodeURIComponent(path29);
|
|
6115
6122
|
} catch {
|
|
6116
6123
|
}
|
|
6117
|
-
return /^\/[A-Za-z]:\//.test(
|
|
6124
|
+
return /^\/[A-Za-z]:\//.test(path29) ? path29.slice(1) : path29;
|
|
6118
6125
|
}
|
|
6119
6126
|
function fromRoot(place, root) {
|
|
6120
6127
|
if (place === void 0 || root === void 0 || !Number.isInteger(place.line) || place.line < 1) return void 0;
|
|
@@ -6154,14 +6161,14 @@ var init_failure_detail = __esm({
|
|
|
6154
6161
|
FRAME = /^\s+at (?:.*? \()?(.+?):(\d+):(\d+)\)?$/;
|
|
6155
6162
|
FRAME_MAX = 8192;
|
|
6156
6163
|
firstLine = (text6) => (0, import_node_util.stripVTControlCharacters)(text6).split("\n").map((line) => line.trim()).find((line) => line !== "");
|
|
6157
|
-
normal = (
|
|
6164
|
+
normal = (path29) => import_node_path3.posix.normalize(path29.replace(/\\/g, "/")).replace(/^([a-z]):/, (_, drive) => `${drive.toUpperCase()}:`);
|
|
6158
6165
|
}
|
|
6159
6166
|
});
|
|
6160
6167
|
|
|
6161
6168
|
// src/mcp-testing/connect/journal.ts
|
|
6162
|
-
function openJournal(
|
|
6163
|
-
if (
|
|
6164
|
-
const fd = (0, import_node_fs3.openSync)(
|
|
6169
|
+
function openJournal(path29, redact2) {
|
|
6170
|
+
if (path29 === void 0) return NONE;
|
|
6171
|
+
const fd = (0, import_node_fs3.openSync)(path29, "w", 384);
|
|
6165
6172
|
if (process.platform !== "win32") (0, import_node_fs3.fchmodSync)(fd, 384);
|
|
6166
6173
|
const start3 = import_node_perf_hooks.performance.now();
|
|
6167
6174
|
let closed = false;
|
|
@@ -9006,8 +9013,8 @@ function sortKeys(value2) {
|
|
|
9006
9013
|
function homePattern(home) {
|
|
9007
9014
|
const trimmed = home?.replace(/[\\/]+$/, "");
|
|
9008
9015
|
if (trimmed === void 0 || trimmed.length < 2) return void 0;
|
|
9009
|
-
const
|
|
9010
|
-
return new RegExp(`(?<![\\w./\\\\-])${
|
|
9016
|
+
const path29 = trimmed.split(/[\\/]/).map(escapeRegExp).join("[\\\\/]");
|
|
9017
|
+
return new RegExp(`(?<![\\w./\\\\-])${path29}(?![\\w-]|\\.\\w)`, /^[A-Za-z]:/.test(trimmed) ? "gi" : "g");
|
|
9011
9018
|
}
|
|
9012
9019
|
function redact(value2, secrets, home) {
|
|
9013
9020
|
if (typeof value2 === "string") {
|
|
@@ -9188,10 +9195,10 @@ function same(a, b) {
|
|
|
9188
9195
|
const ka = Object.keys(a);
|
|
9189
9196
|
return ka.length === Object.keys(b).length && ka.every((k) => Object.hasOwn(b, k) && same(a[k], b[k]));
|
|
9190
9197
|
}
|
|
9191
|
-
function compareSchema(c, side,
|
|
9198
|
+
function compareSchema(c, side, path29, before, after) {
|
|
9192
9199
|
if (same(before, after)) return;
|
|
9193
|
-
const field = `${side}Schema${
|
|
9194
|
-
if (
|
|
9200
|
+
const field = `${side}Schema${path29 === "" ? "" : `.${path29}`}`;
|
|
9201
|
+
if (path29 === "" && (before === void 0 || after === void 0)) {
|
|
9195
9202
|
if (side === "output") {
|
|
9196
9203
|
if (after === void 0) c.add(field, "breaking", "The output schema was removed; a client reading the result loses its shape.", before, after);
|
|
9197
9204
|
else c.add(field, "non-breaking", "An output schema was added.", before, after);
|
|
@@ -9203,10 +9210,10 @@ function compareSchema(c, side, path28, before, after) {
|
|
|
9203
9210
|
return c.add(`${field}`, "breaking", `The type changed from ${show(before["type"])} to ${show(after["type"])}.`, before["type"], after["type"]);
|
|
9204
9211
|
}
|
|
9205
9212
|
if (!same(before["enum"], after["enum"])) compareEnum(c, side, field, before["enum"], after["enum"]);
|
|
9206
|
-
compareProperties(c, side,
|
|
9207
|
-
if (!same(before["items"], after["items"])) compareSchema(c, side, `${
|
|
9213
|
+
compareProperties(c, side, path29, field, before, after);
|
|
9214
|
+
if (!same(before["items"], after["items"])) compareSchema(c, side, `${path29}[]`, before["items"], after["items"]);
|
|
9208
9215
|
if (!same(before["description"], after["description"])) {
|
|
9209
|
-
const what =
|
|
9216
|
+
const what = path29 === "" ? `whole ${side} schema` : side === "input" ? "parameter" : "field";
|
|
9210
9217
|
c.add(field, "informational", `The ${what} description changed: it is what a model reads.`, before["description"], after["description"], {
|
|
9211
9218
|
signal: "security"
|
|
9212
9219
|
});
|
|
@@ -9266,7 +9273,7 @@ function compareEnum(c, side, field, before, after) {
|
|
|
9266
9273
|
if (widened) return c.add(field, "breaking", `The result enum was widened: ${gained}; a client does not know the new value.`, before, after);
|
|
9267
9274
|
c.add(field, "non-breaking", `The result enum was narrowed: ${lost}.`, before, after);
|
|
9268
9275
|
}
|
|
9269
|
-
function compareProperties(c, side,
|
|
9276
|
+
function compareProperties(c, side, path29, field, before, after) {
|
|
9270
9277
|
const bp = isRecord7(before["properties"]) ? before["properties"] : {};
|
|
9271
9278
|
const ap = isRecord7(after["properties"]) ? after["properties"] : {};
|
|
9272
9279
|
const br = stringSet(before["required"]);
|
|
@@ -9279,7 +9286,7 @@ function compareProperties(c, side, path28, field, before, after) {
|
|
|
9279
9286
|
}
|
|
9280
9287
|
const what = side === "input" ? "parameter" : "field";
|
|
9281
9288
|
for (const name of [.../* @__PURE__ */ new Set([...Object.keys(bp), ...Object.keys(ap)])].sort()) {
|
|
9282
|
-
const sub =
|
|
9289
|
+
const sub = path29 === "" ? name : `${path29}.${name}`;
|
|
9283
9290
|
const f = `${side}Schema.${sub}`;
|
|
9284
9291
|
const inBefore = Object.hasOwn(bp, name);
|
|
9285
9292
|
const inAfter = Object.hasOwn(ap, name);
|
|
@@ -10764,10 +10771,10 @@ function schemaNodes(schema) {
|
|
|
10764
10771
|
const children = [];
|
|
10765
10772
|
for (const [name, p] of Object.entries(props(node.schema))) {
|
|
10766
10773
|
if (!isRecord8(p)) continue;
|
|
10767
|
-
const
|
|
10774
|
+
const path29 = node.path === "" ? name : `${node.path}.${name}`;
|
|
10768
10775
|
const depth = node.depth + 1;
|
|
10769
|
-
children.push({ path:
|
|
10770
|
-
if (isRecord8(p.items)) children.push({ path: `${
|
|
10776
|
+
children.push({ path: path29, schema: p, kind: "param", depth });
|
|
10777
|
+
if (isRecord8(p.items)) children.push({ path: `${path29}[]`, schema: p.items, kind: "items", depth: depth + 1 });
|
|
10771
10778
|
}
|
|
10772
10779
|
for (const child of children.reverse()) todo.push(child);
|
|
10773
10780
|
}
|
|
@@ -12491,7 +12498,7 @@ function createClient(opts) {
|
|
|
12491
12498
|
}
|
|
12492
12499
|
const base = opts.apiUrl.replace(/\/+$/, "");
|
|
12493
12500
|
const scrub = (text6) => opts.token === "" ? text6 : text6.split(opts.token).join("***");
|
|
12494
|
-
async function send3(method,
|
|
12501
|
+
async function send3(method, path29, payload2, retries = DEFAULT_RETRIES) {
|
|
12495
12502
|
let last = {
|
|
12496
12503
|
kind: "unavailable",
|
|
12497
12504
|
status: null,
|
|
@@ -12502,7 +12509,7 @@ function createClient(opts) {
|
|
|
12502
12509
|
await respectPause(mine);
|
|
12503
12510
|
let res;
|
|
12504
12511
|
try {
|
|
12505
|
-
res = await doFetch(`${base}${
|
|
12512
|
+
res = await doFetch(`${base}${path29}`, {
|
|
12506
12513
|
method,
|
|
12507
12514
|
headers: { "content-type": payload2?.type ?? "application/json", authorization: `Bearer ${opts.token}` },
|
|
12508
12515
|
// A DELETE carries none. Sending `"undefined"` as a body is what a naive
|
|
@@ -12541,11 +12548,11 @@ function createClient(opts) {
|
|
|
12541
12548
|
return { ok: false, ...last };
|
|
12542
12549
|
}
|
|
12543
12550
|
return {
|
|
12544
|
-
post: (
|
|
12545
|
-
upload: (
|
|
12546
|
-
del: (
|
|
12547
|
-
get: (
|
|
12548
|
-
patch: (
|
|
12551
|
+
post: (path29, body, retries) => send3("POST", path29, { body: JSON.stringify(body), type: "application/json" }, retries),
|
|
12552
|
+
upload: (path29, bytes, contentType2) => send3("POST", path29, { body: bytes, type: contentType2 }, uploadRetries ?? DEFAULT_RETRIES),
|
|
12553
|
+
del: (path29) => send3("DELETE", path29),
|
|
12554
|
+
get: (path29) => send3("GET", path29),
|
|
12555
|
+
patch: (path29, body) => send3("PATCH", path29, { body: JSON.stringify(body), type: "application/json" }),
|
|
12549
12556
|
async put(url, headers, source) {
|
|
12550
12557
|
const putRetries = uploadRetries ?? 3;
|
|
12551
12558
|
let last = { ok: false, status: null, code: "network" };
|
|
@@ -12781,9 +12788,9 @@ var init_fallback = __esm({
|
|
|
12781
12788
|
});
|
|
12782
12789
|
|
|
12783
12790
|
// src/reporter-core/files-batch.ts
|
|
12784
|
-
async function sha256File(
|
|
12791
|
+
async function sha256File(path29) {
|
|
12785
12792
|
const hash = (0, import_node_crypto3.createHash)("sha256");
|
|
12786
|
-
for await (const part of (0, import_node_fs8.createReadStream)(
|
|
12793
|
+
for await (const part of (0, import_node_fs8.createReadStream)(path29)) hash.update(part);
|
|
12787
12794
|
return hash.digest("hex");
|
|
12788
12795
|
}
|
|
12789
12796
|
var import_node_crypto3, import_node_fs8, FILES_BATCH_MAX, DIRECT_BATCH_BYTES, BATCH_PIPELINES, sha256Bytes, BUCKET_CODES;
|
|
@@ -14890,10 +14897,10 @@ function platformGet(deps) {
|
|
|
14890
14897
|
const token2 = (deps.loadToken ?? loadToken)();
|
|
14891
14898
|
if (token2 === null) throw new NotLoggedInError();
|
|
14892
14899
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
14893
|
-
return async (
|
|
14900
|
+
return async (path29) => {
|
|
14894
14901
|
let res;
|
|
14895
14902
|
try {
|
|
14896
|
-
res = await doFetch(`${apiUrl}${
|
|
14903
|
+
res = await doFetch(`${apiUrl}${path29}`, { headers: { authorization: `Bearer ${token2}` } });
|
|
14897
14904
|
} catch {
|
|
14898
14905
|
throw new SyncNetworkError(apiUrl);
|
|
14899
14906
|
}
|
|
@@ -15248,9 +15255,9 @@ var init_read_file = __esm({
|
|
|
15248
15255
|
});
|
|
15249
15256
|
|
|
15250
15257
|
// src/importers/allure.ts
|
|
15251
|
-
function isFolder(
|
|
15258
|
+
function isFolder(path29) {
|
|
15252
15259
|
try {
|
|
15253
|
-
return fs13.statSync(
|
|
15260
|
+
return fs13.statSync(path29).isDirectory();
|
|
15254
15261
|
} catch {
|
|
15255
15262
|
return false;
|
|
15256
15263
|
}
|
|
@@ -15426,6 +15433,7 @@ function pendingOf(r, retry, ctx) {
|
|
|
15426
15433
|
};
|
|
15427
15434
|
const errorContext = errorContextFields(attempt);
|
|
15428
15435
|
const failure2 = FAILED.has(status2) ? failureOf(attempt) : void 0;
|
|
15436
|
+
const stepTitles = stepTitlesOf(attempt);
|
|
15429
15437
|
const pkg2 = labelOf(r, "package");
|
|
15430
15438
|
const where3 = (key.includes("#") ? key.split("#")[0] : pkg2)?.replace(/^[A-Za-z][A-Za-z0-9_-]+:(?![\\/])/, "");
|
|
15431
15439
|
const stated = TOKEN.exec(name)?.[1];
|
|
@@ -15450,7 +15458,8 @@ function pendingOf(r, retry, ctx) {
|
|
|
15450
15458
|
} : {},
|
|
15451
15459
|
...errorContext,
|
|
15452
15460
|
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
15453
|
-
...files.length > 0 ? { files } : {}
|
|
15461
|
+
...files.length > 0 ? { files } : {},
|
|
15462
|
+
...stepTitles !== void 0 ? { stepTitles } : {}
|
|
15454
15463
|
};
|
|
15455
15464
|
}
|
|
15456
15465
|
var fs13, path13, SOURCE, TOKEN, AllureReportError, RESULT, CONTAINER, MAX_JSON_BYTES, MAX_DEPTH2, MAX_TIME, namesIn, timeOf, textOf, labelOf, FAILED, declared, stopOf, compareText;
|
|
@@ -15807,10 +15816,10 @@ function attemptOf(result2, file, ctx) {
|
|
|
15807
15816
|
...typeof at2?.file === "string" && typeof at2.line === "number" ? { location: { file: at2.file, line: at2.line, ...typeof at2.column === "number" ? { column: at2.column } : {} } } : {}
|
|
15808
15817
|
})),
|
|
15809
15818
|
steps: steps(result2.steps),
|
|
15810
|
-
attachments: (result2.attachments ?? []).map(({ name, contentType: contentType2, path:
|
|
15819
|
+
attachments: (result2.attachments ?? []).map(({ name, contentType: contentType2, path: path29, body }) => ({
|
|
15811
15820
|
name: name ?? "",
|
|
15812
15821
|
...contentType2 !== void 0 ? { contentType: contentType2 } : {},
|
|
15813
|
-
...
|
|
15822
|
+
...path29 !== void 0 ? { path: path29 } : {},
|
|
15814
15823
|
// Decoded only where the platform would take it: a report of screenshots kept as
|
|
15815
15824
|
// bodies is megabytes of base64 that nothing here will read.
|
|
15816
15825
|
...typeof body === "string" && isTextType(contentType2) ? { body: Buffer.from(body, "base64") } : {}
|
|
@@ -15832,6 +15841,7 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
15832
15841
|
const errorContext = errorContextFields(attempt);
|
|
15833
15842
|
const failure2 = NOT_FAILED.has(attempt.status) ? void 0 : failureOf(attempt);
|
|
15834
15843
|
const files = filesOf(attempt);
|
|
15844
|
+
const stepTitles = stepTitlesOf(attempt);
|
|
15835
15845
|
const keys = [
|
|
15836
15846
|
...test.id !== void 0 ? [{ kind: "playwright-id", value: test.id }] : [],
|
|
15837
15847
|
{ kind: "path-title", value: pathTitle }
|
|
@@ -15864,7 +15874,8 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
15864
15874
|
...errorContext,
|
|
15865
15875
|
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
15866
15876
|
...files.length > 0 ? { files } : {},
|
|
15867
|
-
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
15877
|
+
...traceUrl !== void 0 ? { traceUrl } : {},
|
|
15878
|
+
...stepTitles !== void 0 ? { stepTitles } : {}
|
|
15868
15879
|
};
|
|
15869
15880
|
}
|
|
15870
15881
|
function walk3(suite, describes, depth, ctx, out) {
|
|
@@ -16123,6 +16134,168 @@ var init_lighthouse = __esm({
|
|
|
16123
16134
|
}
|
|
16124
16135
|
});
|
|
16125
16136
|
|
|
16137
|
+
// src/importers/e2e-report.ts
|
|
16138
|
+
function looksLikeE2eReport(source) {
|
|
16139
|
+
return /^\s*\{/.test(source) && /"schemaVersion"\s*:\s*"report-\d+"/.test(source);
|
|
16140
|
+
}
|
|
16141
|
+
function readE2eReport(source, file, missing = [], notes = []) {
|
|
16142
|
+
let parsed4;
|
|
16143
|
+
try {
|
|
16144
|
+
parsed4 = JSON.parse(source);
|
|
16145
|
+
} catch (err) {
|
|
16146
|
+
throw new JsonReportError(
|
|
16147
|
+
file,
|
|
16148
|
+
`not JSON \u2014 ${printable(err instanceof Error ? err.message : String(err))}`
|
|
16149
|
+
);
|
|
16150
|
+
}
|
|
16151
|
+
if (parsed4?.schemaVersion !== VERSION || typeof parsed4.run !== "object" || parsed4.run === null) {
|
|
16152
|
+
const said3 = typeof parsed4?.schemaVersion === "string" ? `"${printable(parsed4.schemaVersion)}"` : "no schemaVersion";
|
|
16153
|
+
throw new JsonReportError(
|
|
16154
|
+
file,
|
|
16155
|
+
`${said3} \u2014 this import reads the e2e runner's ${VERSION} report only.`
|
|
16156
|
+
);
|
|
16157
|
+
}
|
|
16158
|
+
const run = parsed4.run;
|
|
16159
|
+
const folders = reportFolders(file);
|
|
16160
|
+
const real = path16.join(folders.real, "results");
|
|
16161
|
+
const lexical = path16.join(folders.lexical, "results");
|
|
16162
|
+
const out = [];
|
|
16163
|
+
for (const result2 of run.results ?? []) {
|
|
16164
|
+
if (result2.selected === false) continue;
|
|
16165
|
+
const titles = result2.titlePath ?? [];
|
|
16166
|
+
const title = titles.join(" \u203A ");
|
|
16167
|
+
const testFile = result2.file ?? "";
|
|
16168
|
+
const value2 = [SOURCE6, result2.targetId ?? "", testFile, ...titles].join("#");
|
|
16169
|
+
const base = {
|
|
16170
|
+
keys: [{ kind: "path-title", value: value2 }],
|
|
16171
|
+
source: SOURCE6,
|
|
16172
|
+
title,
|
|
16173
|
+
specRef: typeof result2.source?.line === "number" ? `${testFile}:${result2.source.line}` : testFile
|
|
16174
|
+
};
|
|
16175
|
+
const attempts2 = result2.attempts ?? [];
|
|
16176
|
+
if (attempts2.length === 0) {
|
|
16177
|
+
const skip = result2.skip;
|
|
16178
|
+
out.push({
|
|
16179
|
+
...base,
|
|
16180
|
+
resultKey: resultKey(result2.id ?? value2, 0),
|
|
16181
|
+
rawStatus: STATUS[result2.status ?? ""] ?? result2.status ?? "unknown",
|
|
16182
|
+
...skip !== void 0 ? { errorContext: `skipped (${skip.cause ?? "unknown"}): ${skip.reason ?? ""}` } : {}
|
|
16183
|
+
});
|
|
16184
|
+
continue;
|
|
16185
|
+
}
|
|
16186
|
+
for (const attempt of attempts2) {
|
|
16187
|
+
const retry = typeof attempt.index === "number" && attempt.index >= 0 ? attempt.index : 0;
|
|
16188
|
+
const key = resultKey(result2.id ?? value2, retry);
|
|
16189
|
+
const links = [];
|
|
16190
|
+
const kept = [];
|
|
16191
|
+
for (const a of attempt.artifacts ?? []) {
|
|
16192
|
+
if (a.path !== void 0) {
|
|
16193
|
+
const found = resolveAttachment(real, a.path, lexical);
|
|
16194
|
+
if ("file" in found) {
|
|
16195
|
+
kept.push({
|
|
16196
|
+
name: path16.basename(found.file),
|
|
16197
|
+
path: found.file,
|
|
16198
|
+
...a.mediaType ? { contentType: a.mediaType } : {}
|
|
16199
|
+
});
|
|
16200
|
+
} else missing.push({ title, path: a.path, resultKey: key });
|
|
16201
|
+
} else {
|
|
16202
|
+
const url = webLink(a.url);
|
|
16203
|
+
if (url !== void 0)
|
|
16204
|
+
links.push({
|
|
16205
|
+
name: a.kind ?? "artifact",
|
|
16206
|
+
url,
|
|
16207
|
+
...a.mediaType ? { contentType: a.mediaType } : {}
|
|
16208
|
+
});
|
|
16209
|
+
}
|
|
16210
|
+
}
|
|
16211
|
+
const failed2 = {
|
|
16212
|
+
status: attempt.status ?? "unknown",
|
|
16213
|
+
errors: [attempt.error, ...attempt.secondaryErrors ?? []].filter((e) => e !== void 0).map((e) => ({ text: errorText(e) })),
|
|
16214
|
+
// The report's steps are flat; one that did not pass is the chain of the failure.
|
|
16215
|
+
steps: (attempt.steps ?? []).map((s) => ({
|
|
16216
|
+
title: [s.api, s.label].filter((t) => t !== void 0 && t !== "").join(" "),
|
|
16217
|
+
failed: s.status !== void 0 && s.status !== "passed",
|
|
16218
|
+
steps: []
|
|
16219
|
+
})),
|
|
16220
|
+
attachments: kept,
|
|
16221
|
+
testFile
|
|
16222
|
+
};
|
|
16223
|
+
const rawStatus = STATUS[attempt.status ?? ""] ?? attempt.status ?? "unknown";
|
|
16224
|
+
const started = attempt.startedAt !== void 0 ? new Date(attempt.startedAt) : void 0;
|
|
16225
|
+
const durationMs = typeof attempt.durationMs === "number" && attempt.durationMs >= 0 ? attempt.durationMs : 0;
|
|
16226
|
+
const failure2 = rawStatus === "passed" || rawStatus === "skipped" ? void 0 : failureOf(failed2);
|
|
16227
|
+
const files = filesOf(failed2);
|
|
16228
|
+
const context = errorContextFields(failed2);
|
|
16229
|
+
const skipped2 = attempt.skip ?? result2.skip;
|
|
16230
|
+
out.push({
|
|
16231
|
+
...base,
|
|
16232
|
+
resultKey: key,
|
|
16233
|
+
rawStatus,
|
|
16234
|
+
...started !== void 0 && !Number.isNaN(started.getTime()) ? {
|
|
16235
|
+
execution: {
|
|
16236
|
+
startedAt: started.toISOString(),
|
|
16237
|
+
finishedAt: new Date(started.getTime() + durationMs).toISOString(),
|
|
16238
|
+
durationMs,
|
|
16239
|
+
retry
|
|
16240
|
+
}
|
|
16241
|
+
} : {},
|
|
16242
|
+
...rawStatus === "skipped" && skipped2 !== void 0 && context.errorContext === void 0 ? { errorContext: `skipped (${skipped2.cause ?? "unknown"}): ${skipped2.reason ?? ""}` } : context,
|
|
16243
|
+
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
16244
|
+
...files.length > 0 ? { files } : {},
|
|
16245
|
+
...links.length > 0 ? { attachments: links } : {}
|
|
16246
|
+
});
|
|
16247
|
+
}
|
|
16248
|
+
}
|
|
16249
|
+
for (const e of run.errors ?? []) notes.push(`plune: e2e run error ${printable(errorText(e))}`);
|
|
16250
|
+
const carried = run.carried?.results?.length ?? 0;
|
|
16251
|
+
if (carried > 0) {
|
|
16252
|
+
notes.push(
|
|
16253
|
+
`plune: ${carried} ${carried === 1 ? "test" : "tests"} carried from an earlier e2e run ${carried === 1 ? "is" : "are"} not imported: ${carried === 1 ? "it" : "they"} did not run in this one.`
|
|
16254
|
+
);
|
|
16255
|
+
}
|
|
16256
|
+
const tokens2 = run.usage?.modelTokens ?? 0;
|
|
16257
|
+
const cost2 = run.usage?.estimatedCostUsd;
|
|
16258
|
+
if (tokens2 > 0 || cost2 !== void 0) {
|
|
16259
|
+
notes.push(
|
|
16260
|
+
`plune: the e2e run used ${tokens2} model tokens${cost2 !== void 0 ? `, estimated $${cost2}` : ""}; Plune keeps no cost for an imported run, so it is not sent.`
|
|
16261
|
+
);
|
|
16262
|
+
}
|
|
16263
|
+
const vcs = run.vcs;
|
|
16264
|
+
return {
|
|
16265
|
+
results: out,
|
|
16266
|
+
...typeof vcs?.commit === "string" ? {
|
|
16267
|
+
ci: {
|
|
16268
|
+
commitHash: vcs.commit,
|
|
16269
|
+
...vcs.branch !== void 0 ? { branch: vcs.branch } : {}
|
|
16270
|
+
}
|
|
16271
|
+
} : {}
|
|
16272
|
+
};
|
|
16273
|
+
}
|
|
16274
|
+
var path16, SOURCE6, VERSION, STATUS, errorText;
|
|
16275
|
+
var init_e2e_report = __esm({
|
|
16276
|
+
"src/importers/e2e-report.ts"() {
|
|
16277
|
+
"use strict";
|
|
16278
|
+
init_cjs_shims();
|
|
16279
|
+
path16 = __toESM(require("path"), 1);
|
|
16280
|
+
init_failure_detail();
|
|
16281
|
+
init_result_key();
|
|
16282
|
+
init_attachments();
|
|
16283
|
+
init_playwright_json();
|
|
16284
|
+
SOURCE6 = "e2e";
|
|
16285
|
+
VERSION = "report-1";
|
|
16286
|
+
STATUS = {
|
|
16287
|
+
passed: "passed",
|
|
16288
|
+
failed: "failed",
|
|
16289
|
+
// The test gave up, the product did not answer wrongly.
|
|
16290
|
+
"timed-out": "broken",
|
|
16291
|
+
// The run was cut short: nothing was learned about this test.
|
|
16292
|
+
interrupted: "blocked",
|
|
16293
|
+
skipped: "skipped"
|
|
16294
|
+
};
|
|
16295
|
+
errorText = (e) => [e.code, e.message].filter((t) => t !== void 0 && t !== "").join(": ");
|
|
16296
|
+
}
|
|
16297
|
+
});
|
|
16298
|
+
|
|
16126
16299
|
// src/importers/index.ts
|
|
16127
16300
|
var importers_exports = {};
|
|
16128
16301
|
__export(importers_exports, {
|
|
@@ -16139,12 +16312,13 @@ __export(importers_exports, {
|
|
|
16139
16312
|
});
|
|
16140
16313
|
function detectFormat(source, file) {
|
|
16141
16314
|
if (looksLikeJUnit(source)) return "junit";
|
|
16315
|
+
if (looksLikeE2eReport(source)) return "e2e";
|
|
16142
16316
|
const perf = perfFormatOf(source);
|
|
16143
16317
|
if (perf !== void 0) return perf;
|
|
16144
16318
|
if (looksLikePlaywrightJson(source)) return "playwright-json";
|
|
16145
16319
|
throw new UnknownFormatError(
|
|
16146
16320
|
file,
|
|
16147
|
-
'no <testsuite>, no Playwright "suites", no k6 "metrics"
|
|
16321
|
+
'no <testsuite>, no Playwright "suites", no k6 "metrics", no Lighthouse "lighthouseVersion" and no e2e "schemaVersion" \u2014 this is not a report we can read.'
|
|
16148
16322
|
);
|
|
16149
16323
|
}
|
|
16150
16324
|
function perfFormatOf(source) {
|
|
@@ -16160,7 +16334,7 @@ function perfFormatOf(source) {
|
|
|
16160
16334
|
return void 0;
|
|
16161
16335
|
}
|
|
16162
16336
|
function readFolder(dir, format, options = {}) {
|
|
16163
|
-
if (format === "playwright-json" || format === "k6" || format === "lighthouse") {
|
|
16337
|
+
if (format === "playwright-json" || format === "k6" || format === "lighthouse" || format === "e2e") {
|
|
16164
16338
|
throw new UnknownFormatError(dir, `this is a folder, and only allure-results or JUnit XML files are read from one, not ${format}.`);
|
|
16165
16339
|
}
|
|
16166
16340
|
if (options.minScores !== void 0 && Object.keys(options.minScores).length > 0) {
|
|
@@ -16178,7 +16352,7 @@ function readFolder(dir, format, options = {}) {
|
|
|
16178
16352
|
const skipped2 = [];
|
|
16179
16353
|
let reports = 0;
|
|
16180
16354
|
for (const name of namesIn(dir, /\.xml$/)) {
|
|
16181
|
-
const file =
|
|
16355
|
+
const file = path17.join(dir, name);
|
|
16182
16356
|
let source;
|
|
16183
16357
|
try {
|
|
16184
16358
|
source = readReportFile(file);
|
|
@@ -16214,17 +16388,18 @@ function readReport(source, file, format, options = {}) {
|
|
|
16214
16388
|
}
|
|
16215
16389
|
if (chosen2 === "junit") return { format: chosen2, results: readJUnit(source, file, missing, notes), missing, notes };
|
|
16216
16390
|
if (chosen2 === "k6") return { format: chosen2, results: readK6(source, file), missing, notes };
|
|
16391
|
+
if (chosen2 === "e2e") return { format: chosen2, ...readE2eReport(source, file, missing, notes), missing, notes };
|
|
16217
16392
|
if (chosen2 === "lighthouse") {
|
|
16218
16393
|
return { format: chosen2, results: readLighthouse(source, file, options.minScores), missing, notes };
|
|
16219
16394
|
}
|
|
16220
16395
|
return { format: chosen2, ...readPlaywrightJson(source, file, notes), missing, notes };
|
|
16221
16396
|
}
|
|
16222
|
-
var
|
|
16397
|
+
var path17, IMPORT_FORMATS, UnknownFormatError;
|
|
16223
16398
|
var init_importers = __esm({
|
|
16224
16399
|
"src/importers/index.ts"() {
|
|
16225
16400
|
"use strict";
|
|
16226
16401
|
init_cjs_shims();
|
|
16227
|
-
|
|
16402
|
+
path17 = __toESM(require("path"), 1);
|
|
16228
16403
|
init_run_lifecycle();
|
|
16229
16404
|
init_failure_detail();
|
|
16230
16405
|
init_allure();
|
|
@@ -16232,12 +16407,13 @@ var init_importers = __esm({
|
|
|
16232
16407
|
init_playwright_json();
|
|
16233
16408
|
init_k6();
|
|
16234
16409
|
init_lighthouse();
|
|
16410
|
+
init_e2e_report();
|
|
16235
16411
|
init_read_file();
|
|
16236
16412
|
init_xml();
|
|
16237
16413
|
init_playwright_json();
|
|
16238
16414
|
init_allure();
|
|
16239
16415
|
init_read_file();
|
|
16240
|
-
IMPORT_FORMATS = ["junit", "playwright-json", "allure", "k6", "lighthouse"];
|
|
16416
|
+
IMPORT_FORMATS = ["junit", "playwright-json", "allure", "k6", "lighthouse", "e2e"];
|
|
16241
16417
|
UnknownFormatError = class extends Error {
|
|
16242
16418
|
constructor(file, detail) {
|
|
16243
16419
|
super(`${file} \u2014 ${detail} Say which with --format ${IMPORT_FORMATS.join(" | ")}.`);
|
|
@@ -16322,7 +16498,7 @@ async function handleRunImport(options) {
|
|
|
16322
16498
|
}
|
|
16323
16499
|
for (const m of missing) write(`plune: attachment not found \u2014 ${JSON.stringify(printable(m.title))}: ${printable(m.path)}`);
|
|
16324
16500
|
for (const note2 of notes) write(note2);
|
|
16325
|
-
const announced = (format === "junit" || format === "allure") && (missing.length > 0 || results4.some((r) => (r.files?.length ?? 0) > 0));
|
|
16501
|
+
const announced = (format === "junit" || format === "allure" || format === "e2e") && (missing.length > 0 || results4.some((r) => (r.files?.length ?? 0) > 0));
|
|
16326
16502
|
const env = readEnv();
|
|
16327
16503
|
if (failuresOnly === true && env.config.full === true) {
|
|
16328
16504
|
write("plune: a failures-only report is not the list of what ran \u2014 PLUNE_FULL_RUN is ignored for it, so no case is detached.");
|
|
@@ -16424,7 +16600,7 @@ function describe(result2, apiUrl) {
|
|
|
16424
16600
|
// worked.
|
|
16425
16601
|
// `not delivered` always, zero included: a number that only appears when it is bad is one
|
|
16426
16602
|
// nobody learns to look for. The `[0-9]+ unmatched` the workflows read stays whole.
|
|
16427
|
-
`Read ${result2.parsed} result(s) from ${result2.format === "allure" ? "an" : "a"} ${result2.format} report: ${result2.accepted} accepted, ${result2.duplicate} already there, ${result2.unresolved} unmatched, ${result2.deferred} not delivered.`
|
|
16603
|
+
`Read ${result2.parsed} result(s) from ${result2.format === "allure" || result2.format === "e2e" ? "an" : "a"} ${result2.format} report: ${result2.accepted} accepted, ${result2.duplicate} already there, ${result2.unresolved} unmatched, ${result2.deferred} not delivered.`
|
|
16428
16604
|
];
|
|
16429
16605
|
if (result2.conflict > 0 || result2.rejected > 0) {
|
|
16430
16606
|
lines.push(`${result2.conflict} conflicted and ${result2.rejected} were refused.`);
|
|
@@ -16503,7 +16679,7 @@ function isRunResult(v) {
|
|
|
16503
16679
|
}
|
|
16504
16680
|
function handleReport(opts = {}) {
|
|
16505
16681
|
const cwd = opts.cwd ?? process.cwd();
|
|
16506
|
-
const file =
|
|
16682
|
+
const file = path18.join(cwd, ".plune", "last-run.json");
|
|
16507
16683
|
let raw;
|
|
16508
16684
|
try {
|
|
16509
16685
|
raw = fs14.readFileSync(file, "utf8");
|
|
@@ -16521,13 +16697,13 @@ function handleReport(opts = {}) {
|
|
|
16521
16697
|
}
|
|
16522
16698
|
return parsed4;
|
|
16523
16699
|
}
|
|
16524
|
-
var fs14,
|
|
16700
|
+
var fs14, path18, ReportNotFoundError;
|
|
16525
16701
|
var init_report2 = __esm({
|
|
16526
16702
|
"src/cli/commands/report.ts"() {
|
|
16527
16703
|
"use strict";
|
|
16528
16704
|
init_cjs_shims();
|
|
16529
16705
|
fs14 = __toESM(require("fs"), 1);
|
|
16530
|
-
|
|
16706
|
+
path18 = __toESM(require("path"), 1);
|
|
16531
16707
|
ReportNotFoundError = class extends Error {
|
|
16532
16708
|
code = "NO_SAVED_RUN";
|
|
16533
16709
|
constructor(message2) {
|
|
@@ -17491,7 +17667,7 @@ function number(flag2, raw, min, max) {
|
|
|
17491
17667
|
function readRun2(cwd, file) {
|
|
17492
17668
|
let text6;
|
|
17493
17669
|
try {
|
|
17494
|
-
text6 = fs16.readFileSync(
|
|
17670
|
+
text6 = fs16.readFileSync(path19.resolve(cwd, file), "utf8");
|
|
17495
17671
|
} catch {
|
|
17496
17672
|
throw new JudgeCheckError(`cannot read the run ${file}: run "plune run" first, or name one with --run`);
|
|
17497
17673
|
}
|
|
@@ -17502,13 +17678,13 @@ function readRun2(cwd, file) {
|
|
|
17502
17678
|
}
|
|
17503
17679
|
}
|
|
17504
17680
|
async function handleJudgeCheck(labelsFile, flags2, cwd, write) {
|
|
17505
|
-
const run = readRun2(cwd, flags2.run ??
|
|
17506
|
-
const target4 =
|
|
17681
|
+
const run = readRun2(cwd, flags2.run ?? path19.join(".plune", "last-run.json"));
|
|
17682
|
+
const target4 = path19.resolve(cwd, labelsFile);
|
|
17507
17683
|
if (flags2.init === true) {
|
|
17508
17684
|
if (!flags2.force && fs16.existsSync(target4))
|
|
17509
17685
|
throw new JudgeCheckError(`${labelsFile} exists: it may hold labels; --force writes over it`);
|
|
17510
17686
|
const text7 = labelTemplate(run, flags2.eval);
|
|
17511
|
-
fs16.mkdirSync(
|
|
17687
|
+
fs16.mkdirSync(path19.dirname(target4), { recursive: true });
|
|
17512
17688
|
fs16.writeFileSync(target4, text7, "utf8");
|
|
17513
17689
|
const n = text7 === "" ? 0 : text7.split("\n").length - 1;
|
|
17514
17690
|
write(
|
|
@@ -17538,13 +17714,13 @@ async function handleJudgeCheck(labelsFile, flags2, cwd, write) {
|
|
|
17538
17714
|
write(formatJudgeCheck(report, options.minKappa));
|
|
17539
17715
|
return report.exitCode;
|
|
17540
17716
|
}
|
|
17541
|
-
var fs16,
|
|
17717
|
+
var fs16, path19;
|
|
17542
17718
|
var init_judge_check = __esm({
|
|
17543
17719
|
"src/cli/commands/judge-check.ts"() {
|
|
17544
17720
|
"use strict";
|
|
17545
17721
|
init_cjs_shims();
|
|
17546
17722
|
fs16 = __toESM(require("fs"), 1);
|
|
17547
|
-
|
|
17723
|
+
path19 = __toESM(require("path"), 1);
|
|
17548
17724
|
init_check();
|
|
17549
17725
|
init_labels();
|
|
17550
17726
|
init_run_result_schema();
|
|
@@ -17589,7 +17765,7 @@ async function runInitWizard(cwd) {
|
|
|
17589
17765
|
process.exit(1);
|
|
17590
17766
|
return;
|
|
17591
17767
|
}
|
|
17592
|
-
const outputPath =
|
|
17768
|
+
const outputPath = path20.join(cwd, "plune.yaml");
|
|
17593
17769
|
if (fs17.existsSync(outputPath)) {
|
|
17594
17770
|
const overwrite = await clack.confirm({
|
|
17595
17771
|
message: "plune.yaml already exists. Overwrite?"
|
|
@@ -17634,14 +17810,14 @@ async function runInitWizard(cwd) {
|
|
|
17634
17810
|
spin.stop("plune.yaml created!");
|
|
17635
17811
|
clack.outro("plune.yaml is ready.");
|
|
17636
17812
|
}
|
|
17637
|
-
var clack, fs17,
|
|
17813
|
+
var clack, fs17, path20, import_yaml4;
|
|
17638
17814
|
var init_wizard = __esm({
|
|
17639
17815
|
"src/config/init/wizard.ts"() {
|
|
17640
17816
|
"use strict";
|
|
17641
17817
|
init_cjs_shims();
|
|
17642
17818
|
clack = __toESM(require("@clack/prompts"), 1);
|
|
17643
17819
|
fs17 = __toESM(require("fs"), 1);
|
|
17644
|
-
|
|
17820
|
+
path20 = __toESM(require("path"), 1);
|
|
17645
17821
|
import_yaml4 = require("yaml");
|
|
17646
17822
|
init_errors();
|
|
17647
17823
|
}
|
|
@@ -17649,21 +17825,21 @@ var init_wizard = __esm({
|
|
|
17649
17825
|
|
|
17650
17826
|
// src/cli/templates/index.ts
|
|
17651
17827
|
function writeTemplateFile(cwd, rel, content, force) {
|
|
17652
|
-
const target4 =
|
|
17828
|
+
const target4 = path21.join(cwd, rel);
|
|
17653
17829
|
if (!force && fs18.existsSync(target4)) {
|
|
17654
17830
|
return "skipped";
|
|
17655
17831
|
}
|
|
17656
|
-
fs18.mkdirSync(
|
|
17832
|
+
fs18.mkdirSync(path21.dirname(target4), { recursive: true });
|
|
17657
17833
|
fs18.writeFileSync(target4, content, "utf8");
|
|
17658
17834
|
return "written";
|
|
17659
17835
|
}
|
|
17660
|
-
var fs18,
|
|
17836
|
+
var fs18, path21, PROVIDER_KEY_VARS, ENV_EXAMPLE_TPL, EXAMPLE_JSONL_TPL, PLUNE_YAML_TPL;
|
|
17661
17837
|
var init_templates = __esm({
|
|
17662
17838
|
"src/cli/templates/index.ts"() {
|
|
17663
17839
|
"use strict";
|
|
17664
17840
|
init_cjs_shims();
|
|
17665
17841
|
fs18 = __toESM(require("fs"), 1);
|
|
17666
|
-
|
|
17842
|
+
path21 = __toESM(require("path"), 1);
|
|
17667
17843
|
PROVIDER_KEY_VARS = {
|
|
17668
17844
|
anthropic: "ANTHROPIC_API_KEY",
|
|
17669
17845
|
openai: "OPENAI_API_KEY",
|
|
@@ -17984,12 +18160,12 @@ function convertOpenAiEval({ evalObject, run, rows }) {
|
|
|
17984
18160
|
let dataset;
|
|
17985
18161
|
let datasetField;
|
|
17986
18162
|
if (items2 !== void 0 && items2.length > 0) {
|
|
17987
|
-
const
|
|
18163
|
+
const path29 = `datasets/${id2}.jsonl`;
|
|
17988
18164
|
dataset = {
|
|
17989
|
-
path:
|
|
18165
|
+
path: path29,
|
|
17990
18166
|
jsonl: convertRows(items2, report).map((r) => JSON.stringify(r)).join("\n") + "\n"
|
|
17991
18167
|
};
|
|
17992
|
-
datasetField = `./${
|
|
18168
|
+
datasetField = `./${path29}`;
|
|
17993
18169
|
} else {
|
|
17994
18170
|
const vars = Object.fromEntries([...seen].sort().map((n) => [n, "replace me"]));
|
|
17995
18171
|
datasetField = { examples: [{ vars }] };
|
|
@@ -18076,7 +18252,7 @@ function nextSteps(keyVar) {
|
|
|
18076
18252
|
}
|
|
18077
18253
|
function keyVarOf(cwd) {
|
|
18078
18254
|
try {
|
|
18079
|
-
const cfg = (0, import_yaml6.parse)(fs19.readFileSync(
|
|
18255
|
+
const cfg = (0, import_yaml6.parse)(fs19.readFileSync(path22.join(cwd, "plune.yaml"), "utf8"));
|
|
18080
18256
|
const type = cfg?.provider?.type;
|
|
18081
18257
|
return typeof type === "string" && Object.hasOwn(PROVIDER_KEY_VARS, type) ? PROVIDER_KEY_VARS[type] : void 0;
|
|
18082
18258
|
} catch {
|
|
@@ -18088,7 +18264,7 @@ async function initFromOpenAiEval(options) {
|
|
|
18088
18264
|
const { convertOpenAiEval: convertOpenAiEval2, formatReport: formatReport4, OpenAiEvalImportError: OpenAiEvalImportError2 } = await Promise.resolve().then(() => (init_from_openai_eval(), from_openai_eval_exports));
|
|
18089
18265
|
const read = (file) => {
|
|
18090
18266
|
try {
|
|
18091
|
-
return fs19.readFileSync(
|
|
18267
|
+
return fs19.readFileSync(path22.resolve(cwd, file), "utf8").replace(/^/, "");
|
|
18092
18268
|
} catch (err) {
|
|
18093
18269
|
throw new OpenAiEvalImportError2(`cannot read ${file}: ${err.message}`);
|
|
18094
18270
|
}
|
|
@@ -18127,13 +18303,13 @@ async function initCommand({ cwd, force, yes = false }) {
|
|
|
18127
18303
|
}
|
|
18128
18304
|
process.stdout.write(nextSteps(keyVarOf(cwd)));
|
|
18129
18305
|
}
|
|
18130
|
-
var fs19,
|
|
18306
|
+
var fs19, path22, import_yaml6, TEMPLATES;
|
|
18131
18307
|
var init_init = __esm({
|
|
18132
18308
|
"src/cli/commands/init.ts"() {
|
|
18133
18309
|
"use strict";
|
|
18134
18310
|
init_cjs_shims();
|
|
18135
18311
|
fs19 = __toESM(require("fs"), 1);
|
|
18136
|
-
|
|
18312
|
+
path22 = __toESM(require("path"), 1);
|
|
18137
18313
|
import_yaml6 = require("yaml");
|
|
18138
18314
|
init_wizard();
|
|
18139
18315
|
init_templates();
|
|
@@ -18999,7 +19175,7 @@ function createPluneToolExecutor(opts) {
|
|
|
18999
19175
|
},
|
|
19000
19176
|
async plune_get(i) {
|
|
19001
19177
|
const route = { "test-case": "/v1/test-cases/:id", run: "/v1/runs/:id", "review-item": "/v1/review-items/:id" }[str2(i["kind"])];
|
|
19002
|
-
const res = await call2({ method: "GET", path:
|
|
19178
|
+
const res = await call2({ method: "GET", path: path23(route, str2(i["id"])) });
|
|
19003
19179
|
return { kind: str2(i["kind"]), item: asRecord(res.body) };
|
|
19004
19180
|
},
|
|
19005
19181
|
async plune_cases_search(i) {
|
|
@@ -19069,12 +19245,12 @@ function createPluneToolExecutor(opts) {
|
|
|
19069
19245
|
const { dry_run, projectId: projectId2, ...body } = i;
|
|
19070
19246
|
const project = projectId2 ?? opts.projectId;
|
|
19071
19247
|
if (project === void 0) return fail2("invalid_input", NO_PROJECT);
|
|
19072
|
-
return write({ method: "POST", path:
|
|
19248
|
+
return write({ method: "POST", path: path23("/v1/projects/:id/case-generations", project), body: withoutUndefined(body) }, dry_run);
|
|
19073
19249
|
},
|
|
19074
19250
|
async plune_cases_generation_get(i) {
|
|
19075
19251
|
const project = i["projectId"] ?? opts.projectId;
|
|
19076
19252
|
if (project === void 0) return fail2("invalid_input", NO_PROJECT);
|
|
19077
|
-
const res = await call2({ method: "GET", path:
|
|
19253
|
+
const res = await call2({ method: "GET", path: path23("/v1/projects/:id/case-generations/:generationId", project, str2(i["generationId"])) });
|
|
19078
19254
|
return { generation: asRecord(res.body) };
|
|
19079
19255
|
},
|
|
19080
19256
|
async plune_mission_create(i) {
|
|
@@ -19082,18 +19258,18 @@ function createPluneToolExecutor(opts) {
|
|
|
19082
19258
|
return write({ method: "POST", path: "/v1/missions", body: withoutUndefined(body) }, dry_run);
|
|
19083
19259
|
},
|
|
19084
19260
|
async plune_mission_get(i) {
|
|
19085
|
-
const res = await call2({ method: "GET", path:
|
|
19261
|
+
const res = await call2({ method: "GET", path: path23("/v1/missions/:id", str2(i["missionId"])) });
|
|
19086
19262
|
return { mission: asRecord(res.body) };
|
|
19087
19263
|
},
|
|
19088
19264
|
async plune_mission_update(i) {
|
|
19089
19265
|
const { dry_run, missionId: missionId2, ...body } = i;
|
|
19090
|
-
return write({ method: "PATCH", path:
|
|
19266
|
+
return write({ method: "PATCH", path: path23("/v1/missions/:id", str2(missionId2)), body: withoutUndefined(body) }, dry_run);
|
|
19091
19267
|
},
|
|
19092
19268
|
async plune_source_add(i) {
|
|
19093
19269
|
const parsed4 = (i["kind"] === "file" ? fileSource : linkSource).safeParse(withoutUndefined(i));
|
|
19094
19270
|
if (!parsed4.success) return fail2("invalid_input", `The input does not fit: ${zodMessage(parsed4.error)}`);
|
|
19095
19271
|
const { dry_run, missionId: missionId2, kind: kind2, ...rest } = parsed4.data;
|
|
19096
|
-
const req = kind2 === "file" ? { method: "POST", path:
|
|
19272
|
+
const req = kind2 === "file" ? { method: "POST", path: path23("/v1/missions/:id/files", str2(missionId2)), body: withoutUndefined(rest) } : { method: "POST", path: path23("/v1/missions/:id/sources", str2(missionId2)), body: withoutUndefined({ kind: kind2, ...rest }) };
|
|
19097
19273
|
return write(req, dry_run);
|
|
19098
19274
|
},
|
|
19099
19275
|
async plune_question_ask(i) {
|
|
@@ -19115,7 +19291,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19115
19291
|
return { questions, nextCursor: cursorOf(body["nextCursor"]) };
|
|
19116
19292
|
},
|
|
19117
19293
|
async plune_strategy_propose(i) {
|
|
19118
|
-
const req = { method: "POST", path:
|
|
19294
|
+
const req = { method: "POST", path: path23("/v1/missions/:id/strategy", str2(i["missionId"])), body: i["content"] };
|
|
19119
19295
|
if (i["dry_run"] === true) {
|
|
19120
19296
|
try {
|
|
19121
19297
|
const res = await call2({ ...req, path: `${req.path}/check` });
|
|
@@ -19125,10 +19301,10 @@ function createPluneToolExecutor(opts) {
|
|
|
19125
19301
|
return { dryRun: true, checked: false, request: planned(req) };
|
|
19126
19302
|
}
|
|
19127
19303
|
}
|
|
19128
|
-
return write({ method: "POST", path:
|
|
19304
|
+
return write({ method: "POST", path: path23("/v1/missions/:id/strategy", str2(i["missionId"])), body: i["content"] }, i["dry_run"]);
|
|
19129
19305
|
},
|
|
19130
19306
|
async plune_report_request(i) {
|
|
19131
|
-
return write({ method: "POST", path:
|
|
19307
|
+
return write({ method: "POST", path: path23("/v1/missions/:id/report", str2(i["missionId"])), body: {} }, i["dry_run"]);
|
|
19132
19308
|
},
|
|
19133
19309
|
async plune_discover_tools(i) {
|
|
19134
19310
|
const names = i["names"] ?? [];
|
|
@@ -19154,7 +19330,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19154
19330
|
async plune_cases_update(i) {
|
|
19155
19331
|
const cases = i["cases"];
|
|
19156
19332
|
return batch(
|
|
19157
|
-
cases.map((c) => ({ method: "PATCH", path:
|
|
19333
|
+
cases.map((c) => ({ method: "PATCH", path: path23("/v1/test-cases/:id", c.id), body: c.changes })),
|
|
19158
19334
|
i["dry_run"],
|
|
19159
19335
|
(_b, n) => cases[n]?.id
|
|
19160
19336
|
);
|
|
@@ -19166,7 +19342,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19166
19342
|
const results4 = i["results"];
|
|
19167
19343
|
const req = {
|
|
19168
19344
|
method: "POST",
|
|
19169
|
-
path:
|
|
19345
|
+
path: path23("/v1/runs/:id/results", str2(i["runId"])),
|
|
19170
19346
|
body: withoutUndefined({ results: results4, combination: i["combination"], configuration: i["configuration"] })
|
|
19171
19347
|
};
|
|
19172
19348
|
if (i["dry_run"] === true) return { dryRun: true, requested: results4.length, applied: 0, requests: [planned(req)] };
|
|
@@ -19242,7 +19418,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19242
19418
|
}
|
|
19243
19419
|
};
|
|
19244
19420
|
}
|
|
19245
|
-
var import_node_crypto6, import_zod7, CONFIRM_TTL_MS, READ_ONLY_REFUSAL, NO_PROJECT, readScopeMessage, switchedOffMessage, fail2, zodMessage,
|
|
19421
|
+
var import_node_crypto6, import_zod7, CONFIRM_TTL_MS, READ_ONLY_REFUSAL, NO_PROJECT, readScopeMessage, switchedOffMessage, fail2, zodMessage, path23, withoutUndefined, asRecord, asArray, cursorOf, rawWrites;
|
|
19246
19422
|
var init_execute = __esm({
|
|
19247
19423
|
"src/mcp-tools/execute.ts"() {
|
|
19248
19424
|
"use strict";
|
|
@@ -19262,7 +19438,7 @@ var init_execute = __esm({
|
|
|
19262
19438
|
error: { code, message: message2, ...extra }
|
|
19263
19439
|
});
|
|
19264
19440
|
zodMessage = (error) => error.issues.map((i) => `${i.path.join(".") || "(input)"}: ${i.message}`).join("; ");
|
|
19265
|
-
|
|
19441
|
+
path23 = (template, ...ids) => {
|
|
19266
19442
|
let i = 0;
|
|
19267
19443
|
return template.replace(/:[a-z]+/gi, () => encodeURIComponent(ids[i++] ?? ""));
|
|
19268
19444
|
};
|
|
@@ -19699,7 +19875,7 @@ function healthSteps(session2, opts, found) {
|
|
|
19699
19875
|
};
|
|
19700
19876
|
return [protocolVersion, capabilities2, ...lists2, ping];
|
|
19701
19877
|
}
|
|
19702
|
-
function
|
|
19878
|
+
function errorText2(result2) {
|
|
19703
19879
|
const blocks = Array.isArray(result2.content) ? result2.content : [];
|
|
19704
19880
|
const text6 = blocks.flatMap(
|
|
19705
19881
|
(b) => isRecord9(b) && b.type === "text" && typeof b.text === "string" ? [b.text] : []
|
|
@@ -19717,7 +19893,7 @@ function smokeSteps(session2, items2, opts) {
|
|
|
19717
19893
|
const answer = await callTool(session2, tool2.name, opts.timeoutMs);
|
|
19718
19894
|
switch (answer.kind) {
|
|
19719
19895
|
case "result":
|
|
19720
|
-
return isRecord9(answer.result) && answer.result.isError === true ? { state: "failed", detail: `isError: ${
|
|
19896
|
+
return isRecord9(answer.result) && answer.result.isError === true ? { state: "failed", detail: `isError: ${errorText2(answer.result)}` } : { state: "passed", detail: "answered without isError" };
|
|
19721
19897
|
case "error":
|
|
19722
19898
|
return { state: "failed", detail: `a JSON-RPC error: ${answer.message}` };
|
|
19723
19899
|
case "timeout":
|
|
@@ -20267,13 +20443,13 @@ async function lint(flags2, server2, io, rawOut) {
|
|
|
20267
20443
|
}
|
|
20268
20444
|
function readExceptions(flag2, io) {
|
|
20269
20445
|
const name = flag2 ?? DEFAULT_IGNORE_FILE;
|
|
20270
|
-
const
|
|
20271
|
-
if (!(0, import_node_fs12.existsSync)(
|
|
20446
|
+
const path29 = (0, import_node_path7.resolve)(io.cwd, name);
|
|
20447
|
+
if (!(0, import_node_fs12.existsSync)(path29)) {
|
|
20272
20448
|
if (flag2 !== void 0) throw new UsageError(`--ignore-file: ${name} does not exist.`);
|
|
20273
20449
|
return void 0;
|
|
20274
20450
|
}
|
|
20275
20451
|
const today = io.today ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
20276
|
-
return { name, ...parseExceptionsFile((0, import_node_fs12.readFileSync)(
|
|
20452
|
+
return { name, ...parseExceptionsFile((0, import_node_fs12.readFileSync)(path29, "utf8"), name, today) };
|
|
20277
20453
|
}
|
|
20278
20454
|
async function listTools(session2) {
|
|
20279
20455
|
try {
|
|
@@ -20820,14 +20996,14 @@ async function listAll2(session2, method, key) {
|
|
|
20820
20996
|
}
|
|
20821
20997
|
return listing.items;
|
|
20822
20998
|
}
|
|
20823
|
-
function writeAtomically(
|
|
20999
|
+
function writeAtomically(path29, text6, shown4, flag2 = "--out") {
|
|
20824
21000
|
const temporary = (0, import_node_path8.join)(
|
|
20825
|
-
(0, import_node_path8.dirname)(
|
|
20826
|
-
`.${(0, import_node_path8.basename)(
|
|
21001
|
+
(0, import_node_path8.dirname)(path29),
|
|
21002
|
+
`.${(0, import_node_path8.basename)(path29)}.${process.pid}.${(0, import_node_crypto7.randomBytes)(4).toString("hex")}.tmp`
|
|
20827
21003
|
);
|
|
20828
21004
|
try {
|
|
20829
21005
|
(0, import_node_fs13.writeFileSync)(temporary, text6, { flag: "wx" });
|
|
20830
|
-
(0, import_node_fs13.renameSync)(temporary,
|
|
21006
|
+
(0, import_node_fs13.renameSync)(temporary, path29);
|
|
20831
21007
|
} catch (err) {
|
|
20832
21008
|
(0, import_node_fs13.rmSync)(temporary, { force: true });
|
|
20833
21009
|
const code = err.code ?? "an error";
|
|
@@ -21041,23 +21217,23 @@ function visible(s, max = EXCERPT) {
|
|
|
21041
21217
|
}
|
|
21042
21218
|
function descriptionTexts(snapshot) {
|
|
21043
21219
|
const out = [];
|
|
21044
|
-
const add = (surface,
|
|
21045
|
-
if (typeof v === "string" && v !== "") out.push({ pointer: pointerOf(
|
|
21220
|
+
const add = (surface, path29, v, key = false, stringParam = false) => {
|
|
21221
|
+
if (typeof v === "string" && v !== "") out.push({ pointer: pointerOf(path29), surface, text: v, key, stringParam });
|
|
21046
21222
|
};
|
|
21047
|
-
const schema = (
|
|
21048
|
-
if (typeof node === "string") add("tools",
|
|
21049
|
-
else if (Array.isArray(node)) node.forEach((v, i) => schema([...
|
|
21223
|
+
const schema = (path29, node) => {
|
|
21224
|
+
if (typeof node === "string") add("tools", path29, node);
|
|
21225
|
+
else if (Array.isArray(node)) node.forEach((v, i) => schema([...path29, i], v));
|
|
21050
21226
|
else if (isRecord12(node)) {
|
|
21051
|
-
const param =
|
|
21227
|
+
const param = path29.at(-2) === "properties" && hasStringType(node);
|
|
21052
21228
|
for (const [k, v] of Object.entries(node)) {
|
|
21053
|
-
add("tools", [...
|
|
21054
|
-
if (k === "description" && typeof v === "string") add("tools", [...
|
|
21055
|
-
else schema([...
|
|
21229
|
+
add("tools", [...path29, k], k, true);
|
|
21230
|
+
if (k === "description" && typeof v === "string") add("tools", [...path29, k], v, false, param);
|
|
21231
|
+
else schema([...path29, k], v);
|
|
21056
21232
|
}
|
|
21057
21233
|
}
|
|
21058
21234
|
};
|
|
21059
|
-
const fields = (surface,
|
|
21060
|
-
if (isRecord12(entity2)) for (const f of names) add(surface, [...
|
|
21235
|
+
const fields = (surface, path29, entity2, names) => {
|
|
21236
|
+
if (isRecord12(entity2)) for (const f of names) add(surface, [...path29, f], entity2[f]);
|
|
21061
21237
|
};
|
|
21062
21238
|
add("instructions", ["instructions"], snapshot.instructions);
|
|
21063
21239
|
snapshot.tools?.forEach((t, i) => {
|
|
@@ -21318,7 +21494,7 @@ var init_descriptions = __esm({
|
|
|
21318
21494
|
U = (cp) => `U+${cp.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
21319
21495
|
SHOWN = /^[\p{L}\p{N}\p{P}\p{S} ]$/u;
|
|
21320
21496
|
segment2 = (s) => typeof s === "number" ? String(s) : visible(s.replace(/~/g, "~0").replace(/\//g, "~1"), Infinity);
|
|
21321
|
-
pointerOf = (
|
|
21497
|
+
pointerOf = (path29) => `/${path29.map(segment2).join("/")}`;
|
|
21322
21498
|
hasStringType = (schema) => schema["type"] === "string" || Array.isArray(schema["type"]) && schema["type"].includes("string");
|
|
21323
21499
|
NAMES = {
|
|
21324
21500
|
8234: "left-to-right embedding",
|
|
@@ -21715,14 +21891,14 @@ ${err.stderrTail.map((l) => ` ${l}
|
|
|
21715
21891
|
throw err;
|
|
21716
21892
|
}
|
|
21717
21893
|
}
|
|
21718
|
-
function readLock(
|
|
21719
|
-
if (!(0, import_node_fs15.existsSync)(
|
|
21894
|
+
function readLock(path29, name, required) {
|
|
21895
|
+
if (!(0, import_node_fs15.existsSync)(path29)) {
|
|
21720
21896
|
if (required) throw new UsageError(`${name} does not exist; pin the server first with plune mcp pin.`);
|
|
21721
21897
|
return emptyLock();
|
|
21722
21898
|
}
|
|
21723
21899
|
let text6;
|
|
21724
21900
|
try {
|
|
21725
|
-
text6 = (0, import_node_fs15.readFileSync)(
|
|
21901
|
+
text6 = (0, import_node_fs15.readFileSync)(path29, "utf8");
|
|
21726
21902
|
} catch (err) {
|
|
21727
21903
|
throw new UsageError(`${name}: cannot be read (${err.code ?? "an error"}).`);
|
|
21728
21904
|
}
|
|
@@ -22215,14 +22391,14 @@ var init_raw_http = __esm({
|
|
|
22215
22391
|
});
|
|
22216
22392
|
|
|
22217
22393
|
// src/mcp-testing/conformance/checks/modern/meta.ts
|
|
22218
|
-
function headerMarks(schema,
|
|
22219
|
-
if (Array.isArray(schema)) return schema.flatMap((s, i) => headerMarks(s, [...
|
|
22394
|
+
function headerMarks(schema, path29 = [], inNames = false) {
|
|
22395
|
+
if (Array.isArray(schema)) return schema.flatMap((s, i) => headerMarks(s, [...path29, String(i)]));
|
|
22220
22396
|
if (!isRecord15(schema)) return [];
|
|
22221
22397
|
const marks = [];
|
|
22222
|
-
if (!inNames && "x-mcp-header" in schema) marks.push({ path:
|
|
22398
|
+
if (!inNames && "x-mcp-header" in schema) marks.push({ path: path29, value: schema["x-mcp-header"], schema });
|
|
22223
22399
|
for (const [k, v] of Object.entries(schema)) {
|
|
22224
22400
|
if (!inNames && k === "x-mcp-header") continue;
|
|
22225
|
-
marks.push(...headerMarks(v, [...
|
|
22401
|
+
marks.push(...headerMarks(v, [...path29, k], !inNames && k === "properties"));
|
|
22226
22402
|
}
|
|
22227
22403
|
return marks;
|
|
22228
22404
|
}
|
|
@@ -22259,7 +22435,7 @@ var init_meta = __esm({
|
|
|
22259
22435
|
[META.capabilities]: {}
|
|
22260
22436
|
});
|
|
22261
22437
|
isRecord15 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
22262
|
-
staticallyReachable = (
|
|
22438
|
+
staticallyReachable = (path29) => path29.length > 0 && path29.length % 2 === 0 && path29.every((k, i) => i % 2 === 1 || k === "properties");
|
|
22263
22439
|
}
|
|
22264
22440
|
});
|
|
22265
22441
|
|
|
@@ -22567,8 +22743,8 @@ function discoverPrm(ctx, challenge) {
|
|
|
22567
22743
|
return prm;
|
|
22568
22744
|
}
|
|
22569
22745
|
}
|
|
22570
|
-
const
|
|
22571
|
-
const urls = [.../* @__PURE__ */ new Set([`${url.origin}${WK_PRM}${
|
|
22746
|
+
const path29 = url.pathname === "/" ? "" : url.pathname.replace(/\/$/, "");
|
|
22747
|
+
const urls = [.../* @__PURE__ */ new Set([`${url.origin}${WK_PRM}${path29}`, `${url.origin}${WK_PRM}`])];
|
|
22572
22748
|
for (const u of urls) {
|
|
22573
22749
|
const got2 = await getJson(ctx, u);
|
|
22574
22750
|
prm.wellKnown.push(got2);
|
|
@@ -22588,14 +22764,14 @@ function discoverAs(ctx, issuer) {
|
|
|
22588
22764
|
} catch {
|
|
22589
22765
|
return { issuer, tried: [wrong(issuer, "it is not an absolute URL")], found: void 0 };
|
|
22590
22766
|
}
|
|
22591
|
-
const
|
|
22592
|
-
const urls =
|
|
22767
|
+
const path29 = u.pathname === "/" ? "" : u.pathname.replace(/\/$/, "");
|
|
22768
|
+
const urls = path29 === "" ? [
|
|
22593
22769
|
`${u.origin}/.well-known/oauth-authorization-server`,
|
|
22594
22770
|
`${u.origin}/.well-known/openid-configuration`
|
|
22595
22771
|
] : [
|
|
22596
|
-
`${u.origin}/.well-known/oauth-authorization-server${
|
|
22597
|
-
`${u.origin}/.well-known/openid-configuration${
|
|
22598
|
-
`${u.origin}${
|
|
22772
|
+
`${u.origin}/.well-known/oauth-authorization-server${path29}`,
|
|
22773
|
+
`${u.origin}/.well-known/openid-configuration${path29}`,
|
|
22774
|
+
`${u.origin}${path29}/.well-known/openid-configuration`
|
|
22599
22775
|
];
|
|
22600
22776
|
const as = { issuer, tried: [], found: void 0 };
|
|
22601
22777
|
for (const url of urls) {
|
|
@@ -32292,19 +32468,19 @@ function parseOauthConfig(source, format = "json") {
|
|
|
32292
32468
|
}
|
|
32293
32469
|
return config;
|
|
32294
32470
|
}
|
|
32295
|
-
function loadOauthConfig(
|
|
32471
|
+
function loadOauthConfig(path29) {
|
|
32296
32472
|
let source;
|
|
32297
32473
|
try {
|
|
32298
|
-
if ((0, import_node_fs16.statSync)(
|
|
32299
|
-
source = (0, import_node_fs16.readFileSync)(
|
|
32474
|
+
if ((0, import_node_fs16.statSync)(path29).size > MAX_CONFIG_BYTES) throw new UsageError(tooLarge());
|
|
32475
|
+
source = (0, import_node_fs16.readFileSync)(path29, "utf8");
|
|
32300
32476
|
} catch (err) {
|
|
32301
32477
|
if (err instanceof UsageError) throw err;
|
|
32302
32478
|
const code = err.code;
|
|
32303
32479
|
throw new UsageError(
|
|
32304
|
-
`--config: could not read ${
|
|
32480
|
+
`--config: could not read ${path29}${code === void 0 ? "" : ` (${code})`}.`
|
|
32305
32481
|
);
|
|
32306
32482
|
}
|
|
32307
|
-
return parseOauthConfig(source, /\.ya?ml$/i.test(
|
|
32483
|
+
return parseOauthConfig(source, /\.ya?ml$/i.test(path29) ? "yaml" : "json");
|
|
32308
32484
|
}
|
|
32309
32485
|
var import_node_fs16, import_yaml8, TOP, REGISTRATION2, METHODS, MODES, SECRET_KEY2, ENV_NAME, isObject7, MAX_CONFIG_BYTES, tooLarge;
|
|
32310
32486
|
var init_auth_config = __esm({
|
|
@@ -32361,13 +32537,13 @@ var mcp_conformance_exports = {};
|
|
|
32361
32537
|
__export(mcp_conformance_exports, {
|
|
32362
32538
|
handleMcpConformance: () => handleMcpConformance
|
|
32363
32539
|
});
|
|
32364
|
-
function loadFixture(
|
|
32540
|
+
function loadFixture(path29) {
|
|
32365
32541
|
let doc;
|
|
32366
32542
|
try {
|
|
32367
|
-
doc = JSON.parse((0, import_node_fs17.readFileSync)(
|
|
32543
|
+
doc = JSON.parse((0, import_node_fs17.readFileSync)(path29, "utf8"));
|
|
32368
32544
|
} catch (err) {
|
|
32369
32545
|
const code = err.code;
|
|
32370
|
-
throw new UsageError(`--fixture: could not read ${
|
|
32546
|
+
throw new UsageError(`--fixture: could not read ${path29} as JSON${code === void 0 ? "" : ` (${code})`}.`);
|
|
32371
32547
|
}
|
|
32372
32548
|
if (!Array.isArray(doc)) throw new UsageError('--fixture must hold a JSON list of { "tool": "<name>", "arguments": { ... } }.');
|
|
32373
32549
|
return doc.map((entry2, i) => {
|
|
@@ -33618,7 +33794,7 @@ function scanCross(run, snapshots, files) {
|
|
|
33618
33794
|
if (!places.has(s.label))
|
|
33619
33795
|
places.set(s.label, { file: f.path, line: s.line, column: s.column });
|
|
33620
33796
|
const where3 = (label2) => places.get(safe(label2));
|
|
33621
|
-
const add = (rule, label2,
|
|
33797
|
+
const add = (rule, label2, path29, message2) => {
|
|
33622
33798
|
if (full(run)) {
|
|
33623
33799
|
run.truncated = true;
|
|
33624
33800
|
return;
|
|
@@ -33632,7 +33808,7 @@ function scanCross(run, snapshots, files) {
|
|
|
33632
33808
|
origin: "snapshot",
|
|
33633
33809
|
...where3(label2),
|
|
33634
33810
|
server: safe(label2),
|
|
33635
|
-
path: safePointer(
|
|
33811
|
+
path: safePointer(path29),
|
|
33636
33812
|
message: message2,
|
|
33637
33813
|
fix: def2.fix
|
|
33638
33814
|
});
|
|
@@ -34002,13 +34178,13 @@ function parseScanExceptions(text6, name, today, opts = {}) {
|
|
|
34002
34178
|
const reason = str2(item, "reason");
|
|
34003
34179
|
const expires = str2(item, "expires");
|
|
34004
34180
|
let server2;
|
|
34005
|
-
let
|
|
34181
|
+
let path29;
|
|
34006
34182
|
const scope = pair(item, "scope");
|
|
34007
34183
|
if (scope !== void 0 && (0, import_yaml9.isMap)(scope.value)) {
|
|
34008
34184
|
server2 = str2(scope.value, "server");
|
|
34009
|
-
|
|
34185
|
+
path29 = str2(scope.value, "path");
|
|
34010
34186
|
} else server2 = str2(item, "scope");
|
|
34011
|
-
if (
|
|
34187
|
+
if (path29 !== void 0 && path29.trim() === "")
|
|
34012
34188
|
fail3(item, "path must name a field; leave it out to cover the whole server.");
|
|
34013
34189
|
const subject2 = printable(rule ?? "a rule");
|
|
34014
34190
|
if (rule === void 0 || rule.trim() === "") fail3(item, "an entry needs a rule.");
|
|
@@ -34040,7 +34216,7 @@ function parseScanExceptions(text6, name, today, opts = {}) {
|
|
|
34040
34216
|
const entry2 = {
|
|
34041
34217
|
rule,
|
|
34042
34218
|
server: server2,
|
|
34043
|
-
...
|
|
34219
|
+
...path29 === void 0 ? {} : { path: path29 },
|
|
34044
34220
|
reason,
|
|
34045
34221
|
expires,
|
|
34046
34222
|
line: lineOf(item)
|
|
@@ -34218,10 +34394,10 @@ function journalHeaders(headers) {
|
|
|
34218
34394
|
])
|
|
34219
34395
|
);
|
|
34220
34396
|
}
|
|
34221
|
-
function openProbeJournal(
|
|
34397
|
+
function openProbeJournal(path29) {
|
|
34222
34398
|
let fd;
|
|
34223
34399
|
try {
|
|
34224
|
-
fd = (0, import_node_fs18.openSync)(
|
|
34400
|
+
fd = (0, import_node_fs18.openSync)(path29, "w", 384);
|
|
34225
34401
|
if (process.platform !== "win32") (0, import_node_fs18.fchmodSync)(fd, 384);
|
|
34226
34402
|
} catch {
|
|
34227
34403
|
throw new UsageError("--journal: the file cannot be opened for writing.");
|
|
@@ -35774,9 +35950,9 @@ var init_report3 = __esm({
|
|
|
35774
35950
|
init_types();
|
|
35775
35951
|
GROUPS = ["descriptions", "pins", "config", "cross", "active"];
|
|
35776
35952
|
DISCLAIMER = "No finding does not mean the server is safe: this is the result of the listed rules over the data that was read.";
|
|
35777
|
-
fingerprintOf = (rule, target4,
|
|
35953
|
+
fingerprintOf = (rule, target4, path29, nth) => (0, import_node_crypto15.createHash)("sha256").update(`${rule}
|
|
35778
35954
|
${target4}
|
|
35779
|
-
${
|
|
35955
|
+
${path29}
|
|
35780
35956
|
${nth}`, "utf8").digest("hex").slice(0, 32);
|
|
35781
35957
|
where2 = (f) => f.location === void 0 ? "" : ` (${f.location.file}:${f.location.line}${f.location.column === void 0 ? "" : `:${f.location.column}`})`;
|
|
35782
35958
|
IMPORT_WORDS = {
|
|
@@ -36432,15 +36608,15 @@ function groupsOf(flag2, values) {
|
|
|
36432
36608
|
throw new UsageError(`${flag2}: "${n}" is not a group (${GROUPS.join(", ")}).`);
|
|
36433
36609
|
return names;
|
|
36434
36610
|
}
|
|
36435
|
-
function shown3(cwd,
|
|
36436
|
-
const full2 = (0, import_node_path12.resolve)(cwd,
|
|
36611
|
+
function shown3(cwd, path29) {
|
|
36612
|
+
const full2 = (0, import_node_path12.resolve)(cwd, path29);
|
|
36437
36613
|
const rel = (0, import_node_path12.relative)(cwd, full2);
|
|
36438
36614
|
return rel !== "" && !rel.startsWith("..") && !(0, import_node_path12.isAbsolute)(rel) ? rel.replace(/\\/g, "/") : (0, import_node_path12.basename)(full2);
|
|
36439
36615
|
}
|
|
36440
|
-
function readText(cwd,
|
|
36441
|
-
const full2 = (0, import_node_path12.resolve)(cwd,
|
|
36442
|
-
if (!(0, import_node_fs19.existsSync)(full2)) throw new UsageError(`${flag2}: ${
|
|
36443
|
-
const unreadable2 = () => new UnreadableError(`${flag2}: ${safeText(shown3(cwd,
|
|
36616
|
+
function readText(cwd, path29, flag2, limit3 = true, max = MAX_FILE_BYTES) {
|
|
36617
|
+
const full2 = (0, import_node_path12.resolve)(cwd, path29);
|
|
36618
|
+
if (!(0, import_node_fs19.existsSync)(full2)) throw new UsageError(`${flag2}: ${path29} does not exist.`);
|
|
36619
|
+
const unreadable2 = () => new UnreadableError(`${flag2}: ${safeText(shown3(cwd, path29))} cannot be read.`);
|
|
36444
36620
|
let size = 0;
|
|
36445
36621
|
if (limit3)
|
|
36446
36622
|
try {
|
|
@@ -36450,7 +36626,7 @@ function readText(cwd, path28, flag2, limit3 = true, max = MAX_FILE_BYTES) {
|
|
|
36450
36626
|
}
|
|
36451
36627
|
if (size > max)
|
|
36452
36628
|
throw new TooLargeError(
|
|
36453
|
-
`${flag2}: ${
|
|
36629
|
+
`${flag2}: ${path29} is too large to read (over ${max >= 1024 * 1024 ? `${max / 1024 / 1024} MiB` : `${max / 1024} KiB`}).`
|
|
36454
36630
|
);
|
|
36455
36631
|
try {
|
|
36456
36632
|
return (0, import_node_fs19.readFileSync)(full2, "utf8");
|
|
@@ -36458,8 +36634,8 @@ function readText(cwd, path28, flag2, limit3 = true, max = MAX_FILE_BYTES) {
|
|
|
36458
36634
|
throw unreadable2();
|
|
36459
36635
|
}
|
|
36460
36636
|
}
|
|
36461
|
-
function clientOf(
|
|
36462
|
-
const p =
|
|
36637
|
+
function clientOf(path29) {
|
|
36638
|
+
const p = path29.replace(/\\/g, "/").toLowerCase();
|
|
36463
36639
|
if (p.endsWith("claude_desktop_config.json")) return "claude-desktop";
|
|
36464
36640
|
if (p.includes(".cursor/")) return "cursor";
|
|
36465
36641
|
if (p.includes(".vscode/")) return "vscode";
|
|
@@ -36478,8 +36654,8 @@ async function handleMcpScan(flags2, server2, raw) {
|
|
|
36478
36654
|
throw err;
|
|
36479
36655
|
}
|
|
36480
36656
|
}
|
|
36481
|
-
function fileKeys(cwd,
|
|
36482
|
-
const full2 = (0, import_node_path12.resolve)(cwd,
|
|
36657
|
+
function fileKeys(cwd, path29) {
|
|
36658
|
+
const full2 = (0, import_node_path12.resolve)(cwd, path29);
|
|
36483
36659
|
const keys = [];
|
|
36484
36660
|
let real = full2;
|
|
36485
36661
|
try {
|
|
@@ -36514,9 +36690,9 @@ function noSharedFiles(flags2, outputs, cwd) {
|
|
|
36514
36690
|
...flags2.debugOut === void 0 ? [] : [["--debug-out", flags2.debugOut]]
|
|
36515
36691
|
];
|
|
36516
36692
|
const seen = /* @__PURE__ */ new Map();
|
|
36517
|
-
for (const [flag2,
|
|
36518
|
-
for (const [flag2,
|
|
36519
|
-
const keys = fileKeys(cwd,
|
|
36693
|
+
for (const [flag2, path29] of reads) for (const key of fileKeys(cwd, path29)) seen.set(key, flag2);
|
|
36694
|
+
for (const [flag2, path29] of writes) {
|
|
36695
|
+
const keys = fileKeys(cwd, path29);
|
|
36520
36696
|
for (const key of keys) {
|
|
36521
36697
|
const other = seen.get(key);
|
|
36522
36698
|
if (other !== void 0 && other !== flag2 + "#w")
|
|
@@ -36561,14 +36737,14 @@ async function scan(flags2, server2, io) {
|
|
|
36561
36737
|
const unreadable2 = [];
|
|
36562
36738
|
for (const spec of flags2.snapshot ?? []) {
|
|
36563
36739
|
const named2 = /^([A-Za-z0-9_.-]+)=(.+)$/s.exec(spec);
|
|
36564
|
-
const
|
|
36740
|
+
const path29 = named2 === null ? spec : named2[2] ?? "";
|
|
36565
36741
|
let text6;
|
|
36566
36742
|
try {
|
|
36567
|
-
text6 = readText(io.cwd,
|
|
36743
|
+
text6 = readText(io.cwd, path29, "--snapshot");
|
|
36568
36744
|
} catch (err) {
|
|
36569
36745
|
if (!(err instanceof TooLargeError) && !(err instanceof UnreadableError)) throw err;
|
|
36570
36746
|
unreadable2.push({
|
|
36571
|
-
target: shown3(io.cwd,
|
|
36747
|
+
target: shown3(io.cwd, path29),
|
|
36572
36748
|
reason: err instanceof TooLargeError ? "the file is too large to read (over 8 MiB)" : "the file cannot be read"
|
|
36573
36749
|
});
|
|
36574
36750
|
continue;
|
|
@@ -36578,11 +36754,11 @@ async function scan(flags2, server2, io) {
|
|
|
36578
36754
|
snapshot = parseSnapshot(text6);
|
|
36579
36755
|
} catch (err) {
|
|
36580
36756
|
if (err instanceof SnapshotFormatError)
|
|
36581
|
-
throw new UsageError(`--snapshot ${
|
|
36757
|
+
throw new UsageError(`--snapshot ${path29}: ${err.message}.`);
|
|
36582
36758
|
throw err;
|
|
36583
36759
|
}
|
|
36584
|
-
const label2 = named2?.[1] ?? (snapshot.server?.name !== void 0 && snapshot.server.name !== "" ? snapshot.server.name : (0, import_node_path12.basename)(
|
|
36585
|
-
snapshots.push({ label: label2, snapshot, file: shown3(io.cwd,
|
|
36760
|
+
const label2 = named2?.[1] ?? (snapshot.server?.name !== void 0 && snapshot.server.name !== "" ? snapshot.server.name : (0, import_node_path12.basename)(path29).replace(/\.[^.]*$/, ""));
|
|
36761
|
+
snapshots.push({ label: label2, snapshot, file: shown3(io.cwd, path29), text: text6 });
|
|
36586
36762
|
}
|
|
36587
36763
|
if (live) {
|
|
36588
36764
|
const config = connectionConfig(flags2, server2, io.env);
|
|
@@ -36625,23 +36801,23 @@ async function scan(flags2, server2, io) {
|
|
|
36625
36801
|
}
|
|
36626
36802
|
const configFiles = [];
|
|
36627
36803
|
let configMissing;
|
|
36628
|
-
for (const
|
|
36804
|
+
for (const path29 of flags2.config ?? [])
|
|
36629
36805
|
configFiles.push({
|
|
36630
|
-
path: shown3(io.cwd,
|
|
36631
|
-
client: flags2.client ?? clientOf(
|
|
36632
|
-
text: readText(io.cwd,
|
|
36806
|
+
path: shown3(io.cwd, path29),
|
|
36807
|
+
client: flags2.client ?? clientOf(path29),
|
|
36808
|
+
text: readText(io.cwd, path29, "--config", false)
|
|
36633
36809
|
});
|
|
36634
36810
|
let configRequested = (flags2.config ?? []).length > 0;
|
|
36635
36811
|
if ((flags2.config ?? []).length === 0 && flags2.client !== void 0) {
|
|
36636
36812
|
configRequested = true;
|
|
36637
|
-
const
|
|
36638
|
-
if ((0, import_node_fs19.existsSync)((0, import_node_path12.resolve)(io.cwd,
|
|
36813
|
+
const path29 = CLIENT_FILES[flags2.client];
|
|
36814
|
+
if ((0, import_node_fs19.existsSync)((0, import_node_path12.resolve)(io.cwd, path29)))
|
|
36639
36815
|
configFiles.push({
|
|
36640
|
-
path:
|
|
36816
|
+
path: path29,
|
|
36641
36817
|
client: flags2.client,
|
|
36642
|
-
text: readText(io.cwd,
|
|
36818
|
+
text: readText(io.cwd, path29, "--client", false)
|
|
36643
36819
|
});
|
|
36644
|
-
else configMissing = `${
|
|
36820
|
+
else configMissing = `${path29} is not in this folder`;
|
|
36645
36821
|
}
|
|
36646
36822
|
let pin;
|
|
36647
36823
|
let pinProblem;
|
|
@@ -36810,9 +36986,9 @@ async function findLatestCairnRun(runsDir = "runs") {
|
|
|
36810
36986
|
let newest;
|
|
36811
36987
|
for (const entry2 of entries2) {
|
|
36812
36988
|
if (!entry2.isDirectory()) continue;
|
|
36813
|
-
const dir =
|
|
36989
|
+
const dir = path24.join(runsDir, entry2.name);
|
|
36814
36990
|
try {
|
|
36815
|
-
const report = await fs20.lstat(
|
|
36991
|
+
const report = await fs20.lstat(path24.join(dir, "report.json"));
|
|
36816
36992
|
if (!report.isFile()) continue;
|
|
36817
36993
|
if (newest === void 0 || report.mtimeMs > newest.at) {
|
|
36818
36994
|
newest = { dir, at: report.mtimeMs };
|
|
@@ -36826,7 +37002,7 @@ async function findLatestCairnRun(runsDir = "runs") {
|
|
|
36826
37002
|
async function checkSize(dir, file) {
|
|
36827
37003
|
let size;
|
|
36828
37004
|
try {
|
|
36829
|
-
const st = await fs20.stat(
|
|
37005
|
+
const st = await fs20.stat(path24.join(dir, file));
|
|
36830
37006
|
if (!st.isFile()) throw new CairnArtifactShapeError(file, "", "is not a regular file");
|
|
36831
37007
|
size = st.size;
|
|
36832
37008
|
} catch (e) {
|
|
@@ -36863,7 +37039,7 @@ async function readMcpEvidence(dir, states) {
|
|
|
36863
37039
|
if (!await checkSize(dir, file)) return void 0;
|
|
36864
37040
|
let raw;
|
|
36865
37041
|
try {
|
|
36866
|
-
raw = JSON.parse(await fs20.readFile(
|
|
37042
|
+
raw = JSON.parse(await fs20.readFile(path24.join(dir, file), "utf8"));
|
|
36867
37043
|
} catch {
|
|
36868
37044
|
throw new CairnArtifactShapeError(file, "", "is not valid JSON");
|
|
36869
37045
|
}
|
|
@@ -36993,7 +37169,7 @@ async function casesFromMcp(dir, report) {
|
|
|
36993
37169
|
});
|
|
36994
37170
|
}
|
|
36995
37171
|
async function defaultReadEvidence(dir) {
|
|
36996
|
-
const raw = await readJson(
|
|
37172
|
+
const raw = await readJson(path24.join(dir, "api-evidence.json"));
|
|
36997
37173
|
if (!Array.isArray(raw)) return void 0;
|
|
36998
37174
|
return raw.map((r) => {
|
|
36999
37175
|
const rec = asRecord2(r);
|
|
@@ -37004,10 +37180,14 @@ async function defaultReadEvidence(dir) {
|
|
|
37004
37180
|
function casesFromDesign(report, notes) {
|
|
37005
37181
|
const list3 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
|
|
37006
37182
|
const refused = /* @__PURE__ */ new Map();
|
|
37183
|
+
let cut5 = 0;
|
|
37007
37184
|
const cases = list3.map((raw) => {
|
|
37008
37185
|
const c = asRecord2(raw);
|
|
37009
37186
|
const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
|
|
37010
37187
|
const title = str(c["title"], "untitled case");
|
|
37188
|
+
const why = own3(c, "rationale");
|
|
37189
|
+
const rationale = typeof why === "string" ? why.trim() : "";
|
|
37190
|
+
if (rationale.length > RATIONALE_MAX) cut5 += 1;
|
|
37011
37191
|
const link = own3(c, "traceUrl") ?? void 0;
|
|
37012
37192
|
const said3 = [];
|
|
37013
37193
|
const traceUrl = traceUrlOf(link, title, said3);
|
|
@@ -37025,12 +37205,14 @@ function casesFromDesign(report, notes) {
|
|
|
37025
37205
|
expected: str(c["expected"], "(no expected result recorded)"),
|
|
37026
37206
|
...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
|
|
37027
37207
|
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
|
|
37208
|
+
...rationale !== "" ? { rationale: clip(rationale, RATIONALE_MAX) } : {},
|
|
37028
37209
|
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
37029
37210
|
};
|
|
37030
37211
|
});
|
|
37031
37212
|
for (const times of refused.values()) {
|
|
37032
37213
|
if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
|
|
37033
37214
|
}
|
|
37215
|
+
if (cut5 > 0) notes.push(`plune: ${cut5} case(s) carry an explanation over ${RATIONALE_MAX} characters \u2014 sent cut to ${RATIONALE_MAX}.`);
|
|
37034
37216
|
return cases;
|
|
37035
37217
|
}
|
|
37036
37218
|
function casesFromApi(report, verdicts) {
|
|
@@ -37053,7 +37235,7 @@ function casesFromApi(report, verdicts) {
|
|
|
37053
37235
|
}
|
|
37054
37236
|
async function readCairnRun(dir, deps = {}) {
|
|
37055
37237
|
await checkSize(dir, "report.json");
|
|
37056
|
-
const raw = await readJson(
|
|
37238
|
+
const raw = await readJson(path24.join(dir, "report.json"));
|
|
37057
37239
|
if (raw === void 0) throw new CairnRunNotFoundError(dir);
|
|
37058
37240
|
const report = asRecord2(raw);
|
|
37059
37241
|
if (report["schemaVersion"] !== SUPPORTED_ARTIFACT_VERSION) {
|
|
@@ -37086,7 +37268,7 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
37086
37268
|
return {
|
|
37087
37269
|
schemaVersion: INGEST_SCHEMA_VERSION,
|
|
37088
37270
|
run: {
|
|
37089
|
-
runId: str(report["runId"],
|
|
37271
|
+
runId: str(report["runId"], path24.basename(dir)),
|
|
37090
37272
|
mode,
|
|
37091
37273
|
target: str(report["url"], "unknown"),
|
|
37092
37274
|
// Cairn states the run's tokens as `cost.totalTokens` in every mode; the platform copies it onto each proposal.
|
|
@@ -37096,22 +37278,22 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
37096
37278
|
};
|
|
37097
37279
|
}
|
|
37098
37280
|
async function readCairnSessionFiles(dir) {
|
|
37099
|
-
const raw = await readJson(
|
|
37281
|
+
const raw = await readJson(path24.join(dir, "screencasts", "screencasts.json"));
|
|
37100
37282
|
if (!Array.isArray(raw)) return void 0;
|
|
37101
|
-
const root = await fs20.realpath(dir).catch(() =>
|
|
37283
|
+
const root = await fs20.realpath(dir).catch(() => path24.resolve(dir));
|
|
37102
37284
|
const within2 = (p) => {
|
|
37103
|
-
const rel =
|
|
37104
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
37285
|
+
const rel = path24.relative(root, p);
|
|
37286
|
+
return rel !== "" && !rel.startsWith("..") && !path24.isAbsolute(rel);
|
|
37105
37287
|
};
|
|
37106
37288
|
let outside = 0;
|
|
37107
37289
|
const inside = async (p) => {
|
|
37108
37290
|
if (typeof p !== "string" || p === "") return void 0;
|
|
37109
|
-
const abs =
|
|
37291
|
+
const abs = path24.resolve(root, p);
|
|
37110
37292
|
const real = await fs20.realpath(abs).catch(() => void 0);
|
|
37111
37293
|
if (within2(abs) && (real === void 0 || within2(real))) {
|
|
37112
37294
|
const file = real ?? abs;
|
|
37113
37295
|
const size = await fs20.stat(file).then((s) => s.size, () => void 0);
|
|
37114
|
-
return { path: file, rel:
|
|
37296
|
+
return { path: file, rel: path24.relative(root, abs).split(path24.sep).join("/"), ...size !== void 0 ? { size } : {} };
|
|
37115
37297
|
}
|
|
37116
37298
|
outside += 1;
|
|
37117
37299
|
return void 0;
|
|
@@ -37137,7 +37319,7 @@ async function readCairnSessionFiles(dir) {
|
|
|
37137
37319
|
const keys = new Set(declared2.flatMap((s) => s.files.map((f) => f.key)));
|
|
37138
37320
|
const title = clip(str(own3(rec, "test")));
|
|
37139
37321
|
const files = found.filter((f) => {
|
|
37140
|
-
if ((f.file.size ?? 0) < 1 || f.rel.length > DECLARED.text ||
|
|
37322
|
+
if ((f.file.size ?? 0) < 1 || f.rel.length > DECLARED.text || path24.basename(f.file.path).length > DECLARED.name || keys.has(f.rel)) return false;
|
|
37141
37323
|
keys.add(f.rel);
|
|
37142
37324
|
return true;
|
|
37143
37325
|
});
|
|
@@ -37153,24 +37335,25 @@ async function readCairnSessionFiles(dir) {
|
|
|
37153
37335
|
const atMs = own3(chapter, "atMs");
|
|
37154
37336
|
return t !== "" && Number.isInteger(atMs) && atMs >= 0 ? [{ title: t, atMs }] : [];
|
|
37155
37337
|
}).slice(0, DECLARED.chapters),
|
|
37156
|
-
files: files.map((f) => ({ key: f.rel, name:
|
|
37338
|
+
files: files.map((f) => ({ key: f.rel, name: path24.basename(f.file.path), kind: f.kind, size: f.file.size }))
|
|
37157
37339
|
});
|
|
37158
37340
|
screencasts.set(stableId, declared2);
|
|
37159
37341
|
}
|
|
37160
37342
|
return { byCase, screencasts, unmapped, outside };
|
|
37161
37343
|
}
|
|
37162
|
-
var fs20,
|
|
37344
|
+
var fs20, path24, SUPPORTED_ARTIFACT_VERSION, INGEST_SCHEMA_VERSION, RATIONALE_MAX, NoCairnRunsError, CairnRunNotFoundError, CairnRunVersionError, CairnRunPartialError, CairnArtifactShapeError, CairnEvidenceAmbiguousError, asRecord2, str, own3, MAX_ARTIFACT_BYTES, MAX_MCP_CASES, ARGS_CHARS2, SECRET_NAME2, maskNamed, MCP_STATES, DECLARED, clip;
|
|
37163
37345
|
var init_cairn_artifact = __esm({
|
|
37164
37346
|
"src/cli/commands/cairn-artifact.ts"() {
|
|
37165
37347
|
"use strict";
|
|
37166
37348
|
init_cjs_shims();
|
|
37167
37349
|
fs20 = __toESM(require("fs/promises"), 1);
|
|
37168
|
-
|
|
37350
|
+
path24 = __toESM(require("path"), 1);
|
|
37169
37351
|
init_trace_url();
|
|
37170
37352
|
init_config();
|
|
37171
37353
|
init_errors2();
|
|
37172
37354
|
SUPPORTED_ARTIFACT_VERSION = 1;
|
|
37173
37355
|
INGEST_SCHEMA_VERSION = 1;
|
|
37356
|
+
RATIONALE_MAX = 400;
|
|
37174
37357
|
NoCairnRunsError = class extends Error {
|
|
37175
37358
|
constructor(runsDir) {
|
|
37176
37359
|
super(`No Cairn run found under ${runsDir} \u2014 name the directory instead: plune ingest <dir>.`);
|
|
@@ -37242,7 +37425,7 @@ var init_cairn_artifact = __esm({
|
|
|
37242
37425
|
"needs-review"
|
|
37243
37426
|
]);
|
|
37244
37427
|
DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
37245
|
-
clip = (s) => s.slice(0,
|
|
37428
|
+
clip = (s, max = DECLARED.text) => s.slice(0, max).replace(/[\uD800-\uDBFF]$/, "");
|
|
37246
37429
|
}
|
|
37247
37430
|
});
|
|
37248
37431
|
|
|
@@ -37317,13 +37500,13 @@ async function sendSessionFiles(session2, sent, platform) {
|
|
|
37317
37500
|
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
37318
37501
|
placed.add(item.stableId);
|
|
37319
37502
|
for (const { path: file, size, key } of paths) {
|
|
37320
|
-
const name =
|
|
37503
|
+
const name = path25.basename(file);
|
|
37321
37504
|
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
37322
37505
|
tooBig += 1;
|
|
37323
37506
|
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
37324
37507
|
continue;
|
|
37325
37508
|
}
|
|
37326
|
-
const type = TYPE_BY_EXTENSION2[
|
|
37509
|
+
const type = TYPE_BY_EXTENSION2[path25.extname(file).toLowerCase()] ?? "application/octet-stream";
|
|
37327
37510
|
jobs.push({
|
|
37328
37511
|
id: item.reviewItemId ?? item.resultId,
|
|
37329
37512
|
...item.reviewItemId !== void 0 ? { owner: "review-items" } : {},
|
|
@@ -37399,7 +37582,7 @@ async function handleIngest(deps) {
|
|
|
37399
37582
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
37400
37583
|
const endpoint = `${apiUrl}/v1/ingest/cairn`;
|
|
37401
37584
|
const job = new JobReporter(doFetch, apiUrl, token2, "ingest");
|
|
37402
|
-
await job.open(
|
|
37585
|
+
await job.open(path25.basename(path25.resolve(dir)), payload2.cases.length);
|
|
37403
37586
|
try {
|
|
37404
37587
|
const { result: result2, ...sent } = await upload();
|
|
37405
37588
|
await job.uploaded({ subjectId: result2.runId || void 0 });
|
|
@@ -37477,12 +37660,12 @@ function formatIngestResult(r) {
|
|
|
37477
37660
|
return `${lines.join("\n")}
|
|
37478
37661
|
`;
|
|
37479
37662
|
}
|
|
37480
|
-
var
|
|
37663
|
+
var path25, IngestNotLoggedInError, IngestTokenRejectedError, IngestNetworkError, IngestHttpError, SESSION_FILE_MAX, SESSION_UPLOADS_AT_ONCE, TYPE_BY_EXTENSION2, RESULT_PAGES_MAX, namesOf, targetOf3;
|
|
37481
37664
|
var init_ingest = __esm({
|
|
37482
37665
|
"src/cli/commands/ingest.ts"() {
|
|
37483
37666
|
"use strict";
|
|
37484
37667
|
init_cjs_shims();
|
|
37485
|
-
|
|
37668
|
+
path25 = __toESM(require("path"), 1);
|
|
37486
37669
|
init_client();
|
|
37487
37670
|
init_env2();
|
|
37488
37671
|
init_session2();
|
|
@@ -38108,7 +38291,7 @@ function filteredDotenv(text6, token2) {
|
|
|
38108
38291
|
}
|
|
38109
38292
|
function filesUnder(dir) {
|
|
38110
38293
|
if (!fs21.existsSync(dir)) return [];
|
|
38111
|
-
return fs21.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((p) => fs21.statSync(
|
|
38294
|
+
return fs21.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((p) => fs21.statSync(path26.join(dir, p)).isFile()).map((p) => p.split(path26.sep).join("/")).sort();
|
|
38112
38295
|
}
|
|
38113
38296
|
function newFilesDiff(files) {
|
|
38114
38297
|
return files.map((f) => {
|
|
@@ -38124,12 +38307,12 @@ function newFilesDiff(files) {
|
|
|
38124
38307
|
}).join("");
|
|
38125
38308
|
}
|
|
38126
38309
|
function findExecutable(command, env) {
|
|
38127
|
-
if (command.includes("/") || command.includes("\\")) return fs21.existsSync(command) ?
|
|
38310
|
+
if (command.includes("/") || command.includes("\\")) return fs21.existsSync(command) ? path26.resolve(command) : void 0;
|
|
38128
38311
|
const exts = process.platform === "win32" ? (env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";") : [""];
|
|
38129
|
-
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(
|
|
38312
|
+
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(path26.delimiter).filter((d) => d !== "");
|
|
38130
38313
|
for (const dir of dirs)
|
|
38131
38314
|
for (const ext of exts) {
|
|
38132
|
-
const candidate =
|
|
38315
|
+
const candidate = path26.join(dir, command + ext);
|
|
38133
38316
|
if (fs21.existsSync(candidate) && fs21.statSync(candidate).isFile()) return candidate;
|
|
38134
38317
|
}
|
|
38135
38318
|
return void 0;
|
|
@@ -38138,7 +38321,7 @@ async function handleAutomate(deps) {
|
|
|
38138
38321
|
for (const a of deps.cairnArgs ?? [])
|
|
38139
38322
|
if (/^--(run|into-project)(=|$)/.test(a))
|
|
38140
38323
|
throw new SyncFileError(`${a} is not passed to Cairn: plune automate owns the run folder and does not write into the repo.`);
|
|
38141
|
-
const repo =
|
|
38324
|
+
const repo = path26.resolve(deps.repo ?? process.cwd());
|
|
38142
38325
|
if (!fs21.existsSync(repo) || !fs21.statSync(repo).isDirectory()) throw new SyncFileError(`No directory at ${repo} (--repo).`);
|
|
38143
38326
|
const env = deps.env ?? process.env;
|
|
38144
38327
|
const command = deps.cairn ?? "cairn";
|
|
@@ -38155,14 +38338,14 @@ async function handleAutomate(deps) {
|
|
|
38155
38338
|
throw err;
|
|
38156
38339
|
}
|
|
38157
38340
|
if (!detail.steps?.length) throw new CaseNotAutomatableError(deps.caseId, detail.type);
|
|
38158
|
-
const tmp = fs21.mkdtempSync(
|
|
38341
|
+
const tmp = fs21.mkdtempSync(path26.join(os.tmpdir(), "plune-automate-"));
|
|
38159
38342
|
try {
|
|
38160
|
-
const runDir =
|
|
38161
|
-
fs21.mkdirSync(
|
|
38162
|
-
fs21.writeFileSync(
|
|
38163
|
-
fs21.writeFileSync(
|
|
38164
|
-
const dotenvSource = env["DOTENV_PATH"] ?? env["DOTENV_CONFIG_PATH"] ??
|
|
38165
|
-
const dotenvCopy =
|
|
38343
|
+
const runDir = path26.join(tmp, "run");
|
|
38344
|
+
fs21.mkdirSync(path26.join(runDir, "testcases"), { recursive: true });
|
|
38345
|
+
fs21.writeFileSync(path26.join(runDir, "report.json"), JSON.stringify({ url: deps.url ?? "", mode: "design" }, null, 2));
|
|
38346
|
+
fs21.writeFileSync(path26.join(runDir, "testcases", "ATC-PLUNE-001.md"), caseToAtcMarkdown(detail));
|
|
38347
|
+
const dotenvSource = env["DOTENV_PATH"] ?? env["DOTENV_CONFIG_PATH"] ?? path26.join(repo, ".env");
|
|
38348
|
+
const dotenvCopy = path26.join(tmp, "cairn.env");
|
|
38166
38349
|
fs21.writeFileSync(dotenvCopy, fs21.existsSync(dotenvSource) ? filteredDotenv(fs21.readFileSync(dotenvSource, "utf8"), token2) : "");
|
|
38167
38350
|
const childEnv = { ...cairnEnv(env, token2), DOTENV_PATH: dotenvCopy, DOTENV_CONFIG_PATH: dotenvCopy };
|
|
38168
38351
|
const isScript = /\.[cm]?js$/i.test(executable);
|
|
@@ -38180,8 +38363,8 @@ async function handleAutomate(deps) {
|
|
|
38180
38363
|
const { code } = await runCairn(["automate", "--run", runDir, ...deps.cairnArgs ?? []], false);
|
|
38181
38364
|
if (code === -1) throw new CairnMissingError(command);
|
|
38182
38365
|
if (code !== 0) throw new CairnFailedError(code);
|
|
38183
|
-
const testsDir =
|
|
38184
|
-
const files = filesUnder(testsDir).map((p) => ({ path: p, content: fs21.readFileSync(
|
|
38366
|
+
const testsDir = path26.join(runDir, "tests");
|
|
38367
|
+
const files = filesUnder(testsDir).map((p) => ({ path: p, content: fs21.readFileSync(path26.join(testsDir, p), "utf8") }));
|
|
38185
38368
|
if (files.length === 0) throw new CairnProducedNothingError();
|
|
38186
38369
|
const result2 = { case: detail, files, diff: newFilesDiff(files) };
|
|
38187
38370
|
if (!deps.withCairnVersion) return result2;
|
|
@@ -38352,7 +38535,7 @@ function reportAutomateFailure(err, write) {
|
|
|
38352
38535
|
}
|
|
38353
38536
|
return reportCasesFailure(err, write);
|
|
38354
38537
|
}
|
|
38355
|
-
var import_node_child_process5, fs21, os,
|
|
38538
|
+
var import_node_child_process5, fs21, os, path26, CairnMissingError, CaseNotFoundError, CaseNotAutomatableError, CairnFailedError, CairnProducedNothingError, AUTOMATION_FILES_MAX, AUTOMATION_FILE_MAX_BYTES, AUTOMATION_TOTAL_MAX_BYTES, AUTOMATION_PATH_MAX, AUTOMATION_ORIGIN_MAX, ProposalBoundsError, NoTestCallError, ProposalRefusedError, flat3, REGEX_AFTER, bytesOf, isSpec;
|
|
38356
38539
|
var init_automate = __esm({
|
|
38357
38540
|
"src/cli/commands/automate.ts"() {
|
|
38358
38541
|
"use strict";
|
|
@@ -38360,7 +38543,7 @@ var init_automate = __esm({
|
|
|
38360
38543
|
import_node_child_process5 = require("child_process");
|
|
38361
38544
|
fs21 = __toESM(require("fs"), 1);
|
|
38362
38545
|
os = __toESM(require("os"), 1);
|
|
38363
|
-
|
|
38546
|
+
path26 = __toESM(require("path"), 1);
|
|
38364
38547
|
init_api_url();
|
|
38365
38548
|
init_credentials();
|
|
38366
38549
|
init_plan();
|
|
@@ -38565,16 +38748,16 @@ function resolveInside(cwd, file) {
|
|
|
38565
38748
|
);
|
|
38566
38749
|
let root;
|
|
38567
38750
|
let dir;
|
|
38568
|
-
const abs =
|
|
38751
|
+
const abs = path27.resolve(cwd, file);
|
|
38569
38752
|
try {
|
|
38570
38753
|
root = fs22.realpathSync.native(cwd);
|
|
38571
|
-
dir = fs22.realpathSync.native(
|
|
38754
|
+
dir = fs22.realpathSync.native(path27.dirname(abs));
|
|
38572
38755
|
} catch {
|
|
38573
38756
|
throw outside;
|
|
38574
38757
|
}
|
|
38575
|
-
const rel =
|
|
38576
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
38577
|
-
return
|
|
38758
|
+
const rel = path27.relative(root, dir);
|
|
38759
|
+
if (rel === ".." || rel.startsWith(`..${path27.sep}`) || path27.isAbsolute(rel)) throw outside;
|
|
38760
|
+
return path27.join(dir, path27.basename(abs));
|
|
38578
38761
|
}
|
|
38579
38762
|
function isSecretBodyKey(name) {
|
|
38580
38763
|
const plain = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -38752,7 +38935,7 @@ function stubLines(exchange3, known2) {
|
|
|
38752
38935
|
if (joined(rest.response).some((text7) => holds(lower(text7), forms)))
|
|
38753
38936
|
return { skip: "a credential is split over the pieces of the answer" };
|
|
38754
38937
|
}
|
|
38755
|
-
const body =
|
|
38938
|
+
const body = JSON.stringify(rest, null, 2).split("\n").slice(1).join("\n ");
|
|
38756
38939
|
const text6 = stubHead(exchange3.method, "once") + body;
|
|
38757
38940
|
const unsafe = { skip: "it cannot be written safely" };
|
|
38758
38941
|
try {
|
|
@@ -39157,9 +39340,9 @@ ${stubs.join(",\n")}
|
|
|
39157
39340
|
warn("a lock of a recorder that is no longer running was found and taken over");
|
|
39158
39341
|
}
|
|
39159
39342
|
}
|
|
39160
|
-
const name =
|
|
39161
|
-
for (const entry2 of fs22.readdirSync(
|
|
39162
|
-
const left =
|
|
39343
|
+
const name = path27.basename(file);
|
|
39344
|
+
for (const entry2 of fs22.readdirSync(path27.dirname(file))) {
|
|
39345
|
+
const left = path27.join(path27.dirname(file), entry2);
|
|
39163
39346
|
if (!entry2.startsWith(`${name}.`) || !/^[0-9a-f]{32}\.tmp$/.test(entry2.slice(name.length + 1)))
|
|
39164
39347
|
continue;
|
|
39165
39348
|
if (Date.now() - fs22.statSync(left).mtimeMs > STALE_TEMP_MS) fs22.rmSync(left, { force: true });
|
|
@@ -39207,7 +39390,7 @@ ${stubs.join(",\n")}
|
|
|
39207
39390
|
}
|
|
39208
39391
|
};
|
|
39209
39392
|
}
|
|
39210
|
-
var import_node_crypto16, fs22, http3, https,
|
|
39393
|
+
var import_node_crypto16, fs22, http3, https, path27, MIN_SECRET_LENGTH3, MIN_BODY_SECRET_LENGTH, MAX_SECRET_LENGTH, RECORD_BODY_CAP, RECORDED_RESPONSE_HEADERS, RUN_STUB_FILE_LIMIT, DEFAULT_UPSTREAM_TIMEOUT_MS, RENAME_RETRIES, RENAME_FIRST_WAIT_MS, STALE_TEMP_MS, RECORDING_NOTES, RecordError, realOutbound, SECRET_BODY_ENDINGS, searched, bodySecret, lower, holds, stubHead, NOT_FORWARDED, NOT_PASSED_BACK, one, wait, codeOf4, isRunning;
|
|
39211
39394
|
var init_record = __esm({
|
|
39212
39395
|
"src/mock/record.ts"() {
|
|
39213
39396
|
"use strict";
|
|
@@ -39216,7 +39399,7 @@ var init_record = __esm({
|
|
|
39216
39399
|
fs22 = __toESM(require("fs"), 1);
|
|
39217
39400
|
http3 = __toESM(require("http"), 1);
|
|
39218
39401
|
https = __toESM(require("https"), 1);
|
|
39219
|
-
|
|
39402
|
+
path27 = __toESM(require("path"), 1);
|
|
39220
39403
|
init_schema2();
|
|
39221
39404
|
init_server();
|
|
39222
39405
|
MIN_SECRET_LENGTH3 = 8;
|
|
@@ -39271,7 +39454,7 @@ var init_record = __esm({
|
|
|
39271
39454
|
stubHead = (method, times) => ` {
|
|
39272
39455
|
"method": ${JSON.stringify(method)},
|
|
39273
39456
|
"times": "${times}",
|
|
39274
|
-
`;
|
|
39457
|
+
`;
|
|
39275
39458
|
NOT_FORWARDED = /* @__PURE__ */ new Set([
|
|
39276
39459
|
"connection",
|
|
39277
39460
|
"keep-alive",
|
|
@@ -39372,7 +39555,7 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39372
39555
|
if (flags2.force) throw new MockUsageError("--force goes with --record");
|
|
39373
39556
|
let stubs;
|
|
39374
39557
|
try {
|
|
39375
|
-
stubs = (await loadStubFile(
|
|
39558
|
+
stubs = (await loadStubFile(path28.resolve(cwd, flags2.file))).stubs;
|
|
39376
39559
|
} catch (err) {
|
|
39377
39560
|
if (err instanceof StubFileError) throw new MockUsageError(err.message);
|
|
39378
39561
|
throw err;
|
|
@@ -39392,7 +39575,8 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39392
39575
|
await server2.close();
|
|
39393
39576
|
throw new MockUsageError(err.message);
|
|
39394
39577
|
}
|
|
39395
|
-
|
|
39578
|
+
const count6 = `${stubs.length} ${stubs.length === 1 ? "stub" : "stubs"}`;
|
|
39579
|
+
io.stdout(`Serving ${count6} at ${scope.url}, with no network. Ctrl+C stops.
|
|
39396
39580
|
`);
|
|
39397
39581
|
io.onReady?.(scope.url);
|
|
39398
39582
|
await stopped(io.signal);
|
|
@@ -39402,7 +39586,7 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39402
39586
|
`);
|
|
39403
39587
|
return 0;
|
|
39404
39588
|
}
|
|
39405
|
-
var
|
|
39589
|
+
var path28, MockUsageError, stopped;
|
|
39406
39590
|
var init_mock2 = __esm({
|
|
39407
39591
|
"src/cli/commands/mock.ts"() {
|
|
39408
39592
|
"use strict";
|
|
@@ -39410,7 +39594,7 @@ var init_mock2 = __esm({
|
|
|
39410
39594
|
init_schema2();
|
|
39411
39595
|
init_record();
|
|
39412
39596
|
init_server();
|
|
39413
|
-
|
|
39597
|
+
path28 = __toESM(require("path"), 1);
|
|
39414
39598
|
MockUsageError = class extends Error {
|
|
39415
39599
|
code = "MOCK_USAGE_ERROR";
|
|
39416
39600
|
constructor(message2) {
|
|
@@ -39445,16 +39629,16 @@ init_options2();
|
|
|
39445
39629
|
|
|
39446
39630
|
// src/cli/config-flag.ts
|
|
39447
39631
|
init_cjs_shims();
|
|
39448
|
-
function configFlagValues(args,
|
|
39632
|
+
function configFlagValues(args, path29) {
|
|
39449
39633
|
const out = { before: [], after: [] };
|
|
39450
39634
|
let next = 0;
|
|
39451
39635
|
let side = "before";
|
|
39452
39636
|
for (let i = 0; i < args.length; i++) {
|
|
39453
39637
|
const arg = args[i];
|
|
39454
39638
|
if (arg === "--") break;
|
|
39455
|
-
if (side === "before" && arg ===
|
|
39639
|
+
if (side === "before" && arg === path29[next]) {
|
|
39456
39640
|
next += 1;
|
|
39457
|
-
if (next ===
|
|
39641
|
+
if (next === path29.length) side = "after";
|
|
39458
39642
|
continue;
|
|
39459
39643
|
}
|
|
39460
39644
|
const long = arg.startsWith("--config=") ? arg.slice("--config=".length) : void 0;
|
|
@@ -39783,10 +39967,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39783
39967
|
});
|
|
39784
39968
|
runCommand.command("import").argument(
|
|
39785
39969
|
"<file>",
|
|
39786
|
-
"A JUnit XML or Playwright JSON report, a k6 summary or Lighthouse JSON report, a folder of JUnit XML files (target/surefire-reports, build/test-results/test), or an Allure allure-results folder"
|
|
39970
|
+
"A JUnit XML or Playwright JSON report, a k6 summary or Lighthouse JSON report, an e2e report.json (report-1), a folder of JUnit XML files (target/surefire-reports, build/test-results/test), or an Allure allure-results folder"
|
|
39787
39971
|
).description("Turn a report another runner wrote into a run in Plune \u2014 no provider key needed").option(
|
|
39788
39972
|
"--format <fmt>",
|
|
39789
|
-
"junit | playwright-json | allure | k6 | lighthouse; detected when omitted (a folder with a *-result.json is allure, any other folder is its *.xml files as junit)"
|
|
39973
|
+
"junit | playwright-json | allure | k6 | lighthouse | e2e; detected when omitted (a folder with a *-result.json is allure, any other folder is its *.xml files as junit)"
|
|
39790
39974
|
).option(
|
|
39791
39975
|
"--min-score <category=score>",
|
|
39792
39976
|
"Lighthouse: the score (0-100) a category needs to pass, e.g. performance=90; repeat it per category. A category not named needs 90",
|
|
@@ -39799,7 +39983,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39799
39983
|
}
|
|
39800
39984
|
).option("--key <externalKey>", "The key several jobs share so their reports land in one run").option("--name <text>", "What to call the run in the list (default: the folder name, the time and where it ran; PLUNE_RUN_TITLE sets it too)").option("--create", "Offer tests nothing matched to the review queue", false).option(
|
|
39801
39985
|
"--fail-on-missing-attachments",
|
|
39802
|
-
"Exit 1 when a file the report names ([[ATTACHMENT|path]] in JUnit, a source in allure-results) is not there; the results are sent either way",
|
|
39986
|
+
"Exit 1 when a file the report names ([[ATTACHMENT|path]] in JUnit, a source in allure-results, an artifact path in an e2e report) is not there; the results are sent either way",
|
|
39803
39987
|
false
|
|
39804
39988
|
).option(
|
|
39805
39989
|
"--upload-concurrency <n>",
|
|
@@ -39994,10 +40178,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39994
40178
|
const { handleLogin: handleLogin2, reportLoginFailure: reportLoginFailure2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
39995
40179
|
try {
|
|
39996
40180
|
const token2 = options.token ?? await readTokenFromStdin();
|
|
39997
|
-
const { path:
|
|
40181
|
+
const { path: path29, verified } = await handleLogin2({ token: token2, skipVerify: options.skipVerify });
|
|
39998
40182
|
process.stdout.write(
|
|
39999
|
-
verified ? `Logged in. Token checked against the API and saved to ${
|
|
40000
|
-
` : `Token saved to ${
|
|
40183
|
+
verified ? `Logged in. Token checked against the API and saved to ${path29}
|
|
40184
|
+
` : `Token saved to ${path29} WITHOUT being checked (--skip-verify).
|
|
40001
40185
|
`
|
|
40002
40186
|
);
|
|
40003
40187
|
} catch (err) {
|
|
@@ -40014,9 +40198,9 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40014
40198
|
const verbose = command.optsWithGlobals().verbose === true;
|
|
40015
40199
|
const { handleLogout: handleLogout2 } = await Promise.resolve().then(() => (init_logout(), logout_exports));
|
|
40016
40200
|
try {
|
|
40017
|
-
const { removed, path:
|
|
40201
|
+
const { removed, path: path29 } = handleLogout2();
|
|
40018
40202
|
process.stdout.write(
|
|
40019
|
-
removed ? `Logged out. Removed ${
|
|
40203
|
+
removed ? `Logged out. Removed ${path29}
|
|
40020
40204
|
` : "Not logged in \u2014 nothing to remove.\n"
|
|
40021
40205
|
);
|
|
40022
40206
|
} catch (err) {
|
|
@@ -40479,7 +40663,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40479
40663
|
);
|
|
40480
40664
|
program.command("mock").description(
|
|
40481
40665
|
"Serve a stub file from a local stub server (127.0.0.1 only, no network), or with --record write one from the answers of a real HTTP API"
|
|
40482
|
-
).argument("<file>", "The stub file: served as it is, or written with --record (inside the current folder only)").option("--record", "Forward each request to --target and write the answers into <file>", false).option("--target <origin>", "With --record: where requests go, an http: or https: origin with no path. Nothing in a request changes it").option("--force", "With --record: replace <file> if it is a stub file or empty", false).option("--scope <name>", "The first path segment of the base URL", "default").option(
|
|
40666
|
+
).argument("<file>", "The stub file: served as it is, or written with --record (a recording is written inside the current folder only)").option("--record", "Forward each request to --target and write the answers into <file>", false).option("--target <origin>", "With --record: where requests go, an http: or https: origin with no path. Nothing in a request changes it").option("--force", "With --record: replace <file> if it is a stub file or empty", false).option("--scope <name>", "The first path segment of the base URL", "default").option(
|
|
40483
40667
|
"--port <n>",
|
|
40484
40668
|
"The port on 127.0.0.1 (default: a free one, printed at the start)",
|
|
40485
40669
|
(v) => {
|
|
@@ -40489,7 +40673,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40489
40673
|
0
|
|
40490
40674
|
).addHelpText(
|
|
40491
40675
|
"after",
|
|
40492
|
-
"\nA recording holds the prompts and the answers as they were sent and received: they may hold personal or confidential text. It is never uploaded. Never written: request headers, the query string, and response headers other than content-type and retry-after. A field with a secret's name holds [masked] in place of its value: in the JSON body of a request whatever the value is, in the JSON of an answer only a string of 16 characters or more with no whitespace that is not letters only. A credential value is also replaced wherever it is found, if it came in a header, the query or a cookie and has 8 characters or more, or in a body field and has 16 or more with no whitespace. Not searched for: a value of letters only, and a value in a form other than plain, URL-encoded, JSON-escaped, base64 or hex; a value over 4096 characters is found by its first 4096. A credential in a path segment, or under an ordinary header, query or body-field name, is not known to the recorder. An answer that sends a searched value back in pieces is not recorded. A recording over 1 MiB is not read by `plune run`. Redirects are passed back, not followed. Not recorded, with a warning: a body over 8 MiB, a body that is not UTF-8 text, a compressed body, a redirect, a 304. A failed upstream is answered 502 and not recorded. Timing is not recorded. A replay matches the method, the path and the whole JSON body; the same request recorded several times is replayed in the order recorded. The server answers only a request addressed to 127.0.0.1, localhost or [::1] with its port, and none that a
|
|
40676
|
+
"\nA recording holds the prompts and the answers as they were sent and received: they may hold personal or confidential text. It is never uploaded. Never written: request headers, the query string, and response headers other than content-type and retry-after. A field with a secret's name holds [masked] in place of its value: in the JSON body of a request whatever the value is, in the JSON of an answer only a string of 16 characters or more with no whitespace that is not letters only. A credential value is also replaced wherever it is found, if it came in a header, the query or a cookie and has 8 characters or more, or in a body field and has 16 or more with no whitespace. Not searched for: a value of letters only, and a value in a form other than plain, URL-encoded, JSON-escaped, base64 or hex; a value over 4096 characters is found by its first 4096. A credential in a path segment, or under an ordinary header, query or body-field name, is not known to the recorder. An answer that sends a searched value back in pieces is not recorded. A recording over 1 MiB is not read by `plune run`. Redirects are passed back, not followed. Not recorded, with a warning: a body over 8 MiB, a body that is not UTF-8 text, a compressed body, a redirect, a 304. A failed upstream is answered 502 and not recorded. Timing is not recorded. A replay matches the method, the path and the whole JSON body; the same request recorded several times is replayed in the order recorded. The server answers only a request addressed to 127.0.0.1, localhost or [::1] with its port, and none that a browser marks as sent from another origin: one with an Origin that is not the server's, or with Sec-Fetch-Site cross-site or same-site. Such a request is not forwarded and not recorded; a page that makes a browser send one cannot read an answer. Ctrl+C stops; the exit code is 1 if exchanges could not be written to the file."
|
|
40493
40677
|
).action(
|
|
40494
40678
|
async (file, options, command) => {
|
|
40495
40679
|
const verbose = verboseOf(command);
|