@plune-ai/cli 0.39.10 → 0.39.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6008,6 +6008,17 @@ init_cjs_shims();
6008
6008
  var fs8 = __toESM(require("fs/promises"), 1);
6009
6009
  var path9 = __toESM(require("path"), 1);
6010
6010
 
6011
+ // src/importers/trace-url.ts
6012
+ init_cjs_shims();
6013
+ init_failure_detail();
6014
+ function traceUrlOf(value, title, notes) {
6015
+ if (value === void 0 || typeof value === "string" && value.trim() === "") return void 0;
6016
+ const problem = traceUrlProblem(value);
6017
+ if (problem === void 0) return value.trim();
6018
+ notes.push(`plune: ${JSON.stringify(printable(title))}: trace link not sent (${problem}) \u2014 the result is imported without it.`);
6019
+ return void 0;
6020
+ }
6021
+
6011
6022
  // src/mcp-testing/scan/config/config.ts
6012
6023
  init_cjs_shims();
6013
6024
 
@@ -7817,21 +7828,37 @@ async function defaultReadEvidence(dir) {
7817
7828
  return { name: str(rec["name"]), passed: rec["passed"] === true, ...error !== "" ? { error } : {} };
7818
7829
  });
7819
7830
  }
7820
- function casesFromDesign(report) {
7831
+ function casesFromDesign(report, notes) {
7821
7832
  const list2 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
7822
- return list2.map((raw) => {
7833
+ const refused = /* @__PURE__ */ new Map();
7834
+ const cases = list2.map((raw) => {
7823
7835
  const c = asRecord(raw);
7824
7836
  const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
7837
+ const title = str(c["title"], "untitled case");
7838
+ const link = own(c, "traceUrl") ?? void 0;
7839
+ const said = [];
7840
+ const traceUrl = traceUrlOf(link, title, said);
7841
+ if (said.length > 0) {
7842
+ const key = typeof link === "string" ? link.trim() : typeof link;
7843
+ const before = refused.get(key) ?? 0;
7844
+ if (before === 0) notes.push(...said);
7845
+ refused.set(key, before + 1);
7846
+ }
7825
7847
  return {
7826
7848
  stableId: str(c["stableId"]),
7827
- title: str(c["title"], "untitled case"),
7849
+ title,
7828
7850
  execution: c["execution"] === "manual" ? "manual" : "auto",
7829
7851
  steps: steps.length > 0 ? steps : ["(no steps recorded)"],
7830
7852
  expected: str(c["expected"], "(no expected result recorded)"),
7831
7853
  ...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
7832
- ...typeof c["priority"] === "string" ? { priority: c["priority"] } : {}
7854
+ ...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
7855
+ ...traceUrl !== void 0 ? { traceUrl } : {}
7833
7856
  };
7834
7857
  });
7858
+ for (const times of refused.values()) {
7859
+ if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
7860
+ }
7861
+ return cases;
7835
7862
  }
7836
7863
  function casesFromApi(report, verdicts) {
7837
7864
  const list2 = Array.isArray(report["cases"]) ? report["cases"] : [];
@@ -7878,9 +7905,9 @@ async function readCairnRun(dir, deps = {}) {
7878
7905
  }
7879
7906
  cases = casesFromApi(report, verdicts);
7880
7907
  } else if (mode === "mcp") {
7881
- cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report) : await casesFromMcp(dir, report);
7908
+ cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report, deps.notes ?? []) : await casesFromMcp(dir, report);
7882
7909
  } else {
7883
- cases = casesFromDesign(report);
7910
+ cases = casesFromDesign(report, deps.notes ?? []);
7884
7911
  }
7885
7912
  const tokens = own(asRecord(own(report, "cost")), "totalTokens");
7886
7913
  return {
@@ -8127,7 +8154,8 @@ async function handleIngest(deps) {
8127
8154
  const token = (deps.loadToken ?? loadToken)();
8128
8155
  if (token === null) throw new IngestNotLoggedInError();
8129
8156
  const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
8130
- const payload = await readCairnRun(dir);
8157
+ const notes = [];
8158
+ const payload = await readCairnRun(dir, { notes });
8131
8159
  const session = await readCairnSessionFiles(dir).catch(() => void 0);
8132
8160
  for (const c of payload.cases) {
8133
8161
  const screencasts = session?.screencasts.get(c.stableId);
@@ -8145,6 +8173,7 @@ async function handleIngest(deps) {
8145
8173
  );
8146
8174
  if (files.length > 0) result.files = files;
8147
8175
  if (sent.repeat) result.repeat = true;
8176
+ if (notes.length > 0) result.notes = notes;
8148
8177
  await job.finish({ ok: true });
8149
8178
  if (job.problem !== void 0) result.jobProblem = job.problem;
8150
8179
  return result;
@@ -8195,6 +8224,7 @@ function formatIngestResult(r) {
8195
8224
  const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
8196
8225
  if (r.repeat === true) {
8197
8226
  return `${[
8227
+ ...r.notes ?? [],
8198
8228
  `This Cairn run was already ingested \u2192 ${r.runId}`,
8199
8229
  " nothing new was proposed or attached; a run with a new run id is ingested as new",
8200
8230
  ...files
@@ -8202,6 +8232,7 @@ function formatIngestResult(r) {
8202
8232
  `;
8203
8233
  }
8204
8234
  const lines = [
8235
+ ...r.notes ?? [],
8205
8236
  `Ingested Cairn run \u2192 ${r.runId}`,
8206
8237
  ` ${r.linked} result(s) attached to existing cases`,
8207
8238
  ` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
package/dist/index.d.cts CHANGED
@@ -1232,6 +1232,8 @@ interface IngestResult {
1232
1232
  files?: string[];
1233
1233
  /** The platform already held a run for this report's run id (answered 200): the counters are the first ingest's, nothing new was written. */
1234
1234
  repeat?: true;
1235
+ /** What the reader left out of the payload and why (a trace link the platform would refuse): whole lines, printed first. */
1236
+ notes?: string[];
1235
1237
  }
1236
1238
  declare function handleIngest(deps: IngestDeps): Promise<IngestResult>;
1237
1239
  /**
@@ -1264,6 +1266,8 @@ interface CairnIngestCase {
1264
1266
  verdict?: CairnVerdict;
1265
1267
  technique?: string;
1266
1268
  priority?: string;
1269
+ /** 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. */
1270
+ traceUrl?: string;
1267
1271
  /** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
1268
1272
  screencasts?: CairnScreencast[];
1269
1273
  }
@@ -1307,6 +1311,8 @@ interface EvidenceRecord {
1307
1311
  interface ReadCairnRunDeps {
1308
1312
  /** Injected for tests; returns `undefined` when the run executed nothing and wrote no evidence. */
1309
1313
  readEvidence?: (dir: string) => Promise<EvidenceRecord[] | undefined>;
1314
+ /** Lines for the person, filled while reading: what was left out of the payload and why. */
1315
+ notes?: string[];
1310
1316
  }
1311
1317
  /**
1312
1318
  * Read a Cairn run directory into an upload payload, or throw a typed error explaining why not.
package/dist/index.d.ts CHANGED
@@ -1232,6 +1232,8 @@ interface IngestResult {
1232
1232
  files?: string[];
1233
1233
  /** The platform already held a run for this report's run id (answered 200): the counters are the first ingest's, nothing new was written. */
1234
1234
  repeat?: true;
1235
+ /** What the reader left out of the payload and why (a trace link the platform would refuse): whole lines, printed first. */
1236
+ notes?: string[];
1235
1237
  }
1236
1238
  declare function handleIngest(deps: IngestDeps): Promise<IngestResult>;
1237
1239
  /**
@@ -1264,6 +1266,8 @@ interface CairnIngestCase {
1264
1266
  verdict?: CairnVerdict;
1265
1267
  technique?: string;
1266
1268
  priority?: string;
1269
+ /** 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. */
1270
+ traceUrl?: string;
1267
1271
  /** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
1268
1272
  screencasts?: CairnScreencast[];
1269
1273
  }
@@ -1307,6 +1311,8 @@ interface EvidenceRecord {
1307
1311
  interface ReadCairnRunDeps {
1308
1312
  /** Injected for tests; returns `undefined` when the run executed nothing and wrote no evidence. */
1309
1313
  readEvidence?: (dir: string) => Promise<EvidenceRecord[] | undefined>;
1314
+ /** Lines for the person, filled while reading: what was left out of the payload and why. */
1315
+ notes?: string[];
1310
1316
  }
1311
1317
  /**
1312
1318
  * Read a Cairn run directory into an upload payload, or throw a typed error explaining why not.
package/dist/index.js CHANGED
@@ -5970,6 +5970,17 @@ init_esm_shims();
5970
5970
  import * as fs8 from "fs/promises";
5971
5971
  import * as path10 from "path";
5972
5972
 
5973
+ // src/importers/trace-url.ts
5974
+ init_esm_shims();
5975
+ init_failure_detail();
5976
+ function traceUrlOf(value, title, notes) {
5977
+ if (value === void 0 || typeof value === "string" && value.trim() === "") return void 0;
5978
+ const problem = traceUrlProblem(value);
5979
+ if (problem === void 0) return value.trim();
5980
+ notes.push(`plune: ${JSON.stringify(printable(title))}: trace link not sent (${problem}) \u2014 the result is imported without it.`);
5981
+ return void 0;
5982
+ }
5983
+
5973
5984
  // src/mcp-testing/scan/config/config.ts
5974
5985
  init_esm_shims();
5975
5986
 
@@ -7779,21 +7790,37 @@ async function defaultReadEvidence(dir) {
7779
7790
  return { name: str(rec["name"]), passed: rec["passed"] === true, ...error !== "" ? { error } : {} };
7780
7791
  });
7781
7792
  }
7782
- function casesFromDesign(report) {
7793
+ function casesFromDesign(report, notes) {
7783
7794
  const list2 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
7784
- return list2.map((raw) => {
7795
+ const refused = /* @__PURE__ */ new Map();
7796
+ const cases = list2.map((raw) => {
7785
7797
  const c = asRecord(raw);
7786
7798
  const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
7799
+ const title = str(c["title"], "untitled case");
7800
+ const link = own(c, "traceUrl") ?? void 0;
7801
+ const said = [];
7802
+ const traceUrl = traceUrlOf(link, title, said);
7803
+ if (said.length > 0) {
7804
+ const key = typeof link === "string" ? link.trim() : typeof link;
7805
+ const before = refused.get(key) ?? 0;
7806
+ if (before === 0) notes.push(...said);
7807
+ refused.set(key, before + 1);
7808
+ }
7787
7809
  return {
7788
7810
  stableId: str(c["stableId"]),
7789
- title: str(c["title"], "untitled case"),
7811
+ title,
7790
7812
  execution: c["execution"] === "manual" ? "manual" : "auto",
7791
7813
  steps: steps.length > 0 ? steps : ["(no steps recorded)"],
7792
7814
  expected: str(c["expected"], "(no expected result recorded)"),
7793
7815
  ...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
7794
- ...typeof c["priority"] === "string" ? { priority: c["priority"] } : {}
7816
+ ...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
7817
+ ...traceUrl !== void 0 ? { traceUrl } : {}
7795
7818
  };
7796
7819
  });
7820
+ for (const times of refused.values()) {
7821
+ if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
7822
+ }
7823
+ return cases;
7797
7824
  }
7798
7825
  function casesFromApi(report, verdicts) {
7799
7826
  const list2 = Array.isArray(report["cases"]) ? report["cases"] : [];
@@ -7840,9 +7867,9 @@ async function readCairnRun(dir, deps = {}) {
7840
7867
  }
7841
7868
  cases = casesFromApi(report, verdicts);
7842
7869
  } else if (mode === "mcp") {
7843
- cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report) : await casesFromMcp(dir, report);
7870
+ cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report, deps.notes ?? []) : await casesFromMcp(dir, report);
7844
7871
  } else {
7845
- cases = casesFromDesign(report);
7872
+ cases = casesFromDesign(report, deps.notes ?? []);
7846
7873
  }
7847
7874
  const tokens = own(asRecord(own(report, "cost")), "totalTokens");
7848
7875
  return {
@@ -8089,7 +8116,8 @@ async function handleIngest(deps) {
8089
8116
  const token = (deps.loadToken ?? loadToken)();
8090
8117
  if (token === null) throw new IngestNotLoggedInError();
8091
8118
  const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
8092
- const payload = await readCairnRun(dir);
8119
+ const notes = [];
8120
+ const payload = await readCairnRun(dir, { notes });
8093
8121
  const session = await readCairnSessionFiles(dir).catch(() => void 0);
8094
8122
  for (const c of payload.cases) {
8095
8123
  const screencasts = session?.screencasts.get(c.stableId);
@@ -8107,6 +8135,7 @@ async function handleIngest(deps) {
8107
8135
  );
8108
8136
  if (files.length > 0) result.files = files;
8109
8137
  if (sent.repeat) result.repeat = true;
8138
+ if (notes.length > 0) result.notes = notes;
8110
8139
  await job.finish({ ok: true });
8111
8140
  if (job.problem !== void 0) result.jobProblem = job.problem;
8112
8141
  return result;
@@ -8157,6 +8186,7 @@ function formatIngestResult(r) {
8157
8186
  const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
8158
8187
  if (r.repeat === true) {
8159
8188
  return `${[
8189
+ ...r.notes ?? [],
8160
8190
  `This Cairn run was already ingested \u2192 ${r.runId}`,
8161
8191
  " nothing new was proposed or attached; a run with a new run id is ingested as new",
8162
8192
  ...files
@@ -8164,6 +8194,7 @@ function formatIngestResult(r) {
8164
8194
  `;
8165
8195
  }
8166
8196
  const lines = [
8197
+ ...r.notes ?? [],
8167
8198
  `Ingested Cairn run \u2192 ${r.runId}`,
8168
8199
  ` ${r.linked} result(s) attached to existing cases`,
8169
8200
  ` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/cli",
3
- "version": "0.39.10",
3
+ "version": "0.39.11",
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": [