@plune-ai/cli 0.40.1 → 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 +467 -286
- package/dist/index.cjs +8 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- 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;
|
|
@@ -5761,11 +5761,11 @@ async function start(options = {}) {
|
|
|
5761
5761
|
const badTarget = segments[0] !== "" || segments.length < 2 || segments[1] === "" && segments.length > 2 || segments.some((segment3) => DOT_SEGMENT.test(segment3));
|
|
5762
5762
|
const name = badTarget ? "" : segments[1];
|
|
5763
5763
|
const method = req.method ?? "GET";
|
|
5764
|
-
const
|
|
5764
|
+
const path29 = badTarget ? rawPath : rawPath.slice(name.length + 1) || "/";
|
|
5765
5765
|
const entry2 = {
|
|
5766
5766
|
scope: name,
|
|
5767
5767
|
method,
|
|
5768
|
-
path:
|
|
5768
|
+
path: path29,
|
|
5769
5769
|
query: maskedQuery(new URLSearchParams(queryAt === -1 ? "" : target4.slice(queryAt + 1))),
|
|
5770
5770
|
headers: maskedHeaders(req.headers),
|
|
5771
5771
|
body: body.subarray(0, journalBodyCap).toString("utf8"),
|
|
@@ -5798,7 +5798,7 @@ async function start(options = {}) {
|
|
|
5798
5798
|
const live = scope.stubs.find(({ stub, matches: matches2, calls }) => {
|
|
5799
5799
|
if (stub.times !== "always" && calls >= (stub.times === "once" ? 1 : stub.times))
|
|
5800
5800
|
return false;
|
|
5801
|
-
if (stub.method !== method || !matches2(
|
|
5801
|
+
if (stub.method !== method || !matches2(path29)) return false;
|
|
5802
5802
|
const exact = stub.match === "exact";
|
|
5803
5803
|
if (stub.body === void 0 && !exact) return true;
|
|
5804
5804
|
if (!parsed4) {
|
|
@@ -5958,7 +5958,7 @@ async function start(options = {}) {
|
|
|
5958
5958
|
throw new Error(`Invalid stub: ${formatIssues(result2.error).join("; ")}`);
|
|
5959
5959
|
state2.stubs.push({
|
|
5960
5960
|
stub: result2.data,
|
|
5961
|
-
matches: result2.data.match === "exact" ? (
|
|
5961
|
+
matches: result2.data.match === "exact" ? (path29) => maskedTextMatches(result2.data.path, path29) : pathMatcher(result2.data.path),
|
|
5962
5962
|
calls: 0
|
|
5963
5963
|
});
|
|
5964
5964
|
}
|
|
@@ -6060,12 +6060,12 @@ function machineless(raw, repoRoot, home) {
|
|
|
6060
6060
|
if (repoRoot === void 0) text6 = text6.replace(ANY_HOME, "~");
|
|
6061
6061
|
return text6;
|
|
6062
6062
|
}
|
|
6063
|
-
function pathIn(
|
|
6064
|
-
const parts =
|
|
6063
|
+
function pathIn(path29) {
|
|
6064
|
+
const parts = path29.split(/[\\/]+/);
|
|
6065
6065
|
while (parts.length > 1 && parts.at(-1) === "") parts.pop();
|
|
6066
6066
|
if (!parts.some((part) => part !== "" && !/^[A-Za-z]:$/.test(part))) return void 0;
|
|
6067
6067
|
const joined2 = parts.map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("[\\\\/]+");
|
|
6068
|
-
const escaped = /^\/(?!\/)/.test(
|
|
6068
|
+
const escaped = /^\/(?!\/)/.test(path29) ? joined2.replace("[\\\\/]+", "\\\\*\\/") : joined2;
|
|
6069
6069
|
const url = "(?:(?:file|webpack|webpack-internal):(?:\\\\*\\/){2,3})?";
|
|
6070
6070
|
return new RegExp(`${url}${escaped}`, /^[A-Za-z]:$/.test(parts[0]) ? "gi" : "g");
|
|
6071
6071
|
}
|
|
@@ -6089,6 +6089,11 @@ function chosen({ status: status2, errors: errors2 }) {
|
|
|
6089
6089
|
}
|
|
6090
6090
|
return errors2[0];
|
|
6091
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
|
+
}
|
|
6092
6097
|
function chainOf(steps) {
|
|
6093
6098
|
const chain = [];
|
|
6094
6099
|
for (let failed2 = steps.find((s) => s.failed); failed2 !== void 0; failed2 = failed2.steps.find((s) => s.failed)) {
|
|
@@ -6111,12 +6116,12 @@ function placeOf(error, testFile) {
|
|
|
6111
6116
|
}
|
|
6112
6117
|
function fileOf(raw) {
|
|
6113
6118
|
if (!raw.startsWith("file://")) return raw;
|
|
6114
|
-
let
|
|
6119
|
+
let path29 = raw.slice("file://".length);
|
|
6115
6120
|
try {
|
|
6116
|
-
|
|
6121
|
+
path29 = decodeURIComponent(path29);
|
|
6117
6122
|
} catch {
|
|
6118
6123
|
}
|
|
6119
|
-
return /^\/[A-Za-z]:\//.test(
|
|
6124
|
+
return /^\/[A-Za-z]:\//.test(path29) ? path29.slice(1) : path29;
|
|
6120
6125
|
}
|
|
6121
6126
|
function fromRoot(place, root) {
|
|
6122
6127
|
if (place === void 0 || root === void 0 || !Number.isInteger(place.line) || place.line < 1) return void 0;
|
|
@@ -6156,14 +6161,14 @@ var init_failure_detail = __esm({
|
|
|
6156
6161
|
FRAME = /^\s+at (?:.*? \()?(.+?):(\d+):(\d+)\)?$/;
|
|
6157
6162
|
FRAME_MAX = 8192;
|
|
6158
6163
|
firstLine = (text6) => (0, import_node_util.stripVTControlCharacters)(text6).split("\n").map((line) => line.trim()).find((line) => line !== "");
|
|
6159
|
-
normal = (
|
|
6164
|
+
normal = (path29) => import_node_path3.posix.normalize(path29.replace(/\\/g, "/")).replace(/^([a-z]):/, (_, drive) => `${drive.toUpperCase()}:`);
|
|
6160
6165
|
}
|
|
6161
6166
|
});
|
|
6162
6167
|
|
|
6163
6168
|
// src/mcp-testing/connect/journal.ts
|
|
6164
|
-
function openJournal(
|
|
6165
|
-
if (
|
|
6166
|
-
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);
|
|
6167
6172
|
if (process.platform !== "win32") (0, import_node_fs3.fchmodSync)(fd, 384);
|
|
6168
6173
|
const start3 = import_node_perf_hooks.performance.now();
|
|
6169
6174
|
let closed = false;
|
|
@@ -9008,8 +9013,8 @@ function sortKeys(value2) {
|
|
|
9008
9013
|
function homePattern(home) {
|
|
9009
9014
|
const trimmed = home?.replace(/[\\/]+$/, "");
|
|
9010
9015
|
if (trimmed === void 0 || trimmed.length < 2) return void 0;
|
|
9011
|
-
const
|
|
9012
|
-
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");
|
|
9013
9018
|
}
|
|
9014
9019
|
function redact(value2, secrets, home) {
|
|
9015
9020
|
if (typeof value2 === "string") {
|
|
@@ -9190,10 +9195,10 @@ function same(a, b) {
|
|
|
9190
9195
|
const ka = Object.keys(a);
|
|
9191
9196
|
return ka.length === Object.keys(b).length && ka.every((k) => Object.hasOwn(b, k) && same(a[k], b[k]));
|
|
9192
9197
|
}
|
|
9193
|
-
function compareSchema(c, side,
|
|
9198
|
+
function compareSchema(c, side, path29, before, after) {
|
|
9194
9199
|
if (same(before, after)) return;
|
|
9195
|
-
const field = `${side}Schema${
|
|
9196
|
-
if (
|
|
9200
|
+
const field = `${side}Schema${path29 === "" ? "" : `.${path29}`}`;
|
|
9201
|
+
if (path29 === "" && (before === void 0 || after === void 0)) {
|
|
9197
9202
|
if (side === "output") {
|
|
9198
9203
|
if (after === void 0) c.add(field, "breaking", "The output schema was removed; a client reading the result loses its shape.", before, after);
|
|
9199
9204
|
else c.add(field, "non-breaking", "An output schema was added.", before, after);
|
|
@@ -9205,10 +9210,10 @@ function compareSchema(c, side, path28, before, after) {
|
|
|
9205
9210
|
return c.add(`${field}`, "breaking", `The type changed from ${show(before["type"])} to ${show(after["type"])}.`, before["type"], after["type"]);
|
|
9206
9211
|
}
|
|
9207
9212
|
if (!same(before["enum"], after["enum"])) compareEnum(c, side, field, before["enum"], after["enum"]);
|
|
9208
|
-
compareProperties(c, side,
|
|
9209
|
-
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"]);
|
|
9210
9215
|
if (!same(before["description"], after["description"])) {
|
|
9211
|
-
const what =
|
|
9216
|
+
const what = path29 === "" ? `whole ${side} schema` : side === "input" ? "parameter" : "field";
|
|
9212
9217
|
c.add(field, "informational", `The ${what} description changed: it is what a model reads.`, before["description"], after["description"], {
|
|
9213
9218
|
signal: "security"
|
|
9214
9219
|
});
|
|
@@ -9268,7 +9273,7 @@ function compareEnum(c, side, field, before, after) {
|
|
|
9268
9273
|
if (widened) return c.add(field, "breaking", `The result enum was widened: ${gained}; a client does not know the new value.`, before, after);
|
|
9269
9274
|
c.add(field, "non-breaking", `The result enum was narrowed: ${lost}.`, before, after);
|
|
9270
9275
|
}
|
|
9271
|
-
function compareProperties(c, side,
|
|
9276
|
+
function compareProperties(c, side, path29, field, before, after) {
|
|
9272
9277
|
const bp = isRecord7(before["properties"]) ? before["properties"] : {};
|
|
9273
9278
|
const ap = isRecord7(after["properties"]) ? after["properties"] : {};
|
|
9274
9279
|
const br = stringSet(before["required"]);
|
|
@@ -9281,7 +9286,7 @@ function compareProperties(c, side, path28, field, before, after) {
|
|
|
9281
9286
|
}
|
|
9282
9287
|
const what = side === "input" ? "parameter" : "field";
|
|
9283
9288
|
for (const name of [.../* @__PURE__ */ new Set([...Object.keys(bp), ...Object.keys(ap)])].sort()) {
|
|
9284
|
-
const sub =
|
|
9289
|
+
const sub = path29 === "" ? name : `${path29}.${name}`;
|
|
9285
9290
|
const f = `${side}Schema.${sub}`;
|
|
9286
9291
|
const inBefore = Object.hasOwn(bp, name);
|
|
9287
9292
|
const inAfter = Object.hasOwn(ap, name);
|
|
@@ -10766,10 +10771,10 @@ function schemaNodes(schema) {
|
|
|
10766
10771
|
const children = [];
|
|
10767
10772
|
for (const [name, p] of Object.entries(props(node.schema))) {
|
|
10768
10773
|
if (!isRecord8(p)) continue;
|
|
10769
|
-
const
|
|
10774
|
+
const path29 = node.path === "" ? name : `${node.path}.${name}`;
|
|
10770
10775
|
const depth = node.depth + 1;
|
|
10771
|
-
children.push({ path:
|
|
10772
|
-
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 });
|
|
10773
10778
|
}
|
|
10774
10779
|
for (const child of children.reverse()) todo.push(child);
|
|
10775
10780
|
}
|
|
@@ -12493,7 +12498,7 @@ function createClient(opts) {
|
|
|
12493
12498
|
}
|
|
12494
12499
|
const base = opts.apiUrl.replace(/\/+$/, "");
|
|
12495
12500
|
const scrub = (text6) => opts.token === "" ? text6 : text6.split(opts.token).join("***");
|
|
12496
|
-
async function send3(method,
|
|
12501
|
+
async function send3(method, path29, payload2, retries = DEFAULT_RETRIES) {
|
|
12497
12502
|
let last = {
|
|
12498
12503
|
kind: "unavailable",
|
|
12499
12504
|
status: null,
|
|
@@ -12504,7 +12509,7 @@ function createClient(opts) {
|
|
|
12504
12509
|
await respectPause(mine);
|
|
12505
12510
|
let res;
|
|
12506
12511
|
try {
|
|
12507
|
-
res = await doFetch(`${base}${
|
|
12512
|
+
res = await doFetch(`${base}${path29}`, {
|
|
12508
12513
|
method,
|
|
12509
12514
|
headers: { "content-type": payload2?.type ?? "application/json", authorization: `Bearer ${opts.token}` },
|
|
12510
12515
|
// A DELETE carries none. Sending `"undefined"` as a body is what a naive
|
|
@@ -12543,11 +12548,11 @@ function createClient(opts) {
|
|
|
12543
12548
|
return { ok: false, ...last };
|
|
12544
12549
|
}
|
|
12545
12550
|
return {
|
|
12546
|
-
post: (
|
|
12547
|
-
upload: (
|
|
12548
|
-
del: (
|
|
12549
|
-
get: (
|
|
12550
|
-
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" }),
|
|
12551
12556
|
async put(url, headers, source) {
|
|
12552
12557
|
const putRetries = uploadRetries ?? 3;
|
|
12553
12558
|
let last = { ok: false, status: null, code: "network" };
|
|
@@ -12783,9 +12788,9 @@ var init_fallback = __esm({
|
|
|
12783
12788
|
});
|
|
12784
12789
|
|
|
12785
12790
|
// src/reporter-core/files-batch.ts
|
|
12786
|
-
async function sha256File(
|
|
12791
|
+
async function sha256File(path29) {
|
|
12787
12792
|
const hash = (0, import_node_crypto3.createHash)("sha256");
|
|
12788
|
-
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);
|
|
12789
12794
|
return hash.digest("hex");
|
|
12790
12795
|
}
|
|
12791
12796
|
var import_node_crypto3, import_node_fs8, FILES_BATCH_MAX, DIRECT_BATCH_BYTES, BATCH_PIPELINES, sha256Bytes, BUCKET_CODES;
|
|
@@ -14892,10 +14897,10 @@ function platformGet(deps) {
|
|
|
14892
14897
|
const token2 = (deps.loadToken ?? loadToken)();
|
|
14893
14898
|
if (token2 === null) throw new NotLoggedInError();
|
|
14894
14899
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
14895
|
-
return async (
|
|
14900
|
+
return async (path29) => {
|
|
14896
14901
|
let res;
|
|
14897
14902
|
try {
|
|
14898
|
-
res = await doFetch(`${apiUrl}${
|
|
14903
|
+
res = await doFetch(`${apiUrl}${path29}`, { headers: { authorization: `Bearer ${token2}` } });
|
|
14899
14904
|
} catch {
|
|
14900
14905
|
throw new SyncNetworkError(apiUrl);
|
|
14901
14906
|
}
|
|
@@ -15250,9 +15255,9 @@ var init_read_file = __esm({
|
|
|
15250
15255
|
});
|
|
15251
15256
|
|
|
15252
15257
|
// src/importers/allure.ts
|
|
15253
|
-
function isFolder(
|
|
15258
|
+
function isFolder(path29) {
|
|
15254
15259
|
try {
|
|
15255
|
-
return fs13.statSync(
|
|
15260
|
+
return fs13.statSync(path29).isDirectory();
|
|
15256
15261
|
} catch {
|
|
15257
15262
|
return false;
|
|
15258
15263
|
}
|
|
@@ -15428,6 +15433,7 @@ function pendingOf(r, retry, ctx) {
|
|
|
15428
15433
|
};
|
|
15429
15434
|
const errorContext = errorContextFields(attempt);
|
|
15430
15435
|
const failure2 = FAILED.has(status2) ? failureOf(attempt) : void 0;
|
|
15436
|
+
const stepTitles = stepTitlesOf(attempt);
|
|
15431
15437
|
const pkg2 = labelOf(r, "package");
|
|
15432
15438
|
const where3 = (key.includes("#") ? key.split("#")[0] : pkg2)?.replace(/^[A-Za-z][A-Za-z0-9_-]+:(?![\\/])/, "");
|
|
15433
15439
|
const stated = TOKEN.exec(name)?.[1];
|
|
@@ -15452,7 +15458,8 @@ function pendingOf(r, retry, ctx) {
|
|
|
15452
15458
|
} : {},
|
|
15453
15459
|
...errorContext,
|
|
15454
15460
|
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
15455
|
-
...files.length > 0 ? { files } : {}
|
|
15461
|
+
...files.length > 0 ? { files } : {},
|
|
15462
|
+
...stepTitles !== void 0 ? { stepTitles } : {}
|
|
15456
15463
|
};
|
|
15457
15464
|
}
|
|
15458
15465
|
var fs13, path13, SOURCE, TOKEN, AllureReportError, RESULT, CONTAINER, MAX_JSON_BYTES, MAX_DEPTH2, MAX_TIME, namesIn, timeOf, textOf, labelOf, FAILED, declared, stopOf, compareText;
|
|
@@ -15809,10 +15816,10 @@ function attemptOf(result2, file, ctx) {
|
|
|
15809
15816
|
...typeof at2?.file === "string" && typeof at2.line === "number" ? { location: { file: at2.file, line: at2.line, ...typeof at2.column === "number" ? { column: at2.column } : {} } } : {}
|
|
15810
15817
|
})),
|
|
15811
15818
|
steps: steps(result2.steps),
|
|
15812
|
-
attachments: (result2.attachments ?? []).map(({ name, contentType: contentType2, path:
|
|
15819
|
+
attachments: (result2.attachments ?? []).map(({ name, contentType: contentType2, path: path29, body }) => ({
|
|
15813
15820
|
name: name ?? "",
|
|
15814
15821
|
...contentType2 !== void 0 ? { contentType: contentType2 } : {},
|
|
15815
|
-
...
|
|
15822
|
+
...path29 !== void 0 ? { path: path29 } : {},
|
|
15816
15823
|
// Decoded only where the platform would take it: a report of screenshots kept as
|
|
15817
15824
|
// bodies is megabytes of base64 that nothing here will read.
|
|
15818
15825
|
...typeof body === "string" && isTextType(contentType2) ? { body: Buffer.from(body, "base64") } : {}
|
|
@@ -15834,6 +15841,7 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
15834
15841
|
const errorContext = errorContextFields(attempt);
|
|
15835
15842
|
const failure2 = NOT_FAILED.has(attempt.status) ? void 0 : failureOf(attempt);
|
|
15836
15843
|
const files = filesOf(attempt);
|
|
15844
|
+
const stepTitles = stepTitlesOf(attempt);
|
|
15837
15845
|
const keys = [
|
|
15838
15846
|
...test.id !== void 0 ? [{ kind: "playwright-id", value: test.id }] : [],
|
|
15839
15847
|
{ kind: "path-title", value: pathTitle }
|
|
@@ -15866,7 +15874,8 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
15866
15874
|
...errorContext,
|
|
15867
15875
|
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
15868
15876
|
...files.length > 0 ? { files } : {},
|
|
15869
|
-
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
15877
|
+
...traceUrl !== void 0 ? { traceUrl } : {},
|
|
15878
|
+
...stepTitles !== void 0 ? { stepTitles } : {}
|
|
15870
15879
|
};
|
|
15871
15880
|
}
|
|
15872
15881
|
function walk3(suite, describes, depth, ctx, out) {
|
|
@@ -16125,6 +16134,168 @@ var init_lighthouse = __esm({
|
|
|
16125
16134
|
}
|
|
16126
16135
|
});
|
|
16127
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
|
+
|
|
16128
16299
|
// src/importers/index.ts
|
|
16129
16300
|
var importers_exports = {};
|
|
16130
16301
|
__export(importers_exports, {
|
|
@@ -16141,12 +16312,13 @@ __export(importers_exports, {
|
|
|
16141
16312
|
});
|
|
16142
16313
|
function detectFormat(source, file) {
|
|
16143
16314
|
if (looksLikeJUnit(source)) return "junit";
|
|
16315
|
+
if (looksLikeE2eReport(source)) return "e2e";
|
|
16144
16316
|
const perf = perfFormatOf(source);
|
|
16145
16317
|
if (perf !== void 0) return perf;
|
|
16146
16318
|
if (looksLikePlaywrightJson(source)) return "playwright-json";
|
|
16147
16319
|
throw new UnknownFormatError(
|
|
16148
16320
|
file,
|
|
16149
|
-
'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.'
|
|
16150
16322
|
);
|
|
16151
16323
|
}
|
|
16152
16324
|
function perfFormatOf(source) {
|
|
@@ -16162,7 +16334,7 @@ function perfFormatOf(source) {
|
|
|
16162
16334
|
return void 0;
|
|
16163
16335
|
}
|
|
16164
16336
|
function readFolder(dir, format, options = {}) {
|
|
16165
|
-
if (format === "playwright-json" || format === "k6" || format === "lighthouse") {
|
|
16337
|
+
if (format === "playwright-json" || format === "k6" || format === "lighthouse" || format === "e2e") {
|
|
16166
16338
|
throw new UnknownFormatError(dir, `this is a folder, and only allure-results or JUnit XML files are read from one, not ${format}.`);
|
|
16167
16339
|
}
|
|
16168
16340
|
if (options.minScores !== void 0 && Object.keys(options.minScores).length > 0) {
|
|
@@ -16180,7 +16352,7 @@ function readFolder(dir, format, options = {}) {
|
|
|
16180
16352
|
const skipped2 = [];
|
|
16181
16353
|
let reports = 0;
|
|
16182
16354
|
for (const name of namesIn(dir, /\.xml$/)) {
|
|
16183
|
-
const file =
|
|
16355
|
+
const file = path17.join(dir, name);
|
|
16184
16356
|
let source;
|
|
16185
16357
|
try {
|
|
16186
16358
|
source = readReportFile(file);
|
|
@@ -16216,17 +16388,18 @@ function readReport(source, file, format, options = {}) {
|
|
|
16216
16388
|
}
|
|
16217
16389
|
if (chosen2 === "junit") return { format: chosen2, results: readJUnit(source, file, missing, notes), missing, notes };
|
|
16218
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 };
|
|
16219
16392
|
if (chosen2 === "lighthouse") {
|
|
16220
16393
|
return { format: chosen2, results: readLighthouse(source, file, options.minScores), missing, notes };
|
|
16221
16394
|
}
|
|
16222
16395
|
return { format: chosen2, ...readPlaywrightJson(source, file, notes), missing, notes };
|
|
16223
16396
|
}
|
|
16224
|
-
var
|
|
16397
|
+
var path17, IMPORT_FORMATS, UnknownFormatError;
|
|
16225
16398
|
var init_importers = __esm({
|
|
16226
16399
|
"src/importers/index.ts"() {
|
|
16227
16400
|
"use strict";
|
|
16228
16401
|
init_cjs_shims();
|
|
16229
|
-
|
|
16402
|
+
path17 = __toESM(require("path"), 1);
|
|
16230
16403
|
init_run_lifecycle();
|
|
16231
16404
|
init_failure_detail();
|
|
16232
16405
|
init_allure();
|
|
@@ -16234,12 +16407,13 @@ var init_importers = __esm({
|
|
|
16234
16407
|
init_playwright_json();
|
|
16235
16408
|
init_k6();
|
|
16236
16409
|
init_lighthouse();
|
|
16410
|
+
init_e2e_report();
|
|
16237
16411
|
init_read_file();
|
|
16238
16412
|
init_xml();
|
|
16239
16413
|
init_playwright_json();
|
|
16240
16414
|
init_allure();
|
|
16241
16415
|
init_read_file();
|
|
16242
|
-
IMPORT_FORMATS = ["junit", "playwright-json", "allure", "k6", "lighthouse"];
|
|
16416
|
+
IMPORT_FORMATS = ["junit", "playwright-json", "allure", "k6", "lighthouse", "e2e"];
|
|
16243
16417
|
UnknownFormatError = class extends Error {
|
|
16244
16418
|
constructor(file, detail) {
|
|
16245
16419
|
super(`${file} \u2014 ${detail} Say which with --format ${IMPORT_FORMATS.join(" | ")}.`);
|
|
@@ -16324,7 +16498,7 @@ async function handleRunImport(options) {
|
|
|
16324
16498
|
}
|
|
16325
16499
|
for (const m of missing) write(`plune: attachment not found \u2014 ${JSON.stringify(printable(m.title))}: ${printable(m.path)}`);
|
|
16326
16500
|
for (const note2 of notes) write(note2);
|
|
16327
|
-
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));
|
|
16328
16502
|
const env = readEnv();
|
|
16329
16503
|
if (failuresOnly === true && env.config.full === true) {
|
|
16330
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.");
|
|
@@ -16426,7 +16600,7 @@ function describe(result2, apiUrl) {
|
|
|
16426
16600
|
// worked.
|
|
16427
16601
|
// `not delivered` always, zero included: a number that only appears when it is bad is one
|
|
16428
16602
|
// nobody learns to look for. The `[0-9]+ unmatched` the workflows read stays whole.
|
|
16429
|
-
`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.`
|
|
16430
16604
|
];
|
|
16431
16605
|
if (result2.conflict > 0 || result2.rejected > 0) {
|
|
16432
16606
|
lines.push(`${result2.conflict} conflicted and ${result2.rejected} were refused.`);
|
|
@@ -16505,7 +16679,7 @@ function isRunResult(v) {
|
|
|
16505
16679
|
}
|
|
16506
16680
|
function handleReport(opts = {}) {
|
|
16507
16681
|
const cwd = opts.cwd ?? process.cwd();
|
|
16508
|
-
const file =
|
|
16682
|
+
const file = path18.join(cwd, ".plune", "last-run.json");
|
|
16509
16683
|
let raw;
|
|
16510
16684
|
try {
|
|
16511
16685
|
raw = fs14.readFileSync(file, "utf8");
|
|
@@ -16523,13 +16697,13 @@ function handleReport(opts = {}) {
|
|
|
16523
16697
|
}
|
|
16524
16698
|
return parsed4;
|
|
16525
16699
|
}
|
|
16526
|
-
var fs14,
|
|
16700
|
+
var fs14, path18, ReportNotFoundError;
|
|
16527
16701
|
var init_report2 = __esm({
|
|
16528
16702
|
"src/cli/commands/report.ts"() {
|
|
16529
16703
|
"use strict";
|
|
16530
16704
|
init_cjs_shims();
|
|
16531
16705
|
fs14 = __toESM(require("fs"), 1);
|
|
16532
|
-
|
|
16706
|
+
path18 = __toESM(require("path"), 1);
|
|
16533
16707
|
ReportNotFoundError = class extends Error {
|
|
16534
16708
|
code = "NO_SAVED_RUN";
|
|
16535
16709
|
constructor(message2) {
|
|
@@ -17493,7 +17667,7 @@ function number(flag2, raw, min, max) {
|
|
|
17493
17667
|
function readRun2(cwd, file) {
|
|
17494
17668
|
let text6;
|
|
17495
17669
|
try {
|
|
17496
|
-
text6 = fs16.readFileSync(
|
|
17670
|
+
text6 = fs16.readFileSync(path19.resolve(cwd, file), "utf8");
|
|
17497
17671
|
} catch {
|
|
17498
17672
|
throw new JudgeCheckError(`cannot read the run ${file}: run "plune run" first, or name one with --run`);
|
|
17499
17673
|
}
|
|
@@ -17504,13 +17678,13 @@ function readRun2(cwd, file) {
|
|
|
17504
17678
|
}
|
|
17505
17679
|
}
|
|
17506
17680
|
async function handleJudgeCheck(labelsFile, flags2, cwd, write) {
|
|
17507
|
-
const run = readRun2(cwd, flags2.run ??
|
|
17508
|
-
const target4 =
|
|
17681
|
+
const run = readRun2(cwd, flags2.run ?? path19.join(".plune", "last-run.json"));
|
|
17682
|
+
const target4 = path19.resolve(cwd, labelsFile);
|
|
17509
17683
|
if (flags2.init === true) {
|
|
17510
17684
|
if (!flags2.force && fs16.existsSync(target4))
|
|
17511
17685
|
throw new JudgeCheckError(`${labelsFile} exists: it may hold labels; --force writes over it`);
|
|
17512
17686
|
const text7 = labelTemplate(run, flags2.eval);
|
|
17513
|
-
fs16.mkdirSync(
|
|
17687
|
+
fs16.mkdirSync(path19.dirname(target4), { recursive: true });
|
|
17514
17688
|
fs16.writeFileSync(target4, text7, "utf8");
|
|
17515
17689
|
const n = text7 === "" ? 0 : text7.split("\n").length - 1;
|
|
17516
17690
|
write(
|
|
@@ -17540,13 +17714,13 @@ async function handleJudgeCheck(labelsFile, flags2, cwd, write) {
|
|
|
17540
17714
|
write(formatJudgeCheck(report, options.minKappa));
|
|
17541
17715
|
return report.exitCode;
|
|
17542
17716
|
}
|
|
17543
|
-
var fs16,
|
|
17717
|
+
var fs16, path19;
|
|
17544
17718
|
var init_judge_check = __esm({
|
|
17545
17719
|
"src/cli/commands/judge-check.ts"() {
|
|
17546
17720
|
"use strict";
|
|
17547
17721
|
init_cjs_shims();
|
|
17548
17722
|
fs16 = __toESM(require("fs"), 1);
|
|
17549
|
-
|
|
17723
|
+
path19 = __toESM(require("path"), 1);
|
|
17550
17724
|
init_check();
|
|
17551
17725
|
init_labels();
|
|
17552
17726
|
init_run_result_schema();
|
|
@@ -17591,7 +17765,7 @@ async function runInitWizard(cwd) {
|
|
|
17591
17765
|
process.exit(1);
|
|
17592
17766
|
return;
|
|
17593
17767
|
}
|
|
17594
|
-
const outputPath =
|
|
17768
|
+
const outputPath = path20.join(cwd, "plune.yaml");
|
|
17595
17769
|
if (fs17.existsSync(outputPath)) {
|
|
17596
17770
|
const overwrite = await clack.confirm({
|
|
17597
17771
|
message: "plune.yaml already exists. Overwrite?"
|
|
@@ -17636,14 +17810,14 @@ async function runInitWizard(cwd) {
|
|
|
17636
17810
|
spin.stop("plune.yaml created!");
|
|
17637
17811
|
clack.outro("plune.yaml is ready.");
|
|
17638
17812
|
}
|
|
17639
|
-
var clack, fs17,
|
|
17813
|
+
var clack, fs17, path20, import_yaml4;
|
|
17640
17814
|
var init_wizard = __esm({
|
|
17641
17815
|
"src/config/init/wizard.ts"() {
|
|
17642
17816
|
"use strict";
|
|
17643
17817
|
init_cjs_shims();
|
|
17644
17818
|
clack = __toESM(require("@clack/prompts"), 1);
|
|
17645
17819
|
fs17 = __toESM(require("fs"), 1);
|
|
17646
|
-
|
|
17820
|
+
path20 = __toESM(require("path"), 1);
|
|
17647
17821
|
import_yaml4 = require("yaml");
|
|
17648
17822
|
init_errors();
|
|
17649
17823
|
}
|
|
@@ -17651,21 +17825,21 @@ var init_wizard = __esm({
|
|
|
17651
17825
|
|
|
17652
17826
|
// src/cli/templates/index.ts
|
|
17653
17827
|
function writeTemplateFile(cwd, rel, content, force) {
|
|
17654
|
-
const target4 =
|
|
17828
|
+
const target4 = path21.join(cwd, rel);
|
|
17655
17829
|
if (!force && fs18.existsSync(target4)) {
|
|
17656
17830
|
return "skipped";
|
|
17657
17831
|
}
|
|
17658
|
-
fs18.mkdirSync(
|
|
17832
|
+
fs18.mkdirSync(path21.dirname(target4), { recursive: true });
|
|
17659
17833
|
fs18.writeFileSync(target4, content, "utf8");
|
|
17660
17834
|
return "written";
|
|
17661
17835
|
}
|
|
17662
|
-
var fs18,
|
|
17836
|
+
var fs18, path21, PROVIDER_KEY_VARS, ENV_EXAMPLE_TPL, EXAMPLE_JSONL_TPL, PLUNE_YAML_TPL;
|
|
17663
17837
|
var init_templates = __esm({
|
|
17664
17838
|
"src/cli/templates/index.ts"() {
|
|
17665
17839
|
"use strict";
|
|
17666
17840
|
init_cjs_shims();
|
|
17667
17841
|
fs18 = __toESM(require("fs"), 1);
|
|
17668
|
-
|
|
17842
|
+
path21 = __toESM(require("path"), 1);
|
|
17669
17843
|
PROVIDER_KEY_VARS = {
|
|
17670
17844
|
anthropic: "ANTHROPIC_API_KEY",
|
|
17671
17845
|
openai: "OPENAI_API_KEY",
|
|
@@ -17986,12 +18160,12 @@ function convertOpenAiEval({ evalObject, run, rows }) {
|
|
|
17986
18160
|
let dataset;
|
|
17987
18161
|
let datasetField;
|
|
17988
18162
|
if (items2 !== void 0 && items2.length > 0) {
|
|
17989
|
-
const
|
|
18163
|
+
const path29 = `datasets/${id2}.jsonl`;
|
|
17990
18164
|
dataset = {
|
|
17991
|
-
path:
|
|
18165
|
+
path: path29,
|
|
17992
18166
|
jsonl: convertRows(items2, report).map((r) => JSON.stringify(r)).join("\n") + "\n"
|
|
17993
18167
|
};
|
|
17994
|
-
datasetField = `./${
|
|
18168
|
+
datasetField = `./${path29}`;
|
|
17995
18169
|
} else {
|
|
17996
18170
|
const vars = Object.fromEntries([...seen].sort().map((n) => [n, "replace me"]));
|
|
17997
18171
|
datasetField = { examples: [{ vars }] };
|
|
@@ -18078,7 +18252,7 @@ function nextSteps(keyVar) {
|
|
|
18078
18252
|
}
|
|
18079
18253
|
function keyVarOf(cwd) {
|
|
18080
18254
|
try {
|
|
18081
|
-
const cfg = (0, import_yaml6.parse)(fs19.readFileSync(
|
|
18255
|
+
const cfg = (0, import_yaml6.parse)(fs19.readFileSync(path22.join(cwd, "plune.yaml"), "utf8"));
|
|
18082
18256
|
const type = cfg?.provider?.type;
|
|
18083
18257
|
return typeof type === "string" && Object.hasOwn(PROVIDER_KEY_VARS, type) ? PROVIDER_KEY_VARS[type] : void 0;
|
|
18084
18258
|
} catch {
|
|
@@ -18090,7 +18264,7 @@ async function initFromOpenAiEval(options) {
|
|
|
18090
18264
|
const { convertOpenAiEval: convertOpenAiEval2, formatReport: formatReport4, OpenAiEvalImportError: OpenAiEvalImportError2 } = await Promise.resolve().then(() => (init_from_openai_eval(), from_openai_eval_exports));
|
|
18091
18265
|
const read = (file) => {
|
|
18092
18266
|
try {
|
|
18093
|
-
return fs19.readFileSync(
|
|
18267
|
+
return fs19.readFileSync(path22.resolve(cwd, file), "utf8").replace(/^/, "");
|
|
18094
18268
|
} catch (err) {
|
|
18095
18269
|
throw new OpenAiEvalImportError2(`cannot read ${file}: ${err.message}`);
|
|
18096
18270
|
}
|
|
@@ -18129,13 +18303,13 @@ async function initCommand({ cwd, force, yes = false }) {
|
|
|
18129
18303
|
}
|
|
18130
18304
|
process.stdout.write(nextSteps(keyVarOf(cwd)));
|
|
18131
18305
|
}
|
|
18132
|
-
var fs19,
|
|
18306
|
+
var fs19, path22, import_yaml6, TEMPLATES;
|
|
18133
18307
|
var init_init = __esm({
|
|
18134
18308
|
"src/cli/commands/init.ts"() {
|
|
18135
18309
|
"use strict";
|
|
18136
18310
|
init_cjs_shims();
|
|
18137
18311
|
fs19 = __toESM(require("fs"), 1);
|
|
18138
|
-
|
|
18312
|
+
path22 = __toESM(require("path"), 1);
|
|
18139
18313
|
import_yaml6 = require("yaml");
|
|
18140
18314
|
init_wizard();
|
|
18141
18315
|
init_templates();
|
|
@@ -19001,7 +19175,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19001
19175
|
},
|
|
19002
19176
|
async plune_get(i) {
|
|
19003
19177
|
const route = { "test-case": "/v1/test-cases/:id", run: "/v1/runs/:id", "review-item": "/v1/review-items/:id" }[str2(i["kind"])];
|
|
19004
|
-
const res = await call2({ method: "GET", path:
|
|
19178
|
+
const res = await call2({ method: "GET", path: path23(route, str2(i["id"])) });
|
|
19005
19179
|
return { kind: str2(i["kind"]), item: asRecord(res.body) };
|
|
19006
19180
|
},
|
|
19007
19181
|
async plune_cases_search(i) {
|
|
@@ -19071,12 +19245,12 @@ function createPluneToolExecutor(opts) {
|
|
|
19071
19245
|
const { dry_run, projectId: projectId2, ...body } = i;
|
|
19072
19246
|
const project = projectId2 ?? opts.projectId;
|
|
19073
19247
|
if (project === void 0) return fail2("invalid_input", NO_PROJECT);
|
|
19074
|
-
return write({ method: "POST", path:
|
|
19248
|
+
return write({ method: "POST", path: path23("/v1/projects/:id/case-generations", project), body: withoutUndefined(body) }, dry_run);
|
|
19075
19249
|
},
|
|
19076
19250
|
async plune_cases_generation_get(i) {
|
|
19077
19251
|
const project = i["projectId"] ?? opts.projectId;
|
|
19078
19252
|
if (project === void 0) return fail2("invalid_input", NO_PROJECT);
|
|
19079
|
-
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"])) });
|
|
19080
19254
|
return { generation: asRecord(res.body) };
|
|
19081
19255
|
},
|
|
19082
19256
|
async plune_mission_create(i) {
|
|
@@ -19084,18 +19258,18 @@ function createPluneToolExecutor(opts) {
|
|
|
19084
19258
|
return write({ method: "POST", path: "/v1/missions", body: withoutUndefined(body) }, dry_run);
|
|
19085
19259
|
},
|
|
19086
19260
|
async plune_mission_get(i) {
|
|
19087
|
-
const res = await call2({ method: "GET", path:
|
|
19261
|
+
const res = await call2({ method: "GET", path: path23("/v1/missions/:id", str2(i["missionId"])) });
|
|
19088
19262
|
return { mission: asRecord(res.body) };
|
|
19089
19263
|
},
|
|
19090
19264
|
async plune_mission_update(i) {
|
|
19091
19265
|
const { dry_run, missionId: missionId2, ...body } = i;
|
|
19092
|
-
return write({ method: "PATCH", path:
|
|
19266
|
+
return write({ method: "PATCH", path: path23("/v1/missions/:id", str2(missionId2)), body: withoutUndefined(body) }, dry_run);
|
|
19093
19267
|
},
|
|
19094
19268
|
async plune_source_add(i) {
|
|
19095
19269
|
const parsed4 = (i["kind"] === "file" ? fileSource : linkSource).safeParse(withoutUndefined(i));
|
|
19096
19270
|
if (!parsed4.success) return fail2("invalid_input", `The input does not fit: ${zodMessage(parsed4.error)}`);
|
|
19097
19271
|
const { dry_run, missionId: missionId2, kind: kind2, ...rest } = parsed4.data;
|
|
19098
|
-
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 }) };
|
|
19099
19273
|
return write(req, dry_run);
|
|
19100
19274
|
},
|
|
19101
19275
|
async plune_question_ask(i) {
|
|
@@ -19117,7 +19291,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19117
19291
|
return { questions, nextCursor: cursorOf(body["nextCursor"]) };
|
|
19118
19292
|
},
|
|
19119
19293
|
async plune_strategy_propose(i) {
|
|
19120
|
-
const req = { method: "POST", path:
|
|
19294
|
+
const req = { method: "POST", path: path23("/v1/missions/:id/strategy", str2(i["missionId"])), body: i["content"] };
|
|
19121
19295
|
if (i["dry_run"] === true) {
|
|
19122
19296
|
try {
|
|
19123
19297
|
const res = await call2({ ...req, path: `${req.path}/check` });
|
|
@@ -19127,10 +19301,10 @@ function createPluneToolExecutor(opts) {
|
|
|
19127
19301
|
return { dryRun: true, checked: false, request: planned(req) };
|
|
19128
19302
|
}
|
|
19129
19303
|
}
|
|
19130
|
-
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"]);
|
|
19131
19305
|
},
|
|
19132
19306
|
async plune_report_request(i) {
|
|
19133
|
-
return write({ method: "POST", path:
|
|
19307
|
+
return write({ method: "POST", path: path23("/v1/missions/:id/report", str2(i["missionId"])), body: {} }, i["dry_run"]);
|
|
19134
19308
|
},
|
|
19135
19309
|
async plune_discover_tools(i) {
|
|
19136
19310
|
const names = i["names"] ?? [];
|
|
@@ -19156,7 +19330,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19156
19330
|
async plune_cases_update(i) {
|
|
19157
19331
|
const cases = i["cases"];
|
|
19158
19332
|
return batch(
|
|
19159
|
-
cases.map((c) => ({ method: "PATCH", path:
|
|
19333
|
+
cases.map((c) => ({ method: "PATCH", path: path23("/v1/test-cases/:id", c.id), body: c.changes })),
|
|
19160
19334
|
i["dry_run"],
|
|
19161
19335
|
(_b, n) => cases[n]?.id
|
|
19162
19336
|
);
|
|
@@ -19168,7 +19342,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19168
19342
|
const results4 = i["results"];
|
|
19169
19343
|
const req = {
|
|
19170
19344
|
method: "POST",
|
|
19171
|
-
path:
|
|
19345
|
+
path: path23("/v1/runs/:id/results", str2(i["runId"])),
|
|
19172
19346
|
body: withoutUndefined({ results: results4, combination: i["combination"], configuration: i["configuration"] })
|
|
19173
19347
|
};
|
|
19174
19348
|
if (i["dry_run"] === true) return { dryRun: true, requested: results4.length, applied: 0, requests: [planned(req)] };
|
|
@@ -19244,7 +19418,7 @@ function createPluneToolExecutor(opts) {
|
|
|
19244
19418
|
}
|
|
19245
19419
|
};
|
|
19246
19420
|
}
|
|
19247
|
-
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;
|
|
19248
19422
|
var init_execute = __esm({
|
|
19249
19423
|
"src/mcp-tools/execute.ts"() {
|
|
19250
19424
|
"use strict";
|
|
@@ -19264,7 +19438,7 @@ var init_execute = __esm({
|
|
|
19264
19438
|
error: { code, message: message2, ...extra }
|
|
19265
19439
|
});
|
|
19266
19440
|
zodMessage = (error) => error.issues.map((i) => `${i.path.join(".") || "(input)"}: ${i.message}`).join("; ");
|
|
19267
|
-
|
|
19441
|
+
path23 = (template, ...ids) => {
|
|
19268
19442
|
let i = 0;
|
|
19269
19443
|
return template.replace(/:[a-z]+/gi, () => encodeURIComponent(ids[i++] ?? ""));
|
|
19270
19444
|
};
|
|
@@ -19701,7 +19875,7 @@ function healthSteps(session2, opts, found) {
|
|
|
19701
19875
|
};
|
|
19702
19876
|
return [protocolVersion, capabilities2, ...lists2, ping];
|
|
19703
19877
|
}
|
|
19704
|
-
function
|
|
19878
|
+
function errorText2(result2) {
|
|
19705
19879
|
const blocks = Array.isArray(result2.content) ? result2.content : [];
|
|
19706
19880
|
const text6 = blocks.flatMap(
|
|
19707
19881
|
(b) => isRecord9(b) && b.type === "text" && typeof b.text === "string" ? [b.text] : []
|
|
@@ -19719,7 +19893,7 @@ function smokeSteps(session2, items2, opts) {
|
|
|
19719
19893
|
const answer = await callTool(session2, tool2.name, opts.timeoutMs);
|
|
19720
19894
|
switch (answer.kind) {
|
|
19721
19895
|
case "result":
|
|
19722
|
-
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" };
|
|
19723
19897
|
case "error":
|
|
19724
19898
|
return { state: "failed", detail: `a JSON-RPC error: ${answer.message}` };
|
|
19725
19899
|
case "timeout":
|
|
@@ -20269,13 +20443,13 @@ async function lint(flags2, server2, io, rawOut) {
|
|
|
20269
20443
|
}
|
|
20270
20444
|
function readExceptions(flag2, io) {
|
|
20271
20445
|
const name = flag2 ?? DEFAULT_IGNORE_FILE;
|
|
20272
|
-
const
|
|
20273
|
-
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)) {
|
|
20274
20448
|
if (flag2 !== void 0) throw new UsageError(`--ignore-file: ${name} does not exist.`);
|
|
20275
20449
|
return void 0;
|
|
20276
20450
|
}
|
|
20277
20451
|
const today = io.today ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
20278
|
-
return { name, ...parseExceptionsFile((0, import_node_fs12.readFileSync)(
|
|
20452
|
+
return { name, ...parseExceptionsFile((0, import_node_fs12.readFileSync)(path29, "utf8"), name, today) };
|
|
20279
20453
|
}
|
|
20280
20454
|
async function listTools(session2) {
|
|
20281
20455
|
try {
|
|
@@ -20822,14 +20996,14 @@ async function listAll2(session2, method, key) {
|
|
|
20822
20996
|
}
|
|
20823
20997
|
return listing.items;
|
|
20824
20998
|
}
|
|
20825
|
-
function writeAtomically(
|
|
20999
|
+
function writeAtomically(path29, text6, shown4, flag2 = "--out") {
|
|
20826
21000
|
const temporary = (0, import_node_path8.join)(
|
|
20827
|
-
(0, import_node_path8.dirname)(
|
|
20828
|
-
`.${(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`
|
|
20829
21003
|
);
|
|
20830
21004
|
try {
|
|
20831
21005
|
(0, import_node_fs13.writeFileSync)(temporary, text6, { flag: "wx" });
|
|
20832
|
-
(0, import_node_fs13.renameSync)(temporary,
|
|
21006
|
+
(0, import_node_fs13.renameSync)(temporary, path29);
|
|
20833
21007
|
} catch (err) {
|
|
20834
21008
|
(0, import_node_fs13.rmSync)(temporary, { force: true });
|
|
20835
21009
|
const code = err.code ?? "an error";
|
|
@@ -21043,23 +21217,23 @@ function visible(s, max = EXCERPT) {
|
|
|
21043
21217
|
}
|
|
21044
21218
|
function descriptionTexts(snapshot) {
|
|
21045
21219
|
const out = [];
|
|
21046
|
-
const add = (surface,
|
|
21047
|
-
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 });
|
|
21048
21222
|
};
|
|
21049
|
-
const schema = (
|
|
21050
|
-
if (typeof node === "string") add("tools",
|
|
21051
|
-
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));
|
|
21052
21226
|
else if (isRecord12(node)) {
|
|
21053
|
-
const param =
|
|
21227
|
+
const param = path29.at(-2) === "properties" && hasStringType(node);
|
|
21054
21228
|
for (const [k, v] of Object.entries(node)) {
|
|
21055
|
-
add("tools", [...
|
|
21056
|
-
if (k === "description" && typeof v === "string") add("tools", [...
|
|
21057
|
-
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);
|
|
21058
21232
|
}
|
|
21059
21233
|
}
|
|
21060
21234
|
};
|
|
21061
|
-
const fields = (surface,
|
|
21062
|
-
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]);
|
|
21063
21237
|
};
|
|
21064
21238
|
add("instructions", ["instructions"], snapshot.instructions);
|
|
21065
21239
|
snapshot.tools?.forEach((t, i) => {
|
|
@@ -21320,7 +21494,7 @@ var init_descriptions = __esm({
|
|
|
21320
21494
|
U = (cp) => `U+${cp.toString(16).toUpperCase().padStart(4, "0")}`;
|
|
21321
21495
|
SHOWN = /^[\p{L}\p{N}\p{P}\p{S} ]$/u;
|
|
21322
21496
|
segment2 = (s) => typeof s === "number" ? String(s) : visible(s.replace(/~/g, "~0").replace(/\//g, "~1"), Infinity);
|
|
21323
|
-
pointerOf = (
|
|
21497
|
+
pointerOf = (path29) => `/${path29.map(segment2).join("/")}`;
|
|
21324
21498
|
hasStringType = (schema) => schema["type"] === "string" || Array.isArray(schema["type"]) && schema["type"].includes("string");
|
|
21325
21499
|
NAMES = {
|
|
21326
21500
|
8234: "left-to-right embedding",
|
|
@@ -21717,14 +21891,14 @@ ${err.stderrTail.map((l) => ` ${l}
|
|
|
21717
21891
|
throw err;
|
|
21718
21892
|
}
|
|
21719
21893
|
}
|
|
21720
|
-
function readLock(
|
|
21721
|
-
if (!(0, import_node_fs15.existsSync)(
|
|
21894
|
+
function readLock(path29, name, required) {
|
|
21895
|
+
if (!(0, import_node_fs15.existsSync)(path29)) {
|
|
21722
21896
|
if (required) throw new UsageError(`${name} does not exist; pin the server first with plune mcp pin.`);
|
|
21723
21897
|
return emptyLock();
|
|
21724
21898
|
}
|
|
21725
21899
|
let text6;
|
|
21726
21900
|
try {
|
|
21727
|
-
text6 = (0, import_node_fs15.readFileSync)(
|
|
21901
|
+
text6 = (0, import_node_fs15.readFileSync)(path29, "utf8");
|
|
21728
21902
|
} catch (err) {
|
|
21729
21903
|
throw new UsageError(`${name}: cannot be read (${err.code ?? "an error"}).`);
|
|
21730
21904
|
}
|
|
@@ -22217,14 +22391,14 @@ var init_raw_http = __esm({
|
|
|
22217
22391
|
});
|
|
22218
22392
|
|
|
22219
22393
|
// src/mcp-testing/conformance/checks/modern/meta.ts
|
|
22220
|
-
function headerMarks(schema,
|
|
22221
|
-
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)]));
|
|
22222
22396
|
if (!isRecord15(schema)) return [];
|
|
22223
22397
|
const marks = [];
|
|
22224
|
-
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 });
|
|
22225
22399
|
for (const [k, v] of Object.entries(schema)) {
|
|
22226
22400
|
if (!inNames && k === "x-mcp-header") continue;
|
|
22227
|
-
marks.push(...headerMarks(v, [...
|
|
22401
|
+
marks.push(...headerMarks(v, [...path29, k], !inNames && k === "properties"));
|
|
22228
22402
|
}
|
|
22229
22403
|
return marks;
|
|
22230
22404
|
}
|
|
@@ -22261,7 +22435,7 @@ var init_meta = __esm({
|
|
|
22261
22435
|
[META.capabilities]: {}
|
|
22262
22436
|
});
|
|
22263
22437
|
isRecord15 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
22264
|
-
staticallyReachable = (
|
|
22438
|
+
staticallyReachable = (path29) => path29.length > 0 && path29.length % 2 === 0 && path29.every((k, i) => i % 2 === 1 || k === "properties");
|
|
22265
22439
|
}
|
|
22266
22440
|
});
|
|
22267
22441
|
|
|
@@ -22569,8 +22743,8 @@ function discoverPrm(ctx, challenge) {
|
|
|
22569
22743
|
return prm;
|
|
22570
22744
|
}
|
|
22571
22745
|
}
|
|
22572
|
-
const
|
|
22573
|
-
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}`])];
|
|
22574
22748
|
for (const u of urls) {
|
|
22575
22749
|
const got2 = await getJson(ctx, u);
|
|
22576
22750
|
prm.wellKnown.push(got2);
|
|
@@ -22590,14 +22764,14 @@ function discoverAs(ctx, issuer) {
|
|
|
22590
22764
|
} catch {
|
|
22591
22765
|
return { issuer, tried: [wrong(issuer, "it is not an absolute URL")], found: void 0 };
|
|
22592
22766
|
}
|
|
22593
|
-
const
|
|
22594
|
-
const urls =
|
|
22767
|
+
const path29 = u.pathname === "/" ? "" : u.pathname.replace(/\/$/, "");
|
|
22768
|
+
const urls = path29 === "" ? [
|
|
22595
22769
|
`${u.origin}/.well-known/oauth-authorization-server`,
|
|
22596
22770
|
`${u.origin}/.well-known/openid-configuration`
|
|
22597
22771
|
] : [
|
|
22598
|
-
`${u.origin}/.well-known/oauth-authorization-server${
|
|
22599
|
-
`${u.origin}/.well-known/openid-configuration${
|
|
22600
|
-
`${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`
|
|
22601
22775
|
];
|
|
22602
22776
|
const as = { issuer, tried: [], found: void 0 };
|
|
22603
22777
|
for (const url of urls) {
|
|
@@ -32294,19 +32468,19 @@ function parseOauthConfig(source, format = "json") {
|
|
|
32294
32468
|
}
|
|
32295
32469
|
return config;
|
|
32296
32470
|
}
|
|
32297
|
-
function loadOauthConfig(
|
|
32471
|
+
function loadOauthConfig(path29) {
|
|
32298
32472
|
let source;
|
|
32299
32473
|
try {
|
|
32300
|
-
if ((0, import_node_fs16.statSync)(
|
|
32301
|
-
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");
|
|
32302
32476
|
} catch (err) {
|
|
32303
32477
|
if (err instanceof UsageError) throw err;
|
|
32304
32478
|
const code = err.code;
|
|
32305
32479
|
throw new UsageError(
|
|
32306
|
-
`--config: could not read ${
|
|
32480
|
+
`--config: could not read ${path29}${code === void 0 ? "" : ` (${code})`}.`
|
|
32307
32481
|
);
|
|
32308
32482
|
}
|
|
32309
|
-
return parseOauthConfig(source, /\.ya?ml$/i.test(
|
|
32483
|
+
return parseOauthConfig(source, /\.ya?ml$/i.test(path29) ? "yaml" : "json");
|
|
32310
32484
|
}
|
|
32311
32485
|
var import_node_fs16, import_yaml8, TOP, REGISTRATION2, METHODS, MODES, SECRET_KEY2, ENV_NAME, isObject7, MAX_CONFIG_BYTES, tooLarge;
|
|
32312
32486
|
var init_auth_config = __esm({
|
|
@@ -32363,13 +32537,13 @@ var mcp_conformance_exports = {};
|
|
|
32363
32537
|
__export(mcp_conformance_exports, {
|
|
32364
32538
|
handleMcpConformance: () => handleMcpConformance
|
|
32365
32539
|
});
|
|
32366
|
-
function loadFixture(
|
|
32540
|
+
function loadFixture(path29) {
|
|
32367
32541
|
let doc;
|
|
32368
32542
|
try {
|
|
32369
|
-
doc = JSON.parse((0, import_node_fs17.readFileSync)(
|
|
32543
|
+
doc = JSON.parse((0, import_node_fs17.readFileSync)(path29, "utf8"));
|
|
32370
32544
|
} catch (err) {
|
|
32371
32545
|
const code = err.code;
|
|
32372
|
-
throw new UsageError(`--fixture: could not read ${
|
|
32546
|
+
throw new UsageError(`--fixture: could not read ${path29} as JSON${code === void 0 ? "" : ` (${code})`}.`);
|
|
32373
32547
|
}
|
|
32374
32548
|
if (!Array.isArray(doc)) throw new UsageError('--fixture must hold a JSON list of { "tool": "<name>", "arguments": { ... } }.');
|
|
32375
32549
|
return doc.map((entry2, i) => {
|
|
@@ -33620,7 +33794,7 @@ function scanCross(run, snapshots, files) {
|
|
|
33620
33794
|
if (!places.has(s.label))
|
|
33621
33795
|
places.set(s.label, { file: f.path, line: s.line, column: s.column });
|
|
33622
33796
|
const where3 = (label2) => places.get(safe(label2));
|
|
33623
|
-
const add = (rule, label2,
|
|
33797
|
+
const add = (rule, label2, path29, message2) => {
|
|
33624
33798
|
if (full(run)) {
|
|
33625
33799
|
run.truncated = true;
|
|
33626
33800
|
return;
|
|
@@ -33634,7 +33808,7 @@ function scanCross(run, snapshots, files) {
|
|
|
33634
33808
|
origin: "snapshot",
|
|
33635
33809
|
...where3(label2),
|
|
33636
33810
|
server: safe(label2),
|
|
33637
|
-
path: safePointer(
|
|
33811
|
+
path: safePointer(path29),
|
|
33638
33812
|
message: message2,
|
|
33639
33813
|
fix: def2.fix
|
|
33640
33814
|
});
|
|
@@ -34004,13 +34178,13 @@ function parseScanExceptions(text6, name, today, opts = {}) {
|
|
|
34004
34178
|
const reason = str2(item, "reason");
|
|
34005
34179
|
const expires = str2(item, "expires");
|
|
34006
34180
|
let server2;
|
|
34007
|
-
let
|
|
34181
|
+
let path29;
|
|
34008
34182
|
const scope = pair(item, "scope");
|
|
34009
34183
|
if (scope !== void 0 && (0, import_yaml9.isMap)(scope.value)) {
|
|
34010
34184
|
server2 = str2(scope.value, "server");
|
|
34011
|
-
|
|
34185
|
+
path29 = str2(scope.value, "path");
|
|
34012
34186
|
} else server2 = str2(item, "scope");
|
|
34013
|
-
if (
|
|
34187
|
+
if (path29 !== void 0 && path29.trim() === "")
|
|
34014
34188
|
fail3(item, "path must name a field; leave it out to cover the whole server.");
|
|
34015
34189
|
const subject2 = printable(rule ?? "a rule");
|
|
34016
34190
|
if (rule === void 0 || rule.trim() === "") fail3(item, "an entry needs a rule.");
|
|
@@ -34042,7 +34216,7 @@ function parseScanExceptions(text6, name, today, opts = {}) {
|
|
|
34042
34216
|
const entry2 = {
|
|
34043
34217
|
rule,
|
|
34044
34218
|
server: server2,
|
|
34045
|
-
...
|
|
34219
|
+
...path29 === void 0 ? {} : { path: path29 },
|
|
34046
34220
|
reason,
|
|
34047
34221
|
expires,
|
|
34048
34222
|
line: lineOf(item)
|
|
@@ -34220,10 +34394,10 @@ function journalHeaders(headers) {
|
|
|
34220
34394
|
])
|
|
34221
34395
|
);
|
|
34222
34396
|
}
|
|
34223
|
-
function openProbeJournal(
|
|
34397
|
+
function openProbeJournal(path29) {
|
|
34224
34398
|
let fd;
|
|
34225
34399
|
try {
|
|
34226
|
-
fd = (0, import_node_fs18.openSync)(
|
|
34400
|
+
fd = (0, import_node_fs18.openSync)(path29, "w", 384);
|
|
34227
34401
|
if (process.platform !== "win32") (0, import_node_fs18.fchmodSync)(fd, 384);
|
|
34228
34402
|
} catch {
|
|
34229
34403
|
throw new UsageError("--journal: the file cannot be opened for writing.");
|
|
@@ -35776,9 +35950,9 @@ var init_report3 = __esm({
|
|
|
35776
35950
|
init_types();
|
|
35777
35951
|
GROUPS = ["descriptions", "pins", "config", "cross", "active"];
|
|
35778
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.";
|
|
35779
|
-
fingerprintOf = (rule, target4,
|
|
35953
|
+
fingerprintOf = (rule, target4, path29, nth) => (0, import_node_crypto15.createHash)("sha256").update(`${rule}
|
|
35780
35954
|
${target4}
|
|
35781
|
-
${
|
|
35955
|
+
${path29}
|
|
35782
35956
|
${nth}`, "utf8").digest("hex").slice(0, 32);
|
|
35783
35957
|
where2 = (f) => f.location === void 0 ? "" : ` (${f.location.file}:${f.location.line}${f.location.column === void 0 ? "" : `:${f.location.column}`})`;
|
|
35784
35958
|
IMPORT_WORDS = {
|
|
@@ -36434,15 +36608,15 @@ function groupsOf(flag2, values) {
|
|
|
36434
36608
|
throw new UsageError(`${flag2}: "${n}" is not a group (${GROUPS.join(", ")}).`);
|
|
36435
36609
|
return names;
|
|
36436
36610
|
}
|
|
36437
|
-
function shown3(cwd,
|
|
36438
|
-
const full2 = (0, import_node_path12.resolve)(cwd,
|
|
36611
|
+
function shown3(cwd, path29) {
|
|
36612
|
+
const full2 = (0, import_node_path12.resolve)(cwd, path29);
|
|
36439
36613
|
const rel = (0, import_node_path12.relative)(cwd, full2);
|
|
36440
36614
|
return rel !== "" && !rel.startsWith("..") && !(0, import_node_path12.isAbsolute)(rel) ? rel.replace(/\\/g, "/") : (0, import_node_path12.basename)(full2);
|
|
36441
36615
|
}
|
|
36442
|
-
function readText(cwd,
|
|
36443
|
-
const full2 = (0, import_node_path12.resolve)(cwd,
|
|
36444
|
-
if (!(0, import_node_fs19.existsSync)(full2)) throw new UsageError(`${flag2}: ${
|
|
36445
|
-
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.`);
|
|
36446
36620
|
let size = 0;
|
|
36447
36621
|
if (limit3)
|
|
36448
36622
|
try {
|
|
@@ -36452,7 +36626,7 @@ function readText(cwd, path28, flag2, limit3 = true, max = MAX_FILE_BYTES) {
|
|
|
36452
36626
|
}
|
|
36453
36627
|
if (size > max)
|
|
36454
36628
|
throw new TooLargeError(
|
|
36455
|
-
`${flag2}: ${
|
|
36629
|
+
`${flag2}: ${path29} is too large to read (over ${max >= 1024 * 1024 ? `${max / 1024 / 1024} MiB` : `${max / 1024} KiB`}).`
|
|
36456
36630
|
);
|
|
36457
36631
|
try {
|
|
36458
36632
|
return (0, import_node_fs19.readFileSync)(full2, "utf8");
|
|
@@ -36460,8 +36634,8 @@ function readText(cwd, path28, flag2, limit3 = true, max = MAX_FILE_BYTES) {
|
|
|
36460
36634
|
throw unreadable2();
|
|
36461
36635
|
}
|
|
36462
36636
|
}
|
|
36463
|
-
function clientOf(
|
|
36464
|
-
const p =
|
|
36637
|
+
function clientOf(path29) {
|
|
36638
|
+
const p = path29.replace(/\\/g, "/").toLowerCase();
|
|
36465
36639
|
if (p.endsWith("claude_desktop_config.json")) return "claude-desktop";
|
|
36466
36640
|
if (p.includes(".cursor/")) return "cursor";
|
|
36467
36641
|
if (p.includes(".vscode/")) return "vscode";
|
|
@@ -36480,8 +36654,8 @@ async function handleMcpScan(flags2, server2, raw) {
|
|
|
36480
36654
|
throw err;
|
|
36481
36655
|
}
|
|
36482
36656
|
}
|
|
36483
|
-
function fileKeys(cwd,
|
|
36484
|
-
const full2 = (0, import_node_path12.resolve)(cwd,
|
|
36657
|
+
function fileKeys(cwd, path29) {
|
|
36658
|
+
const full2 = (0, import_node_path12.resolve)(cwd, path29);
|
|
36485
36659
|
const keys = [];
|
|
36486
36660
|
let real = full2;
|
|
36487
36661
|
try {
|
|
@@ -36516,9 +36690,9 @@ function noSharedFiles(flags2, outputs, cwd) {
|
|
|
36516
36690
|
...flags2.debugOut === void 0 ? [] : [["--debug-out", flags2.debugOut]]
|
|
36517
36691
|
];
|
|
36518
36692
|
const seen = /* @__PURE__ */ new Map();
|
|
36519
|
-
for (const [flag2,
|
|
36520
|
-
for (const [flag2,
|
|
36521
|
-
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);
|
|
36522
36696
|
for (const key of keys) {
|
|
36523
36697
|
const other = seen.get(key);
|
|
36524
36698
|
if (other !== void 0 && other !== flag2 + "#w")
|
|
@@ -36563,14 +36737,14 @@ async function scan(flags2, server2, io) {
|
|
|
36563
36737
|
const unreadable2 = [];
|
|
36564
36738
|
for (const spec of flags2.snapshot ?? []) {
|
|
36565
36739
|
const named2 = /^([A-Za-z0-9_.-]+)=(.+)$/s.exec(spec);
|
|
36566
|
-
const
|
|
36740
|
+
const path29 = named2 === null ? spec : named2[2] ?? "";
|
|
36567
36741
|
let text6;
|
|
36568
36742
|
try {
|
|
36569
|
-
text6 = readText(io.cwd,
|
|
36743
|
+
text6 = readText(io.cwd, path29, "--snapshot");
|
|
36570
36744
|
} catch (err) {
|
|
36571
36745
|
if (!(err instanceof TooLargeError) && !(err instanceof UnreadableError)) throw err;
|
|
36572
36746
|
unreadable2.push({
|
|
36573
|
-
target: shown3(io.cwd,
|
|
36747
|
+
target: shown3(io.cwd, path29),
|
|
36574
36748
|
reason: err instanceof TooLargeError ? "the file is too large to read (over 8 MiB)" : "the file cannot be read"
|
|
36575
36749
|
});
|
|
36576
36750
|
continue;
|
|
@@ -36580,11 +36754,11 @@ async function scan(flags2, server2, io) {
|
|
|
36580
36754
|
snapshot = parseSnapshot(text6);
|
|
36581
36755
|
} catch (err) {
|
|
36582
36756
|
if (err instanceof SnapshotFormatError)
|
|
36583
|
-
throw new UsageError(`--snapshot ${
|
|
36757
|
+
throw new UsageError(`--snapshot ${path29}: ${err.message}.`);
|
|
36584
36758
|
throw err;
|
|
36585
36759
|
}
|
|
36586
|
-
const label2 = named2?.[1] ?? (snapshot.server?.name !== void 0 && snapshot.server.name !== "" ? snapshot.server.name : (0, import_node_path12.basename)(
|
|
36587
|
-
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 });
|
|
36588
36762
|
}
|
|
36589
36763
|
if (live) {
|
|
36590
36764
|
const config = connectionConfig(flags2, server2, io.env);
|
|
@@ -36627,23 +36801,23 @@ async function scan(flags2, server2, io) {
|
|
|
36627
36801
|
}
|
|
36628
36802
|
const configFiles = [];
|
|
36629
36803
|
let configMissing;
|
|
36630
|
-
for (const
|
|
36804
|
+
for (const path29 of flags2.config ?? [])
|
|
36631
36805
|
configFiles.push({
|
|
36632
|
-
path: shown3(io.cwd,
|
|
36633
|
-
client: flags2.client ?? clientOf(
|
|
36634
|
-
text: readText(io.cwd,
|
|
36806
|
+
path: shown3(io.cwd, path29),
|
|
36807
|
+
client: flags2.client ?? clientOf(path29),
|
|
36808
|
+
text: readText(io.cwd, path29, "--config", false)
|
|
36635
36809
|
});
|
|
36636
36810
|
let configRequested = (flags2.config ?? []).length > 0;
|
|
36637
36811
|
if ((flags2.config ?? []).length === 0 && flags2.client !== void 0) {
|
|
36638
36812
|
configRequested = true;
|
|
36639
|
-
const
|
|
36640
|
-
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)))
|
|
36641
36815
|
configFiles.push({
|
|
36642
|
-
path:
|
|
36816
|
+
path: path29,
|
|
36643
36817
|
client: flags2.client,
|
|
36644
|
-
text: readText(io.cwd,
|
|
36818
|
+
text: readText(io.cwd, path29, "--client", false)
|
|
36645
36819
|
});
|
|
36646
|
-
else configMissing = `${
|
|
36820
|
+
else configMissing = `${path29} is not in this folder`;
|
|
36647
36821
|
}
|
|
36648
36822
|
let pin;
|
|
36649
36823
|
let pinProblem;
|
|
@@ -36812,9 +36986,9 @@ async function findLatestCairnRun(runsDir = "runs") {
|
|
|
36812
36986
|
let newest;
|
|
36813
36987
|
for (const entry2 of entries2) {
|
|
36814
36988
|
if (!entry2.isDirectory()) continue;
|
|
36815
|
-
const dir =
|
|
36989
|
+
const dir = path24.join(runsDir, entry2.name);
|
|
36816
36990
|
try {
|
|
36817
|
-
const report = await fs20.lstat(
|
|
36991
|
+
const report = await fs20.lstat(path24.join(dir, "report.json"));
|
|
36818
36992
|
if (!report.isFile()) continue;
|
|
36819
36993
|
if (newest === void 0 || report.mtimeMs > newest.at) {
|
|
36820
36994
|
newest = { dir, at: report.mtimeMs };
|
|
@@ -36828,7 +37002,7 @@ async function findLatestCairnRun(runsDir = "runs") {
|
|
|
36828
37002
|
async function checkSize(dir, file) {
|
|
36829
37003
|
let size;
|
|
36830
37004
|
try {
|
|
36831
|
-
const st = await fs20.stat(
|
|
37005
|
+
const st = await fs20.stat(path24.join(dir, file));
|
|
36832
37006
|
if (!st.isFile()) throw new CairnArtifactShapeError(file, "", "is not a regular file");
|
|
36833
37007
|
size = st.size;
|
|
36834
37008
|
} catch (e) {
|
|
@@ -36865,7 +37039,7 @@ async function readMcpEvidence(dir, states) {
|
|
|
36865
37039
|
if (!await checkSize(dir, file)) return void 0;
|
|
36866
37040
|
let raw;
|
|
36867
37041
|
try {
|
|
36868
|
-
raw = JSON.parse(await fs20.readFile(
|
|
37042
|
+
raw = JSON.parse(await fs20.readFile(path24.join(dir, file), "utf8"));
|
|
36869
37043
|
} catch {
|
|
36870
37044
|
throw new CairnArtifactShapeError(file, "", "is not valid JSON");
|
|
36871
37045
|
}
|
|
@@ -36995,7 +37169,7 @@ async function casesFromMcp(dir, report) {
|
|
|
36995
37169
|
});
|
|
36996
37170
|
}
|
|
36997
37171
|
async function defaultReadEvidence(dir) {
|
|
36998
|
-
const raw = await readJson(
|
|
37172
|
+
const raw = await readJson(path24.join(dir, "api-evidence.json"));
|
|
36999
37173
|
if (!Array.isArray(raw)) return void 0;
|
|
37000
37174
|
return raw.map((r) => {
|
|
37001
37175
|
const rec = asRecord2(r);
|
|
@@ -37006,10 +37180,14 @@ async function defaultReadEvidence(dir) {
|
|
|
37006
37180
|
function casesFromDesign(report, notes) {
|
|
37007
37181
|
const list3 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
|
|
37008
37182
|
const refused = /* @__PURE__ */ new Map();
|
|
37183
|
+
let cut5 = 0;
|
|
37009
37184
|
const cases = list3.map((raw) => {
|
|
37010
37185
|
const c = asRecord2(raw);
|
|
37011
37186
|
const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
|
|
37012
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;
|
|
37013
37191
|
const link = own3(c, "traceUrl") ?? void 0;
|
|
37014
37192
|
const said3 = [];
|
|
37015
37193
|
const traceUrl = traceUrlOf(link, title, said3);
|
|
@@ -37027,12 +37205,14 @@ function casesFromDesign(report, notes) {
|
|
|
37027
37205
|
expected: str(c["expected"], "(no expected result recorded)"),
|
|
37028
37206
|
...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
|
|
37029
37207
|
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
|
|
37208
|
+
...rationale !== "" ? { rationale: clip(rationale, RATIONALE_MAX) } : {},
|
|
37030
37209
|
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
37031
37210
|
};
|
|
37032
37211
|
});
|
|
37033
37212
|
for (const times of refused.values()) {
|
|
37034
37213
|
if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
|
|
37035
37214
|
}
|
|
37215
|
+
if (cut5 > 0) notes.push(`plune: ${cut5} case(s) carry an explanation over ${RATIONALE_MAX} characters \u2014 sent cut to ${RATIONALE_MAX}.`);
|
|
37036
37216
|
return cases;
|
|
37037
37217
|
}
|
|
37038
37218
|
function casesFromApi(report, verdicts) {
|
|
@@ -37055,7 +37235,7 @@ function casesFromApi(report, verdicts) {
|
|
|
37055
37235
|
}
|
|
37056
37236
|
async function readCairnRun(dir, deps = {}) {
|
|
37057
37237
|
await checkSize(dir, "report.json");
|
|
37058
|
-
const raw = await readJson(
|
|
37238
|
+
const raw = await readJson(path24.join(dir, "report.json"));
|
|
37059
37239
|
if (raw === void 0) throw new CairnRunNotFoundError(dir);
|
|
37060
37240
|
const report = asRecord2(raw);
|
|
37061
37241
|
if (report["schemaVersion"] !== SUPPORTED_ARTIFACT_VERSION) {
|
|
@@ -37088,7 +37268,7 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
37088
37268
|
return {
|
|
37089
37269
|
schemaVersion: INGEST_SCHEMA_VERSION,
|
|
37090
37270
|
run: {
|
|
37091
|
-
runId: str(report["runId"],
|
|
37271
|
+
runId: str(report["runId"], path24.basename(dir)),
|
|
37092
37272
|
mode,
|
|
37093
37273
|
target: str(report["url"], "unknown"),
|
|
37094
37274
|
// Cairn states the run's tokens as `cost.totalTokens` in every mode; the platform copies it onto each proposal.
|
|
@@ -37098,22 +37278,22 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
37098
37278
|
};
|
|
37099
37279
|
}
|
|
37100
37280
|
async function readCairnSessionFiles(dir) {
|
|
37101
|
-
const raw = await readJson(
|
|
37281
|
+
const raw = await readJson(path24.join(dir, "screencasts", "screencasts.json"));
|
|
37102
37282
|
if (!Array.isArray(raw)) return void 0;
|
|
37103
|
-
const root = await fs20.realpath(dir).catch(() =>
|
|
37283
|
+
const root = await fs20.realpath(dir).catch(() => path24.resolve(dir));
|
|
37104
37284
|
const within2 = (p) => {
|
|
37105
|
-
const rel =
|
|
37106
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
37285
|
+
const rel = path24.relative(root, p);
|
|
37286
|
+
return rel !== "" && !rel.startsWith("..") && !path24.isAbsolute(rel);
|
|
37107
37287
|
};
|
|
37108
37288
|
let outside = 0;
|
|
37109
37289
|
const inside = async (p) => {
|
|
37110
37290
|
if (typeof p !== "string" || p === "") return void 0;
|
|
37111
|
-
const abs =
|
|
37291
|
+
const abs = path24.resolve(root, p);
|
|
37112
37292
|
const real = await fs20.realpath(abs).catch(() => void 0);
|
|
37113
37293
|
if (within2(abs) && (real === void 0 || within2(real))) {
|
|
37114
37294
|
const file = real ?? abs;
|
|
37115
37295
|
const size = await fs20.stat(file).then((s) => s.size, () => void 0);
|
|
37116
|
-
return { path: file, rel:
|
|
37296
|
+
return { path: file, rel: path24.relative(root, abs).split(path24.sep).join("/"), ...size !== void 0 ? { size } : {} };
|
|
37117
37297
|
}
|
|
37118
37298
|
outside += 1;
|
|
37119
37299
|
return void 0;
|
|
@@ -37139,7 +37319,7 @@ async function readCairnSessionFiles(dir) {
|
|
|
37139
37319
|
const keys = new Set(declared2.flatMap((s) => s.files.map((f) => f.key)));
|
|
37140
37320
|
const title = clip(str(own3(rec, "test")));
|
|
37141
37321
|
const files = found.filter((f) => {
|
|
37142
|
-
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;
|
|
37143
37323
|
keys.add(f.rel);
|
|
37144
37324
|
return true;
|
|
37145
37325
|
});
|
|
@@ -37155,24 +37335,25 @@ async function readCairnSessionFiles(dir) {
|
|
|
37155
37335
|
const atMs = own3(chapter, "atMs");
|
|
37156
37336
|
return t !== "" && Number.isInteger(atMs) && atMs >= 0 ? [{ title: t, atMs }] : [];
|
|
37157
37337
|
}).slice(0, DECLARED.chapters),
|
|
37158
|
-
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 }))
|
|
37159
37339
|
});
|
|
37160
37340
|
screencasts.set(stableId, declared2);
|
|
37161
37341
|
}
|
|
37162
37342
|
return { byCase, screencasts, unmapped, outside };
|
|
37163
37343
|
}
|
|
37164
|
-
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;
|
|
37165
37345
|
var init_cairn_artifact = __esm({
|
|
37166
37346
|
"src/cli/commands/cairn-artifact.ts"() {
|
|
37167
37347
|
"use strict";
|
|
37168
37348
|
init_cjs_shims();
|
|
37169
37349
|
fs20 = __toESM(require("fs/promises"), 1);
|
|
37170
|
-
|
|
37350
|
+
path24 = __toESM(require("path"), 1);
|
|
37171
37351
|
init_trace_url();
|
|
37172
37352
|
init_config();
|
|
37173
37353
|
init_errors2();
|
|
37174
37354
|
SUPPORTED_ARTIFACT_VERSION = 1;
|
|
37175
37355
|
INGEST_SCHEMA_VERSION = 1;
|
|
37356
|
+
RATIONALE_MAX = 400;
|
|
37176
37357
|
NoCairnRunsError = class extends Error {
|
|
37177
37358
|
constructor(runsDir) {
|
|
37178
37359
|
super(`No Cairn run found under ${runsDir} \u2014 name the directory instead: plune ingest <dir>.`);
|
|
@@ -37244,7 +37425,7 @@ var init_cairn_artifact = __esm({
|
|
|
37244
37425
|
"needs-review"
|
|
37245
37426
|
]);
|
|
37246
37427
|
DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
37247
|
-
clip = (s) => s.slice(0,
|
|
37428
|
+
clip = (s, max = DECLARED.text) => s.slice(0, max).replace(/[\uD800-\uDBFF]$/, "");
|
|
37248
37429
|
}
|
|
37249
37430
|
});
|
|
37250
37431
|
|
|
@@ -37319,13 +37500,13 @@ async function sendSessionFiles(session2, sent, platform) {
|
|
|
37319
37500
|
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
37320
37501
|
placed.add(item.stableId);
|
|
37321
37502
|
for (const { path: file, size, key } of paths) {
|
|
37322
|
-
const name =
|
|
37503
|
+
const name = path25.basename(file);
|
|
37323
37504
|
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
37324
37505
|
tooBig += 1;
|
|
37325
37506
|
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
37326
37507
|
continue;
|
|
37327
37508
|
}
|
|
37328
|
-
const type = TYPE_BY_EXTENSION2[
|
|
37509
|
+
const type = TYPE_BY_EXTENSION2[path25.extname(file).toLowerCase()] ?? "application/octet-stream";
|
|
37329
37510
|
jobs.push({
|
|
37330
37511
|
id: item.reviewItemId ?? item.resultId,
|
|
37331
37512
|
...item.reviewItemId !== void 0 ? { owner: "review-items" } : {},
|
|
@@ -37401,7 +37582,7 @@ async function handleIngest(deps) {
|
|
|
37401
37582
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
37402
37583
|
const endpoint = `${apiUrl}/v1/ingest/cairn`;
|
|
37403
37584
|
const job = new JobReporter(doFetch, apiUrl, token2, "ingest");
|
|
37404
|
-
await job.open(
|
|
37585
|
+
await job.open(path25.basename(path25.resolve(dir)), payload2.cases.length);
|
|
37405
37586
|
try {
|
|
37406
37587
|
const { result: result2, ...sent } = await upload();
|
|
37407
37588
|
await job.uploaded({ subjectId: result2.runId || void 0 });
|
|
@@ -37479,12 +37660,12 @@ function formatIngestResult(r) {
|
|
|
37479
37660
|
return `${lines.join("\n")}
|
|
37480
37661
|
`;
|
|
37481
37662
|
}
|
|
37482
|
-
var
|
|
37663
|
+
var path25, IngestNotLoggedInError, IngestTokenRejectedError, IngestNetworkError, IngestHttpError, SESSION_FILE_MAX, SESSION_UPLOADS_AT_ONCE, TYPE_BY_EXTENSION2, RESULT_PAGES_MAX, namesOf, targetOf3;
|
|
37483
37664
|
var init_ingest = __esm({
|
|
37484
37665
|
"src/cli/commands/ingest.ts"() {
|
|
37485
37666
|
"use strict";
|
|
37486
37667
|
init_cjs_shims();
|
|
37487
|
-
|
|
37668
|
+
path25 = __toESM(require("path"), 1);
|
|
37488
37669
|
init_client();
|
|
37489
37670
|
init_env2();
|
|
37490
37671
|
init_session2();
|
|
@@ -38110,7 +38291,7 @@ function filteredDotenv(text6, token2) {
|
|
|
38110
38291
|
}
|
|
38111
38292
|
function filesUnder(dir) {
|
|
38112
38293
|
if (!fs21.existsSync(dir)) return [];
|
|
38113
|
-
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();
|
|
38114
38295
|
}
|
|
38115
38296
|
function newFilesDiff(files) {
|
|
38116
38297
|
return files.map((f) => {
|
|
@@ -38126,12 +38307,12 @@ function newFilesDiff(files) {
|
|
|
38126
38307
|
}).join("");
|
|
38127
38308
|
}
|
|
38128
38309
|
function findExecutable(command, env) {
|
|
38129
|
-
if (command.includes("/") || command.includes("\\")) return fs21.existsSync(command) ?
|
|
38310
|
+
if (command.includes("/") || command.includes("\\")) return fs21.existsSync(command) ? path26.resolve(command) : void 0;
|
|
38130
38311
|
const exts = process.platform === "win32" ? (env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";") : [""];
|
|
38131
|
-
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(
|
|
38312
|
+
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(path26.delimiter).filter((d) => d !== "");
|
|
38132
38313
|
for (const dir of dirs)
|
|
38133
38314
|
for (const ext of exts) {
|
|
38134
|
-
const candidate =
|
|
38315
|
+
const candidate = path26.join(dir, command + ext);
|
|
38135
38316
|
if (fs21.existsSync(candidate) && fs21.statSync(candidate).isFile()) return candidate;
|
|
38136
38317
|
}
|
|
38137
38318
|
return void 0;
|
|
@@ -38140,7 +38321,7 @@ async function handleAutomate(deps) {
|
|
|
38140
38321
|
for (const a of deps.cairnArgs ?? [])
|
|
38141
38322
|
if (/^--(run|into-project)(=|$)/.test(a))
|
|
38142
38323
|
throw new SyncFileError(`${a} is not passed to Cairn: plune automate owns the run folder and does not write into the repo.`);
|
|
38143
|
-
const repo =
|
|
38324
|
+
const repo = path26.resolve(deps.repo ?? process.cwd());
|
|
38144
38325
|
if (!fs21.existsSync(repo) || !fs21.statSync(repo).isDirectory()) throw new SyncFileError(`No directory at ${repo} (--repo).`);
|
|
38145
38326
|
const env = deps.env ?? process.env;
|
|
38146
38327
|
const command = deps.cairn ?? "cairn";
|
|
@@ -38157,14 +38338,14 @@ async function handleAutomate(deps) {
|
|
|
38157
38338
|
throw err;
|
|
38158
38339
|
}
|
|
38159
38340
|
if (!detail.steps?.length) throw new CaseNotAutomatableError(deps.caseId, detail.type);
|
|
38160
|
-
const tmp = fs21.mkdtempSync(
|
|
38341
|
+
const tmp = fs21.mkdtempSync(path26.join(os.tmpdir(), "plune-automate-"));
|
|
38161
38342
|
try {
|
|
38162
|
-
const runDir =
|
|
38163
|
-
fs21.mkdirSync(
|
|
38164
|
-
fs21.writeFileSync(
|
|
38165
|
-
fs21.writeFileSync(
|
|
38166
|
-
const dotenvSource = env["DOTENV_PATH"] ?? env["DOTENV_CONFIG_PATH"] ??
|
|
38167
|
-
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");
|
|
38168
38349
|
fs21.writeFileSync(dotenvCopy, fs21.existsSync(dotenvSource) ? filteredDotenv(fs21.readFileSync(dotenvSource, "utf8"), token2) : "");
|
|
38169
38350
|
const childEnv = { ...cairnEnv(env, token2), DOTENV_PATH: dotenvCopy, DOTENV_CONFIG_PATH: dotenvCopy };
|
|
38170
38351
|
const isScript = /\.[cm]?js$/i.test(executable);
|
|
@@ -38182,8 +38363,8 @@ async function handleAutomate(deps) {
|
|
|
38182
38363
|
const { code } = await runCairn(["automate", "--run", runDir, ...deps.cairnArgs ?? []], false);
|
|
38183
38364
|
if (code === -1) throw new CairnMissingError(command);
|
|
38184
38365
|
if (code !== 0) throw new CairnFailedError(code);
|
|
38185
|
-
const testsDir =
|
|
38186
|
-
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") }));
|
|
38187
38368
|
if (files.length === 0) throw new CairnProducedNothingError();
|
|
38188
38369
|
const result2 = { case: detail, files, diff: newFilesDiff(files) };
|
|
38189
38370
|
if (!deps.withCairnVersion) return result2;
|
|
@@ -38354,7 +38535,7 @@ function reportAutomateFailure(err, write) {
|
|
|
38354
38535
|
}
|
|
38355
38536
|
return reportCasesFailure(err, write);
|
|
38356
38537
|
}
|
|
38357
|
-
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;
|
|
38358
38539
|
var init_automate = __esm({
|
|
38359
38540
|
"src/cli/commands/automate.ts"() {
|
|
38360
38541
|
"use strict";
|
|
@@ -38362,7 +38543,7 @@ var init_automate = __esm({
|
|
|
38362
38543
|
import_node_child_process5 = require("child_process");
|
|
38363
38544
|
fs21 = __toESM(require("fs"), 1);
|
|
38364
38545
|
os = __toESM(require("os"), 1);
|
|
38365
|
-
|
|
38546
|
+
path26 = __toESM(require("path"), 1);
|
|
38366
38547
|
init_api_url();
|
|
38367
38548
|
init_credentials();
|
|
38368
38549
|
init_plan();
|
|
@@ -38567,16 +38748,16 @@ function resolveInside(cwd, file) {
|
|
|
38567
38748
|
);
|
|
38568
38749
|
let root;
|
|
38569
38750
|
let dir;
|
|
38570
|
-
const abs =
|
|
38751
|
+
const abs = path27.resolve(cwd, file);
|
|
38571
38752
|
try {
|
|
38572
38753
|
root = fs22.realpathSync.native(cwd);
|
|
38573
|
-
dir = fs22.realpathSync.native(
|
|
38754
|
+
dir = fs22.realpathSync.native(path27.dirname(abs));
|
|
38574
38755
|
} catch {
|
|
38575
38756
|
throw outside;
|
|
38576
38757
|
}
|
|
38577
|
-
const rel =
|
|
38578
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
38579
|
-
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));
|
|
38580
38761
|
}
|
|
38581
38762
|
function isSecretBodyKey(name) {
|
|
38582
38763
|
const plain = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -39159,9 +39340,9 @@ ${stubs.join(",\n")}
|
|
|
39159
39340
|
warn("a lock of a recorder that is no longer running was found and taken over");
|
|
39160
39341
|
}
|
|
39161
39342
|
}
|
|
39162
|
-
const name =
|
|
39163
|
-
for (const entry2 of fs22.readdirSync(
|
|
39164
|
-
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);
|
|
39165
39346
|
if (!entry2.startsWith(`${name}.`) || !/^[0-9a-f]{32}\.tmp$/.test(entry2.slice(name.length + 1)))
|
|
39166
39347
|
continue;
|
|
39167
39348
|
if (Date.now() - fs22.statSync(left).mtimeMs > STALE_TEMP_MS) fs22.rmSync(left, { force: true });
|
|
@@ -39209,7 +39390,7 @@ ${stubs.join(",\n")}
|
|
|
39209
39390
|
}
|
|
39210
39391
|
};
|
|
39211
39392
|
}
|
|
39212
|
-
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;
|
|
39213
39394
|
var init_record = __esm({
|
|
39214
39395
|
"src/mock/record.ts"() {
|
|
39215
39396
|
"use strict";
|
|
@@ -39218,7 +39399,7 @@ var init_record = __esm({
|
|
|
39218
39399
|
fs22 = __toESM(require("fs"), 1);
|
|
39219
39400
|
http3 = __toESM(require("http"), 1);
|
|
39220
39401
|
https = __toESM(require("https"), 1);
|
|
39221
|
-
|
|
39402
|
+
path27 = __toESM(require("path"), 1);
|
|
39222
39403
|
init_schema2();
|
|
39223
39404
|
init_server();
|
|
39224
39405
|
MIN_SECRET_LENGTH3 = 8;
|
|
@@ -39374,7 +39555,7 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39374
39555
|
if (flags2.force) throw new MockUsageError("--force goes with --record");
|
|
39375
39556
|
let stubs;
|
|
39376
39557
|
try {
|
|
39377
|
-
stubs = (await loadStubFile(
|
|
39558
|
+
stubs = (await loadStubFile(path28.resolve(cwd, flags2.file))).stubs;
|
|
39378
39559
|
} catch (err) {
|
|
39379
39560
|
if (err instanceof StubFileError) throw new MockUsageError(err.message);
|
|
39380
39561
|
throw err;
|
|
@@ -39405,7 +39586,7 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39405
39586
|
`);
|
|
39406
39587
|
return 0;
|
|
39407
39588
|
}
|
|
39408
|
-
var
|
|
39589
|
+
var path28, MockUsageError, stopped;
|
|
39409
39590
|
var init_mock2 = __esm({
|
|
39410
39591
|
"src/cli/commands/mock.ts"() {
|
|
39411
39592
|
"use strict";
|
|
@@ -39413,7 +39594,7 @@ var init_mock2 = __esm({
|
|
|
39413
39594
|
init_schema2();
|
|
39414
39595
|
init_record();
|
|
39415
39596
|
init_server();
|
|
39416
|
-
|
|
39597
|
+
path28 = __toESM(require("path"), 1);
|
|
39417
39598
|
MockUsageError = class extends Error {
|
|
39418
39599
|
code = "MOCK_USAGE_ERROR";
|
|
39419
39600
|
constructor(message2) {
|
|
@@ -39448,16 +39629,16 @@ init_options2();
|
|
|
39448
39629
|
|
|
39449
39630
|
// src/cli/config-flag.ts
|
|
39450
39631
|
init_cjs_shims();
|
|
39451
|
-
function configFlagValues(args,
|
|
39632
|
+
function configFlagValues(args, path29) {
|
|
39452
39633
|
const out = { before: [], after: [] };
|
|
39453
39634
|
let next = 0;
|
|
39454
39635
|
let side = "before";
|
|
39455
39636
|
for (let i = 0; i < args.length; i++) {
|
|
39456
39637
|
const arg = args[i];
|
|
39457
39638
|
if (arg === "--") break;
|
|
39458
|
-
if (side === "before" && arg ===
|
|
39639
|
+
if (side === "before" && arg === path29[next]) {
|
|
39459
39640
|
next += 1;
|
|
39460
|
-
if (next ===
|
|
39641
|
+
if (next === path29.length) side = "after";
|
|
39461
39642
|
continue;
|
|
39462
39643
|
}
|
|
39463
39644
|
const long = arg.startsWith("--config=") ? arg.slice("--config=".length) : void 0;
|
|
@@ -39786,10 +39967,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39786
39967
|
});
|
|
39787
39968
|
runCommand.command("import").argument(
|
|
39788
39969
|
"<file>",
|
|
39789
|
-
"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"
|
|
39790
39971
|
).description("Turn a report another runner wrote into a run in Plune \u2014 no provider key needed").option(
|
|
39791
39972
|
"--format <fmt>",
|
|
39792
|
-
"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)"
|
|
39793
39974
|
).option(
|
|
39794
39975
|
"--min-score <category=score>",
|
|
39795
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",
|
|
@@ -39802,7 +39983,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39802
39983
|
}
|
|
39803
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(
|
|
39804
39985
|
"--fail-on-missing-attachments",
|
|
39805
|
-
"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",
|
|
39806
39987
|
false
|
|
39807
39988
|
).option(
|
|
39808
39989
|
"--upload-concurrency <n>",
|
|
@@ -39997,10 +40178,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39997
40178
|
const { handleLogin: handleLogin2, reportLoginFailure: reportLoginFailure2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
39998
40179
|
try {
|
|
39999
40180
|
const token2 = options.token ?? await readTokenFromStdin();
|
|
40000
|
-
const { path:
|
|
40181
|
+
const { path: path29, verified } = await handleLogin2({ token: token2, skipVerify: options.skipVerify });
|
|
40001
40182
|
process.stdout.write(
|
|
40002
|
-
verified ? `Logged in. Token checked against the API and saved to ${
|
|
40003
|
-
` : `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).
|
|
40004
40185
|
`
|
|
40005
40186
|
);
|
|
40006
40187
|
} catch (err) {
|
|
@@ -40017,9 +40198,9 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40017
40198
|
const verbose = command.optsWithGlobals().verbose === true;
|
|
40018
40199
|
const { handleLogout: handleLogout2 } = await Promise.resolve().then(() => (init_logout(), logout_exports));
|
|
40019
40200
|
try {
|
|
40020
|
-
const { removed, path:
|
|
40201
|
+
const { removed, path: path29 } = handleLogout2();
|
|
40021
40202
|
process.stdout.write(
|
|
40022
|
-
removed ? `Logged out. Removed ${
|
|
40203
|
+
removed ? `Logged out. Removed ${path29}
|
|
40023
40204
|
` : "Not logged in \u2014 nothing to remove.\n"
|
|
40024
40205
|
);
|
|
40025
40206
|
} catch (err) {
|