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
@@ -9,6 +9,7 @@ set -euo pipefail
9
9
  current_branch="$(git branch --show-current 2>/dev/null || true)"
10
10
  head_sha="$(git rev-parse --short HEAD 2>/dev/null || true)"
11
11
  inside_work_tree="$(git rev-parse --is-inside-work-tree 2>/dev/null || true)"
12
+ symbolic_ref="$(git symbolic-ref -q --short HEAD 2>/dev/null || true)"
12
13
  remote_url="$(git remote get-url origin 2>/dev/null || true)"
13
14
  platform="unknown"
14
15
  base_branch=""
@@ -18,9 +19,13 @@ branch_state="unknown"
18
19
  branch_rescue="none"
19
20
  rescue_action=""
20
21
 
21
- if [[ -n "$current_branch" ]]; then
22
+ if [[ "$inside_work_tree" != "true" ]]; then
23
+ branch_state="none"
24
+ elif [[ -z "$head_sha" ]]; then
25
+ branch_state="unborn"
26
+ elif [[ -n "$current_branch" ]]; then
22
27
  branch_state="branch"
23
- elif [[ "$inside_work_tree" == "true" && -n "$head_sha" ]]; then
28
+ elif [[ -n "$head_sha" ]]; then
24
29
  branch_state="detached"
25
30
  else
26
31
  branch_state="none"
@@ -92,10 +97,14 @@ if [[ "$branch_state" == "detached" ]]; then
92
97
  branch_rescue="create-local-branch-or-handoff"
93
98
  rescue_action="Create a named local branch at HEAD before local closeout, or write local-handoff if no branch should be created."
94
99
  fi
100
+ elif [[ "$branch_state" == "unborn" ]]; then
101
+ branch_rescue="resolve-unborn-branch"
102
+ rescue_action="HEAD has no commit. Run inspect-git-index.sh, switch to an existing exact-case branch or create a branch from a real base, then stage only the intended files."
95
103
  fi
96
104
 
97
105
  cat <<EOF
98
106
  CURRENT_BRANCH=$current_branch
107
+ SYMBOLIC_REF=$symbolic_ref
99
108
  BRANCH_STATE=$branch_state
100
109
  HEAD_SHA=$head_sha
101
110
  BASE_BRANCH=$base_branch
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ # ------------------------------------------------------------
6
+ # cc-act: 提交前核验 HEAD / ref / index 真相
7
+ # ------------------------------------------------------------
8
+
9
+ inside_work_tree="$(git rev-parse --is-inside-work-tree 2>/dev/null || true)"
10
+ if [[ "$inside_work_tree" != "true" ]]; then
11
+ echo "ShipPreflightError: not inside a git work tree" >&2
12
+ exit 1
13
+ fi
14
+
15
+ current_branch="$(git branch --show-current 2>/dev/null || true)"
16
+ symbolic_ref="$(git symbolic-ref -q --short HEAD 2>/dev/null || true)"
17
+ head_sha="$(git rev-parse --verify --short HEAD 2>/dev/null || true)"
18
+ head_state="present"
19
+ commit_ready="true"
20
+ blocker=""
21
+ case_collision=""
22
+
23
+ if [[ -z "$head_sha" ]]; then
24
+ head_state="unborn"
25
+ commit_ready="false"
26
+ blocker="HEAD is unborn; do not trust staged status until the branch is anchored to a real commit."
27
+ fi
28
+
29
+ if [[ -n "$symbolic_ref" ]]; then
30
+ symbolic_ref_lower="$(printf '%s' "$symbolic_ref" | tr '[:upper:]' '[:lower:]')"
31
+ while IFS= read -r ref_name; do
32
+ ref_name_lower="$(printf '%s' "$ref_name" | tr '[:upper:]' '[:lower:]')"
33
+ if [[ "$ref_name" != "$symbolic_ref" && "$ref_name_lower" == "$symbolic_ref_lower" ]]; then
34
+ case_collision="$ref_name"
35
+ commit_ready="false"
36
+ blocker="${blocker:+$blocker }Case-variant branch already exists: $ref_name."
37
+ break
38
+ fi
39
+ done < <(git for-each-ref --format='%(refname:short)' refs/heads 2>/dev/null || true)
40
+ fi
41
+
42
+ staged_count="$(git diff --cached --name-only --diff-filter=ACMRTUXB | sed '/^$/d' | wc -l | tr -d ' ')"
43
+ unstaged_count="$(git diff --name-only --diff-filter=ACMRTUXB | sed '/^$/d' | wc -l | tr -d ' ')"
44
+ untracked_count="$(git ls-files --others --exclude-standard | sed '/^$/d' | wc -l | tr -d ' ')"
45
+
46
+ cat <<EOF
47
+ INSIDE_WORK_TREE=$inside_work_tree
48
+ CURRENT_BRANCH=$current_branch
49
+ SYMBOLIC_REF=$symbolic_ref
50
+ HEAD_STATE=$head_state
51
+ HEAD_SHA=$head_sha
52
+ CASE_COLLISION_BRANCH=$case_collision
53
+ STAGED_COUNT=$staged_count
54
+ UNSTAGED_COUNT=$unstaged_count
55
+ UNTRACKED_COUNT=$untracked_count
56
+ COMMIT_READY=$commit_ready
57
+ BLOCKER=$blocker
58
+ EOF
@@ -2,10 +2,6 @@
2
2
 
3
3
  set -euo pipefail
4
4
 
5
- # ------------------------------------------------------------
6
- # cc-act: 从 requirement 真相源渲染 pr-brief.md
7
- # ------------------------------------------------------------
8
-
9
5
  usage() {
10
6
  cat <<'EOF'
11
7
  Usage: render-pr-brief.sh --dir path/to/change [--out path/to/pr-brief.md] [--repo-root path/to/repo]
@@ -32,475 +28,79 @@ if [[ -z "$REQ_DIR" || ! -d "$REQ_DIR" ]]; then
32
28
  fi
33
29
 
34
30
  if [[ -z "$REPO_ROOT" ]]; then
35
- REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
31
+ REPO_ROOT="$(git -C "$REQ_DIR" rev-parse --show-toplevel 2>/dev/null || pwd)"
36
32
  fi
37
33
 
38
34
  script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
39
35
  source "$script_dir/cc-act-common.sh"
40
- CHANGE_DIR="$(req_act_change_dir "$REQ_DIR")"
36
+
37
+ change_dir="$(req_act_change_dir "$REQ_DIR")"
38
+ task_file="$(req_act_tasks_path "$change_dir")"
41
39
  if [[ -z "$OUT_FILE" ]]; then
42
- OUT_FILE="$(req_act_handoff_dir "$CHANGE_DIR")/pr-brief.md"
40
+ OUT_FILE="$(req_act_pr_brief_path "$change_dir")"
43
41
  fi
44
- report_card="$(req_act_report_path "$CHANGE_DIR")"
45
- manifest="$(req_act_manifest_path "$CHANGE_DIR")"
46
- tasks_file="$(req_act_tasks_path "$CHANGE_DIR")"
47
- design_file="$(req_act_contract_path "$CHANGE_DIR")"
48
- release_note="$(req_act_release_note_path "$CHANGE_DIR")"
49
- resume_index="$(req_act_resume_index_path "$CHANGE_DIR")"
50
- doc_sync_report="$(req_act_doc_sync_report_path "$CHANGE_DIR")"
51
42
 
52
- "$script_dir/verify-act-gate.sh" --dir "$CHANGE_DIR" >/dev/null
53
- "$script_dir/sync-act-docs.sh" --dir "$CHANGE_DIR" --repo-root "$REPO_ROOT" >/dev/null
43
+ "$script_dir/verify-act-gate.sh" --dir "$change_dir" >/dev/null
54
44
 
55
- ship_context="$("$script_dir/detect-ship-target.sh" 2>/dev/null || true)"
56
- current_branch="$(req_act_ship_field "$ship_context" "CURRENT_BRANCH")"
57
- branch_state="$(req_act_ship_field "$ship_context" "BRANCH_STATE")"
58
- branch_rescue="$(req_act_ship_field "$ship_context" "BRANCH_RESCUE")"
59
- rescue_action="$(req_act_ship_field "$ship_context" "RESCUE_ACTION")"
60
- base_branch="$(req_act_ship_field "$ship_context" "BASE_BRANCH")"
61
- ship_mode="$(req_act_ship_field "$ship_context" "DECISION_HINT")"
62
- pr_status="$(req_act_ship_field "$ship_context" "PR_STATUS")"
63
- pr_url="$(req_act_ship_field "$ship_context" "PR_URL")"
45
+ mkdir -p "$(dirname "$OUT_FILE")"
64
46
 
65
- requirement_id="$(req_act_requirement_id "$manifest" "$CHANGE_DIR")"
66
- report_summary="$(req_act_report_summary "$report_card")"
67
- report_verdict="$(req_act_report_verdict "$report_card")"
68
- output_language="$(req_act_output_language "$report_card")"
69
- normalized_output_language="$(printf '%s' "$output_language" | tr '[:upper:]' '[:lower:]')"
70
- case "$normalized_output_language" in
71
- *zh*|*chinese*|*中文*)
72
- pr_body_locale="zh"
73
- pr_language_label="中文"
74
- ;;
75
- *)
76
- pr_body_locale="en"
77
- pr_language_label="English"
78
- ;;
79
- esac
80
- design_goal="$(req_act_design_goal "$design_file")"
81
- main_risk="$(req_act_main_risk "$design_file")"
82
- review_base_sha="$(jq -r '[.review.taskReviews.reviewPacket.baseSha?, .review.diffReview.reviewPacket.baseSha?] | map(select(. != null and . != "")) | first // "not recorded"' "$report_card")"
83
- review_head_sha="$(jq -r '[.review.taskReviews.reviewPacket.headSha?, .review.diffReview.reviewPacket.headSha?] | map(select(. != null and . != "")) | first // "not recorded"' "$report_card")"
84
- review_packet_summary="$(jq -r '
85
- [
86
- .review.taskReviews.reviewPacket.requirements?,
87
- .review.diffReview.reviewPacket.requirements?
88
- ]
89
- | map(select(. != null and . != ""))
90
- | unique
91
- | if length == 0 then "not recorded" else join("; ") end
92
- ' "$report_card")"
93
- finding_triage_summary="$(jq -r '
94
- [
95
- (.review.taskReviews.findings? // []),
96
- (.review.diffReview.findings? // []),
97
- (.review.findings? // [])
98
- ]
99
- | flatten
100
- | map(.triageStatus? // .status? // "untriaged")
101
- | if length == 0 then "no findings" else group_by(.) | map("\(.[0])=\(length)") | join(", ") end
102
- ' "$report_card")"
103
- qa_claim_summary="$(jq -r '
104
- "qa=\(.qa.status? // "not recorded"), claims=" +
105
- (((.claimEvidence? // []) | map((.claim // "unknown") + ":" + (.status // "unknown")) | join(", ")) // "not recorded")
106
- ' "$report_card")"
107
-
108
- tmp_changed="$(mktemp)"
109
- tmp_verify="$(mktemp)"
110
- tmp_followups="$(mktemp)"
111
- tmp_evidence="$(mktemp)"
112
- cleanup() {
113
- rm -f "$tmp_changed" "$tmp_verify" "$tmp_followups" "$tmp_evidence"
114
- }
115
- trap cleanup EXIT
116
-
117
- req_act_collect_completed_titles "$manifest" "$tasks_file" "$tmp_changed"
118
- req_act_collect_verification_commands "$manifest" "$tmp_verify"
119
- req_act_collect_evidence "$report_card" "$tmp_evidence"
120
- req_act_collect_followups "$report_card" "$manifest" "$tmp_followups"
121
-
122
- claude_status="manual check required"
123
- readme_status="manual check required"
124
- if [[ -f "$doc_sync_report" ]]; then
125
- if grep -q 'No scoped `CLAUDE.md` target detected' "$doc_sync_report"; then
126
- claude_status="no scoped CLAUDE target detected"
127
- else
128
- claude_status="see doc-sync-report.md"
129
- fi
130
- if grep -q 'No README candidate found' "$doc_sync_report"; then
131
- readme_status="no README candidate found"
132
- else
133
- readme_status="see doc-sync-report.md"
134
- fi
135
- fi
136
-
137
- review_freshness_summary="$(jq -r '
138
- .review.freshness as $fresh |
139
- if $fresh == null then
140
- "not recorded"
141
- else
142
- "status=\($fresh.status // "unknown"), reviewed=\($fresh.reviewedCommit // "not recorded"), current=\($fresh.currentCommit // "not recorded"), commitsSinceReview=\($fresh.commitsSinceReview // "unknown")" +
143
- (if (($fresh.staleReason // "") != "") then ", reason=\($fresh.staleReason)" else "" end)
144
- end
145
- ' "$report_card")"
146
- review_quality_summary="$(jq -r '
147
- "qualityScore=\(.review.qualityScore // "not recorded")"
148
- ' "$report_card")"
149
- specialist_review_summary="$(jq -r '
150
- (.review.specialistReviews? // [])
151
- | if length == 0 then
152
- "no specialist facets recorded"
153
- else
154
- map((.name // "unknown") + ":" + (.status // "unknown")) | join(", ")
155
- end
156
- ' "$report_card")"
157
- qa_coverage_summary="$(jq -r '
158
- .qa.coverageAudit as $coverage |
159
- if $coverage == null then
160
- "not recorded"
161
- else
162
- "status=\($coverage.status // "unknown"), coverage=\($coverage.coveragePct // "n/a"), gaps=\((($coverage.gaps // []) | length)), e2eRequired=\($coverage.e2eRequired // false), evalRequired=\($coverage.evalRequired // false)"
163
- end
164
- ' "$report_card")"
165
- browser_qa_summary="$(jq -r '
166
- .qa.browserEvidence as $browser |
167
- if $browser == null then
168
- "not recorded"
169
- else
170
- "status=\($browser.status // "unknown"), mode=\($browser.mode // "unknown"), routes=\((($browser.affectedRoutes // []) | length)), issues=\((($browser.issues // []) | length)), consoleErrors=\((($browser.consoleErrors // []) | length))" +
171
- (if (($browser.skipReason // "") != "") then ", skip=\($browser.skipReason)" else "" end)
172
- end
173
- ' "$report_card")"
174
- feedback_loop_summary="$(jq -r '
175
- .qa.feedbackLoop as $loop |
176
- if $loop == null then
177
- "not recorded"
178
- else
179
- "status=\($loop.status // "unknown"), mode=\($loop.mode // "unknown"), determinism=\($loop.determinism // "not recorded"), reproductionRate=\($loop.reproductionRate // "not recorded")" +
180
- (if (($loop.blockedReason // "") != "") then ", blocked=\($loop.blockedReason)" else "" end)
181
- end
182
- ' "$report_card")"
183
- behavior_evidence_summary="$(jq -r '
184
- .qa.behaviorEvidence as $behavior |
185
- if $behavior == null then
186
- "not recorded"
187
- else
188
- "status=\($behavior.status // "unknown"), boundary=\($behavior.userFacingBoundary // "not recorded"), expected=\($behavior.expectedBehavior // "not recorded"), actual=\($behavior.actualBehavior // "not recorded"), steps=\((($behavior.reproductionSteps // []) | length))"
189
- end
190
- ' "$report_card")"
191
- failure_ownership_summary="$(jq -r '
192
- (.runtime.failureOwnership? // [])
193
- | if length == 0 then
194
- "no open failures recorded"
195
- else
196
- group_by(.classification // "unknown")
197
- | map("\(.[0].classification // "unknown")=\(length)")
198
- | join(", ")
199
- end
200
- ' "$report_card")"
201
- documentation_release_summary="CLAUDE=${claude_status}; README=${readme_status}"
202
- pr_body_accuracy_summary="body must be regenerated from this pr-brief, current report-card, and current diff before PR create/update"
203
- roadmap_sync_summary="$(req_act_roadmap_sync_summary "$manifest" "$REPO_ROOT")"
47
+ branch="$(git -C "$REPO_ROOT" branch --show-current 2>/dev/null || true)"
48
+ head_sha="$(git -C "$REPO_ROOT" rev-parse --short HEAD 2>/dev/null || true)"
49
+ status="$(git -C "$REPO_ROOT" status --short 2>/dev/null || true)"
50
+ commits="$(git -C "$REPO_ROOT" log --oneline -10 2>/dev/null || true)"
51
+ changed="$(git -C "$REPO_ROOT" diff --stat HEAD 2>/dev/null || true)"
204
52
 
205
53
  {
206
54
  echo "# PR Brief"
207
55
  echo
208
- echo "## Document Meta"
209
- echo
210
- echo "- Output language: $output_language"
211
- echo
212
- echo "## Requirement"
213
- echo
214
- echo "- $requirement_id"
215
- echo
216
- echo "## Ship Mode"
217
- echo
218
- echo "- \`$ship_mode\`"
219
- echo
220
- echo "## Branch Context"
221
- echo
222
- echo "- Current branch: ${current_branch:-unknown}"
223
- [[ -n "$branch_state" ]] && echo "- Branch state: $branch_state"
224
- echo "- Base branch: ${base_branch:-unknown}"
225
- [[ -n "$branch_rescue" && "$branch_rescue" != "none" ]] && echo "- Branch rescue: $branch_rescue"
226
- [[ -n "$rescue_action" ]] && echo "- Rescue action: $rescue_action"
227
- if [[ -n "$pr_url" ]]; then
228
- echo "- PR / MR: $pr_url ($pr_status)"
229
- else
230
- echo "- PR / MR: none"
231
- fi
232
- echo
233
- echo "## Review Range"
234
- echo
235
- echo "- Reviewed base SHA: $review_base_sha"
236
- echo "- Reviewed head SHA: $review_head_sha"
237
- echo "- Review packet: $review_packet_summary"
238
- echo "- Finding triage: $finding_triage_summary"
239
- echo "- QA / claim evidence: $qa_claim_summary"
240
- echo
241
- echo "## Readiness Dashboard"
242
- echo
243
- echo "- Review freshness: $review_freshness_summary"
244
- echo "- Review quality: $review_quality_summary"
245
- echo "- Specialist review facets: $specialist_review_summary"
246
- echo "- QA coverage: $qa_coverage_summary"
247
- echo "- Browser QA: $browser_qa_summary"
248
- echo "- Feedback loop: $feedback_loop_summary"
249
- echo "- Behavior evidence: $behavior_evidence_summary"
250
- echo "- Failure ownership: $failure_ownership_summary"
251
- echo "- Documentation release: $documentation_release_summary"
252
- echo "- Roadmap progress: $roadmap_sync_summary"
253
- echo "- PR body accuracy: $pr_body_accuracy_summary"
254
- echo
255
- echo "## Pull Request Body Contract"
256
- echo
257
- echo "- Language source: \`Output language: $output_language\`"
258
- echo "- PR body language: $pr_language_label"
259
- echo "- Title rule: use the same language as the PR body after the Conventional Commits \`type(scope)\` prefix; keep identifiers, paths, commands, and issue keys unchanged."
260
- echo "- Body source: rebuild from this \`pr-brief.md\`, current diff, current \`review/report-card.json\`, doc sync output, and roadmap/backlog writeback; do not reuse a stale PR body."
261
- echo "- Required sections: summary, problem, changes, validation, review/gate evidence, risk/rollback, docs/writeback, and follow-ups."
262
- echo "- Completeness gate: no empty headings, no generic \"tests passed\" claim without commands or evidence, and no \`<placeholder>\` text may remain before \`gh pr create\` or \`gh pr edit\`."
263
- echo
264
- echo "## Pull Request Body Draft"
56
+ echo "## Change"
265
57
  echo
266
- echo '```markdown'
267
- if [[ "$pr_body_locale" == "zh" ]]; then
268
- echo "## 摘要"
269
- if [[ -n "$report_summary" ]]; then
270
- echo "- $report_summary"
271
- fi
272
- if [[ -n "$design_goal" && "$design_goal" != "$report_summary" ]]; then
273
- echo "- $design_goal"
274
- fi
275
- if [[ -z "$report_summary" && -z "$design_goal" ]]; then
276
- echo "- 未记录顶层摘要;创建或更新 PR 前必须补齐。"
277
- fi
278
- echo
279
- echo "## 问题"
280
- echo "- 需求:$requirement_id"
281
- echo "- 用户可见缺口:${design_goal:-需要从 planning 产物补齐}"
282
- echo
283
- echo "## 变更"
284
- if [[ -s "$tmp_changed" ]]; then
285
- while IFS= read -r line; do
286
- echo "- $line"
287
- done < "$tmp_changed"
288
- else
289
- echo "- 未捕获完成任务列表;创建或更新 PR 前必须补齐。"
290
- fi
291
- echo
292
- echo "## 验证"
293
- echo "- \`report-card.json\` 结论:$report_verdict"
294
- if [[ -s "$tmp_evidence" ]]; then
295
- while IFS= read -r line; do
296
- echo "- $line"
297
- done < "$tmp_evidence"
298
- else
299
- echo "- 未记录证据行;必须补充命令、退出码或关键观察。"
300
- fi
301
- if [[ -s "$tmp_verify" ]]; then
302
- while IFS= read -r cmd; do
303
- echo "- \`$cmd\`"
304
- done < "$tmp_verify"
305
- fi
306
- echo
307
- echo "## Review / Gate 证据"
308
- echo "- Reviewed base SHA: $review_base_sha"
309
- echo "- Reviewed head SHA: $review_head_sha"
310
- echo "- Review packet: $review_packet_summary"
311
- echo "- Finding triage: $finding_triage_summary"
312
- echo "- QA / claim evidence: $qa_claim_summary"
313
- echo "- Readiness: review freshness=[$review_freshness_summary]; qa coverage=[$qa_coverage_summary]; browser QA=[$browser_qa_summary]"
314
- echo
315
- echo "## 风险与回滚"
316
- if [[ -n "$main_risk" ]]; then
317
- echo "- 主要风险:$main_risk"
318
- else
319
- echo "- 主要风险:planning/design.md 未记录新增风险。"
320
- fi
321
- echo "- 回滚边界:按 \`Rollback Guard\` 的 safe state、side effects 和 owner 执行;如未补齐,不得合并。"
322
- echo
323
- echo "## 文档与回写"
324
- echo "- \`CLAUDE.md\`: $claude_status"
325
- echo "- \`README.md\`: $readme_status"
326
- echo "- Roadmap progress: $roadmap_sync_summary"
327
- echo
328
- echo "## 后续事项"
329
- if [[ -s "$tmp_followups" ]]; then
330
- while IFS= read -r line; do
331
- echo "- $line"
332
- done < "$tmp_followups"
333
- else
334
- echo "- 无已记录后续事项。"
335
- fi
336
- else
337
- echo "## Summary"
338
- if [[ -n "$report_summary" ]]; then
339
- echo "- $report_summary"
340
- fi
341
- if [[ -n "$design_goal" && "$design_goal" != "$report_summary" ]]; then
342
- echo "- $design_goal"
343
- fi
344
- if [[ -z "$report_summary" && -z "$design_goal" ]]; then
345
- echo "- No top-line summary recorded; fill this before creating or updating the PR."
346
- fi
347
- echo
348
- echo "## Problem"
349
- echo "- Requirement: $requirement_id"
350
- echo "- User-visible gap: ${design_goal:-fill from planning artifacts before PR update}"
351
- echo
352
- echo "## Changes"
353
- if [[ -s "$tmp_changed" ]]; then
354
- while IFS= read -r line; do
355
- echo "- $line"
356
- done < "$tmp_changed"
357
- else
358
- echo "- No completed task list captured; fill this before creating or updating the PR."
359
- fi
360
- echo
361
- echo "## Validation"
362
- echo "- \`report-card.json\` verdict: $report_verdict"
363
- if [[ -s "$tmp_evidence" ]]; then
364
- while IFS= read -r line; do
365
- echo "- $line"
366
- done < "$tmp_evidence"
367
- else
368
- echo "- No evidence lines recorded; add command, exit status, or key observation evidence."
369
- fi
370
- if [[ -s "$tmp_verify" ]]; then
371
- while IFS= read -r cmd; do
372
- echo "- \`$cmd\`"
373
- done < "$tmp_verify"
374
- fi
375
- echo
376
- echo "## Review / Gate Evidence"
377
- echo "- Reviewed base SHA: $review_base_sha"
378
- echo "- Reviewed head SHA: $review_head_sha"
379
- echo "- Review packet: $review_packet_summary"
380
- echo "- Finding triage: $finding_triage_summary"
381
- echo "- QA / claim evidence: $qa_claim_summary"
382
- echo "- Readiness: review freshness=[$review_freshness_summary]; qa coverage=[$qa_coverage_summary]; browser QA=[$browser_qa_summary]"
383
- echo
384
- echo "## Risk And Rollback"
385
- if [[ -n "$main_risk" ]]; then
386
- echo "- Main risk: $main_risk"
387
- else
388
- echo "- Main risk: no additional risk captured in planning/design.md."
389
- fi
390
- echo "- Rollback boundary: follow the \`Rollback Guard\` safe state, side effects, and owner; do not merge if this is incomplete."
391
- echo
392
- echo "## Docs And Writeback"
393
- echo "- \`CLAUDE.md\`: $claude_status"
394
- echo "- \`README.md\`: $readme_status"
395
- echo "- Roadmap progress: $roadmap_sync_summary"
396
- echo
397
- echo "## Follow-ups"
398
- if [[ -s "$tmp_followups" ]]; then
399
- while IFS= read -r line; do
400
- echo "- $line"
401
- done < "$tmp_followups"
402
- else
403
- echo "- None recorded."
404
- fi
405
- fi
406
- echo '```'
407
- echo
408
- echo "## Summary"
409
- echo
410
- if [[ -n "$report_summary" ]]; then
411
- echo "- $report_summary"
412
- fi
413
- if [[ -n "$design_goal" && "$design_goal" != "$report_summary" ]]; then
414
- echo "- $design_goal"
415
- fi
416
- if [[ -z "$report_summary" && -z "$design_goal" ]]; then
417
- echo "- No top-line summary recorded yet."
418
- fi
58
+ echo "- Change key: $(basename "$change_dir")"
59
+ echo "- Branch: ${branch:-unknown}"
60
+ echo "- Head: ${head_sha:-unknown}"
419
61
  echo
420
- echo "## What Changed"
62
+ echo "## Task Summary"
421
63
  echo
422
- if [[ -s "$tmp_changed" ]]; then
423
- while IFS= read -r line; do
424
- echo "- $line"
425
- done < "$tmp_changed"
64
+ if [[ -f "$task_file" ]]; then
65
+ awk '/^- \[[xX]\] /{print "- Done: " substr($0, 7)}' "$task_file"
426
66
  else
427
- echo "- No completed task list captured yet."
67
+ echo "- Missing task.md"
428
68
  fi
429
69
  echo
430
- echo "## Verification Evidence"
70
+ echo "## Recent Commits"
431
71
  echo
432
- echo "- \`report-card.json\` verdict: $report_verdict"
433
- if [[ "$ship_mode" == "post-merge-closeout" ]]; then
434
- echo "- Merged-result verification: required before closeout; record command, exit status, and key observation"
435
- else
436
- echo "- Merged-result verification: not applicable before merge"
437
- fi
438
- if [[ -s "$tmp_evidence" ]]; then
439
- while IFS= read -r line; do
440
- echo "- $line"
441
- done < "$tmp_evidence"
72
+ if [[ -n "$commits" ]]; then
73
+ printf '%s\n' "$commits" | sed 's/^/- /'
442
74
  else
443
- echo "- No evidence lines captured yet."
75
+ echo "- No commits found"
444
76
  fi
445
77
  echo
446
- echo "## QA Behavior Evidence"
447
- echo
448
- echo "- Feedback loop: $feedback_loop_summary"
449
- echo "- Behavior evidence: $behavior_evidence_summary"
450
- jq -r '
451
- .qa.behaviorEvidence as $behavior |
452
- if $behavior == null then empty else
453
- (($behavior.reproductionSteps // [])[]? | "- Reproduction step: " + .),
454
- (($behavior.domainLanguage // [])[]? | "- Domain language: " + .)
455
- end
456
- ' "$report_card" 2>/dev/null | sed '/^$/d' || true
78
+ echo "## Current Diff"
457
79
  echo
458
- echo "## Documentation Sync"
459
- echo
460
- echo "- \`CLAUDE.md\`: $claude_status"
461
- echo "- \`README.md\`: $readme_status"
462
- if [[ -f "$release_note" ]]; then
463
- echo "- \`release-note.md\`: refreshed"
464
- else
465
- echo "- \`release-note.md\`: missing"
466
- fi
467
- if [[ -f "$resume_index" ]]; then
468
- echo "- \`resume-index.md\`: refreshed"
80
+ if [[ -n "$changed" ]]; then
81
+ printf '%s\n' "$changed" | sed 's/^/- /'
469
82
  else
470
- echo "- \`resume-index.md\`: missing"
83
+ echo "- No uncommitted diff"
471
84
  fi
472
85
  echo
473
- echo "## Roadmap Progress Sync"
86
+ echo "## Worktree Status"
474
87
  echo
475
- echo "- $roadmap_sync_summary"
476
- echo
477
- echo "## How To Verify"
478
- echo
479
- if [[ -s "$tmp_verify" ]]; then
480
- while IFS= read -r cmd; do
481
- echo "- \`$cmd\`"
482
- done < "$tmp_verify"
88
+ if [[ -n "$status" ]]; then
89
+ printf '%s\n' "$status" | sed 's/^/- /'
483
90
  else
484
- echo "- See \`review/report-card.json\` evidence."
91
+ echo "- Clean"
485
92
  fi
486
93
  echo
487
- echo "## Follow-Ups"
94
+ echo "## PR Body Draft"
488
95
  echo
489
- if [[ -s "$tmp_followups" ]]; then
490
- while IFS= read -r line; do
491
- echo "- $line"
492
- done < "$tmp_followups"
493
- else
494
- echo "- None recorded."
495
- fi
96
+ echo "Summary:"
97
+ echo "- <summarize user-visible change from task.md and commits>"
496
98
  echo
497
- echo "## Risks"
99
+ echo "Validation:"
100
+ echo "- <copy fresh cc-check commands and results>"
498
101
  echo
499
- if [[ -n "$main_risk" ]]; then
500
- echo "- $main_risk"
501
- else
502
- echo "- No additional risk captured in planning/design.md."
503
- fi
102
+ echo "Risk / rollback:"
103
+ echo "- <summarize residual risk and rollback path>"
504
104
  } > "$OUT_FILE"
505
105
 
506
- echo "Wrote $OUT_FILE"
106
+ echo "Rendered $OUT_FILE"