rungate 0.4.0 → 0.5.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/config/behavioral-sc-map.json +170 -0
- package/config/brief-policies.json +28 -0
- package/config/ceremony-profiles.json +207 -0
- package/config/check-registry.json +114 -0
- package/config/matcher-registry.json +142 -0
- package/config/prove-evidence.schema.json +65 -0
- package/config/spec-policies.json +36 -0
- package/config/universal-rules.yaml +15 -0
- package/config/workflow-schema.json +279 -0
- package/lib/ac-quality.ts +119 -0
- package/lib/cli-commands.ts +7 -1
- package/lib/config-loader.ts +129 -5
- package/lib/conformity.ts +1122 -31
- package/lib/context-docs.ts +182 -0
- package/lib/create-brief.ts +22 -17
- package/lib/create-sc.ts +35 -8
- package/lib/doc-scan-targets.ts +435 -0
- package/lib/gate-check-audit.ts +9 -9
- package/lib/github.ts +195 -0
- package/lib/js-top-level-code.ts +27 -2
- package/lib/organize.ts +129 -40
- package/lib/package-closure.ts +387 -0
- package/lib/project-aliases.ts +100 -0
- package/lib/release-preflight.ts +352 -48
- package/lib/rungate-schema.ts +23 -1
- package/lib/sc-cover.ts +92 -1
- package/lib/sc-ids.ts +151 -0
- package/lib/scaffold/defaults.ts +40 -0
- package/lib/scaffold/managed-workflow.ts +125 -27
- package/lib/scaffold/owned-files.ts +6 -0
- package/lib/scaffold/profiles.ts +94 -0
- package/lib/scaffold/rehearsal.ts +355 -0
- package/lib/scaffold/steps.ts +787 -105
- package/lib/scaffold/write-steps.ts +208 -0
- package/lib/scratch-cleanup.ts +198 -0
- package/lib/scratch-roots.ts +94 -0
- package/lib/source-anchor.ts +144 -0
- package/lib/success-doc.ts +779 -0
- package/lib/suite-run-reading.ts +194 -0
- package/lib/test-census.ts +199 -0
- package/lib/trajectory.ts +377 -0
- package/lib/validators/spec-validators.ts +52 -35
- package/lib/workflow-security.ts +152 -7
- package/lib/workflow-test-harness.ts +349 -0
- package/lib/worktree-cleanup.ts +123 -7
- package/lib/worktree-repo.ts +165 -0
- package/package.json +10 -1
- package/scripts/audit-specs.ts +134 -37
- package/scripts/audit-transcript.ts +259 -0
- package/scripts/create-sc.ts +15 -1
- package/scripts/create-success.ts +162 -0
- package/scripts/detect-sc-drift.ts +200 -0
- package/scripts/extract-constraints.ts +16 -36
- package/scripts/scaffold-project.ts +51 -137
- package/scripts/split-spec.ts +315 -0
- package/scripts/sync-sc-status.ts +751 -0
- package/specs/SPEC-TEMPLATE.md +200 -0
- package/templates/SUCCESS-TEMPLATE.md +72 -0
- package/templates/agent-briefs/_shared.md +9 -0
- package/templates/agent-briefs/aditi.md +46 -0
- package/templates/agent-briefs/discovery.md +37 -0
- package/templates/agent-briefs/marcus.md +39 -0
- package/templates/agent-briefs/quinn.md +67 -0
- package/templates/agent-briefs/rook.md +40 -0
- package/templates/agent-briefs/serena.md +39 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Prove Evidence",
|
|
4
|
+
"description": "Output artifact from /prove skill",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["contractVersion", "issueNumber", "verdict", "commitSHA", "capturedAt", "criteriaResults"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"contractVersion": { "type": "string" },
|
|
9
|
+
"issueNumber": { "type": "integer" },
|
|
10
|
+
"verdict": { "type": "string", "enum": ["PROVEN", "UNPROVEN", "INCONCLUSIVE"] },
|
|
11
|
+
"commitSHA": { "type": "string" },
|
|
12
|
+
"capturedAt": { "type": "string", "format": "date-time" },
|
|
13
|
+
"beforeEvidence": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"type": { "type": "string", "enum": ["text", "screenshot", "api", "none"] },
|
|
17
|
+
"path": { "type": ["string", "null"] },
|
|
18
|
+
"capturedAt": { "type": ["string", "null"] },
|
|
19
|
+
"description": { "type": "string" }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"afterEvidence": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"properties": {
|
|
25
|
+
"type": { "type": "string", "enum": ["text", "screenshot", "api"] },
|
|
26
|
+
"path": { "type": "string" },
|
|
27
|
+
"capturedAt": { "type": "string", "format": "date-time" },
|
|
28
|
+
"environment": { "type": "string", "enum": ["local", "prod"] },
|
|
29
|
+
"description": { "type": "string" }
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"comparisonSummary": { "type": "string" },
|
|
33
|
+
"quinnVerdict": { "type": "string", "enum": ["PASS", "FAIL", "SKIP"] },
|
|
34
|
+
"reproduced": { "type": "boolean" },
|
|
35
|
+
"criteriaResults": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"minItems": 1,
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": ["scId", "verdict", "evidence"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"scId": { "type": "string" },
|
|
43
|
+
"verdict": { "type": "string", "enum": ["PASS", "FAIL", "SKIP"] },
|
|
44
|
+
"evidence": { "type": "string" },
|
|
45
|
+
"evidencePath": { "type": ["string", "null"] },
|
|
46
|
+
"exitCode": { "type": ["integer", "null"] }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"gaps": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": ["ac", "status"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"ac": { "type": "string" },
|
|
57
|
+
"status": { "type": "string" },
|
|
58
|
+
"detail": { "type": "string" },
|
|
59
|
+
"priority": { "type": ["string", "null"] },
|
|
60
|
+
"followUpIssue": { "type": ["string", "null"] }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Data-driven spec-alignment checks — Decision #3",
|
|
3
|
+
"forbiddenTargets": {
|
|
4
|
+
"patterns": ["SKILL\\.md"],
|
|
5
|
+
"scope": ["statement", "evidenceMethod.command"],
|
|
6
|
+
"message": "enforcement goes in scripts/hooks/gates, not SKILL.md (decision #4)"
|
|
7
|
+
},
|
|
8
|
+
"forbiddenLanguage": {
|
|
9
|
+
"patterns": ["DA should", "remember to", "must manually", "don.t forget", "should remember", "needs to remember"],
|
|
10
|
+
"scope": ["statement"],
|
|
11
|
+
"message": "use mechanical enforcement instead (decision #8)"
|
|
12
|
+
},
|
|
13
|
+
"implementationPatterns": {
|
|
14
|
+
"data-driven-enforcement": {
|
|
15
|
+
"decision": "#3",
|
|
16
|
+
"description": "Enforcement via JSON data, not inline code",
|
|
17
|
+
"antiPatterns": ["hardcoded.*(rule|check|gate)", "inline.*(validation|enforcement)"],
|
|
18
|
+
"scope": ["statement"],
|
|
19
|
+
"message": "enforcement should be data-driven — add patterns to JSON, not inline code (decision #3)"
|
|
20
|
+
},
|
|
21
|
+
"deep-modules-thin-consumers": {
|
|
22
|
+
"decision": "#7",
|
|
23
|
+
"description": "Shared logic in scripts/lib/, consumers call one function",
|
|
24
|
+
"antiPatterns": ["duplicate.*(logic|function|helper)", "copy.*(shared|lib|util)"],
|
|
25
|
+
"scope": ["statement"],
|
|
26
|
+
"message": "shared logic goes in scripts/lib/ — consumers import and call (decision #7)"
|
|
27
|
+
},
|
|
28
|
+
"warn-before-fail": {
|
|
29
|
+
"decision": "#9",
|
|
30
|
+
"description": "New checks start as WARN, promote to FAIL after precision data",
|
|
31
|
+
"antiPatterns": ["new.*(check|gate).*expect.*fail", "add.*expect.*throw.*new"],
|
|
32
|
+
"scope": ["statement", "evidenceMethod.command"],
|
|
33
|
+
"message": "new checks ship as WARN — promote to FAIL only with >80% precision over 10+ cycles (decision #9)"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Universal rules — loaded by scaffold into every generated AGENTS.md
|
|
2
|
+
# Consumer projects can override or extend via a `rules` array in .claude/rungate.json
|
|
3
|
+
#
|
|
4
|
+
# These were previously hardcoded in lib/generators/agents-md.ts.
|
|
5
|
+
# Now loaded from config so they can be customized per-deployment.
|
|
6
|
+
|
|
7
|
+
rules:
|
|
8
|
+
- "Verify before asserting — try it first, report what actually happened"
|
|
9
|
+
- "Never fake results or hide failures — if it fails, report it honestly"
|
|
10
|
+
- "Fix all test failures before reporting done — a green suite is the minimum bar"
|
|
11
|
+
- "Run full test suite and show real output — no summaries, no skipped files"
|
|
12
|
+
- "Read docs before writing code — routing table shows where"
|
|
13
|
+
- "Fix the source, not the output — fix generator, not generated files"
|
|
14
|
+
- "Commit all changes before reporting done — uncommitted work is lost work"
|
|
15
|
+
- "Read PROJECT-STATE.md first on session start — it's the session bridge"
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "workflow-state",
|
|
4
|
+
"description": "Ship harness v2 — single state file per issue. All gates read/write this file. See gateContract for expected field values per gate check.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "issue", "repo", "slug", "phase"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": 2 },
|
|
9
|
+
"issue": { "type": "integer", "description": "GitHub issue number" },
|
|
10
|
+
"repo": { "type": "string", "description": "owner/repo" },
|
|
11
|
+
"issueRepo": { "type": "string", "description": "owner/repo for GitHub issues (if different from code repo)" },
|
|
12
|
+
"projectRoot": { "type": "string", "description": "Absolute path to the project root directory" },
|
|
13
|
+
"slug": { "type": "string", "description": "YYYYMMDD-HHMMSS_kebab-description" },
|
|
14
|
+
"phase": {
|
|
15
|
+
"enum": ["GOAL", "DISCOVERY", "SCOPE", "BUILD", "VERIFY", "SHIP", "DONE", "CIRCUIT_BREAK"],
|
|
16
|
+
"description": "Current phase in the single loop"
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
"issueGoal": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Verbatim Goal section from GitHub issue — never paraphrased by DA"
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
"sourceSpecs": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"required": ["path", "citedInDiscovery"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"path": { "type": "string", "description": "File path or URL to the spec" },
|
|
31
|
+
"citedInDiscovery": { "type": "boolean", "description": "Was this spec actually read with file:line citations?" },
|
|
32
|
+
"specElements": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": { "type": "string" },
|
|
35
|
+
"description": "Key structural elements from the spec (e.g. '6 horizontal layers', '11 consumers')"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
"sizing": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"predicted": { "enum": ["XS", "S", "M", "L"] },
|
|
45
|
+
"ceremonyTier": { "enum": ["LIGHT", "STANDARD", "THOROUGH"] },
|
|
46
|
+
"actualFiles": { "type": "integer" },
|
|
47
|
+
"actualMinutes": { "type": "integer" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
"acs": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["id", "type", "statement"],
|
|
56
|
+
"properties": {
|
|
57
|
+
"id": { "type": "string", "pattern": "^AC-[0-9]+$" },
|
|
58
|
+
"type": { "enum": ["CODE", "OUTCOME"] },
|
|
59
|
+
"statement": { "type": "string" },
|
|
60
|
+
"specElement": { "type": "string", "description": "Which spec element this AC traces to" },
|
|
61
|
+
"threshold": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"op": { "enum": ["==", ">=", "<=", ">", "<", "!=", "contains", "exists"] },
|
|
65
|
+
"value": {},
|
|
66
|
+
"unit": { "type": "string" }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"evidenceMethod": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"properties": {
|
|
72
|
+
"type": { "enum": ["GREP_CHECK", "FILE_EXISTS", "CURL_CHECK", "BUN_TEST", "SCREENSHOT", "PLAYWRIGHT", "COMMAND", "MANUAL"] },
|
|
73
|
+
"command": { "type": "string" }
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"evidence": {
|
|
77
|
+
"type": ["object", "null"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"type": { "enum": ["file-citation", "grep-output", "api-response", "screenshot", "test-output", "command-output", "manual-attestation"] },
|
|
80
|
+
"content": { "type": "string" },
|
|
81
|
+
"value": { "type": ["number", "null"], "description": "Structured numeric value for threshold comparison — avoids grep extraction ambiguity" },
|
|
82
|
+
"url": { "type": ["string", "null"] }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"contextFiles": {
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"properties": {
|
|
90
|
+
"path": { "type": "string", "description": "File path relative to project root" },
|
|
91
|
+
"lines": { "type": "string", "description": "Line range, e.g. '162-285'" },
|
|
92
|
+
"reason": { "type": "string", "description": "Why this file is relevant to the AC" }
|
|
93
|
+
},
|
|
94
|
+
"required": ["path"]
|
|
95
|
+
},
|
|
96
|
+
"description": "Source files relevant to this AC — used by brief-assembler to give Marcus context"
|
|
97
|
+
},
|
|
98
|
+
"verdict": { "enum": ["PENDING", "PASS", "FAIL"] }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
"agents": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"default": {},
|
|
106
|
+
"properties": {
|
|
107
|
+
"marcus": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {
|
|
110
|
+
"spawned": { "type": "boolean" },
|
|
111
|
+
"verdict": { "enum": ["PASS", "FAIL", null] },
|
|
112
|
+
"branch": { "type": "string" },
|
|
113
|
+
"iterations": { "type": "integer" }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"quinn": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"properties": {
|
|
119
|
+
"spawned": { "type": "boolean" },
|
|
120
|
+
"verdict": { "enum": ["PASS", "FAIL", null] },
|
|
121
|
+
"comparedToSpec": { "type": "boolean" },
|
|
122
|
+
"screenshots": { "type": "array", "items": { "type": "string" } }
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"rook": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"properties": {
|
|
128
|
+
"spawned": { "type": "boolean" },
|
|
129
|
+
"verdict": { "enum": ["PASS", "FAIL", null] },
|
|
130
|
+
"findings": { "type": ["string", "null"], "description": "Rook security scan findings summary" }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
"environments": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"default": {},
|
|
139
|
+
"properties": {
|
|
140
|
+
"local": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"api": { "enum": ["PASS", "FAIL", "SKIP", null] },
|
|
144
|
+
"apiSkipReason": { "type": "string", "description": "Justification for skipping local API validation" },
|
|
145
|
+
"ui": { "enum": ["PASS", "FAIL", "SKIP", null] },
|
|
146
|
+
"uiSkipReason": { "type": "string", "description": "Justification for skipping local UI validation" },
|
|
147
|
+
"tests": { "enum": ["PASS", "FAIL", "SKIP", null] }
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"prod": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"properties": {
|
|
153
|
+
"rebuild": { "enum": ["PASS", "FAIL", "SKIP", null] },
|
|
154
|
+
"rebuildSkipReason": { "type": "string", "description": "Justification for skipping prod rebuild" },
|
|
155
|
+
"smoke": { "enum": ["PASS", "FAIL", "SKIP", null] },
|
|
156
|
+
"smokeSkipReason": { "type": "string", "description": "Justification for skipping prod smoke test" },
|
|
157
|
+
"quinn": { "enum": ["PASS", "FAIL", "SKIP", null] },
|
|
158
|
+
"quinnSkipReason": { "type": "string", "description": "Justification for skipping prod Quinn validation" },
|
|
159
|
+
"quinnSpot": { "enum": ["PASS", "FAIL", "SKIP", null] },
|
|
160
|
+
"quinnSpotSkipReason": { "type": "string", "description": "Justification for skipping prod Quinn spot check" }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
"gates": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"properties": {
|
|
169
|
+
"scope": {
|
|
170
|
+
"type": "object",
|
|
171
|
+
"properties": {
|
|
172
|
+
"result": { "enum": ["PASS", "FAIL", null] },
|
|
173
|
+
"attempt": { "type": "integer" },
|
|
174
|
+
"failures": { "type": "array", "items": { "type": "object" } },
|
|
175
|
+
"ts": { "type": "string" }
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"verify": {
|
|
179
|
+
"type": "object",
|
|
180
|
+
"properties": {
|
|
181
|
+
"result": { "enum": ["PASS", "FAIL", null] },
|
|
182
|
+
"attempt": { "type": "integer" },
|
|
183
|
+
"failures": { "type": "array", "items": { "type": "object" } },
|
|
184
|
+
"ts": { "type": "string" }
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"ship": {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"properties": {
|
|
190
|
+
"result": { "enum": ["PASS", "FAIL", null] },
|
|
191
|
+
"attempt": { "type": "integer" },
|
|
192
|
+
"failures": { "type": "array", "items": { "type": "object" } },
|
|
193
|
+
"ts": { "type": "string" }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"iterationCount": { "type": "integer", "default": 0 },
|
|
199
|
+
"startTs": { "type": "string", "format": "date-time" },
|
|
200
|
+
"updatedTs": { "type": "string", "format": "date-time" },
|
|
201
|
+
|
|
202
|
+
"phaseTimings": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"description": "Per-phase timing entries for bottleneck analysis. Each phase maps to an array of entries — convergence loop re-entries create new entries rather than overwriting.",
|
|
205
|
+
"additionalProperties": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"type": "object",
|
|
209
|
+
"properties": {
|
|
210
|
+
"enteredTs": { "type": "string", "format": "date-time" },
|
|
211
|
+
"exitedTs": { "type": "string", "format": "date-time" },
|
|
212
|
+
"iteration": { "type": "integer", "description": "Iteration number (1-based, for convergence loop re-entries)" },
|
|
213
|
+
"source": { "type": "string", "enum": ["gate-runner", "DA"], "description": "What wrote this timing entry" }
|
|
214
|
+
},
|
|
215
|
+
"required": ["enteredTs", "source"]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
"gateContract": {
|
|
221
|
+
"type": "object",
|
|
222
|
+
"description": "Documents expected field paths and valid values for each gate check. DA reference — prevents setting fields to prose instead of enum values.",
|
|
223
|
+
"properties": {
|
|
224
|
+
"environments": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"description": "Expected values for environment validation fields",
|
|
227
|
+
"properties": {
|
|
228
|
+
"local.api": { "type": "string", "enum": ["PASS", "SKIP"], "description": "Set to PASS after API validation, SKIP with apiSkipReason" },
|
|
229
|
+
"local.ui": { "type": "string", "enum": ["PASS", "SKIP"], "description": "Set to PASS after UI validation, SKIP requires uiSkipReason field" },
|
|
230
|
+
"local.uiSkipReason": { "type": "string", "description": "Required when local.ui is SKIP" },
|
|
231
|
+
"local.tests": { "type": "string", "enum": ["PASS", "SKIP", "FAIL"], "description": "Set by Marcus after running tests. tests-pass reads this first." },
|
|
232
|
+
"prod.rebuild": { "type": "string", "enum": ["PASS", "SKIP"], "description": "SKIP requires rebuildSkipReason" },
|
|
233
|
+
"prod.smoke": { "type": "string", "enum": ["PASS", "SKIP"], "description": "SKIP requires smokeSkipReason" },
|
|
234
|
+
"prod.quinn": { "type": "string", "enum": ["PASS", "SKIP"], "description": "SKIP requires quinnSkipReason" }
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"verdicts": {
|
|
238
|
+
"type": "object",
|
|
239
|
+
"description": "Valid verdict values for ACs and agents",
|
|
240
|
+
"properties": {
|
|
241
|
+
"ac.verdict": { "type": "string", "enum": ["PASS", "FAIL"], "description": "Each AC verdict must be exactly PASS or FAIL" },
|
|
242
|
+
"agent.verdict": { "type": "string", "enum": ["PASS", "FAIL", "SKIP"], "description": "Agent verdicts — SKIP requires skipReason" }
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"evidence": {
|
|
246
|
+
"type": "object",
|
|
247
|
+
"description": "Valid evidence types",
|
|
248
|
+
"properties": {
|
|
249
|
+
"type": { "type": "string", "enum": ["file-citation", "grep-output", "api-response", "screenshot", "test-output", "command-output", "manual-attestation"] }
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"baselines": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"description": "Baseline fields for repos with pre-existing issues",
|
|
255
|
+
"properties": {
|
|
256
|
+
"testBaseline": { "type": "integer", "description": "Pre-existing test failure count. tests-pass compares against this." },
|
|
257
|
+
"tscBaseline": { "type": "integer", "description": "Pre-existing TypeScript error count. tsc-pass compares against this." }
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
"changelog": {
|
|
264
|
+
"type": "array",
|
|
265
|
+
"description": "Append-only event log — never delete entries",
|
|
266
|
+
"items": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"required": ["ts", "event"],
|
|
269
|
+
"properties": {
|
|
270
|
+
"ts": { "type": "string", "format": "date-time" },
|
|
271
|
+
"event": { "type": "string" },
|
|
272
|
+
"detail": { "type": "string" },
|
|
273
|
+
"phase": { "type": "string" },
|
|
274
|
+
"actor": { "enum": ["da", "marcus", "quinn", "rook", "gate-runner"] }
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two AC-quality readings `gates/workflow.test.ts` used to compute inline
|
|
3
|
+
* and then `console.warn` about (#423).
|
|
4
|
+
*
|
|
5
|
+
* #183 audited the ported check list and found four checks that warn without
|
|
6
|
+
* asserting. Two were documented decisions. These two were not: they were
|
|
7
|
+
* `tsc-pass`'s shape — a name promising a verdict over a body that cannot
|
|
8
|
+
* produce one — and they sat in `WARN_TIER_CHECKS` with a reason reading
|
|
9
|
+
* "reported, not fixed".
|
|
10
|
+
*
|
|
11
|
+
* #423 settles them in opposite directions, and the reason they go different
|
|
12
|
+
* ways is the whole point of separating the READING from the VERDICT:
|
|
13
|
+
*
|
|
14
|
+
* - `outcomeEvidenceViolations` now **refuses**. An OUTCOME AC records that a
|
|
15
|
+
* user-visible outcome was observed; a bare number cannot establish one, and
|
|
16
|
+
* `0`, `{}`, `null` and `SKIP` being indistinguishable from success is the
|
|
17
|
+
* *Silent Default Substitution* anti-pattern this repo already names in
|
|
18
|
+
* `.claude/rules/config-access.md`. Its sibling two tests above it,
|
|
19
|
+
* `outcome-acs-no-skip`, has always asserted.
|
|
20
|
+
*
|
|
21
|
+
* - `goalKeywordCoverage` stays a **warning**, and that is now a measured
|
|
22
|
+
* decision rather than a deferral. Measured over the 153 `workflow-state.json`
|
|
23
|
+
* files under `~/.rungate` carrying a goal: **71% of real runs** fall under
|
|
24
|
+
* the 50% threshold, median coverage 38%. Restricting to states whose ACs
|
|
25
|
+
* carry real statements (>80 chars) gives 66% of 131, median 41%; >300 chars
|
|
26
|
+
* gives 73% of 101. The number does not move. A check that would refuse two
|
|
27
|
+
* runs in three is not a gate, it is an outage, and a stopword-filtered
|
|
28
|
+
* substring match over prose is the same basis #409 Decision #9 already
|
|
29
|
+
* rejected for `spec-decision-compliance`.
|
|
30
|
+
*
|
|
31
|
+
* Both are here rather than inline in the gate suite for the reason
|
|
32
|
+
* `.claude/rules/checks-must-be-able-to-fail.md` gives: one exported binding
|
|
33
|
+
* per reading, so there is exactly one thing to mutate and the test can drive
|
|
34
|
+
* both sides of it without a workflow run.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** An AC as the gate suite sees it — untyped on the wire, so read defensively. */
|
|
38
|
+
interface LooseAc {
|
|
39
|
+
id?: unknown;
|
|
40
|
+
type?: unknown;
|
|
41
|
+
verdict?: unknown;
|
|
42
|
+
statement?: unknown;
|
|
43
|
+
evidence?: { content?: unknown } | null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function asAcs(acs: unknown): LooseAc[] {
|
|
47
|
+
return Array.isArray(acs) ? (acs as LooseAc[]) : [];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Evidence that is a bare measurement — a number and nothing a reader could
|
|
52
|
+
* check.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately wider than the `/^\d+$/` the inline body used. That form read
|
|
55
|
+
* `3` as numeric-only and `3/3`, `12%`, `0.0` and `-1` as behavioural, which
|
|
56
|
+
* is the second shape in `.claude/rules/checks-must-be-able-to-fail.md`: a
|
|
57
|
+
* detector narrower than what it detects, where a reformat of the same
|
|
58
|
+
* non-answer walks straight through. The question is whether the evidence
|
|
59
|
+
* contains a WORD, so that is what is asked.
|
|
60
|
+
*/
|
|
61
|
+
export function isBareMeasurement(content: unknown): boolean {
|
|
62
|
+
if (typeof content !== "string") return false;
|
|
63
|
+
const trimmed = content.trim();
|
|
64
|
+
if (trimmed === "") return false; // absence is a different check's question
|
|
65
|
+
return !/[a-z]/i.test(trimmed);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* OUTCOME ACs marked PASS whose evidence is a bare measurement.
|
|
70
|
+
*
|
|
71
|
+
* **Absent evidence is deliberately out of scope.** `all-acs-have-evidence`
|
|
72
|
+
* exempts OUTCOME ACs from mechanical evidence at ship time by design — they
|
|
73
|
+
* are verified live at prove — so reporting absence here would duplicate a
|
|
74
|
+
* decision another check already owns, and two deciders answering one question
|
|
75
|
+
* are behaviourally one (the fourth shape, #420). This one answers: when there
|
|
76
|
+
* IS evidence, does it say anything.
|
|
77
|
+
*/
|
|
78
|
+
export function outcomeEvidenceViolations(acs: unknown): string[] {
|
|
79
|
+
return asAcs(acs)
|
|
80
|
+
.filter(ac => ac.type === "OUTCOME" && ac.verdict === "PASS")
|
|
81
|
+
.filter(ac => isBareMeasurement(ac.evidence?.content))
|
|
82
|
+
.map(ac => `${String(ac.id ?? "?")}: evidence is ${JSON.stringify(String(ac.evidence?.content ?? "")).slice(0, 40)}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The words in a goal worth asking about: long enough to mean something. */
|
|
86
|
+
const STOPWORDS = new Set([
|
|
87
|
+
"the", "and", "for", "that", "this", "with", "from", "have", "been",
|
|
88
|
+
"will", "must", "when", "into", "also", "each", "than",
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
/** ADR-009 C4's threshold, warned under — never refused. See the file docblock. */
|
|
92
|
+
export const GOAL_COVERAGE_WARN_BELOW = 0.5;
|
|
93
|
+
|
|
94
|
+
export interface GoalCoverage {
|
|
95
|
+
keywords: string[];
|
|
96
|
+
covered: string[];
|
|
97
|
+
coverage: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* How much of the issue goal's vocabulary the ACs repeat (ADR-009 C4).
|
|
102
|
+
*
|
|
103
|
+
* `null` when there is nothing to ask — no goal, or a goal of nothing but
|
|
104
|
+
* short words. A caller must not read that as full coverage; it is the
|
|
105
|
+
* difference between measuring zero and not measuring, which is the
|
|
106
|
+
* distinction `.claude/rules/config-access.md` calls out by name.
|
|
107
|
+
*/
|
|
108
|
+
export function goalKeywordCoverage(goal: unknown, acs: unknown): GoalCoverage | null {
|
|
109
|
+
if (typeof goal !== "string" || goal.trim() === "") return null;
|
|
110
|
+
const keywords = goal
|
|
111
|
+
.toLowerCase()
|
|
112
|
+
.replace(/[^a-z0-9\s]/g, " ")
|
|
113
|
+
.split(/\s+/)
|
|
114
|
+
.filter(w => w.length > 4 && !STOPWORDS.has(w));
|
|
115
|
+
if (keywords.length === 0) return null;
|
|
116
|
+
const acText = asAcs(acs).map(ac => String(ac.statement ?? "").toLowerCase()).join(" ");
|
|
117
|
+
const covered = keywords.filter(kw => acText.includes(kw));
|
|
118
|
+
return { keywords, covered, coverage: covered.length / keywords.length };
|
|
119
|
+
}
|
package/lib/cli-commands.ts
CHANGED
|
@@ -60,7 +60,7 @@ export const CLI_COMMANDS: Record<string, CliCommand> = {
|
|
|
60
60
|
scaffold: {
|
|
61
61
|
script: "scripts/scaffold-project.ts",
|
|
62
62
|
summary: "Generate or refresh a project's agent files, rules and conformity suite",
|
|
63
|
-
usage: "rungate scaffold <path> [--type code|workflow] [--fix] [--force] [--commit]",
|
|
63
|
+
usage: "rungate scaffold <path> [--type code|workflow] [--fix] [--force] [--commit] [--no-auto-fix] [--prune-consumers]",
|
|
64
64
|
},
|
|
65
65
|
"create-spec": {
|
|
66
66
|
script: "scripts/create-spec.ts",
|
|
@@ -68,6 +68,12 @@ export const CLI_COMMANDS: Record<string, CliCommand> = {
|
|
|
68
68
|
usage: 'rungate create-spec "Title" ["what it governs"] [--sc "statement"]',
|
|
69
69
|
projectRootFlag: true,
|
|
70
70
|
},
|
|
71
|
+
"create-success": {
|
|
72
|
+
script: "scripts/create-success.ts",
|
|
73
|
+
summary: "Seed SUCCESS.md — what this project is for, and the claims that prove it",
|
|
74
|
+
usage: "rungate create-success [--owner <name>] [--force]",
|
|
75
|
+
projectRootFlag: true,
|
|
76
|
+
},
|
|
71
77
|
"create-sc": {
|
|
72
78
|
script: "scripts/create-sc.ts",
|
|
73
79
|
summary: "Generate a matchable success-criterion line from a registered pattern",
|