@agent-ix/quoin 0.21.8 → 0.22.5

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.
Files changed (116) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/default-modules.yaml +18 -2
  4. package/dist/{advisor-COB2SuIj.js → advisor-BkgwDKvQ.js} +1 -1
  5. package/dist/auditor/audit.d.ts +23 -18
  6. package/dist/auditor/audit.d.ts.map +1 -1
  7. package/dist/auditor/index.d.ts +2 -1
  8. package/dist/auditor/index.d.ts.map +1 -1
  9. package/dist/{auditor-ww0MC62a.js → auditor-C3bSmPD_.js} +82 -65
  10. package/dist/{base-DNieRzIg.js → base-CqKNs2Kd.js} +1 -1
  11. package/dist/cli.js +1 -1
  12. package/dist/commands/advise.js +16 -15
  13. package/dist/commands/assurance.d.ts.map +1 -1
  14. package/dist/commands/assurance.js +84 -61
  15. package/dist/commands/catalog/list.js +2 -2
  16. package/dist/commands/catalog/methods.js +3 -3
  17. package/dist/commands/catalog/show.js +2 -2
  18. package/dist/commands/catalog/validate.js +2 -2
  19. package/dist/commands/completeness.js +2 -2
  20. package/dist/commands/config/doctor.d.ts.map +1 -1
  21. package/dist/commands/config/doctor.js +3 -3
  22. package/dist/commands/config/edit.d.ts.map +1 -1
  23. package/dist/commands/config/edit.js +3 -3
  24. package/dist/commands/config/get.js +1 -1
  25. package/dist/commands/config/set.js +1 -1
  26. package/dist/commands/evidence/affirm.js +6 -5
  27. package/dist/commands/evidence/audit.d.ts.map +1 -1
  28. package/dist/commands/evidence/audit.js +57 -45
  29. package/dist/commands/evidence/baseline.d.ts.map +1 -1
  30. package/dist/commands/evidence/baseline.js +52 -42
  31. package/dist/commands/evidence/gc.js +3 -2
  32. package/dist/commands/evidence/index.js +1 -1
  33. package/dist/commands/evidence/inspect-mocks.d.ts +16 -0
  34. package/dist/commands/evidence/inspect-mocks.d.ts.map +1 -0
  35. package/dist/commands/evidence/inspect-mocks.js +49 -0
  36. package/dist/commands/evidence/record.d.ts +1 -0
  37. package/dist/commands/evidence/record.d.ts.map +1 -1
  38. package/dist/commands/evidence/record.js +42 -31
  39. package/dist/commands/matrix.js +1 -1
  40. package/dist/commands/measurement/index.d.ts +7 -0
  41. package/dist/commands/measurement/index.d.ts.map +1 -0
  42. package/dist/commands/measurement/index.js +11 -0
  43. package/dist/commands/measurement/record.d.ts +10 -0
  44. package/dist/commands/measurement/record.d.ts.map +1 -0
  45. package/dist/commands/measurement/record.js +35 -0
  46. package/dist/commands/module/ensure-defaults.js +3 -3
  47. package/dist/commands/module/install.js +2 -2
  48. package/dist/commands/module/list.js +2 -2
  49. package/dist/commands/module/remove.js +2 -2
  50. package/dist/commands/report.d.ts +15 -0
  51. package/dist/commands/report.d.ts.map +1 -0
  52. package/dist/commands/report.js +70 -0
  53. package/dist/commands/review.js +1 -1
  54. package/dist/commands/to-plan.js +1 -1
  55. package/dist/commands/update.js +2 -2
  56. package/dist/commands/validate.d.ts +13 -0
  57. package/dist/commands/validate.d.ts.map +1 -0
  58. package/dist/commands/validate.js +123 -0
  59. package/dist/commands/write.js +3 -3
  60. package/dist/{completeness-F657dxMp.js → completeness-DamWradt.js} +1 -1
  61. package/dist/evidence/index.d.ts +3 -2
  62. package/dist/evidence/index.d.ts.map +1 -1
  63. package/dist/evidence/mock-inspection.d.ts +16 -0
  64. package/dist/evidence/mock-inspection.d.ts.map +1 -0
  65. package/dist/evidence/store.d.ts +11 -1
  66. package/dist/evidence/store.d.ts.map +1 -1
  67. package/dist/evidence/types.d.ts +31 -0
  68. package/dist/evidence/types.d.ts.map +1 -1
  69. package/dist/{evidence-BA5vyZJk.js → evidence-DD0CHzJ0.js} +246 -316
  70. package/dist/{flow-command-D1vJU-7a.js → flow-command-BfFNY0Rv.js} +1 -1
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +9 -8
  74. package/dist/measurement/compare.d.ts +4 -0
  75. package/dist/measurement/compare.d.ts.map +1 -0
  76. package/dist/measurement/index.d.ts +9 -0
  77. package/dist/measurement/index.d.ts.map +1 -0
  78. package/dist/measurement/plans.d.ts +4 -0
  79. package/dist/measurement/plans.d.ts.map +1 -0
  80. package/dist/measurement/portfolio.d.ts +48 -0
  81. package/dist/measurement/portfolio.d.ts.map +1 -0
  82. package/dist/measurement/profiles.d.ts +9 -0
  83. package/dist/measurement/profiles.d.ts.map +1 -0
  84. package/dist/measurement/report.d.ts +44 -0
  85. package/dist/measurement/report.d.ts.map +1 -0
  86. package/dist/measurement/store.d.ts +7 -0
  87. package/dist/measurement/store.d.ts.map +1 -0
  88. package/dist/measurement/types.d.ts +83 -0
  89. package/dist/measurement/types.d.ts.map +1 -0
  90. package/dist/measurement/validate.d.ts +9 -0
  91. package/dist/measurement/validate.d.ts.map +1 -0
  92. package/dist/measurement-CzB74Q07.js +595 -0
  93. package/dist/{modules-BWyZ7kVN.js → modules-ez9httBA.js} +2 -2
  94. package/dist/{plugins-Czi2OyDB.js → plugins-C-ta0llj.js} +1 -1
  95. package/dist/quire/contract.d.ts +11 -12
  96. package/dist/quire/contract.d.ts.map +1 -1
  97. package/dist/quire/exec.d.ts +10 -0
  98. package/dist/quire/exec.d.ts.map +1 -1
  99. package/dist/quire/index.d.ts +2 -2
  100. package/dist/quire/index.d.ts.map +1 -1
  101. package/dist/quire/types.d.ts +119 -1
  102. package/dist/quire/types.d.ts.map +1 -1
  103. package/dist/{quire-UzoK3Azf.js → quire-D8tCpgyA.js} +526 -499
  104. package/dist/schemas/coverage-v1.schema.json +919 -105
  105. package/dist/schemas/properties-v1.schema.json +25 -0
  106. package/dist/store--2sAv12X.js +219 -0
  107. package/dist/validators/gates.d.ts +18 -0
  108. package/dist/validators/gates.d.ts.map +1 -0
  109. package/dist/validators/index.d.ts +2 -0
  110. package/dist/validators/index.d.ts.map +1 -0
  111. package/dist/{version-G_RI6TD4.js → version-Dg0e6CZU.js} +1 -1
  112. package/dist/{write-BJ9rTVAS.js → write-DElwS9xc.js} +1 -1
  113. package/package.json +22 -16
  114. package/skills/assurance-status-report/SKILL.md +135 -0
  115. package/skills/assurance-status-report/references/report-contract.md +110 -0
  116. package/skills/spec-architecture-evaluation/SKILL.md +30 -0
@@ -1,254 +1,56 @@
1
- import { existsSync as e, mkdirSync as t, readFileSync as n, readdirSync as r, rmSync as i, writeFileSync as a } from "node:fs";
2
- import { dirname as o, join as s } from "node:path";
3
- //#region src/evidence/types.ts
4
- var c = "runs", l = "scans", u = "mutation-score";
5
- //#endregion
6
- //#region src/evidence/store.ts
7
- function d(e) {
8
- return s(e, "spec", "evidence");
9
- }
10
- function f(e) {
11
- return s(d(e), "bindings.json");
12
- }
13
- function p(e) {
14
- return s(d(e), "baseline.json");
15
- }
16
- function m(e, t, n) {
17
- return s(d(e), c, t, `${g(n)}.json`);
18
- }
19
- function h(e, t, n) {
20
- return s(d(e), l, t, `${g(n)}.json`);
21
- }
22
- function g(e) {
23
- return e.slice(0, 12);
24
- }
25
- function _(e) {
26
- return `${JSON.stringify(v(e), null, 2)}\n`;
27
- }
28
- function v(e) {
29
- if (Array.isArray(e)) return e.map(v);
30
- if (typeof e != "object" || !e) return e;
31
- let t = {};
32
- for (let n of Object.keys(e).sort()) t[n] = v(e[n]);
33
- return t;
34
- }
35
- function y(e, n) {
36
- t(o(e), { recursive: !0 }), a(e, _(n), "utf8");
37
- }
38
- var b = class extends Error {
39
- path;
40
- cause;
41
- constructor(e, t) {
42
- let n = t instanceof Error ? t.message : String(t);
43
- super(`${e} exists but is not readable JSON: ${n}. A merge conflict in a checked-in store file is the usual cause — resolve it, or delete the file to start from an empty store.`), this.path = e, this.cause = t, this.name = "StoreReadError";
44
- }
45
- };
46
- function x(t) {
47
- if (!e(t)) return null;
48
- try {
49
- return JSON.parse(n(t, "utf8"));
50
- } catch (e) {
51
- throw new b(t, e);
52
- }
53
- }
54
- function S(e, t) {
55
- try {
56
- return x(e);
57
- } catch (n) {
58
- if (n instanceof b) return t.push(e), null;
59
- throw n;
60
- }
61
- }
62
- function ee(e, t) {
63
- let n = m(e, t.suite, t.commit);
64
- return y(n, {
65
- ...t,
66
- schemaVersion: 1
67
- }), n;
68
- }
69
- function te(e, t) {
70
- let n = h(e, t.suite, t.commit);
71
- return y(n, {
72
- ...t,
73
- schemaVersion: 1
74
- }), n;
75
- }
76
- function C(t, n) {
77
- let i = s(d(t), l, n);
78
- return e(i) ? r(i).filter((e) => e.endsWith(".json")).sort() : [];
79
- }
80
- function ne(e, t, n = []) {
81
- return C(e, t).map((r) => S(h(e, t, r.replace(/\.json$/, "")), n)).filter((e) => e !== null).sort((e, t) => k(e.timestamp, t.timestamp) || k(e.commit, t.commit));
82
- }
83
- function w(e, t, n = []) {
84
- return ne(e, t, n).at(-1) ?? null;
85
- }
86
- function re(e) {
87
- return e.rulesEvaluated === void 0 ? null : e.rulesEvaluated === 0;
88
- }
89
- function T(t, n) {
90
- let i = s(d(t), c, n);
91
- return e(i) ? r(i).filter((e) => e.endsWith(".json")).sort() : [];
92
- }
93
- function E(e, t, n = []) {
94
- return T(e, t).map((r) => S(m(e, t, r.replace(/\.json$/, "")), n)).filter((e) => e !== null).sort((e, t) => k(e.timestamp, t.timestamp) || k(e.commit, t.commit));
95
- }
96
- function D(e, t, n = []) {
97
- return E(e, t, n).at(-1) ?? null;
98
- }
99
- function O(e) {
100
- return A(e).map((t) => D(e, t)).filter((e) => e !== null);
101
- }
102
- function ie(e) {
103
- return A(e).map((t) => w(e, t)).filter((e) => e !== null);
104
- }
105
- function k(e, t) {
106
- return e === t ? 0 : e < t ? -1 : 1;
107
- }
108
- function A(t) {
109
- let n = /* @__PURE__ */ new Set();
110
- for (let i of [c, l]) {
111
- let a = s(d(t), i);
112
- if (e(a)) for (let e of r(a, { withFileTypes: !0 })) e.isDirectory() && n.add(e.name);
113
- }
114
- return [...n].sort();
115
- }
116
- function j(e) {
117
- return x(f(e)) ?? {
118
- schemaVersion: 1,
119
- bindings: []
120
- };
121
- }
122
- function M(e, t) {
123
- let n = [...t.bindings].sort(F);
124
- y(f(e), {
125
- schemaVersion: 1,
126
- bindings: n
127
- });
128
- }
129
- function ae(e) {
130
- return x(p(e));
131
- }
132
- function N(e, t) {
133
- y(p(e), {
134
- schemaVersion: 1,
135
- commit: t.commit,
136
- accepted: [...t.accepted].sort(k)
137
- });
138
- }
139
- function P(e, t = !1) {
140
- let n = new Set(j(e).bindings.map((e) => `${e.suite}/${g(e.commit)}.json`)), r = [];
141
- for (let a of A(e)) {
142
- let o = T(e, a), u = /* @__PURE__ */ new Set(), f = D(e, a);
143
- f && u.add(`${g(f.commit)}.json`);
144
- for (let l of o) {
145
- if (u.has(l) || n.has(`${a}/${l}`)) continue;
146
- let o = s(d(e), c, a, l);
147
- r.push(o), t || i(o);
148
- }
149
- let p = C(e, a), m = /* @__PURE__ */ new Set(), h = w(e, a);
150
- h && m.add(`${g(h.commit)}.json`);
151
- for (let o of p) {
152
- if (m.has(o) || n.has(`${a}/${o}`)) continue;
153
- let c = s(d(e), l, a, o);
154
- r.push(c), t || i(c);
155
- }
156
- }
157
- return r.sort();
158
- }
159
- function F(e, t) {
160
- return e.obligation === t.obligation ? e.suite === t.suite ? 0 : e.suite < t.suite ? -1 : 1 : e.obligation < t.obligation ? -1 : 1;
161
- }
162
- function I(e, t) {
163
- let n = e.findIndex((e) => e.obligation === t.obligation && e.suite === t.suite);
164
- if (n === -1) return {
165
- bindings: [...e, { ...t }],
166
- created: !0,
167
- suspect: !1
168
- };
169
- let r = e[n], i = r.statementHashAtBinding !== t.statementHashAtBinding, a = {
170
- ...r,
171
- commit: t.commit,
172
- symbols: t.symbols
173
- }, o = [...e];
174
- return o[n] = a, {
175
- bindings: o,
176
- created: !1,
177
- suspect: i
178
- };
179
- }
180
- function L(e, t, n, r, i, a, o) {
181
- let s = e.map((e, t) => [e, t]).filter(([e]) => e.obligation === t && (!o || e.suite === o));
182
- if (s.length === 0) return {
183
- bindings: e,
184
- found: !1
185
- };
186
- let c = [...e];
187
- for (let [e, t] of s) c[t] = {
188
- ...e,
189
- statementHashAtBinding: n,
190
- affirmations: [...e.affirmations ?? [], {
191
- who: r,
192
- commit: i,
193
- note: a
194
- }]
195
- };
196
- return {
197
- bindings: c,
198
- found: !0
199
- };
200
- }
201
- //#endregion
1
+ import { _ as e, f as t, p as n, r, u as i, x as a, y as o } from "./store--2sAv12X.js";
2
+ import { readFileSync as s, readdirSync as c } from "node:fs";
3
+ import { extname as l, join as u, relative as d } from "node:path";
202
4
  //#region src/evidence/record.ts
203
- function R(e) {
204
- let t = ee(e.repo, {
5
+ function f(n) {
6
+ let i = o(n.repo, {
205
7
  schemaVersion: 1,
206
- suite: e.suite,
207
- commit: e.commit,
208
- tool: e.tool,
209
- evidenceKind: e.evidenceKind,
210
- timestamp: e.timestamp,
211
- entries: e.entries
212
- }), n = new Map(e.obligations.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
213
- for (let t of e.obligations) for (let e of t.target_ids ?? []) n.has(e) || r.set(e, [...r.get(e) ?? [], t]);
214
- let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
215
- for (let t of e.entries) for (let e of t.traceIds ?? []) {
216
- let o = n.has(e) ? [n.get(e)] : r.get(e) ?? [];
217
- if (o.length === 0) {
218
- a.add(e);
8
+ suite: n.suite,
9
+ commit: n.commit,
10
+ tool: n.tool,
11
+ evidenceKind: n.evidenceKind,
12
+ timestamp: n.timestamp,
13
+ entries: n.entries
14
+ }), a = new Map(n.obligations.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map();
15
+ for (let e of n.obligations) for (let t of e.target_ids ?? []) a.has(t) || s.set(t, [...s.get(t) ?? [], e]);
16
+ let c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set();
17
+ for (let e of n.entries) for (let t of e.traceIds ?? []) {
18
+ let n = a.has(t) ? [a.get(t)] : s.get(t) ?? [];
19
+ if (n.length === 0) {
20
+ l.add(t);
219
21
  continue;
220
22
  }
221
- if (t.outcome === "pass") for (let e of o) {
222
- let n = i.get(e.id) ?? [];
223
- n.push(t.symbol), i.set(e.id, n);
23
+ if (e.outcome === "pass") for (let t of n) {
24
+ let n = c.get(t.id) ?? [];
25
+ n.push(e.symbol), c.set(t.id, n);
224
26
  }
225
27
  }
226
- let o = j(e.repo).bindings, s = [], c = [];
227
- for (let [t, r] of [...i].sort(([e], [t]) => e === t ? 0 : e < t ? -1 : 1)) {
228
- let i = n.get(t);
28
+ let u = t(n.repo).bindings, d = [], f = [];
29
+ for (let [e, t] of [...c].sort(([e], [t]) => e === t ? 0 : e < t ? -1 : 1)) {
30
+ let i = a.get(e);
229
31
  if (!i) continue;
230
- let a = I(o, {
231
- obligation: t,
32
+ let o = r(u, {
33
+ obligation: e,
232
34
  statementHashAtBinding: i.statement_hash,
233
- suite: e.suite,
234
- commit: e.commit,
235
- symbols: [...r].sort()
35
+ suite: n.suite,
36
+ commit: n.commit,
37
+ symbols: [...t].sort()
236
38
  });
237
- o = a.bindings, a.created && s.push(t), a.suspect && c.push(t);
39
+ u = o.bindings, o.created && d.push(e), o.suspect && f.push(e);
238
40
  }
239
- return M(e.repo, { bindings: o }), {
240
- runPath: t,
241
- bound: s.sort(),
242
- suspect: c.sort(),
243
- unmatched: [...a].sort()
41
+ return e(n.repo, { bindings: u }), {
42
+ runPath: i,
43
+ bound: d.sort(),
44
+ suspect: f.sort(),
45
+ unmatched: [...l].sort()
244
46
  };
245
47
  }
246
- function z(e) {
48
+ function p(e) {
247
49
  return e.obligations ?? [];
248
50
  }
249
51
  //#endregion
250
52
  //#region src/evidence/adapters/types.ts
251
- var B = class extends Error {
53
+ var m = class extends Error {
252
54
  adapter;
253
55
  constructor(e, t) {
254
56
  super(`${e}: ${t}`), this.adapter = e, this.name = "AdapterError";
@@ -256,11 +58,11 @@ var B = class extends Error {
256
58
  };
257
59
  //#endregion
258
60
  //#region src/evidence/adapters/cargo-mutants.ts
259
- function V(e) {
61
+ function h(e) {
260
62
  let t = e.file?.trim(), n = e.function?.function_name?.trim();
261
63
  if (t !== void 0 && t !== "" && n !== void 0 && n !== "") return `${t}::${n}`;
262
64
  }
263
- var H = {
65
+ var g = {
264
66
  name: "cargo-mutants",
265
67
  summary: "cargo-mutants outcomes.json — mutation score per mutated function.",
266
68
  tools: ["cargo-mutants", "cargo mutants"],
@@ -269,55 +71,55 @@ var H = {
269
71
  try {
270
72
  t = JSON.parse(e);
271
73
  } catch (e) {
272
- throw new B("cargo-mutants", `input is not JSON: ${e.message}`);
74
+ throw new m("cargo-mutants", `input is not JSON: ${e.message}`);
273
75
  }
274
- if (!Array.isArray(t.outcomes)) throw new B("cargo-mutants", "no `outcomes` array — expected the contents of mutants.out/outcomes.json");
76
+ if (!Array.isArray(t.outcomes)) throw new m("cargo-mutants", "no `outcomes` array — expected the contents of mutants.out/outcomes.json");
275
77
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
276
78
  for (let e of t.outcomes) {
277
79
  if (e.scenario === "Baseline" || typeof e.scenario != "object") continue;
278
80
  let t = e.scenario.Mutant;
279
81
  if (t === void 0) continue;
280
- let i = V(t);
82
+ let i = h(t);
281
83
  i !== void 0 && (e.summary === "CaughtMutant" ? n.set(i, (n.get(i) ?? 0) + 1) : (e.summary === "MissedMutant" || e.summary === "Timeout") && r.set(i, (r.get(i) ?? 0) + 1));
282
84
  }
283
85
  let i = [.../* @__PURE__ */ new Set([...n.keys(), ...r.keys()])].sort();
284
- if (i.length === 0) throw new B("cargo-mutants", "no viable mutants in the report — nothing was measured");
86
+ if (i.length === 0) throw new m("cargo-mutants", "no viable mutants in the report — nothing was measured");
285
87
  return { entries: i.map((e) => {
286
- let t = n.get(e) ?? 0, i = r.get(e) ?? 0, a = t + i;
88
+ let t = n.get(e) ?? 0, i = r.get(e) ?? 0, o = t + i;
287
89
  return {
288
90
  symbol: e,
289
91
  outcome: i === 0 ? "pass" : "fail",
290
- score: t / a,
291
- metric: u
92
+ score: t / o,
93
+ metric: a
292
94
  };
293
95
  }) };
294
96
  }
295
- }, U = /<testcase\b([^>]*?)(\/>|>([\s\S]*?)<\/testcase\s*>)/g, W = /([\w:.-]+)\s*=\s*"([^"]*)"/g;
296
- function G(e) {
97
+ }, _ = /<testcase\b([^>]*?)(\/>|>([\s\S]*?)<\/testcase\s*>)/g, v = /([\w:.-]+)\s*=\s*"([^"]*)"/g;
98
+ function y(e) {
297
99
  let t = /* @__PURE__ */ new Map();
298
- for (let n of e.matchAll(W)) t.set(n[1], K(n[2]));
100
+ for (let n of e.matchAll(v)) t.set(n[1], ee(n[2]));
299
101
  return t;
300
102
  }
301
- function K(e) {
103
+ function ee(e) {
302
104
  return e.replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&quot;", "\"").replaceAll("&apos;", "'").replaceAll("&amp;", "&");
303
105
  }
304
- function q(e, t) {
106
+ function b(e, t) {
305
107
  let n = e.trim(), r = t.trim();
306
108
  return n === "" ? r : r === "" ? n : n === r ? r : n.endsWith(`::${r}`) || n.endsWith(`.${r}`) ? n.replaceAll(".", "::") : `${n.replaceAll(".", "::")}::${r}`;
307
109
  }
308
- var J = /<property\b([^>]*)\/?>/g;
309
- function oe(e) {
110
+ var x = /<property\b([^>]*)\/?>/g;
111
+ function S(e) {
310
112
  let t = [];
311
- for (let n of e.matchAll(J)) {
312
- let e = G(n[1]), r = e.get("name"), i = e.get("value");
113
+ for (let n of e.matchAll(x)) {
114
+ let e = y(n[1]), r = e.get("name"), i = e.get("value");
313
115
  if (r !== void 0 && i !== void 0 && (r === "trace" || r === "traceIds" || r === "trace_ids")) for (let e of i.split(/[,\s]+/)) e !== "" && t.push(e);
314
116
  }
315
117
  return t.length > 0 ? t : void 0;
316
118
  }
317
- function se(e) {
119
+ function C(e) {
318
120
  return /<error\b/.test(e) ? "error" : /<failure\b/.test(e) ? "fail" : /<skipped\b/.test(e) ? "skip" : "pass";
319
121
  }
320
- var ce = {
122
+ var w = {
321
123
  name: "junit",
322
124
  summary: "JUnit XML (<testsuite>/<testcase>), as emitted by most runners.",
323
125
  tools: [
@@ -330,34 +132,34 @@ var ce = {
330
132
  ],
331
133
  parse(e) {
332
134
  let t = [];
333
- for (let n of e.matchAll(U)) {
334
- let e = G(n[1]), r = n[3] ?? "", i = q(e.get("classname") ?? "", e.get("name") ?? "");
135
+ for (let n of e.matchAll(_)) {
136
+ let e = y(n[1]), r = n[3] ?? "", i = b(e.get("classname") ?? "", e.get("name") ?? "");
335
137
  if (i === "") continue;
336
- let a = oe(r);
138
+ let a = S(r);
337
139
  t.push({
338
140
  symbol: i,
339
- outcome: se(r),
141
+ outcome: C(r),
340
142
  ...a === void 0 ? {} : { traceIds: a }
341
143
  });
342
144
  }
343
- if (t.length === 0) throw new B("junit", "no <testcase> elements found — is this JUnit XML?");
145
+ if (t.length === 0) throw new m("junit", "no <testcase> elements found — is this JUnit XML?");
344
146
  return { entries: t };
345
147
  }
346
- }, le = /^([A-Za-z0-9._-]+):\s*(OK|FAIL)\b\s*(?:[—-]\s*)?(.*)$/, ue = /\(([^)]*)\)[.\s]*$/, de = /\b((?:FR|NFR|StR|US)-\d+-AC-\d+|TC-\d+)\b/g;
347
- function fe(e) {
348
- let t = ue.exec(e);
148
+ }, T = /^([A-Za-z0-9._-]+):\s*(OK|FAIL)\b\s*(?:[—-]\s*)?(.*)$/, E = /\(([^)]*)\)[.\s]*$/, D = /\b((?:FR|NFR|StR|US)-\d+-AC-\d+|TC-\d+)\b/g;
149
+ function O(e) {
150
+ let t = E.exec(e);
349
151
  if (!t) return;
350
- let n = [...t[1].matchAll(de)].map((e) => e[1]);
152
+ let n = [...t[1].matchAll(D)].map((e) => e[1]);
351
153
  return n.length > 0 ? n : void 0;
352
154
  }
353
- function pe(e) {
155
+ function k(e) {
354
156
  let t = [], n = 0;
355
157
  for (let r of e.split("\n")) {
356
- let e = le.exec(r.trim());
158
+ let e = T.exec(r.trim());
357
159
  if (!e) continue;
358
160
  let [, i, a, o] = e;
359
161
  if (n += 1, a === "OK") continue;
360
- let s = o.trim(), c = fe(s);
162
+ let s = o.trim(), c = O(s);
361
163
  t.push({
362
164
  ruleId: i,
363
165
  severity: "violation",
@@ -365,7 +167,7 @@ function pe(e) {
365
167
  ...c === void 0 ? {} : { traceIds: c }
366
168
  });
367
169
  }
368
- if (n === 0) throw new B("audit-script", "no `<name>: OK` or `<name>: FAIL` line found — is this audit-script output?");
170
+ if (n === 0) throw new m("audit-script", "no `<name>: OK` or `<name>: FAIL` line found — is this audit-script output?");
369
171
  return {
370
172
  findings: t,
371
173
  tool: "audit-script",
@@ -374,15 +176,15 @@ function pe(e) {
374
176
  }
375
177
  //#endregion
376
178
  //#region src/evidence/adapters/agent-eval.ts
377
- function me(e) {
179
+ function A(e) {
378
180
  let t;
379
181
  try {
380
182
  t = JSON.parse(e);
381
183
  } catch (e) {
382
- throw new B("agent-eval", `not JSON: ${e instanceof Error ? e.message : String(e)}`);
184
+ throw new m("agent-eval", `not JSON: ${e instanceof Error ? e.message : String(e)}`);
383
185
  }
384
186
  let n = t;
385
- if (!n || typeof n != "object" || !Array.isArray(n.results)) throw new B("agent-eval", "expected a cli-agent-evals report with a \"results\" array");
187
+ if (!n || typeof n != "object" || !Array.isArray(n.results)) throw new m("agent-eval", "expected a cli-agent-evals report with a \"results\" array");
386
188
  let r = [];
387
189
  for (let e of n.results) {
388
190
  let t = typeof e.id == "string" ? e.id : null;
@@ -390,19 +192,19 @@ function me(e) {
390
192
  symbol: t,
391
193
  outcome: e.ok === !0 ? "pass" : "fail",
392
194
  traceIds: [t],
393
- ...he(e)
195
+ ...j(e)
394
196
  });
395
197
  }
396
- if (r.length === 0) throw new B("agent-eval", "no scenario results in the report — did the suite run?");
198
+ if (r.length === 0) throw new m("agent-eval", "no scenario results in the report — did the suite run?");
397
199
  return { entries: r };
398
200
  }
399
- function he(e) {
201
+ function j(e) {
400
202
  let t = e.passRate;
401
203
  if (typeof t != "string") return {};
402
204
  let [n, r] = t.split("/").map(Number);
403
205
  return !Number.isFinite(n) || !Number.isFinite(r) || r === 0 ? {} : { score: n / r };
404
206
  }
405
- var ge = {
207
+ var M = {
406
208
  name: "agent-eval",
407
209
  summary: "cli-agent-evals report JSON — one entry per scenario, keyed on the scenario id.",
408
210
  tools: [
@@ -410,22 +212,22 @@ var ge = {
410
212
  "agent-evals",
411
213
  "agent-pty"
412
214
  ],
413
- parse: me
215
+ parse: A
414
216
  };
415
217
  //#endregion
416
218
  //#region src/evidence/adapters/sbom.ts
417
- function _e(e) {
219
+ function N(e) {
418
220
  let t;
419
221
  try {
420
222
  t = JSON.parse(e);
421
223
  } catch (e) {
422
- throw new B("sbom", `not JSON: ${e instanceof Error ? e.message : String(e)}. CycloneDX and SPDX both have JSON serialisations; the tag-value SPDX form is not read here.`);
224
+ throw new m("sbom", `not JSON: ${e instanceof Error ? e.message : String(e)}. CycloneDX and SPDX both have JSON serialisations; the tag-value SPDX form is not read here.`);
423
225
  }
424
- if (!t || typeof t != "object") throw new B("sbom", "expected a JSON object");
226
+ if (!t || typeof t != "object") throw new m("sbom", "expected a JSON object");
425
227
  let n = t;
426
- return { entries: Y(n) ?? ve(n) ?? ye(n) };
228
+ return { entries: P(n) ?? F(n) ?? te(n) };
427
229
  }
428
- function Y(e) {
230
+ function P(e) {
429
231
  return String(e.bomFormat ?? "") === "CycloneDX" ? (Array.isArray(e.components) ? e.components : []).map((e) => {
430
232
  let t = e, n = typeof t.purl == "string" ? t.purl : null, r = typeof t.name == "string" ? t.name : null;
431
233
  if (!n && !r) return null;
@@ -436,7 +238,7 @@ function Y(e) {
436
238
  };
437
239
  }).filter((e) => e !== null) : null;
438
240
  }
439
- function ve(e) {
241
+ function F(e) {
440
242
  return typeof e.spdxVersion == "string" ? (Array.isArray(e.packages) ? e.packages : []).map((e) => {
441
243
  let t = e, n = (Array.isArray(t.externalRefs) ? t.externalRefs : []).map((e) => e).find((e) => String(e.referenceType ?? "") === "purl"), r = n && typeof n.referenceLocator == "string" ? n.referenceLocator : null, i = typeof t.name == "string" ? t.name : null;
442
244
  if (!r && !i) return null;
@@ -447,10 +249,10 @@ function ve(e) {
447
249
  };
448
250
  }).filter((e) => e !== null) : null;
449
251
  }
450
- function ye(e) {
451
- throw new B("sbom", `neither a CycloneDX (\`bomFormat\`) nor an SPDX (\`spdxVersion\`) document — top-level keys: ${Object.keys(e).slice(0, 6).join(", ") || "(none)"}`);
252
+ function te(e) {
253
+ throw new m("sbom", `neither a CycloneDX (\`bomFormat\`) nor an SPDX (\`spdxVersion\`) document — top-level keys: ${Object.keys(e).slice(0, 6).join(", ") || "(none)"}`);
452
254
  }
453
- var be = {
255
+ var I = {
454
256
  name: "sbom",
455
257
  summary: "CycloneDX or SPDX JSON — one entry per component, so an empty inventory reads as vacuous.",
456
258
  tools: [
@@ -460,19 +262,19 @@ var be = {
460
262
  "cdxgen",
461
263
  "cargo-cyclonedx"
462
264
  ],
463
- parse: _e
265
+ parse: N
464
266
  };
465
267
  //#endregion
466
268
  //#region src/evidence/adapters/sarif.ts
467
- function xe(e) {
269
+ function L(e) {
468
270
  let t;
469
271
  try {
470
272
  t = JSON.parse(e);
471
273
  } catch (e) {
472
- throw new B("sarif", `input is not JSON: ${e.message}`);
274
+ throw new m("sarif", `input is not JSON: ${e.message}`);
473
275
  }
474
- if (!Array.isArray(t.runs)) throw new B("sarif", "no `runs` array — expected a SARIF 2.1.0 log");
475
- if (t.runs.length === 0) throw new B("sarif", "`runs` is empty — a log with no run proves no scan executed");
276
+ if (!Array.isArray(t.runs)) throw new m("sarif", "no `runs` array — expected a SARIF 2.1.0 log");
277
+ if (t.runs.length === 0) throw new m("sarif", "`runs` is empty — a log with no run proves no scan executed");
476
278
  let n = [], r = [], i;
477
279
  for (let e of t.runs) {
478
280
  let t = e.tool?.driver;
@@ -496,14 +298,14 @@ function xe(e) {
496
298
  ...i === void 0 ? {} : { rulesEvaluated: i }
497
299
  };
498
300
  }
499
- function Se(e) {
301
+ function R(e) {
500
302
  let t;
501
303
  try {
502
304
  t = JSON.parse(e);
503
305
  } catch (e) {
504
- throw new B("cargo-audit", `input is not JSON: ${e.message}`);
306
+ throw new m("cargo-audit", `input is not JSON: ${e.message}`);
505
307
  }
506
- if (t.vulnerabilities === void 0) throw new B("cargo-audit", "no `vulnerabilities` object — expected `cargo audit --json` output");
308
+ if (t.vulnerabilities === void 0) throw new m("cargo-audit", "no `vulnerabilities` object — expected `cargo audit --json` output");
507
309
  let n = [], r = (e, t) => {
508
310
  let r = e.advisory?.id;
509
311
  if (r === void 0 || r === "") return;
@@ -526,7 +328,7 @@ function Se(e) {
526
328
  }
527
329
  //#endregion
528
330
  //#region src/evidence/adapters/registry.ts
529
- var X = {
331
+ var z = {
530
332
  name: "entries",
531
333
  summary: "Normalized {\"entries\": [{symbol, outcome, traceIds?}]} — the default.",
532
334
  tools: [],
@@ -535,18 +337,18 @@ var X = {
535
337
  try {
536
338
  t = JSON.parse(e);
537
339
  } catch (e) {
538
- throw new B("entries", `input is not JSON: ${e.message}`);
340
+ throw new m("entries", `input is not JSON: ${e.message}`);
539
341
  }
540
- if (!Array.isArray(t.entries)) throw new B("entries", "expected JSON of the form {\"entries\": [{symbol, outcome, traceIds?}]}");
342
+ if (!Array.isArray(t.entries)) throw new m("entries", "expected JSON of the form {\"entries\": [{symbol, outcome, traceIds?}]}");
541
343
  return { entries: t.entries };
542
344
  }
543
- }, Z = [
544
- X,
545
- ce,
546
- H,
547
- be,
548
- ge
549
- ], Q = [
345
+ }, B = [
346
+ z,
347
+ w,
348
+ g,
349
+ I,
350
+ M
351
+ ], V = [
550
352
  {
551
353
  name: "sarif",
552
354
  summary: "SARIF 2.1.0 — semgrep --sarif, CodeQL, ESLint, ZAP via converter.",
@@ -555,7 +357,7 @@ var X = {
555
357
  "semgrep",
556
358
  "codeql"
557
359
  ],
558
- parse: xe
360
+ parse: L
559
361
  },
560
362
  {
561
363
  name: "audit-script",
@@ -567,7 +369,7 @@ var X = {
567
369
  "import-linter",
568
370
  "dependency-cruiser"
569
371
  ],
570
- parse: pe
372
+ parse: k
571
373
  },
572
374
  {
573
375
  name: "cargo-audit",
@@ -578,26 +380,154 @@ var X = {
578
380
  "cargo-deny",
579
381
  "cargo deny"
580
382
  ],
581
- parse: Se
383
+ parse: R
582
384
  }
583
- ], $ = [...Z.map((e) => e.name), ...Q.map((e) => e.name)];
584
- function Ce(e) {
585
- if (e.adapter !== void 0 && e.adapter !== "") return Q.find((t) => t.name === e.adapter);
385
+ ], H = [...B.map((e) => e.name), ...V.map((e) => e.name)];
386
+ function U(e) {
387
+ if (e.adapter !== void 0 && e.adapter !== "") return V.find((t) => t.name === e.adapter);
586
388
  let t = (e.tool ?? "").toLowerCase();
587
- if (t !== "") return Q.find((e) => e.tools.some((e) => t.includes(e)));
389
+ if (t !== "") return V.find((e) => e.tools.some((e) => t.includes(e)));
588
390
  }
589
- function we(e) {
391
+ function W(e) {
590
392
  if (e.adapter !== void 0 && e.adapter !== "") {
591
- let t = Z.find((t) => t.name === e.adapter);
592
- if (t === void 0) throw new B("adapter", `unknown adapter '${e.adapter}'. Available: ${$.join(", ")}`);
393
+ let t = B.find((t) => t.name === e.adapter);
394
+ if (t === void 0) throw new m("adapter", `unknown adapter '${e.adapter}'. Available: ${H.join(", ")}`);
593
395
  return t;
594
396
  }
595
397
  let t = (e.tool ?? "").toLowerCase();
596
398
  if (t !== "") {
597
- let e = Z.find((e) => e.tools.some((e) => t.includes(e)));
399
+ let e = B.find((e) => e.tools.some((e) => t.includes(e)));
598
400
  if (e !== void 0) return e;
599
401
  }
600
- return X;
402
+ return z;
403
+ }
404
+ //#endregion
405
+ //#region src/evidence/mock-inspection.ts
406
+ var G = /* @__PURE__ */ new Set([
407
+ ".rs",
408
+ ".py",
409
+ ".ts",
410
+ ".tsx",
411
+ ".js",
412
+ ".jsx"
413
+ ]), K = /* @__PURE__ */ new Set([
414
+ ".git",
415
+ "dist",
416
+ "node_modules",
417
+ "spec",
418
+ "target",
419
+ "vendor"
420
+ ]);
421
+ function q(e, t) {
422
+ if (!t) return {
423
+ injections: [],
424
+ suites: []
425
+ };
426
+ let r = i(e).map((r) => n(e, r, t)).filter((e) => e !== null && e.commit === t);
427
+ return {
428
+ suites: r.map((e) => e.suite).sort($),
429
+ injections: r.flatMap((e) => e.injections).sort((e, t) => $(e.suite, t.suite) || $(e.path ?? "", t.path ?? "") || (e.line ?? 0) - (t.line ?? 0))
430
+ };
431
+ }
432
+ function J(e, t) {
433
+ let n = [];
434
+ for (let r of Y(e)) {
435
+ let i = s(r, "utf8"), a = X(i, l(r));
436
+ if (a.length !== 0) for (let o of i.matchAll(/\b([A-Z][A-Za-z0-9_]*(?:(?:::|\.)[A-Za-z_][A-Za-z0-9_]*)+)\s*\(/g)) {
437
+ let s = o[1];
438
+ if (!re(s)) continue;
439
+ let c = Z(a, o.index ?? -1);
440
+ c && n.push({
441
+ suite: t,
442
+ symbol: c.symbol,
443
+ injects: [s],
444
+ path: d(e, r),
445
+ line: i.slice(0, o.index).split("\n").length
446
+ });
447
+ }
448
+ }
449
+ let r = /* @__PURE__ */ new Map();
450
+ for (let e of n) {
451
+ let t = `${e.path ?? ""}:${e.line ?? 0}:${e.symbol}`, n = r.get(t);
452
+ n ? n.injects = [.../* @__PURE__ */ new Set([...n.injects, ...e.injects])].sort() : r.set(t, {
453
+ ...e,
454
+ injects: [...e.injects].sort()
455
+ });
456
+ }
457
+ return [...r.values()].sort((e, t) => $(e.path ?? "", t.path ?? "") || (e.line ?? 0) - (t.line ?? 0) || $(e.symbol, t.symbol));
458
+ }
459
+ function Y(e) {
460
+ let t = [], n = (e) => {
461
+ for (let r of c(e, { withFileTypes: !0 })) {
462
+ if (r.isDirectory() && K.has(r.name)) continue;
463
+ let i = u(e, r.name);
464
+ r.isDirectory() ? n(i) : r.isFile() && G.has(l(i)) && t.push(i);
465
+ }
466
+ };
467
+ return n(e), t.sort($);
468
+ }
469
+ function X(e, t) {
470
+ let n = [], r = t === ".rs" ? [/#\s*\[\s*test\s*\][\s\S]{0,240}?\bfn\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g] : t === ".py" ? [/(?:^|\n)\s*(?:async\s+)?def\s+(test_[A-Za-z0-9_]*)\s*\(/g] : [/\b(?:test|it)\s*\(\s*["'`]([^"'`]+)["'`]/g, /\b(?:async\s+)?function\s+(test[A-Za-z0-9_]*)\s*\(/g];
471
+ for (let i of r) for (let r of e.matchAll(i)) {
472
+ let i = r.index ?? 0, a = t === ".py" ? i + r[0].lastIndexOf(r[1]) : i, o = t === ".py" ? Q(e, a) : ne(e, a + r[0].length);
473
+ n.push({
474
+ at: a,
475
+ end: o,
476
+ symbol: r[1]
477
+ });
478
+ }
479
+ return n.sort((e, t) => e.at - t.at);
480
+ }
481
+ function Z(e, t) {
482
+ let n = null;
483
+ for (let r of e) {
484
+ if (r.at > t) break;
485
+ t <= r.end && (n = r);
486
+ }
487
+ return n;
488
+ }
489
+ function Q(e, t) {
490
+ let n = e.lastIndexOf("\n", t) + 1, r = /^\s*/.exec(e.slice(n))?.[0].length ?? 0, i = e.indexOf("\n", t);
491
+ if (i < 0) return e.length;
492
+ for (i += 1; i < e.length;) {
493
+ let t = e.indexOf("\n", i), n = t < 0 ? e.length : t, a = e.slice(i, n);
494
+ if (a.trim() && !a.trimStart().startsWith("#") && (/^\s*/.exec(a)?.[0].length ?? 0) <= r) return i - 1;
495
+ i = n + 1;
496
+ }
497
+ return e.length;
498
+ }
499
+ function ne(e, t) {
500
+ let n = e.indexOf("{", t);
501
+ if (n < 0 || n - t > 500) return t;
502
+ let r = 0, i = null, a = !1, o = !1, s = !1;
503
+ for (let t = n; t < e.length; t += 1) {
504
+ let n = e[t], c = e[t + 1] ?? "";
505
+ if (o) {
506
+ n === "\n" && (o = !1);
507
+ continue;
508
+ }
509
+ if (s) {
510
+ n === "*" && c === "/" && (s = !1, t += 1);
511
+ continue;
512
+ }
513
+ if (i) {
514
+ a ? a = !1 : n === "\\" ? a = !0 : n === i && (i = null);
515
+ continue;
516
+ }
517
+ if (n === "/" && c === "/") o = !0, t += 1;
518
+ else if (n === "/" && c === "*") s = !0, t += 1;
519
+ else if (n === "\"" || n === "'" || n === "`") i = n;
520
+ else if (n === "{") r += 1;
521
+ else if (n === "}" && --r === 0) return t;
522
+ }
523
+ return e.length;
524
+ }
525
+ function re(e) {
526
+ let t = e.split(/::|\./), n = t[0], r = t.at(-1) ?? "";
527
+ return /^(?:mock|fake|stub|spy)/i.test(n) || /^(?:allow|approve|approved|bypass|fake|mock|stub|succeed|success)$/i.test(r);
528
+ }
529
+ function $(e, t) {
530
+ return e === t ? 0 : e < t ? -1 : 1;
601
531
  }
602
532
  //#endregion
603
- export { re as _, R as a, te as b, I as c, O as d, w as f, j as g, ae as h, z as i, P as l, A as m, we as n, L as o, ie as p, Ce as r, p as s, $ as t, D as u, N as v, u as x, M as y };
533
+ export { U as a, W as i, q as n, p as o, H as r, f as s, J as t };