cc-devflow 4.5.10 → 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 (187) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +23 -0
  2. package/.claude/skills/cc-act/PLAYBOOK.md +17 -269
  3. package/.claude/skills/cc-act/SKILL.md +38 -418
  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 +24 -0
  15. package/.claude/skills/cc-check/PLAYBOOK.md +19 -273
  16. package/.claude/skills/cc-check/SKILL.md +33 -454
  17. package/.claude/skills/cc-check/references/review-contract.md +12 -147
  18. package/.claude/skills/cc-dev/CHANGELOG.md +20 -0
  19. package/.claude/skills/cc-dev/PLAYBOOK.md +1 -1
  20. package/.claude/skills/cc-dev/SKILL.md +52 -130
  21. package/.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh +181 -0
  22. package/.claude/skills/cc-do/CHANGELOG.md +17 -0
  23. package/.claude/skills/cc-do/PLAYBOOK.md +19 -113
  24. package/.claude/skills/cc-do/SKILL.md +39 -236
  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 +23 -0
  31. package/.claude/skills/cc-investigate/PLAYBOOK.md +20 -180
  32. package/.claude/skills/cc-investigate/SKILL.md +65 -513
  33. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +48 -95
  34. package/.claude/skills/cc-investigate/references/investigation-contract.md +14 -217
  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 +29 -0
  39. package/.claude/skills/cc-plan/PLAYBOOK.md +22 -161
  40. package/.claude/skills/cc-plan/SKILL.md +47 -640
  41. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +30 -225
  42. package/.claude/skills/cc-plan/references/planning-contract.md +24 -160
  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 +27 -0
  65. package/README.md +5 -3
  66. package/README.zh-CN.md +5 -3
  67. package/bin/cc-devflow-cli.js +20 -260
  68. package/bin/cc-devflow.js +44 -7
  69. package/docs/commands/README.md +1 -1
  70. package/docs/commands/README.zh-CN.md +1 -1
  71. package/docs/examples/README.md +1 -1
  72. package/docs/examples/START-HERE.md +14 -14
  73. package/docs/examples/example-bindings.json +11 -11
  74. package/docs/examples/full-design-blocked/README.md +4 -6
  75. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/{planning/tasks.md → task.md} +20 -15
  76. package/docs/examples/local-handoff/README.md +8 -11
  77. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/pr-brief.md +31 -0
  78. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/{planning/tasks.md → task.md} +18 -13
  79. package/docs/examples/pdca-loop/README.md +6 -9
  80. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +9 -11
  81. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/{planning/tasks.md → task.md} +18 -13
  82. package/docs/examples/scripts/check-example-bindings.sh +11 -62
  83. package/docs/guides/artifact-contract.md +10 -36
  84. package/docs/guides/getting-started.md +8 -7
  85. package/docs/guides/getting-started.zh-CN.md +8 -7
  86. package/docs/guides/minimize-artifacts.md +16 -116
  87. package/docs/guides/project-postmortem.md +14 -71
  88. package/lib/compiler/__tests__/skills-registry.test.js +9 -8
  89. package/lib/compiler/resource-copier.js +29 -0
  90. package/lib/skill-runtime/__tests__/archive-change.test.js +2 -2
  91. package/lib/skill-runtime/__tests__/benchmark-skills.test.js +109 -0
  92. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +14 -4
  93. package/lib/skill-runtime/errors.js +3 -3
  94. package/lib/skill-runtime/index.js +5 -23
  95. package/lib/skill-runtime/paths.js +5 -52
  96. package/lib/skill-runtime/query-registry.js +4 -4
  97. package/lib/skill-runtime/query.js +89 -201
  98. package/lib/skill-runtime/store.js +4 -40
  99. package/lib/skill-runtime/trace.js +2 -2
  100. package/package.json +5 -7
  101. package/.claude/skills/cc-act/assets/PROJECT_POSTMORTEM_PRINCIPLES_TEMPLATE.md +0 -29
  102. package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +0 -54
  103. package/.claude/skills/cc-act/scripts/generate-status-report.sh +0 -92
  104. package/.claude/skills/cc-act/scripts/sync-act-docs.sh +0 -355
  105. package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +0 -234
  106. package/.claude/skills/cc-check/scripts/render-report-card.js +0 -438
  107. package/.claude/skills/cc-check/scripts/verify-gate.sh +0 -85
  108. package/.claude/skills/cc-do/scripts/build-task-context.sh +0 -175
  109. package/.claude/skills/cc-do/scripts/record-review-decision.sh +0 -88
  110. package/.claude/skills/cc-do/scripts/recover-workflow.sh +0 -82
  111. package/.claude/skills/cc-do/scripts/run-problem-analysis.sh +0 -70
  112. package/.claude/skills/cc-do/scripts/verify-task-gates.sh +0 -109
  113. package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +0 -92
  114. package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +0 -225
  115. package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +0 -179
  116. package/.claude/skills/cc-spec-init/assets/CHANGE_META_TEMPLATE.json +0 -28
  117. package/.claude/skills/cc-spec-init/scripts/validate-spec-links.sh +0 -45
  118. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +0 -234
  119. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +0 -488
  120. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +0 -189
  121. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/resume-index.md +0 -39
  122. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/handoff/status.md +0 -29
  123. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +0 -123
  124. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +0 -292
  125. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +0 -136
  126. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/status.md +0 -29
  127. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +0 -124
  128. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +0 -292
  129. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +0 -136
  130. package/docs/get-shit-done-strategy-audit.md +0 -518
  131. package/docs/skill-runtime-migration.md +0 -46
  132. package/lib/skill-runtime/__tests__/approve.test.js +0 -92
  133. package/lib/skill-runtime/__tests__/autopilot.test.js +0 -253
  134. package/lib/skill-runtime/__tests__/benchmark-artifacts.test.js +0 -165
  135. package/lib/skill-runtime/__tests__/delegation.test.js +0 -97
  136. package/lib/skill-runtime/__tests__/dispatch.test.js +0 -237
  137. package/lib/skill-runtime/__tests__/intent.test.js +0 -203
  138. package/lib/skill-runtime/__tests__/lifecycle.test.js +0 -169
  139. package/lib/skill-runtime/__tests__/planner.tdd.test.js +0 -331
  140. package/lib/skill-runtime/__tests__/prepare-pr.test.js +0 -126
  141. package/lib/skill-runtime/__tests__/query.test.js +0 -860
  142. package/lib/skill-runtime/__tests__/readiness.test.js +0 -53
  143. package/lib/skill-runtime/__tests__/release.test.js +0 -85
  144. package/lib/skill-runtime/__tests__/review-check-integration.test.js +0 -148
  145. package/lib/skill-runtime/__tests__/review-records.test.js +0 -619
  146. package/lib/skill-runtime/__tests__/runtime.integration.test.js +0 -351
  147. package/lib/skill-runtime/__tests__/schemas.test.js +0 -337
  148. package/lib/skill-runtime/__tests__/task-contract-migrate.test.js +0 -137
  149. package/lib/skill-runtime/__tests__/task-contract.test.js +0 -783
  150. package/lib/skill-runtime/__tests__/team-state.test.js +0 -51
  151. package/lib/skill-runtime/__tests__/verify-artifacts.test.js +0 -203
  152. package/lib/skill-runtime/__tests__/worker-run.test.js +0 -275
  153. package/lib/skill-runtime/__tests__/worker.test.js +0 -56
  154. package/lib/skill-runtime/__tests__/workflow-context-legacy-fallback.test.js +0 -31
  155. package/lib/skill-runtime/__tests__/workflow-context.test.js +0 -98
  156. package/lib/skill-runtime/artifacts.js +0 -88
  157. package/lib/skill-runtime/context-index.js +0 -545
  158. package/lib/skill-runtime/delegation.js +0 -533
  159. package/lib/skill-runtime/intent.js +0 -309
  160. package/lib/skill-runtime/lifecycle.js +0 -294
  161. package/lib/skill-runtime/operations/CLAUDE.md +0 -19
  162. package/lib/skill-runtime/operations/approve.js +0 -81
  163. package/lib/skill-runtime/operations/autopilot-core.js +0 -337
  164. package/lib/skill-runtime/operations/autopilot-execution.js +0 -307
  165. package/lib/skill-runtime/operations/autopilot-shared.js +0 -48
  166. package/lib/skill-runtime/operations/autopilot.js +0 -163
  167. package/lib/skill-runtime/operations/dispatch.js +0 -416
  168. package/lib/skill-runtime/operations/init.js +0 -60
  169. package/lib/skill-runtime/operations/janitor.js +0 -61
  170. package/lib/skill-runtime/operations/plan.js +0 -59
  171. package/lib/skill-runtime/operations/prepare-pr.js +0 -25
  172. package/lib/skill-runtime/operations/release.js +0 -99
  173. package/lib/skill-runtime/operations/resume.js +0 -126
  174. package/lib/skill-runtime/operations/review-records.js +0 -265
  175. package/lib/skill-runtime/operations/snapshot.js +0 -45
  176. package/lib/skill-runtime/operations/task-contract.js +0 -524
  177. package/lib/skill-runtime/operations/verify.js +0 -170
  178. package/lib/skill-runtime/operations/worker-run.js +0 -531
  179. package/lib/skill-runtime/operations/worker.js +0 -33
  180. package/lib/skill-runtime/planner.js +0 -539
  181. package/lib/skill-runtime/readiness.js +0 -84
  182. package/lib/skill-runtime/review-records.js +0 -123
  183. package/lib/skill-runtime/review.js +0 -855
  184. package/lib/skill-runtime/schemas.js +0 -746
  185. package/lib/skill-runtime/task-contract.js +0 -187
  186. package/lib/skill-runtime/team-state.js +0 -122
  187. package/lib/skill-runtime/workflow-context.js +0 -748
@@ -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();
@@ -1,85 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 检查验证产物和 report-card 是否齐全
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage: verify-gate.sh --report report-card.json [--require FILE...]
12
- EOF
13
- }
14
-
15
- REPORT=""
16
- requires=()
17
-
18
- while [[ $# -gt 0 ]]; do
19
- case "$1" in
20
- --report) REPORT="$2"; shift 2 ;;
21
- --require) requires+=("$2"); shift 2 ;;
22
- -h|--help) usage; exit 0 ;;
23
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
24
- esac
25
- done
26
-
27
- if [[ -z "$REPORT" || ! -f "$REPORT" ]]; then
28
- usage
29
- exit 1
30
- fi
31
-
32
- jq -e '
33
- .changeId and
34
- .overall and
35
- .verdict and
36
- .summary and
37
- .review and
38
- .blockingFindings and
39
- (.runtime and (.runtime | type == "object")) and
40
- (.runtime.status | IN("pass", "fail", "blocked", "skipped", "pending")) and
41
- ((.runtime.failureOwnership? // []) | type == "array") and
42
- ((.runtime.failureOwnership? // []) | all(.[]; (.classification? // "environment") | IN("in-branch", "pre-existing", "environment", "ambiguous"))) and
43
- (.specAlignment? // "blocked") and
44
- ((.specDeltaVerified? // false) | type == "boolean") and
45
- ((.specSyncReady? // false) | type == "boolean") and
46
- .reroute and
47
- .timestamp and
48
- (.verdict | IN("pass", "fail", "blocked")) and
49
- (.overall | IN("pass", "fail")) and
50
- (.reroute | IN("none", "cc-do", "cc-investigate", "cc-plan")) and
51
- (.review.status | IN("pass", "fail", "blocked", "skipped", "pending")) and
52
- ((.review.freshness? // {"status":"unknown"}) | type == "object") and
53
- ((.review.freshness.status? // "unknown") | IN("fresh", "stale", "unknown", "not-applicable")) and
54
- ((.review.specialistReviews? // []) | type == "array") and
55
- ((.claimEvidence? // []) | type == "array") and
56
- ((.claimEvidence? // []) | all(.[];
57
- (.claim and .requiredProof and .commandOrArtifact and .keyObservation and .status) and
58
- (.status | IN("pass", "fail", "blocked", "skipped", "pending"))
59
- )) and
60
- ((.qa? // {"status":"skipped"}) | type == "object") and
61
- ((.qa.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
62
- ((.qa.coverageAudit? // {"status":"skipped"}) | type == "object") and
63
- ((.qa.coverageAudit.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
64
- ((.qa.browserEvidence? // {"status":"skipped"}) | type == "object") and
65
- ((.qa.browserEvidence.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
66
- ((.qa.feedbackLoop? // {"status":"skipped"}) | type == "object") and
67
- ((.qa.feedbackLoop.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
68
- ((.qa.behaviorEvidence? // {"status":"skipped"}) | type == "object") and
69
- ((.qa.behaviorEvidence.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
70
- ((.qa.architectureFollowUps? // []) | type == "array") and
71
- ((.review.findings? // []) | all(.[]; ((.confidenceScore? // 7) | type == "number") and ((.displayTier? // "info") | IN("blocking", "warning", "info", "suppressed")))) and
72
- ((.verdict != "pass") or ((.review.freshness.status? // "unknown") | IN("fresh", "not-applicable"))) and
73
- ((.verdict != "pass") or ((.qa.feedbackLoop.status? // "skipped") | IN("pass", "skipped"))) and
74
- ((.verdict != "pass") or ((.qa.behaviorEvidence.status? // "skipped") | IN("pass", "skipped"))) and
75
- ((.verdict != "pass") or (((.runtime.failureOwnership? // []) | map(select(((.classification? // "") | IN("in-branch", "ambiguous")) and ((.status? // "open") | IN("open", "pending")))) | length) == 0)) and
76
- ((.verdict == "pass" and .reroute == "none") or (.verdict != "pass" and .reroute != "none"))
77
- ' "$REPORT" >/dev/null
78
-
79
- if (( ${#requires[@]} > 0 )); then
80
- for file in "${requires[@]}"; do
81
- [[ -f "$file" ]] || { echo "Missing required file: $file" >&2; exit 1; }
82
- done
83
- fi
84
-
85
- echo "Gate report is structurally valid"
@@ -1,175 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 组装当前任务的执行上下文,只输出到 stdout
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage:
12
- build-task-context.sh --dir path/to/change --task T001
13
- EOF
14
- }
15
-
16
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
- source "$SCRIPT_DIR/cc-do-common.sh"
18
- REQ_DIR=""
19
- TASK_ID=""
20
-
21
- while [[ $# -gt 0 ]]; do
22
- case "$1" in
23
- --dir) REQ_DIR="$2"; shift 2 ;;
24
- --task) TASK_ID="$(echo "$2" | tr '[:lower:]' '[:upper:]')"; shift 2 ;;
25
- -h|--help) usage; exit 0 ;;
26
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
27
- esac
28
- done
29
-
30
- if [[ -z "$REQ_DIR" || -z "$TASK_ID" || ! -d "$REQ_DIR" ]]; then
31
- usage
32
- exit 1
33
- fi
34
-
35
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
36
- manifest="$(req_do_manifest_path "$CHANGE_DIR")"
37
- design_file="$(req_do_contract_path "$CHANGE_DIR")"
38
- tasks_file="$(req_do_tasks_path "$CHANGE_DIR")"
39
- change_meta="$(req_do_change_meta_path "$CHANGE_DIR")"
40
- resume_index="$(req_do_resume_index_path "$CHANGE_DIR")"
41
-
42
- if [[ ! -f "$manifest" ]]; then
43
- echo "Missing $manifest" >&2
44
- exit 1
45
- fi
46
-
47
- task_json="$(jq -c --arg task "$TASK_ID" '.tasks[] | select(.id == $task)' "$manifest")"
48
- if [[ -z "$task_json" ]]; then
49
- echo "$TASK_ID not found in manifest" >&2
50
- exit 1
51
- fi
52
-
53
- change_id="$(jq -r '.changeId // .requirementId // "REQ-UNKNOWN"' "$manifest")"
54
- ready_json="$("$SCRIPT_DIR/select-ready-tasks.sh" --manifest "$manifest")"
55
-
56
- list_or_none() {
57
- local value="$1"
58
- if [[ -z "${value//$'\n'/}" ]]; then
59
- echo "- None"
60
- else
61
- printf '%s\n' "$value" | sed '/^$/d' | awk '!seen[$0]++' | sed 's/^/- /'
62
- fi
63
- }
64
-
65
- task_title="$(jq -r '.title // ""' <<<"$task_json")"
66
- task_phase="$(jq -r '.phase // 0' <<<"$task_json")"
67
- task_status="$(jq -r '.status // "pending"' <<<"$task_json")"
68
- task_parallel="$(jq -r '.parallel // false' <<<"$task_json")"
69
- task_depends="$(jq -r '(.dependsOn // [])[]?' <<<"$task_json")"
70
- task_touches="$(jq -r '((.touches // .files // [])[]?)' <<<"$task_json")"
71
- task_acceptance="$(jq -r '(.acceptance // [])[]?' <<<"$task_json")"
72
- task_verification="$(jq -r '(.verification // [])[]?' <<<"$task_json")"
73
- task_read_files="$(jq -r '(.context.readFiles // [])[]?' <<<"$task_json")"
74
- task_commands="$(jq -r '(.context.commands // [])[]?' <<<"$task_json")"
75
- task_notes="$(jq -r '(.context.notes // [])[]?' <<<"$task_json")"
76
- completed_tasks="$(jq -r '
77
- .tasks[]
78
- | select((.status // "pending") == "passed" or (.status // "pending") == "completed" or (.status // "pending") == "done" or (.status // "pending") == "verified")
79
- | .id
80
- ' "$manifest")"
81
- ready_tasks="$(echo "$ready_json" | jq -r '.readyTasks[]?.id')"
82
- running_tasks="$(echo "$ready_json" | jq -r '.runningTasks[]?.id')"
83
- active_phase="$(echo "$ready_json" | jq -r '.activePhase // "unknown"')"
84
- spec_source="$manifest"
85
- if [[ -f "$change_meta" ]]; then
86
- spec_source="$change_meta"
87
- fi
88
- primary_capability="$(jq -r '.spec.primaryCapability // empty' "$spec_source" 2>/dev/null || true)"
89
- secondary_capabilities="$(jq -r '(.spec.secondaryCapabilities // [])[]?' "$spec_source" 2>/dev/null || true)"
90
- spec_files="$(jq -r '(.spec.specFiles // [])[]?' "$spec_source" 2>/dev/null || true)"
91
- expected_delta="$(jq -r '(.spec.expectedDelta // [])[]?' "$spec_source" 2>/dev/null || true)"
92
- sync_status="$(jq -r '.spec.syncStatus // "unknown"' "$spec_source" 2>/dev/null || true)"
93
-
94
- {
95
- echo "# Task Context"
96
- echo
97
- echo "- Change: $change_id"
98
- echo "- Task: $TASK_ID"
99
- echo "- Title: $task_title"
100
- echo "- Phase: $task_phase"
101
- echo "- Status: $task_status"
102
- echo "- Parallel eligible: $task_parallel"
103
- echo "- Active phase: $active_phase"
104
- echo
105
- echo "## Current Progress"
106
- echo
107
- echo "### Completed Tasks"
108
- list_or_none "$completed_tasks"
109
- echo
110
- echo "### Running Tasks"
111
- list_or_none "$running_tasks"
112
- echo
113
- echo "### Ready Tasks"
114
- list_or_none "$ready_tasks"
115
- echo
116
- echo "## Dependencies"
117
- echo
118
- list_or_none "$task_depends"
119
- echo
120
- echo "## Touches"
121
- echo
122
- list_or_none "$task_touches"
123
- echo
124
- echo "## Acceptance"
125
- echo
126
- list_or_none "$task_acceptance"
127
- echo
128
- echo "## Verification"
129
- echo
130
- list_or_none "$task_verification"
131
- echo
132
- echo "## Read First"
133
- echo
134
- list_or_none "$task_read_files"
135
- echo
136
- echo "## Commands To Trust"
137
- echo
138
- list_or_none "$task_commands"
139
- echo
140
- echo "## Spec Contract"
141
- echo
142
- echo "- Primary capability: ${primary_capability:-none}"
143
- echo "- Spec sync status: ${sync_status:-unknown}"
144
- echo
145
- echo "### Secondary Capabilities"
146
- list_or_none "$secondary_capabilities"
147
- echo
148
- echo "### Capability Specs"
149
- list_or_none "$spec_files"
150
- echo
151
- echo "### Expected Spec Delta"
152
- list_or_none "$expected_delta"
153
- echo
154
- echo "## Task Notes"
155
- echo
156
- list_or_none "$task_notes"
157
- echo
158
- echo "## Canonical Planning Files"
159
- echo
160
- [[ -f "$design_file" ]] && echo "- ${design_file#$CHANGE_DIR/}"
161
- [[ -f "$tasks_file" ]] && echo "- ${tasks_file#$CHANGE_DIR/}"
162
- [[ -f "$change_meta" ]] && echo "- ${change_meta#$CHANGE_DIR/}"
163
- echo "- planning/task-manifest.json"
164
- echo
165
- echo "## Context Reset"
166
- echo
167
- echo "- If chat context drifts, discard conversational memory and reload only the canonical files above, current Git state, and CLI logs."
168
- echo "- Do not continue from memory if the current task, active phase, or latest verification status cannot be restated exactly."
169
- echo
170
- if [[ -f "$resume_index" ]]; then
171
- echo "## Optional Resume Index"
172
- echo
173
- cat "$resume_index"
174
- fi
175
- }