@momentiq/dark-factory-cli 1.1.0 → 2.0.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/README.md +86 -2
- package/dist/adapters/critic-result-schema.d.ts +14 -14
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +7 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/static-schema-lint.d.ts +68 -0
- package/dist/adapters/static-schema-lint.d.ts.map +1 -0
- package/dist/adapters/static-schema-lint.js +813 -0
- package/dist/adapters/static-schema-lint.js.map +1 -0
- package/dist/cli.d.ts +17 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +296 -41
- package/dist/cli.js.map +1 -1
- package/dist/commands/findings.d.ts +6 -0
- package/dist/commands/findings.d.ts.map +1 -0
- package/dist/commands/findings.js +196 -0
- package/dist/commands/findings.js.map +1 -0
- package/dist/commands/skills.d.ts +6 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +248 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/doctor.d.ts +17 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +107 -0
- package/dist/doctor.js.map +1 -1
- package/dist/evidence/docker-build.d.ts +6 -0
- package/dist/evidence/docker-build.d.ts.map +1 -0
- package/dist/evidence/docker-build.js +199 -0
- package/dist/evidence/docker-build.js.map +1 -0
- package/dist/evidence/index.d.ts +1 -0
- package/dist/evidence/index.d.ts.map +1 -1
- package/dist/evidence/index.js +6 -0
- package/dist/evidence/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/doctor.d.ts.map +1 -1
- package/dist/mcp/tools/doctor.js +5 -0
- package/dist/mcp/tools/doctor.js.map +1 -1
- package/dist/mcp/tools/review-bypass.d.ts.map +1 -1
- package/dist/mcp/tools/review-bypass.js +21 -0
- package/dist/mcp/tools/review-bypass.js.map +1 -1
- package/dist/mcp/tools/skills-install.d.ts +6 -0
- package/dist/mcp/tools/skills-install.d.ts.map +1 -0
- package/dist/mcp/tools/skills-install.js +260 -0
- package/dist/mcp/tools/skills-install.js.map +1 -0
- package/dist/mcp/tools/stats-gate.d.ts.map +1 -1
- package/dist/mcp/tools/stats-gate.js +63 -15
- package/dist/mcp/tools/stats-gate.js.map +1 -1
- package/dist/policy/gate.d.ts +1 -1
- package/dist/policy/gate.d.ts.map +1 -1
- package/dist/policy/gate.js +96 -12
- package/dist/policy/gate.js.map +1 -1
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +105 -1
- package/dist/prompt.js.map +1 -1
- package/dist/report.d.ts +106 -3
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +282 -10
- package/dist/report.js.map +1 -1
- package/dist/runner.d.ts +2 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +86 -2
- package/dist/runner.js.map +1 -1
- package/dist/self-consistency.d.ts +144 -0
- package/dist/self-consistency.d.ts.map +1 -0
- package/dist/self-consistency.js +368 -0
- package/dist/self-consistency.js.map +1 -0
- package/dist/skills/config.d.ts +176 -0
- package/dist/skills/config.d.ts.map +1 -0
- package/dist/skills/config.js +251 -0
- package/dist/skills/config.js.map +1 -0
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +8 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/install.d.ts +62 -0
- package/dist/skills/install.d.ts.map +1 -0
- package/dist/skills/install.js +315 -0
- package/dist/skills/install.js.map +1 -0
- package/dist/skills/template.d.ts +42 -0
- package/dist/skills/template.d.ts.map +1 -0
- package/dist/skills/template.js +95 -0
- package/dist/skills/template.js.map +1 -0
- package/dist/trusted-surface/rebind.d.ts.map +1 -1
- package/dist/trusted-surface/rebind.js +14 -1
- package/dist/trusted-surface/rebind.js.map +1 -1
- package/package.json +32 -2
- package/skills/README.md +89 -0
- package/skills/chief-engineer-blitz/SKILL.md.tmpl +443 -0
- package/skills/chief-engineer-blitz/skill.json +53 -0
- package/skills/chief-engineer-review/SKILL.md.tmpl +184 -0
- package/skills/chief-engineer-review/references/review-examples.md.tmpl +130 -0
- package/skills/chief-engineer-review/skill.json +67 -0
- package/skills/chief-engineer-review/templates/code-review-prompt.md.tmpl +111 -0
- package/skills/chief-engineer-review/templates/escalation-prompt.md.tmpl +56 -0
- package/skills/chief-engineer-review/templates/plan-review-prompt.md.tmpl +74 -0
- package/skills/skill-schema.json +73 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// df_skills_install + df_skills_list MCP tools — DFP #192.
|
|
2
|
+
//
|
|
3
|
+
// Parallel surface to the `df skills install / list` CLI subcommand.
|
|
4
|
+
// Same `installSkill` / `listBundledSkills` core powers both — the tool
|
|
5
|
+
// here only wraps the IO + adapts the result shape into MCP's structured
|
|
6
|
+
// content envelope.
|
|
7
|
+
//
|
|
8
|
+
// Tool shapes:
|
|
9
|
+
//
|
|
10
|
+
// df_skills_install →
|
|
11
|
+
// input { skillName, all?, force?, targetDir? }
|
|
12
|
+
// output { installed: [{ skillName, manifestVersion, configPath,
|
|
13
|
+
// configIsDefault, files: [...] , resolvedVariables: [...] }] }
|
|
14
|
+
//
|
|
15
|
+
// df_skills_list →
|
|
16
|
+
// input {}
|
|
17
|
+
// output { skills: [{ name, version, summary, originatingRepo? }] }
|
|
18
|
+
//
|
|
19
|
+
// Both tools default to the agent client's cwd (where `df mcp` was
|
|
20
|
+
// launched), matching every other tool in this catalog. Tests inject a
|
|
21
|
+
// fixture cwd via the cwd option.
|
|
22
|
+
import { resolve } from "node:path";
|
|
23
|
+
import { z } from "zod";
|
|
24
|
+
import { enabledSkillNames, loadDarkFactoryConfig, } from "../../skills/config.js";
|
|
25
|
+
import { installSkill, KNOWN_SKILLS, listBundledSkills, } from "../../skills/install.js";
|
|
26
|
+
function renderInstallMarkdown(results) {
|
|
27
|
+
if (results.length === 0) {
|
|
28
|
+
return `**df_skills_install**: no skills installed.`;
|
|
29
|
+
}
|
|
30
|
+
const lines = [];
|
|
31
|
+
for (const r of results) {
|
|
32
|
+
lines.push(`**df_skills_install**: ${r.skillName} v${r.manifestVersion} — ${r.files.length} file(s)`);
|
|
33
|
+
lines.push(` config: ${r.configPath}${r.configIsDefault ? " (defaults — no darkfactory.yaml)" : ""}`);
|
|
34
|
+
for (const f of r.files) {
|
|
35
|
+
if (f.action === "skipped") {
|
|
36
|
+
lines.push(` ! ${f.relTarget} — SKIPPED (${f.reason ?? "skipped"})`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
lines.push(` - ${f.relTarget} — ${f.action}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
export function registerSkillsTools(server, opts = {}) {
|
|
46
|
+
server.registerTool("df_skills_install", {
|
|
47
|
+
title: "Install a bundled Dark Factory skill",
|
|
48
|
+
description: "Render + install one (or all) bundled skill(s) into the consumer " +
|
|
49
|
+
"repo's .claude/skills/<name>/ directory. The skill body templates " +
|
|
50
|
+
"are rendered against the consumer's darkfactory.yaml (with sensible " +
|
|
51
|
+
"defaults when keys are absent). The rendered files carry a GENERATED " +
|
|
52
|
+
"header — a re-install with the same inputs is a no-op; a re-install " +
|
|
53
|
+
"with different inputs overwrites; a re-install where the rendered " +
|
|
54
|
+
"file has been hand-edited is SKIPPED unless force=true. " +
|
|
55
|
+
`Bundled skills: ${KNOWN_SKILLS.join(", ")}.`,
|
|
56
|
+
inputSchema: {
|
|
57
|
+
skillName: z
|
|
58
|
+
.string()
|
|
59
|
+
.min(1)
|
|
60
|
+
.optional()
|
|
61
|
+
.describe(`Skill name to install. Required unless 'all' is true. One of: ${KNOWN_SKILLS.join(", ")}.`),
|
|
62
|
+
all: z
|
|
63
|
+
.boolean()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("If true, install every skill declared `enabled: true` in darkfactory.yaml#skills. " +
|
|
66
|
+
"Mutually exclusive with skillName."),
|
|
67
|
+
force: z
|
|
68
|
+
.boolean()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Overwrite hand-edited rendered files. Off by default — re-install " +
|
|
71
|
+
"of a hand-edited file returns action=skipped instead."),
|
|
72
|
+
targetDir: z
|
|
73
|
+
.string()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("Override the install location (default: <cwd>/.claude/skills/<name>/). " +
|
|
76
|
+
"Tests pass a fixture dir; production callers omit this."),
|
|
77
|
+
},
|
|
78
|
+
outputSchema: {
|
|
79
|
+
installed: z
|
|
80
|
+
.array(z.object({
|
|
81
|
+
skillName: z.string(),
|
|
82
|
+
manifestVersion: z.string(),
|
|
83
|
+
configPath: z.string(),
|
|
84
|
+
configIsDefault: z.boolean(),
|
|
85
|
+
resolvedVariables: z.array(z.object({ name: z.string(), value: z.string() })),
|
|
86
|
+
files: z.array(z.object({
|
|
87
|
+
relTarget: z.string(),
|
|
88
|
+
absoluteTarget: z.string(),
|
|
89
|
+
action: z.enum(["created", "updated", "unchanged", "skipped"]),
|
|
90
|
+
reason: z.string().optional(),
|
|
91
|
+
})),
|
|
92
|
+
}))
|
|
93
|
+
.describe("One result per installed skill. action='skipped' means the file " +
|
|
94
|
+
"exists without the GENERATED marker and force was not set."),
|
|
95
|
+
},
|
|
96
|
+
annotations: {
|
|
97
|
+
readOnlyHint: false,
|
|
98
|
+
destructiveHint: false,
|
|
99
|
+
idempotentHint: true,
|
|
100
|
+
openWorldHint: false,
|
|
101
|
+
},
|
|
102
|
+
}, async ({ skillName, all, force, targetDir }) => {
|
|
103
|
+
const cwd = resolve(opts.cwd ?? process.cwd());
|
|
104
|
+
if (all === true && skillName !== undefined) {
|
|
105
|
+
return {
|
|
106
|
+
isError: true,
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
109
|
+
type: "text",
|
|
110
|
+
text: `**df_skills_install**: cannot pass both skillName and all=true.`,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (all !== true && skillName === undefined) {
|
|
116
|
+
return {
|
|
117
|
+
isError: true,
|
|
118
|
+
content: [
|
|
119
|
+
{
|
|
120
|
+
type: "text",
|
|
121
|
+
text: `**df_skills_install**: skillName is required (or pass all=true).`,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
let targetSkills;
|
|
127
|
+
if (all === true) {
|
|
128
|
+
if (targetDir !== undefined) {
|
|
129
|
+
return {
|
|
130
|
+
isError: true,
|
|
131
|
+
content: [
|
|
132
|
+
{
|
|
133
|
+
type: "text",
|
|
134
|
+
text: `**df_skills_install**: all=true is incompatible with targetDir (bundled skills share target filenames like SKILL.md, so a single dir would overwrite). Install each skill separately, or omit targetDir to use the default <cwd>/.claude/skills/<name>/.`,
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const loaded = loadDarkFactoryConfig(cwd);
|
|
141
|
+
const enabled = enabledSkillNames(loaded.config);
|
|
142
|
+
if (enabled.length === 0) {
|
|
143
|
+
return {
|
|
144
|
+
isError: true,
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: `**df_skills_install**: all=true but no skills marked enabled: true in ${loaded.configPath}` +
|
|
149
|
+
`${loaded.isDefault ? " (no darkfactory.yaml present)" : ""}.`,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const unknown = enabled.filter((name) => !KNOWN_SKILLS.includes(name));
|
|
155
|
+
if (unknown.length > 0) {
|
|
156
|
+
return {
|
|
157
|
+
isError: true,
|
|
158
|
+
content: [
|
|
159
|
+
{
|
|
160
|
+
type: "text",
|
|
161
|
+
text: `**df_skills_install**: all=true rejected — unknown skill name(s) in ${loaded.configPath}: ${unknown.join(", ")}. Known skills: ${KNOWN_SKILLS.join(", ")}.`,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
targetSkills = enabled;
|
|
167
|
+
}
|
|
168
|
+
catch (err) {
|
|
169
|
+
return {
|
|
170
|
+
isError: true,
|
|
171
|
+
content: [
|
|
172
|
+
{
|
|
173
|
+
type: "text",
|
|
174
|
+
text: `**df_skills_install**: failed to load darkfactory.yaml — ${err.message}`,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
targetSkills = [skillName];
|
|
182
|
+
}
|
|
183
|
+
const results = [];
|
|
184
|
+
for (const name of targetSkills) {
|
|
185
|
+
try {
|
|
186
|
+
const installOpts = {
|
|
187
|
+
cwd,
|
|
188
|
+
skillName: name,
|
|
189
|
+
...(force === true ? { force: true } : {}),
|
|
190
|
+
...(targetDir !== undefined ? { targetDir } : {}),
|
|
191
|
+
};
|
|
192
|
+
results.push(installSkill(installOpts));
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
return {
|
|
196
|
+
isError: true,
|
|
197
|
+
content: [
|
|
198
|
+
{
|
|
199
|
+
type: "text",
|
|
200
|
+
text: `**df_skills_install**: ${err.message}`,
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Mirror the CLI's exit-code 3 contract: when ANY rendered file was
|
|
207
|
+
// skipped (hand-edited, body-mismatch, or pre-template detection),
|
|
208
|
+
// surface that as an MCP-level error so the agent caller does not
|
|
209
|
+
// silently accept a partial install. The structuredContent still
|
|
210
|
+
// carries the full per-file detail so the caller can decide whether
|
|
211
|
+
// to retry with force=true.
|
|
212
|
+
const hasSkipped = results.some((r) => r.files.some((f) => f.action === "skipped"));
|
|
213
|
+
const summary = renderInstallMarkdown(results);
|
|
214
|
+
const text = hasSkipped
|
|
215
|
+
? `${summary}\n\nOne or more files were skipped. Re-call with force=true to overwrite.`
|
|
216
|
+
: summary;
|
|
217
|
+
return {
|
|
218
|
+
...(hasSkipped ? { isError: true } : {}),
|
|
219
|
+
structuredContent: { installed: results },
|
|
220
|
+
content: [{ type: "text", text }],
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
server.registerTool("df_skills_list", {
|
|
224
|
+
title: "List bundled Dark Factory skills",
|
|
225
|
+
description: "List every skill bundled with @momentiq/dark-factory-cli: name, " +
|
|
226
|
+
"manifest version, summary, originating repo (when known). The " +
|
|
227
|
+
"complementary action is df_skills_install.",
|
|
228
|
+
inputSchema: {},
|
|
229
|
+
outputSchema: {
|
|
230
|
+
skills: z
|
|
231
|
+
.array(z.object({
|
|
232
|
+
name: z.string(),
|
|
233
|
+
version: z.string(),
|
|
234
|
+
summary: z.string(),
|
|
235
|
+
originatingRepo: z.string().optional(),
|
|
236
|
+
}))
|
|
237
|
+
.describe("Sorted alphabetically by name. Empty when no skills are bundled."),
|
|
238
|
+
},
|
|
239
|
+
annotations: {
|
|
240
|
+
readOnlyHint: true,
|
|
241
|
+
openWorldHint: false,
|
|
242
|
+
},
|
|
243
|
+
}, async () => {
|
|
244
|
+
const items = listBundledSkills();
|
|
245
|
+
const lines = [
|
|
246
|
+
`**df_skills_list**: ${items.length} bundled skill(s)`,
|
|
247
|
+
];
|
|
248
|
+
for (const item of items) {
|
|
249
|
+
lines.push(` - ${item.name} v${item.version}${item.originatingRepo ? ` (origin: ${item.originatingRepo})` : ""}`);
|
|
250
|
+
lines.push(` ${item.summary}`);
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
structuredContent: { skills: items },
|
|
254
|
+
content: [
|
|
255
|
+
{ type: "text", text: lines.join("\n") },
|
|
256
|
+
],
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=skills-install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills-install.js","sourceRoot":"","sources":["../../../src/mcp/tools/skills-install.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,qEAAqE;AACrE,wEAAwE;AACxE,yEAAyE;AACzE,oBAAoB;AACpB,EAAE;AACF,eAAe;AACf,EAAE;AACF,wBAAwB;AACxB,qDAAqD;AACrD,qEAAqE;AACrE,2FAA2F;AAC3F,EAAE;AACF,qBAAqB;AACrB,gBAAgB;AAChB,wEAAwE;AACxE,EAAE;AACF,mEAAmE;AACnE,uEAAuE;AACvE,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AAMjC,SAAS,qBAAqB,CAAC,OAAwB;IACrD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,6CAA6C,CAAC;IACvD,CAAC;IACD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CACR,0BAA0B,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,eAAe,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,CAC1F,CAAC;QACF,KAAK,CAAC,IAAI,CACR,aAAa,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3F,CAAC;QACF,KAAK,MAA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BACA,QAAQ,CACP,kEAAkE,CACnE;SACJ;QACD,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,KAAK;SACrB;KACF,EACD,KAAK,IAAI,EAAE;QACT,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;QAClC,MAAM,KAAK,GAAa;YACtB,uBAAuB,KAAK,CAAC,MAAM,mBAAmB;SACvD,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CACR,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACvG,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACpC,CAAC;QACD,OAAO;YACL,iBAAiB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;YACpC,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACzC;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats-gate.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/stats-gate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stats-gate.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/stats-gate.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAerE,MAAM,WAAW,6BAA6B;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAID,UAAU,eAAe;IACvB,QAAQ,CAAC,MAAM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,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAID,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,IAAI,GAAE,6BAAkC,GACvC,IAAI,CA2RN"}
|
|
@@ -14,12 +14,29 @@
|
|
|
14
14
|
// available via the resource surface (`df://repo/audit-log` for raw
|
|
15
15
|
// NDJSON; clients can recompute).
|
|
16
16
|
//
|
|
17
|
-
// df_gate_push wraps `runCommitGate` for each
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
17
|
+
// df_gate_push wraps `runCommitGate` for each pushed range. The spec
|
|
18
|
+
// explicitly notes: "the stdio MCP server already owns stdin; pass the
|
|
19
|
+
// protocol data as a tool argument." So the `stdin_protocol` input
|
|
20
|
+
// string is what git's pre-push hook would write to stdin — newline-
|
|
21
|
+
// separated `<localRef> <localSha> <remoteRef> <remoteSha>` lines.
|
|
22
|
+
//
|
|
23
|
+
// Default semantic (Cycle 13 / dark-factory-platform#149) — mirrors the
|
|
24
|
+
// CLI `df gate-push` flip: ONLY the HEAD (last) commit of each push
|
|
25
|
+
// update is evaluated. Intermediate commits' per-SHA artifacts at
|
|
26
|
+
// `.git/agent-reviews/<sha>.json` are iteration receipts (inspect them
|
|
27
|
+
// with `df findings --range <base>..<head>` or the matching MCP
|
|
28
|
+
// resource at `df://repo/findings/{sha}`), but they do not influence
|
|
29
|
+
// the verdict. Opt back into the legacy per-commit semantic with the
|
|
30
|
+
// `full_range: true` input — use it for forensic replay or per-commit
|
|
31
|
+
// deploy-log audit.
|
|
32
|
+
//
|
|
33
|
+
// Soundness caveat — the same one applies to the CLI default: each
|
|
34
|
+
// per-SHA artifact reviews `parent..commit`, NOT `base..tip`. HEAD's
|
|
35
|
+
// APPROVED verdict therefore proves only the LAST INCREMENTAL change
|
|
36
|
+
// is safe; cumulative review of `base..tip` is not produced by the
|
|
37
|
+
// per-commit hook path. Set `full_range: true` (or run the CI cold-
|
|
38
|
+
// path agent-critic on the full PR diff) when cumulative soundness
|
|
39
|
+
// matters more than termination of the find-fix loop.
|
|
23
40
|
//
|
|
24
41
|
// The `'bypass-required'` verdict signals: the gate would block, AND
|
|
25
42
|
// the policy permits an emergency bypass (`policy.allowEmergencyBypass:
|
|
@@ -167,13 +184,23 @@ export function registerStatsGateTools(server, opts = {}) {
|
|
|
167
184
|
});
|
|
168
185
|
server.registerTool("df_gate_push", {
|
|
169
186
|
title: "Evaluate the pre-push gate for a pushed range",
|
|
170
|
-
description: "Evaluate `df gate-push`'s gate
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
187
|
+
description: "Evaluate `df gate-push`'s gate over a git pre-push protocol " +
|
|
188
|
+
"range. Default (Cycle 13 / dark-factory-platform#149): " +
|
|
189
|
+
"evaluates ONLY the HEAD (final) commit of each push update; " +
|
|
190
|
+
"intermediate commits are iteration receipts (inspect with " +
|
|
191
|
+
"the matching `df findings --range` CLI subcommand or the " +
|
|
192
|
+
"`df://repo/findings/{sha}` resource) and do not influence the " +
|
|
193
|
+
"verdict. Set `full_range: true` to opt into the legacy per-" +
|
|
194
|
+
"commit semantic (gates every commit; any blocker vetoes). " +
|
|
195
|
+
"Soundness caveat: each per-SHA artifact reviews `parent.." +
|
|
196
|
+
"commit` only, NOT `base..tip` — HEAD's APPROVED verdict proves " +
|
|
197
|
+
"only the last incremental change. Use `full_range: true` (or " +
|
|
198
|
+
"the CI cold-path) when cumulative soundness matters. The " +
|
|
199
|
+
"`stdin_protocol` input is what git would write to the husky " +
|
|
200
|
+
"pre-push hook's stdin — newline-separated `<localRef> " +
|
|
201
|
+
"<localSha> <remoteRef> <remoteSha>` lines. Returns the " +
|
|
202
|
+
"aggregate verdict + per-commit blocking reasons. Read-only " +
|
|
203
|
+
"(does not push, does not write artifacts).",
|
|
177
204
|
inputSchema: {
|
|
178
205
|
stdin_protocol: z
|
|
179
206
|
.string()
|
|
@@ -186,6 +213,15 @@ export function registerStatsGateTools(server, opts = {}) {
|
|
|
186
213
|
.optional()
|
|
187
214
|
.describe("Profile name (overrides AGENT_REVIEW_PROFILE env). " +
|
|
188
215
|
"Defaults to `local`."),
|
|
216
|
+
full_range: z
|
|
217
|
+
.boolean()
|
|
218
|
+
.optional()
|
|
219
|
+
.describe("When true, restores the pre-Cycle-13 per-commit semantic: " +
|
|
220
|
+
"every commit in the push range is gated and any blocker " +
|
|
221
|
+
"vetoes the push. Default false (HEAD-only). Mirrors the " +
|
|
222
|
+
"`df gate-push --full-range` CLI flag and the " +
|
|
223
|
+
"DF_GATE_FULL_RANGE=1 env. Use for forensic replay or " +
|
|
224
|
+
"per-commit deploy-log audit."),
|
|
189
225
|
},
|
|
190
226
|
outputSchema: {
|
|
191
227
|
verdict: z
|
|
@@ -216,7 +252,7 @@ export function registerStatsGateTools(server, opts = {}) {
|
|
|
216
252
|
readOnlyHint: true,
|
|
217
253
|
openWorldHint: false,
|
|
218
254
|
},
|
|
219
|
-
}, async ({ stdin_protocol, profile }) => {
|
|
255
|
+
}, async ({ stdin_protocol, profile, full_range }) => {
|
|
220
256
|
const cwd = resolve(opts.cwd ?? process.cwd());
|
|
221
257
|
let loaded;
|
|
222
258
|
try {
|
|
@@ -238,11 +274,23 @@ export function registerStatsGateTools(server, opts = {}) {
|
|
|
238
274
|
const reasons = [];
|
|
239
275
|
let blocked = false;
|
|
240
276
|
let commitsEvaluated = 0;
|
|
277
|
+
const useFullRange = full_range === true;
|
|
241
278
|
for (const update of updates) {
|
|
242
279
|
if (update.isDelete)
|
|
243
280
|
continue;
|
|
244
281
|
const commits = await commitsForPushUpdate(update, cwd);
|
|
245
|
-
|
|
282
|
+
if (commits.length === 0)
|
|
283
|
+
continue;
|
|
284
|
+
// Default (Cycle 13): gate ONLY HEAD — the last element of the
|
|
285
|
+
// rev-list-reverse walk. Intermediate commits' artifacts are
|
|
286
|
+
// iteration receipts (inspect via `df findings --range` or the
|
|
287
|
+
// `df://repo/findings/{sha}` resource). Legacy / opt-in
|
|
288
|
+
// (`full_range: true`): gate every commit in the range and let
|
|
289
|
+
// any blocker veto.
|
|
290
|
+
const toEvaluate = useFullRange
|
|
291
|
+
? commits
|
|
292
|
+
: [commits[commits.length - 1] ?? ""];
|
|
293
|
+
for (const sha of toEvaluate) {
|
|
246
294
|
commitsEvaluated += 1;
|
|
247
295
|
const gateRes = await runCommitGate({
|
|
248
296
|
loaded,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats-gate.js","sourceRoot":"","sources":["../../../src/mcp/tools/stats-gate.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,eAAe;AACf,gDAAgD;AAChD,EAAE;AACF,mBAAmB;AACnB,qEAAqE;AACrE,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,sEAAsE;AACtE,oEAAoE;AACpE,kCAAkC;AAClC,EAAE;AACF,mEAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"stats-gate.js","sourceRoot":"","sources":["../../../src/mcp/tools/stats-gate.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,eAAe;AACf,gDAAgD;AAChD,EAAE;AACF,mBAAmB;AACnB,qEAAqE;AACrE,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,sEAAsE;AACtE,oEAAoE;AACpE,kCAA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D,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;SAC3C,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/policy/gate.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface EvaluatePushGateOptions {
|
|
|
29
29
|
profileCriticIds?: ReadonlyArray<string>;
|
|
30
30
|
}
|
|
31
31
|
export declare function evaluatePushGate(options: EvaluatePushGateOptions): Promise<GateResult>;
|
|
32
|
-
export declare function evaluateQuorumCriticResults(artifact: ReviewArtifact, blockingSeverities: ReviewSeverity[], quorum: number, blocks: GateBlock[], warnings: GateWarning[]): void;
|
|
32
|
+
export declare function evaluateQuorumCriticResults(artifact: ReviewArtifact, blockingSeverities: ReviewSeverity[], quorum: number, blocks: GateBlock[], warnings: GateWarning[], unilateralVetoRules?: import("@momentiq/dark-factory-schemas").UnilateralVetoRules): void;
|
|
33
33
|
export declare function summarizeGate(result: GateResult): string;
|
|
34
34
|
export interface RouteEvaluation {
|
|
35
35
|
triggered: VerificationRoute[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/policy/gate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAEL,qBAAqB,EACrB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/policy/gate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAEL,qBAAqB,EACrB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAU3D,OAAO,EAC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AAE,YAAY,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,OAAO,EAAE,kBAAkB,GAC1B,YAAY,CAgCd;AA0ID,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,YAAY,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAU7B;AAKD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/policy/gate.js
CHANGED
|
@@ -5,7 +5,7 @@ import { matchAnyGlob } from "../glob.js";
|
|
|
5
5
|
import { changedFiles, commitDiff, commitMetadata, commitParent, diffHash, resolveCommit, } from "../git.js";
|
|
6
6
|
import { parseCommitTrailers } from "../evidence/index.js";
|
|
7
7
|
import { resolveArtifactDir, resolveArtifactRoot, telemetryPath } from "../paths.js";
|
|
8
|
-
import { isCriticCompleted, criticVetoesGate, quorumAggregateVerdict, readArtifact, } from "../report.js";
|
|
8
|
+
import { findingCarriesCorroborationFlag, isCorroboratedByOtherCritic, isCriticCompleted, criticVetoesGate, quorumAggregateVerdict, readArtifact, } from "../report.js";
|
|
9
9
|
import { classifyTdd as classifyTddImpl, } from "./tdd-classifier.js";
|
|
10
10
|
import { parseQualityGateEvidence, } from "@momentiq/dark-factory-schemas";
|
|
11
11
|
const BYPASS_ENV = "AGENT_REVIEW_BYPASS";
|
|
@@ -167,7 +167,7 @@ export async function evaluateCommitGate(options) {
|
|
|
167
167
|
// fallback to 2 preserves cycle 322.3 default for hand-built
|
|
168
168
|
// test configs.
|
|
169
169
|
const effectiveQuorum = options.quorumOverride ?? loaded.config.aggregation.quorum ?? 2;
|
|
170
|
-
evaluateQuorumCriticResults(scopedArtifact, loaded.config.aggregation.blockingSeverities, effectiveQuorum, blocks, warnings);
|
|
170
|
+
evaluateQuorumCriticResults(scopedArtifact, loaded.config.aggregation.blockingSeverities, effectiveQuorum, blocks, warnings, loaded.config.aggregation.unilateralVetoRules);
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
173
173
|
// Cycle 322.2 Component 4 — `required` flag threading.
|
|
@@ -290,7 +290,7 @@ export async function evaluatePushGate(options) {
|
|
|
290
290
|
}
|
|
291
291
|
if (loaded.config.aggregation.policy === "min-complete-quorum") {
|
|
292
292
|
const effectiveQuorum = options.quorumOverride ?? loaded.config.aggregation.quorum ?? 2;
|
|
293
|
-
evaluateQuorumCriticResults(scopedArtifact, loaded.config.aggregation.blockingSeverities, effectiveQuorum, blocks, warnings);
|
|
293
|
+
evaluateQuorumCriticResults(scopedArtifact, loaded.config.aggregation.blockingSeverities, effectiveQuorum, blocks, warnings, loaded.config.aggregation.unilateralVetoRules);
|
|
294
294
|
}
|
|
295
295
|
else {
|
|
296
296
|
const requiredCriticIds = new Set(loaded.config.critics.filter((c) => c.required).map((c) => c.id));
|
|
@@ -392,7 +392,11 @@ function recomputeArtifactVerdict(scopedResults, loaded, quorumOverride) {
|
|
|
392
392
|
// Cast: `quorumAggregateVerdict` reads CriticResult fields by
|
|
393
393
|
// name; scoped results are a subset of the original artifact's
|
|
394
394
|
// results array, so the shape is identical.
|
|
395
|
-
scopedResults, loaded.config.aggregation.blockingSeverities, quorum
|
|
395
|
+
scopedResults, loaded.config.aggregation.blockingSeverities, quorum,
|
|
396
|
+
// Issue dark-factory-platform#112 — thread the corroboration
|
|
397
|
+
// rules so a profile-filtered recompute honors the same policy
|
|
398
|
+
// the live verdict computation does.
|
|
399
|
+
loaded.config.aggregation.unilateralVetoRules).verdict;
|
|
396
400
|
}
|
|
397
401
|
// block-if-any: only required critics drive the aggregate.
|
|
398
402
|
const requiredCriticIds = new Set(loaded.config.critics.filter((c) => c.required).map((c) => c.id));
|
|
@@ -625,7 +629,38 @@ requiredCriticIds) {
|
|
|
625
629
|
// runbook for choosing `quorum`; until then, the policy stays at
|
|
626
630
|
// `block-if-any` and `blockOnReviewError` continues to drive the
|
|
627
631
|
// fail-closed behavior in the legacy evaluator below.
|
|
628
|
-
|
|
632
|
+
/**
|
|
633
|
+
* Issue dark-factory-platform#112 — collect blocking-severity findings
|
|
634
|
+
* the critic produced that should be demoted from blocks to warnings
|
|
635
|
+
* under the corroboration policy. A finding is demoted when ALL of:
|
|
636
|
+
* 1. It carries a flag listed in `rules.requireCorroborationFor`
|
|
637
|
+
* (mapped via `FLAG_TO_FINDING_KEY` in `report.ts`).
|
|
638
|
+
* 2. No OTHER completed critic raises a blocking finding on the
|
|
639
|
+
* same file within `rules.requireCorroborationOnHunkRadius` lines.
|
|
640
|
+
*
|
|
641
|
+
* Findings without a flag, or with corroboration, are NOT demoted —
|
|
642
|
+
* the safety net stays intact for findings the critic can defend.
|
|
643
|
+
* The demoted set is populated in `sink` (mutation-free at the caller
|
|
644
|
+
* boundary: the caller pre-allocates the Set).
|
|
645
|
+
*/
|
|
646
|
+
function collectDemotedFindings(critic, allResults, blockingSeverities, rules, sink) {
|
|
647
|
+
for (const f of critic.findings) {
|
|
648
|
+
if (!blockingSeverities.includes(f.severity))
|
|
649
|
+
continue;
|
|
650
|
+
if (!findingCarriesCorroborationFlag(f, rules.requireCorroborationFor))
|
|
651
|
+
continue;
|
|
652
|
+
const corroborated = isCorroboratedByOtherCritic(f, critic.criticId, allResults, blockingSeverities, rules.requireCorroborationOnHunkRadius);
|
|
653
|
+
if (!corroborated)
|
|
654
|
+
sink.add(f);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
export function evaluateQuorumCriticResults(artifact, blockingSeverities, quorum, blocks, warnings,
|
|
658
|
+
// Issue dark-factory-platform#112 — optional unilateral-veto rules.
|
|
659
|
+
// When supplied, blocking findings that carry one of the
|
|
660
|
+
// configured corroboration-required flags AND are not corroborated
|
|
661
|
+
// by another critic within the configured radius are demoted to
|
|
662
|
+
// `critic_disagreement` warnings instead of contributing to blocks.
|
|
663
|
+
unilateralVetoRules) {
|
|
629
664
|
// Surface every critic's terminal state as a warning so the
|
|
630
665
|
// artifact reader sees all per-critic diagnostics even when no
|
|
631
666
|
// veto fires.
|
|
@@ -645,7 +680,27 @@ export function evaluateQuorumCriticResults(artifact, blockingSeverities, quorum
|
|
|
645
680
|
}
|
|
646
681
|
// Completed critic. Vetoes contribute blocks; non-veto findings
|
|
647
682
|
// contribute warnings.
|
|
648
|
-
|
|
683
|
+
//
|
|
684
|
+
// Issue dark-factory-platform#112 — pre-compute the per-finding
|
|
685
|
+
// demotion set under `unilateralVetoRules`. A blocking-severity
|
|
686
|
+
// finding that's flagged for corroboration AND has none from
|
|
687
|
+
// another critic within the configured radius gets demoted: it
|
|
688
|
+
// contributes to `warnings` (as `critic_disagreement`) instead of
|
|
689
|
+
// `blocks`. Findings with no flag, or with corroboration, stay on
|
|
690
|
+
// the block path.
|
|
691
|
+
const demoted = new Set();
|
|
692
|
+
if (unilateralVetoRules !== undefined) {
|
|
693
|
+
collectDemotedFindings(result, artifact.criticResults, blockingSeverities, unilateralVetoRules, demoted);
|
|
694
|
+
}
|
|
695
|
+
const ctx = unilateralVetoRules !== undefined
|
|
696
|
+
? {
|
|
697
|
+
allResults: artifact.criticResults,
|
|
698
|
+
rules: unilateralVetoRules,
|
|
699
|
+
}
|
|
700
|
+
: undefined;
|
|
701
|
+
const vetoes = ctx
|
|
702
|
+
? criticVetoesGate(result, blockingSeverities, ctx)
|
|
703
|
+
: criticVetoesGate(result, blockingSeverities);
|
|
649
704
|
if (vetoes) {
|
|
650
705
|
if (result.requiresHumanJudgment) {
|
|
651
706
|
blocks.push({
|
|
@@ -664,11 +719,40 @@ export function evaluateQuorumCriticResults(artifact, blockingSeverities, quorum
|
|
|
664
719
|
const blocking = result.findings.filter((f) => blockingSeverities.includes(f.severity));
|
|
665
720
|
for (const f of blocking) {
|
|
666
721
|
const detail = `${f.category}@${f.file ?? "?"}: ${f.evidence}`;
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
722
|
+
if (demoted.has(f)) {
|
|
723
|
+
warnings.push({
|
|
724
|
+
reason: "critic_disagreement",
|
|
725
|
+
criticId: result.criticId,
|
|
726
|
+
detail,
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
blocks.push({
|
|
731
|
+
reason: `${f.severity}_finding`,
|
|
732
|
+
criticId: result.criticId,
|
|
733
|
+
detail,
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
// Critic didn't veto — but blocking findings still need to be
|
|
740
|
+
// surfaced somewhere. Under corroboration-policy demotion, they
|
|
741
|
+
// become `critic_disagreement` warnings; otherwise this branch
|
|
742
|
+
// does nothing (the existing semantics — non-vetoing critic's
|
|
743
|
+
// blocking findings only ever surface via the `vetoes === true`
|
|
744
|
+
// branch under standard quorum policy).
|
|
745
|
+
if (demoted.size > 0) {
|
|
746
|
+
for (const f of result.findings) {
|
|
747
|
+
if (!demoted.has(f))
|
|
748
|
+
continue;
|
|
749
|
+
const detail = `${f.category}@${f.file ?? "?"}: ${f.evidence}`;
|
|
750
|
+
warnings.push({
|
|
751
|
+
reason: "critic_disagreement",
|
|
752
|
+
criticId: result.criticId,
|
|
753
|
+
detail,
|
|
754
|
+
});
|
|
755
|
+
}
|
|
672
756
|
}
|
|
673
757
|
}
|
|
674
758
|
// Non-blocking findings are always warnings regardless of vetoes.
|
|
@@ -688,7 +772,7 @@ export function evaluateQuorumCriticResults(artifact, blockingSeverities, quorum
|
|
|
688
772
|
// (the §11 invariant). When the verdict already shows a veto
|
|
689
773
|
// contributed to blocks, do NOT also add `quorum_unmet` — the
|
|
690
774
|
// veto is the actionable signal.
|
|
691
|
-
const outcome = quorumAggregateVerdict(artifact.criticResults, blockingSeverities, quorum);
|
|
775
|
+
const outcome = quorumAggregateVerdict(artifact.criticResults, blockingSeverities, quorum, unilateralVetoRules);
|
|
692
776
|
if (outcome.reason === "quorum_unmet" && blocks.length === 0) {
|
|
693
777
|
const completed = artifact.criticResults.filter(isCriticCompleted).length;
|
|
694
778
|
const total = artifact.criticResults.length;
|