@sackville-mcp/verdict 0.0.1-alpha.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Curtis Autery
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,144 @@
1
+ import { SEVERITY_RANK, Severity, atLeast, maxSeverity } from "@sackville-mcp/severity";
2
+ import { ContractResult } from "@sackville-mcp/api";
3
+ import { DiffCoverageReport } from "@sackville-mcp/coverage";
4
+ import { DependencyAudit } from "@sackville-mcp/deps";
5
+ import { FlakeVerdict } from "@sackville-mcp/flake";
6
+ import { MutationSummary } from "@sackville-mcp/mutate";
7
+
8
+ //#region src/types.d.ts
9
+ /** The pillars a composite verdict can fold. */
10
+ type PillarName = 'contract' | 'coverage' | 'deps' | 'flake' | 'mutate';
11
+ /**
12
+ * A pillar's contribution to the verdict.
13
+ * - `pass` — ran, clean.
14
+ * - `warn` — a real signal of a problem the policy may or may not treat as failing.
15
+ * - `fail` — a problem this pillar treats as failing on its own.
16
+ * - `no-signal` — ran but had no usable signal (mutation null+no survivors, flake
17
+ * insufficient-data, deps with no OSV snapshot, contract with zero entries).
18
+ * - `missing` — no input was supplied for this pillar.
19
+ *
20
+ * `no-signal` and `missing` NEVER count as a pass (ADR 0013 §1).
21
+ *
22
+ * NOTE (ADR 0013 Addendum, milestone 5c): the run-driving orchestrator does NOT
23
+ * add new statuses. A pillar it tried to run but whose own gate was unmet, or that
24
+ * crashed, is reported as `no-signal` + a `skipReason`/`errorReason` (below); a
25
+ * pillar the agent did not request stays `missing`. Both already fold to
26
+ * `inconclusive`, so "absence is never a pass" extends to gate-blocked/errored/
27
+ * not-requested for free — without touching this exhaustively-switched union.
28
+ */
29
+ type PillarStatus = 'pass' | 'warn' | 'fail' | 'no-signal' | 'missing';
30
+ interface PillarVerdict {
31
+ pillar: PillarName;
32
+ status: PillarStatus;
33
+ /** The worst severity this pillar observed (drives the composite worstSeverity). */
34
+ severity: Severity;
35
+ /** A short, redaction-safe one-line summary. */
36
+ headline: string;
37
+ /** Optional small tallies (e.g. `{ findings: 3 }`) — never large/inlined detail. */
38
+ counts?: Record<string, number>;
39
+ /**
40
+ * Provenance for the contract pillar: whether the result came from a live run or
41
+ * from a captured HAR (different trust/redaction story — ADR 0013 §1).
42
+ */
43
+ source?: 'run' | 'capture-from-HAR';
44
+ /**
45
+ * Run-driving provenance (ADR 0013 Addendum, milestone 5c): why a requested pillar
46
+ * produced no usable signal. `gate-not-set` = the pillar's own operator gate was
47
+ * unmet (never run — "compose, never widen"); `not-requested` = the agent did not
48
+ * ask for it. A present `skipReason` can NEVER be laundered into a pass.
49
+ */
50
+ skipReason?: 'gate-not-set' | 'not-requested';
51
+ /**
52
+ * Run-driving provenance (ADR 0013 Addendum, milestone 5c): a requested pillar
53
+ * crashed/timed out. **Already routed through the operator `Redactor`** by the
54
+ * orchestrator before it reaches here — must not carry raw paths/secrets. A present
55
+ * `errorReason` can NEVER be laundered into a pass.
56
+ */
57
+ errorReason?: string;
58
+ }
59
+ /** The overall posture. `inconclusive` is the honest "couldn't claim pass" state. */
60
+ type OverallStatus = 'pass' | 'warn' | 'fail' | 'inconclusive';
61
+ interface CompositeVerdict {
62
+ /** `true` ONLY when the overall status is `pass`. warn/fail/inconclusive ⇒ false. */
63
+ ok: boolean;
64
+ status: OverallStatus;
65
+ /** The worst severity across all present pillars. */
66
+ worstSeverity: Severity;
67
+ /** The pillar driving the worst outcome, when there is one. */
68
+ worstPillar?: PillarName;
69
+ /** Every pillar's verdict (including `missing` ones), in a stable order. */
70
+ pillars: PillarVerdict[];
71
+ /** Pillars with no input supplied. */
72
+ missing: PillarName[];
73
+ }
74
+ /**
75
+ * The policy cut. There is intentionally NO baked-in default (ADR 0013 §3a/slice
76
+ * 10): the operator/agent must declare `failAtOrAbove` to escalate a severity to a
77
+ * failing overall posture — the rollup must not silently encode a value judgment.
78
+ */
79
+ interface VerdictPolicy {
80
+ /** A pillar whose severity is at least this becomes a failing overall posture. */
81
+ failAtOrAbove?: Severity;
82
+ }
83
+ //#endregion
84
+ //#region src/adapters.d.ts
85
+ /** Contract drift over validated responses (live run or capture-from-HAR). */
86
+ declare function fromContractResults(results: ContractResult[], source?: 'run' | 'capture-from-HAR'): PillarVerdict;
87
+ /**
88
+ * The capture-verdict facts a contract sub-verdict needs to fold WITHOUT laundering an
89
+ * unverifiable entry into a pass (5f, ADR 0013 Addendum 4). A superset of
90
+ * `@sackville-mcp/api`'s `CaptureContractVerdict` — its no-signal/unresolved entries push NO
91
+ * `ContractResult`, so `fromContractResults` (results-only) can't see them. `clean` is
92
+ * the load-bearing flag (`entriesValidated>0 ∧ unresolvedBodies===0 ∧ noSignal===0 ∧ all
93
+ * valid`).
94
+ */
95
+ interface CaptureVerdictFacts {
96
+ results: ContractResult[];
97
+ clean: boolean;
98
+ noSignal: number;
99
+ unresolvedBodies: number;
100
+ entriesValidated: number;
101
+ }
102
+ /**
103
+ * Fold the FULL capture verdict (clean-aware): an error finding is a real breach (`fail`);
104
+ * else a NOT-clean capture (no-signal / unresolved / zero validated) is `no-signal`
105
+ * (inconclusive) — NEVER a pass riding on a sibling valid entry (ADR 0013 §1, the latent
106
+ * hole this closes in the shipped 5e produce + consume paths); else a warning is `warn`;
107
+ * else `pass`. Used by the verify orchestrator for the consume + both produce capture paths.
108
+ */
109
+ declare function fromCaptureVerdict(v: CaptureVerdictFacts, source?: 'run' | 'capture-from-HAR'): PillarVerdict;
110
+ /** Coverage of a diff — the forgotten-assertion catch. */
111
+ declare function fromDiffCoverage(report: DiffCoverageReport): PillarVerdict;
112
+ /** Dependency vulnerability/deprecation audit over the installed versions. */
113
+ declare function fromDependencyAudits(audits: DependencyAudit[], opts: {
114
+ osvSnapshotLoaded: boolean;
115
+ }): PillarVerdict;
116
+ /** Flaky/broken test detection over recorded run histories. */
117
+ declare function fromFlakeVerdicts(verdicts: FlakeVerdict[]): PillarVerdict;
118
+ /** Mutation testing — are the tests meaningful? Keyed off survivors, not only score. */
119
+ declare function fromMutationSummary(summary: MutationSummary): PillarVerdict;
120
+ //#endregion
121
+ //#region src/compose.d.ts
122
+ /** Per-pillar adapter outputs. Any omitted pillar is folded as `missing`. */
123
+ interface ComposeInputs {
124
+ contract?: PillarVerdict;
125
+ coverage?: PillarVerdict;
126
+ deps?: PillarVerdict;
127
+ flake?: PillarVerdict;
128
+ mutate?: PillarVerdict;
129
+ }
130
+ /**
131
+ * Fold the per-pillar verdicts into one composite verdict (ADR 0013 §1). Pure and
132
+ * deterministic. The load-bearing invariant: **absence is never a pass** — an
133
+ * empty fold, or any present `missing`/`no-signal` pillar with no failing/warning
134
+ * signal elsewhere, yields `inconclusive` (`ok:false`), never `pass`.
135
+ *
136
+ * The overall posture has NO baked-in threshold: a pillar only escalates the whole
137
+ * verdict to `fail` either because the pillar itself decided `fail`, or because the
138
+ * caller's `policy.failAtOrAbove` says its severity is failing. With no policy, a
139
+ * severity-only finding stays `warn`.
140
+ */
141
+ declare function composeVerdict(inputs: ComposeInputs, policy?: VerdictPolicy): CompositeVerdict;
142
+ //#endregion
143
+ export { type CaptureVerdictFacts, type ComposeInputs, type CompositeVerdict, type OverallStatus, type PillarName, type PillarStatus, type PillarVerdict, SEVERITY_RANK, type Severity, type VerdictPolicy, atLeast, composeVerdict, fromCaptureVerdict, fromContractResults, fromDependencyAudits, fromDiffCoverage, fromFlakeVerdicts, fromMutationSummary, maxSeverity };
144
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/adapters.ts","../src/compose.ts"],"mappings":";;;;;;;;;KAGY,UAAA;;;;;;AAAZ;;;;AAAsB;AAoBtB;;;;AAAwB;AAExB;;;KAFY,YAAA;AAAA,UAEK,aAAA;EACf,MAAA,EAAQ,UAAA;EACR,MAAA,EAAQ,YAAA;EAMO;EAJf,QAAA,EAAU,QAAA;EAHV;EAKA,Q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_RANK, atLeast, maxSeverity } from "@sackville-mcp/severity";
2
+ //#region src/adapters.ts
3
+ /** Contract drift over validated responses (live run or capture-from-HAR). */
4
+ function fromContractResults(results, source = "capture-from-HAR") {
5
+ if (results.length === 0) return {
6
+ pillar: "contract",
7
+ status: "no-signal",
8
+ severity: "none",
9
+ headline: "no contract entries validated",
10
+ source
11
+ };
12
+ let errors = 0;
13
+ let warnings = 0;
14
+ for (const r of results) for (const f of r.findings) if (f.severity === "error") errors++;
15
+ else warnings++;
16
+ if (errors > 0) return {
17
+ pillar: "contract",
18
+ status: "fail",
19
+ severity: "high",
20
+ headline: `${errors} contract error(s) across ${results.length} response(s)`,
21
+ counts: {
22
+ errors,
23
+ warnings,
24
+ entries: results.length
25
+ },
26
+ source
27
+ };
28
+ if (warnings > 0) return {
29
+ pillar: "contract",
30
+ status: "warn",
31
+ severity: "low",
32
+ headline: `${warnings} contract warning(s)`,
33
+ counts: {
34
+ errors,
35
+ warnings,
36
+ entries: results.length
37
+ },
38
+ source
39
+ };
40
+ return {
41
+ pillar: "contract",
42
+ status: "pass",
43
+ severity: "none",
44
+ headline: `${results.length} response(s) match the contract`,
45
+ counts: {
46
+ errors,
47
+ warnings,
48
+ entries: results.length
49
+ },
50
+ source
51
+ };
52
+ }
53
+ /**
54
+ * Fold the FULL capture verdict (clean-aware): an error finding is a real breach (`fail`);
55
+ * else a NOT-clean capture (no-signal / unresolved / zero validated) is `no-signal`
56
+ * (inconclusive) — NEVER a pass riding on a sibling valid entry (ADR 0013 §1, the latent
57
+ * hole this closes in the shipped 5e produce + consume paths); else a warning is `warn`;
58
+ * else `pass`. Used by the verify orchestrator for the consume + both produce capture paths.
59
+ */
60
+ function fromCaptureVerdict(v, source = "capture-from-HAR") {
61
+ let errors = 0;
62
+ let warnings = 0;
63
+ for (const r of v.results) for (const f of r.findings) if (f.severity === "error") errors++;
64
+ else warnings++;
65
+ if (errors > 0) return {
66
+ pillar: "contract",
67
+ status: "fail",
68
+ severity: "high",
69
+ headline: `${errors} contract error(s) across ${v.entriesValidated} response(s)`,
70
+ counts: {
71
+ errors,
72
+ warnings,
73
+ entries: v.entriesValidated
74
+ },
75
+ source
76
+ };
77
+ if (!v.clean) return {
78
+ pillar: "contract",
79
+ status: "no-signal",
80
+ severity: "none",
81
+ headline: v.entriesValidated === 0 ? "no contract entries validated" : v.unresolvedBodies > 0 ? `${v.unresolvedBodies} captured body(ies) could not be resolved` : `${v.noSignal} captured entr(ies) had no matching contract`,
82
+ source
83
+ };
84
+ if (warnings > 0) return {
85
+ pillar: "contract",
86
+ status: "warn",
87
+ severity: "low",
88
+ headline: `${warnings} contract warning(s)`,
89
+ counts: {
90
+ errors,
91
+ warnings,
92
+ entries: v.entriesValidated
93
+ },
94
+ source
95
+ };
96
+ return {
97
+ pillar: "contract",
98
+ status: "pass",
99
+ severity: "none",
100
+ headline: `${v.entriesValidated} response(s) match the contract`,
101
+ counts: {
102
+ errors,
103
+ warnings,
104
+ entries: v.entriesValidated
105
+ },
106
+ source
107
+ };
108
+ }
109
+ /** Coverage of a diff — the forgotten-assertion catch. */
110
+ function fromDiffCoverage(report) {
111
+ const { summary, uncovered } = report;
112
+ if (summary.total === 0) return {
113
+ pillar: "coverage",
114
+ status: "no-signal",
115
+ severity: "none",
116
+ headline: "no new executable lines classified",
117
+ counts: { filesWithoutCoverage: summary.filesWithoutCoverage }
118
+ };
119
+ if (uncovered.length > 0) return {
120
+ pillar: "coverage",
121
+ status: "fail",
122
+ severity: "moderate",
123
+ headline: `${uncovered.length} uncovered new line(s)`,
124
+ counts: {
125
+ uncovered: uncovered.length,
126
+ covered: summary.covered,
127
+ filesWithoutCoverage: summary.filesWithoutCoverage
128
+ }
129
+ };
130
+ return {
131
+ pillar: "coverage",
132
+ status: "pass",
133
+ severity: "none",
134
+ headline: `all ${summary.covered} new executable line(s) covered`,
135
+ counts: { covered: summary.covered }
136
+ };
137
+ }
138
+ /** deps' `SeverityBucket` → the shared scale. `'unknown'` is NOT a severity here. */
139
+ function bucketToSeverity(bucket) {
140
+ switch (bucket) {
141
+ case "critical":
142
+ case "high":
143
+ case "moderate":
144
+ case "low":
145
+ case "none": return bucket;
146
+ default: return "unknown";
147
+ }
148
+ }
149
+ /** Dependency vulnerability/deprecation audit over the installed versions. */
150
+ function fromDependencyAudits(audits, opts) {
151
+ if (!opts.osvSnapshotLoaded) return {
152
+ pillar: "deps",
153
+ status: "no-signal",
154
+ severity: "none",
155
+ headline: "no OSV snapshot loaded — vulnerability status unknown",
156
+ counts: { packages: audits.length }
157
+ };
158
+ let worst = "none";
159
+ let hasUnknown = false;
160
+ let vulnerable = 0;
161
+ let deprecated = 0;
162
+ for (const a of audits) {
163
+ const sev = bucketToSeverity(a.worstSeverity);
164
+ if (sev === "unknown") hasUnknown = true;
165
+ else {
166
+ worst = maxSeverity(worst, sev);
167
+ if (sev !== "none") vulnerable++;
168
+ }
169
+ if (a.deprecated.isDeprecated) deprecated++;
170
+ }
171
+ const counts = {
172
+ packages: audits.length,
173
+ vulnerable,
174
+ deprecated
175
+ };
176
+ if (worst !== "none") return {
177
+ pillar: "deps",
178
+ status: "warn",
179
+ severity: worst,
180
+ headline: `${vulnerable} vulnerable package(s), worst ${worst}`,
181
+ counts
182
+ };
183
+ if (deprecated > 0) return {
184
+ pillar: "deps",
185
+ status: "warn",
186
+ severity: "low",
187
+ headline: `${deprecated} deprecated package(s)`,
188
+ counts
189
+ };
190
+ if (hasUnknown) return {
191
+ pillar: "deps",
192
+ status: "no-signal",
193
+ severity: "none",
194
+ headline: "a matched advisory has an undetermined severity",
195
+ counts
196
+ };
197
+ return {
198
+ pillar: "deps",
199
+ status: "pass",
200
+ severity: "none",
201
+ headline: `${audits.length} package(s) clean`,
202
+ counts
203
+ };
204
+ }
205
+ /** Severity of a flaky test scaled by its conservative flake magnitude. */
206
+ function flakeSeverity(flakeScore) {
207
+ if (flakeScore >= .5) return "high";
208
+ if (flakeScore >= .2) return "moderate";
209
+ return "low";
210
+ }
211
+ /** Flaky/broken test detection over recorded run histories. */
212
+ function fromFlakeVerdicts(verdicts) {
213
+ if (verdicts.length === 0) return {
214
+ pillar: "flake",
215
+ status: "no-signal",
216
+ severity: "none",
217
+ headline: "no test histories supplied"
218
+ };
219
+ let broken = 0;
220
+ let flaky = 0;
221
+ let reliable = 0;
222
+ let insufficient = 0;
223
+ let worstFlakeScore = 0;
224
+ for (const v of verdicts) switch (v.state) {
225
+ case "broken":
226
+ broken++;
227
+ break;
228
+ case "flaky":
229
+ flaky++;
230
+ worstFlakeScore = Math.max(worstFlakeScore, v.flakeScore);
231
+ break;
232
+ case "reliable":
233
+ reliable++;
234
+ break;
235
+ default: insufficient++;
236
+ }
237
+ const counts = {
238
+ broken,
239
+ flaky,
240
+ reliable,
241
+ insufficientData: insufficient,
242
+ total: verdicts.length
243
+ };
244
+ if (broken > 0) return {
245
+ pillar: "flake",
246
+ status: "fail",
247
+ severity: "high",
248
+ headline: `${broken} broken test(s)`,
249
+ counts
250
+ };
251
+ if (flaky > 0) return {
252
+ pillar: "flake",
253
+ status: "warn",
254
+ severity: flakeSeverity(worstFlakeScore),
255
+ headline: `${flaky} flaky test(s)`,
256
+ counts
257
+ };
258
+ if (insufficient > 0) return {
259
+ pillar: "flake",
260
+ status: "no-signal",
261
+ severity: "none",
262
+ headline: `${insufficient} test(s) with insufficient run history`,
263
+ counts
264
+ };
265
+ return {
266
+ pillar: "flake",
267
+ status: "pass",
268
+ severity: "none",
269
+ headline: `${reliable} reliable test(s)`,
270
+ counts
271
+ };
272
+ }
273
+ /** Mutation testing — are the tests meaningful? Keyed off survivors, not only score. */
274
+ function fromMutationSummary(summary) {
275
+ const survivors = summary.survivors.length;
276
+ if (summary.metrics.mutationScore === null && survivors === 0) return {
277
+ pillar: "mutate",
278
+ status: "no-signal",
279
+ severity: "none",
280
+ headline: "no valid mutants evaluated"
281
+ };
282
+ if (survivors > 0) return {
283
+ pillar: "mutate",
284
+ status: "warn",
285
+ severity: "moderate",
286
+ headline: `${survivors} surviving mutant(s)`,
287
+ counts: {
288
+ survivors,
289
+ valid: summary.metrics.valid
290
+ }
291
+ };
292
+ return {
293
+ pillar: "mutate",
294
+ status: "pass",
295
+ severity: "none",
296
+ headline: "all valid mutants detected",
297
+ counts: {
298
+ survivors: 0,
299
+ valid: summary.metrics.valid
300
+ }
301
+ };
302
+ }
303
+ //#endregion
304
+ //#region src/compose.ts
305
+ /** Stable pillar order for the breakdown + tie-breaking the worst pillar. */
306
+ const ORDER = [
307
+ "contract",
308
+ "coverage",
309
+ "deps",
310
+ "flake",
311
+ "mutate"
312
+ ];
313
+ function missingPillar(pillar) {
314
+ return {
315
+ pillar,
316
+ status: "missing",
317
+ severity: "none",
318
+ headline: "no input supplied"
319
+ };
320
+ }
321
+ /**
322
+ * Fold the per-pillar verdicts into one composite verdict (ADR 0013 §1). Pure and
323
+ * deterministic. The load-bearing invariant: **absence is never a pass** — an
324
+ * empty fold, or any present `missing`/`no-signal` pillar with no failing/warning
325
+ * signal elsewhere, yields `inconclusive` (`ok:false`), never `pass`.
326
+ *
327
+ * The overall posture has NO baked-in threshold: a pillar only escalates the whole
328
+ * verdict to `fail` either because the pillar itself decided `fail`, or because the
329
+ * caller's `policy.failAtOrAbove` says its severity is failing. With no policy, a
330
+ * severity-only finding stays `warn`.
331
+ */
332
+ function composeVerdict(inputs, policy = {}) {
333
+ const pillars = ORDER.map((name) => inputs[name] ?? missingPillar(name));
334
+ const missing = pillars.filter((p) => p.status === "missing").map((p) => p.pillar);
335
+ const worstSeverity = maxSeverity(...pillars.map((p) => p.severity));
336
+ let worstPillar;
337
+ if (worstSeverity !== "none") {
338
+ for (const p of pillars) if (SEVERITY_RANK[p.severity] === SEVERITY_RANK[worstSeverity]) {
339
+ worstPillar = p.pillar;
340
+ break;
341
+ }
342
+ }
343
+ const failsByPolicy = (p) => policy.failAtOrAbove !== void 0 && (p.status === "warn" || p.status === "fail") && atLeast(p.severity, policy.failAtOrAbove);
344
+ const anyFail = pillars.some((p) => p.status === "fail" || failsByPolicy(p));
345
+ const anyWarn = pillars.some((p) => p.status === "warn");
346
+ const anyInconclusive = pillars.some((p) => p.status === "missing" || p.status === "no-signal" || p.skipReason !== void 0 || p.errorReason !== void 0);
347
+ let status;
348
+ if (anyFail) status = "fail";
349
+ else if (anyWarn) status = "warn";
350
+ else if (anyInconclusive) status = "inconclusive";
351
+ else status = "pass";
352
+ return {
353
+ ok: status === "pass",
354
+ status,
355
+ worstSeverity,
356
+ ...worstPillar ? { worstPillar } : {},
357
+ pillars,
358
+ missing
359
+ };
360
+ }
361
+ //#endregion
362
+ export { SEVERITY_RANK, atLeast, composeVerdict, fromCaptureVerdict, fromContractResults, fromDependencyAudits, fromDiffCoverage, fromFlakeVerdicts, fromMutationSummary, maxSeverity };
363
+
364
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/adapters.ts","../src/compose.ts"],"sourcesContent":["/**\n * The five per-pillar adapters (ADR 0013 §1, slices 8–9). Each maps a pillar's\n * native result onto the shared `PillarVerdict` shape. **Type-only imports** of the\n * pillar result interfaces — `@sackville-mcp/verdict` must never import a pillar runtime\n * (that would drag `better-sqlite3`/`playwright-core` in and break the\n * independent-gate posture). The inline severity choices are documented per\n * mapping; the load-bearing rule is that no `no-signal`/absence path ever returns\n * `pass`.\n */\nimport type { ContractResult } from '@sackville-mcp/api'\nimport type { DiffCoverageReport } from '@sackville-mcp/coverage'\nimport type { DependencyAudit } from '@sackville-mcp/deps'\nimport type { FlakeVerdict } from '@sackville-mcp/flake'\nimport type { MutationSummary } from '@sackville-mcp/mutate'\nimport { maxSeverity, type Severity } from './severity.js'\nimport type { PillarVerdict } from './types.js'\n\n/** Contract drift over validated responses (live run or capture-from-HAR). */\nexport function fromContractResults(\n results: ContractResult[],\n source: 'run' | 'capture-from-HAR' = 'capture-from-HAR',\n): PillarVerdict {\n if (results.length === 0) {\n // Zero entries validated = no signal, NOT a pass (ADR 0013 §1).\n return {\n pillar: 'contract',\n status: 'no-signal',\n severity: 'none',\n headline: 'no contract entries validated',\n source,\n }\n }\n let errors = 0\n let warnings = 0\n for (const r of results) {\n for (const f of r.findings) {\n if (f.severity === 'error') errors++\n else warnings++\n }\n }\n if (errors > 0) {\n // A response-schema violation / undocumented operation is a real breach → high.\n return {\n pillar: 'contract',\n status: 'fail',\n severity: 'high',\n headline: `${errors} contract error(s) across ${results.length} response(s)`,\n counts: { errors, warnings, entries: results.length },\n source,\n }\n }\n if (warnings > 0) {\n return {\n pillar: 'contract',\n status: 'warn',\n severity: 'low',\n headline: `${warnings} contract warning(s)`,\n counts: { errors, warnings, entries: results.length },\n source,\n }\n }\n return {\n pillar: 'contract',\n status: 'pass',\n severity: 'none',\n headline: `${results.length} response(s) match the contract`,\n counts: { errors, warnings, entries: results.length },\n source,\n }\n}\n\n/**\n * The capture-verdict facts a contract sub-verdict needs to fold WITHOUT laundering an\n * unverifiable entry into a pass (5f, ADR 0013 Addendum 4). A superset of\n * `@sackville-mcp/api`'s `CaptureContractVerdict` — its no-signal/unresolved entries push NO\n * `ContractResult`, so `fromContractResults` (results-only) can't see them. `clean` is\n * the load-bearing flag (`entriesValidated>0 ∧ unresolvedBodies===0 ∧ noSignal===0 ∧ all\n * valid`).\n */\nexport interface CaptureVerdictFacts {\n results: ContractResult[]\n clean: boolean\n noSignal: number\n unresolvedBodies: number\n entriesValidated: number\n}\n\n/**\n * Fold the FULL capture verdict (clean-aware): an error finding is a real breach (`fail`);\n * else a NOT-clean capture (no-signal / unresolved / zero validated) is `no-signal`\n * (inconclusive) — NEVER a pass riding on a sibling valid entry (ADR 0013 §1, the latent\n * hole this closes in the shipped 5e produce + consume paths); else a warning is `warn`;\n * else `pass`. Used by the verify orchestrator for the consume + both produce capture paths.\n */\nexport function fromCaptureVerdict(\n v: CaptureVerdictFacts,\n source: 'run' | 'capture-from-HAR' = 'capture-from-HAR',\n): PillarVerdict {\n let errors = 0\n let warnings = 0\n for (const r of v.results) {\n for (const f of r.findings) {\n if (f.severity === 'error') errors++\n else warnings++\n }\n }\n if (errors > 0) {\n return {\n pillar: 'contract',\n status: 'fail',\n severity: 'high',\n headline: `${errors} contract error(s) across ${v.entriesValidated} response(s)`,\n counts: { errors, warnings, entries: v.entriesValidated },\n source,\n }\n }\n if (!v.clean) {\n const headline =\n v.entriesValidated === 0\n ? 'no contract entries validated'\n : v.unresolvedBodies > 0\n ? `${v.unresolvedBodies} captured body(ies) could not be resolved`\n : `${v.noSignal} captured entr(ies) had no matching contract`\n return { pillar: 'contract', status: 'no-signal', severity: 'none', headline, source }\n }\n if (warnings > 0) {\n return {\n pillar: 'contract',\n status: 'warn',\n severity: 'low',\n headline: `${warnings} contract warning(s)`,\n counts: { errors, warnings, entries: v.entriesValidated },\n source,\n }\n }\n return {\n pillar: 'contract',\n status: 'pass',\n severity: 'none',\n headline: `${v.entriesValidated} response(s) match the contract`,\n counts: { errors, warnings, entries: v.entriesValidated },\n source,\n }\n}\n\n/** Coverage of a diff — the forgotten-assertion catch. */\nexport function fromDiffCoverage(report: DiffCoverageReport): PillarVerdict {\n const { summary, uncovered } = report\n if (summary.total === 0) {\n // No new executable lines were classified — nothing to assert on.\n return {\n pillar: 'coverage',\n status: 'no-signal',\n severity: 'none',\n headline: 'no new executable lines classified',\n counts: { filesWithoutCoverage: summary.filesWithoutCoverage },\n }\n }\n if (uncovered.length > 0) {\n // A new executable line with no covering test under a TDD gate is a real gap,\n // but not a security-grade severity → moderate.\n return {\n pillar: 'coverage',\n status: 'fail',\n severity: 'moderate',\n headline: `${uncovered.length} uncovered new line(s)`,\n counts: {\n uncovered: uncovered.length,\n covered: summary.covered,\n filesWithoutCoverage: summary.filesWithoutCoverage,\n },\n }\n }\n return {\n pillar: 'coverage',\n status: 'pass',\n severity: 'none',\n headline: `all ${summary.covered} new executable line(s) covered`,\n counts: { covered: summary.covered },\n }\n}\n\n/** deps' `SeverityBucket` → the shared scale. `'unknown'` is NOT a severity here. */\nfunction bucketToSeverity(bucket: DependencyAudit['worstSeverity']): Severity | 'unknown' {\n switch (bucket) {\n case 'critical':\n case 'high':\n case 'moderate':\n case 'low':\n case 'none':\n return bucket\n default:\n // 'unknown' — never silently map to low/none (ADR 0013 slice 8 invariant).\n return 'unknown'\n }\n}\n\n/** Dependency vulnerability/deprecation audit over the installed versions. */\nexport function fromDependencyAudits(\n audits: DependencyAudit[],\n opts: { osvSnapshotLoaded: boolean },\n): PillarVerdict {\n if (!opts.osvSnapshotLoaded) {\n // \"No known vulnerabilities\" without a snapshot is not authoritative — no-signal,\n // never a pass (deps' own `osvSnapshotLoaded:false` honesty; ADR 0013 §1).\n return {\n pillar: 'deps',\n status: 'no-signal',\n severity: 'none',\n headline: 'no OSV snapshot loaded — vulnerability status unknown',\n counts: { packages: audits.length },\n }\n }\n let worst: Severity = 'none'\n let hasUnknown = false\n let vulnerable = 0\n let deprecated = 0\n for (const a of audits) {\n const sev = bucketToSeverity(a.worstSeverity)\n if (sev === 'unknown') hasUnknown = true\n else {\n worst = maxSeverity(worst, sev)\n if (sev !== 'none') vulnerable++\n }\n if (a.deprecated.isDeprecated) deprecated++\n }\n const counts = { packages: audits.length, vulnerable, deprecated }\n if (worst !== 'none') {\n // A real, severity-rated vulnerability — `warn` here; the caller's policy decides\n // whether that severity escalates the whole verdict to `fail`.\n return {\n pillar: 'deps',\n status: 'warn',\n severity: worst,\n headline: `${vulnerable} vulnerable package(s), worst ${worst}`,\n counts,\n }\n }\n if (deprecated > 0) {\n return {\n pillar: 'deps',\n status: 'warn',\n severity: 'low',\n headline: `${deprecated} deprecated package(s)`,\n counts,\n }\n }\n if (hasUnknown) {\n // Some advisory severity could not be determined — not clean, not a pass.\n return {\n pillar: 'deps',\n status: 'no-signal',\n severity: 'none',\n headline: 'a matched advisory has an undetermined severity',\n counts,\n }\n }\n return {\n pillar: 'deps',\n status: 'pass',\n severity: 'none',\n headline: `${audits.length} package(s) clean`,\n counts,\n }\n}\n\n/** Severity of a flaky test scaled by its conservative flake magnitude. */\nfunction flakeSeverity(flakeScore: number): Severity {\n if (flakeScore >= 0.5) return 'high'\n if (flakeScore >= 0.2) return 'moderate'\n return 'low'\n}\n\n/** Flaky/broken test detection over recorded run histories. */\nexport function fromFlakeVerdicts(verdicts: FlakeVerdict[]): PillarVerdict {\n if (verdicts.length === 0) {\n return {\n pillar: 'flake',\n status: 'no-signal',\n severity: 'none',\n headline: 'no test histories supplied',\n }\n }\n let broken = 0\n let flaky = 0\n let reliable = 0\n let insufficient = 0\n let worstFlakeScore = 0\n for (const v of verdicts) {\n switch (v.state) {\n case 'broken':\n broken++\n break\n case 'flaky':\n flaky++\n worstFlakeScore = Math.max(worstFlakeScore, v.flakeScore)\n break\n case 'reliable':\n reliable++\n break\n default:\n insufficient++\n }\n }\n const counts = { broken, flaky, reliable, insufficientData: insufficient, total: verdicts.length }\n if (broken > 0) {\n // A consistently-failing test is a real failure → high.\n return {\n pillar: 'flake',\n status: 'fail',\n severity: 'high',\n headline: `${broken} broken test(s)`,\n counts,\n }\n }\n if (flaky > 0) {\n return {\n pillar: 'flake',\n status: 'warn',\n severity: flakeSeverity(worstFlakeScore),\n headline: `${flaky} flaky test(s)`,\n counts,\n }\n }\n if (insufficient > 0) {\n // Not enough runs to call the rest reliable — no-signal, never a pass.\n return {\n pillar: 'flake',\n status: 'no-signal',\n severity: 'none',\n headline: `${insufficient} test(s) with insufficient run history`,\n counts,\n }\n }\n return {\n pillar: 'flake',\n status: 'pass',\n severity: 'none',\n headline: `${reliable} reliable test(s)`,\n counts,\n }\n}\n\n/** Mutation testing — are the tests meaningful? Keyed off survivors, not only score. */\nexport function fromMutationSummary(summary: MutationSummary): PillarVerdict {\n const survivors = summary.survivors.length\n // No valid mutants AND nothing survived = nothing ran meaningfully → no-signal.\n // (Keying only off `mutationScore===null` would launder a real gap — ADR slice 9.)\n if (summary.metrics.mutationScore === null && survivors === 0) {\n return {\n pillar: 'mutate',\n status: 'no-signal',\n severity: 'none',\n headline: 'no valid mutants evaluated',\n }\n }\n if (survivors > 0) {\n // Surviving / never-covered mutants are the actionable test gap → moderate.\n return {\n pillar: 'mutate',\n status: 'warn',\n severity: 'moderate',\n headline: `${survivors} surviving mutant(s)`,\n counts: { survivors, valid: summary.metrics.valid },\n }\n }\n return {\n pillar: 'mutate',\n status: 'pass',\n severity: 'none',\n headline: 'all valid mutants detected',\n counts: { survivors: 0, valid: summary.metrics.valid },\n }\n}\n","import { atLeast, maxSeverity, SEVERITY_RANK, type Severity } from './severity.js'\nimport type {\n CompositeVerdict,\n OverallStatus,\n PillarName,\n PillarVerdict,\n VerdictPolicy,\n} from './types.js'\n\n/** Per-pillar adapter outputs. Any omitted pillar is folded as `missing`. */\nexport interface ComposeInputs {\n contract?: PillarVerdict\n coverage?: PillarVerdict\n deps?: PillarVerdict\n flake?: PillarVerdict\n mutate?: PillarVerdict\n}\n\n/** Stable pillar order for the breakdown + tie-breaking the worst pillar. */\nconst ORDER: PillarName[] = ['contract', 'coverage', 'deps', 'flake', 'mutate']\n\nfunction missingPillar(pillar: PillarName): PillarVerdict {\n return { pillar, status: 'missing', severity: 'none', headline: 'no input supplied' }\n}\n\n/**\n * Fold the per-pillar verdicts into one composite verdict (ADR 0013 §1). Pure and\n * deterministic. The load-bearing invariant: **absence is never a pass** — an\n * empty fold, or any present `missing`/`no-signal` pillar with no failing/warning\n * signal elsewhere, yields `inconclusive` (`ok:false`), never `pass`.\n *\n * The overall posture has NO baked-in threshold: a pillar only escalates the whole\n * verdict to `fail` either because the pillar itself decided `fail`, or because the\n * caller's `policy.failAtOrAbove` says its severity is failing. With no policy, a\n * severity-only finding stays `warn`.\n */\nexport function composeVerdict(\n inputs: ComposeInputs,\n policy: VerdictPolicy = {},\n): CompositeVerdict {\n const pillars = ORDER.map((name) => inputs[name] ?? missingPillar(name))\n const missing = pillars.filter((p) => p.status === 'missing').map((p) => p.pillar)\n\n const worstSeverity = maxSeverity(...pillars.map((p) => p.severity))\n // The worst pillar: highest severity, ties broken by ORDER; only when non-`none`.\n let worstPillar: PillarName | undefined\n if (worstSeverity !== 'none') {\n for (const p of pillars) {\n if (SEVERITY_RANK[p.severity] === SEVERITY_RANK[worstSeverity]) {\n worstPillar = p.pillar\n break\n }\n }\n }\n\n const failsByPolicy = (p: PillarVerdict): boolean =>\n policy.failAtOrAbove !== undefined &&\n (p.status === 'warn' || p.status === 'fail') &&\n atLeast(p.severity, policy.failAtOrAbove)\n\n const anyFail = pillars.some((p) => p.status === 'fail' || failsByPolicy(p))\n const anyWarn = pillars.some((p) => p.status === 'warn')\n // `missing`/`no-signal` are absence; so is any present run-driving provenance\n // (`skipReason`/`errorReason`). The provenance check is defensive — it ensures a\n // gate-blocked/errored pillar can never be laundered into a pass even if a future\n // adapter mislabels its status (ADR 0013 Addendum, milestone 5c).\n const anyInconclusive = pillars.some(\n (p) =>\n p.status === 'missing' ||\n p.status === 'no-signal' ||\n p.skipReason !== undefined ||\n p.errorReason !== undefined,\n )\n\n let status: OverallStatus\n if (anyFail) status = 'fail'\n else if (anyWarn) status = 'warn'\n else if (anyInconclusive) status = 'inconclusive'\n else status = 'pass'\n\n return {\n ok: status === 'pass',\n status,\n worstSeverity,\n ...(worstPillar ? { worstPillar } : {}),\n pillars,\n missing,\n }\n}\n\nexport type { Severity }\n"],"mappings":";;;AAkBA,SAAgB,oBACd,SACA,SAAqC,oBACtB;CACf,IAAI,QAAQ,WAAW,GAErB,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,UAAU;EACV;CACF;CAEF,IAAI,SAAS;CACb,IAAI,WAAW;CACf,KAAK,MAAM,KAAK,SACd,KAAK,MAAM,KAAK,EAAE,UAChB,IAAI,EAAE,aAAa,SAAS;MACvB;CAGT,IAAI,SAAS,GAEX,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,UAAU,GAAG,OAAO,4BAA4B,QAAQ,OAAO;EAC/D,QAAQ;GAAE;GAAQ;GAAU,SAAS,QAAQ;EAAO;EACpD;CACF;CAEF,IAAI,WAAW,GACb,OA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AAe,KAAA,KACjB,EAAE,gBAAgB,KAAA,CACtB;CAEA,IAAI;CACJ,IAAI,SAAS,SAAS;MACjB,IAAI,SAAS,SAAS;MACtB,IAAI,iBAAiB,SAAS;MAC9B,SAAS;CAEd,OAAO;EACL,IAAI,WAAW;EACf;EACA;EACA,GAAI,cAAc,EAAE,YAAY,IAAI,CAAC;EACrC;EACA;CACF;AACF"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@sackville-mcp/verdict",
3
+ "version": "0.0.1-alpha.0",
4
+ "type": "module",
5
+ "license": "Apache-2.0",
6
+ "exports": {
7
+ ".": {
8
+ "import": {
9
+ "types": "./dist/index.d.mts",
10
+ "default": "./dist/index.mjs"
11
+ }
12
+ }
13
+ },
14
+ "main": "./dist/index.mjs",
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@sackville-mcp/severity": "0.0.1-alpha.0"
20
+ },
21
+ "devDependencies": {
22
+ "@sackville-mcp/api": "0.0.1-alpha.0",
23
+ "@sackville-mcp/coverage": "0.0.1-alpha.0",
24
+ "@sackville-mcp/deps": "0.0.1-alpha.0",
25
+ "@sackville-mcp/flake": "0.0.1-alpha.0",
26
+ "@sackville-mcp/mutate": "0.0.1-alpha.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/ceautery/sackville.git",
34
+ "directory": "packages/verdict"
35
+ },
36
+ "scripts": {
37
+ "build": "tsdown",
38
+ "typecheck": "tsc --noEmit"
39
+ }
40
+ }