@agent-ix/quoin 0.15.1 → 0.17.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.
Files changed (70) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/default-modules.yaml +4 -4
  4. package/dist/advisor/advise.d.ts.map +1 -1
  5. package/dist/advisor/methods.d.ts +11 -1
  6. package/dist/advisor/methods.d.ts.map +1 -1
  7. package/dist/{advisor-D35K3_iI.js → advisor-Dhy9S7PS.js} +21 -8
  8. package/dist/audit-CudnEJmh.js +127 -0
  9. package/dist/auditor/audit.d.ts +15 -4
  10. package/dist/auditor/audit.d.ts.map +1 -1
  11. package/dist/auditor/index.d.ts +1 -1
  12. package/dist/auditor/index.d.ts.map +1 -1
  13. package/dist/{base-CtpwIg4M.js → base-D_-Jy4cE.js} +1 -1
  14. package/dist/cli.js +1 -1
  15. package/dist/commands/advise.d.ts +16 -0
  16. package/dist/commands/advise.d.ts.map +1 -0
  17. package/dist/commands/advise.js +161 -0
  18. package/dist/commands/catalog/list.js +2 -2
  19. package/dist/commands/catalog/methods.js +3 -3
  20. package/dist/commands/catalog/show.js +2 -2
  21. package/dist/commands/catalog/validate.js +2 -2
  22. package/dist/commands/config/doctor.js +1 -1
  23. package/dist/commands/config/edit.js +1 -1
  24. package/dist/commands/config/get.js +1 -1
  25. package/dist/commands/config/set.js +1 -1
  26. package/dist/commands/evidence/affirm.d.ts.map +1 -1
  27. package/dist/commands/evidence/affirm.js +36 -50
  28. package/dist/commands/evidence/audit.d.ts +1 -0
  29. package/dist/commands/evidence/audit.d.ts.map +1 -1
  30. package/dist/commands/evidence/audit.js +46 -158
  31. package/dist/commands/evidence/baseline.d.ts +14 -0
  32. package/dist/commands/evidence/baseline.d.ts.map +1 -0
  33. package/dist/commands/evidence/baseline.js +79 -0
  34. package/dist/commands/evidence/gc.js +2 -2
  35. package/dist/commands/evidence/index.d.ts.map +1 -1
  36. package/dist/commands/evidence/index.js +4 -2
  37. package/dist/commands/evidence/record.d.ts +1 -0
  38. package/dist/commands/evidence/record.d.ts.map +1 -1
  39. package/dist/commands/evidence/record.js +34 -47
  40. package/dist/commands/matrix.js +1 -1
  41. package/dist/commands/module/ensure-defaults.js +3 -3
  42. package/dist/commands/module/install.js +2 -2
  43. package/dist/commands/module/list.js +2 -2
  44. package/dist/commands/module/remove.js +2 -2
  45. package/dist/commands/review.js +1 -1
  46. package/dist/commands/to-plan.js +1 -1
  47. package/dist/commands/update.js +2 -2
  48. package/dist/commands/write.js +3 -3
  49. package/dist/evidence/index.d.ts +1 -1
  50. package/dist/evidence/index.d.ts.map +1 -1
  51. package/dist/evidence/record.d.ts +6 -0
  52. package/dist/evidence/record.d.ts.map +1 -1
  53. package/dist/evidence/store.d.ts +76 -6
  54. package/dist/evidence/store.d.ts.map +1 -1
  55. package/dist/evidence/types.d.ts +26 -5
  56. package/dist/evidence/types.d.ts.map +1 -1
  57. package/dist/{evidence-BvUyw-Yv.js → evidence-QUw0KyMH.js} +76 -38
  58. package/dist/{flow-command-BSMqxass.js → flow-command-B-ZBn9Sd.js} +1 -1
  59. package/dist/index.js +6 -6
  60. package/dist/{modules-Ckfaq5p4.js → modules-DSkUXhHn.js} +2 -2
  61. package/dist/{plugins-CLuXx2Jr.js → plugins-DiS0OXoo.js} +1 -1
  62. package/dist/quire/exec.d.ts +44 -0
  63. package/dist/quire/exec.d.ts.map +1 -0
  64. package/dist/quire/index.d.ts +1 -0
  65. package/dist/quire/index.d.ts.map +1 -1
  66. package/dist/{quire-MbMdffPh.js → quire-D7ra5rUF.js} +315 -261
  67. package/dist/{version-By2YFRZQ.js → version-DmZHxX4n.js} +1 -1
  68. package/dist/{write-8JJ8Dumo.js → write-CPdSNIkF.js} +1 -1
  69. package/package.json +1 -1
  70. package/skills/spec-evidence-analysis/SKILL.md +27 -11
@@ -1,81 +1,67 @@
1
- import { n as e, t } from "../../quire-MbMdffPh.js";
2
- import { t as n } from "../../base-CtpwIg4M.js";
3
- import { c as r, r as i, u as a } from "../../evidence-BvUyw-Yv.js";
4
- import { Flags as o } from "@oclif/core";
5
- import { execFileSync as s } from "node:child_process";
1
+ import { i as e, n as t, o as n, t as r } from "../../quire-D7ra5rUF.js";
2
+ import { t as i } from "../../base-D_-Jy4cE.js";
3
+ import { d as a, l as o, r as s } from "../../evidence-QUw0KyMH.js";
4
+ import { Flags as c } from "@oclif/core";
5
+ import { execFileSync as l } from "node:child_process";
6
6
  //#region src/commands/evidence/affirm.ts
7
- var c = class c extends n {
7
+ var u = class u extends i {
8
8
  static summary = "Re-affirm a binding after the statement it was made against changed.";
9
9
  static description = "A reworded acceptance criterion changes its content hash, which makes every\nbinding on it SUSPECT until somebody says the evidence still discharges the new\nwording. This is that act.\n\nAuto-bind, explicit affirmation: first discharge binds without asking, because\nrequiring a signature on something the evidence already proves puts a gate in\nfront of the common case and teaches people to click through it. Re-affirmation\nis the judgement call, so it stays explicit — and it is recorded with who, at\nwhich commit, and optionally why.\n\nRe-running the test does NOT clear suspicion. If it did, the suspect state would\nclear itself on the next CI run and the detector would never fire.";
10
10
  static examples = ["quoin evidence affirm --obligation FR-001-AC-1 --who @reviewer", "quoin evidence affirm --obligation NFR-006-M-2 --who @reviewer --note 'threshold widened deliberately'"];
11
11
  static flags = {
12
- obligation: o.string({
12
+ obligation: c.string({
13
13
  description: "Obligation id whose binding is being re-affirmed.",
14
14
  required: !0
15
15
  }),
16
- who: o.string({
16
+ who: c.string({
17
17
  description: "Who is affirming. Recorded verbatim.",
18
18
  required: !0
19
19
  }),
20
- note: o.string({ description: "Why the evidence still holds." }),
21
- commit: o.string({ description: "Commit of the affirmation. Defaults to HEAD." }),
22
- repo: o.string({
20
+ note: c.string({ description: "Why the evidence still holds." }),
21
+ commit: c.string({ description: "Commit of the affirmation. Defaults to HEAD." }),
22
+ repo: c.string({
23
23
  description: "Repository root.",
24
24
  default: "."
25
25
  }),
26
- module: o.string({ description: "Module directory supplying the traceability model." }),
27
- json: o.boolean({ description: "Emit the outcome as JSON." })
26
+ module: c.string({ description: "Module directory supplying the traceability model." }),
27
+ json: c.boolean({ description: "Emit the outcome as JSON." })
28
28
  };
29
29
  async run() {
30
- let { flags: n } = await this.parse(c), o = e(l());
31
- o && this.error(o.message, { exit: 2 });
32
- let u = [
30
+ let { flags: i } = await this.parse(u), c = n(r());
31
+ c && this.error(c.message, { exit: 2 });
32
+ let d = [
33
33
  "coverage",
34
34
  "--scope",
35
- n.repo,
35
+ i.repo,
36
36
  "--json"
37
37
  ];
38
- n.module && u.push("--module", n.module);
39
- let d = t(s("quire", u, {
40
- encoding: "utf8",
41
- stdio: [
42
- "ignore",
43
- "pipe",
44
- "ignore"
45
- ]
46
- }));
47
- d.ok || this.error(d.error.message, { exit: 2 });
48
- let f = (d.value.obligations ?? []).find((e) => e.id === n.obligation);
49
- f || this.error(`no obligation \`${n.obligation}\` is derived from this spec today. Either the id is wrong, or the requirement it named is gone — in which case the binding should be removed rather than affirmed.`, { exit: 2 });
50
- let p = n.commit ?? s("git", [
38
+ i.module && d.push("--module", i.module);
39
+ let f = e(t(d));
40
+ f.ok || this.error(f.error.message, { exit: 2 });
41
+ let p = (f.value.obligations ?? []).find((e) => e.id === i.obligation);
42
+ p || this.error(`no obligation \`${i.obligation}\` is derived from this spec today. Either the id is wrong, or the requirement it named is gone — in which case the binding should be removed rather than affirmed.`, { exit: 2 });
43
+ let m = i.commit ?? l("git", [
51
44
  "-C",
52
- n.repo,
45
+ i.repo,
53
46
  "rev-parse",
54
47
  "HEAD"
55
- ], { encoding: "utf8" }).trim(), m = r(n.repo).bindings, { bindings: h, found: g } = i(m, n.obligation, f.statement_hash, n.who, p, n.note);
56
- g || this.error(`no binding exists for \`${n.obligation}\`, so there is nothing to affirm. A binding is created when a suite first discharges the obligation (\`quoin evidence record\`).`, { exit: 2 }), a(n.repo, {
48
+ ], { encoding: "utf8" }).trim(), h = o(i.repo).bindings, { bindings: g, found: _ } = s(h, i.obligation, p.statement_hash, i.who, m, i.note);
49
+ _ || this.error(`no binding exists for \`${i.obligation}\`, so there is nothing to affirm. A binding is created when a suite first discharges the obligation (\`quoin evidence record\`).`, { exit: 2 }), a(i.repo, {
57
50
  schemaVersion: 1,
58
- bindings: h
51
+ bindings: g
59
52
  });
60
- let _ = {
61
- obligation: n.obligation,
62
- who: n.who,
63
- commit: p,
64
- statementHash: f.statement_hash
53
+ let v = {
54
+ obligation: i.obligation,
55
+ who: i.who,
56
+ commit: m,
57
+ statementHash: p.statement_hash
65
58
  };
66
- if (n.json) {
67
- this.log(JSON.stringify(_, null, 2));
59
+ if (i.json) {
60
+ this.log(JSON.stringify(v, null, 2));
68
61
  return;
69
62
  }
70
- this.log(`affirmed ${n.obligation} by ${n.who} at ${p.slice(0, 12)} (hash ${f.statement_hash.slice(0, 12)}…)`);
63
+ this.log(`affirmed ${i.obligation} by ${i.who} at ${m.slice(0, 12)} (hash ${p.statement_hash.slice(0, 12)}…)`);
71
64
  }
72
65
  };
73
- function l() {
74
- try {
75
- return s("quire", ["--version"], { encoding: "utf8" });
76
- } catch {
77
- return null;
78
- }
79
- }
80
66
  //#endregion
81
- export { c as default };
67
+ export { u as default };
@@ -9,6 +9,7 @@ export default class EvidenceAudit extends QuoinCommand {
9
9
  ratchet: import('@oclif/core/interfaces').BooleanFlag<boolean>;
10
10
  strict: import('@oclif/core/interfaces').BooleanFlag<boolean>;
11
11
  json: import('@oclif/core/interfaces').BooleanFlag<boolean>;
12
+ "multiplicity-requires": import('@oclif/core/interfaces').OptionFlag<string[] | undefined, import('@oclif/core/interfaces').CustomOptions>;
12
13
  };
13
14
  run(): Promise<void>;
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/audit.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAa7C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,YAAY;IACrD,MAAM,CAAC,OAAO,SACmD;IACjE,MAAM,CAAC,WAAW,SAcX;IAEP,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;MAYV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA6D3B"}
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/audit.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB7C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,YAAY;IACrD,MAAM,CAAC,OAAO,SACmD;IACjE,MAAM,CAAC,WAAW,SAeuC;IAEzD,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;MAmBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAgE3B"}
@@ -1,177 +1,72 @@
1
- import { n as e, t } from "../../quire-MbMdffPh.js";
2
- import { t as n } from "../../base-CtpwIg4M.js";
3
- import { a as r, c as i, l as a, o, s } from "../../evidence-BvUyw-Yv.js";
4
- import { t as c } from "../../advisor-D35K3_iI.js";
5
- import { Flags as l } from "@oclif/core";
6
- import { execFileSync as u } from "node:child_process";
7
- //#region src/auditor/audit.ts
8
- function d(e) {
9
- let t = [], n = [], r = new Map(e.bindings.map((e) => [e.obligation, e])), i = new Map(e.runs.map((e) => [e.suite, e]));
10
- for (let a of [...e.obligations].sort((e, t) => e.id.localeCompare(t.id))) {
11
- let o = r.get(a.id);
12
- if (!o) {
13
- t.push({
14
- kind: "undischarged",
15
- obligation: a.id,
16
- severity: "medium",
17
- summary: `no evidence is bound to ${a.id}`
18
- });
19
- continue;
20
- }
21
- if (o.statementHashAtBinding !== a.statement_hash) {
22
- t.push({
23
- kind: "suspect-link",
24
- obligation: a.id,
25
- severity: "high",
26
- summary: `${a.id} was reworded after its evidence was bound (bound against ${o.statementHashAtBinding.slice(0, 12)}…, now ${a.statement_hash.slice(0, 12)}…). Re-affirm or re-verify.`
27
- });
28
- continue;
29
- }
30
- let s = i.get(o.suite);
31
- if (!s) {
32
- t.push({
33
- kind: "stale-evidence",
34
- obligation: a.id,
35
- severity: "high",
36
- summary: `${a.id} is bound to suite ${o.suite}, which has no recorded run. The binding claims evidence that is not in the store.`
37
- });
38
- continue;
39
- }
40
- e.headCommit && s.commit !== e.headCommit && t.push({
41
- kind: "stale-evidence",
42
- obligation: a.id,
43
- severity: "medium",
44
- summary: `${a.id} rests on a ${o.suite} run at ${s.commit.slice(0, 12)}, not at HEAD (${e.headCommit.slice(0, 12)}).`
45
- });
46
- let c = o.symbols.filter((e) => {
47
- let t = s.entries.find((t) => t.symbol === e);
48
- return !t || t.outcome === "skip";
49
- });
50
- if (c.length > 0 && c.length === o.symbols.length) {
51
- t.push({
52
- kind: "vacuous-evidence",
53
- obligation: a.id,
54
- severity: "high",
55
- summary: `every symbol bound to ${a.id} was skipped or absent from the ${o.suite} run: ${c.sort().join(", ")}. The row reads as covered and nothing was verified.`
56
- });
57
- continue;
58
- }
59
- let l = f(a, o, s, e.catalog);
60
- if (l) {
61
- t.push(l);
62
- continue;
63
- }
64
- let u = p(a, o, e);
65
- if (u) {
66
- t.push(u);
67
- continue;
68
- }
69
- n.push(a.id);
70
- }
71
- return t.sort((e, t) => e.obligation.localeCompare(t.obligation) || e.kind.localeCompare(t.kind)), {
72
- findings: t,
73
- healthy: n.sort()
74
- };
75
- }
76
- function f(e, t, n, r) {
77
- if (!r || !e.method) return null;
78
- let i = e.method.trim().toLowerCase(), a = /* @__PURE__ */ new Set();
79
- for (let e of r.methods) e.id.toLowerCase() === i && a.add(e.class), e.class.toLowerCase() === i && a.add(e.class);
80
- if (a.size === 0) return null;
81
- let o = a.has("Test"), s = n.entries.length > 0;
82
- return !o && s ? {
83
- kind: "method-conformance",
84
- obligation: e.id,
85
- severity: "medium",
86
- summary: `${e.id} declares \`${e.method}\` (${[...a].sort().join("/")}) but is discharged by a test run in ${t.suite}. A method that is not a test is not discharged by one.`
87
- } : null;
88
- }
89
- function p(e, t, n) {
90
- let r = n.multiplicityRequires ?? [];
91
- return r.length === 0 || !e.criticality || !r.includes(e.criticality) || new Set(n.bindings.filter((t) => t.obligation === e.id).map((e) => e.suite)).size >= 2 ? null : {
92
- kind: "insufficient-multiplicity",
93
- obligation: e.id,
94
- severity: "medium",
95
- summary: `${e.id} is criticality ${e.criticality}, which requires two independent methods, but all its evidence comes from ${t.suite}.`
96
- };
97
- }
98
- function m(e, t) {
99
- let n = /* @__PURE__ */ new Set([...t.undischarged.map((e) => `undischarged:${e}`), ...t.suspect.map((e) => `suspect-link:${e}`)]);
100
- return e.findings.filter((e) => !n.has(`${e.kind}:${e.obligation}`));
101
- }
102
- //#endregion
1
+ import { i as e, n as t, o as n, t as r } from "../../quire-D7ra5rUF.js";
2
+ import { t as i } from "../../base-D_-Jy4cE.js";
3
+ import { t as a } from "../../advisor-Dhy9S7PS.js";
4
+ import { c as o, l as s, o as c, s as l } from "../../evidence-QUw0KyMH.js";
5
+ import { r as u, t as d } from "../../audit-CudnEJmh.js";
6
+ import { Flags as f } from "@oclif/core";
7
+ import { execFileSync as p } from "node:child_process";
103
8
  //#region src/commands/evidence/audit.ts
104
- var h = class r extends n {
9
+ var m = class c extends i {
105
10
  static summary = "Audit the evidence store: suspect links, staleness, vacuity.";
106
- static description = "Reads the store and reports. RUNS NOTHING (ADR-0011 invariant 1) — the\nconsumer's CI refreshes evidence, and an auditor that could re-run a suite could\nalso make a finding disappear by re-running it.\n\nChecks:\n suspect-link the statement changed after the evidence was bound\n stale-evidence bound to a missing run, or to a run behind HEAD\n vacuous-evidence every bound symbol was skipped or absent from the run\n undischarged no evidence is bound at all\n method-conformance a non-test method discharged by a test run\n insufficient-multiplicity criticality demands two independent suites\n\n--ratchet compares against spec/evidence/baseline.json and fails only on NEW\nviolations. A gate that fails on the whole existing backlog gets disabled within\na week.";
11
+ static description = "Reads the store and reports. RUNS NOTHING (ADR-0011 invariant 1) — the\nconsumer's CI refreshes evidence, and an auditor that could re-run a suite could\nalso make a finding disappear by re-running it.\n\nChecks:\n suspect-link the statement changed after the evidence was bound\n stale-evidence bound to a missing run, or to a run behind HEAD\n vacuous-evidence every bound symbol was skipped or absent from the run\n undischarged no evidence is bound at all\n method-conformance evidence of a kind the declared method does not produce\n unknown-method the declared method is in no catalog\n insufficient-multiplicity criticality demands two independent suites\n\n--ratchet compares against spec/evidence/baseline.json and fails only on NEW\nviolations. A gate that fails on the whole existing backlog gets disabled within\na week. Write that baseline with: quoin evidence baseline";
107
12
  static examples = [
108
13
  "quoin evidence audit",
109
14
  "quoin evidence audit --ratchet --strict",
110
15
  "quoin evidence audit --json"
111
16
  ];
112
17
  static flags = {
113
- repo: l.string({
18
+ repo: f.string({
114
19
  description: "Repository root.",
115
20
  default: "."
116
21
  }),
117
- module: l.string({ description: "Module directory supplying the traceability model." }),
118
- ratchet: l.boolean({ description: "Report only violations absent from the baseline." }),
119
- strict: l.boolean({ description: "Exit 1 when any reported finding remains." }),
120
- json: l.boolean({ description: "Emit the report as JSON." })
22
+ module: f.string({ description: "Module directory supplying the traceability model." }),
23
+ ratchet: f.boolean({ description: "Report only violations absent from the baseline." }),
24
+ strict: f.boolean({ description: "Exit 1 when any reported finding remains." }),
25
+ json: f.boolean({ description: "Emit the report as JSON." }),
26
+ "multiplicity-requires": f.string({
27
+ description: "Criticality values demanding two independent suites. Repeatable. Unset by default: no obligation source in the ecosystem declares a criticality column, so a built-in default could never fire.",
28
+ multiple: !0
29
+ })
121
30
  };
122
31
  async run() {
123
- let { flags: n } = await this.parse(r), a = e(v());
124
- a && this.error(a.message, { exit: 2 });
125
- let o = [
32
+ let { flags: i } = await this.parse(c), l = n(r());
33
+ l && this.error(l.message, { exit: 2 });
34
+ let f = [
126
35
  "coverage",
127
36
  "--scope",
128
- n.repo,
37
+ i.repo,
129
38
  "--json"
130
39
  ];
131
- n.module && o.push("--module", n.module);
132
- let l = t(u("quire", o, {
133
- encoding: "utf8",
134
- stdio: [
135
- "ignore",
136
- "pipe",
137
- "ignore"
138
- ]
139
- }));
140
- l.ok || this.error(l.error.message, { exit: 2 });
141
- let f = d({
142
- obligations: l.value.obligations ?? [],
143
- bindings: i(n.repo).bindings,
144
- runs: g(n.repo),
145
- catalog: c(),
146
- headCommit: _(n.repo),
147
- multiplicityRequires: ["P0"]
148
- }), p = n.ratchet ? s(n.repo) : null, h = p ? m(f, p) : f.findings;
149
- if (n.json) this.log(JSON.stringify({
150
- findings: h,
151
- healthy: f.healthy,
152
- ratchet: n.ratchet
40
+ i.module && f.push("--module", i.module);
41
+ let p = e(t(f));
42
+ p.ok || this.error(p.error.message, { exit: 2 });
43
+ let m = d({
44
+ obligations: p.value.obligations ?? [],
45
+ bindings: s(i.repo).bindings,
46
+ runs: h(i.repo),
47
+ catalog: a(i.module ? [i.module] : void 0),
48
+ headCommit: g(i.repo),
49
+ multiplicityRequires: i["multiplicity-requires"]
50
+ }), _ = i.ratchet ? o(i.repo) : null, v = _ ? u(m, _) : m.findings;
51
+ if (i.json) this.log(JSON.stringify({
52
+ findings: v,
53
+ healthy: m.healthy,
54
+ ratchet: i.ratchet
153
55
  }, null, 2));
154
- else if (h.length === 0) this.log(`${f.healthy.length} obligation(s) with healthy evidence; nothing to report`);
56
+ else if (v.length === 0) this.log(`${m.healthy.length} obligation(s) with healthy evidence; nothing to report`);
155
57
  else {
156
- for (let e of h) this.log(`[${e.severity}] ${e.kind}: ${e.summary}`);
157
- this.log(""), this.log(`${h.length} finding(s), ${f.healthy.length} healthy` + (n.ratchet ? " (new violations only)" : ""));
58
+ for (let e of v) this.log(`[${e.severity}] ${e.kind}: ${e.summary}`);
59
+ this.log(""), this.log(`${v.length} finding(s), ${m.healthy.length} healthy` + (i.ratchet ? " (new violations only)" : ""));
158
60
  }
159
- n.strict && h.length > 0 && this.exit(1);
61
+ i.strict && v.length > 0 && this.exit(1);
160
62
  }
161
63
  };
162
- function g(e) {
163
- let t = [];
164
- for (let n of r(e)) {
165
- let r = o(e, n).at(-1);
166
- if (!r) continue;
167
- let i = a(e, n, r.replace(/\.json$/, ""));
168
- i && t.push(i);
169
- }
170
- return t;
64
+ function h(e) {
65
+ return l(e).map((t) => c(e, t)).filter((e) => e !== null);
171
66
  }
172
- function _(e) {
67
+ function g(e) {
173
68
  try {
174
- return u("git", [
69
+ return p("git", [
175
70
  "-C",
176
71
  e,
177
72
  "rev-parse",
@@ -181,12 +76,5 @@ function _(e) {
181
76
  return;
182
77
  }
183
78
  }
184
- function v() {
185
- try {
186
- return u("quire", ["--version"], { encoding: "utf8" });
187
- } catch {
188
- return null;
189
- }
190
- }
191
79
  //#endregion
192
- export { h as default };
80
+ export { m as default };
@@ -0,0 +1,14 @@
1
+ import { QuoinCommand } from '../../base.js';
2
+ export default class EvidenceBaseline extends QuoinCommand {
3
+ static summary: string;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ repo: import('@oclif/core/interfaces').OptionFlag<string, import('@oclif/core/interfaces').CustomOptions>;
8
+ module: import('@oclif/core/interfaces').OptionFlag<string | undefined, import('@oclif/core/interfaces').CustomOptions>;
9
+ "dry-run": import('@oclif/core/interfaces').BooleanFlag<boolean>;
10
+ json: import('@oclif/core/interfaces').BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+ //# sourceMappingURL=baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/baseline.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAkB7C,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,YAAY;IACxD,MAAM,CAAC,OAAO,SAA0D;IACxE,MAAM,CAAC,WAAW,SAU8C;IAEhE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;;;MASV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiD3B"}
@@ -0,0 +1,79 @@
1
+ import { i as e, n as t, o as n, t as r } from "../../quire-D7ra5rUF.js";
2
+ import { t as i } from "../../base-D_-Jy4cE.js";
3
+ import { t as a } from "../../advisor-Dhy9S7PS.js";
4
+ import { i as o, l as s, o as c, s as l, u } from "../../evidence-QUw0KyMH.js";
5
+ import { n as d, t as f } from "../../audit-CudnEJmh.js";
6
+ import { Flags as p } from "@oclif/core";
7
+ import { execFileSync as m } from "node:child_process";
8
+ //#region src/commands/evidence/baseline.ts
9
+ var h = class c extends i {
10
+ static summary = "Accept the current findings as the ratchet baseline.";
11
+ static description = "Writes spec/evidence/baseline.json: every finding the audit reports right now,\nas <kind>:<obligation>, plus the commit it was accepted at.\n\n`--ratchet` reads this file and fails only on findings NOT in it. Without it,\na first run of the gate reports the entire existing backlog and gets switched\noff within a week — so accepting a baseline is the deliberate act that makes\nthe ratchet usable, and its diff is the record of what was accepted and by whom.\n\nRe-run this at a release to move the ratchet forward. Never run it to make a\nnew failure go away: the diff is reviewed, and a baseline that grows between\nreleases is the gate quietly being disabled one entry at a time.";
12
+ static examples = ["quoin evidence baseline", "quoin evidence baseline --dry-run"];
13
+ static flags = {
14
+ repo: p.string({
15
+ description: "Repository root.",
16
+ default: "."
17
+ }),
18
+ module: p.string({ description: "Module directory supplying the traceability model." }),
19
+ "dry-run": p.boolean({ description: "Print what would be accepted and write nothing." }),
20
+ json: p.boolean({ description: "Emit the outcome as JSON." })
21
+ };
22
+ async run() {
23
+ let { flags: i } = await this.parse(c), l = n(r());
24
+ l && this.error(l.message, { exit: 2 });
25
+ let p = [
26
+ "coverage",
27
+ "--scope",
28
+ i.repo,
29
+ "--json"
30
+ ];
31
+ i.module && p.push("--module", i.module);
32
+ let m = e(t(p));
33
+ m.ok || this.error(m.error.message, { exit: 2 });
34
+ let h = f({
35
+ obligations: m.value.obligations ?? [],
36
+ bindings: s(i.repo).bindings,
37
+ runs: g(i.repo),
38
+ catalog: a(i.module ? [i.module] : void 0),
39
+ headCommit: _(i.repo)
40
+ }).findings.map(d).sort(), v = _(i.repo) ?? "";
41
+ if (i["dry-run"] || u(i.repo, {
42
+ schemaVersion: 1,
43
+ commit: v,
44
+ accepted: h
45
+ }), i.json) {
46
+ this.log(JSON.stringify({
47
+ accepted: h,
48
+ commit: v,
49
+ dryRun: !!i["dry-run"]
50
+ }, null, 2));
51
+ return;
52
+ }
53
+ let y = /* @__PURE__ */ new Map();
54
+ for (let e of h) {
55
+ let t = e.slice(0, e.indexOf(":"));
56
+ y.set(t, (y.get(t) ?? 0) + 1);
57
+ }
58
+ this.log(`${i["dry-run"] ? "would accept" : "accepted"} ${h.length} finding(s) at ${v.slice(0, 12) || "an unknown commit"}`);
59
+ for (let [e, t] of [...y].sort()) this.log(` ${e}: ${t}`);
60
+ i["dry-run"] || this.log(o(i.repo));
61
+ }
62
+ };
63
+ function g(e) {
64
+ return l(e).map((t) => c(e, t)).filter((e) => e !== null);
65
+ }
66
+ function _(e) {
67
+ try {
68
+ return m("git", [
69
+ "-C",
70
+ e,
71
+ "rev-parse",
72
+ "HEAD"
73
+ ], { encoding: "utf8" }).trim();
74
+ } catch {
75
+ return;
76
+ }
77
+ }
78
+ //#endregion
79
+ export { h as default };
@@ -1,5 +1,5 @@
1
- import { t as e } from "../../base-CtpwIg4M.js";
2
- import { i as t } from "../../evidence-BvUyw-Yv.js";
1
+ import { t as e } from "../../base-D_-Jy4cE.js";
2
+ import { a as t } from "../../evidence-QUw0KyMH.js";
3
3
  import { Flags as n } from "@oclif/core";
4
4
  //#region src/commands/evidence/gc.ts
5
5
  var r = class r extends e {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAChD,MAAM,CAAC,OAAO,SAC2D;IACzE,MAAM,CAAC,WAAW,SAc2C;IAE7D,MAAM,CAAC,QAAQ,WAIb;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAChD,MAAM,CAAC,OAAO,SAC2D;IACzE,MAAM,CAAC,WAAW,SAgB6C;IAE/D,MAAM,CAAC,QAAQ,WAMb;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAG3B"}
@@ -1,11 +1,13 @@
1
- import { t as e } from "../../base-CtpwIg4M.js";
1
+ import { t as e } from "../../base-D_-Jy4cE.js";
2
2
  //#region src/commands/evidence/index.ts
3
3
  var t = class t extends e {
4
4
  static summary = "The evidence store — what actually ran, and against which statement.";
5
- static description = "The artifact of record for verification (FR-030). quoin TRANSCRIBES; the\nconsumer's CI executes — nothing here runs a test.\n\nLayout, under spec/evidence/:\n\n suites.md authored suite registry (validated corpus document)\n inspections.md authored inspection acts (validated corpus document)\n bindings.json obligation -> hash-at-binding -> evidence\n baseline.json the accepted violation set the ratchet compares against\n runs/<SUITE-N>/<commit12>.json one file = one run of one suite\n\nSubcommands:\n quoin evidence record transcribe a suite run\n quoin evidence affirm re-affirm a binding after its statement changed\n quoin evidence gc drop run records nothing references";
5
+ static description = "The artifact of record for verification (FR-030). quoin TRANSCRIBES; the\nconsumer's CI executes — nothing here runs a test.\n\nLayout, under spec/evidence/:\n\n suites.md authored suite registry (validated corpus document)\n inspections.md authored inspection acts (validated corpus document)\n bindings.json obligation -> hash-at-binding -> evidence\n baseline.json the accepted violation set the ratchet compares against\n runs/<SUITE-N>/<commit12>.json one file = one run of one suite\n\nSubcommands:\n quoin evidence record transcribe a suite run\n quoin evidence affirm re-affirm a binding after its statement changed\n quoin evidence audit read the store and report\n quoin evidence baseline accept the current findings as the ratchet baseline\n quoin evidence gc drop run records nothing references";
6
6
  static examples = [
7
7
  "quoin evidence record --suite SUITE-001 --commit $(git rev-parse HEAD) --tool 'cargo test' --results run.json",
8
8
  "quoin evidence affirm --obligation FR-001-AC-1 --who @reviewer",
9
+ "quoin evidence audit --ratchet --strict",
10
+ "quoin evidence baseline",
9
11
  "quoin evidence gc --dry-run"
10
12
  ];
11
13
  async run() {
@@ -7,6 +7,7 @@ export default class EvidenceRecord extends QuoinCommand {
7
7
  suite: import('@oclif/core/interfaces').OptionFlag<string, import('@oclif/core/interfaces').CustomOptions>;
8
8
  commit: import('@oclif/core/interfaces').OptionFlag<string, import('@oclif/core/interfaces').CustomOptions>;
9
9
  tool: import('@oclif/core/interfaces').OptionFlag<string, import('@oclif/core/interfaces').CustomOptions>;
10
+ kind: import('@oclif/core/interfaces').OptionFlag<string | undefined, import('@oclif/core/interfaces').CustomOptions>;
10
11
  results: import('@oclif/core/interfaces').OptionFlag<string, import('@oclif/core/interfaces').CustomOptions>;
11
12
  repo: import('@oclif/core/interfaces').OptionFlag<string, import('@oclif/core/interfaces').CustomOptions>;
12
13
  module: import('@oclif/core/interfaces').OptionFlag<string | undefined, import('@oclif/core/interfaces').CustomOptions>;
@@ -1 +1 @@
1
- {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/record.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQ7C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAY;IACtD,MAAM,CAAC,OAAO,SAAuD;IACrE,MAAM,CAAC,WAAW,SAa2D;IAE7E,MAAM,CAAC,QAAQ,WAEb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;MA4BV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyD3B"}
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/commands/evidence/record.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAa7C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAY;IACtD,MAAM,CAAC,OAAO,SAAuD;IACrE,MAAM,CAAC,WAAW,SAa2D;IAE7E,MAAM,CAAC,QAAQ,WAEb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;MAmCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAuD3B"}
@@ -1,85 +1,72 @@
1
- import { n as e, t } from "../../quire-MbMdffPh.js";
2
- import { t as n } from "../../base-CtpwIg4M.js";
3
- import { n as r, t as i } from "../../evidence-BvUyw-Yv.js";
4
- import { readFileSync as a } from "node:fs";
5
- import { Flags as o } from "@oclif/core";
6
- import { execFileSync as s } from "node:child_process";
1
+ import { i as e, n as t, o as n, t as r } from "../../quire-D7ra5rUF.js";
2
+ import { t as i } from "../../base-D_-Jy4cE.js";
3
+ import { n as a, t as o } from "../../evidence-QUw0KyMH.js";
4
+ import { readFileSync as s } from "node:fs";
5
+ import { Flags as c } from "@oclif/core";
7
6
  //#region src/commands/evidence/record.ts
8
- var c = class a extends n {
7
+ var l = class s extends i {
9
8
  static summary = "Transcribe one suite run into the evidence store.";
10
9
  static description = "Records ONE run of ONE suite at ONE commit, then binds every obligation that\nrun discharged, stamping the statement hash as it stands now.\n\nquoin transcribes; the consumer's CI executes (ADR-0011 invariant 1). This\ncommand runs no test and judges no result — recording a FAILING run is as\nlegitimate as recording a passing one, and more useful, because a suite that\nstopped passing is exactly what a freshness check needs to see.\n\n--results takes normalized entries:\n\n {\"entries\": [{\"symbol\": \"tests::tc001\", \"outcome\": \"pass\", \"traceIds\": [\"FR-001-AC-1\"]}]}\n\nFormat adapters (junit, llvm-cov, cargo-mutants, SARIF) are a separate ticket\n(agent-ix/quoin#91); this verb owns the store, not the parsing of every tool.";
11
10
  static examples = ["quoin evidence record --suite SUITE-001 --commit $(git rev-parse HEAD) --tool 'cargo test' --results run.json"];
12
11
  static flags = {
13
- suite: o.string({
12
+ suite: c.string({
14
13
  description: "Suite id from spec/evidence/suites.md (e.g. SUITE-001).",
15
14
  required: !0
16
15
  }),
17
- commit: o.string({
16
+ commit: c.string({
18
17
  description: "Full commit sha the run was performed at.",
19
18
  required: !0
20
19
  }),
21
- tool: o.string({
20
+ tool: c.string({
22
21
  description: "Tool and version, as it identifies itself.",
23
22
  required: !0
24
23
  }),
25
- results: o.string({
24
+ kind: c.string({ description: "Evidence kind this run produced (Unit, Property, Static, Manual, …) — the vocabulary the catalog's `evidence_kind` and the suite registry's `Evidence Kind` column use. Method conformance compares kind to kind; without it the check stays silent rather than guessing." }),
25
+ results: c.string({
26
26
  description: "Normalized run entries as JSON. `-` reads stdin.",
27
27
  required: !0
28
28
  }),
29
- repo: o.string({
29
+ repo: c.string({
30
30
  description: "Repository root. Defaults to the working directory.",
31
31
  default: "."
32
32
  }),
33
- module: o.string({ description: "Module directory supplying the traceability model." }),
34
- timestamp: o.string({ description: "ISO-8601 run time. Defaults to now." }),
35
- json: o.boolean({ description: "Emit the outcome as JSON." })
33
+ module: c.string({ description: "Module directory supplying the traceability model." }),
34
+ timestamp: c.string({ description: "ISO-8601 run time. Defaults to now." }),
35
+ json: c.boolean({ description: "Emit the outcome as JSON." })
36
36
  };
37
37
  async run() {
38
- let { flags: n } = await this.parse(a), o = e(l());
39
- o && this.error(o.message, { exit: 2 });
40
- let c = u(n.results), d = [
38
+ let { flags: i } = await this.parse(s), c = n(r());
39
+ c && this.error(c.message, { exit: 2 });
40
+ let l = u(i.results), d = [
41
41
  "coverage",
42
42
  "--scope",
43
- n.repo,
43
+ i.repo,
44
44
  "--json"
45
45
  ];
46
- n.module && d.push("--module", n.module);
47
- let f = s("quire", d, {
48
- encoding: "utf8",
49
- stdio: [
50
- "ignore",
51
- "pipe",
52
- "ignore"
53
- ]
54
- }), p = t(f);
46
+ i.module && d.push("--module", i.module);
47
+ let f = t(d), p = e(f);
55
48
  p.ok || this.error(`${p.error.message}\n${p.error.errors.slice(0, 10).join("\n")}`, { exit: 2 });
56
- let m = r({
57
- repo: n.repo,
58
- suite: n.suite,
59
- commit: n.commit,
60
- tool: n.tool,
61
- timestamp: n.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
62
- entries: c,
63
- obligations: i(p.value)
49
+ let m = a({
50
+ repo: i.repo,
51
+ suite: i.suite,
52
+ commit: i.commit,
53
+ tool: i.tool,
54
+ evidenceKind: i.kind,
55
+ timestamp: i.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
56
+ entries: l,
57
+ obligations: o(p.value)
64
58
  });
65
- if (n.json) {
59
+ if (i.json) {
66
60
  this.log(JSON.stringify(m, null, 2));
67
61
  return;
68
62
  }
69
- this.log(`recorded ${n.suite} @ ${n.commit.slice(0, 12)} → ${m.runPath}`), this.log(` bound: ${m.bound.length}`), m.suspect.length > 0 && this.log(` suspect (statement changed since binding, re-affirm to clear): ${m.suspect.join(", ")}`), m.unmatched.length > 0 && this.log(` unmatched trace ids (tagged in the suite, stated by no obligation): ${m.unmatched.join(", ")}`);
63
+ this.log(`recorded ${i.suite} @ ${i.commit.slice(0, 12)} → ${m.runPath}`), this.log(` bound: ${m.bound.length}`), m.suspect.length > 0 && this.log(` suspect (statement changed since binding, re-affirm to clear): ${m.suspect.join(", ")}`), m.unmatched.length > 0 && this.log(` unmatched trace ids (tagged in the suite, stated by no obligation): ${m.unmatched.join(", ")}`);
70
64
  }
71
65
  };
72
- function l() {
73
- try {
74
- return s("quire", ["--version"], { encoding: "utf8" });
75
- } catch {
76
- return null;
77
- }
78
- }
79
66
  function u(e) {
80
- let t = a(e === "-" ? 0 : e, "utf8"), n = JSON.parse(t);
67
+ let t = s(e === "-" ? 0 : e, "utf8"), n = JSON.parse(t);
81
68
  if (!Array.isArray(n.entries)) throw Error("--results must be JSON of the form {\"entries\": [{symbol, outcome, traceIds?}]}");
82
69
  return n.entries;
83
70
  }
84
71
  //#endregion
85
- export { c as default };
72
+ export { l as default };