@agent-ix/quoin 0.14.0 → 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.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/default-modules.yaml +4 -4
- package/dist/advisor/advise.d.ts +57 -0
- package/dist/advisor/advise.d.ts.map +1 -0
- package/dist/advisor/index.d.ts +10 -0
- package/dist/advisor/index.d.ts.map +1 -0
- package/dist/advisor/methods.d.ts +60 -0
- package/dist/advisor/methods.d.ts.map +1 -0
- package/dist/advisor-Dhy9S7PS.js +63 -0
- package/dist/audit-CudnEJmh.js +127 -0
- package/dist/auditor/audit.d.ts +63 -0
- package/dist/auditor/audit.d.ts.map +1 -0
- package/dist/auditor/index.d.ts +8 -0
- package/dist/auditor/index.d.ts.map +1 -0
- package/dist/{base-BIELM-Fk.js → base-D_-Jy4cE.js} +2 -2
- package/dist/catalog.d.ts +1 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/advise.d.ts +16 -0
- package/dist/commands/advise.d.ts.map +1 -0
- package/dist/commands/advise.js +161 -0
- package/dist/commands/catalog/list.js +2 -2
- package/dist/commands/catalog/methods.d.ts +12 -0
- package/dist/commands/catalog/methods.d.ts.map +1 -0
- package/dist/commands/catalog/methods.js +43 -0
- package/dist/commands/catalog/show.js +2 -2
- package/dist/commands/catalog/validate.js +2 -2
- package/dist/commands/config/doctor.js +1 -1
- package/dist/commands/config/edit.js +1 -1
- package/dist/commands/config/get.js +1 -1
- package/dist/commands/config/set.js +1 -1
- package/dist/commands/evidence/affirm.d.ts +17 -0
- package/dist/commands/evidence/affirm.d.ts.map +1 -0
- package/dist/commands/evidence/affirm.js +67 -0
- package/dist/commands/evidence/audit.d.ts +16 -0
- package/dist/commands/evidence/audit.d.ts.map +1 -0
- package/dist/commands/evidence/audit.js +80 -0
- package/dist/commands/evidence/baseline.d.ts +14 -0
- package/dist/commands/evidence/baseline.d.ts.map +1 -0
- package/dist/commands/evidence/baseline.js +79 -0
- package/dist/commands/evidence/gc.d.ts +13 -0
- package/dist/commands/evidence/gc.d.ts.map +1 -0
- package/dist/commands/evidence/gc.js +34 -0
- package/dist/commands/evidence/index.d.ts +8 -0
- package/dist/commands/evidence/index.d.ts.map +1 -0
- package/dist/commands/evidence/index.js +18 -0
- package/dist/commands/evidence/record.d.ts +19 -0
- package/dist/commands/evidence/record.d.ts.map +1 -0
- package/dist/commands/evidence/record.js +72 -0
- package/dist/commands/matrix.js +1 -1
- package/dist/commands/module/ensure-defaults.js +3 -3
- package/dist/commands/module/install.js +2 -2
- package/dist/commands/module/list.js +2 -2
- package/dist/commands/module/remove.js +2 -2
- package/dist/commands/review.js +1 -1
- package/dist/commands/to-plan.js +1 -1
- package/dist/commands/update.js +2 -2
- package/dist/commands/write.js +3 -3
- package/dist/evidence/index.d.ts +13 -0
- package/dist/evidence/index.d.ts.map +1 -0
- package/dist/evidence/record.d.ts +58 -0
- package/dist/evidence/record.d.ts.map +1 -0
- package/dist/evidence/store.d.ts +147 -0
- package/dist/evidence/store.d.ts.map +1 -0
- package/dist/evidence/types.d.ts +143 -0
- package/dist/evidence/types.d.ts.map +1 -0
- package/dist/evidence-QUw0KyMH.js +209 -0
- package/dist/{flow-command-Cu3AeDeV.js → flow-command-B-ZBn9Sd.js} +1 -1
- package/dist/index.js +6 -6
- package/dist/{modules-BumGtAYj.js → modules-DSkUXhHn.js} +2 -2
- package/dist/{plugins-DkBB_VkF.js → plugins-DiS0OXoo.js} +1 -1
- package/dist/quire/contract.d.ts +82 -0
- package/dist/quire/contract.d.ts.map +1 -0
- package/dist/quire/exec.d.ts +44 -0
- package/dist/quire/exec.d.ts.map +1 -0
- package/dist/quire/index.d.ts +12 -0
- package/dist/quire/index.d.ts.map +1 -0
- package/dist/quire/types.d.ts +155 -0
- package/dist/quire/types.d.ts.map +1 -0
- package/dist/quire/validate.d.ts +34 -0
- package/dist/quire/validate.d.ts.map +1 -0
- package/dist/quire-D7ra5rUF.js +4926 -0
- package/dist/schemas/coverage-v1.schema.json +191 -0
- package/dist/schemas/properties-v1.schema.json +134 -0
- package/dist/{version-4FRTZpv_.js → version-DmZHxX4n.js} +1 -1
- package/dist/{write-UmBcjFtj.js → write-CPdSNIkF.js} +1 -1
- package/package.json +6 -2
- package/skills/spec-evidence-analysis/SKILL.md +79 -51
package/default-modules.yaml
CHANGED
|
@@ -10,13 +10,13 @@ schemaVersion: 1
|
|
|
10
10
|
name: quoin-default-modules
|
|
11
11
|
entries:
|
|
12
12
|
- name: spec-artifacts-iso
|
|
13
|
-
version: "0.
|
|
13
|
+
version: "0.12.0"
|
|
14
14
|
defaultEnabled: true
|
|
15
15
|
source:
|
|
16
16
|
type: git-subdir
|
|
17
17
|
url: agent-ix/spec-artifacts-iso
|
|
18
18
|
path: spec_artifacts_iso
|
|
19
|
-
ref: v0.
|
|
19
|
+
ref: v0.12.0
|
|
20
20
|
|
|
21
21
|
- name: spec-artifacts-app
|
|
22
22
|
version: "0.5.0"
|
|
@@ -28,13 +28,13 @@ entries:
|
|
|
28
28
|
ref: v0.5.0
|
|
29
29
|
|
|
30
30
|
- name: spec-artifacts-process
|
|
31
|
-
version: "0.
|
|
31
|
+
version: "0.17.0"
|
|
32
32
|
defaultEnabled: true
|
|
33
33
|
source:
|
|
34
34
|
type: git-subdir
|
|
35
35
|
url: agent-ix/spec-artifacts-process
|
|
36
36
|
path: spec_artifacts_process
|
|
37
|
-
ref: v0.
|
|
37
|
+
ref: v0.17.0
|
|
38
38
|
|
|
39
39
|
- name: spec-objects-business
|
|
40
40
|
version: "0.6.0"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { MethodCatalog } from './methods.js';
|
|
2
|
+
/** What the advisor knows about one obligation before it recommends anything. */
|
|
3
|
+
export interface ObligationFacts {
|
|
4
|
+
id: string;
|
|
5
|
+
statement: string;
|
|
6
|
+
/** The authored `Verification` cell, when the row has one. */
|
|
7
|
+
authoredMethod?: string | null;
|
|
8
|
+
/** The FR-052 property shape quire classified the criterion as. */
|
|
9
|
+
propertyShape?: string | null;
|
|
10
|
+
/** The owning document's archetype (`FR`, `NFR`, `StR`). */
|
|
11
|
+
archetype?: string | null;
|
|
12
|
+
/** Object types the spec declares near this requirement, if any. */
|
|
13
|
+
objectTypes?: string[];
|
|
14
|
+
}
|
|
15
|
+
/** Why a method was recommended — the rule and the value that matched. */
|
|
16
|
+
export interface MatchReason {
|
|
17
|
+
rule: string;
|
|
18
|
+
value: string;
|
|
19
|
+
}
|
|
20
|
+
/** One recommendation for one obligation. */
|
|
21
|
+
export interface Recommendation {
|
|
22
|
+
method: string;
|
|
23
|
+
class: string;
|
|
24
|
+
evidenceKind?: string;
|
|
25
|
+
reasons: MatchReason[];
|
|
26
|
+
}
|
|
27
|
+
/** The advisor's verdict for one obligation. */
|
|
28
|
+
export interface Advice {
|
|
29
|
+
obligation: string;
|
|
30
|
+
/** Deterministic recommendations, strongest (most rules matched) first. */
|
|
31
|
+
recommended: Recommendation[];
|
|
32
|
+
/** The authored method, normalized. */
|
|
33
|
+
authored?: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Set when the authored method is not among the recommendations AND the
|
|
36
|
+
* advisor had rules to go on. Advisory: the human confirms, and the confirmed
|
|
37
|
+
* method is what the auditor later checks conformance against.
|
|
38
|
+
*/
|
|
39
|
+
mismatch: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* True when no rule matched anything. The honest outcome — an advisor that
|
|
42
|
+
* recommends `Test` because it found nothing is the habit this replaces.
|
|
43
|
+
*/
|
|
44
|
+
inconclusive: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Characteristics readable from an obligation's statement. */
|
|
47
|
+
export declare function characteristicsOf(statement: string): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Recommend methods for one obligation.
|
|
50
|
+
*
|
|
51
|
+
* A method is recommended when **any** of its applicability rules matches a
|
|
52
|
+
* fact about the obligation. Ranking is by number of matching rules — a method
|
|
53
|
+
* two axes agree on outranks one a single axis suggested — with the method id
|
|
54
|
+
* as a deterministic tiebreak, so the same input always yields the same order.
|
|
55
|
+
*/
|
|
56
|
+
export declare function advise(catalog: MethodCatalog, facts: ObligationFacts): Advice;
|
|
57
|
+
//# sourceMappingURL=advise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advise.d.ts","sourceRoot":"","sources":["../../src/advisor/advise.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEtE,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,6CAA6C;AAC7C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,gDAAgD;AAChD,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,YAAY,EAAE,OAAO,CAAC;CACvB;AA8CD,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAI7D;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,CAmD7E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalog-driven test-plan advisor (FR-031).
|
|
3
|
+
*
|
|
4
|
+
* The capability the ADR-0011 mission names: help define the TESTING PLAN for
|
|
5
|
+
* the software being specced, so the evidence store then measures that it
|
|
6
|
+
* happens.
|
|
7
|
+
*/
|
|
8
|
+
export { loadMethodCatalog, methodClasses, type MethodCatalog, type VerificationMethod, } from './methods.js';
|
|
9
|
+
export { advise, characteristicsOf, type Advice, type MatchReason, type ObligationFacts, type Recommendation, } from './advise.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/advisor/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The verification-method catalog, merged and readable (FR-031).
|
|
3
|
+
*
|
|
4
|
+
* quire-rs owns the merge for its own consumers; this reads the same manifests
|
|
5
|
+
* from the same module roots so an agent — and this advisor — can reach the
|
|
6
|
+
* catalog without shelling into the engine for a value that is plain module
|
|
7
|
+
* data on disk.
|
|
8
|
+
*
|
|
9
|
+
* Merge is **first-wins by method id**, matching quire-rs FR-054 exactly. If
|
|
10
|
+
* the two disagreed, the advisor would recommend from one catalog while the
|
|
11
|
+
* auditor checked conformance against another.
|
|
12
|
+
*/
|
|
13
|
+
/** One catalog entry, as the module declared it. */
|
|
14
|
+
export interface VerificationMethod {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
/** IADT here; a free string to the engine, so a free string here. */
|
|
18
|
+
class: string;
|
|
19
|
+
definition: string;
|
|
20
|
+
evidenceKind?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Rule name → values. **Never interpreted structurally** — the advisor
|
|
23
|
+
* matches values, and which axes exist is the declaring module's business
|
|
24
|
+
* (quire-rs FR-054-CON-2).
|
|
25
|
+
*/
|
|
26
|
+
applicability: Record<string, string[]>;
|
|
27
|
+
tooling: string[];
|
|
28
|
+
/** Module that contributed this entry (first-wins). */
|
|
29
|
+
moduleName: string;
|
|
30
|
+
}
|
|
31
|
+
/** The merged catalog plus what the merge could not use. */
|
|
32
|
+
export interface MethodCatalog {
|
|
33
|
+
methods: VerificationMethod[];
|
|
34
|
+
/** Method ids more than one module declared, in first-wins order. */
|
|
35
|
+
duplicates: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
modules: string[];
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Module roots whose `manifest.yaml` could not be read or parsed. Reported
|
|
41
|
+
* rather than thrown: a catalog missing one module's entries is still worth
|
|
42
|
+
* having, and the command that would have crashed is the one an operator runs
|
|
43
|
+
* to diagnose the module (agent-ix/quoin#106).
|
|
44
|
+
*/
|
|
45
|
+
unreadable: Array<{
|
|
46
|
+
moduleRoot: string;
|
|
47
|
+
reason: string;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Load and merge every module's `verification_catalog`.
|
|
52
|
+
*
|
|
53
|
+
* A module declaring none contributes none, and a catalog nobody declares is
|
|
54
|
+
* an empty list rather than an error — a repository that has not adopted the
|
|
55
|
+
* catalog can still run everything else.
|
|
56
|
+
*/
|
|
57
|
+
export declare function loadMethodCatalog(moduleRoots?: string[]): MethodCatalog;
|
|
58
|
+
/** Every distinct `class` in the catalog, sorted — the IADT axis in practice. */
|
|
59
|
+
export declare function methodClasses(catalog: MethodCatalog): string[];
|
|
60
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.ts","sourceRoot":"","sources":["../../src/advisor/methods.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,qEAAqE;IACrE,UAAU,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACrD;;;;;OAKG;IACH,UAAU,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,WAAuB,GACjC,aAAa,CAuEf;AAaD,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAE9D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { n as e, s as t } from "./base-D_-Jy4cE.js";
|
|
2
|
+
import { readFileSync as n } from "node:fs";
|
|
3
|
+
import { join as r } from "node:path";
|
|
4
|
+
import { parse as i } from "yaml";
|
|
5
|
+
//#region src/advisor/methods.ts
|
|
6
|
+
function a(a = e()) {
|
|
7
|
+
let s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = [];
|
|
8
|
+
for (let e of a) {
|
|
9
|
+
let a = t(e);
|
|
10
|
+
if (!a || l.has(a)) continue;
|
|
11
|
+
l.add(a);
|
|
12
|
+
let d;
|
|
13
|
+
try {
|
|
14
|
+
d = i(n(r(a, "manifest.yaml"), "utf8"));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
u.push({
|
|
17
|
+
moduleRoot: a,
|
|
18
|
+
reason: e instanceof Error ? e.message : String(e)
|
|
19
|
+
});
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (!d || typeof d != "object") continue;
|
|
23
|
+
let f = String(d.name ?? a), p = d.verification_catalog;
|
|
24
|
+
if (!(!p || typeof p != "object")) for (let [e, t] of Object.entries(p)) {
|
|
25
|
+
let n = s.get(e);
|
|
26
|
+
if (n) {
|
|
27
|
+
let t = c.get(e) ?? [n.moduleName];
|
|
28
|
+
t.push(f), c.set(e, t);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
s.set(e, {
|
|
32
|
+
id: e,
|
|
33
|
+
name: String(t.name ?? ""),
|
|
34
|
+
class: String(t.class ?? ""),
|
|
35
|
+
definition: String(t.definition ?? ""),
|
|
36
|
+
evidenceKind: typeof t.evidence_kind == "string" ? t.evidence_kind : void 0,
|
|
37
|
+
applicability: o(t.applicability),
|
|
38
|
+
tooling: Array.isArray(t.tooling) ? t.tooling.map(String) : [],
|
|
39
|
+
moduleName: f
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let d = (e, t) => e.id === t.id ? 0 : e.id < t.id ? -1 : 1;
|
|
44
|
+
return {
|
|
45
|
+
methods: [...s.values()].sort(d),
|
|
46
|
+
duplicates: [...c.entries()].map(([e, t]) => ({
|
|
47
|
+
id: e,
|
|
48
|
+
modules: t
|
|
49
|
+
})).sort(d),
|
|
50
|
+
unreadable: u.sort((e, t) => e.moduleRoot === t.moduleRoot ? 0 : e.moduleRoot < t.moduleRoot ? -1 : 1)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function o(e) {
|
|
54
|
+
if (!e || typeof e != "object") return {};
|
|
55
|
+
let t = {};
|
|
56
|
+
for (let [n, r] of Object.entries(e)) Array.isArray(r) && (t[n] = r.map(String));
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
function s(e) {
|
|
60
|
+
return [...new Set(e.methods.map((e) => e.class))].sort();
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { s as n, a as t };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//#region src/auditor/audit.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let a = [], o = [], s = /* @__PURE__ */ new Map();
|
|
4
|
+
for (let t of e.bindings) {
|
|
5
|
+
let e = s.get(t.obligation) ?? [];
|
|
6
|
+
e.push(t), s.set(t.obligation, e);
|
|
7
|
+
}
|
|
8
|
+
let c = new Map(e.runs.map((e) => [e.suite, e]));
|
|
9
|
+
for (let l of [...e.obligations].sort(n)) {
|
|
10
|
+
let n = (s.get(l.id) ?? []).slice().sort((e, n) => t(e.suite, n.suite));
|
|
11
|
+
if (n.length === 0) {
|
|
12
|
+
a.push({
|
|
13
|
+
kind: "undischarged",
|
|
14
|
+
obligation: l.id,
|
|
15
|
+
severity: "medium",
|
|
16
|
+
summary: `no evidence is bound to ${l.id}`
|
|
17
|
+
});
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
let u = n.filter((e) => e.statementHashAtBinding !== l.statement_hash);
|
|
21
|
+
if (u.length > 0) {
|
|
22
|
+
a.push({
|
|
23
|
+
kind: "suspect-link",
|
|
24
|
+
obligation: l.id,
|
|
25
|
+
severity: "high",
|
|
26
|
+
summary: `${l.id} was reworded after its evidence was bound in ${u.map((e) => e.suite).join(", ")} (bound against ${u[0].statementHashAtBinding.slice(0, 12)}…, now ${l.statement_hash.slice(0, 12)}…). Re-affirm or re-verify.`
|
|
27
|
+
});
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
let d = n.filter((e) => !c.has(e.suite));
|
|
31
|
+
if (d.length > 0) {
|
|
32
|
+
a.push({
|
|
33
|
+
kind: "stale-evidence",
|
|
34
|
+
obligation: l.id,
|
|
35
|
+
severity: "high",
|
|
36
|
+
summary: `${l.id} is bound to ${d.map((e) => e.suite).join(", ")}, which ${d.length === 1 ? "has" : "have"} no recorded run. The binding claims evidence that is not in the store.`
|
|
37
|
+
});
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
let f = n.map((e) => c.get(e.suite));
|
|
41
|
+
if (e.headCommit) {
|
|
42
|
+
let t = n.filter((t, n) => f[n].commit !== e.headCommit);
|
|
43
|
+
t.length > 0 && a.push({
|
|
44
|
+
kind: "stale-evidence",
|
|
45
|
+
obligation: l.id,
|
|
46
|
+
severity: "medium",
|
|
47
|
+
summary: `${l.id} rests on ` + t.map((e) => `a ${e.suite} run at ${c.get(e.suite).commit.slice(0, 12)}`).join(" and ") + `, not at HEAD (${e.headCommit.slice(0, 12)}).`
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
let p = n.flatMap((e, t) => e.symbols.filter((e) => {
|
|
51
|
+
let n = f[t].entries.find((t) => t.symbol === e);
|
|
52
|
+
return !n || n.outcome === "skip";
|
|
53
|
+
}).map((t) => `${e.suite}:${t}`)), m = n.reduce((e, t) => e + t.symbols.length, 0);
|
|
54
|
+
if (p.length > 0 && p.length === m) {
|
|
55
|
+
a.push({
|
|
56
|
+
kind: "vacuous-evidence",
|
|
57
|
+
obligation: l.id,
|
|
58
|
+
severity: "high",
|
|
59
|
+
summary: `every symbol bound to ${l.id} was skipped or absent from its run: ${p.sort(t).join(", ")}. The row reads as covered and nothing was verified.`
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
let h = r(l, n, f, e.catalog);
|
|
64
|
+
if (h) {
|
|
65
|
+
a.push(h);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
let g = i(l, n, e);
|
|
69
|
+
if (g) {
|
|
70
|
+
a.push(g);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
o.push(l.id);
|
|
74
|
+
}
|
|
75
|
+
return a.sort((e, n) => t(e.obligation, n.obligation) || t(e.kind, n.kind)), {
|
|
76
|
+
findings: a,
|
|
77
|
+
healthy: o.sort(t)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function t(e, t) {
|
|
81
|
+
return e === t ? 0 : e < t ? -1 : 1;
|
|
82
|
+
}
|
|
83
|
+
function n(e, n) {
|
|
84
|
+
return t(e.id, n.id);
|
|
85
|
+
}
|
|
86
|
+
function r(e, n, r, i) {
|
|
87
|
+
if (!i || !e.method) return null;
|
|
88
|
+
let a = e.method.trim().toLowerCase(), o = i.methods.filter((e) => e.id.toLowerCase() === a || e.class.toLowerCase() === a);
|
|
89
|
+
if (o.length === 0) return {
|
|
90
|
+
kind: "unknown-method",
|
|
91
|
+
obligation: e.id,
|
|
92
|
+
severity: "medium",
|
|
93
|
+
summary: `${e.id} declares \`${e.method}\`, which is neither a catalog method id nor a catalog class. Nothing can say what discharging it means, so no conformance check can run against it.`
|
|
94
|
+
};
|
|
95
|
+
let s = new Set(o.map((e) => e.evidenceKind).filter((e) => typeof e == "string" && e.length > 0));
|
|
96
|
+
if (s.size === 0) return null;
|
|
97
|
+
let c = n.filter((e, t) => {
|
|
98
|
+
let n = r[t].evidenceKind;
|
|
99
|
+
return typeof n == "string" && n.length > 0 && !s.has(n);
|
|
100
|
+
});
|
|
101
|
+
return c.length === 0 ? null : {
|
|
102
|
+
kind: "method-conformance",
|
|
103
|
+
obligation: e.id,
|
|
104
|
+
severity: "medium",
|
|
105
|
+
summary: `${e.id} declares \`${e.method}\`, whose evidence kind is ${[...s].sort(t).join("/")}, but is discharged by ` + c.map((e) => `a ${r[n.indexOf(e)].evidenceKind} run in ${e.suite}`).join(" and ") + ". A method is not discharged by evidence of another kind."
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function i(e, t, n) {
|
|
109
|
+
let r = n.multiplicityRequires ?? [];
|
|
110
|
+
if (r.length === 0 || !e.criticality || !r.includes(e.criticality)) return null;
|
|
111
|
+
let i = new Set(t.map((e) => e.suite));
|
|
112
|
+
return i.size >= 2 ? null : {
|
|
113
|
+
kind: "insufficient-multiplicity",
|
|
114
|
+
obligation: e.id,
|
|
115
|
+
severity: "medium",
|
|
116
|
+
summary: `${e.id} is criticality ${e.criticality}, which requires two independent methods, but all its evidence comes from ${[...i].join(", ")}.`
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function a(e) {
|
|
120
|
+
return `${e.kind}:${e.obligation}`;
|
|
121
|
+
}
|
|
122
|
+
function o(e, t) {
|
|
123
|
+
let n = new Set(t.accepted);
|
|
124
|
+
return e.findings.filter((e) => !n.has(a(e)));
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
export { a as n, o as r, e as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Obligation } from '../quire/index.js';
|
|
2
|
+
import { Binding, RunRecord } from '../evidence/index.js';
|
|
3
|
+
import { MethodCatalog } from '../advisor/index.js';
|
|
4
|
+
/** Severity of one finding. Matches the SpecReview vocabulary. */
|
|
5
|
+
export type Severity = "low" | "medium" | "high";
|
|
6
|
+
/** One thing wrong with the evidence for one obligation. */
|
|
7
|
+
export interface Finding {
|
|
8
|
+
kind: "suspect-link" | "stale-evidence" | "vacuous-evidence" | "undischarged" | "method-conformance" | "unknown-method" | "insufficient-multiplicity";
|
|
9
|
+
obligation: string;
|
|
10
|
+
severity: Severity;
|
|
11
|
+
summary: string;
|
|
12
|
+
}
|
|
13
|
+
/** What the auditor was given to read. */
|
|
14
|
+
export interface AuditInput {
|
|
15
|
+
/** Obligations as quire derives them today. */
|
|
16
|
+
obligations: Obligation[];
|
|
17
|
+
/** The binding graph from the store. */
|
|
18
|
+
bindings: Binding[];
|
|
19
|
+
/** Every run record the store holds, newest per suite. */
|
|
20
|
+
runs: RunRecord[];
|
|
21
|
+
/** The merged verification-method catalog, for method conformance. */
|
|
22
|
+
catalog?: MethodCatalog;
|
|
23
|
+
/** Commit being audited, for freshness. */
|
|
24
|
+
headCommit?: string;
|
|
25
|
+
/** Criticality values that demand two independent methods. */
|
|
26
|
+
multiplicityRequires?: string[];
|
|
27
|
+
}
|
|
28
|
+
/** The audit result, ordered so the same input yields the same report. */
|
|
29
|
+
export interface AuditReport {
|
|
30
|
+
findings: Finding[];
|
|
31
|
+
/** Obligations with a binding whose hash still matches. */
|
|
32
|
+
healthy: string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Audit the store against the obligations of the day.
|
|
36
|
+
*
|
|
37
|
+
* Every check is deterministic and reads only what it was handed. There is no
|
|
38
|
+
* clock, no filesystem walk and no subprocess in here — the caller assembles
|
|
39
|
+
* the inputs, which is what makes the whole thing testable without a repository.
|
|
40
|
+
*/
|
|
41
|
+
export declare function audit(input: AuditInput): AuditReport;
|
|
42
|
+
/** The baseline key for one finding. */
|
|
43
|
+
export declare function findingKey(finding: Finding): string;
|
|
44
|
+
/**
|
|
45
|
+
* Findings not present in the baseline — what a ratchet fails on.
|
|
46
|
+
*
|
|
47
|
+
* The baseline is a flat set of `<kind>:<obligation>` keys covering **every**
|
|
48
|
+
* finding kind. It used to be two named buckets, `undischarged` and `suspect`,
|
|
49
|
+
* so `stale-evidence`, `vacuous-evidence`, `method-conformance`,
|
|
50
|
+
* `unknown-method` and `insufficient-multiplicity` could never be baselined and
|
|
51
|
+
* `--ratchet` reported the whole existing backlog for all five — which is the
|
|
52
|
+
* outcome this function's own comment says ratchet mode exists to prevent
|
|
53
|
+
* (agent-ix/quoin#105).
|
|
54
|
+
*/
|
|
55
|
+
export declare function ratchet(report: AuditReport, baseline: {
|
|
56
|
+
accepted: string[];
|
|
57
|
+
}): Finding[];
|
|
58
|
+
/** What changed between two audits — the per-PR delta. */
|
|
59
|
+
export declare function delta(before: AuditReport, after: AuditReport): {
|
|
60
|
+
added: Finding[];
|
|
61
|
+
resolved: Finding[];
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/auditor/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,kEAAkE;AAClE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,WAAW,OAAO;IACtB,IAAI,EACA,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,gBAAgB,GAChB,2BAA2B,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,0DAA0D;IAC1D,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,sEAAsE;IACtE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CA4JpD;AAuHD,wCAAwC;AACxC,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAC/B,OAAO,EAAE,CAKX;AAED,0DAA0D;AAC1D,wBAAgB,KAAK,CACnB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,WAAW,GACjB;IAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAO3C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The evidence auditor (FR-032) — suspect links, stale evidence, vacuity.
|
|
3
|
+
*
|
|
4
|
+
* Reads the store and reports. Runs nothing (ADR-0011 invariant 1): an auditor
|
|
5
|
+
* that could re-run a suite could also make a finding disappear by re-running it.
|
|
6
|
+
*/
|
|
7
|
+
export { audit, delta, findingKey, ratchet, type AuditInput, type AuditReport, type Finding, type Severity, } from './audit.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auditor/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./version-
|
|
1
|
+
import { t as e } from "./version-DmZHxX4n.js";
|
|
2
2
|
import { BaseCommand as t, maybeOfferUpdate as n } from "@agent-ix/ix-cli-core";
|
|
3
3
|
import { existsSync as r, readFileSync as i, readdirSync as a, statSync as o } from "node:fs";
|
|
4
4
|
import { basename as s, join as c, resolve as l } from "node:path";
|
|
@@ -134,4 +134,4 @@ function w(e) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
//#endregion
|
|
137
|
-
export { f as a, g as i, m as n, h as o, p as r, C as t };
|
|
137
|
+
export { f as a, g as i, m as n, h as o, p as r, v as s, C as t };
|
package/dist/catalog.d.ts
CHANGED
|
@@ -29,4 +29,5 @@ export declare function filamentModulesDir(home?: string): string;
|
|
|
29
29
|
export declare function defaultModuleRoots(home?: string): string[];
|
|
30
30
|
export declare function loadCatalog(moduleRoots?: string[]): SpecCatalog;
|
|
31
31
|
export declare function findCatalogEntry(catalog: SpecCatalog, name: string): SpecCatalogEntry | undefined;
|
|
32
|
+
export declare function locateModuleRoot(candidate: string): string | undefined;
|
|
32
33
|
//# sourceMappingURL=catalog.d.ts.map
|
package/dist/catalog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;CACJ;AAED,wBAAgB,MAAM,IAAI,MAAM,CAI/B;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,IAAI,SAAW,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAW,GAAG,MAAM,EAAE,CAW5D;AAED,wBAAgB,WAAW,CAAC,WAAW,WAAuB,GAAG,WAAW,CAyD3E;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAK9B"}
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;CACJ;AAED,wBAAgB,MAAM,IAAI,MAAM,CAI/B;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,IAAI,SAAW,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAW,GAAG,MAAM,EAAE,CAW5D;AAED,wBAAgB,WAAW,CAAC,WAAW,WAAuB,GAAG,WAAW,CAyD3E;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAK9B;AAMD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUtE"}
|
package/dist/cli.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QuoinCommand } from '../base.js';
|
|
2
|
+
export default class Advise 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
|
+
"mismatch-only": import('@oclif/core/interfaces').BooleanFlag<boolean>;
|
|
10
|
+
"inconclusive-only": import('@oclif/core/interfaces').BooleanFlag<boolean>;
|
|
11
|
+
json: import('@oclif/core/interfaces').BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
private render;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=advise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advise.d.ts","sourceRoot":"","sources":["../../src/commands/advise.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAa1C,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,YAAY;IAC9C,MAAM,CAAC,OAAO,SAC6D;IAC3E,MAAM,CAAC,WAAW,SAY4D;IAE9E,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;MAaV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA4D1B,OAAO,CAAC,MAAM;CAqBf"}
|