@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/index.cjs
CHANGED
|
@@ -6067,13 +6067,13 @@ async function start(options = {}) {
|
|
|
6067
6067
|
hold(writeSlowly(res, rendered.body, failure.bytes_per_sec, timers));
|
|
6068
6068
|
return;
|
|
6069
6069
|
case "truncated_json": {
|
|
6070
|
-
const
|
|
6070
|
+
const cut2 = rendered.body.subarray(0, Math.floor(rendered.body.length / 2));
|
|
6071
6071
|
if (failure.content_length === "cut") {
|
|
6072
|
-
head(
|
|
6073
|
-
res.end(
|
|
6072
|
+
head(cut2.length);
|
|
6073
|
+
res.end(cut2);
|
|
6074
6074
|
} else {
|
|
6075
6075
|
head(rendered.body.length);
|
|
6076
|
-
res.write(
|
|
6076
|
+
res.write(cut2, () => res.destroy());
|
|
6077
6077
|
}
|
|
6078
6078
|
return;
|
|
6079
6079
|
}
|
|
@@ -9266,6 +9266,9 @@ var safeText = (text) => noCommands(
|
|
|
9266
9266
|
// src/cli/commands/cairn-artifact.ts
|
|
9267
9267
|
var SUPPORTED_ARTIFACT_VERSION = 1;
|
|
9268
9268
|
var INGEST_SCHEMA_VERSION = 1;
|
|
9269
|
+
var RATIONALE_MAX = 400;
|
|
9270
|
+
var OBSERVATION_KINDS = ["console-error", "page-error", "request-failed", "dead-click", "layout-defect", "a11y-violation"];
|
|
9271
|
+
var OBSERVATION_LIMITS = { perRun: 200, title: 200, page: 2048, steps: 50, step: 400, evidence: 2e3 };
|
|
9269
9272
|
var NoCairnRunsError = class extends Error {
|
|
9270
9273
|
constructor(runsDir) {
|
|
9271
9274
|
super(`No Cairn run found under ${runsDir} \u2014 name the directory instead: plune ingest <dir>.`);
|
|
@@ -9536,10 +9539,14 @@ async function defaultReadEvidence(dir) {
|
|
|
9536
9539
|
function casesFromDesign(report, notes) {
|
|
9537
9540
|
const list2 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
|
|
9538
9541
|
const refused = /* @__PURE__ */ new Map();
|
|
9542
|
+
let cut2 = 0;
|
|
9539
9543
|
const cases = list2.map((raw) => {
|
|
9540
9544
|
const c = asRecord(raw);
|
|
9541
9545
|
const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
|
|
9542
9546
|
const title = str(c["title"], "untitled case");
|
|
9547
|
+
const why = own2(c, "rationale");
|
|
9548
|
+
const rationale = typeof why === "string" ? why.trim() : "";
|
|
9549
|
+
if (rationale.length > RATIONALE_MAX) cut2 += 1;
|
|
9543
9550
|
const link = own2(c, "traceUrl") ?? void 0;
|
|
9544
9551
|
const said = [];
|
|
9545
9552
|
const traceUrl = traceUrlOf(link, title, said);
|
|
@@ -9557,12 +9564,14 @@ function casesFromDesign(report, notes) {
|
|
|
9557
9564
|
expected: str(c["expected"], "(no expected result recorded)"),
|
|
9558
9565
|
...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
|
|
9559
9566
|
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
|
|
9567
|
+
...rationale !== "" ? { rationale: clip(rationale, RATIONALE_MAX) } : {},
|
|
9560
9568
|
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
9561
9569
|
};
|
|
9562
9570
|
});
|
|
9563
9571
|
for (const times of refused.values()) {
|
|
9564
9572
|
if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
|
|
9565
9573
|
}
|
|
9574
|
+
if (cut2 > 0) notes.push(`plune: ${cut2} case(s) carry an explanation over ${RATIONALE_MAX} characters \u2014 sent cut to ${RATIONALE_MAX}.`);
|
|
9566
9575
|
return cases;
|
|
9567
9576
|
}
|
|
9568
9577
|
function casesFromApi(report, verdicts) {
|
|
@@ -9615,6 +9624,7 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
9615
9624
|
cases = casesFromDesign(report, deps.notes ?? []);
|
|
9616
9625
|
}
|
|
9617
9626
|
const tokens = own2(asRecord(own2(report, "cost")), "totalTokens");
|
|
9627
|
+
const observations = await readObservations(dir, deps.notes ?? []);
|
|
9618
9628
|
return {
|
|
9619
9629
|
schemaVersion: INGEST_SCHEMA_VERSION,
|
|
9620
9630
|
run: {
|
|
@@ -9624,11 +9634,62 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
9624
9634
|
// Cairn states the run's tokens as `cost.totalTokens` in every mode; the platform copies it onto each proposal.
|
|
9625
9635
|
...Number.isInteger(tokens) && tokens >= 0 ? { cost: { tokens, cases: cases.length } } : {}
|
|
9626
9636
|
},
|
|
9627
|
-
cases
|
|
9637
|
+
cases,
|
|
9638
|
+
...observations !== void 0 && observations.length > 0 ? { observations } : {}
|
|
9628
9639
|
};
|
|
9629
9640
|
}
|
|
9641
|
+
var cut = (s, max) => s.length > max ? s.slice(0, max) : s;
|
|
9642
|
+
async function readObservations(dir, notes) {
|
|
9643
|
+
const file = "observations.json";
|
|
9644
|
+
if (!await checkSize(dir, file)) return void 0;
|
|
9645
|
+
const raw = await readJson(path9.join(dir, file));
|
|
9646
|
+
if (raw === void 0 || typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
9647
|
+
throw new CairnArtifactShapeError(file, "", "is not a JSON object");
|
|
9648
|
+
}
|
|
9649
|
+
const doc = raw;
|
|
9650
|
+
if (own2(doc, "schemaVersion") !== SUPPORTED_ARTIFACT_VERSION) {
|
|
9651
|
+
throw new CairnRunVersionError(`${String(own2(doc, "schemaVersion"))} (in ${file})`);
|
|
9652
|
+
}
|
|
9653
|
+
const items = own2(doc, "observations");
|
|
9654
|
+
if (!Array.isArray(items)) throw new CairnArtifactShapeError(file, "observations", "is not a list");
|
|
9655
|
+
const out = [];
|
|
9656
|
+
let dropped = 0;
|
|
9657
|
+
let clipped = false;
|
|
9658
|
+
for (const item of items) {
|
|
9659
|
+
const o = asRecord(item);
|
|
9660
|
+
const kind = own2(o, "kind");
|
|
9661
|
+
const severity = own2(o, "severity");
|
|
9662
|
+
const [title, page, evidence] = ["title", "page", "evidence"].map((k) => own2(o, k));
|
|
9663
|
+
const repro = own2(o, "repro");
|
|
9664
|
+
const steps = Array.isArray(repro) ? repro.filter((s) => typeof s === "string" && s.trim() !== "") : [];
|
|
9665
|
+
if (!OBSERVATION_KINDS.includes(kind) || severity !== "low" && severity !== "medium" && severity !== "high" || [title, page, evidence].some((v) => typeof v !== "string" || v.trim() === "") || steps.length === 0) {
|
|
9666
|
+
dropped++;
|
|
9667
|
+
continue;
|
|
9668
|
+
}
|
|
9669
|
+
const L3 = OBSERVATION_LIMITS;
|
|
9670
|
+
const t = title.trim();
|
|
9671
|
+
const p = page;
|
|
9672
|
+
const e = redactSecrets(evidence);
|
|
9673
|
+
clipped ||= t.length > L3.title || p.length > L3.page || e.length > L3.evidence || steps.length > L3.steps || steps.some((s) => s.length > L3.step);
|
|
9674
|
+
out.push({
|
|
9675
|
+
kind,
|
|
9676
|
+
severity,
|
|
9677
|
+
title: cut(t, L3.title),
|
|
9678
|
+
page: cut(p, L3.page),
|
|
9679
|
+
repro: steps.slice(0, L3.steps).map((s) => cut(s, L3.step)),
|
|
9680
|
+
evidence: cut(e, L3.evidence)
|
|
9681
|
+
});
|
|
9682
|
+
}
|
|
9683
|
+
if (dropped > 0) notes.push(`plune: ${dropped} observation(s) of a kind or shape this CLI does not know \u2014 not sent.`);
|
|
9684
|
+
if (clipped) notes.push("plune: some observations carry text over the platform's bounds \u2014 sent cut.");
|
|
9685
|
+
if (out.length > OBSERVATION_LIMITS.perRun) {
|
|
9686
|
+
notes.push(`plune: ${out.length - OBSERVATION_LIMITS.perRun} observation(s) over the ${OBSERVATION_LIMITS.perRun} a run may carry \u2014 not sent.`);
|
|
9687
|
+
return out.slice(0, OBSERVATION_LIMITS.perRun);
|
|
9688
|
+
}
|
|
9689
|
+
return out;
|
|
9690
|
+
}
|
|
9630
9691
|
var DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
9631
|
-
var clip = (s) => s.slice(0,
|
|
9692
|
+
var clip = (s, max = DECLARED.text) => s.slice(0, max).replace(/[\uD800-\uDBFF]$/, "");
|
|
9632
9693
|
async function readCairnSessionFiles(dir) {
|
|
9633
9694
|
const raw = await readJson(path9.join(dir, "screencasts", "screencasts.json"));
|
|
9634
9695
|
if (!Array.isArray(raw)) return void 0;
|
|
@@ -9907,7 +9968,8 @@ async function handleIngest(deps) {
|
|
|
9907
9968
|
runId: typeof body.runId === "string" ? body.runId : "",
|
|
9908
9969
|
linked: typeof body.linked === "number" ? body.linked : 0,
|
|
9909
9970
|
proposed: typeof body.proposed === "number" ? body.proposed : 0,
|
|
9910
|
-
skipped: typeof body.skipped === "number" ? body.skipped : 0
|
|
9971
|
+
skipped: typeof body.skipped === "number" ? body.skipped : 0,
|
|
9972
|
+
...payload.observations !== void 0 && typeof body.observed === "number" ? { observed: body.observed } : {}
|
|
9911
9973
|
};
|
|
9912
9974
|
return { result, items: itemsOf(body), repeat: res.status === 200 };
|
|
9913
9975
|
}
|
|
@@ -9942,6 +10004,7 @@ function formatIngestResult(r) {
|
|
|
9942
10004
|
` ${r.linked} result(s) attached to existing cases`,
|
|
9943
10005
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
9944
10006
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
10007
|
+
...r.observed !== void 0 ? [` Observations: ${r.observed} queued \u2014 file a bug or dismiss each in Plune`] : [],
|
|
9945
10008
|
...files
|
|
9946
10009
|
];
|
|
9947
10010
|
return `${lines.join("\n")}
|
package/dist/index.d.cts
CHANGED
|
@@ -1459,6 +1459,8 @@ interface IngestResult {
|
|
|
1459
1459
|
linked: number;
|
|
1460
1460
|
proposed: number;
|
|
1461
1461
|
skipped: number;
|
|
1462
|
+
/** Observations queued for review; absent when the run sent none or the platform does not count them. */
|
|
1463
|
+
observed?: number;
|
|
1462
1464
|
/** Why the platform's job queue did not take this ingest's report: the first refusal or error. The run is recorded. */
|
|
1463
1465
|
jobProblem?: string;
|
|
1464
1466
|
/** What became of the run's recordings (videos, traces): a count, then a line per reason a file stayed behind. */
|
|
@@ -1499,6 +1501,8 @@ interface CairnIngestCase {
|
|
|
1499
1501
|
verdict?: CairnVerdict;
|
|
1500
1502
|
technique?: string;
|
|
1501
1503
|
priority?: string;
|
|
1504
|
+
/** Why the case exists, in the words of whoever wrote it; the review queue shows it when the proposal is opened. */
|
|
1505
|
+
rationale?: string;
|
|
1502
1506
|
/** The https address of the run's trace, as the report gives it to the case. Absent when it gives none or the link is refused. */
|
|
1503
1507
|
traceUrl?: string;
|
|
1504
1508
|
/** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
|
|
@@ -1534,6 +1538,17 @@ interface CairnIngestPayload {
|
|
|
1534
1538
|
};
|
|
1535
1539
|
};
|
|
1536
1540
|
cases: CairnIngestCase[];
|
|
1541
|
+
/** What an exploration noticed without a test failing (Cairn's `observations.json`); absent when the run wrote none. */
|
|
1542
|
+
observations?: CairnObservation[];
|
|
1543
|
+
}
|
|
1544
|
+
declare const OBSERVATION_KINDS: readonly ["console-error", "page-error", "request-failed", "dead-click", "layout-defect", "a11y-violation"];
|
|
1545
|
+
interface CairnObservation {
|
|
1546
|
+
kind: (typeof OBSERVATION_KINDS)[number];
|
|
1547
|
+
severity: 'low' | 'medium' | 'high';
|
|
1548
|
+
title: string;
|
|
1549
|
+
page: string;
|
|
1550
|
+
repro: string[];
|
|
1551
|
+
evidence: string;
|
|
1537
1552
|
}
|
|
1538
1553
|
interface EvidenceRecord {
|
|
1539
1554
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1459,6 +1459,8 @@ interface IngestResult {
|
|
|
1459
1459
|
linked: number;
|
|
1460
1460
|
proposed: number;
|
|
1461
1461
|
skipped: number;
|
|
1462
|
+
/** Observations queued for review; absent when the run sent none or the platform does not count them. */
|
|
1463
|
+
observed?: number;
|
|
1462
1464
|
/** Why the platform's job queue did not take this ingest's report: the first refusal or error. The run is recorded. */
|
|
1463
1465
|
jobProblem?: string;
|
|
1464
1466
|
/** What became of the run's recordings (videos, traces): a count, then a line per reason a file stayed behind. */
|
|
@@ -1499,6 +1501,8 @@ interface CairnIngestCase {
|
|
|
1499
1501
|
verdict?: CairnVerdict;
|
|
1500
1502
|
technique?: string;
|
|
1501
1503
|
priority?: string;
|
|
1504
|
+
/** Why the case exists, in the words of whoever wrote it; the review queue shows it when the proposal is opened. */
|
|
1505
|
+
rationale?: string;
|
|
1502
1506
|
/** The https address of the run's trace, as the report gives it to the case. Absent when it gives none or the link is refused. */
|
|
1503
1507
|
traceUrl?: string;
|
|
1504
1508
|
/** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
|
|
@@ -1534,6 +1538,17 @@ interface CairnIngestPayload {
|
|
|
1534
1538
|
};
|
|
1535
1539
|
};
|
|
1536
1540
|
cases: CairnIngestCase[];
|
|
1541
|
+
/** What an exploration noticed without a test failing (Cairn's `observations.json`); absent when the run wrote none. */
|
|
1542
|
+
observations?: CairnObservation[];
|
|
1543
|
+
}
|
|
1544
|
+
declare const OBSERVATION_KINDS: readonly ["console-error", "page-error", "request-failed", "dead-click", "layout-defect", "a11y-violation"];
|
|
1545
|
+
interface CairnObservation {
|
|
1546
|
+
kind: (typeof OBSERVATION_KINDS)[number];
|
|
1547
|
+
severity: 'low' | 'medium' | 'high';
|
|
1548
|
+
title: string;
|
|
1549
|
+
page: string;
|
|
1550
|
+
repro: string[];
|
|
1551
|
+
evidence: string;
|
|
1537
1552
|
}
|
|
1538
1553
|
interface EvidenceRecord {
|
|
1539
1554
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -6029,13 +6029,13 @@ async function start(options = {}) {
|
|
|
6029
6029
|
hold(writeSlowly(res, rendered.body, failure.bytes_per_sec, timers));
|
|
6030
6030
|
return;
|
|
6031
6031
|
case "truncated_json": {
|
|
6032
|
-
const
|
|
6032
|
+
const cut2 = rendered.body.subarray(0, Math.floor(rendered.body.length / 2));
|
|
6033
6033
|
if (failure.content_length === "cut") {
|
|
6034
|
-
head(
|
|
6035
|
-
res.end(
|
|
6034
|
+
head(cut2.length);
|
|
6035
|
+
res.end(cut2);
|
|
6036
6036
|
} else {
|
|
6037
6037
|
head(rendered.body.length);
|
|
6038
|
-
res.write(
|
|
6038
|
+
res.write(cut2, () => res.destroy());
|
|
6039
6039
|
}
|
|
6040
6040
|
return;
|
|
6041
6041
|
}
|
|
@@ -9228,6 +9228,9 @@ var safeText = (text) => noCommands(
|
|
|
9228
9228
|
// src/cli/commands/cairn-artifact.ts
|
|
9229
9229
|
var SUPPORTED_ARTIFACT_VERSION = 1;
|
|
9230
9230
|
var INGEST_SCHEMA_VERSION = 1;
|
|
9231
|
+
var RATIONALE_MAX = 400;
|
|
9232
|
+
var OBSERVATION_KINDS = ["console-error", "page-error", "request-failed", "dead-click", "layout-defect", "a11y-violation"];
|
|
9233
|
+
var OBSERVATION_LIMITS = { perRun: 200, title: 200, page: 2048, steps: 50, step: 400, evidence: 2e3 };
|
|
9231
9234
|
var NoCairnRunsError = class extends Error {
|
|
9232
9235
|
constructor(runsDir) {
|
|
9233
9236
|
super(`No Cairn run found under ${runsDir} \u2014 name the directory instead: plune ingest <dir>.`);
|
|
@@ -9498,10 +9501,14 @@ async function defaultReadEvidence(dir) {
|
|
|
9498
9501
|
function casesFromDesign(report, notes) {
|
|
9499
9502
|
const list2 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
|
|
9500
9503
|
const refused = /* @__PURE__ */ new Map();
|
|
9504
|
+
let cut2 = 0;
|
|
9501
9505
|
const cases = list2.map((raw) => {
|
|
9502
9506
|
const c = asRecord(raw);
|
|
9503
9507
|
const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
|
|
9504
9508
|
const title = str(c["title"], "untitled case");
|
|
9509
|
+
const why = own2(c, "rationale");
|
|
9510
|
+
const rationale = typeof why === "string" ? why.trim() : "";
|
|
9511
|
+
if (rationale.length > RATIONALE_MAX) cut2 += 1;
|
|
9505
9512
|
const link = own2(c, "traceUrl") ?? void 0;
|
|
9506
9513
|
const said = [];
|
|
9507
9514
|
const traceUrl = traceUrlOf(link, title, said);
|
|
@@ -9519,12 +9526,14 @@ function casesFromDesign(report, notes) {
|
|
|
9519
9526
|
expected: str(c["expected"], "(no expected result recorded)"),
|
|
9520
9527
|
...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
|
|
9521
9528
|
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
|
|
9529
|
+
...rationale !== "" ? { rationale: clip(rationale, RATIONALE_MAX) } : {},
|
|
9522
9530
|
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
9523
9531
|
};
|
|
9524
9532
|
});
|
|
9525
9533
|
for (const times of refused.values()) {
|
|
9526
9534
|
if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
|
|
9527
9535
|
}
|
|
9536
|
+
if (cut2 > 0) notes.push(`plune: ${cut2} case(s) carry an explanation over ${RATIONALE_MAX} characters \u2014 sent cut to ${RATIONALE_MAX}.`);
|
|
9528
9537
|
return cases;
|
|
9529
9538
|
}
|
|
9530
9539
|
function casesFromApi(report, verdicts) {
|
|
@@ -9577,6 +9586,7 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
9577
9586
|
cases = casesFromDesign(report, deps.notes ?? []);
|
|
9578
9587
|
}
|
|
9579
9588
|
const tokens = own2(asRecord(own2(report, "cost")), "totalTokens");
|
|
9589
|
+
const observations = await readObservations(dir, deps.notes ?? []);
|
|
9580
9590
|
return {
|
|
9581
9591
|
schemaVersion: INGEST_SCHEMA_VERSION,
|
|
9582
9592
|
run: {
|
|
@@ -9586,11 +9596,62 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
9586
9596
|
// Cairn states the run's tokens as `cost.totalTokens` in every mode; the platform copies it onto each proposal.
|
|
9587
9597
|
...Number.isInteger(tokens) && tokens >= 0 ? { cost: { tokens, cases: cases.length } } : {}
|
|
9588
9598
|
},
|
|
9589
|
-
cases
|
|
9599
|
+
cases,
|
|
9600
|
+
...observations !== void 0 && observations.length > 0 ? { observations } : {}
|
|
9590
9601
|
};
|
|
9591
9602
|
}
|
|
9603
|
+
var cut = (s, max) => s.length > max ? s.slice(0, max) : s;
|
|
9604
|
+
async function readObservations(dir, notes) {
|
|
9605
|
+
const file = "observations.json";
|
|
9606
|
+
if (!await checkSize(dir, file)) return void 0;
|
|
9607
|
+
const raw = await readJson(path10.join(dir, file));
|
|
9608
|
+
if (raw === void 0 || typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
9609
|
+
throw new CairnArtifactShapeError(file, "", "is not a JSON object");
|
|
9610
|
+
}
|
|
9611
|
+
const doc = raw;
|
|
9612
|
+
if (own2(doc, "schemaVersion") !== SUPPORTED_ARTIFACT_VERSION) {
|
|
9613
|
+
throw new CairnRunVersionError(`${String(own2(doc, "schemaVersion"))} (in ${file})`);
|
|
9614
|
+
}
|
|
9615
|
+
const items = own2(doc, "observations");
|
|
9616
|
+
if (!Array.isArray(items)) throw new CairnArtifactShapeError(file, "observations", "is not a list");
|
|
9617
|
+
const out = [];
|
|
9618
|
+
let dropped = 0;
|
|
9619
|
+
let clipped = false;
|
|
9620
|
+
for (const item of items) {
|
|
9621
|
+
const o = asRecord(item);
|
|
9622
|
+
const kind = own2(o, "kind");
|
|
9623
|
+
const severity = own2(o, "severity");
|
|
9624
|
+
const [title, page, evidence] = ["title", "page", "evidence"].map((k) => own2(o, k));
|
|
9625
|
+
const repro = own2(o, "repro");
|
|
9626
|
+
const steps = Array.isArray(repro) ? repro.filter((s) => typeof s === "string" && s.trim() !== "") : [];
|
|
9627
|
+
if (!OBSERVATION_KINDS.includes(kind) || severity !== "low" && severity !== "medium" && severity !== "high" || [title, page, evidence].some((v) => typeof v !== "string" || v.trim() === "") || steps.length === 0) {
|
|
9628
|
+
dropped++;
|
|
9629
|
+
continue;
|
|
9630
|
+
}
|
|
9631
|
+
const L3 = OBSERVATION_LIMITS;
|
|
9632
|
+
const t = title.trim();
|
|
9633
|
+
const p = page;
|
|
9634
|
+
const e = redactSecrets(evidence);
|
|
9635
|
+
clipped ||= t.length > L3.title || p.length > L3.page || e.length > L3.evidence || steps.length > L3.steps || steps.some((s) => s.length > L3.step);
|
|
9636
|
+
out.push({
|
|
9637
|
+
kind,
|
|
9638
|
+
severity,
|
|
9639
|
+
title: cut(t, L3.title),
|
|
9640
|
+
page: cut(p, L3.page),
|
|
9641
|
+
repro: steps.slice(0, L3.steps).map((s) => cut(s, L3.step)),
|
|
9642
|
+
evidence: cut(e, L3.evidence)
|
|
9643
|
+
});
|
|
9644
|
+
}
|
|
9645
|
+
if (dropped > 0) notes.push(`plune: ${dropped} observation(s) of a kind or shape this CLI does not know \u2014 not sent.`);
|
|
9646
|
+
if (clipped) notes.push("plune: some observations carry text over the platform's bounds \u2014 sent cut.");
|
|
9647
|
+
if (out.length > OBSERVATION_LIMITS.perRun) {
|
|
9648
|
+
notes.push(`plune: ${out.length - OBSERVATION_LIMITS.perRun} observation(s) over the ${OBSERVATION_LIMITS.perRun} a run may carry \u2014 not sent.`);
|
|
9649
|
+
return out.slice(0, OBSERVATION_LIMITS.perRun);
|
|
9650
|
+
}
|
|
9651
|
+
return out;
|
|
9652
|
+
}
|
|
9592
9653
|
var DECLARED = { text: 500, name: 200, chapters: 200, perCase: 20 };
|
|
9593
|
-
var clip = (s) => s.slice(0,
|
|
9654
|
+
var clip = (s, max = DECLARED.text) => s.slice(0, max).replace(/[\uD800-\uDBFF]$/, "");
|
|
9594
9655
|
async function readCairnSessionFiles(dir) {
|
|
9595
9656
|
const raw = await readJson(path10.join(dir, "screencasts", "screencasts.json"));
|
|
9596
9657
|
if (!Array.isArray(raw)) return void 0;
|
|
@@ -9869,7 +9930,8 @@ async function handleIngest(deps) {
|
|
|
9869
9930
|
runId: typeof body.runId === "string" ? body.runId : "",
|
|
9870
9931
|
linked: typeof body.linked === "number" ? body.linked : 0,
|
|
9871
9932
|
proposed: typeof body.proposed === "number" ? body.proposed : 0,
|
|
9872
|
-
skipped: typeof body.skipped === "number" ? body.skipped : 0
|
|
9933
|
+
skipped: typeof body.skipped === "number" ? body.skipped : 0,
|
|
9934
|
+
...payload.observations !== void 0 && typeof body.observed === "number" ? { observed: body.observed } : {}
|
|
9873
9935
|
};
|
|
9874
9936
|
return { result, items: itemsOf(body), repeat: res.status === 200 };
|
|
9875
9937
|
}
|
|
@@ -9904,6 +9966,7 @@ function formatIngestResult(r) {
|
|
|
9904
9966
|
` ${r.linked} result(s) attached to existing cases`,
|
|
9905
9967
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
9906
9968
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
9969
|
+
...r.observed !== void 0 ? [` Observations: ${r.observed} queued \u2014 file a bug or dismiss each in Plune`] : [],
|
|
9907
9970
|
...files
|
|
9908
9971
|
];
|
|
9909
9972
|
return `${lines.join("\n")}
|
package/dist/reporter-core.cjs
CHANGED
|
@@ -45,6 +45,7 @@ __export(reporter_core_exports, {
|
|
|
45
45
|
repoRootOf: () => repoRootOf,
|
|
46
46
|
resultKey: () => resultKey,
|
|
47
47
|
startRun: () => startRun,
|
|
48
|
+
stepTitlesOf: () => stepTitlesOf,
|
|
48
49
|
webLink: () => webLink
|
|
49
50
|
});
|
|
50
51
|
module.exports = __toCommonJS(reporter_core_exports);
|
|
@@ -567,6 +568,11 @@ function chosen({ status, errors }) {
|
|
|
567
568
|
}
|
|
568
569
|
return errors[0];
|
|
569
570
|
}
|
|
571
|
+
function stepTitlesOf(attempt) {
|
|
572
|
+
if (attempt.status !== "passed") return void 0;
|
|
573
|
+
const titles = attempt.steps.map((s) => s.title.trim()).filter((t) => t !== "");
|
|
574
|
+
return titles.length > 0 ? titles : void 0;
|
|
575
|
+
}
|
|
570
576
|
function chainOf(steps) {
|
|
571
577
|
const chain = [];
|
|
572
578
|
for (let failed = steps.find((s) => s.failed); failed !== void 0; failed = failed.steps.find((s) => s.failed)) {
|
|
@@ -1993,5 +1999,6 @@ function resultKey(testId, retry) {
|
|
|
1993
1999
|
repoRootOf,
|
|
1994
2000
|
resultKey,
|
|
1995
2001
|
startRun,
|
|
2002
|
+
stepTitlesOf,
|
|
1996
2003
|
webLink
|
|
1997
2004
|
});
|
package/dist/reporter-core.d.cts
CHANGED
|
@@ -238,6 +238,11 @@ interface PendingResult {
|
|
|
238
238
|
* nothing found. A platform older than the field is handled as for `targets`.
|
|
239
239
|
*/
|
|
240
240
|
findings?: ResultFindings;
|
|
241
|
+
/**
|
|
242
|
+
* The titles of the top-level `test.step` calls of a passed attempt, in order (`stepTitlesOf`). The platform proposes them as the text of
|
|
243
|
+
* the test's case when they differ from its description. Absent rather than empty; a platform older than the field ignores it.
|
|
244
|
+
*/
|
|
245
|
+
stepTitles?: string[];
|
|
241
246
|
}
|
|
242
247
|
/** Where in the test a finding belongs: a declared step, by its position from 1 and its title. */
|
|
243
248
|
interface FindingStep {
|
|
@@ -713,6 +718,13 @@ declare function errorContextFields(attempt: FailedAttempt, home?: string): {
|
|
|
713
718
|
* bodies must not hold them all until a batch is sent.
|
|
714
719
|
*/
|
|
715
720
|
declare function filesOf(attempt: FailedAttempt): ResultFile[];
|
|
721
|
+
/**
|
|
722
|
+
* The titles of a passed attempt's top-level declared steps (`test.step`), in the order they ran, the empty ones left out. The platform
|
|
723
|
+
* compares them with the description of the test's case and, when they differ, queues a proposal to update it. Only a passed attempt
|
|
724
|
+
* says which steps the test has - a failed one stopped somewhere among them - and the nested steps stay out: a case's description is a
|
|
725
|
+
* flat list. Absent when there are none.
|
|
726
|
+
*/
|
|
727
|
+
declare function stepTitlesOf(attempt: Pick<FailedAttempt, 'status' | 'steps'>): string[] | undefined;
|
|
716
728
|
/**
|
|
717
729
|
* A link only for an address a browser opens as a page — never `file:`, `javascript:` or half a URL.
|
|
718
730
|
* As the platform checks it: `new URL` alone mends `https:/host` and `https:host` into https, and a
|
|
@@ -729,4 +741,4 @@ declare function webLink(href: string | undefined): string | undefined;
|
|
|
729
741
|
*/
|
|
730
742
|
declare function maskCredentials(text: string): string;
|
|
731
743
|
|
|
732
|
-
export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type Finding, type FindingStep, type FrozenSummary, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultFindings, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextFields, errorContextOf, failureOf, filesOf, maskCredentials, readEnv, repoRootOf, resultKey, startRun, webLink };
|
|
744
|
+
export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type Finding, type FindingStep, type FrozenSummary, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultFindings, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextFields, errorContextOf, failureOf, filesOf, maskCredentials, readEnv, repoRootOf, resultKey, startRun, stepTitlesOf, webLink };
|
package/dist/reporter-core.d.ts
CHANGED
|
@@ -238,6 +238,11 @@ interface PendingResult {
|
|
|
238
238
|
* nothing found. A platform older than the field is handled as for `targets`.
|
|
239
239
|
*/
|
|
240
240
|
findings?: ResultFindings;
|
|
241
|
+
/**
|
|
242
|
+
* The titles of the top-level `test.step` calls of a passed attempt, in order (`stepTitlesOf`). The platform proposes them as the text of
|
|
243
|
+
* the test's case when they differ from its description. Absent rather than empty; a platform older than the field ignores it.
|
|
244
|
+
*/
|
|
245
|
+
stepTitles?: string[];
|
|
241
246
|
}
|
|
242
247
|
/** Where in the test a finding belongs: a declared step, by its position from 1 and its title. */
|
|
243
248
|
interface FindingStep {
|
|
@@ -713,6 +718,13 @@ declare function errorContextFields(attempt: FailedAttempt, home?: string): {
|
|
|
713
718
|
* bodies must not hold them all until a batch is sent.
|
|
714
719
|
*/
|
|
715
720
|
declare function filesOf(attempt: FailedAttempt): ResultFile[];
|
|
721
|
+
/**
|
|
722
|
+
* The titles of a passed attempt's top-level declared steps (`test.step`), in the order they ran, the empty ones left out. The platform
|
|
723
|
+
* compares them with the description of the test's case and, when they differ, queues a proposal to update it. Only a passed attempt
|
|
724
|
+
* says which steps the test has - a failed one stopped somewhere among them - and the nested steps stay out: a case's description is a
|
|
725
|
+
* flat list. Absent when there are none.
|
|
726
|
+
*/
|
|
727
|
+
declare function stepTitlesOf(attempt: Pick<FailedAttempt, 'status' | 'steps'>): string[] | undefined;
|
|
716
728
|
/**
|
|
717
729
|
* A link only for an address a browser opens as a page — never `file:`, `javascript:` or half a URL.
|
|
718
730
|
* As the platform checks it: `new URL` alone mends `https:/host` and `https:host` into https, and a
|
|
@@ -729,4 +741,4 @@ declare function webLink(href: string | undefined): string | undefined;
|
|
|
729
741
|
*/
|
|
730
742
|
declare function maskCredentials(text: string): string;
|
|
731
743
|
|
|
732
|
-
export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type Finding, type FindingStep, type FrozenSummary, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultFindings, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextFields, errorContextOf, failureOf, filesOf, maskCredentials, readEnv, repoRootOf, resultKey, startRun, webLink };
|
|
744
|
+
export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type Finding, type FindingStep, type FrozenSummary, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultFindings, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextFields, errorContextOf, failureOf, filesOf, maskCredentials, readEnv, repoRootOf, resultKey, startRun, stepTitlesOf, webLink };
|
package/dist/reporter-core.js
CHANGED
|
@@ -516,6 +516,11 @@ function chosen({ status, errors }) {
|
|
|
516
516
|
}
|
|
517
517
|
return errors[0];
|
|
518
518
|
}
|
|
519
|
+
function stepTitlesOf(attempt) {
|
|
520
|
+
if (attempt.status !== "passed") return void 0;
|
|
521
|
+
const titles = attempt.steps.map((s) => s.title.trim()).filter((t) => t !== "");
|
|
522
|
+
return titles.length > 0 ? titles : void 0;
|
|
523
|
+
}
|
|
519
524
|
function chainOf(steps) {
|
|
520
525
|
const chain = [];
|
|
521
526
|
for (let failed = steps.find((s) => s.failed); failed !== void 0; failed = failed.steps.find((s) => s.failed)) {
|
|
@@ -1941,5 +1946,6 @@ export {
|
|
|
1941
1946
|
repoRootOf,
|
|
1942
1947
|
resultKey,
|
|
1943
1948
|
startRun,
|
|
1949
|
+
stepTitlesOf,
|
|
1944
1950
|
webLink
|
|
1945
1951
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"mcpName": "ai.plune/cli",
|
|
5
5
|
"description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
|
|
6
6
|
"keywords": [
|