@plune-ai/cli 0.40.1 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/dist/cli.cjs +547 -310
- package/dist/index.cjs +70 -7
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +70 -7
- 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) {
|
|
@@ -5873,13 +5873,13 @@ async function start(options = {}) {
|
|
|
5873
5873
|
hold(writeSlowly(res, rendered.body, failure2.bytes_per_sec, timers));
|
|
5874
5874
|
return;
|
|
5875
5875
|
case "truncated_json": {
|
|
5876
|
-
const
|
|
5876
|
+
const cut6 = rendered.body.subarray(0, Math.floor(rendered.body.length / 2));
|
|
5877
5877
|
if (failure2.content_length === "cut") {
|
|
5878
|
-
head(
|
|
5879
|
-
res.end(
|
|
5878
|
+
head(cut6.length);
|
|
5879
|
+
res.end(cut6);
|
|
5880
5880
|
} else {
|
|
5881
5881
|
head(rendered.body.length);
|
|
5882
|
-
res.write(
|
|
5882
|
+
res.write(cut6, () => res.destroy());
|
|
5883
5883
|
}
|
|
5884
5884
|
return;
|
|
5885
5885
|
}
|
|
@@ -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
|
}
|
|
@@ -22098,7 +22272,7 @@ async function rawRequest(target4, req, limits = {}) {
|
|
|
22098
22272
|
const events = [];
|
|
22099
22273
|
let bytes = 0;
|
|
22100
22274
|
let ended = false;
|
|
22101
|
-
let
|
|
22275
|
+
let cut6;
|
|
22102
22276
|
const parser = sseParser();
|
|
22103
22277
|
const decoder = new TextDecoder();
|
|
22104
22278
|
if (res.body !== null && limits.headersOnly !== true) {
|
|
@@ -22118,7 +22292,7 @@ async function rawRequest(target4, req, limits = {}) {
|
|
|
22118
22292
|
events.push(e);
|
|
22119
22293
|
if (events.length > maxEvents) {
|
|
22120
22294
|
events.pop();
|
|
22121
|
-
|
|
22295
|
+
cut6 = "events";
|
|
22122
22296
|
break read;
|
|
22123
22297
|
}
|
|
22124
22298
|
if (limits.stopWhen?.(e) === true) {
|
|
@@ -22128,12 +22302,12 @@ async function rawRequest(target4, req, limits = {}) {
|
|
|
22128
22302
|
}
|
|
22129
22303
|
}
|
|
22130
22304
|
if (fed.tooLong) {
|
|
22131
|
-
|
|
22305
|
+
cut6 = "line";
|
|
22132
22306
|
break;
|
|
22133
22307
|
}
|
|
22134
22308
|
}
|
|
22135
22309
|
if (bytes > maxBytes) {
|
|
22136
|
-
|
|
22310
|
+
cut6 = "bytes";
|
|
22137
22311
|
break;
|
|
22138
22312
|
}
|
|
22139
22313
|
}
|
|
@@ -22158,7 +22332,7 @@ async function rawRequest(target4, req, limits = {}) {
|
|
|
22158
22332
|
utf8,
|
|
22159
22333
|
events,
|
|
22160
22334
|
ended,
|
|
22161
|
-
...
|
|
22335
|
+
...cut6 === void 0 ? {} : { cut: cut6 },
|
|
22162
22336
|
ms: Math.round(performance.now() - started)
|
|
22163
22337
|
};
|
|
22164
22338
|
}
|
|
@@ -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) {
|
|
@@ -25723,8 +25897,8 @@ async function streams(ctx) {
|
|
|
25723
25897
|
const got2 = await probed(ctx);
|
|
25724
25898
|
if (isOutcome3(got2)) return got2;
|
|
25725
25899
|
const sse = [got2.p, ...await concurrent(ctx, got2.s)].filter((a) => isSse(a.res));
|
|
25726
|
-
const
|
|
25727
|
-
return
|
|
25900
|
+
const cut6 = sse.find((a) => a.res.cut !== void 0);
|
|
25901
|
+
return cut6 === void 0 ? sse : tooMuch(cut6);
|
|
25728
25902
|
}
|
|
25729
25903
|
var ACCEPT, LINGER_MS, BROADCAST_MS, ok, isSse, parsed3, answers2, probeMethod, opened, isOutcome3, session, probe2, concurrent, notificationAccepted, contentType, utf8Json, singleEndpoint, getStreamOr405, modernGetDelete405, sessionIdAscii, sessionRequired400, INVALID_VERSION, versionHeaderInvalid400, concurrentMatched, cutOf, tooMuch, noSse, eventIdsUnique, streamCloses, noServerRequests, accelBuffering, closeCancels, sessionTerminated404, noBroadcast, TRANSPORT;
|
|
25730
25904
|
var init_transport = __esm({
|
|
@@ -25795,8 +25969,8 @@ var init_transport = __esm({
|
|
|
25795
25969
|
const got2 = await probed(ctx);
|
|
25796
25970
|
if (isOutcome3(got2)) return got2;
|
|
25797
25971
|
const { res, detail } = got2.p;
|
|
25798
|
-
const
|
|
25799
|
-
if (
|
|
25972
|
+
const cut6 = cutOf(res, detail);
|
|
25973
|
+
if (cut6 !== void 0) return cut6;
|
|
25800
25974
|
const fix = "Send every JSON-RPC message as JSON encoded in UTF-8.";
|
|
25801
25975
|
if (!res.utf8) return { ...failed("The body of the answer is not valid UTF-8.", fix), details: [detail] };
|
|
25802
25976
|
const messages = isSse(res) ? res.events.map((e) => e.data).filter((d) => d !== "") : [res.body];
|
|
@@ -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 cut6 = 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) cut6 += 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 (cut6 > 0) notes.push(`plune: ${cut6} 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) {
|
|
@@ -37085,35 +37265,86 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
37085
37265
|
cases = casesFromDesign(report, deps.notes ?? []);
|
|
37086
37266
|
}
|
|
37087
37267
|
const tokens2 = own3(asRecord2(own3(report, "cost")), "totalTokens");
|
|
37268
|
+
const observations = await readObservations(dir, deps.notes ?? []);
|
|
37088
37269
|
return {
|
|
37089
37270
|
schemaVersion: INGEST_SCHEMA_VERSION,
|
|
37090
37271
|
run: {
|
|
37091
|
-
runId: str(report["runId"],
|
|
37272
|
+
runId: str(report["runId"], path24.basename(dir)),
|
|
37092
37273
|
mode,
|
|
37093
37274
|
target: str(report["url"], "unknown"),
|
|
37094
37275
|
// Cairn states the run's tokens as `cost.totalTokens` in every mode; the platform copies it onto each proposal.
|
|
37095
37276
|
...Number.isInteger(tokens2) && tokens2 >= 0 ? { cost: { tokens: tokens2, cases: cases.length } } : {}
|
|
37096
37277
|
},
|
|
37097
|
-
cases
|
|
37278
|
+
cases,
|
|
37279
|
+
...observations !== void 0 && observations.length > 0 ? { observations } : {}
|
|
37098
37280
|
};
|
|
37099
37281
|
}
|
|
37282
|
+
async function readObservations(dir, notes) {
|
|
37283
|
+
const file = "observations.json";
|
|
37284
|
+
if (!await checkSize(dir, file)) return void 0;
|
|
37285
|
+
const raw = await readJson(path24.join(dir, file));
|
|
37286
|
+
if (raw === void 0 || typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
37287
|
+
throw new CairnArtifactShapeError(file, "", "is not a JSON object");
|
|
37288
|
+
}
|
|
37289
|
+
const doc = raw;
|
|
37290
|
+
if (own3(doc, "schemaVersion") !== SUPPORTED_ARTIFACT_VERSION) {
|
|
37291
|
+
throw new CairnRunVersionError(`${String(own3(doc, "schemaVersion"))} (in ${file})`);
|
|
37292
|
+
}
|
|
37293
|
+
const items2 = own3(doc, "observations");
|
|
37294
|
+
if (!Array.isArray(items2)) throw new CairnArtifactShapeError(file, "observations", "is not a list");
|
|
37295
|
+
const out = [];
|
|
37296
|
+
let dropped = 0;
|
|
37297
|
+
let clipped = false;
|
|
37298
|
+
for (const item of items2) {
|
|
37299
|
+
const o = asRecord2(item);
|
|
37300
|
+
const kind2 = own3(o, "kind");
|
|
37301
|
+
const severity2 = own3(o, "severity");
|
|
37302
|
+
const [title, page, evidence] = ["title", "page", "evidence"].map((k) => own3(o, k));
|
|
37303
|
+
const repro = own3(o, "repro");
|
|
37304
|
+
const steps = Array.isArray(repro) ? repro.filter((s) => typeof s === "string" && s.trim() !== "") : [];
|
|
37305
|
+
if (!OBSERVATION_KINDS.includes(kind2) || severity2 !== "low" && severity2 !== "medium" && severity2 !== "high" || [title, page, evidence].some((v) => typeof v !== "string" || v.trim() === "") || steps.length === 0) {
|
|
37306
|
+
dropped++;
|
|
37307
|
+
continue;
|
|
37308
|
+
}
|
|
37309
|
+
const L3 = OBSERVATION_LIMITS;
|
|
37310
|
+
const t = title.trim();
|
|
37311
|
+
const p = page;
|
|
37312
|
+
const e = redactSecrets(evidence);
|
|
37313
|
+
clipped ||= t.length > L3.title || p.length > L3.page || e.length > L3.evidence || steps.length > L3.steps || steps.some((s) => s.length > L3.step);
|
|
37314
|
+
out.push({
|
|
37315
|
+
kind: kind2,
|
|
37316
|
+
severity: severity2,
|
|
37317
|
+
title: cut4(t, L3.title),
|
|
37318
|
+
page: cut4(p, L3.page),
|
|
37319
|
+
repro: steps.slice(0, L3.steps).map((s) => cut4(s, L3.step)),
|
|
37320
|
+
evidence: cut4(e, L3.evidence)
|
|
37321
|
+
});
|
|
37322
|
+
}
|
|
37323
|
+
if (dropped > 0) notes.push(`plune: ${dropped} observation(s) of a kind or shape this CLI does not know \u2014 not sent.`);
|
|
37324
|
+
if (clipped) notes.push("plune: some observations carry text over the platform's bounds \u2014 sent cut.");
|
|
37325
|
+
if (out.length > OBSERVATION_LIMITS.perRun) {
|
|
37326
|
+
notes.push(`plune: ${out.length - OBSERVATION_LIMITS.perRun} observation(s) over the ${OBSERVATION_LIMITS.perRun} a run may carry \u2014 not sent.`);
|
|
37327
|
+
return out.slice(0, OBSERVATION_LIMITS.perRun);
|
|
37328
|
+
}
|
|
37329
|
+
return out;
|
|
37330
|
+
}
|
|
37100
37331
|
async function readCairnSessionFiles(dir) {
|
|
37101
|
-
const raw = await readJson(
|
|
37332
|
+
const raw = await readJson(path24.join(dir, "screencasts", "screencasts.json"));
|
|
37102
37333
|
if (!Array.isArray(raw)) return void 0;
|
|
37103
|
-
const root = await fs20.realpath(dir).catch(() =>
|
|
37334
|
+
const root = await fs20.realpath(dir).catch(() => path24.resolve(dir));
|
|
37104
37335
|
const within2 = (p) => {
|
|
37105
|
-
const rel =
|
|
37106
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
37336
|
+
const rel = path24.relative(root, p);
|
|
37337
|
+
return rel !== "" && !rel.startsWith("..") && !path24.isAbsolute(rel);
|
|
37107
37338
|
};
|
|
37108
37339
|
let outside = 0;
|
|
37109
37340
|
const inside = async (p) => {
|
|
37110
37341
|
if (typeof p !== "string" || p === "") return void 0;
|
|
37111
|
-
const abs =
|
|
37342
|
+
const abs = path24.resolve(root, p);
|
|
37112
37343
|
const real = await fs20.realpath(abs).catch(() => void 0);
|
|
37113
37344
|
if (within2(abs) && (real === void 0 || within2(real))) {
|
|
37114
37345
|
const file = real ?? abs;
|
|
37115
37346
|
const size = await fs20.stat(file).then((s) => s.size, () => void 0);
|
|
37116
|
-
return { path: file, rel:
|
|
37347
|
+
return { path: file, rel: path24.relative(root, abs).split(path24.sep).join("/"), ...size !== void 0 ? { size } : {} };
|
|
37117
37348
|
}
|
|
37118
37349
|
outside += 1;
|
|
37119
37350
|
return void 0;
|
|
@@ -37139,7 +37370,7 @@ async function readCairnSessionFiles(dir) {
|
|
|
37139
37370
|
const keys = new Set(declared2.flatMap((s) => s.files.map((f) => f.key)));
|
|
37140
37371
|
const title = clip(str(own3(rec, "test")));
|
|
37141
37372
|
const files = found.filter((f) => {
|
|
37142
|
-
if ((f.file.size ?? 0) < 1 || f.rel.length > DECLARED.text ||
|
|
37373
|
+
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
37374
|
keys.add(f.rel);
|
|
37144
37375
|
return true;
|
|
37145
37376
|
});
|
|
@@ -37155,24 +37386,27 @@ async function readCairnSessionFiles(dir) {
|
|
|
37155
37386
|
const atMs = own3(chapter, "atMs");
|
|
37156
37387
|
return t !== "" && Number.isInteger(atMs) && atMs >= 0 ? [{ title: t, atMs }] : [];
|
|
37157
37388
|
}).slice(0, DECLARED.chapters),
|
|
37158
|
-
files: files.map((f) => ({ key: f.rel, name:
|
|
37389
|
+
files: files.map((f) => ({ key: f.rel, name: path24.basename(f.file.path), kind: f.kind, size: f.file.size }))
|
|
37159
37390
|
});
|
|
37160
37391
|
screencasts.set(stableId, declared2);
|
|
37161
37392
|
}
|
|
37162
37393
|
return { byCase, screencasts, unmapped, outside };
|
|
37163
37394
|
}
|
|
37164
|
-
var fs20,
|
|
37395
|
+
var fs20, path24, SUPPORTED_ARTIFACT_VERSION, INGEST_SCHEMA_VERSION, RATIONALE_MAX, OBSERVATION_KINDS, OBSERVATION_LIMITS, NoCairnRunsError, CairnRunNotFoundError, CairnRunVersionError, CairnRunPartialError, CairnArtifactShapeError, CairnEvidenceAmbiguousError, asRecord2, str, own3, MAX_ARTIFACT_BYTES, MAX_MCP_CASES, ARGS_CHARS2, SECRET_NAME2, maskNamed, MCP_STATES, cut4, DECLARED, clip;
|
|
37165
37396
|
var init_cairn_artifact = __esm({
|
|
37166
37397
|
"src/cli/commands/cairn-artifact.ts"() {
|
|
37167
37398
|
"use strict";
|
|
37168
37399
|
init_cjs_shims();
|
|
37169
37400
|
fs20 = __toESM(require("fs/promises"), 1);
|
|
37170
|
-
|
|
37401
|
+
path24 = __toESM(require("path"), 1);
|
|
37171
37402
|
init_trace_url();
|
|
37172
37403
|
init_config();
|
|
37173
37404
|
init_errors2();
|
|
37174
37405
|
SUPPORTED_ARTIFACT_VERSION = 1;
|
|
37175
37406
|
INGEST_SCHEMA_VERSION = 1;
|
|
37407
|
+
RATIONALE_MAX = 400;
|
|
37408
|
+
OBSERVATION_KINDS = ["console-error", "page-error", "request-failed", "dead-click", "layout-defect", "a11y-violation"];
|
|
37409
|
+
OBSERVATION_LIMITS = { perRun: 200, title: 200, page: 2048, steps: 50, step: 400, evidence: 2e3 };
|
|
37176
37410
|
NoCairnRunsError = class extends Error {
|
|
37177
37411
|
constructor(runsDir) {
|
|
37178
37412
|
super(`No Cairn run found under ${runsDir} \u2014 name the directory instead: plune ingest <dir>.`);
|
|
@@ -37243,8 +37477,9 @@ var init_cairn_artifact = __esm({
|
|
|
37243
37477
|
"could-not-run",
|
|
37244
37478
|
"needs-review"
|
|
37245
37479
|
]);
|
|
37480
|
+
cut4 = (s, max) => s.length > max ? s.slice(0, max) : s;
|
|
37246
37481
|
DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
37247
|
-
clip = (s) => s.slice(0,
|
|
37482
|
+
clip = (s, max = DECLARED.text) => s.slice(0, max).replace(/[\uD800-\uDBFF]$/, "");
|
|
37248
37483
|
}
|
|
37249
37484
|
});
|
|
37250
37485
|
|
|
@@ -37319,13 +37554,13 @@ async function sendSessionFiles(session2, sent, platform) {
|
|
|
37319
37554
|
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
37320
37555
|
placed.add(item.stableId);
|
|
37321
37556
|
for (const { path: file, size, key } of paths) {
|
|
37322
|
-
const name =
|
|
37557
|
+
const name = path25.basename(file);
|
|
37323
37558
|
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
37324
37559
|
tooBig += 1;
|
|
37325
37560
|
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
37326
37561
|
continue;
|
|
37327
37562
|
}
|
|
37328
|
-
const type = TYPE_BY_EXTENSION2[
|
|
37563
|
+
const type = TYPE_BY_EXTENSION2[path25.extname(file).toLowerCase()] ?? "application/octet-stream";
|
|
37329
37564
|
jobs.push({
|
|
37330
37565
|
id: item.reviewItemId ?? item.resultId,
|
|
37331
37566
|
...item.reviewItemId !== void 0 ? { owner: "review-items" } : {},
|
|
@@ -37401,7 +37636,7 @@ async function handleIngest(deps) {
|
|
|
37401
37636
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
37402
37637
|
const endpoint = `${apiUrl}/v1/ingest/cairn`;
|
|
37403
37638
|
const job = new JobReporter(doFetch, apiUrl, token2, "ingest");
|
|
37404
|
-
await job.open(
|
|
37639
|
+
await job.open(path25.basename(path25.resolve(dir)), payload2.cases.length);
|
|
37405
37640
|
try {
|
|
37406
37641
|
const { result: result2, ...sent } = await upload();
|
|
37407
37642
|
await job.uploaded({ subjectId: result2.runId || void 0 });
|
|
@@ -37439,7 +37674,8 @@ async function handleIngest(deps) {
|
|
|
37439
37674
|
runId: typeof body.runId === "string" ? body.runId : "",
|
|
37440
37675
|
linked: typeof body.linked === "number" ? body.linked : 0,
|
|
37441
37676
|
proposed: typeof body.proposed === "number" ? body.proposed : 0,
|
|
37442
|
-
skipped: typeof body.skipped === "number" ? body.skipped : 0
|
|
37677
|
+
skipped: typeof body.skipped === "number" ? body.skipped : 0,
|
|
37678
|
+
...payload2.observations !== void 0 && typeof body.observed === "number" ? { observed: body.observed } : {}
|
|
37443
37679
|
};
|
|
37444
37680
|
return { result: result2, items: itemsOf(body), repeat: res.status === 200 };
|
|
37445
37681
|
}
|
|
@@ -37474,17 +37710,18 @@ function formatIngestResult(r) {
|
|
|
37474
37710
|
` ${r.linked} result(s) attached to existing cases`,
|
|
37475
37711
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
37476
37712
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
37713
|
+
...r.observed !== void 0 ? [` Observations: ${r.observed} queued \u2014 file a bug or dismiss each in Plune`] : [],
|
|
37477
37714
|
...files
|
|
37478
37715
|
];
|
|
37479
37716
|
return `${lines.join("\n")}
|
|
37480
37717
|
`;
|
|
37481
37718
|
}
|
|
37482
|
-
var
|
|
37719
|
+
var path25, IngestNotLoggedInError, IngestTokenRejectedError, IngestNetworkError, IngestHttpError, SESSION_FILE_MAX, SESSION_UPLOADS_AT_ONCE, TYPE_BY_EXTENSION2, RESULT_PAGES_MAX, namesOf, targetOf3;
|
|
37483
37720
|
var init_ingest = __esm({
|
|
37484
37721
|
"src/cli/commands/ingest.ts"() {
|
|
37485
37722
|
"use strict";
|
|
37486
37723
|
init_cjs_shims();
|
|
37487
|
-
|
|
37724
|
+
path25 = __toESM(require("path"), 1);
|
|
37488
37725
|
init_client();
|
|
37489
37726
|
init_env2();
|
|
37490
37727
|
init_session2();
|
|
@@ -37533,7 +37770,7 @@ __export(requirements_import_exports, {
|
|
|
37533
37770
|
MAX_MARKDOWN_BYTES: () => MAX_MARKDOWN_BYTES,
|
|
37534
37771
|
RequirementsImportError: () => RequirementsImportError,
|
|
37535
37772
|
buildImportBody: () => buildImportBody,
|
|
37536
|
-
cut: () =>
|
|
37773
|
+
cut: () => cut5,
|
|
37537
37774
|
flat: () => flat2,
|
|
37538
37775
|
formatDiscover: () => formatDiscover,
|
|
37539
37776
|
formatReport: () => formatReport3,
|
|
@@ -37713,7 +37950,7 @@ function formatDiscover(file, r) {
|
|
|
37713
37950
|
if (r.tables.length === 0) out.push(" (none)");
|
|
37714
37951
|
for (const t of r.tables) {
|
|
37715
37952
|
const mark = t.unreadable !== void 0 ? ` cannot be read: ${t.unreadable}` : t.looksLikeRequirements ? " <- looks like requirements" : "";
|
|
37716
|
-
out.push(` #${t.index} line ${t.line} ${t.heading === null ? "(no heading)" : `"${flat2(t.heading)}"`} ${
|
|
37953
|
+
out.push(` #${t.index} line ${t.line} ${t.heading === null ? "(no heading)" : `"${flat2(t.heading)}"`} ${cut5(t.headers.map(flat2).join(" | "), 100)} ${plural8(t.rowCount, "row")}${mark}`);
|
|
37717
37954
|
}
|
|
37718
37955
|
out.push("", "Sections");
|
|
37719
37956
|
if (r.sections.length === 0) out.push(" (none)");
|
|
@@ -37745,8 +37982,8 @@ function formatReport3(report) {
|
|
|
37745
37982
|
for (const i of rows.slice(0, SHOWN4)) {
|
|
37746
37983
|
const changes = i.changes !== void 0 && i.changes.length > 0 ? `; changes: ${i.changes.join(", ")}` : "";
|
|
37747
37984
|
const notes = i.notes !== void 0 && i.notes.length > 0 ? `; note: ${i.notes.join("; ")}` : "";
|
|
37748
|
-
const from = i.table === void 0 ? "" : `table #${i.table}${i.tableHeading ? ` "${
|
|
37749
|
-
out.push(` ${from}line ${i.line} ${i.key ?? "-"} ${
|
|
37985
|
+
const from = i.table === void 0 ? "" : `table #${i.table}${i.tableHeading ? ` "${cut5(flat2(i.tableHeading), 40)}"` : ""} `;
|
|
37986
|
+
out.push(` ${from}line ${i.line} ${i.key ?? "-"} ${cut5(flat2(i.title), 80)} - ${flat2(i.reason)}${changes}${notes}`);
|
|
37750
37987
|
}
|
|
37751
37988
|
if (rows.length > SHOWN4) out.push(` ... and ${rows.length - SHOWN4} more (--json lists every row)`);
|
|
37752
37989
|
}
|
|
@@ -37758,7 +37995,7 @@ function formatReport3(report) {
|
|
|
37758
37995
|
const n = report.notImported;
|
|
37759
37996
|
if (n.tables.length + n.sections.length + n.frontmatterKeys.length > 0) {
|
|
37760
37997
|
out.push("", "Not imported");
|
|
37761
|
-
for (const t of n.tables) out.push(` table #${t.index} ${t.heading === null ? "" : `"${flat2(t.heading)}" `}(${
|
|
37998
|
+
for (const t of n.tables) out.push(` table #${t.index} ${t.heading === null ? "" : `"${flat2(t.heading)}" `}(${cut5(t.headers.map(flat2).join(" | "), 80)}; ${plural8(t.rowCount, "row")})`);
|
|
37762
37999
|
for (const x of n.sections) out.push(` section #${x.index} "${flat2(x.heading)}" (${plural8(x.bulletCount, "bullet")})`);
|
|
37763
38000
|
if (n.frontmatterKeys.length > 0) out.push(` frontmatter keys: ${n.frontmatterKeys.join(", ")}`);
|
|
37764
38001
|
}
|
|
@@ -37770,7 +38007,7 @@ function reportRequirementsImportFailure(err, write) {
|
|
|
37770
38007
|
write(err.message + "\n");
|
|
37771
38008
|
return err.exitCode;
|
|
37772
38009
|
}
|
|
37773
|
-
var import_node_fs20, import_node_path13, MAX_MARKDOWN_BYTES, RequirementsImportError, usage, COLUMN_FLAGS, SECTION_FLAGS, oneOf5, TABLE_SPEC_KEYS, SPEC_HELP, SUPPORT, SHOWN4, flat2,
|
|
38010
|
+
var import_node_fs20, import_node_path13, MAX_MARKDOWN_BYTES, RequirementsImportError, usage, COLUMN_FLAGS, SECTION_FLAGS, oneOf5, TABLE_SPEC_KEYS, SPEC_HELP, SUPPORT, SHOWN4, flat2, cut5, plural8;
|
|
37774
38011
|
var init_requirements_import = __esm({
|
|
37775
38012
|
"src/cli/commands/requirements-import.ts"() {
|
|
37776
38013
|
"use strict";
|
|
@@ -37826,7 +38063,7 @@ var init_requirements_import = __esm({
|
|
|
37826
38063
|
SUPPORT = "This platform does not support requirements import yet. Nothing was sent to a project; try a newer Plune platform.";
|
|
37827
38064
|
SHOWN4 = 50;
|
|
37828
38065
|
flat2 = (s) => s.replace(/\s+/g, " ").trim();
|
|
37829
|
-
|
|
38066
|
+
cut5 = (s, n) => s.length > n ? `${s.slice(0, n - 1)}\u2026` : s;
|
|
37830
38067
|
plural8 = (n, one2, many = `${one2}s`) => `${n} ${n === 1 ? one2 : many}`;
|
|
37831
38068
|
}
|
|
37832
38069
|
});
|
|
@@ -37875,7 +38112,7 @@ function formatLinksDiscover(file, r) {
|
|
|
37875
38112
|
if (r.tables.length === 0) out.push(" (none)");
|
|
37876
38113
|
for (const t of r.tables) {
|
|
37877
38114
|
const mark = t.unreadable !== void 0 ? ` cannot be read: ${t.unreadable}` : "";
|
|
37878
|
-
out.push(` #${t.index} line ${t.line} ${t.heading === null ? "(no heading)" : `"${flat2(t.heading)}"`} ${
|
|
38115
|
+
out.push(` #${t.index} line ${t.line} ${t.heading === null ? "(no heading)" : `"${flat2(t.heading)}"`} ${cut5(t.headers.map(flat2).join(" | "), 100)} ${plural8(t.rowCount, "row")}${mark}`);
|
|
37879
38116
|
}
|
|
37880
38117
|
if (r.truncated) out.push("", "The file has more tables than are listed here.");
|
|
37881
38118
|
out.push("", "Pick the matrix and name its two columns (a dry run, nothing is written):", ` plune requirements links ${file} --table <n> --requirement-column <header> --test-column <header>`);
|
|
@@ -37889,7 +38126,7 @@ function formatLinks(report) {
|
|
|
37889
38126
|
if (rows.length === 0) continue;
|
|
37890
38127
|
out.push("", `${action} (${rows.length})`);
|
|
37891
38128
|
for (const i of rows.slice(0, SHOWN5)) {
|
|
37892
|
-
out.push(` line ${i.line} ${i.key === "" ? "-" : i.key} -> ${i.test === "" ? "-" :
|
|
38129
|
+
out.push(` line ${i.line} ${i.key === "" ? "-" : i.key} -> ${i.test === "" ? "-" : cut5(flat2(i.test), 80)} - ${flat2(i.reason)}`);
|
|
37893
38130
|
}
|
|
37894
38131
|
if (rows.length > SHOWN5) out.push(` ... and ${rows.length - SHOWN5} more (--json lists every row)`);
|
|
37895
38132
|
}
|
|
@@ -38110,7 +38347,7 @@ function filteredDotenv(text6, token2) {
|
|
|
38110
38347
|
}
|
|
38111
38348
|
function filesUnder(dir) {
|
|
38112
38349
|
if (!fs21.existsSync(dir)) return [];
|
|
38113
|
-
return fs21.readdirSync(dir, { recursive: true, encoding: "utf8" }).filter((p) => fs21.statSync(
|
|
38350
|
+
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
38351
|
}
|
|
38115
38352
|
function newFilesDiff(files) {
|
|
38116
38353
|
return files.map((f) => {
|
|
@@ -38126,12 +38363,12 @@ function newFilesDiff(files) {
|
|
|
38126
38363
|
}).join("");
|
|
38127
38364
|
}
|
|
38128
38365
|
function findExecutable(command, env) {
|
|
38129
|
-
if (command.includes("/") || command.includes("\\")) return fs21.existsSync(command) ?
|
|
38366
|
+
if (command.includes("/") || command.includes("\\")) return fs21.existsSync(command) ? path26.resolve(command) : void 0;
|
|
38130
38367
|
const exts = process.platform === "win32" ? (env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";") : [""];
|
|
38131
|
-
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(
|
|
38368
|
+
const dirs = (env["PATH"] ?? env["Path"] ?? "").split(path26.delimiter).filter((d) => d !== "");
|
|
38132
38369
|
for (const dir of dirs)
|
|
38133
38370
|
for (const ext of exts) {
|
|
38134
|
-
const candidate =
|
|
38371
|
+
const candidate = path26.join(dir, command + ext);
|
|
38135
38372
|
if (fs21.existsSync(candidate) && fs21.statSync(candidate).isFile()) return candidate;
|
|
38136
38373
|
}
|
|
38137
38374
|
return void 0;
|
|
@@ -38140,7 +38377,7 @@ async function handleAutomate(deps) {
|
|
|
38140
38377
|
for (const a of deps.cairnArgs ?? [])
|
|
38141
38378
|
if (/^--(run|into-project)(=|$)/.test(a))
|
|
38142
38379
|
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 =
|
|
38380
|
+
const repo = path26.resolve(deps.repo ?? process.cwd());
|
|
38144
38381
|
if (!fs21.existsSync(repo) || !fs21.statSync(repo).isDirectory()) throw new SyncFileError(`No directory at ${repo} (--repo).`);
|
|
38145
38382
|
const env = deps.env ?? process.env;
|
|
38146
38383
|
const command = deps.cairn ?? "cairn";
|
|
@@ -38157,14 +38394,14 @@ async function handleAutomate(deps) {
|
|
|
38157
38394
|
throw err;
|
|
38158
38395
|
}
|
|
38159
38396
|
if (!detail.steps?.length) throw new CaseNotAutomatableError(deps.caseId, detail.type);
|
|
38160
|
-
const tmp = fs21.mkdtempSync(
|
|
38397
|
+
const tmp = fs21.mkdtempSync(path26.join(os.tmpdir(), "plune-automate-"));
|
|
38161
38398
|
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 =
|
|
38399
|
+
const runDir = path26.join(tmp, "run");
|
|
38400
|
+
fs21.mkdirSync(path26.join(runDir, "testcases"), { recursive: true });
|
|
38401
|
+
fs21.writeFileSync(path26.join(runDir, "report.json"), JSON.stringify({ url: deps.url ?? "", mode: "design" }, null, 2));
|
|
38402
|
+
fs21.writeFileSync(path26.join(runDir, "testcases", "ATC-PLUNE-001.md"), caseToAtcMarkdown(detail));
|
|
38403
|
+
const dotenvSource = env["DOTENV_PATH"] ?? env["DOTENV_CONFIG_PATH"] ?? path26.join(repo, ".env");
|
|
38404
|
+
const dotenvCopy = path26.join(tmp, "cairn.env");
|
|
38168
38405
|
fs21.writeFileSync(dotenvCopy, fs21.existsSync(dotenvSource) ? filteredDotenv(fs21.readFileSync(dotenvSource, "utf8"), token2) : "");
|
|
38169
38406
|
const childEnv = { ...cairnEnv(env, token2), DOTENV_PATH: dotenvCopy, DOTENV_CONFIG_PATH: dotenvCopy };
|
|
38170
38407
|
const isScript = /\.[cm]?js$/i.test(executable);
|
|
@@ -38182,8 +38419,8 @@ async function handleAutomate(deps) {
|
|
|
38182
38419
|
const { code } = await runCairn(["automate", "--run", runDir, ...deps.cairnArgs ?? []], false);
|
|
38183
38420
|
if (code === -1) throw new CairnMissingError(command);
|
|
38184
38421
|
if (code !== 0) throw new CairnFailedError(code);
|
|
38185
|
-
const testsDir =
|
|
38186
|
-
const files = filesUnder(testsDir).map((p) => ({ path: p, content: fs21.readFileSync(
|
|
38422
|
+
const testsDir = path26.join(runDir, "tests");
|
|
38423
|
+
const files = filesUnder(testsDir).map((p) => ({ path: p, content: fs21.readFileSync(path26.join(testsDir, p), "utf8") }));
|
|
38187
38424
|
if (files.length === 0) throw new CairnProducedNothingError();
|
|
38188
38425
|
const result2 = { case: detail, files, diff: newFilesDiff(files) };
|
|
38189
38426
|
if (!deps.withCairnVersion) return result2;
|
|
@@ -38354,7 +38591,7 @@ function reportAutomateFailure(err, write) {
|
|
|
38354
38591
|
}
|
|
38355
38592
|
return reportCasesFailure(err, write);
|
|
38356
38593
|
}
|
|
38357
|
-
var import_node_child_process5, fs21, os,
|
|
38594
|
+
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
38595
|
var init_automate = __esm({
|
|
38359
38596
|
"src/cli/commands/automate.ts"() {
|
|
38360
38597
|
"use strict";
|
|
@@ -38362,7 +38599,7 @@ var init_automate = __esm({
|
|
|
38362
38599
|
import_node_child_process5 = require("child_process");
|
|
38363
38600
|
fs21 = __toESM(require("fs"), 1);
|
|
38364
38601
|
os = __toESM(require("os"), 1);
|
|
38365
|
-
|
|
38602
|
+
path26 = __toESM(require("path"), 1);
|
|
38366
38603
|
init_api_url();
|
|
38367
38604
|
init_credentials();
|
|
38368
38605
|
init_plan();
|
|
@@ -38567,16 +38804,16 @@ function resolveInside(cwd, file) {
|
|
|
38567
38804
|
);
|
|
38568
38805
|
let root;
|
|
38569
38806
|
let dir;
|
|
38570
|
-
const abs =
|
|
38807
|
+
const abs = path27.resolve(cwd, file);
|
|
38571
38808
|
try {
|
|
38572
38809
|
root = fs22.realpathSync.native(cwd);
|
|
38573
|
-
dir = fs22.realpathSync.native(
|
|
38810
|
+
dir = fs22.realpathSync.native(path27.dirname(abs));
|
|
38574
38811
|
} catch {
|
|
38575
38812
|
throw outside;
|
|
38576
38813
|
}
|
|
38577
|
-
const rel =
|
|
38578
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
38579
|
-
return
|
|
38814
|
+
const rel = path27.relative(root, dir);
|
|
38815
|
+
if (rel === ".." || rel.startsWith(`..${path27.sep}`) || path27.isAbsolute(rel)) throw outside;
|
|
38816
|
+
return path27.join(dir, path27.basename(abs));
|
|
38580
38817
|
}
|
|
38581
38818
|
function isSecretBodyKey(name) {
|
|
38582
38819
|
const plain = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -39159,9 +39396,9 @@ ${stubs.join(",\n")}
|
|
|
39159
39396
|
warn("a lock of a recorder that is no longer running was found and taken over");
|
|
39160
39397
|
}
|
|
39161
39398
|
}
|
|
39162
|
-
const name =
|
|
39163
|
-
for (const entry2 of fs22.readdirSync(
|
|
39164
|
-
const left =
|
|
39399
|
+
const name = path27.basename(file);
|
|
39400
|
+
for (const entry2 of fs22.readdirSync(path27.dirname(file))) {
|
|
39401
|
+
const left = path27.join(path27.dirname(file), entry2);
|
|
39165
39402
|
if (!entry2.startsWith(`${name}.`) || !/^[0-9a-f]{32}\.tmp$/.test(entry2.slice(name.length + 1)))
|
|
39166
39403
|
continue;
|
|
39167
39404
|
if (Date.now() - fs22.statSync(left).mtimeMs > STALE_TEMP_MS) fs22.rmSync(left, { force: true });
|
|
@@ -39209,7 +39446,7 @@ ${stubs.join(",\n")}
|
|
|
39209
39446
|
}
|
|
39210
39447
|
};
|
|
39211
39448
|
}
|
|
39212
|
-
var import_node_crypto16, fs22, http3, https,
|
|
39449
|
+
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
39450
|
var init_record = __esm({
|
|
39214
39451
|
"src/mock/record.ts"() {
|
|
39215
39452
|
"use strict";
|
|
@@ -39218,7 +39455,7 @@ var init_record = __esm({
|
|
|
39218
39455
|
fs22 = __toESM(require("fs"), 1);
|
|
39219
39456
|
http3 = __toESM(require("http"), 1);
|
|
39220
39457
|
https = __toESM(require("https"), 1);
|
|
39221
|
-
|
|
39458
|
+
path27 = __toESM(require("path"), 1);
|
|
39222
39459
|
init_schema2();
|
|
39223
39460
|
init_server();
|
|
39224
39461
|
MIN_SECRET_LENGTH3 = 8;
|
|
@@ -39374,7 +39611,7 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39374
39611
|
if (flags2.force) throw new MockUsageError("--force goes with --record");
|
|
39375
39612
|
let stubs;
|
|
39376
39613
|
try {
|
|
39377
|
-
stubs = (await loadStubFile(
|
|
39614
|
+
stubs = (await loadStubFile(path28.resolve(cwd, flags2.file))).stubs;
|
|
39378
39615
|
} catch (err) {
|
|
39379
39616
|
if (err instanceof StubFileError) throw new MockUsageError(err.message);
|
|
39380
39617
|
throw err;
|
|
@@ -39405,7 +39642,7 @@ Prompts and answers are stored as they are and may hold personal or confidential
|
|
|
39405
39642
|
`);
|
|
39406
39643
|
return 0;
|
|
39407
39644
|
}
|
|
39408
|
-
var
|
|
39645
|
+
var path28, MockUsageError, stopped;
|
|
39409
39646
|
var init_mock2 = __esm({
|
|
39410
39647
|
"src/cli/commands/mock.ts"() {
|
|
39411
39648
|
"use strict";
|
|
@@ -39413,7 +39650,7 @@ var init_mock2 = __esm({
|
|
|
39413
39650
|
init_schema2();
|
|
39414
39651
|
init_record();
|
|
39415
39652
|
init_server();
|
|
39416
|
-
|
|
39653
|
+
path28 = __toESM(require("path"), 1);
|
|
39417
39654
|
MockUsageError = class extends Error {
|
|
39418
39655
|
code = "MOCK_USAGE_ERROR";
|
|
39419
39656
|
constructor(message2) {
|
|
@@ -39448,16 +39685,16 @@ init_options2();
|
|
|
39448
39685
|
|
|
39449
39686
|
// src/cli/config-flag.ts
|
|
39450
39687
|
init_cjs_shims();
|
|
39451
|
-
function configFlagValues(args,
|
|
39688
|
+
function configFlagValues(args, path29) {
|
|
39452
39689
|
const out = { before: [], after: [] };
|
|
39453
39690
|
let next = 0;
|
|
39454
39691
|
let side = "before";
|
|
39455
39692
|
for (let i = 0; i < args.length; i++) {
|
|
39456
39693
|
const arg = args[i];
|
|
39457
39694
|
if (arg === "--") break;
|
|
39458
|
-
if (side === "before" && arg ===
|
|
39695
|
+
if (side === "before" && arg === path29[next]) {
|
|
39459
39696
|
next += 1;
|
|
39460
|
-
if (next ===
|
|
39697
|
+
if (next === path29.length) side = "after";
|
|
39461
39698
|
continue;
|
|
39462
39699
|
}
|
|
39463
39700
|
const long = arg.startsWith("--config=") ? arg.slice("--config=".length) : void 0;
|
|
@@ -39786,10 +40023,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39786
40023
|
});
|
|
39787
40024
|
runCommand.command("import").argument(
|
|
39788
40025
|
"<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"
|
|
40026
|
+
"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
40027
|
).description("Turn a report another runner wrote into a run in Plune \u2014 no provider key needed").option(
|
|
39791
40028
|
"--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)"
|
|
40029
|
+
"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
40030
|
).option(
|
|
39794
40031
|
"--min-score <category=score>",
|
|
39795
40032
|
"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 +40039,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39802
40039
|
}
|
|
39803
40040
|
).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
40041
|
"--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",
|
|
40042
|
+
"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
40043
|
false
|
|
39807
40044
|
).option(
|
|
39808
40045
|
"--upload-concurrency <n>",
|
|
@@ -39997,10 +40234,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
39997
40234
|
const { handleLogin: handleLogin2, reportLoginFailure: reportLoginFailure2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
39998
40235
|
try {
|
|
39999
40236
|
const token2 = options.token ?? await readTokenFromStdin();
|
|
40000
|
-
const { path:
|
|
40237
|
+
const { path: path29, verified } = await handleLogin2({ token: token2, skipVerify: options.skipVerify });
|
|
40001
40238
|
process.stdout.write(
|
|
40002
|
-
verified ? `Logged in. Token checked against the API and saved to ${
|
|
40003
|
-
` : `Token saved to ${
|
|
40239
|
+
verified ? `Logged in. Token checked against the API and saved to ${path29}
|
|
40240
|
+
` : `Token saved to ${path29} WITHOUT being checked (--skip-verify).
|
|
40004
40241
|
`
|
|
40005
40242
|
);
|
|
40006
40243
|
} catch (err) {
|
|
@@ -40017,9 +40254,9 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
40017
40254
|
const verbose = command.optsWithGlobals().verbose === true;
|
|
40018
40255
|
const { handleLogout: handleLogout2 } = await Promise.resolve().then(() => (init_logout(), logout_exports));
|
|
40019
40256
|
try {
|
|
40020
|
-
const { removed, path:
|
|
40257
|
+
const { removed, path: path29 } = handleLogout2();
|
|
40021
40258
|
process.stdout.write(
|
|
40022
|
-
removed ? `Logged out. Removed ${
|
|
40259
|
+
removed ? `Logged out. Removed ${path29}
|
|
40023
40260
|
` : "Not logged in \u2014 nothing to remove.\n"
|
|
40024
40261
|
);
|
|
40025
40262
|
} catch (err) {
|