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,7 +1,7 @@
1
1
  /**
2
2
  * [INPUT]: 接收 query id、repoRoot/changeId 与只读 handler registry。
3
- * [OUTPUT]: 返回 typed query result:ok/data 或 named error,并附 operational trace。
4
- * [POS]: skill runtime 的查询分发表,只读派生已有 artifact,不承载 workflow 语义。
3
+ * [OUTPUT]: 返回 typed query result:ok/data 或 named error,并附 trace。
4
+ * [POS]: skill runtime 的查询分发表,只读派生 task.md Git 语义。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
7
7
 
@@ -59,7 +59,7 @@ function createQueryRegistry(entries) {
59
59
  `Missing required query artifact: ${missingRefs.join(', ')}`,
60
60
  {
61
61
  artifactRefs: missingRefs,
62
- rescueAction: 'create required workflow artifacts before running this query'
62
+ rescueAction: 'create task.md before running this query'
63
63
  }
64
64
  );
65
65
  }
@@ -84,7 +84,7 @@ function createQueryRegistry(entries) {
84
84
  event: `query.${queryId}.failed`,
85
85
  changeId: context.changeId,
86
86
  artifactRefs,
87
- nextAction: error.rescueAction || 'inspect-workflow-artifacts'
87
+ nextAction: error.rescueAction || 'inspect-task-md-and-git-history'
88
88
  })
89
89
  };
90
90
  }
@@ -1,238 +1,126 @@
1
1
  /**
2
- * [INPUT]: 依赖 store/artifacts/lifecycle 读取 requirement 工件,接收 repoRoot、changeId 和可选 changeKey。
3
- * [OUTPUT]: 对外提供 typed query registry 与兼容查询函数,附 named error 和 trace shape
4
- * [POS]: skill runtime 的薄查询兼容层,只读 artifact 与共享 lifecycle 语义,不再自带流程推导副本。
2
+ * [INPUT]: 依赖 task.md、handoff/pr-brief.md Git 状态。
3
+ * [OUTPUT]: 提供 Git-first workflow-context 查询,不读取流程 JSON
4
+ * [POS]: cc-devflow CLI 的只读上下文层;Git 是历史真相,task.md 是任务真相。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
7
7
 
8
- const {
9
- getRuntimeStatePath,
10
- getTaskManifestPath,
11
- getReportCardPath,
12
- exists,
13
- readJson
14
- } = require('./store');
15
- const { getIntentPrBriefPath } = require('./artifacts');
16
- const { deriveManifestExecutionState } = require('./planner');
17
- const {
18
- getApprovalState,
19
- deriveLifecycleStage,
20
- deriveTaskProgress,
21
- isTaskCompletedStatus
22
- } = require('./lifecycle');
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { spawnSync } = require('child_process');
23
11
  const { createQueryRegistry } = require('./query-registry');
24
- const { namedError } = require('./errors');
25
- const { deriveShipReadiness } = require('./readiness');
26
- const {
27
- getWorkflowContext,
28
- getWorkflowContextArtifactRefs,
29
- getWorkflowContextRequiredArtifactRefs
30
- } = require('./workflow-context');
31
-
32
- async function readQueryArtifact(filePath, { required = true } = {}) {
33
- try {
34
- const value = await readJson(filePath, null);
35
-
36
- if (required && value === null) {
37
- throw namedError(
38
- 'MissingQueryArtifactError',
39
- `Missing required query artifact: ${filePath}`,
40
- {
41
- artifactRefs: [filePath],
42
- rescueAction: 'create required workflow artifacts before running this query'
43
- }
44
- );
45
- }
46
-
47
- return value;
48
- } catch (error) {
49
- if (error.name === 'MissingQueryArtifactError') {
50
- throw error;
51
- }
12
+ const { getChangePaths } = require('./paths');
13
+ const { createTrace } = require('./trace');
52
14
 
53
- throw namedError(
54
- 'InvalidQueryArtifactError',
55
- `Invalid query artifact ${filePath}: ${error.message}`,
56
- {
57
- artifactRefs: [filePath],
58
- rescueAction: 'repair or regenerate the invalid workflow artifact before running this query',
59
- details: {
60
- cause: error.name || 'Error'
61
- }
62
- }
63
- );
64
- }
15
+ function readTextIfExists(filePath) {
16
+ return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : null;
65
17
  }
66
18
 
67
- /**
68
- * 获取任务进度统计
69
- * @param {string} repoRoot - 仓库根目录
70
- * @param {string} changeId - 需求 ID
71
- * @returns {Promise<Object>} 进度统计对象
72
- */
73
- async function getProgress(repoRoot, changeId, options = {}) {
74
- const manifestPath = getTaskManifestPath(repoRoot, changeId, options);
75
- const manifest = await readQueryArtifact(manifestPath);
76
- return deriveTaskProgress(manifest.tasks || []);
77
- }
19
+ function runGit(repoRoot, args) {
20
+ const result = spawnSync('git', args, {
21
+ cwd: repoRoot,
22
+ encoding: 'utf8'
23
+ });
78
24
 
79
- /**
80
- * 获取下一个待执行的任务
81
- * @param {string} repoRoot - 仓库根目录
82
- * @param {string} changeId - 需求 ID
83
- * @returns {Promise<Object|null>} 下一个任务对象或 null
84
- */
85
- async function getNextTask(repoRoot, changeId, options = {}) {
86
- const manifestPath = getTaskManifestPath(repoRoot, changeId, options);
87
- const manifest = await readQueryArtifact(manifestPath);
88
- const executionState = deriveManifestExecutionState(manifest.tasks || []);
89
- const activePhase = executionState.activePhase;
90
- const completedIds = new Set(
91
- (manifest.tasks || [])
92
- .filter((task) => isTaskCompletedStatus(task.status))
93
- .map((task) => task.id)
94
- );
95
- const currentTaskId = manifest.currentTaskId ?? executionState.currentTaskId;
96
-
97
- if (currentTaskId) {
98
- const currentTask = manifest.tasks.find((task) => task.id === currentTaskId);
99
- if (currentTask && currentTask.status === 'pending') {
100
- return currentTask;
101
- }
25
+ if (result.status !== 0) {
26
+ return null;
102
27
  }
103
28
 
104
- const nextTask = (manifest.tasks || []).find((task) => {
105
- if (task.status !== 'pending') {
106
- return false;
107
- }
29
+ return result.stdout.trim();
30
+ }
108
31
 
109
- if (activePhase !== null && activePhase !== undefined && (task.phase || 1) !== activePhase) {
110
- return false;
111
- }
32
+ function parseTaskSummary(markdown) {
33
+ const lines = String(markdown || '').split(/\r?\n/);
34
+ const tasks = [];
112
35
 
113
- return (task.dependsOn || []).every((depId) => completedIds.has(depId));
114
- });
36
+ for (const line of lines) {
37
+ const match = line.match(/^\s*-\s+\[( |x|X)\]\s+((?:T\d+|[A-Z]+-\d+)[^:\n]*)(?::\s*)?(.*)$/);
38
+ if (!match) continue;
115
39
 
116
- return nextTask || null;
117
- }
40
+ tasks.push({
41
+ id: match[2].trim().split(/\s+/)[0],
42
+ title: (match[3] || match[2]).trim(),
43
+ status: match[1].toLowerCase() === 'x' ? 'done' : 'pending'
44
+ });
45
+ }
118
46
 
119
- /**
120
- * 获取完整的聚合状态视图
121
- * @param {string} repoRoot - 仓库根目录
122
- * @param {string} changeId - 需求 ID
123
- * @returns {Promise<Object>} 完整状态对象
124
- */
125
- async function getFullState(repoRoot, changeId, options = {}) {
126
- const statePath = getRuntimeStatePath(repoRoot, changeId, options);
127
- const reportPath = getReportCardPath(repoRoot, changeId, options);
128
- const prBriefPath = getIntentPrBriefPath(repoRoot, changeId, options);
129
-
130
- const [state, manifest, hasPrBrief] = await Promise.all([
131
- readQueryArtifact(statePath),
132
- readQueryArtifact(getTaskManifestPath(repoRoot, changeId, options)),
133
- exists(prBriefPath)
134
- ]);
135
- const progress = await getProgress(repoRoot, changeId, options);
136
- const nextTask = await getNextTask(repoRoot, changeId, options);
137
- const report = await readQueryArtifact(reportPath, { required: false });
47
+ const completed = tasks.filter((task) => task.status === 'done').length;
48
+ const next = tasks.find((task) => task.status === 'pending') || null;
138
49
 
139
50
  return {
140
- lifecycle: {
141
- changeId: state.changeId,
142
- goal: state.goal,
143
- status: state.status,
144
- initializedAt: state.initializedAt,
145
- plannedAt: state.plannedAt,
146
- verifiedAt: state.verifiedAt,
147
- releasedAt: state.releasedAt,
148
- updatedAt: state.updatedAt,
149
- stage: deriveLifecycleStage({ state, manifest, report, hasPrBrief }),
150
- approval: getApprovalState(state, manifest)
151
- },
152
- progress,
153
- nextTask,
154
- delivery: {
155
- prBriefPath: hasPrBrief ? prBriefPath : null
156
- },
157
- quality: report ? {
158
- overall: report.overall,
159
- verdict: report.verdict || (report.overall === 'pass' ? 'pass' : 'fail'),
160
- reviewStatus: report.review?.status || 'skipped',
161
- reviewFindings: (report.review?.findings || []).length,
162
- blockingFindings: report.blockingFindings,
163
- timestamp: report.timestamp
164
- } : null
51
+ total: tasks.length,
52
+ completed,
53
+ pending: tasks.length - completed,
54
+ next
165
55
  };
166
56
  }
167
57
 
168
- async function getShipReadiness(repoRoot, changeId, options = {}) {
169
- const reportPath = getReportCardPath(repoRoot, changeId, options);
170
- const report = await readJson(reportPath, null);
171
-
172
- if (!report) {
173
- throw namedError(
174
- 'MissingReportCardError',
175
- `Missing report card for ${changeId}`,
176
- {
177
- artifactRefs: [reportPath],
178
- rescueAction: 'run cc-check and create review/report-card.json before cc-act'
179
- }
180
- );
181
- }
58
+ function getWorkflowContextArtifactRefs(repoRoot, changeId, options = {}) {
59
+ const change = getChangePaths(repoRoot, changeId, options);
60
+ return [
61
+ path.join(change.changeDir, 'task.md'),
62
+ path.join(change.handoffDir, 'pr-brief.md')
63
+ ];
64
+ }
182
65
 
183
- return deriveShipReadiness(report, { reportPath });
66
+ function getWorkflowContextRequiredArtifactRefs(repoRoot, changeId, options = {}) {
67
+ const change = getChangePaths(repoRoot, changeId, options);
68
+ return [path.join(change.changeDir, 'task.md')];
184
69
  }
185
70
 
186
- function queryArtifactRefs(repoRoot, changeId, names, options = {}) {
187
- const refs = {
188
- manifest: getTaskManifestPath(repoRoot, changeId, options),
189
- state: getRuntimeStatePath(repoRoot, changeId, options),
190
- report: getReportCardPath(repoRoot, changeId, options),
191
- prBrief: getIntentPrBriefPath(repoRoot, changeId, options)
192
- };
71
+ async function getWorkflowContext(repoRoot, changeId, options = {}) {
72
+ const change = getChangePaths(repoRoot, changeId, options);
73
+ const taskPath = path.join(change.changeDir, 'task.md');
74
+ const prBriefPath = path.join(change.handoffDir, 'pr-brief.md');
75
+ const taskMarkdown = readTextIfExists(taskPath) || '';
76
+ const taskSummary = parseTaskSummary(taskMarkdown);
193
77
 
194
- return names.map((name) => refs[name]).filter(Boolean);
78
+ const branch = runGit(repoRoot, ['branch', '--show-current']) || '';
79
+ const head = runGit(repoRoot, ['rev-parse', '--short', 'HEAD']) || '';
80
+ const status = runGit(repoRoot, ['status', '--short']) || '';
81
+ const recentCommits = runGit(repoRoot, ['log', '--oneline', '-5']) || '';
82
+
83
+ return {
84
+ changeId,
85
+ changeKey: change.changeKey,
86
+ nextAction: {
87
+ skill: taskSummary.next ? 'cc-do' : 'cc-check',
88
+ taskId: taskSummary.next ? taskSummary.next.id : null
89
+ },
90
+ files: {
91
+ task: taskPath,
92
+ prBrief: fs.existsSync(prBriefPath) ? prBriefPath : null
93
+ },
94
+ taskSummary,
95
+ git: {
96
+ branch,
97
+ head,
98
+ dirty: status.length > 0,
99
+ status: status ? status.split(/\r?\n/) : [],
100
+ recentCommits: recentCommits ? recentCommits.split(/\r?\n/) : []
101
+ }
102
+ };
195
103
  }
196
104
 
197
105
  const registry = createQueryRegistry([
198
- {
199
- id: 'progress',
200
- artifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['manifest'], { changeKey }),
201
- requiredArtifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['manifest'], { changeKey }),
202
- handler: ({ repoRoot, changeId, changeKey }) => getProgress(repoRoot, changeId, { changeKey })
203
- },
204
- {
205
- id: 'next-task',
206
- artifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['manifest'], { changeKey }),
207
- requiredArtifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['manifest'], { changeKey }),
208
- handler: ({ repoRoot, changeId, changeKey }) => getNextTask(repoRoot, changeId, { changeKey })
209
- },
210
- {
211
- id: 'full-state',
212
- artifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['state', 'manifest', 'report', 'prBrief'], { changeKey }),
213
- requiredArtifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['state', 'manifest'], { changeKey }),
214
- handler: ({ repoRoot, changeId, changeKey }) => getFullState(repoRoot, changeId, { changeKey })
215
- },
216
- {
217
- id: 'ship-readiness',
218
- artifactRefs: ({ repoRoot, changeId, changeKey }) => queryArtifactRefs(repoRoot, changeId, ['report'], { changeKey }),
219
- handler: ({ repoRoot, changeId, changeKey }) => getShipReadiness(repoRoot, changeId, { changeKey })
220
- },
221
106
  {
222
107
  id: 'workflow-context',
223
- artifactRefs: ({ repoRoot, changeId, changeKey }) => getWorkflowContextArtifactRefs(repoRoot, changeId, { changeKey }),
224
- requiredArtifactRefs: ({ repoRoot, changeId, changeKey }) => getWorkflowContextRequiredArtifactRefs(repoRoot, changeId, { changeKey }),
225
- nextAction: 'read-compact-workflow-context',
108
+ artifactRefs: ({ repoRoot, changeId, changeKey }) => (
109
+ getWorkflowContextArtifactRefs(repoRoot, changeId, { changeKey })
110
+ ),
111
+ requiredArtifactRefs: ({ repoRoot, changeId, changeKey }) => (
112
+ getWorkflowContextRequiredArtifactRefs(repoRoot, changeId, { changeKey })
113
+ ),
114
+ nextAction: 'read-task-md-and-git-history',
226
115
  handler: ({ repoRoot, changeId, changeKey }) => getWorkflowContext(repoRoot, changeId, { changeKey })
227
116
  }
228
117
  ]);
229
118
 
230
119
  module.exports = {
231
- getProgress,
232
- getNextTask,
233
- getFullState,
234
- getShipReadiness,
235
120
  getWorkflowContext,
121
+ getWorkflowContextArtifactRefs,
122
+ getWorkflowContextRequiredArtifactRefs,
236
123
  listQueryIds: registry.listQueryIds,
237
- runQuery: registry.runQuery
124
+ runQuery: registry.runQuery,
125
+ createTrace
238
126
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * [INPUT]: 依赖 fs/path/child_process,依赖调用方提供 changeId 与命令参数。
3
- * [OUTPUT]: 对外提供 shared runtime 路径约定、JSON/文本读写、删除、JSONL 追加与命令执行工具。
4
- * [POS]: skill runtime 的数据与 IO 基础设施层,被全部 operations 复用。
3
+ * [OUTPUT]: 对外提供 shared path、文本读写与命令执行工具。
4
+ * [POS]: skill runtime 的轻量 IO 层,不承载流程 JSON 契约。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
7
7
 
@@ -12,8 +12,7 @@ const { spawn } = require('child_process');
12
12
  const {
13
13
  getDevflowRoot,
14
14
  getChangesRoot,
15
- getChangePaths,
16
- getTaskPaths
15
+ getChangePaths
17
16
  } = require('./paths');
18
17
 
19
18
  function nowIso() {
@@ -44,42 +43,14 @@ function getChangeDir(repoRoot, changeId, options = {}) {
44
43
  return getChangePaths(repoRoot, changeId, options).changeDir;
45
44
  }
46
45
 
47
- function getTaskManifestPath(repoRoot, changeId, options = {}) {
48
- return path.join(getChangePaths(repoRoot, changeId, options).planningDir, 'task-manifest.json');
49
- }
50
-
51
- function getReportCardPath(repoRoot, changeId, options = {}) {
52
- return path.join(getChangePaths(repoRoot, changeId, options).reviewDir, 'report-card.json');
53
- }
54
-
55
- function getReleaseNotePath(repoRoot, changeId, options = {}) {
56
- return path.join(getChangePaths(repoRoot, changeId, options).handoffDir, 'release-note.md');
57
- }
58
-
59
- function getRuntimeStatePath(repoRoot, changeId, options = {}) {
60
- return path.join(getChangePaths(repoRoot, changeId, options).metaDir, 'change-state.json');
61
- }
62
-
63
46
  function getTasksMarkdownPath(repoRoot, changeId, options = {}) {
64
- return path.join(getChangePaths(repoRoot, changeId, options).planningDir, 'tasks.md');
47
+ return path.join(getChangePaths(repoRoot, changeId, options).changeDir, 'task.md');
65
48
  }
66
49
 
67
50
  function getRuntimeRoot(repoRoot) {
68
51
  return getChangesRoot(repoRoot);
69
52
  }
70
53
 
71
- function getRuntimeChangeDir(repoRoot, changeId, options = {}) {
72
- return getChangePaths(repoRoot, changeId, options).executionDir;
73
- }
74
-
75
- function getRuntimeTaskDir(repoRoot, changeId, taskId, options = {}) {
76
- return getTaskPaths(repoRoot, changeId, taskId, options).taskDir;
77
- }
78
-
79
- function getEventsPath(repoRoot, changeId, taskId, options = {}) {
80
- return getTaskPaths(repoRoot, changeId, taskId, options).eventsPath;
81
- }
82
-
83
54
  async function exists(filePath) {
84
55
  try {
85
56
  await fsp.access(filePath);
@@ -222,15 +193,8 @@ module.exports = {
222
193
  nowIso,
223
194
  resolveRepoRoot,
224
195
  getChangeDir,
225
- getTaskManifestPath,
226
- getReportCardPath,
227
- getReleaseNotePath,
228
- getRuntimeStatePath,
229
196
  getTasksMarkdownPath,
230
197
  getRuntimeRoot,
231
- getRuntimeChangeDir,
232
- getRuntimeTaskDir,
233
- getEventsPath,
234
198
  exists,
235
199
  ensureDir,
236
200
  readText,
@@ -1,6 +1,6 @@
1
1
  /**
2
- * [INPUT]: 接收 query/doctor/preflight 的事件名、artifact refs 与下一动作。
3
- * [OUTPUT]: 生成统一 trace shape,供恢复、排查和 report-card 引用。
2
+ * [INPUT]: 接收 query/doctor/preflight 的事件名、refs 与下一动作。
3
+ * [OUTPUT]: 生成统一 trace shape,供排查和上下文读取使用。
4
4
  * [POS]: skill runtime 的 operational trace 层,不承载 workflow 决策。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-devflow",
3
- "version": "4.5.10",
3
+ "version": "4.5.12",
4
4
  "description": "Multi-platform CLI and skill pack for agent coding",
5
5
  "main": "bin/cc-devflow.js",
6
6
  "bin": {
@@ -44,12 +44,10 @@
44
44
  "scripts": {
45
45
  "prepublishOnly": "node scripts/validate-publish.js",
46
46
  "test": "jest",
47
- "verify": "npm test && npm run verify:examples && npm run verify:artifacts",
48
- "verify:examples": "bash docs/examples/scripts/check-example-bindings.sh",
49
- "verify:artifacts": "node scripts/verify-artifacts.js",
50
- "verify:publish": "node scripts/validate-publish.js",
51
- "benchmark:artifacts": "node scripts/benchmark-artifacts.js",
52
- "benchmark:workflow-context": "node scripts/benchmark-workflow-context-tokens.js",
47
+ "verify": "npm test && npm run verify:examples && npm run benchmark:skills",
48
+ "verify:examples": "bash docs/examples/scripts/check-example-bindings.sh",
49
+ "verify:publish": "node scripts/validate-publish.js",
50
+ "benchmark:skills": "node scripts/benchmark-skills.js",
53
51
  "start": "node bin/cc-devflow.js",
54
52
  "adapt": "node bin/adapt.js",
55
53
  "adapt:check": "node bin/adapt.js --check",
@@ -1,29 +0,0 @@
1
- # Project Postmortem Principles
2
-
3
- This file stores generalized lessons extracted from concrete incidents. Keep each
4
- principle short enough to scan, but cite the incident file and Git evidence that
5
- made it real.
6
-
7
- ## Principles
8
-
9
- ### PM-P001 <principle title>
10
-
11
- - Failure class:
12
- - Model limitation or professional judgment trap:
13
- - Rule:
14
- - Countermeasure before planning:
15
- - Countermeasure before coding:
16
- - Countermeasure before shipping:
17
- - Evidence:
18
- - Incident: `devflow/postmortems/incidents/<date>-<change-key>.md`
19
- - Git: `<commit-or-range>`
20
- - Search terms:
21
-
22
- ## Candidate Principles
23
-
24
- Use this section for patterns that appeared once but are not yet strong enough to
25
- be promoted.
26
-
27
- | Candidate | Evidence | Promotion trigger |
28
- | --- | --- | --- |
29
- | | | repeats, high severity, or architecture-wide impact |
@@ -1,54 +0,0 @@
1
- # Release Note
2
-
3
- ## Document Meta
4
-
5
- - Output language:
6
-
7
- ## Release Scope
8
-
9
- - Why a release note is needed now:
10
-
11
- ## User Impact
12
-
13
- -
14
-
15
- ## What Is New
16
-
17
- -
18
-
19
- ## Verification
20
-
21
- -
22
-
23
- ## Rollback Guard
24
-
25
- - Safe state:
26
- - Rollback command / manual steps:
27
- - Side effects:
28
- - Owner:
29
-
30
- ## QA Behavior Evidence
31
-
32
- - Feedback loop:
33
- - User-visible behavior:
34
- - Reproduction / verification path:
35
-
36
- ## Ops Notes
37
-
38
- -
39
-
40
- ## Roadmap Progress
41
-
42
- - Source RM:
43
- - Status after sync:
44
- - Progress after sync:
45
- - Follow-up writeback:
46
- - No-op reason:
47
-
48
- ## Follow-Ups
49
-
50
- - Current behavior:
51
- - Desired behavior:
52
- - Acceptance criteria:
53
- - Out of scope:
54
- - Learning extraction target:
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # cc-act: 汇总 requirement 当前 gate 与 ship 状态
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage: generate-status-report.sh --dir path/to/change
12
- EOF
13
- }
14
-
15
- REQ_DIR=""
16
- while [[ $# -gt 0 ]]; do
17
- case "$1" in
18
- --dir) REQ_DIR="$2"; shift 2 ;;
19
- -h|--help) usage; exit 0 ;;
20
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
21
- esac
22
- done
23
-
24
- if [[ -z "$REQ_DIR" || ! -d "$REQ_DIR" ]]; then
25
- usage
26
- exit 1
27
- fi
28
-
29
- script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
30
- source "$script_dir/cc-act-common.sh"
31
- CHANGE_DIR="$(req_act_change_dir "$REQ_DIR")"
32
- report_card="$(req_act_report_path "$CHANGE_DIR")"
33
- tasks_file="$(req_act_tasks_path "$CHANGE_DIR")"
34
- manifest="$(req_act_manifest_path "$CHANGE_DIR")"
35
- handoff_dir="$(req_act_handoff_dir "$CHANGE_DIR")"
36
-
37
- verdict="unknown"
38
- reroute="unknown"
39
- evidence_count="0"
40
- gap_count="0"
41
-
42
- if [[ -f "$report_card" ]]; then
43
- verdict="$(jq -r '.verdict // "unknown"' "$report_card" 2>/dev/null || echo unknown)"
44
- reroute="$(jq -r '.reroute // "unknown"' "$report_card" 2>/dev/null || echo unknown)"
45
- evidence_count="$(jq -r '(.evidence // []) | length' "$report_card" 2>/dev/null || echo 0)"
46
- gap_count="$(jq -r '(.gaps // []) | length' "$report_card" 2>/dev/null || echo 0)"
47
- fi
48
-
49
- remaining_tasks="0"
50
- done_tasks="0"
51
- if [[ -f "$tasks_file" ]]; then
52
- remaining_tasks="$(awk '/^- \[ \]/{c++} END{print c+0}' "$tasks_file" 2>/dev/null || echo 0)"
53
- done_tasks="$(awk '/^- \[[xX]\]/{c++} END{print c+0}' "$tasks_file" 2>/dev/null || echo 0)"
54
- fi
55
-
56
- ship_context="$("$script_dir/detect-ship-target.sh" 2>/dev/null || true)"
57
- current_branch="$(printf '%s\n' "$ship_context" | awk -F= '/^CURRENT_BRANCH=/{print $2}')"
58
- branch_state="$(printf '%s\n' "$ship_context" | awk -F= '/^BRANCH_STATE=/{print $2}')"
59
- branch_rescue="$(printf '%s\n' "$ship_context" | awk -F= '/^BRANCH_RESCUE=/{print $2}')"
60
- rescue_action="$(printf '%s\n' "$ship_context" | awk -F= '/^RESCUE_ACTION=/{print $2}')"
61
- base_branch="$(printf '%s\n' "$ship_context" | awk -F= '/^BASE_BRANCH=/{print $2}')"
62
- platform="$(printf '%s\n' "$ship_context" | awk -F= '/^PLATFORM=/{print $2}')"
63
- decision_hint="$(printf '%s\n' "$ship_context" | awk -F= '/^DECISION_HINT=/{print $2}')"
64
- pr_status="$(printf '%s\n' "$ship_context" | awk -F= '/^PR_STATUS=/{print $2}')"
65
- pr_url="$(printf '%s\n' "$ship_context" | awk -F= '/^PR_URL=/{print $2}')"
66
- roadmap_sync_summary="$(req_act_roadmap_sync_summary "$manifest")"
67
-
68
- {
69
- echo "# Status Report"
70
- echo
71
- echo "- Change dir: $CHANGE_DIR"
72
- echo "- Check result: $verdict"
73
- echo "- Gate reroute: $reroute"
74
- echo "- Evidence items: $evidence_count"
75
- echo "- Open gaps: $gap_count"
76
- echo "- Completed tasks: $done_tasks"
77
- echo "- Remaining tasks: $remaining_tasks"
78
- [[ -n "$current_branch" ]] && echo "- Current branch: $current_branch"
79
- [[ -n "$branch_state" ]] && echo "- Branch state: $branch_state"
80
- [[ -n "$base_branch" ]] && echo "- Base branch: $base_branch"
81
- [[ -n "$platform" ]] && echo "- Platform: $platform"
82
- [[ -n "$decision_hint" ]] && echo "- Ship mode hint: $decision_hint"
83
- [[ -n "$branch_rescue" && "$branch_rescue" != "none" ]] && echo "- Branch rescue: $branch_rescue"
84
- [[ -n "$rescue_action" ]] && echo "- Rescue action: $rescue_action"
85
- [[ -n "$pr_status" ]] && echo "- PR status: $pr_status"
86
- [[ -n "$pr_url" ]] && echo "- PR url: $pr_url"
87
- echo "- Roadmap progress: $roadmap_sync_summary"
88
- [[ -f "$handoff_dir/pr-brief.md" ]] && echo "- PR brief: ready"
89
- [[ -f "$handoff_dir/release-note.md" ]] && echo "- Release note: ready"
90
- [[ -f "$handoff_dir/resume-index.md" ]] && echo "- Resume index: ready"
91
- [[ -f "$handoff_dir/doc-sync-report.md" ]] && echo "- Doc sync report: ready"
92
- }