cc-devflow 4.5.11 → 4.5.13

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 +23 -0
  50. package/.claude/skills/cc-review/PLAYBOOK.md +13 -86
  51. package/.claude/skills/cc-review/SKILL.md +67 -238
  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 +21 -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,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.11",
3
+ "version": "4.5.13",
4
4
  "description": "Multi-platform CLI and skill pack for agent coding",
5
5
  "main": "bin/cc-devflow.js",
6
6
  "bin": {
@@ -44,13 +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 && npm run benchmark:skills",
47
+ "verify": "npm test && npm run verify:examples && npm run benchmark:skills",
48
48
  "verify:examples": "bash docs/examples/scripts/check-example-bindings.sh",
49
- "verify:artifacts": "node scripts/verify-artifacts.js",
50
49
  "verify:publish": "node scripts/validate-publish.js",
51
- "benchmark:artifacts": "node scripts/benchmark-artifacts.js",
52
50
  "benchmark:skills": "node scripts/benchmark-skills.js",
53
- "benchmark:workflow-context": "node scripts/benchmark-workflow-context-tokens.js",
54
51
  "start": "node bin/cc-devflow.js",
55
52
  "adapt": "node bin/adapt.js",
56
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
- }
@@ -1,355 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # cc-act: 同步 requirement 级文档,并产出 doc sync 报告
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage: sync-act-docs.sh --dir path/to/change [--repo-root path/to/repo]
12
- EOF
13
- }
14
-
15
- REQ_DIR=""
16
- REPO_ROOT=""
17
-
18
- while [[ $# -gt 0 ]]; do
19
- case "$1" in
20
- --dir) REQ_DIR="$2"; shift 2 ;;
21
- --repo-root) REPO_ROOT="$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 "$REQ_DIR" || ! -d "$REQ_DIR" ]]; then
28
- usage
29
- exit 1
30
- fi
31
-
32
- if [[ -z "$REPO_ROOT" ]]; then
33
- REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
34
- fi
35
-
36
- script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
37
- source "$script_dir/cc-act-common.sh"
38
- CHANGE_DIR="$(req_act_change_dir "$REQ_DIR")"
39
- report_card="$(req_act_report_path "$CHANGE_DIR")"
40
- manifest="$(req_act_manifest_path "$CHANGE_DIR")"
41
- tasks_file="$(req_act_tasks_path "$CHANGE_DIR")"
42
- design_file="$(req_act_contract_path "$CHANGE_DIR")"
43
- resume_index="$(req_act_resume_index_path "$CHANGE_DIR")"
44
- release_note="$(req_act_release_note_path "$CHANGE_DIR")"
45
- doc_sync_report="$(req_act_doc_sync_report_path "$CHANGE_DIR")"
46
-
47
- "$script_dir/verify-act-gate.sh" --dir "$CHANGE_DIR" >/dev/null
48
- mkdir -p "$(dirname "$resume_index")"
49
-
50
- ship_context="$("$script_dir/detect-ship-target.sh" 2>/dev/null || true)"
51
- current_branch="$(req_act_ship_field "$ship_context" "CURRENT_BRANCH")"
52
- branch_state="$(req_act_ship_field "$ship_context" "BRANCH_STATE")"
53
- branch_rescue="$(req_act_ship_field "$ship_context" "BRANCH_RESCUE")"
54
- rescue_action="$(req_act_ship_field "$ship_context" "RESCUE_ACTION")"
55
- base_branch="$(req_act_ship_field "$ship_context" "BASE_BRANCH")"
56
- ship_mode="$(req_act_ship_field "$ship_context" "DECISION_HINT")"
57
- pr_status="$(req_act_ship_field "$ship_context" "PR_STATUS")"
58
- pr_url="$(req_act_ship_field "$ship_context" "PR_URL")"
59
-
60
- timestamp="$(date '+%Y-%m-%d %H:%M:%S %z')"
61
- requirement_id="$(req_act_requirement_id "$manifest" "$CHANGE_DIR")"
62
- report_summary="$(req_act_report_summary "$report_card")"
63
- report_verdict="$(req_act_report_verdict "$report_card")"
64
- spec_sync_ready="$(req_act_spec_sync_ready "$report_card")"
65
- output_language="$(req_act_output_language "$report_card")"
66
- design_goal="$(req_act_design_goal "$design_file")"
67
- main_risk="$(req_act_main_risk "$design_file")"
68
- roadmap_sync_summary="$(req_act_roadmap_sync_summary "$manifest" "$REPO_ROOT")"
69
-
70
- tmp_changed="$(mktemp)"
71
- tmp_verify="$(mktemp)"
72
- tmp_followups="$(mktemp)"
73
- tmp_touched="$(mktemp)"
74
- tmp_specs="$(mktemp)"
75
- tmp_claude="$(mktemp)"
76
- tmp_readme="$(mktemp)"
77
- cleanup() {
78
- rm -f "$tmp_changed" "$tmp_verify" "$tmp_followups" "$tmp_touched" "$tmp_specs" "$tmp_claude" "$tmp_readme"
79
- }
80
- trap cleanup EXIT
81
-
82
- # ------------------------------------------------------------
83
- # 共享提取:变更 / 验证 / follow-up / touched
84
- # ------------------------------------------------------------
85
- req_act_collect_completed_titles "$manifest" "$tasks_file" "$tmp_changed"
86
- req_act_collect_verification_commands "$manifest" "$tmp_verify"
87
- req_act_collect_followups "$report_card" "$manifest" "$tmp_followups"
88
- req_act_collect_touched_files "$manifest" "$tmp_touched"
89
- req_act_collect_spec_files "$manifest" "$tmp_specs"
90
-
91
- nearest_claude() {
92
- local rel="$1"
93
- local dir candidate
94
-
95
- if [[ -z "$rel" ]]; then
96
- return 0
97
- fi
98
-
99
- dir="$(dirname "$rel")"
100
- while :; do
101
- if [[ "$dir" == "." ]]; then
102
- candidate="$REPO_ROOT/CLAUDE.md"
103
- else
104
- candidate="$REPO_ROOT/$dir/CLAUDE.md"
105
- fi
106
- if [[ -f "$candidate" ]]; then
107
- printf '%s\n' "${candidate#$REPO_ROOT/}"
108
- return 0
109
- fi
110
- if [[ "$dir" == "." || "$dir" == "/" ]]; then
111
- break
112
- fi
113
- dir="$(dirname "$dir")"
114
- done
115
-
116
- if [[ -f "$REPO_ROOT/CLAUDE.md" ]]; then
117
- printf '%s\n' "CLAUDE.md"
118
- fi
119
- }
120
-
121
- while IFS= read -r touched; do
122
- nearest_claude "$touched" >> "$tmp_claude" || true
123
- done < "$tmp_touched"
124
- awk 'NF && !seen[$0]++' "$tmp_claude" > "${tmp_claude}.dedup"
125
- mv "${tmp_claude}.dedup" "$tmp_claude"
126
-
127
- find "$REPO_ROOT" -maxdepth 2 -type f \( -iname 'README.md' -o -iname 'README*.md' \) \
128
- -print 2>/dev/null | sed "s|^$REPO_ROOT/||" | awk '!seen[$0]++' > "$tmp_readme" || true
129
-
130
- # ------------------------------------------------------------
131
- # 生成 release note
132
- # ------------------------------------------------------------
133
- {
134
- echo "# Release Note"
135
- echo
136
- echo "## Document Meta"
137
- echo
138
- echo "- Output language: $output_language"
139
- echo
140
- echo "## User Impact"
141
- if [[ -n "$report_summary" ]]; then
142
- echo
143
- echo "- $report_summary"
144
- fi
145
- if [[ -n "$design_goal" && "$design_goal" != "$report_summary" ]]; then
146
- echo "- $design_goal"
147
- fi
148
- if [[ ! -s "$tmp_changed" && -z "$report_summary" && -z "$design_goal" ]]; then
149
- echo
150
- echo "- No user-facing summary captured yet."
151
- fi
152
- echo
153
- echo "## What Is New"
154
- if [[ -s "$tmp_changed" ]]; then
155
- while IFS= read -r line; do
156
- echo "- $line"
157
- done < "$tmp_changed"
158
- else
159
- echo
160
- echo "- No completed task list captured yet."
161
- fi
162
- echo
163
- echo "## Verification"
164
- echo
165
- echo "- CC-Check verdict: $report_verdict"
166
- jq -r '(.evidence // [])[]?' "$report_card" 2>/dev/null | sed '/^$/d' | while IFS= read -r line; do
167
- echo "- $line"
168
- done
169
- if [[ -s "$tmp_verify" ]]; then
170
- while IFS= read -r cmd; do
171
- echo "- Verify with: \`$cmd\`"
172
- done < "$tmp_verify"
173
- fi
174
- echo
175
- echo "## Ops Notes"
176
- echo
177
- echo "- Ship mode: $ship_mode"
178
- [[ -n "$branch_state" ]] && echo "- Branch state: $branch_state"
179
- echo "- Spec sync ready: $spec_sync_ready"
180
- echo "- Current branch: ${current_branch:-unknown}"
181
- echo "- Base branch: ${base_branch:-unknown}"
182
- [[ -n "$branch_rescue" && "$branch_rescue" != "none" ]] && echo "- Branch rescue: $branch_rescue"
183
- [[ -n "$rescue_action" ]] && echo "- Rescue action: $rescue_action"
184
- [[ -n "$pr_status" ]] && echo "- PR status: $pr_status"
185
- [[ -n "$pr_url" ]] && echo "- PR url: $pr_url"
186
- echo "- Roadmap progress: $roadmap_sync_summary"
187
- echo
188
- echo "## Roadmap Progress"
189
- echo
190
- echo "- $roadmap_sync_summary"
191
- echo
192
- echo "## Follow-Ups"
193
- if [[ -s "$tmp_followups" ]]; then
194
- echo
195
- while IFS= read -r line; do
196
- echo "- $line"
197
- done < "$tmp_followups"
198
- else
199
- echo
200
- echo "- None recorded."
201
- fi
202
- } > "$release_note"
203
-
204
- # ------------------------------------------------------------
205
- # 生成 resume index
206
- # ------------------------------------------------------------
207
- next_action="Refresh handoff and close the requirement."
208
- case "$ship_mode" in
209
- create-pr) next_action="Push current branch and create PR / MR from pr-brief.md." ;;
210
- update-pr) next_action="Refresh the open PR / MR body and resolve outstanding review feedback." ;;
211
- local-handoff) next_action="Hand off with pr-brief.md and this resume index." ;;
212
- post-merge-closeout) next_action="Run release note/backlog writeback, then run cc-devflow archive-change $requirement_id and verify the archive path." ;;
213
- esac
214
- if [[ "$branch_rescue" == "create-branch-before-pr" ]]; then
215
- next_action="Run ensure-ship-branch.sh, rerun final verification, then push the named branch and create PR / MR from pr-brief.md."
216
- elif [[ "$branch_rescue" == "create-local-branch-or-handoff" ]]; then
217
- next_action="Run ensure-ship-branch.sh before local closeout, or keep local-handoff only if no branch should be created."
218
- fi
219
-
220
- {
221
- echo "# Resume Index"
222
- echo
223
- echo "## Document Meta"
224
- echo
225
- echo "- Output language: $output_language"
226
- echo
227
- echo "- Requirement: $requirement_id"
228
- echo "- Current stage: cc-act"
229
- echo "- Current task: ship:$ship_mode"
230
- [[ -n "$branch_state" ]] && echo "- Branch state: $branch_state"
231
- if [[ -s "$tmp_followups" ]]; then
232
- echo "- Ready tasks: follow-up review"
233
- else
234
- echo "- Ready tasks: none"
235
- fi
236
- echo "- Updated at: $timestamp"
237
- echo
238
- echo "## Last Good Checkpoint"
239
- echo
240
- if [[ -n "$report_summary" ]]; then
241
- echo "- $report_summary"
242
- else
243
- echo "- Req-Check passed; see review/report-card.json for evidence."
244
- fi
245
- echo "- Ship mode decided as \`$ship_mode\`."
246
- [[ -n "$branch_rescue" && "$branch_rescue" != "none" ]] && echo "- Branch rescue: \`$branch_rescue\`."
247
- [[ -n "$rescue_action" ]] && echo "- Rescue action: $rescue_action"
248
- echo "- Roadmap progress: $roadmap_sync_summary"
249
- [[ -n "$pr_url" ]] && echo "- Active PR / MR: $pr_url"
250
- echo
251
- echo "## Follow-Ups"
252
- echo
253
- if [[ -s "$tmp_followups" ]]; then
254
- while IFS= read -r line; do
255
- echo "- $line"
256
- done < "$tmp_followups"
257
- else
258
- echo "- None."
259
- fi
260
- echo
261
- echo "## Next Action"
262
- echo
263
- echo "- $next_action"
264
- echo "- Formal spec sync belongs in cc-act before final ship closeout."
265
- echo "- Roadmap progress must be synced through cc-roadmap before final closeout when a source RM exists."
266
- echo
267
- echo "## Parallel Notes"
268
- echo
269
- echo "- Safe to parallelize: documentation review, backlog wording, release note polish."
270
- echo "- Must stay sequential: cc-check pass -> doc sync -> pr brief render -> ship action."
271
- } > "$resume_index"
272
-
273
- # ------------------------------------------------------------
274
- # 生成 doc sync 报告:要求人工关注的项目级文档目标
275
- # ------------------------------------------------------------
276
- {
277
- echo "# Doc Sync Report"
278
- echo
279
- echo "## Document Meta"
280
- echo
281
- echo "- Output language: $output_language"
282
- echo
283
- echo "- Requirement: $requirement_id"
284
- echo "- Ship mode: $ship_mode"
285
- echo "- CC-Check verdict: $report_verdict"
286
- echo "- Spec sync ready: $spec_sync_ready"
287
- echo "- Updated at: $timestamp"
288
- echo
289
- echo "## Synced Requirement Artifacts"
290
- echo
291
- echo "- \`handoff/release-note.md\`: refreshed"
292
- echo "- \`resume-index.md\`: refreshed"
293
- echo
294
- echo "## Touched Files"
295
- echo
296
- if [[ -s "$tmp_touched" ]]; then
297
- while IFS= read -r line; do
298
- echo "- \`$line\`"
299
- done < "$tmp_touched"
300
- else
301
- echo "- No touched files recorded in task-manifest.json."
302
- fi
303
- echo
304
- echo "## Spec Targets"
305
- echo
306
- if [[ -s "$tmp_specs" ]]; then
307
- while IFS= read -r line; do
308
- echo "- \`$line\`"
309
- done < "$tmp_specs"
310
- else
311
- echo "- No capability spec files recorded in task-manifest.json."
312
- fi
313
- echo
314
- echo "## Roadmap Targets"
315
- echo
316
- echo "- $roadmap_sync_summary"
317
- echo
318
- echo "## Project Doc Targets"
319
- echo
320
- echo "### CLAUDE Targets"
321
- if [[ -s "$tmp_claude" ]]; then
322
- echo
323
- while IFS= read -r line; do
324
- echo "- \`$line\`"
325
- done < "$tmp_claude"
326
- else
327
- echo
328
- echo "- No scoped \`CLAUDE.md\` target detected from touched files."
329
- fi
330
- echo
331
- echo "### README Candidates"
332
- if [[ -s "$tmp_readme" ]]; then
333
- echo
334
- while IFS= read -r line; do
335
- echo "- \`$line\`"
336
- done < "$tmp_readme"
337
- else
338
- echo
339
- echo "- No README candidate found under repo root."
340
- fi
341
- echo
342
- echo "## Manual Follow-Ups"
343
- echo
344
- echo "- Update the listed \`CLAUDE.md\` files if structure, workflow, or operational truth changed."
345
- echo "- Update README candidates if user-visible behavior or setup flow changed."
346
- echo "- Update \`devflow/roadmap.json\` via \`sync-roadmap-progress.sh\` when source RM status, progress, or follow-up truth changed."
347
- echo "- Re-render \`pr-brief.md\` after any manual doc edits so the PR body stays in sync."
348
- if [[ -n "$main_risk" ]]; then
349
- echo "- Main risk to reflect in docs: $main_risk"
350
- fi
351
- } > "$doc_sync_report"
352
-
353
- echo "Synced $release_note"
354
- echo "Synced $resume_index"
355
- echo "Wrote $doc_sync_report"