cc-devflow 4.5.11 → 4.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +18 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +17 -269
  3. package/.claude/skills/cc-act/SKILL.md +38 -425
  4. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_INDEX_TEMPLATE.md +2 -13
  5. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_TEMPLATE.md +1 -9
  6. package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +21 -177
  7. package/.claude/skills/cc-act/references/closure-contract.md +12 -63
  8. package/.claude/skills/cc-act/references/git-commit-guidelines.md +5 -5
  9. package/.claude/skills/cc-act/scripts/cc-act-common.sh +5 -322
  10. package/.claude/skills/cc-act/scripts/detect-ship-target.sh +11 -2
  11. package/.claude/skills/cc-act/scripts/inspect-git-index.sh +58 -0
  12. package/.claude/skills/cc-act/scripts/render-pr-brief.sh +40 -440
  13. package/.claude/skills/cc-act/scripts/verify-act-gate.sh +10 -50
  14. package/.claude/skills/cc-check/CHANGELOG.md +18 -0
  15. package/.claude/skills/cc-check/PLAYBOOK.md +19 -273
  16. package/.claude/skills/cc-check/SKILL.md +33 -456
  17. package/.claude/skills/cc-check/references/review-contract.md +12 -147
  18. package/.claude/skills/cc-dev/CHANGELOG.md +15 -0
  19. package/.claude/skills/cc-dev/PLAYBOOK.md +1 -1
  20. package/.claude/skills/cc-dev/SKILL.md +52 -137
  21. package/.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh +181 -0
  22. package/.claude/skills/cc-do/CHANGELOG.md +11 -0
  23. package/.claude/skills/cc-do/PLAYBOOK.md +19 -113
  24. package/.claude/skills/cc-do/SKILL.md +39 -245
  25. package/.claude/skills/cc-do/references/execution-recovery.md +15 -109
  26. package/.claude/skills/cc-do/scripts/cc-do-common.sh +5 -57
  27. package/.claude/skills/cc-do/scripts/check-task-status.sh +35 -65
  28. package/.claude/skills/cc-do/scripts/mark-task-complete.sh +9 -46
  29. package/.claude/skills/cc-do/scripts/select-ready-tasks.sh +29 -97
  30. package/.claude/skills/cc-investigate/CHANGELOG.md +16 -0
  31. package/.claude/skills/cc-investigate/PLAYBOOK.md +20 -180
  32. package/.claude/skills/cc-investigate/SKILL.md +64 -246
  33. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +48 -98
  34. package/.claude/skills/cc-investigate/references/investigation-contract.md +14 -218
  35. package/.claude/skills/cc-next/CHANGELOG.md +6 -0
  36. package/.claude/skills/cc-next/PLAYBOOK.md +12 -8
  37. package/.claude/skills/cc-next/SKILL.md +34 -140
  38. package/.claude/skills/cc-plan/CHANGELOG.md +16 -0
  39. package/.claude/skills/cc-plan/PLAYBOOK.md +22 -161
  40. package/.claude/skills/cc-plan/SKILL.md +45 -295
  41. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +30 -228
  42. package/.claude/skills/cc-plan/references/planning-contract.md +24 -161
  43. package/.claude/skills/cc-plan/scripts/next-change-key.sh +8 -44
  44. package/.claude/skills/cc-plan/scripts/parse-task-dependencies.js +2 -2
  45. package/.claude/skills/cc-plan/scripts/validate-scope.sh +1 -1
  46. package/.claude/skills/cc-pr-land/SKILL.md +14 -114
  47. package/.claude/skills/cc-pr-review/CHANGELOG.md +4 -0
  48. package/.claude/skills/cc-pr-review/SKILL.md +20 -103
  49. package/.claude/skills/cc-review/CHANGELOG.md +17 -0
  50. package/.claude/skills/cc-review/PLAYBOOK.md +13 -86
  51. package/.claude/skills/cc-review/SKILL.md +53 -241
  52. package/.claude/skills/cc-review/references/e2e-and-plugin-verification.md +2 -2
  53. package/.claude/skills/cc-review/references/implementation-review-branch.md +7 -147
  54. package/.claude/skills/cc-review/references/plan-review-branch.md +5 -147
  55. package/.claude/skills/cc-review/references/review-methods.md +10 -218
  56. package/.claude/skills/cc-review/scripts/collect-review-context.sh +4 -63
  57. package/.claude/skills/cc-roadmap/PLAYBOOK.md +1 -1
  58. package/.claude/skills/cc-roadmap/SKILL.md +3 -3
  59. package/.claude/skills/cc-simplify/CHANGELOG.md +7 -0
  60. package/.claude/skills/cc-simplify/SKILL.md +26 -21
  61. package/.claude/skills/cc-spec-init/PLAYBOOK.md +12 -48
  62. package/.claude/skills/cc-spec-init/SKILL.md +29 -132
  63. package/.claude/skills/cc-spec-init/references/spec-contract.md +8 -17
  64. package/CHANGELOG.md +13 -0
  65. package/bin/cc-devflow-cli.js +20 -260
  66. package/bin/cc-devflow.js +44 -7
  67. package/docs/commands/README.md +1 -1
  68. package/docs/commands/README.zh-CN.md +1 -1
  69. package/docs/examples/README.md +1 -1
  70. package/docs/examples/START-HERE.md +14 -15
  71. package/docs/examples/example-bindings.json +11 -11
  72. package/docs/examples/full-design-blocked/README.md +4 -6
  73. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/{planning/tasks.md → task.md} +20 -15
  74. package/docs/examples/local-handoff/README.md +8 -11
  75. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/pr-brief.md +31 -0
  76. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/{planning/tasks.md → task.md} +18 -13
  77. package/docs/examples/pdca-loop/README.md +6 -9
  78. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +9 -11
  79. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/{planning/tasks.md → task.md} +18 -13
  80. package/docs/examples/scripts/check-example-bindings.sh +11 -62
  81. package/docs/guides/artifact-contract.md +10 -40
  82. package/docs/guides/getting-started.md +8 -8
  83. package/docs/guides/getting-started.zh-CN.md +8 -8
  84. package/docs/guides/minimize-artifacts.md +16 -130
  85. package/docs/guides/project-postmortem.md +14 -71
  86. package/lib/compiler/__tests__/skills-registry.test.js +9 -8
  87. package/lib/compiler/resource-copier.js +29 -0
  88. package/lib/skill-runtime/__tests__/archive-change.test.js +2 -2
  89. package/lib/skill-runtime/__tests__/benchmark-skills.test.js +3 -3
  90. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +14 -4
  91. package/lib/skill-runtime/errors.js +3 -3
  92. package/lib/skill-runtime/index.js +5 -23
  93. package/lib/skill-runtime/paths.js +5 -52
  94. package/lib/skill-runtime/query-registry.js +4 -4
  95. package/lib/skill-runtime/query.js +89 -201
  96. package/lib/skill-runtime/store.js +4 -40
  97. package/lib/skill-runtime/trace.js +2 -2
  98. package/package.json +2 -5
  99. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_PRINCIPLES_TEMPLATE.md +0 -29
  100. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +0 -54
  101. package/.claude/skills/cc-act/scripts/generate-status-report.sh +0 -92
  102. package/.claude/skills/cc-act/scripts/sync-act-docs.sh +0 -355
  103. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +0 -234
  104. package/.claude/skills/cc-check/scripts/render-report-card.js +0 -438
  105. package/.claude/skills/cc-check/scripts/verify-gate.sh +0 -85
  106. package/.claude/skills/cc-do/scripts/build-task-context.sh +0 -175
  107. package/.claude/skills/cc-do/scripts/record-review-decision.sh +0 -88
  108. package/.claude/skills/cc-do/scripts/recover-workflow.sh +0 -82
  109. package/.claude/skills/cc-do/scripts/run-problem-analysis.sh +0 -70
  110. package/.claude/skills/cc-do/scripts/verify-task-gates.sh +0 -109
  111. package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +0 -92
  112. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +0 -224
  113. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +0 -178
  114. package/.claude/skills/cc-spec-init/assets/CHANGE_META_TEMPLATE.json +0 -28
  115. package/.claude/skills/cc-spec-init/scripts/validate-spec-links.sh +0 -45
  116. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +0 -234
  117. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +0 -488
  118. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +0 -189
  119. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/resume-index.md +0 -39
  120. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/status.md +0 -29
  121. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +0 -123
  122. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +0 -292
  123. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +0 -136
  124. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/status.md +0 -29
  125. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +0 -124
  126. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +0 -292
  127. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +0 -136
  128. package/docs/get-shit-done-strategy-audit.md +0 -518
  129. package/docs/skill-runtime-migration.md +0 -46
  130. package/lib/skill-runtime/__tests__/approve.test.js +0 -92
  131. package/lib/skill-runtime/__tests__/autopilot.test.js +0 -253
  132. package/lib/skill-runtime/__tests__/benchmark-artifacts.test.js +0 -165
  133. package/lib/skill-runtime/__tests__/delegation.test.js +0 -97
  134. package/lib/skill-runtime/__tests__/dispatch.test.js +0 -237
  135. package/lib/skill-runtime/__tests__/intent.test.js +0 -203
  136. package/lib/skill-runtime/__tests__/lifecycle.test.js +0 -169
  137. package/lib/skill-runtime/__tests__/planner.tdd.test.js +0 -331
  138. package/lib/skill-runtime/__tests__/prepare-pr.test.js +0 -126
  139. package/lib/skill-runtime/__tests__/query.test.js +0 -860
  140. package/lib/skill-runtime/__tests__/readiness.test.js +0 -53
  141. package/lib/skill-runtime/__tests__/release.test.js +0 -85
  142. package/lib/skill-runtime/__tests__/review-check-integration.test.js +0 -148
  143. package/lib/skill-runtime/__tests__/review-records.test.js +0 -619
  144. package/lib/skill-runtime/__tests__/runtime.integration.test.js +0 -351
  145. package/lib/skill-runtime/__tests__/schemas.test.js +0 -337
  146. package/lib/skill-runtime/__tests__/task-contract-migrate.test.js +0 -137
  147. package/lib/skill-runtime/__tests__/task-contract.test.js +0 -874
  148. package/lib/skill-runtime/__tests__/team-state.test.js +0 -51
  149. package/lib/skill-runtime/__tests__/verify-artifacts.test.js +0 -203
  150. package/lib/skill-runtime/__tests__/worker-run.test.js +0 -275
  151. package/lib/skill-runtime/__tests__/worker.test.js +0 -56
  152. package/lib/skill-runtime/__tests__/workflow-context-legacy-fallback.test.js +0 -31
  153. package/lib/skill-runtime/__tests__/workflow-context.test.js +0 -98
  154. package/lib/skill-runtime/artifacts.js +0 -88
  155. package/lib/skill-runtime/context-index.js +0 -545
  156. package/lib/skill-runtime/delegation.js +0 -533
  157. package/lib/skill-runtime/intent.js +0 -309
  158. package/lib/skill-runtime/lifecycle.js +0 -294
  159. package/lib/skill-runtime/operations/CLAUDE.md +0 -19
  160. package/lib/skill-runtime/operations/approve.js +0 -81
  161. package/lib/skill-runtime/operations/autopilot-core.js +0 -337
  162. package/lib/skill-runtime/operations/autopilot-execution.js +0 -307
  163. package/lib/skill-runtime/operations/autopilot-shared.js +0 -48
  164. package/lib/skill-runtime/operations/autopilot.js +0 -163
  165. package/lib/skill-runtime/operations/dispatch.js +0 -416
  166. package/lib/skill-runtime/operations/init.js +0 -60
  167. package/lib/skill-runtime/operations/janitor.js +0 -61
  168. package/lib/skill-runtime/operations/plan.js +0 -59
  169. package/lib/skill-runtime/operations/prepare-pr.js +0 -25
  170. package/lib/skill-runtime/operations/release.js +0 -99
  171. package/lib/skill-runtime/operations/resume.js +0 -126
  172. package/lib/skill-runtime/operations/review-records.js +0 -265
  173. package/lib/skill-runtime/operations/snapshot.js +0 -45
  174. package/lib/skill-runtime/operations/task-contract.js +0 -593
  175. package/lib/skill-runtime/operations/verify.js +0 -170
  176. package/lib/skill-runtime/operations/worker-run.js +0 -531
  177. package/lib/skill-runtime/operations/worker.js +0 -33
  178. package/lib/skill-runtime/planner.js +0 -539
  179. package/lib/skill-runtime/readiness.js +0 -84
  180. package/lib/skill-runtime/review-records.js +0 -123
  181. package/lib/skill-runtime/review.js +0 -855
  182. package/lib/skill-runtime/schemas.js +0 -746
  183. package/lib/skill-runtime/task-contract.js +0 -188
  184. package/lib/skill-runtime/team-state.js +0 -122
  185. package/lib/skill-runtime/workflow-context.js +0 -748
@@ -1,234 +0,0 @@
1
- {
2
- "changeId": "REQ-123",
3
- "outputPolicy": {
4
- "documentLanguage": ""
5
- },
6
- "verdict": "blocked",
7
- "overall": "fail",
8
- "summary": "verdict=blocked quick=1/2 strict=0/0 review=blocked",
9
- "specAlignment": "blocked",
10
- "specDeltaVerified": false,
11
- "specSyncReady": false,
12
- "runtime": {
13
- "status": "blocked",
14
- "failureOwnership": [
15
- {
16
- "errorName": "MissingSpecReviewProof",
17
- "failure": "missing spec review proof",
18
- "classification": "in-branch",
19
- "owner": "branch",
20
- "touchedByDiff": true,
21
- "artifactRefs": [
22
- "planning/task-manifest.json",
23
- "review/report-card.json"
24
- ],
25
- "evidence": "planning/task-manifest.json tasks[T002].reviews.spec is empty",
26
- "rescueAction": "record spec review proof for T002 or reroute to cc-do",
27
- "action": "reroute-cc-do",
28
- "status": "open"
29
- }
30
- ]
31
- },
32
- "claimEvidence": [
33
- {
34
- "claim": "tests-pass",
35
- "requiredProof": "fresh test command with exit 0 and 0 failures",
36
- "commandOrArtifact": "npm test -- src/feature/feature.test.ts",
37
- "exitStatus": 0,
38
- "keyObservation": "targeted tests passed in this run",
39
- "status": "pass"
40
- },
41
- {
42
- "claim": "requirements-met",
43
- "requiredProof": "line-by-line planning/tasks.md and task-manifest.json checklist",
44
- "commandOrArtifact": "planning/tasks.md + planning/task-manifest.json",
45
- "exitStatus": null,
46
- "keyObservation": "T002 still lacks spec review proof",
47
- "status": "blocked"
48
- }
49
- ],
50
- "qa": {
51
- "status": "blocked",
52
- "feedbackLoop": {
53
- "status": "blocked",
54
- "mode": "targeted-test",
55
- "commandOrArtifact": "npm test -- src/feature/feature.test.ts",
56
- "speed": "fast",
57
- "determinism": "high",
58
- "signalSharpness": "targeted failure would indicate the user-visible behavior regressed",
59
- "reproductionRate": "not recorded",
60
- "attempts": [
61
- "targeted unit test"
62
- ],
63
- "blockedReason": "red/green reproduction is not recorded yet"
64
- },
65
- "behaviorEvidence": {
66
- "status": "blocked",
67
- "userFacingBoundary": "feature behavior",
68
- "expectedBehavior": "target behavior succeeds for the user",
69
- "actualBehavior": "not proven yet",
70
- "reproductionSteps": [
71
- "run the targeted verification command"
72
- ],
73
- "consistency": "not recorded",
74
- "domainLanguage": [
75
- "feature behavior"
76
- ]
77
- },
78
- "regressionProof": [
79
- {
80
- "behavior": "original symptom",
81
- "redCommand": "",
82
- "redFailure": "",
83
- "greenCommand": "",
84
- "greenObservation": "",
85
- "restoredState": false
86
- }
87
- ],
88
- "testQuality": [
89
- {
90
- "area": "targeted-tests",
91
- "checksRealBehavior": true,
92
- "mockBoundary": "none",
93
- "testOnlyProductionApi": false,
94
- "status": "pass"
95
- }
96
- ],
97
- "coverageAudit": {
98
- "status": "blocked",
99
- "coveragePct": null,
100
- "pathMap": ["planning/tasks.md#T002"],
101
- "gaps": ["T002 has no spec review proof, so the requirement cannot be marked covered"],
102
- "testsAdded": [],
103
- "e2eRequired": false,
104
- "evalRequired": false,
105
- "qualityStars": "★"
106
- },
107
- "browserEvidence": {
108
- "status": "skipped",
109
- "mode": "not-applicable",
110
- "affectedRoutes": [],
111
- "screenshots": [],
112
- "consoleErrors": [],
113
- "healthScore": null,
114
- "issues": [],
115
- "skipReason": "template example is not a UI browser QA scenario"
116
- },
117
- "humanUat": {
118
- "status": "skipped",
119
- "required": false,
120
- "scenario": "",
121
- "tester": "",
122
- "evidence": [],
123
- "failure": "",
124
- "reroute": "none",
125
- "skipReason": "not required for this template scenario"
126
- },
127
- "architectureFollowUps": [
128
- {
129
- "summary": "Add the missing public test seam before widening coverage",
130
- "currentBehavior": "review proof depends on task metadata instead of a direct behavior seam",
131
- "desiredBehavior": "tests verify the behavior through a stable public interface",
132
- "keyInterfaces": [
133
- "feature public API"
134
- ],
135
- "acceptanceCriteria": [
136
- "target behavior can be reproduced without private implementation hooks"
137
- ],
138
- "outOfScope": [
139
- "rewriting unrelated modules"
140
- ],
141
- "status": "deferred-minor"
142
- }
143
- ],
144
- "tddException": null
145
- },
146
- "quickGates": [
147
- {
148
- "name": "targeted-tests",
149
- "status": "pass",
150
- "command": "npm test -- src/feature/feature.test.ts",
151
- "summary": "targeted tests passed"
152
- },
153
- {
154
- "name": "review-proof",
155
- "status": "blocked",
156
- "command": "review artifacts",
157
- "summary": "missing spec review proof for T002"
158
- }
159
- ],
160
- "strictGates": [],
161
- "review": {
162
- "status": "blocked",
163
- "summary": "Task review evidence is incomplete",
164
- "details": "T002 is implemented, but the requirement still lacks spec review proof required by the gate.",
165
- "freshness": {
166
- "status": "unknown",
167
- "reviewedCommit": "",
168
- "currentCommit": "",
169
- "commitsSinceReview": null,
170
- "staleReason": "review range is not recorded yet"
171
- },
172
- "qualityScore": null,
173
- "specialistReviews": [
174
- {
175
- "name": "testing",
176
- "status": "blocked",
177
- "required": true,
178
- "summary": "testing facet cannot pass while task review proof is missing",
179
- "skipReason": "",
180
- "findings": []
181
- }
182
- ],
183
- "taskReviews": {
184
- "status": "blocked",
185
- "required": true,
186
- "summary": "T002 has no spec review record yet",
187
- "reviewPacket": {
188
- "baseSha": "",
189
- "headSha": "",
190
- "requirements": "planning/tasks.md#T002",
191
- "implemented": "implementation report for T002",
192
- "reviewerContext": "task spec and changed files"
193
- },
194
- "reviewers": [],
195
- "findings": [
196
- {
197
- "severity": "important",
198
- "confidence": "high",
199
- "source": "task-review",
200
- "summary": "T002 spec review proof is missing",
201
- "evidence": "planning/task-manifest.json tasks[T002].reviews.spec is empty",
202
- "action": "reroute-cc-do",
203
- "rescueAction": "record spec review proof for T002 or return to cc-do",
204
- "triageStatus": "clarification-needed",
205
- "confidenceScore": 9,
206
- "fingerprint": "task-review:T002:missing-spec-review",
207
- "displayTier": "blocking",
208
- "suppressionReason": null
209
- }
210
- ]
211
- },
212
- "diffReview": {
213
- "status": "skipped",
214
- "required": false,
215
- "summary": "",
216
- "reviewPacket": {
217
- "baseSha": "",
218
- "headSha": "",
219
- "requirements": "planning/design.md",
220
- "implemented": "",
221
- "reviewerContext": ""
222
- },
223
- "reviewers": [],
224
- "findings": []
225
- },
226
- "findings": []
227
- },
228
- "blockingFindings": [
229
- "review: missing spec review proof for T002"
230
- ],
231
- "gaps": [],
232
- "reroute": "cc-do",
233
- "timestamp": "2026-04-15T12:00:00.000Z"
234
- }
@@ -1,438 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
-
5
- function usage() {
6
- console.error(
7
- 'Usage: render-report-card.js --change-id REQ-123 --manifest task-manifest.json --quick quick.json --strict strict.json --review review.json'
8
- );
9
- }
10
-
11
- function readJson(filePath) {
12
- return JSON.parse(fs.readFileSync(filePath, 'utf8'));
13
- }
14
-
15
- function parseArgs(argv) {
16
- const args = {
17
- changeId: '',
18
- manifest: '',
19
- quick: '',
20
- strict: '',
21
- review: '',
22
- timestamp: ''
23
- };
24
-
25
- for (let index = 0; index < argv.length; index += 1) {
26
- const arg = argv[index];
27
- if (arg === '--change-id') {
28
- args.changeId = argv[index + 1] || '';
29
- index += 1;
30
- continue;
31
- }
32
- if (arg === '--manifest') {
33
- args.manifest = argv[index + 1] || '';
34
- index += 1;
35
- continue;
36
- }
37
- if (arg === '--quick') {
38
- args.quick = argv[index + 1] || '';
39
- index += 1;
40
- continue;
41
- }
42
- if (arg === '--strict') {
43
- args.strict = argv[index + 1] || '';
44
- index += 1;
45
- continue;
46
- }
47
- if (arg === '--review') {
48
- args.review = argv[index + 1] || '';
49
- index += 1;
50
- continue;
51
- }
52
- if (arg === '--timestamp') {
53
- args.timestamp = argv[index + 1] || '';
54
- index += 1;
55
- continue;
56
- }
57
- }
58
-
59
- return args;
60
- }
61
-
62
- function deriveVerdict(manifest, quickGates, strictGates, review) {
63
- if ((manifest.tasks || []).some((task) => task.status === 'failed')) {
64
- return 'fail';
65
- }
66
-
67
- if ([...quickGates, ...strictGates].some((gate) => gate.status === 'fail')) {
68
- return 'fail';
69
- }
70
-
71
- if ([...quickGates, ...strictGates].some((gate) => ['blocked', 'pending'].includes(gate.status))) {
72
- return 'blocked';
73
- }
74
-
75
- if (review.qa?.status === 'fail') {
76
- return 'fail';
77
- }
78
-
79
- if (['blocked', 'pending'].includes(review.qa?.status)) {
80
- return 'blocked';
81
- }
82
-
83
- if (['fail'].includes(review.qa?.feedbackLoop?.status)) {
84
- return 'fail';
85
- }
86
-
87
- if (['blocked', 'pending'].includes(review.qa?.feedbackLoop?.status)) {
88
- return 'blocked';
89
- }
90
-
91
- if (['fail'].includes(review.qa?.behaviorEvidence?.status)) {
92
- return 'fail';
93
- }
94
-
95
- if (['blocked', 'pending'].includes(review.qa?.behaviorEvidence?.status)) {
96
- return 'blocked';
97
- }
98
-
99
- if (review.status === 'blocked') {
100
- return 'blocked';
101
- }
102
-
103
- if (review.status === 'fail') {
104
- return 'fail';
105
- }
106
-
107
- const freshness = buildReviewFreshness(review).status;
108
- if (review.status === 'pass' && !['fresh', 'not-applicable'].includes(freshness)) {
109
- return 'blocked';
110
- }
111
-
112
- const openOwnedFailures = (review.runtime?.failureOwnership || []).some((item) => {
113
- const classification = item.classification || '';
114
- const status = item.status || 'open';
115
- return ['in-branch', 'ambiguous'].includes(classification) && !['resolved', 'closed'].includes(status);
116
- });
117
- if (openOwnedFailures) {
118
- return 'blocked';
119
- }
120
-
121
- return 'pass';
122
- }
123
-
124
- function deriveReroute({ verdict, review, manifest, blockingFindings }) {
125
- if (verdict === 'pass') {
126
- return 'none';
127
- }
128
-
129
- const taskFailures = (manifest.tasks || []).some((task) => task.status === 'failed');
130
- if (taskFailures) {
131
- return 'cc-do';
132
- }
133
-
134
- const rerouteSignals = [
135
- review.summary || '',
136
- review.details || '',
137
- ...(blockingFindings || [])
138
- ].join(' ').toLowerCase();
139
-
140
- if (/(root cause|repro|debug|investigat|regression)/.test(rerouteSignals)) {
141
- return 'cc-investigate';
142
- }
143
-
144
- if (/(design|scope|plan|planning|requirement|contract)/.test(rerouteSignals)) {
145
- return 'cc-plan';
146
- }
147
-
148
- return 'cc-do';
149
- }
150
-
151
- function buildSummary({ quickGates, strictGates, review, verdict }) {
152
- const gateSummary = (gates) => `${gates.filter((gate) => gate.status === 'pass').length}/${gates.length}`;
153
- return [
154
- `verdict=${verdict}`,
155
- `quick=${gateSummary(quickGates)}`,
156
- `strict=${gateSummary(strictGates)}`,
157
- `review=${review.status}`
158
- ].join(' ');
159
- }
160
-
161
- function claimFromGate(gate) {
162
- const name = String(gate.name || '').toLowerCase();
163
- if (/test|spec/.test(name)) {
164
- return 'tests-pass';
165
- }
166
- if (/lint/.test(name)) {
167
- return 'lint-clean';
168
- }
169
- if (/type/.test(name)) {
170
- return 'typecheck-clean';
171
- }
172
- if (/build|compile/.test(name)) {
173
- return 'build-succeeds';
174
- }
175
- return `gate-${gate.name || 'unknown'}`;
176
- }
177
-
178
- function isTaskComplete(task) {
179
- const status = String(task?.status || (task?.completed ? 'completed' : 'pending')).toLowerCase();
180
- return ['passed', 'done', 'completed', 'verified'].includes(status);
181
- }
182
-
183
- function buildClaimEvidence({ manifest, quickGates, strictGates, review }) {
184
- const gateClaims = [...quickGates, ...strictGates].map((gate) => ({
185
- claim: claimFromGate(gate),
186
- requiredProof: 'fresh command output with exit status and key observation',
187
- commandOrArtifact: gate.command || gate.name || '',
188
- exitStatus: gate.exitStatus ?? null,
189
- keyObservation: gate.summary || gate.details || '',
190
- status: gate.status || 'blocked'
191
- }));
192
-
193
- const openTasks = (manifest.tasks || []).filter((task) => !isTaskComplete(task));
194
- gateClaims.push({
195
- claim: 'requirements-met',
196
- requiredProof: 'line-by-line planning/tasks.md and task-manifest.json checklist',
197
- commandOrArtifact: 'planning/tasks.md + planning/task-manifest.json',
198
- exitStatus: null,
199
- keyObservation: openTasks.length === 0 ? 'no open task gaps recorded' : `${openTasks.length} open task gaps recorded`,
200
- status: openTasks.length === 0 && review.status === 'pass' ? 'pass' : 'blocked'
201
- });
202
-
203
- return [...(review.claimEvidence || []), ...gateClaims];
204
- }
205
-
206
- function buildQa(review) {
207
- return {
208
- status: review.qa?.status || 'skipped',
209
- feedbackLoop: review.qa?.feedbackLoop || {
210
- status: 'skipped',
211
- mode: 'not-applicable',
212
- commandOrArtifact: '',
213
- speed: '',
214
- determinism: '',
215
- signalSharpness: '',
216
- reproductionRate: '',
217
- attempts: [],
218
- blockedReason: 'not recorded'
219
- },
220
- behaviorEvidence: review.qa?.behaviorEvidence || {
221
- status: 'skipped',
222
- userFacingBoundary: '',
223
- expectedBehavior: '',
224
- actualBehavior: '',
225
- reproductionSteps: [],
226
- consistency: '',
227
- domainLanguage: []
228
- },
229
- regressionProof: review.qa?.regressionProof || [],
230
- testQuality: review.qa?.testQuality || [],
231
- coverageAudit: review.qa?.coverageAudit || {
232
- status: 'skipped',
233
- coveragePct: null,
234
- pathMap: [],
235
- gaps: [],
236
- testsAdded: [],
237
- e2eRequired: false,
238
- evalRequired: false,
239
- qualityStars: ''
240
- },
241
- browserEvidence: review.qa?.browserEvidence || {
242
- status: 'skipped',
243
- mode: 'not-applicable',
244
- affectedRoutes: [],
245
- screenshots: [],
246
- consoleErrors: [],
247
- healthScore: null,
248
- issues: [],
249
- skipReason: 'not recorded'
250
- },
251
- architectureFollowUps: review.qa?.architectureFollowUps || [],
252
- tddException: review.qa?.tddException || null
253
- };
254
- }
255
-
256
- function buildRuntime(review) {
257
- const failureOwnership = review.runtime?.failureOwnership || [];
258
- const hasOpenOwnedFailure = failureOwnership.some((item) => {
259
- const classification = item.classification || '';
260
- const status = item.status || 'open';
261
- return ['in-branch', 'ambiguous'].includes(classification) && !['resolved', 'closed'].includes(status);
262
- });
263
-
264
- return {
265
- status: review.runtime?.status || (hasOpenOwnedFailure ? 'blocked' : 'pass'),
266
- failureOwnership
267
- };
268
- }
269
-
270
- function firstReviewHead(review) {
271
- return [
272
- review.taskReviews?.reviewPacket?.headSha,
273
- review.diffReview?.reviewPacket?.headSha
274
- ].find((value) => typeof value === 'string' && value.length > 0) || '';
275
- }
276
-
277
- function buildReviewFreshness(review) {
278
- if (review.freshness) {
279
- return review.freshness;
280
- }
281
-
282
- const headSha = firstReviewHead(review);
283
- if (!headSha) {
284
- return {
285
- status: 'unknown',
286
- reviewedCommit: '',
287
- currentCommit: '',
288
- commitsSinceReview: null,
289
- staleReason: 'review headSha is not recorded'
290
- };
291
- }
292
-
293
- return {
294
- status: 'fresh',
295
- reviewedCommit: headSha,
296
- currentCommit: headSha,
297
- commitsSinceReview: 0,
298
- staleReason: ''
299
- };
300
- }
301
-
302
- function buildReview(review) {
303
- return {
304
- ...review,
305
- freshness: buildReviewFreshness(review),
306
- qualityScore: review.qualityScore ?? null,
307
- specialistReviews: review.specialistReviews || []
308
- };
309
- }
310
-
311
- function isFindingOpen(item) {
312
- const status = item.status || item.triageStatus || '';
313
- return !['resolved', 'accepted', 'informational', 'accepted-fixed', 'rejected-with-evidence', 'deferred-minor'].includes(status);
314
- }
315
-
316
- function summarizeOpenReviewFindings(findings = []) {
317
- return findings
318
- .filter(isFindingOpen)
319
- .map((item) => `${item.source || 'review'}: ${item.summary || item.evidence || 'open finding'}`);
320
- }
321
-
322
- function collectBlockingFindings({ manifest, quickGates, strictGates, review }) {
323
- const findings = [];
324
-
325
- for (const task of manifest.tasks || []) {
326
- if (task.status === 'failed') {
327
- findings.push(`${task.id}: ${task.lastError || 'task failed'}`);
328
- }
329
- }
330
-
331
- for (const gate of [...quickGates, ...strictGates]) {
332
- if (['fail', 'blocked', 'pending'].includes(gate.status)) {
333
- findings.push(`${gate.name}: ${gate.details || gate.summary || gate.status}`);
334
- }
335
- }
336
-
337
- if (review.status === 'blocked' || review.status === 'fail') {
338
- findings.push(`review: ${review.summary || review.details || review.status}`);
339
- }
340
-
341
- return findings.concat(summarizeOpenReviewFindings(review.findings || []));
342
- }
343
-
344
- function deriveSpecSignals(manifest, verdict, review) {
345
- const spec = manifest.spec || {};
346
- const hasSpec =
347
- Boolean(spec.primaryCapability) ||
348
- (Array.isArray(spec.secondaryCapabilities) && spec.secondaryCapabilities.length > 0) ||
349
- (Array.isArray(spec.specFiles) && spec.specFiles.length > 0);
350
-
351
- if (!hasSpec || review.status === 'blocked') {
352
- return {
353
- specAlignment: 'blocked',
354
- specDeltaVerified: false,
355
- specSyncReady: false
356
- };
357
- }
358
-
359
- if (verdict === 'fail') {
360
- return {
361
- specAlignment: 'fail',
362
- specDeltaVerified: false,
363
- specSyncReady: false
364
- };
365
- }
366
-
367
- return {
368
- specAlignment: 'pass',
369
- specDeltaVerified: true,
370
- specSyncReady: true
371
- };
372
- }
373
-
374
- function main() {
375
- const args = parseArgs(process.argv.slice(2));
376
- if (!args.changeId || !args.manifest || !args.quick || !args.strict || !args.review) {
377
- usage();
378
- process.exit(1);
379
- }
380
-
381
- const manifest = readJson(args.manifest);
382
- const quickGates = readJson(args.quick);
383
- const strictGates = readJson(args.strict);
384
- const review = readJson(args.review);
385
-
386
- const blockingFindings = collectBlockingFindings({
387
- manifest,
388
- quickGates,
389
- strictGates,
390
- review
391
- });
392
- const verdict = deriveVerdict(manifest, quickGates, strictGates, review);
393
- const reroute = deriveReroute({
394
- verdict,
395
- review,
396
- manifest,
397
- blockingFindings
398
- });
399
- const specSignals = deriveSpecSignals(manifest, verdict, review);
400
- const claimEvidence = buildClaimEvidence({
401
- manifest,
402
- quickGates,
403
- strictGates,
404
- review
405
- });
406
- const runtime = buildRuntime(review);
407
- const qa = buildQa(review);
408
- const reviewReport = buildReview(review);
409
-
410
- const report = {
411
- changeId: args.changeId,
412
- verdict,
413
- overall: verdict === 'pass' ? 'pass' : 'fail',
414
- summary: buildSummary({
415
- quickGates,
416
- strictGates,
417
- review,
418
- verdict
419
- }),
420
- specAlignment: specSignals.specAlignment,
421
- specDeltaVerified: specSignals.specDeltaVerified,
422
- specSyncReady: specSignals.specSyncReady,
423
- runtime,
424
- claimEvidence,
425
- qa,
426
- quickGates,
427
- strictGates,
428
- review: reviewReport,
429
- blockingFindings,
430
- gaps: manifest.spec?.newGaps || [],
431
- reroute,
432
- timestamp: args.timestamp || new Date().toISOString()
433
- };
434
-
435
- process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
436
- }
437
-
438
- main();