@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
|
@@ -0,0 +1,209 @@
|
|
|
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";
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/evidence/store.ts
|
|
7
|
+
function l(e) {
|
|
8
|
+
return s(e, "spec", "evidence");
|
|
9
|
+
}
|
|
10
|
+
function u(e) {
|
|
11
|
+
return s(l(e), "bindings.json");
|
|
12
|
+
}
|
|
13
|
+
function d(e) {
|
|
14
|
+
return s(l(e), "baseline.json");
|
|
15
|
+
}
|
|
16
|
+
function f(e, t, n) {
|
|
17
|
+
return s(l(e), c, t, `${p(n)}.json`);
|
|
18
|
+
}
|
|
19
|
+
function p(e) {
|
|
20
|
+
return e.slice(0, 12);
|
|
21
|
+
}
|
|
22
|
+
function m(e) {
|
|
23
|
+
return `${JSON.stringify(h(e), null, 2)}\n`;
|
|
24
|
+
}
|
|
25
|
+
function h(e) {
|
|
26
|
+
if (Array.isArray(e)) return e.map(h);
|
|
27
|
+
if (typeof e != "object" || !e) return e;
|
|
28
|
+
let t = {};
|
|
29
|
+
for (let n of Object.keys(e).sort()) t[n] = h(e[n]);
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
function g(e, n) {
|
|
33
|
+
t(o(e), { recursive: !0 }), a(e, m(n), "utf8");
|
|
34
|
+
}
|
|
35
|
+
var _ = class extends Error {
|
|
36
|
+
path;
|
|
37
|
+
cause;
|
|
38
|
+
constructor(e, t) {
|
|
39
|
+
let n = t instanceof Error ? t.message : String(t);
|
|
40
|
+
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";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function v(t) {
|
|
44
|
+
if (!e(t)) return null;
|
|
45
|
+
try {
|
|
46
|
+
return JSON.parse(n(t, "utf8"));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
throw new _(t, e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function y(e, t) {
|
|
52
|
+
try {
|
|
53
|
+
return v(e);
|
|
54
|
+
} catch (n) {
|
|
55
|
+
if (n instanceof _) return t.push(e), null;
|
|
56
|
+
throw n;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function b(e, t) {
|
|
60
|
+
let n = f(e, t.suite, t.commit);
|
|
61
|
+
return g(n, {
|
|
62
|
+
...t,
|
|
63
|
+
schemaVersion: 1
|
|
64
|
+
}), n;
|
|
65
|
+
}
|
|
66
|
+
function x(t, n) {
|
|
67
|
+
let i = s(l(t), c, n);
|
|
68
|
+
return e(i) ? r(i).filter((e) => e.endsWith(".json")).sort() : [];
|
|
69
|
+
}
|
|
70
|
+
function S(e, t, n = []) {
|
|
71
|
+
return x(e, t).map((r) => y(f(e, t, r.replace(/\.json$/, "")), n)).filter((e) => e !== null).sort((e, t) => w(e.timestamp, t.timestamp) || w(e.commit, t.commit));
|
|
72
|
+
}
|
|
73
|
+
function C(e, t, n = []) {
|
|
74
|
+
return S(e, t, n).at(-1) ?? null;
|
|
75
|
+
}
|
|
76
|
+
function w(e, t) {
|
|
77
|
+
return e === t ? 0 : e < t ? -1 : 1;
|
|
78
|
+
}
|
|
79
|
+
function T(t) {
|
|
80
|
+
let n = s(l(t), c);
|
|
81
|
+
return e(n) ? r(n, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => e.name).sort() : [];
|
|
82
|
+
}
|
|
83
|
+
function E(e) {
|
|
84
|
+
return v(u(e)) ?? {
|
|
85
|
+
schemaVersion: 1,
|
|
86
|
+
bindings: []
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function D(e, t) {
|
|
90
|
+
let n = [...t.bindings].sort(j);
|
|
91
|
+
g(u(e), {
|
|
92
|
+
schemaVersion: 1,
|
|
93
|
+
bindings: n
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function O(e) {
|
|
97
|
+
return v(d(e));
|
|
98
|
+
}
|
|
99
|
+
function k(e, t) {
|
|
100
|
+
g(d(e), {
|
|
101
|
+
schemaVersion: 1,
|
|
102
|
+
commit: t.commit,
|
|
103
|
+
accepted: [...t.accepted].sort(w)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function A(e, t = !1) {
|
|
107
|
+
let n = new Set(E(e).bindings.map((e) => `${e.suite}/${p(e.commit)}.json`)), r = [];
|
|
108
|
+
for (let a of T(e)) {
|
|
109
|
+
let o = x(e, a), u = /* @__PURE__ */ new Set(), d = C(e, a);
|
|
110
|
+
d && u.add(`${p(d.commit)}.json`);
|
|
111
|
+
for (let d of o) {
|
|
112
|
+
if (u.has(d) || n.has(`${a}/${d}`)) continue;
|
|
113
|
+
let o = s(l(e), c, a, d);
|
|
114
|
+
r.push(o), t || i(o);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return r.sort();
|
|
118
|
+
}
|
|
119
|
+
function j(e, t) {
|
|
120
|
+
return e.obligation === t.obligation ? e.suite === t.suite ? 0 : e.suite < t.suite ? -1 : 1 : e.obligation < t.obligation ? -1 : 1;
|
|
121
|
+
}
|
|
122
|
+
function M(e, t) {
|
|
123
|
+
let n = e.findIndex((e) => e.obligation === t.obligation && e.suite === t.suite);
|
|
124
|
+
if (n === -1) return {
|
|
125
|
+
bindings: [...e, { ...t }],
|
|
126
|
+
created: !0,
|
|
127
|
+
suspect: !1
|
|
128
|
+
};
|
|
129
|
+
let r = e[n], i = r.statementHashAtBinding !== t.statementHashAtBinding, a = {
|
|
130
|
+
...r,
|
|
131
|
+
commit: t.commit,
|
|
132
|
+
symbols: t.symbols
|
|
133
|
+
}, o = [...e];
|
|
134
|
+
return o[n] = a, {
|
|
135
|
+
bindings: o,
|
|
136
|
+
created: !1,
|
|
137
|
+
suspect: i
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function N(e, t, n, r, i, a, o) {
|
|
141
|
+
let s = e.map((e, t) => [e, t]).filter(([e]) => e.obligation === t && (!o || e.suite === o));
|
|
142
|
+
if (s.length === 0) return {
|
|
143
|
+
bindings: e,
|
|
144
|
+
found: !1
|
|
145
|
+
};
|
|
146
|
+
let c = [...e];
|
|
147
|
+
for (let [e, t] of s) c[t] = {
|
|
148
|
+
...e,
|
|
149
|
+
statementHashAtBinding: n,
|
|
150
|
+
affirmations: [...e.affirmations ?? [], {
|
|
151
|
+
who: r,
|
|
152
|
+
commit: i,
|
|
153
|
+
note: a
|
|
154
|
+
}]
|
|
155
|
+
};
|
|
156
|
+
return {
|
|
157
|
+
bindings: c,
|
|
158
|
+
found: !0
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/evidence/record.ts
|
|
163
|
+
function P(e) {
|
|
164
|
+
let t = b(e.repo, {
|
|
165
|
+
schemaVersion: 1,
|
|
166
|
+
suite: e.suite,
|
|
167
|
+
commit: e.commit,
|
|
168
|
+
tool: e.tool,
|
|
169
|
+
evidenceKind: e.evidenceKind,
|
|
170
|
+
timestamp: e.timestamp,
|
|
171
|
+
entries: e.entries
|
|
172
|
+
}), n = new Map(e.obligations.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
173
|
+
for (let t of e.entries) for (let e of t.traceIds ?? []) {
|
|
174
|
+
if (!n.has(e)) {
|
|
175
|
+
i.add(e);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (t.outcome !== "pass") continue;
|
|
179
|
+
let a = r.get(e) ?? [];
|
|
180
|
+
a.push(t.symbol), r.set(e, a);
|
|
181
|
+
}
|
|
182
|
+
let a = E(e.repo).bindings, o = [], s = [];
|
|
183
|
+
for (let [t, i] of [...r].sort(([e], [t]) => e === t ? 0 : e < t ? -1 : 1)) {
|
|
184
|
+
let r = n.get(t);
|
|
185
|
+
if (!r) continue;
|
|
186
|
+
let c = M(a, {
|
|
187
|
+
obligation: t,
|
|
188
|
+
statementHashAtBinding: r.statement_hash,
|
|
189
|
+
suite: e.suite,
|
|
190
|
+
commit: e.commit,
|
|
191
|
+
symbols: [...i].sort()
|
|
192
|
+
});
|
|
193
|
+
a = c.bindings, c.created && o.push(t), c.suspect && s.push(t);
|
|
194
|
+
}
|
|
195
|
+
return D(e.repo, {
|
|
196
|
+
schemaVersion: 1,
|
|
197
|
+
bindings: a
|
|
198
|
+
}), {
|
|
199
|
+
runPath: t,
|
|
200
|
+
bound: o.sort(),
|
|
201
|
+
suspect: s.sort(),
|
|
202
|
+
unmatched: [...i].sort()
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function F(e) {
|
|
206
|
+
return e.obligations ?? [];
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
export { A as a, O as c, D as d, d as i, E as l, P as n, C as o, N as r, T as s, F as t, k as u };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as e, t } from "./version-
|
|
1
|
+
import { n as e, t } from "./version-DmZHxX4n.js";
|
|
2
2
|
import { isVersionRequest as n, main as r } from "./cli.js";
|
|
3
|
-
import { i, n as a, o, r as s, t as c } from "./base-
|
|
4
|
-
import { a as l, i as u, n as d, r as f } from "./plugins-
|
|
5
|
-
import { n as p, t as m } from "./modules-
|
|
3
|
+
import { i, n as a, o, r as s, t as c } from "./base-D_-Jy4cE.js";
|
|
4
|
+
import { a as l, i as u, n as d, r as f } from "./plugins-DiS0OXoo.js";
|
|
5
|
+
import { n as p, t as m } from "./modules-DSkUXhHn.js";
|
|
6
6
|
import { i as h, n as g, r as _, t as v } from "./config-schema-Dp-vlxuR.js";
|
|
7
|
-
import { a as y, i as b, n as x, o as S, r as C, t as w } from "./write-
|
|
8
|
-
import { t as T } from "./flow-command-
|
|
7
|
+
import { a as y, i as b, n as x, o as S, r as C, t as w } from "./write-CPdSNIkF.js";
|
|
8
|
+
import { t as T } from "./flow-command-B-ZBn9Sd.js";
|
|
9
9
|
export { T as FlowCommand, v as QUOIN_ENV_BINDINGS, g as QUOIN_PLUGIN_ID, c as QuoinCommand, _ as QuoinConfigSchema, b as UNRESOLVED_ORG_MESSAGE, w as createAuthoringPack, a as defaultModuleRoots, m as defaultModulesManifest, p as ensureDefaultModules, s as filamentModulesDir, i as findCatalogEntry, x as formatAuthoringPack, d as installPlugin, n as isVersionRequest, h as ixSchema, f as listPlugins, o as loadCatalog, r as main, y as originOrg, t as packageVersion, u as parseSourceArg, C as parseTypeList, l as removePlugin, S as resolveOrg, e as resolveVersion };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e } from "./base-
|
|
2
|
-
import { t } from "./plugins-
|
|
1
|
+
import { a as e } from "./base-D_-Jy4cE.js";
|
|
2
|
+
import { t } from "./plugins-DiS0OXoo.js";
|
|
3
3
|
import { readFileSync as n } from "node:fs";
|
|
4
4
|
import { dirname as r, join as i } from "node:path";
|
|
5
5
|
import { fileURLToPath as a } from "node:url";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, r as t } from "./base-
|
|
1
|
+
import { a as e, r as t } from "./base-D_-Jy4cE.js";
|
|
2
2
|
import { existsSync as n, readFileSync as r, rmSync as i } from "node:fs";
|
|
3
3
|
import { basename as a, join as o } from "node:path";
|
|
4
4
|
import { parse as s } from "yaml";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The quire↔quoin JSON contract (FR-029).
|
|
3
|
+
*
|
|
4
|
+
* quire-rs FR-055 publishes a versioned JSON Schema for each machine-readable
|
|
5
|
+
* payload it emits. This module is the consumer side: it pins the contract
|
|
6
|
+
* version quoin was written against, vendors the published schemas, and
|
|
7
|
+
* enforces the version premise before anything reads a payload.
|
|
8
|
+
*
|
|
9
|
+
* ## Why the schemas are vendored
|
|
10
|
+
*
|
|
11
|
+
* quire-rs is a Rust crate consumed by git tag; quoin is an npm package. There
|
|
12
|
+
* is no dependency edge along which a schema file could travel, and fetching
|
|
13
|
+
* one at runtime is out of the question (quoin performs no network reads on a
|
|
14
|
+
* command path). So the artifacts are **copied in with their provenance
|
|
15
|
+
* recorded** — source tag, path and content hash — and refreshed deliberately
|
|
16
|
+
* by `scripts/refresh-quire-schemas.mjs`, whose diff is reviewed.
|
|
17
|
+
*
|
|
18
|
+
* That is a copy, and a copy can drift. What keeps it honest is that the hash
|
|
19
|
+
* is asserted on every test run and the refresh script re-derives it from a
|
|
20
|
+
* checked-out quire-rs at the pinned tag: an edit to the vendored file without
|
|
21
|
+
* a matching refresh fails immediately, rather than silently teaching quoin a
|
|
22
|
+
* contract quire does not emit.
|
|
23
|
+
*/
|
|
24
|
+
/** Where the vendored schemas came from, and exactly which bytes. */
|
|
25
|
+
export declare const QUIRE_CONTRACT: {
|
|
26
|
+
/** The quire-rs release the vendored schemas were copied from. */
|
|
27
|
+
readonly sourceTag: "v0.29.0";
|
|
28
|
+
/** The contract version, as carried in each schema's `$id` and filename. */
|
|
29
|
+
readonly contractVersion: "v1";
|
|
30
|
+
/**
|
|
31
|
+
* Minimum `quire` CLI that emits this contract.
|
|
32
|
+
*
|
|
33
|
+
* v0.21.0 is the first release carrying the FR-053 `obligation` field on
|
|
34
|
+
* property records and the FR-055 published schemas. An older binary emits a
|
|
35
|
+
* payload this contract does not describe — which is a diagnosable state, not
|
|
36
|
+
* a parse error to discover three frames deep.
|
|
37
|
+
*/
|
|
38
|
+
readonly minimumCli: "0.21.0";
|
|
39
|
+
/**
|
|
40
|
+
* SHA-256 of each vendored file. Asserted on every test run, so an edit
|
|
41
|
+
* without a matching refresh fails loudly.
|
|
42
|
+
*/
|
|
43
|
+
readonly hashes: {
|
|
44
|
+
readonly "coverage-v1.schema.json": "bcc79e194a2f6c1a60d5345cf4f7947913fe0fe7dcde3f31989b9d9b8cecdbc3";
|
|
45
|
+
readonly "properties-v1.schema.json": "d81f1ec85abdecd1f1664ded15e081f9aecb6c0f054d6b332b71e904cf826292";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type SchemaName = keyof typeof QUIRE_CONTRACT.hashes;
|
|
49
|
+
/** Absolute path of a vendored schema. */
|
|
50
|
+
export declare function schemaPath(name: SchemaName): string;
|
|
51
|
+
/** Read a vendored schema as parsed JSON. */
|
|
52
|
+
export declare function readSchema(name: SchemaName): unknown;
|
|
53
|
+
/** SHA-256 of a vendored schema as it sits on disk. */
|
|
54
|
+
export declare function schemaHash(name: SchemaName): string;
|
|
55
|
+
/**
|
|
56
|
+
* A CLI version that does not satisfy the contract's premise.
|
|
57
|
+
*
|
|
58
|
+
* Carried as a distinct shape so a caller can report *which* premise failed
|
|
59
|
+
* rather than "something went wrong reading quire output" — the failure mode
|
|
60
|
+
* agent-ix/quoin#88 was filed about, where a shape drift surfaced as an
|
|
61
|
+
* unexplained mid-skill error.
|
|
62
|
+
*/
|
|
63
|
+
export interface VersionPremiseFailure {
|
|
64
|
+
readonly kind: "version-premise";
|
|
65
|
+
readonly found: string | null;
|
|
66
|
+
readonly required: string;
|
|
67
|
+
readonly message: string;
|
|
68
|
+
}
|
|
69
|
+
/** Parse `quire --version` output (`quire 0.21.0`) into a version string. */
|
|
70
|
+
export declare function parseCliVersion(output: string): string | null;
|
|
71
|
+
/** Numeric semver comparison. Returns <0, 0, >0. */
|
|
72
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
73
|
+
/**
|
|
74
|
+
* Check a `quire --version` output against the contract's minimum.
|
|
75
|
+
*
|
|
76
|
+
* Returns `null` when the premise holds. Returns a named failure otherwise —
|
|
77
|
+
* including when the version could not be parsed at all, because "no quire on
|
|
78
|
+
* PATH" and "a quire too old to emit this shape" are both states a caller must
|
|
79
|
+
* report rather than push into a downstream parse.
|
|
80
|
+
*/
|
|
81
|
+
export declare function checkVersionPremise(versionOutput: string | null): VersionPremiseFailure | null;
|
|
82
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/quire/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,qEAAqE;AACrE,eAAO,MAAM,cAAc;IACzB,kEAAkE;;IAElE,4EAA4E;;IAE5E;;;;;;;OAOG;;IAEH;;;OAGG;;;;;CAOK,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC,MAAM,CAAC;AAI5D,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEnD;AAED,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEpD;AAED,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAInD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7D;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5D;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,qBAAqB,GAAG,IAAI,CA2B9B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Running the `quire` CLI (FR-029).
|
|
3
|
+
*
|
|
4
|
+
* One place, so the subprocess contract — what is captured, what is reported on
|
|
5
|
+
* failure — is a decision made once rather than repeated at each call site.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Run `quire` and return stdout, surfacing **stderr** when it fails.
|
|
9
|
+
*
|
|
10
|
+
* `stdio: ["ignore", "pipe", "ignore"]` threw away exactly the sentence the
|
|
11
|
+
* operator needs. Reproduced (agent-ix/quoin#106):
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* $ quire coverage --scope . --json
|
|
15
|
+
* no module in scope declares a `traceability:` model, so there is nothing to
|
|
16
|
+
* reconcile; install a module that declares one (e.g. spec-artifacts-process)
|
|
17
|
+
* or pass --module
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `src/quire/contract.ts` goes to real trouble over the version-premise
|
|
21
|
+
* diagnostic for precisely this reason; discarding the subprocess's own
|
|
22
|
+
* diagnostic undid it one frame later.
|
|
23
|
+
*/
|
|
24
|
+
export declare function runQuire(args: string[]): string;
|
|
25
|
+
/**
|
|
26
|
+
* As {@link runQuire}, but a non-zero exit returns what was written rather than
|
|
27
|
+
* throwing.
|
|
28
|
+
*
|
|
29
|
+
* `quire properties` exits 1 when **any** input document fails to resolve — an
|
|
30
|
+
* asset with no `type:`, say — while still writing a complete, valid payload
|
|
31
|
+
* for every document that did. Treating that as total failure threw away the
|
|
32
|
+
* whole property-shape axis over two untyped files, silently (agent-ix/quoin#103).
|
|
33
|
+
*
|
|
34
|
+
* The caller decides what a partial result is worth; this only stops the
|
|
35
|
+
* decision being made by an exception.
|
|
36
|
+
*/
|
|
37
|
+
export declare function runQuireAllowFailure(args: string[]): {
|
|
38
|
+
stdout: string;
|
|
39
|
+
stderr: string;
|
|
40
|
+
ok: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** `quire --version` output, or `null` when quire is not on PATH. */
|
|
43
|
+
export declare function quireVersion(): string | null;
|
|
44
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/quire/exec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAc/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;CACb,CAkBA;AAED,qEAAqE;AACrE,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAM5C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The quire↔quoin contract surface (FR-029).
|
|
3
|
+
*
|
|
4
|
+
* One import site for everything a consumer needs to read quire JSON safely:
|
|
5
|
+
* the pinned contract, the version premise, the validators, and the models the
|
|
6
|
+
* validators make true.
|
|
7
|
+
*/
|
|
8
|
+
export { QUIRE_CONTRACT, checkVersionPremise, compareVersions, parseCliVersion, readSchema, schemaHash, schemaPath, type SchemaName, type VersionPremiseFailure, } from './contract.js';
|
|
9
|
+
export { parseCoverage, parseProperties, validateCoverage, validateProperties, type ContractViolation, type ValidationResult, } from './validate.js';
|
|
10
|
+
export type { AcShape, CoverageDiagnostic, CoverageReport, CoverageTotals, Criterion, CriteriaCounts, CriterionObligation, Extraction, GroupCounts, NoSymbolRow, Obligation, PropertiesDocument, PropertiesReport, PropertyShape, PropertySpan, StatusLie, UnbackedRow, UntrackedSymbol, } from './types.js';
|
|
11
|
+
export { quireVersion, runQuire, runQuireAllowFailure } from './exec.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/quire/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,UAAU,EACf,KAAK,qBAAqB,GAC3B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,OAAO,EACP,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript models for the quire JSON payloads (FR-029).
|
|
3
|
+
*
|
|
4
|
+
* These mirror the vendored schemas rather than restating them: every value
|
|
5
|
+
* that reaches consumer code has been validated against the published schema
|
|
6
|
+
* first (`validateCoverage` / `validateProperties`), so a mismatch between
|
|
7
|
+
* these declarations and the contract surfaces as a validation error naming the
|
|
8
|
+
* offending path — not as an `undefined` three frames later.
|
|
9
|
+
*
|
|
10
|
+
* That ordering is the point. quoin's own `spec/review.md` Finding 8 records
|
|
11
|
+
* "no contract test against quire": the shapes lived as prose in skill
|
|
12
|
+
* markdown, and when one drifted an agent failed mid-skill with nothing to
|
|
13
|
+
* diagnose. Types alone would not have fixed that — TypeScript erases at
|
|
14
|
+
* runtime and JSON from a subprocess is `any`. The validator is what makes
|
|
15
|
+
* these types true.
|
|
16
|
+
*/
|
|
17
|
+
/** One reference row answerable for trace ids nothing backs (FR-050-AC-3). */
|
|
18
|
+
export interface UnbackedRow {
|
|
19
|
+
reference: string;
|
|
20
|
+
document: string;
|
|
21
|
+
row_id?: string | null;
|
|
22
|
+
target_ids: string[];
|
|
23
|
+
}
|
|
24
|
+
/** A row whose status classes as complete while nothing backs it. */
|
|
25
|
+
export interface StatusLie {
|
|
26
|
+
reference: string;
|
|
27
|
+
document: string;
|
|
28
|
+
row_id?: string | null;
|
|
29
|
+
status: string;
|
|
30
|
+
target_ids: string[];
|
|
31
|
+
}
|
|
32
|
+
/** An unbacked row exempted by a method that mints no source symbol (CR-041). */
|
|
33
|
+
export interface NoSymbolRow {
|
|
34
|
+
reference: string;
|
|
35
|
+
document: string;
|
|
36
|
+
row_id?: string | null;
|
|
37
|
+
test_type: string;
|
|
38
|
+
target_ids: string[];
|
|
39
|
+
}
|
|
40
|
+
/** A source symbol whose trace tag resolves to nothing declared. */
|
|
41
|
+
export interface UntrackedSymbol {
|
|
42
|
+
path: string;
|
|
43
|
+
symbol: string;
|
|
44
|
+
trace_id: string;
|
|
45
|
+
}
|
|
46
|
+
/** Backed/total counts for one minting document and target kind. */
|
|
47
|
+
export interface GroupCounts {
|
|
48
|
+
document: string;
|
|
49
|
+
target: string;
|
|
50
|
+
backed: number;
|
|
51
|
+
total: number;
|
|
52
|
+
}
|
|
53
|
+
/** Per-document property-shape counts (CR-028). */
|
|
54
|
+
export interface CriteriaCounts {
|
|
55
|
+
document: string;
|
|
56
|
+
archetype: string;
|
|
57
|
+
criteria: number;
|
|
58
|
+
property_shaped: number;
|
|
59
|
+
by_property: Record<string, number>;
|
|
60
|
+
}
|
|
61
|
+
/** A declaration that selected nothing, and why (CR-054). */
|
|
62
|
+
export interface CoverageDiagnostic {
|
|
63
|
+
declaration: string;
|
|
64
|
+
/** Open machine vocabulary — deliberately not a union (FR-055). */
|
|
65
|
+
reason: string;
|
|
66
|
+
message: string;
|
|
67
|
+
path?: string | null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* One derived obligation (quire-rs FR-053) — the quire↔quoin contract itself.
|
|
71
|
+
*
|
|
72
|
+
* `statement_hash` is the whole reason this record exists downstream: suspect
|
|
73
|
+
* detection is `current_hash !== hash_at_binding` and nothing more.
|
|
74
|
+
*/
|
|
75
|
+
export interface Obligation {
|
|
76
|
+
source: string;
|
|
77
|
+
id: string;
|
|
78
|
+
document: string;
|
|
79
|
+
statement: string;
|
|
80
|
+
statement_hash: string;
|
|
81
|
+
method?: string | null;
|
|
82
|
+
parameters?: Record<string, string>;
|
|
83
|
+
criticality?: string | null;
|
|
84
|
+
}
|
|
85
|
+
/** Bundle-wide totals. The criteria pair is all-or-nothing. */
|
|
86
|
+
export interface CoverageTotals {
|
|
87
|
+
backed: number;
|
|
88
|
+
total: number;
|
|
89
|
+
criteria?: number | null;
|
|
90
|
+
property_shaped?: number | null;
|
|
91
|
+
}
|
|
92
|
+
/** The `quire coverage --json` payload (v1). */
|
|
93
|
+
export interface CoverageReport {
|
|
94
|
+
unbacked_rows: UnbackedRow[];
|
|
95
|
+
status_lies: StatusLie[];
|
|
96
|
+
/** Absent — not empty — when the module declares no exemption vocabulary. */
|
|
97
|
+
no_symbol_rows?: NoSymbolRow[];
|
|
98
|
+
untracked_symbols: UntrackedSymbol[];
|
|
99
|
+
groups: GroupCounts[];
|
|
100
|
+
criteria?: CriteriaCounts[];
|
|
101
|
+
diagnostics?: CoverageDiagnostic[];
|
|
102
|
+
obligations?: Obligation[];
|
|
103
|
+
totals: CoverageTotals;
|
|
104
|
+
}
|
|
105
|
+
/** A byte-offset span carrying its own text (FR-052). */
|
|
106
|
+
export interface PropertySpan {
|
|
107
|
+
start: number;
|
|
108
|
+
end: number;
|
|
109
|
+
text: string;
|
|
110
|
+
}
|
|
111
|
+
/** The FR-047 shape axis. Closed in the engine, so closed here. */
|
|
112
|
+
export type AcShape = "assertion" | "obligation" | "given-when-then" | "unstructured";
|
|
113
|
+
/** The FR-052 property-shape axis. Closed by FR-052-CON-3. */
|
|
114
|
+
export type PropertyShape = "round-trip" | "idempotence" | "ordering" | "invariant" | "error-case" | "lifecycle" | "concurrency" | "universal" | "example" | "unclassified";
|
|
115
|
+
/** What a generator may do with a criterion (CR-033). */
|
|
116
|
+
export type Extraction = "extractable" | "candidate" | "not-extractable";
|
|
117
|
+
/**
|
|
118
|
+
* The obligation as nested on a criterion record.
|
|
119
|
+
*
|
|
120
|
+
* Carries no `id`, `statement` or `document`: the criterion and its enclosing
|
|
121
|
+
* document object already have all three.
|
|
122
|
+
*/
|
|
123
|
+
export interface CriterionObligation {
|
|
124
|
+
source: string;
|
|
125
|
+
statement_hash: string;
|
|
126
|
+
method?: string | null;
|
|
127
|
+
parameters?: Record<string, string>;
|
|
128
|
+
criticality?: string | null;
|
|
129
|
+
}
|
|
130
|
+
/** One classified acceptance criterion. */
|
|
131
|
+
export interface Criterion {
|
|
132
|
+
row_id: string | null;
|
|
133
|
+
statement: string;
|
|
134
|
+
line: number | null;
|
|
135
|
+
shape: AcShape;
|
|
136
|
+
property: PropertyShape;
|
|
137
|
+
extractable: boolean;
|
|
138
|
+
extraction: Extraction;
|
|
139
|
+
domain: PropertySpan | null;
|
|
140
|
+
precondition: PropertySpan | null;
|
|
141
|
+
oracle: PropertySpan | null;
|
|
142
|
+
signals: string[];
|
|
143
|
+
obligation: CriterionObligation | null;
|
|
144
|
+
}
|
|
145
|
+
/** One document's classified criteria. */
|
|
146
|
+
export interface PropertiesDocument {
|
|
147
|
+
document: string;
|
|
148
|
+
archetype: string;
|
|
149
|
+
criteria: Criterion[];
|
|
150
|
+
}
|
|
151
|
+
/** The `quire properties --json` payload (v1). */
|
|
152
|
+
export interface PropertiesReport {
|
|
153
|
+
documents: PropertiesDocument[];
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/quire/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SchemaName } from './contract.js';
|
|
2
|
+
import { CoverageReport, PropertiesReport } from './types.js';
|
|
3
|
+
/** A payload that did not satisfy the published contract. */
|
|
4
|
+
export interface ContractViolation {
|
|
5
|
+
readonly kind: "contract-violation";
|
|
6
|
+
readonly schema: SchemaName;
|
|
7
|
+
/** One line per failing path, in the order ajv reported them. */
|
|
8
|
+
readonly errors: string[];
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}
|
|
11
|
+
export type ValidationResult<T> = {
|
|
12
|
+
ok: true;
|
|
13
|
+
value: T;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
error: ContractViolation;
|
|
17
|
+
};
|
|
18
|
+
/** Validate a `quire coverage --json` payload. */
|
|
19
|
+
export declare function validateCoverage(payload: unknown): ValidationResult<CoverageReport>;
|
|
20
|
+
/** Validate a `quire properties --json` payload. */
|
|
21
|
+
export declare function validateProperties(payload: unknown): ValidationResult<PropertiesReport>;
|
|
22
|
+
/**
|
|
23
|
+
* Parse and validate in one step, so a caller never holds an unvalidated
|
|
24
|
+
* payload it could accidentally use.
|
|
25
|
+
*
|
|
26
|
+
* A JSON parse failure is reported as a contract violation rather than thrown:
|
|
27
|
+
* from the caller's position "quire emitted something unreadable" and "quire
|
|
28
|
+
* emitted the wrong shape" are the same actionable fact — the tool's output
|
|
29
|
+
* cannot be consumed — and both want the same named diagnostic.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseCoverage(text: string): ValidationResult<CoverageReport>;
|
|
32
|
+
/** As {@link parseCoverage}, for the properties payload. */
|
|
33
|
+
export declare function parseProperties(text: string): ValidationResult<PropertiesReport>;
|
|
34
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/quire/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAoDnE,kDAAkD;AAClD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,GACf,gBAAgB,CAAC,cAAc,CAAC,CAElC;AAED,oDAAoD;AACpD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,GACf,gBAAgB,CAAC,gBAAgB,CAAC,CAEpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAE5E;AAED,4DAA4D;AAC5D,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GACX,gBAAgB,CAAC,gBAAgB,CAAC,CAEpC"}
|