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,88 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 记录 spec / code review 结论,并同步 manifest;失败时保留 CLI 事件
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage:
12
- record-review-decision.sh --dir path/to/change --task T001 --gate spec|code --verdict pass|fail|blocked --summary "..."
13
- EOF
14
- }
15
-
16
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
- source "$SCRIPT_DIR/cc-do-common.sh"
18
- REQ_DIR=""
19
- TASK_ID=""
20
- GATE=""
21
- VERDICT=""
22
- SUMMARY=""
23
-
24
- while [[ $# -gt 0 ]]; do
25
- case "$1" in
26
- --dir) REQ_DIR="$2"; shift 2 ;;
27
- --task) TASK_ID="$(echo "$2" | tr '[:lower:]' '[:upper:]')"; shift 2 ;;
28
- --gate) GATE="$2"; shift 2 ;;
29
- --verdict) VERDICT="$2"; shift 2 ;;
30
- --summary) SUMMARY="$2"; shift 2 ;;
31
- -h|--help) usage; exit 0 ;;
32
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
33
- esac
34
- done
35
-
36
- if [[ -z "$REQ_DIR" || -z "$TASK_ID" || -z "$GATE" || -z "$VERDICT" || -z "$SUMMARY" ]]; then
37
- usage
38
- exit 1
39
- fi
40
-
41
- if [[ "$GATE" != "spec" && "$GATE" != "code" ]]; then
42
- echo "Gate must be spec or code" >&2
43
- exit 1
44
- fi
45
-
46
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
47
- manifest="$(req_do_manifest_path "$CHANGE_DIR")"
48
- change_id="$(jq -r '.changeId // .requirementId // "REQ-UNKNOWN"' "$manifest" 2>/dev/null || basename "$CHANGE_DIR")"
49
- timestamp="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
50
- event_name="${GATE}_review_${VERDICT}"
51
-
52
- if [[ -f "$manifest" ]]; then
53
- tmp_manifest="$(mktemp)"
54
- jq --arg task "$TASK_ID" --arg gate "$GATE" --arg verdict "$VERDICT" '
55
- .tasks |= map(
56
- if .id == $task then
57
- . + { reviews: ((.reviews // {}) + {($gate): $verdict}) }
58
- else
59
- .
60
- end
61
- )
62
- ' "$manifest" > "$tmp_manifest"
63
- mv "$tmp_manifest" "$manifest"
64
- fi
65
-
66
- if [[ "$VERDICT" != "pass" ]]; then
67
- runtime_task_dir="$(req_do_task_runtime_dir "$CHANGE_DIR" "$TASK_ID")"
68
- mkdir -p "$runtime_task_dir"
69
- jq -nc \
70
- --arg type "$event_name" \
71
- --arg changeId "$change_id" \
72
- --arg taskId "$TASK_ID" \
73
- --arg gate "$GATE" \
74
- --arg verdict "$VERDICT" \
75
- --arg summary "$SUMMARY" \
76
- --arg timestamp "$timestamp" \
77
- '{
78
- type: $type,
79
- changeId: $changeId,
80
- taskId: $taskId,
81
- gate: $gate,
82
- verdict: $verdict,
83
- summary: $summary,
84
- timestamp: $timestamp
85
- }' >> "$runtime_task_dir/events.jsonl"
86
- fi
87
-
88
- echo "Recorded $event_name for $TASK_ID"
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 从 requirement 目录恢复当前工作位置
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage: recover-workflow.sh --dir path/to/change
12
- EOF
13
- }
14
-
15
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
- source "$SCRIPT_DIR/cc-do-common.sh"
17
- REQ_DIR=""
18
-
19
- while [[ $# -gt 0 ]]; do
20
- case "$1" in
21
- --dir) REQ_DIR="$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
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
33
- manifest="$(req_do_manifest_path "$CHANGE_DIR")"
34
- tasks="$(req_do_tasks_path "$CHANGE_DIR")"
35
- report="$(req_do_report_card_path "$CHANGE_DIR")"
36
- change_id=""
37
-
38
- echo "# Recovery Snapshot"
39
- echo
40
- echo "- Change dir: $CHANGE_DIR"
41
-
42
- if [[ -f "$manifest" ]]; then
43
- current="$(jq -r '.currentTaskId // "unknown"' "$manifest" 2>/dev/null || echo unknown)"
44
- status="$(jq -r '.status // "unknown"' "$manifest" 2>/dev/null || echo unknown)"
45
- change_id="$(jq -r '.changeId // .requirementId // "unknown"' "$manifest" 2>/dev/null || echo unknown)"
46
- echo "- Manifest status: $status"
47
- echo "- Change ID: $change_id"
48
- echo "- Current task: $current"
49
-
50
- ready_json="$("$SCRIPT_DIR/select-ready-tasks.sh" --manifest "$manifest" 2>/dev/null || echo '{}')"
51
- ready_tasks="$(echo "$ready_json" | jq -r '[.readyTasks[]?.id] | if length == 0 then "none" else join(", ") end')"
52
- active_phase="$(echo "$ready_json" | jq -r '.activePhase // "unknown"')"
53
- echo "- Active phase: $active_phase"
54
- echo "- Ready tasks: $ready_tasks"
55
- fi
56
-
57
- if [[ -f "$tasks" ]]; then
58
- next_task="$(grep '^- \[ \]' "$tasks" | head -1 || true)"
59
- done_count="$(grep -c '^- \[x\]' "$tasks" 2>/dev/null || echo 0)"
60
- todo_count="$(grep -c '^- \[ \]' "$tasks" 2>/dev/null || echo 0)"
61
- echo "- TASKS done: $done_count"
62
- echo "- TASKS todo: $todo_count"
63
- [[ -n "$next_task" ]] && echo "- Next visible task: $next_task"
64
- fi
65
-
66
- if [[ -f "$report" ]]; then
67
- verdict="$(jq -r '.verdict // .overall // "unknown"' "$report" 2>/dev/null || echo unknown)"
68
- echo "- Latest check verdict: $verdict"
69
- fi
70
-
71
- if [[ -f "$manifest" ]]; then
72
- echo
73
- echo "## Task Status"
74
- jq -r '.tasks[]? | "- " + .id + ": " + (.status // "pending") + (if .lastError then " - " + .lastError else "" end)' "$manifest" 2>/dev/null || true
75
- fi
76
-
77
- if git -C "$CHANGE_DIR" rev-parse --show-toplevel >/dev/null 2>&1; then
78
- repo_root="$(git -C "$CHANGE_DIR" rev-parse --show-toplevel)"
79
- echo
80
- echo "## Git State"
81
- git -C "$repo_root" status --short
82
- fi
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 生成根因分析骨架
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage: run-problem-analysis.sh --dir path/to/change --input "symptom"
12
- EOF
13
- }
14
-
15
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
- source "$SCRIPT_DIR/cc-do-common.sh"
17
- REQ_DIR=""
18
- INPUT=""
19
-
20
- while [[ $# -gt 0 ]]; do
21
- case "$1" in
22
- --dir) REQ_DIR="$2"; shift 2 ;;
23
- --input) INPUT="$2"; shift 2 ;;
24
- -h|--help) usage; exit 0 ;;
25
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
26
- esac
27
- done
28
-
29
- if [[ -z "$REQ_DIR" || -z "$INPUT" || ! -d "$REQ_DIR" ]]; then
30
- usage
31
- exit 1
32
- fi
33
-
34
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
35
- analysis_file="$(req_do_planning_dir "$CHANGE_DIR")/analysis.md"
36
- mkdir -p "$(dirname "$analysis_file")"
37
-
38
- cat > "$analysis_file" <<EOF
39
- # analysis
40
-
41
- ## Symptom
42
-
43
- $INPUT
44
-
45
- ## Failing Test To Add First
46
-
47
- -
48
-
49
- ## Reproduction
50
-
51
- -
52
-
53
- ## Evidence
54
-
55
- -
56
-
57
- ## Root Cause Hypothesis
58
-
59
- -
60
-
61
- ## Fix Direction
62
-
63
- -
64
-
65
- ## Guardrail Test After Fix
66
-
67
- -
68
- EOF
69
-
70
- echo "Wrote $analysis_file"
@@ -1,109 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 校验任务状态、依赖和可选 CLI 事件顺序
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage:
12
- verify-task-gates.sh --dir path/to/change --task T001
13
- EOF
14
- }
15
-
16
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
- source "$SCRIPT_DIR/cc-do-common.sh"
18
- REQ_DIR=""
19
- TASK_ID=""
20
-
21
- while [[ $# -gt 0 ]]; do
22
- case "$1" in
23
- --dir) REQ_DIR="$2"; shift 2 ;;
24
- --task) TASK_ID="$(echo "$2" | tr '[:lower:]' '[:upper:]')"; shift 2 ;;
25
- -h|--help) usage; exit 0 ;;
26
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
27
- esac
28
- done
29
-
30
- if [[ -z "$REQ_DIR" || -z "$TASK_ID" ]]; then
31
- usage
32
- exit 1
33
- fi
34
-
35
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
36
- manifest="$(req_do_manifest_path "$CHANGE_DIR")"
37
- runtime_task_dir="$(req_do_task_runtime_dir "$CHANGE_DIR" "$TASK_ID")"
38
- events_file="$runtime_task_dir/events.jsonl"
39
-
40
- task_json="$(jq -c --arg task "$TASK_ID" '.tasks[] | select(.id == $task)' "$manifest" 2>/dev/null || true)"
41
- [[ -n "$task_json" ]] || {
42
- echo "Task $TASK_ID not found in manifest" >&2
43
- exit 1
44
- }
45
-
46
- while IFS= read -r dependency; do
47
- dep_status="$(jq -r --arg dep "$dependency" '.tasks[] | select(.id == $dep) | .status // "pending"' "$manifest" 2>/dev/null || echo pending)"
48
- [[ "$dep_status" == "passed" || "$dep_status" == "completed" || "$dep_status" == "done" || "$dep_status" == "verified" ]] || {
49
- echo "Task $TASK_ID dependency $dependency is not complete" >&2
50
- exit 1
51
- }
52
- done < <(jq -r '(.dependsOn // [])[]?' <<<"$task_json")
53
-
54
- spec_verdict="$(jq -r --arg task "$TASK_ID" '.tasks[] | select(.id == $task) | .reviews.spec // "pending"' "$manifest" 2>/dev/null || echo pending)"
55
- code_verdict="$(jq -r --arg task "$TASK_ID" '.tasks[] | select(.id == $task) | .reviews.code // "pending"' "$manifest" 2>/dev/null || echo pending)"
56
-
57
- [[ "$spec_verdict" == "pass" ]] || {
58
- echo "Task $TASK_ID spec review verdict is not pass" >&2
59
- exit 1
60
- }
61
-
62
- [[ "$code_verdict" == "pass" ]] || {
63
- echo "Task $TASK_ID code review verdict is not pass" >&2
64
- exit 1
65
- }
66
-
67
- if [[ -f "$events_file" ]]; then
68
- events=()
69
- while IFS= read -r event; do
70
- events+=("$event")
71
- done < <(jq -r --arg task "$TASK_ID" 'select(.taskId == $task) | .type' "$events_file")
72
-
73
- if [[ ${#events[@]} -gt 0 ]]; then
74
- first_index() {
75
- local target="$1"
76
- local index=0
77
- for event in "${events[@]}"; do
78
- if [[ "$event" == "$target" ]]; then
79
- echo "$index"
80
- return
81
- fi
82
- index=$((index + 1))
83
- done
84
- echo "-1"
85
- }
86
-
87
- assert_before() {
88
- local before="$1"
89
- local after="$2"
90
- local before_idx after_idx
91
- before_idx="$(first_index "$before")"
92
- after_idx="$(first_index "$after")"
93
- if [[ "$before_idx" != "-1" && "$after_idx" != "-1" && "$before_idx" -ge "$after_idx" ]]; then
94
- echo "Task $TASK_ID gate order is invalid: $before must precede $after" >&2
95
- exit 1
96
- fi
97
- }
98
-
99
- assert_before "red_failed" "red_reason_verified"
100
- assert_before "red_reason_verified" "red_seam_verified"
101
- assert_before "red_seam_verified" "red_behavior_verified"
102
- assert_before "red_behavior_verified" "mock_boundary_verified"
103
- assert_before "mock_boundary_verified" "green_passed"
104
- assert_before "red_failed" "green_passed"
105
- assert_before "green_passed" "refactor_green"
106
- fi
107
- fi
108
-
109
- echo "Task $TASK_ID gates verified"
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 兼容旧入口:只写必要的 CLI 事件,不再生成 checkpoint.json
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage:
12
- write-task-checkpoint.sh --dir path/to/change --task T001 --status pending|running|passed|failed|skipped [--summary "..."] [--event context_ready] [--attempt 0] [--session session-id] [--next-action "..."] [--tdd-json '{"red":...}']
13
- EOF
14
- }
15
-
16
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
- source "$SCRIPT_DIR/cc-do-common.sh"
18
- REQ_DIR=""
19
- TASK_ID=""
20
- STATUS=""
21
- SUMMARY=""
22
- EVENT_TYPE=""
23
- ATTEMPT="0"
24
- SESSION_ID=""
25
- NEXT_ACTION=""
26
- TDD_JSON=""
27
-
28
- while [[ $# -gt 0 ]]; do
29
- case "$1" in
30
- --dir) REQ_DIR="$2"; shift 2 ;;
31
- --task) TASK_ID="$(echo "$2" | tr '[:lower:]' '[:upper:]')"; shift 2 ;;
32
- --status) STATUS="$2"; shift 2 ;;
33
- --summary) SUMMARY="$2"; shift 2 ;;
34
- --event) EVENT_TYPE="$2"; shift 2 ;;
35
- --attempt) ATTEMPT="$2"; shift 2 ;;
36
- --session) SESSION_ID="$2"; shift 2 ;;
37
- --next-action) NEXT_ACTION="$2"; shift 2 ;;
38
- --tdd-json) TDD_JSON="$2"; shift 2 ;;
39
- -h|--help) usage; exit 0 ;;
40
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
41
- esac
42
- done
43
-
44
- if [[ -z "$REQ_DIR" || -z "$TASK_ID" || -z "$STATUS" ]]; then
45
- usage
46
- exit 1
47
- fi
48
-
49
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
50
- manifest="$(req_do_manifest_path "$CHANGE_DIR")"
51
- change_id="$(jq -r '.changeId // .requirementId // "REQ-UNKNOWN"' "$manifest" 2>/dev/null || basename "$REQ_DIR")"
52
- timestamp="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
53
- runtime_task_dir="$(req_do_task_runtime_dir "$CHANGE_DIR" "$TASK_ID")"
54
-
55
- if [[ -z "$SESSION_ID" ]]; then
56
- SESSION_ID="${TASK_ID}-$(date -u +%s)"
57
- fi
58
-
59
- tdd_payload="null"
60
- if [[ -n "$TDD_JSON" ]]; then
61
- if [[ -f "$TDD_JSON" ]]; then
62
- tdd_payload="$(jq -c . "$TDD_JSON")"
63
- else
64
- tdd_payload="$(printf '%s' "$TDD_JSON" | jq -c .)"
65
- fi
66
- fi
67
-
68
- if [[ -n "$EVENT_TYPE" || "$STATUS" == "failed" ]]; then
69
- mkdir -p "$runtime_task_dir"
70
- jq -nc \
71
- --arg type "${EVENT_TYPE:-status_$STATUS}" \
72
- --arg changeId "$change_id" \
73
- --arg taskId "$TASK_ID" \
74
- --arg sessionId "$SESSION_ID" \
75
- --arg status "$STATUS" \
76
- --arg summary "$SUMMARY" \
77
- --arg nextAction "$NEXT_ACTION" \
78
- --arg timestamp "$timestamp" \
79
- --argjson tdd "$tdd_payload" \
80
- '{
81
- type: $type,
82
- changeId: $changeId,
83
- taskId: $taskId,
84
- sessionId: $sessionId,
85
- status: $status,
86
- summary: $summary,
87
- nextAction: $nextAction,
88
- timestamp: $timestamp
89
- } + (if $tdd == null then {} else {tdd: $tdd} end)' >> "$runtime_task_dir/events.jsonl"
90
- fi
91
-
92
- echo "No checkpoint written; task truth lives in planning/tasks.md and planning/task-manifest.json"
@@ -1,225 +0,0 @@
1
- {
2
- "changeId": "FIX-XXX",
3
- "requirementId": "FIX-XXX",
4
- "requirementVersion": "FIX-XXX.v1",
5
- "outputPolicy": {
6
- "documentLanguage": ""
7
- },
8
- "planningMeta": {
9
- "ccInvestigateSkillVersion": "1.5.0",
10
- "analysisVersion": "analysis.v1",
11
- "workBranch": "FIX/XXX-short-bug-name",
12
- "approvedAt": "2026-04-17T12:00:00.000Z",
13
- "basedOnRootCause": "Root cause sentence"
14
- },
15
- "investigationMeta": {
16
- "symptomStatus": "stable",
17
- "reproductionPath": "npm test -- src/feature/feature.test.ts",
18
- "feedbackLoop": {
19
- "loopType": "failing-test",
20
- "commandOrDriver": "npm test -- src/feature/feature.test.ts",
21
- "expectedFailingSignal": "The test fails with the user-reported behavior",
22
- "actualFailingSignal": "Observed failure output from the current repo",
23
- "symptomMatchEvidence": "Failure output matches the reported symptom, not a nearby unrelated failure",
24
- "runtime": "under 10s",
25
- "determinism": "deterministic",
26
- "failureRate": "100%",
27
- "signalSpecificity": "asserts the exact broken behavior",
28
- "sharpeningPlan": "Narrow setup or assertions if the loop becomes slow or broad",
29
- "evidenceRequest": ""
30
- },
31
- "patternAnalysis": {
32
- "selectedPattern": "null propagation",
33
- "ruledOutPatterns": [
34
- "race condition",
35
- "performance regression",
36
- "configuration drift",
37
- "timing guess / flaky wait"
38
- ],
39
- "notes": "Pattern evidence belongs in planning/tasks.md#Root Cause Contract"
40
- },
41
- "boundaryProbes": [
42
- {
43
- "componentBoundary": "api -> service",
44
- "inputObserved": "Request payload matches the reproduced failure",
45
- "outputObserved": "Service receives invalid state",
46
- "configEnvObserved": "Relevant env/config values recorded in analysis.md",
47
- "stateObserved": "State snapshot or log pointer",
48
- "verdict": "fail"
49
- }
50
- ],
51
- "backwardTrace": {
52
- "immediateFailureSite": "file:line or operation where the symptom appears",
53
- "directCaller": "caller that passed the bad value or state",
54
- "callerChain": [
55
- "entrypoint",
56
- "intermediate caller",
57
- "failure site"
58
- ],
59
- "badValueOrigin": "where the invalid data/state first appears",
60
- "originalTrigger": "user action, command, event, config, or dependency response that starts the chain",
61
- "symptomSiteFixRejectedBecause": "Guarding only the failure site would leave the bad upstream contract intact"
62
- },
63
- "rootCauseProof": {
64
- "symptomSite": "User-visible failure, command, UI state, log, or bad artifact",
65
- "firstBadState": "First field, artifact, cache entry, queue message, config, response, or memory object that becomes invalid",
66
- "firstBadStateEvidence": [
67
- "Boundary probe or trace evidence from planning/tasks.md#Root Cause Contract"
68
- ],
69
- "violatedContract": "Schema, invariant, API contract, state transition, trust boundary, or timing condition violated",
70
- "originalTrigger": "User action, command, event, recent diff, config change, or external response that created the first bad state",
71
- "counterfactualProof": {
72
- "method": "Restore the contract, replace input, roll back diff, fix config, or assert the boundary",
73
- "expectedObservation": "The first bad state no longer forms and the symptom disappears",
74
- "actualObservation": "Observed evidence from the current repo"
75
- },
76
- "escapeReason": "Why tests, types, validators, monitoring, review, or artifact gates missed it",
77
- "status": "confirmed"
78
- },
79
- "referenceComparison": {
80
- "similarWorkingExample": "path/to/working/example",
81
- "brokenPath": "path/to/broken/path",
82
- "differencesFound": [
83
- "Working path validates input before persistence"
84
- ],
85
- "differencesAcceptedAsHypothesis": [
86
- "Missing validation before persistence"
87
- ],
88
- "differencesRuledOut": []
89
- },
90
- "diagnosticInstrumentation": [
91
- {
92
- "probeTag": "[DEBUG-FIXXXX-a4f2]",
93
- "probeLocation": "file:line or component boundary",
94
- "questionAnswered": "Which boundary first emits the invalid value?",
95
- "commandToRun": "npm test -- src/feature/feature.test.ts",
96
- "expectedSignal": "Probe records invalid value before the failure site",
97
- "actualSignal": "Observed evidence from the current repo",
98
- "cleanupRequirement": "Remove temporary probe or convert it into a durable assertion/log"
99
- }
100
- ],
101
- "candidateHypotheses": [
102
- {
103
- "rank": 1,
104
- "statement": "Specific, testable root-cause claim",
105
- "whyPlausible": "Reproduction output points to the affected contract",
106
- "prediction": "The failing signal disappears when that contract is restored",
107
- "status": "accepted-for-testing"
108
- }
109
- ],
110
- "priorInvestigations": [],
111
- "researchEvidence": [],
112
- "domainDecisionContext": {
113
- "contextFilesRead": [],
114
- "adrFilesRead": [],
115
- "vocabularyNotes": [],
116
- "adrConflicts": []
117
- },
118
- "rootCauseHypothesis": {
119
- "statement": "Specific, testable root-cause claim",
120
- "falsificationMethod": "Command, log probe, assertion, or code-path check",
121
- "expectedObservation": "What should be observed if the hypothesis is true",
122
- "actualObservation": "Observed evidence from the current repo",
123
- "status": "confirmed"
124
- },
125
- "rootCauseClass": "code",
126
- "noCodeRootCause": {
127
- "whyNotCodeRootCause": "",
128
- "monitoringOrFutureEvidenceNeeded": "",
129
- "operatorHandlingAfterFix": ""
130
- },
131
- "hypothesisAttempts": [
132
- {
133
- "statement": "Specific, testable root-cause claim",
134
- "status": "confirmed",
135
- "evidenceFor": [
136
- "Reproduction output points to the affected code path"
137
- ],
138
- "evidenceAgainst": [],
139
- "falsificationMethod": "Run the reproduction command"
140
- }
141
- ],
142
- "escalationDecision": {
143
- "failedHypothesisCount": 0,
144
- "nextOption": "cc-do",
145
- "recommendation": "Repair the confirmed root cause"
146
- },
147
- "correctTestSeam": {
148
- "testSeam": "public interface or end-to-end path that reaches the real trigger chain",
149
- "publicInterfaceExercised": "CLI/API/UI behavior observed by callers",
150
- "realTriggerChainCoverage": "The test enters through the same trigger path as the bug",
151
- "whyShallowTestRejected": "A lower-level unit test would not prove the upstream contract",
152
- "ifNoCorrectSeam": ""
153
- },
154
- "repairBoundary": {
155
- "affectedModule": "src/feature",
156
- "allowedFiles": [
157
- "src/feature/feature.ts",
158
- "src/feature/feature.test.ts"
159
- ],
160
- "forbiddenFiles": [
161
- "unrelated modules"
162
- ],
163
- "blastRadiusFileCount": 2,
164
- "blastRadiusRisk": "low",
165
- "splitOrRerouteDecision": "single focused repair"
166
- }
167
- },
168
- "currentTaskId": "T001",
169
- "tasks": [
170
- {
171
- "id": "T001",
172
- "title": "[TEST] Capture the bug as a failing reproduction",
173
- "phase": 1,
174
- "status": "pending",
175
- "dependsOn": [],
176
- "parallel": false,
177
- "touches": [
178
- "tests",
179
- "bug-reproduction"
180
- ],
181
- "files": [
182
- "src/feature/feature.test.ts"
183
- ],
184
- "acceptance": [
185
- "The target bug is reproduced as a stable failure",
186
- "The failing loop matches the user-reported symptom",
187
- "The regression test uses the correct seam for the real trigger chain",
188
- "The failure output points to the confirmed root-cause path",
189
- "The reproduction preserves evidence for first bad state and original trigger"
190
- ],
191
- "verification": [
192
- "npm test -- src/feature/feature.test.ts"
193
- ],
194
- "evidence": [
195
- "Failing test output"
196
- ],
197
- "context": {
198
- "readFiles": [
199
- "analysis.md",
200
- "tasks.md",
201
- "change-meta.json"
202
- ],
203
- "commands": [
204
- "npm test -- src/feature/feature.test.ts"
205
- ],
206
- "notes": [
207
- "Prove the bug first",
208
- "Do not repair the symptom site unless analysis proves it is the original trigger",
209
- "Do not change unrelated contracts in this task"
210
- ]
211
- },
212
- "reviews": {
213
- "spec": "pending",
214
- "code": "pending"
215
- },
216
- "type": "TEST",
217
- "run": [
218
- "npm test -- src/feature/feature.test.ts"
219
- ],
220
- "checks": [],
221
- "attempts": 0,
222
- "maxRetries": 1
223
- }
224
- ]
225
- }