cc-devflow 4.5.11 → 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 (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 +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 +13 -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,85 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 检查验证产物和 report-card 是否齐全
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage: verify-gate.sh --report report-card.json [--require FILE...]
12
- EOF
13
- }
14
-
15
- REPORT=""
16
- requires=()
17
-
18
- while [[ $# -gt 0 ]]; do
19
- case "$1" in
20
- --report) REPORT="$2"; shift 2 ;;
21
- --require) requires+=("$2"); shift 2 ;;
22
- -h|--help) usage; exit 0 ;;
23
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
24
- esac
25
- done
26
-
27
- if [[ -z "$REPORT" || ! -f "$REPORT" ]]; then
28
- usage
29
- exit 1
30
- fi
31
-
32
- jq -e '
33
- .changeId and
34
- .overall and
35
- .verdict and
36
- .summary and
37
- .review and
38
- .blockingFindings and
39
- (.runtime and (.runtime | type == "object")) and
40
- (.runtime.status | IN("pass", "fail", "blocked", "skipped", "pending")) and
41
- ((.runtime.failureOwnership? // []) | type == "array") and
42
- ((.runtime.failureOwnership? // []) | all(.[]; (.classification? // "environment") | IN("in-branch", "pre-existing", "environment", "ambiguous"))) and
43
- (.specAlignment? // "blocked") and
44
- ((.specDeltaVerified? // false) | type == "boolean") and
45
- ((.specSyncReady? // false) | type == "boolean") and
46
- .reroute and
47
- .timestamp and
48
- (.verdict | IN("pass", "fail", "blocked")) and
49
- (.overall | IN("pass", "fail")) and
50
- (.reroute | IN("none", "cc-do", "cc-investigate", "cc-plan")) and
51
- (.review.status | IN("pass", "fail", "blocked", "skipped", "pending")) and
52
- ((.review.freshness? // {"status":"unknown"}) | type == "object") and
53
- ((.review.freshness.status? // "unknown") | IN("fresh", "stale", "unknown", "not-applicable")) and
54
- ((.review.specialistReviews? // []) | type == "array") and
55
- ((.claimEvidence? // []) | type == "array") and
56
- ((.claimEvidence? // []) | all(.[];
57
- (.claim and .requiredProof and .commandOrArtifact and .keyObservation and .status) and
58
- (.status | IN("pass", "fail", "blocked", "skipped", "pending"))
59
- )) and
60
- ((.qa? // {"status":"skipped"}) | type == "object") and
61
- ((.qa.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
62
- ((.qa.coverageAudit? // {"status":"skipped"}) | type == "object") and
63
- ((.qa.coverageAudit.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
64
- ((.qa.browserEvidence? // {"status":"skipped"}) | type == "object") and
65
- ((.qa.browserEvidence.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
66
- ((.qa.feedbackLoop? // {"status":"skipped"}) | type == "object") and
67
- ((.qa.feedbackLoop.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
68
- ((.qa.behaviorEvidence? // {"status":"skipped"}) | type == "object") and
69
- ((.qa.behaviorEvidence.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
70
- ((.qa.architectureFollowUps? // []) | type == "array") and
71
- ((.review.findings? // []) | all(.[]; ((.confidenceScore? // 7) | type == "number") and ((.displayTier? // "info") | IN("blocking", "warning", "info", "suppressed")))) and
72
- ((.verdict != "pass") or ((.review.freshness.status? // "unknown") | IN("fresh", "not-applicable"))) and
73
- ((.verdict != "pass") or ((.qa.feedbackLoop.status? // "skipped") | IN("pass", "skipped"))) and
74
- ((.verdict != "pass") or ((.qa.behaviorEvidence.status? // "skipped") | IN("pass", "skipped"))) and
75
- ((.verdict != "pass") or (((.runtime.failureOwnership? // []) | map(select(((.classification? // "") | IN("in-branch", "ambiguous")) and ((.status? // "open") | IN("open", "pending")))) | length) == 0)) and
76
- ((.verdict == "pass" and .reroute == "none") or (.verdict != "pass" and .reroute != "none"))
77
- ' "$REPORT" >/dev/null
78
-
79
- if (( ${#requires[@]} > 0 )); then
80
- for file in "${requires[@]}"; do
81
- [[ -f "$file" ]] || { echo "Missing required file: $file" >&2; exit 1; }
82
- done
83
- fi
84
-
85
- echo "Gate report is structurally valid"
@@ -1,175 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -euo pipefail
4
-
5
- # ------------------------------------------------------------
6
- # 组装当前任务的执行上下文,只输出到 stdout
7
- # ------------------------------------------------------------
8
-
9
- usage() {
10
- cat <<'EOF'
11
- Usage:
12
- build-task-context.sh --dir path/to/change --task T001
13
- EOF
14
- }
15
-
16
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
- source "$SCRIPT_DIR/cc-do-common.sh"
18
- REQ_DIR=""
19
- TASK_ID=""
20
-
21
- while [[ $# -gt 0 ]]; do
22
- case "$1" in
23
- --dir) REQ_DIR="$2"; shift 2 ;;
24
- --task) TASK_ID="$(echo "$2" | tr '[:lower:]' '[:upper:]')"; shift 2 ;;
25
- -h|--help) usage; exit 0 ;;
26
- *) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
27
- esac
28
- done
29
-
30
- if [[ -z "$REQ_DIR" || -z "$TASK_ID" || ! -d "$REQ_DIR" ]]; then
31
- usage
32
- exit 1
33
- fi
34
-
35
- CHANGE_DIR="$(req_do_resolve_change_dir "$REQ_DIR")"
36
- manifest="$(req_do_manifest_path "$CHANGE_DIR")"
37
- design_file="$(req_do_contract_path "$CHANGE_DIR")"
38
- tasks_file="$(req_do_tasks_path "$CHANGE_DIR")"
39
- change_meta="$(req_do_change_meta_path "$CHANGE_DIR")"
40
- resume_index="$(req_do_resume_index_path "$CHANGE_DIR")"
41
-
42
- if [[ ! -f "$manifest" ]]; then
43
- echo "Missing $manifest" >&2
44
- exit 1
45
- fi
46
-
47
- task_json="$(jq -c --arg task "$TASK_ID" '.tasks[] | select(.id == $task)' "$manifest")"
48
- if [[ -z "$task_json" ]]; then
49
- echo "$TASK_ID not found in manifest" >&2
50
- exit 1
51
- fi
52
-
53
- change_id="$(jq -r '.changeId // .requirementId // "REQ-UNKNOWN"' "$manifest")"
54
- ready_json="$("$SCRIPT_DIR/select-ready-tasks.sh" --manifest "$manifest")"
55
-
56
- list_or_none() {
57
- local value="$1"
58
- if [[ -z "${value//$'\n'/}" ]]; then
59
- echo "- None"
60
- else
61
- printf '%s\n' "$value" | sed '/^$/d' | awk '!seen[$0]++' | sed 's/^/- /'
62
- fi
63
- }
64
-
65
- task_title="$(jq -r '.title // ""' <<<"$task_json")"
66
- task_phase="$(jq -r '.phase // 0' <<<"$task_json")"
67
- task_status="$(jq -r '.status // "pending"' <<<"$task_json")"
68
- task_parallel="$(jq -r '.parallel // false' <<<"$task_json")"
69
- task_depends="$(jq -r '(.dependsOn // [])[]?' <<<"$task_json")"
70
- task_touches="$(jq -r '((.touches // .files // [])[]?)' <<<"$task_json")"
71
- task_acceptance="$(jq -r '(.acceptance // [])[]?' <<<"$task_json")"
72
- task_verification="$(jq -r '(.verification // [])[]?' <<<"$task_json")"
73
- task_read_files="$(jq -r '(.context.readFiles // [])[]?' <<<"$task_json")"
74
- task_commands="$(jq -r '(.context.commands // [])[]?' <<<"$task_json")"
75
- task_notes="$(jq -r '(.context.notes // [])[]?' <<<"$task_json")"
76
- completed_tasks="$(jq -r '
77
- .tasks[]
78
- | select((.status // "pending") == "passed" or (.status // "pending") == "completed" or (.status // "pending") == "done" or (.status // "pending") == "verified")
79
- | .id
80
- ' "$manifest")"
81
- ready_tasks="$(echo "$ready_json" | jq -r '.readyTasks[]?.id')"
82
- running_tasks="$(echo "$ready_json" | jq -r '.runningTasks[]?.id')"
83
- active_phase="$(echo "$ready_json" | jq -r '.activePhase // "unknown"')"
84
- spec_source="$manifest"
85
- if [[ -f "$change_meta" ]]; then
86
- spec_source="$change_meta"
87
- fi
88
- primary_capability="$(jq -r '.spec.primaryCapability // empty' "$spec_source" 2>/dev/null || true)"
89
- secondary_capabilities="$(jq -r '(.spec.secondaryCapabilities // [])[]?' "$spec_source" 2>/dev/null || true)"
90
- spec_files="$(jq -r '(.spec.specFiles // [])[]?' "$spec_source" 2>/dev/null || true)"
91
- expected_delta="$(jq -r '(.spec.expectedDelta // [])[]?' "$spec_source" 2>/dev/null || true)"
92
- sync_status="$(jq -r '.spec.syncStatus // "unknown"' "$spec_source" 2>/dev/null || true)"
93
-
94
- {
95
- echo "# Task Context"
96
- echo
97
- echo "- Change: $change_id"
98
- echo "- Task: $TASK_ID"
99
- echo "- Title: $task_title"
100
- echo "- Phase: $task_phase"
101
- echo "- Status: $task_status"
102
- echo "- Parallel eligible: $task_parallel"
103
- echo "- Active phase: $active_phase"
104
- echo
105
- echo "## Current Progress"
106
- echo
107
- echo "### Completed Tasks"
108
- list_or_none "$completed_tasks"
109
- echo
110
- echo "### Running Tasks"
111
- list_or_none "$running_tasks"
112
- echo
113
- echo "### Ready Tasks"
114
- list_or_none "$ready_tasks"
115
- echo
116
- echo "## Dependencies"
117
- echo
118
- list_or_none "$task_depends"
119
- echo
120
- echo "## Touches"
121
- echo
122
- list_or_none "$task_touches"
123
- echo
124
- echo "## Acceptance"
125
- echo
126
- list_or_none "$task_acceptance"
127
- echo
128
- echo "## Verification"
129
- echo
130
- list_or_none "$task_verification"
131
- echo
132
- echo "## Read First"
133
- echo
134
- list_or_none "$task_read_files"
135
- echo
136
- echo "## Commands To Trust"
137
- echo
138
- list_or_none "$task_commands"
139
- echo
140
- echo "## Spec Contract"
141
- echo
142
- echo "- Primary capability: ${primary_capability:-none}"
143
- echo "- Spec sync status: ${sync_status:-unknown}"
144
- echo
145
- echo "### Secondary Capabilities"
146
- list_or_none "$secondary_capabilities"
147
- echo
148
- echo "### Capability Specs"
149
- list_or_none "$spec_files"
150
- echo
151
- echo "### Expected Spec Delta"
152
- list_or_none "$expected_delta"
153
- echo
154
- echo "## Task Notes"
155
- echo
156
- list_or_none "$task_notes"
157
- echo
158
- echo "## Canonical Planning Files"
159
- echo
160
- [[ -f "$design_file" ]] && echo "- ${design_file#$CHANGE_DIR/}"
161
- [[ -f "$tasks_file" ]] && echo "- ${tasks_file#$CHANGE_DIR/}"
162
- [[ -f "$change_meta" ]] && echo "- ${change_meta#$CHANGE_DIR/}"
163
- echo "- planning/task-manifest.json"
164
- echo
165
- echo "## Context Reset"
166
- echo
167
- echo "- If chat context drifts, discard conversational memory and reload only the canonical files above, current Git state, and CLI logs."
168
- echo "- Do not continue from memory if the current task, active phase, or latest verification status cannot be restated exactly."
169
- echo
170
- if [[ -f "$resume_index" ]]; then
171
- echo "## Optional Resume Index"
172
- echo
173
- cat "$resume_index"
174
- fi
175
- }
@@ -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"