@agent-ix/quoin 0.19.2 → 0.21.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 (66) 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 +54 -11
  5. package/dist/advisor/advise.d.ts.map +1 -1
  6. package/dist/advisor/index.d.ts +1 -1
  7. package/dist/advisor/index.d.ts.map +1 -1
  8. package/dist/{advisor-a9axb4Jl.js → advisor-C4P3aTJT.js} +1 -1
  9. package/dist/auditor/audit.d.ts +23 -0
  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/auditor-B6Hs00oH.js +269 -0
  14. package/dist/{base-BE20w0jY.js → base-DQg6yfbN.js} +1 -1
  15. package/dist/cli.js +1 -1
  16. package/dist/commands/advise.d.ts.map +1 -1
  17. package/dist/commands/advise.js +82 -36
  18. package/dist/commands/assurance.js +13 -13
  19. package/dist/commands/catalog/list.js +2 -2
  20. package/dist/commands/catalog/methods.js +3 -3
  21. package/dist/commands/catalog/show.js +2 -2
  22. package/dist/commands/catalog/validate.js +2 -2
  23. package/dist/commands/completeness.js +2 -2
  24. package/dist/commands/config/doctor.js +1 -1
  25. package/dist/commands/config/edit.js +1 -1
  26. package/dist/commands/config/get.js +1 -1
  27. package/dist/commands/config/set.js +1 -1
  28. package/dist/commands/evidence/affirm.js +5 -5
  29. package/dist/commands/evidence/audit.d.ts.map +1 -1
  30. package/dist/commands/evidence/audit.js +36 -42
  31. package/dist/commands/evidence/baseline.js +13 -13
  32. package/dist/commands/evidence/gc.js +2 -2
  33. package/dist/commands/evidence/index.js +1 -1
  34. package/dist/commands/evidence/record.js +12 -12
  35. package/dist/commands/matrix.js +1 -1
  36. package/dist/commands/module/ensure-defaults.js +3 -3
  37. package/dist/commands/module/install.js +2 -2
  38. package/dist/commands/module/list.js +2 -2
  39. package/dist/commands/module/remove.js +2 -2
  40. package/dist/commands/review.js +1 -1
  41. package/dist/commands/to-plan.js +1 -1
  42. package/dist/commands/update.js +2 -2
  43. package/dist/commands/write.js +3 -3
  44. package/dist/{completeness-BeqcskAI.js → completeness-B1qG_rZo.js} +1 -1
  45. package/dist/evidence/index.d.ts +1 -1
  46. package/dist/evidence/index.d.ts.map +1 -1
  47. package/dist/evidence/record.d.ts.map +1 -1
  48. package/dist/evidence/store.d.ts +12 -0
  49. package/dist/evidence/store.d.ts.map +1 -1
  50. package/dist/{evidence-FRF9RN77.js → evidence-DopNnj0E.js} +120 -110
  51. package/dist/{flow-command-BrzzKBo9.js → flow-command-CrMEzCWz.js} +1 -1
  52. package/dist/index.js +6 -6
  53. package/dist/{modules-_FQTZ3gx.js → modules-CvBmrY7T.js} +2 -2
  54. package/dist/{plugins-Q1MtCIE5.js → plugins-C7jz-Y_w.js} +1 -1
  55. package/dist/quire/contract.d.ts +2 -2
  56. package/dist/quire/types.d.ts +11 -0
  57. package/dist/quire/types.d.ts.map +1 -1
  58. package/dist/{quire-Dis3ky5t.js → quire-VZjWaHph.js} +2 -2
  59. package/dist/schemas/coverage-v1.schema.json +23 -1
  60. package/dist/{version-D0l3nDPZ.js → version-DgWC58-h.js} +1 -1
  61. package/dist/{write-CMA6BDUq.js → write-68NgoaMy.js} +1 -1
  62. package/package.json +2 -2
  63. package/skills/spec-evidence-analysis/SKILL.md +51 -1
  64. package/skills/spec-fuzz/SKILL.md +30 -0
  65. package/dist/auditor-W2jFinr6.js +0 -188
  66. package/dist/combinatorial-Cq01XfhV.js +0 -80
@@ -53,6 +53,11 @@
53
53
  "description": "FR-053: derived obligation records, ordered by source then document then row. Absent for a model declaring no `obligations:` sources.",
54
54
  "items": { "$ref": "#/$defs/Obligation" }
55
55
  },
56
+ "implements": {
57
+ "type": "array",
58
+ "description": "FR-062: requirement -> production-code edges. Absent for a module declaring no `implements` marker forms. Carries no weight in `totals` — scope is not evidence.",
59
+ "items": { "$ref": "#/$defs/ImplementsRecord" }
60
+ },
56
61
  "totals": { "$ref": "#/$defs/CoverageTotals" }
57
62
  },
58
63
  "$defs": {
@@ -169,9 +174,26 @@
169
174
  "additionalProperties": { "type": "string" },
170
175
  "description": "Declared parameters. An absent key means the cell was empty — never defaulted."
171
176
  },
172
- "criticality": { "type": ["string", "null"] }
177
+ "criticality": { "type": ["string", "null"] },
178
+ "target_ids": {
179
+ "type": "array",
180
+ "items": { "type": "string", "minLength": 1 },
181
+ "description": "Test-case ids the method cell names, e.g. `Test (TC-707)`. Additive in v1: absent on a payload from an engine before quire-rs v0.35.0, and omitted where the cell names none. A consumer binding evidence keyed on a TEST CASE rather than on the criterion needs this join, which the engine parsed and discarded (agent-ix/quire-rs#180)."
182
+ }
173
183
  }
174
184
  },
185
+ "ImplementsRecord": {
186
+ "type": "object",
187
+ "additionalProperties": false,
188
+ "required": ["path", "symbol", "trace_id", "form"],
189
+ "properties": {
190
+ "path": { "type": "string", "minLength": 1 },
191
+ "symbol": { "type": "string", "minLength": 1 },
192
+ "trace_id": { "type": "string", "minLength": 1 },
193
+ "form": { "type": "string", "minLength": 1 }
194
+ },
195
+ "description": "FR-062: one requirement -> production-code edge. SCOPE, not evidence — which requirement a production symbol is about. A consumer must not fold this into a backed set or a coverage total; doing so lets unverified code claim coverage, which is the backdoor CR-061 closed."
196
+ },
175
197
  "CoverageTotals": {
176
198
  "type": "object",
177
199
  "additionalProperties": false,
@@ -11,7 +11,7 @@ function a(e) {
11
11
  return e || i();
12
12
  }
13
13
  function o() {
14
- return a("0.19.2");
14
+ return a("0.21.0");
15
15
  }
16
16
  //#endregion
17
17
  export { a as n, o as t };
@@ -1,4 +1,4 @@
1
- import { i as e } from "./base-BE20w0jY.js";
1
+ import { i as e } from "./base-DQg6yfbN.js";
2
2
  import { n as t, r as n, t as r } from "./config-schema-Dp-vlxuR.js";
3
3
  import { ConfigService as i } from "@agent-ix/ix-cli-core";
4
4
  import { existsSync as a, readFileSync as o, statSync as s } from "node:fs";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agent-ix/quoin",
3
3
  "description": "Spec-driven development for Claude Code — author validated, ISO/IEC/IEEE 29148-aligned specs, then plan and build against them.",
4
- "version": "0.19.2",
4
+ "version": "0.21.0",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "files": [
@@ -97,7 +97,7 @@
97
97
  "zod": ">=4.4.3"
98
98
  },
99
99
  "devDependencies": {
100
- "@agent-ix/quire-cli": "^0.23.0",
100
+ "@agent-ix/quire-cli": "^0.25.1",
101
101
  "@types/node": "26.1.2",
102
102
  "@typescript-eslint/eslint-plugin": "8.66.0",
103
103
  "@typescript-eslint/parser": "8.66.0",
@@ -58,10 +58,15 @@ against.
58
58
 
59
59
  2. **Take the deterministic recommendations first.** They come from the
60
60
  catalog's `applicability` rules matched against facts about the obligation:
61
- its statement's characteristics, its FR-052 property shape, its archetype.
61
+ its statement's characteristics, its FR-052 property shape, its archetype,
62
+ its declared criticality, and what the evidence store already records.
62
63
  Rules match or they do not. Each recommendation names the rule and the value
63
64
  that matched, so you can check the reasoning rather than trust it.
64
65
 
66
+ **Read what matched, not just what was recommended.** A recommendation
67
+ matched *only* on an evidence characteristic is telling you about the tests,
68
+ not about the requirement — see below.
69
+
65
70
  3. **Judge only the residue, and label it.** Where the rules are inconclusive
66
71
  the advisor says so and stops rather than guessing. That is where your
67
72
  judgement belongs — and it must be recorded *as* judgement. Never present an
@@ -76,6 +81,51 @@ against.
76
81
  suite that can produce its evidence is a gap in the plan, not a gap in the
77
82
  spec.
78
83
 
84
+ ## Recommendations that come from the evidence, not from the requirement
85
+
86
+ `quoin advise` reads the evidence store. Two characteristics come from there
87
+ rather than from the statement, and they mean something different from the rest.
88
+
89
+ | Matched value | What it says |
90
+ |---|---|
91
+ | `fault-detection-unmeasured` | the obligation **is** exercised by a bound run, and nothing measures whether that exercise would catch a fault |
92
+ | `fault-detection-failed` | something **did** measure it, and a seeded fault survived |
93
+
94
+ **Both mean "escalate the existing suite", not "the requirement is unverified".**
95
+ An obligation nothing is bound to is `undischarged`, which the auditor reports
96
+ separately — and neither of these mints for it, deliberately, because
97
+ recommending a solver for code nobody has tested yet is advice nobody can act
98
+ on.
99
+
100
+ So when the only reason a method was recommended is one of these two, the
101
+ finding you write is about the tests. "This is tested and nothing says the tests
102
+ discriminate" is a different sentence from "this requirement has no method", and
103
+ they lead to different work.
104
+
105
+ ## Cost is not in the catalog yet, so it has to be here
106
+
107
+ The advisor ranks by **how many rules matched**. It has no way to say what a
108
+ method costs, so an escalation of last resort ties with a unit test and the
109
+ output gives no hint. Filed as `agent-ix/quire-rs#190`; until it lands, this
110
+ paragraph is the only place the ordering is written down.
111
+
112
+ **`concolic-execution` is the case to watch.** Concrete + symbolic execution
113
+ runs the code while recording the constraints on each branch, then negates one
114
+ and asks a solver for an input that flips it — `if x * 3 == 51` is a
115
+ 1-in-4-billion coin flip for a fuzzer and one line of algebra for a solver. It
116
+ also path-explodes and is slow. **Nobody reaches for it first.** The industrial
117
+ pattern is hybrid fuzzing: fuzz until the coverage curve flattens, then hand the
118
+ stuck branches to a solver (Driller, QSYM, SymCC).
119
+
120
+ When it is recommended alongside a cheaper method keyed on the same evidence —
121
+ `mutation-testing` on `fault-detection-unmeasured`, for instance — **take the
122
+ cheaper one first.** Measuring is what tells you whether the escalation is
123
+ warranted.
124
+
125
+ This is the skill-local-prose arrangement ADR-0011 moved away from, and it is
126
+ recorded as a debt rather than a design. When `quire-rs#190` lands, this section
127
+ should shrink to a pointer at the catalog.
128
+
79
129
  ## What "inconclusive" means, and why it is not a failure
80
130
 
81
131
  An obligation the rules cannot place is a normal outcome — the catalog's
@@ -49,6 +49,36 @@ Three more:
49
49
  Not for: authoring the requirement (`specify`), choosing the method (`quoin advise`), or
50
50
  running the fuzzer. Running is the consumer's CI — quoin transcribes, it does not execute.
51
51
 
52
+ ## When fuzzing stops being the answer
53
+
54
+ A fuzz campaign has a shape: coverage climbs, then flattens. **The plateau is
55
+ the documented signal to escalate**, not to fuzz harder. Random input cannot
56
+ satisfy a checksum, a CRC or a magic number — `if x * 3 == 51` is roughly a
57
+ 1-in-4-billion coin flip for a fuzzer and one line of algebra for a solver.
58
+
59
+ The industrial pattern is **hybrid fuzzing**: fuzz until the curve flattens,
60
+ hand the stuck branches to a solver, feed the solved inputs back to the fuzzer
61
+ as fresh seeds. Driller (2016) did it with AFL + angr; QSYM, SymCC and Fuzzolic
62
+ followed.
63
+
64
+ The concrete hop in Rust:
65
+
66
+ ```
67
+ cargo-fuzz ──plateau──▶ Kani bounded model checking over MIR (AWS)
68
+ haybale symbolic execution of LLVM IR, in Rust
69
+ ```
70
+
71
+ `quoin advise` will point there on its own once the evidence says so — the
72
+ catalog keys `concolic-execution` on `fault-detection-unmeasured` (exercised,
73
+ and nothing measures whether the tests discriminate) and
74
+ `fault-detection-failed` (measured, and a seeded fault survived). Record the
75
+ fuzz and mutation runs and the recommendation follows.
76
+
77
+ **Do not escalate before that.** Concolic execution path-explodes and is slow;
78
+ it earns its cost only where the cheap search has demonstrably stalled. The
79
+ catalog cannot yet express that ordering (`agent-ix/quire-rs#190`), so it is
80
+ written here.
81
+
52
82
  ## Inputs
53
83
 
54
84
  - The target repository.
@@ -1,188 +0,0 @@
1
- import { n as e, t } from "./combinatorial-Cq01XfhV.js";
2
- import { h as n } from "./evidence-FRF9RN77.js";
3
- //#region src/auditor/audit.ts
4
- function r(r) {
5
- let l = [], u = [], d = /* @__PURE__ */ new Map();
6
- for (let e of r.bindings) {
7
- let t = d.get(e.obligation) ?? [];
8
- t.push(e), d.set(e.obligation, t);
9
- }
10
- let f = new Map(r.runs.map((e) => [e.suite, e])), p = new Map((r.scans ?? []).map((e) => [e.suite, e]));
11
- for (let m of [...r.obligations].sort(a)) {
12
- let a = (d.get(m.id) ?? []).slice().sort((e, t) => i(e.suite, t.suite));
13
- if (a.length === 0) {
14
- l.push({
15
- kind: "undischarged",
16
- obligation: m.id,
17
- severity: "medium",
18
- summary: `no evidence is bound to ${m.id}`
19
- });
20
- continue;
21
- }
22
- let h = a.filter((e) => e.statementHashAtBinding !== m.statement_hash);
23
- if (h.length > 0) {
24
- l.push({
25
- kind: "suspect-link",
26
- obligation: m.id,
27
- severity: "high",
28
- summary: `${m.id} was reworded after its evidence was bound in ${h.map((e) => e.suite).join(", ")} (bound against ${h[0].statementHashAtBinding.slice(0, 12)}…, now ${m.statement_hash.slice(0, 12)}…). Re-affirm or re-verify.`
29
- });
30
- continue;
31
- }
32
- let g = a.filter((e) => !f.has(e.suite) && !p.has(e.suite));
33
- if (g.length > 0) {
34
- l.push({
35
- kind: "stale-evidence",
36
- obligation: m.id,
37
- severity: "high",
38
- summary: `${m.id} is bound to ${g.map((e) => e.suite).join(", ")}, which ${g.length === 1 ? "has" : "have"} no recorded run. The binding claims evidence that is not in the store.`
39
- });
40
- continue;
41
- }
42
- let _ = a.map((e) => p.get(e.suite)).filter((e) => e !== void 0).filter((e) => n(e) === !0);
43
- if (_.length > 0) {
44
- l.push({
45
- kind: "vacuous-evidence",
46
- obligation: m.id,
47
- severity: "high",
48
- summary: `${m.id} rests on a scan that evaluated no rules: ` + _.map((e) => `${e.suite} (${e.tool})`).sort(i).join(", ") + ". It reported no finding because it looked for nothing."
49
- });
50
- continue;
51
- }
52
- let v = a.filter((e) => f.has(e.suite));
53
- if (v.length === 0) continue;
54
- let y = v.map((e) => f.get(e.suite));
55
- if (r.headCommit) {
56
- let e = a.filter((e, t) => y[t].commit !== r.headCommit);
57
- e.length > 0 && l.push({
58
- kind: "stale-evidence",
59
- obligation: m.id,
60
- severity: "medium",
61
- summary: `${m.id} rests on ` + e.map((e) => `a ${e.suite} run at ${f.get(e.suite).commit.slice(0, 12)}`).join(" and ") + `, not at HEAD (${r.headCommit.slice(0, 12)}).`
62
- });
63
- }
64
- let b = v.flatMap((e, t) => e.symbols.filter((e) => {
65
- let n = y[t].entries.find((t) => t.symbol === e);
66
- return !n || n.outcome === "skip";
67
- }).map((t) => `${e.suite}:${t}`)), x = v.reduce((e, t) => e + t.symbols.length, 0);
68
- if (b.length > 0 && b.length === x) {
69
- l.push({
70
- kind: "vacuous-evidence",
71
- obligation: m.id,
72
- severity: "high",
73
- summary: `every symbol bound to ${m.id} was skipped or absent from its run: ${b.sort(i).join(", ")}. The row reads as covered and nothing was verified.`
74
- });
75
- continue;
76
- }
77
- let S = t(m.statement ?? "");
78
- if (S) {
79
- let t = y.flatMap((e) => e.entries.map((e) => e.config).filter((e) => !!e)), n = e(S, t);
80
- if (n.covered < n.demanded) {
81
- l.push({
82
- kind: "combinatorial-gap",
83
- obligation: m.id,
84
- severity: "medium",
85
- summary: `${m.id} demands ${n.demanded} ${n.strength}-way combinations and its runs reached ${n.covered}. Never run: ${n.gaps.slice(0, 10).join("; ")}` + (n.gaps.length > 10 ? ` (and ${n.gaps.length - 10} more)` : "")
86
- });
87
- continue;
88
- }
89
- }
90
- let C = o(m, v, y, r.catalog);
91
- if (C) {
92
- l.push(C);
93
- continue;
94
- }
95
- let w = s(m, a, r);
96
- if (w) {
97
- l.push(w);
98
- continue;
99
- }
100
- let T = c(m, v, y, r);
101
- if (T) {
102
- l.push(T);
103
- continue;
104
- }
105
- u.push(m.id);
106
- }
107
- return l.sort((e, t) => i(e.obligation, t.obligation) || i(e.kind, t.kind)), {
108
- findings: l,
109
- healthy: u.sort(i)
110
- };
111
- }
112
- function i(e, t) {
113
- return e === t ? 0 : e < t ? -1 : 1;
114
- }
115
- function a(e, t) {
116
- return i(e.id, t.id);
117
- }
118
- function o(e, t, n, r) {
119
- if (!r || !e.method) return null;
120
- let a = e.method.trim().toLowerCase(), o = r.methods.filter((e) => e.id.toLowerCase() === a || e.class.toLowerCase() === a);
121
- if (o.length === 0) return {
122
- kind: "unknown-method",
123
- obligation: e.id,
124
- severity: "medium",
125
- 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.`
126
- };
127
- let s = new Set(o.map((e) => e.evidenceKind).filter((e) => typeof e == "string" && e.length > 0));
128
- if (s.size === 0) return null;
129
- let c = t.filter((e, t) => {
130
- let r = n[t].evidenceKind;
131
- return typeof r == "string" && r.length > 0 && !s.has(r);
132
- });
133
- return c.length === 0 ? null : {
134
- kind: "method-conformance",
135
- obligation: e.id,
136
- severity: "medium",
137
- summary: `${e.id} declares \`${e.method}\`, whose evidence kind is ${[...s].sort(i).join("/")}, but is discharged by ` + c.map((e) => `a ${n[t.indexOf(e)].evidenceKind} run in ${e.suite}`).join(" and ") + ". A method is not discharged by evidence of another kind."
138
- };
139
- }
140
- function s(e, t, n) {
141
- let r = n.multiplicityRequires ?? [];
142
- if (r.length === 0 || !e.criticality || !r.includes(e.criticality)) return null;
143
- let i = new Set(t.map((e) => e.suite));
144
- return i.size >= 2 ? null : {
145
- kind: "insufficient-multiplicity",
146
- obligation: e.id,
147
- severity: "medium",
148
- summary: `${e.id} is criticality ${e.criticality}, which requires two independent methods, but all its evidence comes from ${[...i].join(", ")}.`
149
- };
150
- }
151
- function c(e, t, n, r) {
152
- let i = r.mutationFloor ?? {};
153
- if (!e.criticality) return null;
154
- let a = i[e.criticality];
155
- if (a === void 0 || !l(r.catalog)) return null;
156
- let o = u(t, n, r.catalog);
157
- if (o.length === 0) return {
158
- kind: "unmeasured-mutation-score",
159
- obligation: e.id,
160
- severity: "medium",
161
- summary: `${e.id} is criticality ${e.criticality}, which demands a mutation score of at least ${a}, and no run bound to it records one.`
162
- };
163
- let s = Math.min(...o);
164
- return s >= a ? null : {
165
- kind: "insufficient-mutation-score",
166
- obligation: e.id,
167
- severity: "medium",
168
- summary: `${e.id} is criticality ${e.criticality}, which demands a mutation score of at least ${a}; its weakest bound symbol scores ${s}.`
169
- };
170
- }
171
- function l(e) {
172
- let t = new Set((e?.methods ?? []).filter((e) => e.id === "mutation-testing").flatMap((e) => e.tooling).map((e) => e.toLowerCase()));
173
- return t.size > 0 ? t : null;
174
- }
175
- function u(e, t, n) {
176
- let r = new Set(e.map((e) => e.suite)), i = l(n) ?? /* @__PURE__ */ new Set(), a = [];
177
- for (let e of t) if (r.has(e.suite) && [...i].some((t) => e.tool.toLowerCase().startsWith(t))) for (let t of e.entries) t.score !== void 0 && t.outcome !== "skip" && a.push(t.score);
178
- return a;
179
- }
180
- function d(e) {
181
- return `${e.kind}:${e.obligation}`;
182
- }
183
- function f(e, t) {
184
- let n = new Set(t.accepted);
185
- return e.findings.filter((e) => !n.has(d(e)));
186
- }
187
- //#endregion
188
- export { d as n, f as r, r as t };
@@ -1,80 +0,0 @@
1
- //#region src/auditor/combinatorial.ts
2
- var e = /^(\d+)-way over\s/, t = /([^\s(]+)\(([^)]*)\)/g, n = /excluding\[([^\]]*)\]/g;
3
- function r(r) {
4
- let i = e.exec(r);
5
- if (!i) return null;
6
- let a = Number.parseInt(i[1], 10);
7
- if (!Number.isFinite(a) || a < 1) return null;
8
- let o = r.split("excluding[")[0], s = [];
9
- for (let e of o.matchAll(t)) {
10
- let t = e[2].split("|").map((e) => e.trim()).filter((e) => e !== "");
11
- t.length < 2 || s.push({
12
- name: e[1],
13
- values: t
14
- });
15
- }
16
- if (s.length < 2) return null;
17
- let c = [];
18
- for (let e of r.matchAll(n)) {
19
- let t = e[1].split(",").map((e) => e.trim()).filter((e) => e !== "").map((e) => {
20
- let t = e.indexOf("=");
21
- return t === -1 ? null : [e.slice(0, t).trim(), e.slice(t + 1).trim()];
22
- }).filter((e) => e !== null);
23
- t.length >= 2 && c.push({ assignments: t });
24
- }
25
- return {
26
- strength: a,
27
- dimensions: s,
28
- exclusions: c
29
- };
30
- }
31
- function i(e, t) {
32
- if (t > e || t < 1) return [];
33
- let n = [], r = [], i = (a) => {
34
- if (r.length === t) {
35
- n.push([...r]);
36
- return;
37
- }
38
- for (let t = a; t < e; t += 1) r.push(t), i(t + 1), r.pop();
39
- };
40
- return i(0), n;
41
- }
42
- function a(e) {
43
- return [...e].sort((e, t) => e[0] < t[0] ? -1 : +(e[0] > t[0])).map(([e, t]) => `${e}=${t}`).join(" & ");
44
- }
45
- function o(e, t) {
46
- return e.exclusions.some((e) => e.assignments.every(([e, n]) => t.some(([t, r]) => t === e && r === n)));
47
- }
48
- function s(e) {
49
- let t = /* @__PURE__ */ new Set();
50
- for (let n of i(e.dimensions.length, e.strength)) {
51
- let r = (i, s) => {
52
- if (i === n.length) {
53
- o(e, s) || t.add(a(s));
54
- return;
55
- }
56
- let c = e.dimensions[n[i]];
57
- for (let e of c.values) s.push([c.name, e]), r(i + 1, s), s.pop();
58
- };
59
- r(0, []);
60
- }
61
- return t;
62
- }
63
- function c(e, t) {
64
- let n = e.dimensions.filter((e) => t[e.name] !== void 0 && e.values.includes(t[e.name])), r = /* @__PURE__ */ new Set();
65
- for (let o of i(n.length, e.strength)) r.add(a(o.map((e) => [n[e].name, t[n[e].name]])));
66
- return r;
67
- }
68
- function l(e, t) {
69
- let n = s(e), r = /* @__PURE__ */ new Set();
70
- for (let i of t) for (let t of c(e, i)) n.has(t) && r.add(t);
71
- let i = [...n].filter((e) => !r.has(e)).sort();
72
- return {
73
- strength: e.strength,
74
- demanded: n.size,
75
- covered: r.size,
76
- gaps: i
77
- };
78
- }
79
- //#endregion
80
- export { l as n, r as t };