cc-devflow 2.4.6 → 4.1.0

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 (191) hide show
  1. package/.claude/CLAUDE.md +1065 -48
  2. package/.claude/agents/dev-implementer.md +195 -0
  3. package/.claude/commands/{flow-archive.md → flow/archive.md} +46 -11
  4. package/.claude/commands/flow/context.md +150 -0
  5. package/.claude/commands/flow/delta.md +245 -0
  6. package/.claude/commands/{flow-dev.md → flow/dev.md} +112 -11
  7. package/.claude/commands/flow/init.md +45 -0
  8. package/.claude/commands/flow/quality.md +159 -0
  9. package/.claude/commands/flow/spec.md +186 -0
  10. package/.claude/commands/flow/workspace.md +146 -0
  11. package/.claude/commands/{cancel-ralph.md → util/cancel-ralph.md} +1 -0
  12. package/.claude/config/quality-gates.yml +305 -0
  13. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +313 -0
  14. package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +91 -0
  15. package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +151 -0
  16. package/.claude/docs/templates/JOURNAL_TEMPLATE.md +75 -0
  17. package/.claude/docs/templates/_shared/CLAUDE.md +36 -0
  18. package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +125 -0
  19. package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +187 -0
  20. package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +164 -0
  21. package/.claude/docs/templates/context/dev.jsonl.template +6 -0
  22. package/.claude/docs/templates/context/epic.jsonl.template +5 -0
  23. package/.claude/docs/templates/context/prd.jsonl.template +4 -0
  24. package/.claude/docs/templates/context/research.jsonl.template +4 -0
  25. package/.claude/docs/templates/context/review.jsonl.template +5 -0
  26. package/.claude/docs/templates/context/tech.jsonl.template +5 -0
  27. package/.claude/hooks/CLAUDE.md +342 -0
  28. package/.claude/hooks/inject-agent-context.ts +480 -0
  29. package/.claude/hooks/inject-skill-context.ts +359 -0
  30. package/.claude/hooks/ralph-loop.ts +931 -0
  31. package/.claude/hooks/task-completed-hook.ts +593 -0
  32. package/.claude/hooks/teammate-idle-hook.ts +690 -0
  33. package/.claude/hooks/types/team-types.d.ts +238 -0
  34. package/.claude/rules/devflow-conventions.md +82 -9
  35. package/.claude/scripts/archive-requirement.sh +44 -1
  36. package/.claude/scripts/common.sh +670 -3
  37. package/.claude/scripts/delta-parser.ts +527 -0
  38. package/.claude/scripts/detect-file-conflicts.sh +151 -0
  39. package/.claude/scripts/flow-context-add.sh +134 -0
  40. package/.claude/scripts/flow-context-init.sh +133 -0
  41. package/.claude/scripts/flow-context-validate.sh +144 -0
  42. package/.claude/scripts/flow-delta-apply.sh +297 -0
  43. package/.claude/scripts/flow-delta-archive.sh +71 -0
  44. package/.claude/scripts/flow-delta-create.sh +202 -0
  45. package/.claude/scripts/flow-delta-list.sh +142 -0
  46. package/.claude/scripts/flow-delta-status.sh +235 -0
  47. package/.claude/scripts/flow-quality-full.sh +184 -0
  48. package/.claude/scripts/flow-quality-quick.sh +64 -0
  49. package/.claude/scripts/flow-workspace-init.sh +117 -0
  50. package/.claude/scripts/flow-workspace-record.sh +164 -0
  51. package/.claude/scripts/flow-workspace-start.sh +88 -0
  52. package/.claude/scripts/get-workflow-status.sh +415 -0
  53. package/.claude/scripts/parse-task-dependencies.js +334 -0
  54. package/.claude/scripts/record-quality-error.sh +165 -0
  55. package/.claude/scripts/run-quality-gates.sh +242 -0
  56. package/.claude/scripts/team-dev-init.sh +319 -0
  57. package/.claude/scripts/team-state-recovery.sh +229 -0
  58. package/.claude/scripts/workflow-status.ts +433 -0
  59. package/.claude/settings.json +19 -0
  60. package/.claude/skills/cc-devflow-orchestrator/SKILL.md +85 -200
  61. package/.claude/skills/domain/using-git-worktrees/SKILL.md +252 -0
  62. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +133 -0
  63. package/.claude/skills/domain/using-git-worktrees/context.jsonl +4 -0
  64. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +218 -0
  65. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +232 -0
  66. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +130 -0
  67. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +140 -0
  68. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +70 -0
  69. package/.claude/skills/skill-rules.json +72 -1
  70. package/.claude/skills/utility/journey-checker/SKILL.md +199 -0
  71. package/.claude/skills/utility/journey-checker/pressure-scenarios.md +164 -0
  72. package/.claude/skills/utility/skill-creator/LICENSE.txt +202 -0
  73. package/.claude/skills/utility/skill-creator/SKILL.md +356 -0
  74. package/.claude/skills/utility/skill-creator/references/output-patterns.md +82 -0
  75. package/.claude/skills/utility/skill-creator/references/workflows.md +28 -0
  76. package/.claude/skills/utility/skill-creator/scripts/init_skill.py +303 -0
  77. package/.claude/skills/utility/skill-creator/scripts/package_skill.py +110 -0
  78. package/.claude/skills/utility/skill-creator/scripts/quick_validate.py +95 -0
  79. package/.claude/skills/workflow/flow-dev/CLAUDE.md +78 -0
  80. package/.claude/skills/workflow/flow-dev/SKILL.md +96 -0
  81. package/.claude/skills/workflow/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +71 -0
  82. package/.claude/skills/workflow/flow-dev/context.jsonl +8 -0
  83. package/.claude/skills/workflow/flow-dev/dev-implementer.jsonl +8 -0
  84. package/.claude/skills/workflow/flow-dev/scripts/entry-gate.sh +116 -0
  85. package/.claude/skills/workflow/flow-dev/scripts/exit-gate.sh +101 -0
  86. package/.claude/skills/workflow/flow-dev/scripts/task-orchestrator.sh +106 -0
  87. package/.claude/skills/workflow/flow-fix/SKILL.md +105 -0
  88. package/.claude/skills/workflow/flow-fix/context.jsonl +6 -0
  89. package/.claude/skills/workflow/flow-fix/references/bug-analyzer.md +381 -0
  90. package/.claude/skills/workflow/flow-init/SKILL.md +211 -0
  91. package/.claude/skills/workflow/flow-init/assets/BRAINSTORM_TEMPLATE.md +148 -0
  92. package/.claude/skills/workflow/flow-init/assets/INIT_FLOW_TEMPLATE.md +198 -0
  93. package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +276 -0
  94. package/.claude/skills/workflow/flow-init/context.jsonl +5 -0
  95. package/.claude/skills/workflow/flow-init/references/flow-researcher.md +132 -0
  96. package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +232 -0
  97. package/.claude/skills/workflow/flow-init/scripts/consolidate-research.sh +182 -0
  98. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +515 -0
  99. package/.claude/skills/workflow/flow-init/scripts/generate-research-tasks.sh +157 -0
  100. package/.claude/skills/workflow/flow-init/scripts/populate-research-tasks.sh +284 -0
  101. package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +332 -0
  102. package/.claude/skills/workflow/flow-quality/SKILL.md +94 -0
  103. package/.claude/skills/workflow/flow-quality/context.jsonl +6 -0
  104. package/.claude/skills/workflow/flow-quality/references/code-quality-reviewer.md +205 -0
  105. package/.claude/skills/workflow/flow-quality/references/qa-tester.md +313 -0
  106. package/.claude/skills/workflow/flow-quality/references/security-reviewer.md +314 -0
  107. package/.claude/skills/workflow/flow-quality/references/spec-reviewer.md +221 -0
  108. package/.claude/skills/workflow/flow-release/SKILL.md +126 -0
  109. package/.claude/skills/workflow/flow-release/context.jsonl +7 -0
  110. package/.claude/skills/workflow/flow-release/references/release-manager.md +295 -0
  111. package/.claude/skills/workflow/flow-spec/CLAUDE.md +103 -0
  112. package/.claude/skills/workflow/flow-spec/SKILL.md +545 -0
  113. package/.claude/skills/workflow/flow-spec/context.jsonl +7 -0
  114. package/.claude/skills/workflow/flow-spec/scripts/entry-gate.sh +194 -0
  115. package/.claude/skills/workflow/flow-spec/scripts/exit-gate.sh +244 -0
  116. package/.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh +205 -0
  117. package/.claude/skills/workflow/flow-spec/scripts/team-communication.sh +353 -0
  118. package/.claude/skills/workflow/flow-spec/scripts/team-init.sh +195 -0
  119. package/.claude/skills/workflow/flow-spec/scripts/test-team-mode.sh +496 -0
  120. package/.claude/skills/workflow/flow-spec/team-config.json +165 -0
  121. package/.claude/skills/workflow.yaml +417 -0
  122. package/CHANGELOG.md +254 -0
  123. package/README.md +193 -33
  124. package/README.zh-CN.md +206 -46
  125. package/lib/compiler/CLAUDE.md +77 -46
  126. package/lib/compiler/__tests__/multi-module-emitters.test.js +508 -0
  127. package/lib/compiler/context-expander.js +179 -0
  128. package/lib/compiler/emitters/antigravity-emitter.js +195 -5
  129. package/lib/compiler/emitters/base-emitter.js +217 -2
  130. package/lib/compiler/emitters/codex-emitter.js +200 -4
  131. package/lib/compiler/emitters/cursor-emitter.js +307 -3
  132. package/lib/compiler/emitters/qwen-emitter.js +196 -4
  133. package/lib/compiler/index.js +197 -2
  134. package/lib/compiler/platforms.js +270 -21
  135. package/package.json +1 -1
  136. package/.claude/commands/flow-epic.md +0 -183
  137. package/.claude/commands/flow-init.md +0 -370
  138. package/.claude/commands/flow-prd.md +0 -144
  139. package/.claude/commands/flow-qa.md +0 -93
  140. package/.claude/commands/flow-review.md +0 -257
  141. package/.claude/commands/flow-tech.md +0 -142
  142. package/.claude/commands/flow-ui.md +0 -189
  143. package/.claude/skills/file-header-guardian/SKILL.md +0 -56
  144. package/.claude/skills/skill-developer/ADVANCED.md +0 -197
  145. package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
  146. package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
  147. package/.claude/skills/skill-developer/SKILL.md +0 -426
  148. package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
  149. package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
  150. package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
  151. package/.claude/skills/writing-skills/SKILL.md +0 -655
  152. package/.claude/skills/writing-skills/anthropic-best-practices.md +0 -1150
  153. package/.claude/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
  154. package/.claude/skills/writing-skills/graphviz-conventions.dot +0 -172
  155. package/.claude/skills/writing-skills/persuasion-principles.md +0 -187
  156. package/.claude/skills/writing-skills/render-graphs.js +0 -168
  157. package/.claude/skills/writing-skills/testing-skills-with-subagents.md +0 -384
  158. package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +0 -1
  159. package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +0 -1
  160. /package/.claude/commands/{core-architecture.md → core/architecture.md} +0 -0
  161. /package/.claude/commands/{core-guidelines.md → core/guidelines.md} +0 -0
  162. /package/.claude/commands/{core-roadmap.md → core/roadmap.md} +0 -0
  163. /package/.claude/commands/{core-style.md → core/style.md} +0 -0
  164. /package/.claude/commands/{flow-checklist.md → flow/checklist.md} +0 -0
  165. /package/.claude/commands/{flow-clarify.md → flow/clarify.md} +0 -0
  166. /package/.claude/commands/{flow-constitution.md → flow/constitution.md} +0 -0
  167. /package/.claude/commands/{flow-fix.md → flow/fix.md} +0 -0
  168. /package/.claude/commands/{flow-ideate.md → flow/ideate.md} +0 -0
  169. /package/.claude/commands/{flow-new.md → flow/new.md} +0 -0
  170. /package/.claude/commands/{flow-release.md → flow/release.md} +0 -0
  171. /package/.claude/commands/{flow-restart.md → flow/restart.md} +0 -0
  172. /package/.claude/commands/{flow-status.md → flow/status.md} +0 -0
  173. /package/.claude/commands/{flow-update.md → flow/update.md} +0 -0
  174. /package/.claude/commands/{flow-upgrade.md → flow/upgrade.md} +0 -0
  175. /package/.claude/commands/{flow-verify.md → flow/verify.md} +0 -0
  176. /package/.claude/commands/{code-review-high.md → util/code-review.md} +0 -0
  177. /package/.claude/commands/{git-commit.md → util/git-commit.md} +0 -0
  178. /package/.claude/commands/{problem-analyzer.md → util/problem-analyzer.md} +0 -0
  179. /package/.claude/skills/{flow-attention-refresh → domain/attention-refresh}/SKILL.md +0 -0
  180. /package/.claude/skills/{flow-brainstorming → domain/brainstorming}/SKILL.md +0 -0
  181. /package/.claude/skills/{flow-debugging → domain/debugging}/SKILL.md +0 -0
  182. /package/.claude/skills/{flow-finishing-branch → domain/finishing-branch}/SKILL.md +0 -0
  183. /package/.claude/skills/{flow-receiving-review → domain/receiving-review}/SKILL.md +0 -0
  184. /package/.claude/skills/{flow-tdd → domain/tdd}/SKILL.md +0 -0
  185. /package/.claude/skills/{verification-before-completion → domain/verification}/SKILL.md +0 -0
  186. /package/.claude/skills/{constitution-guardian → guardrail/constitution-guardian}/SKILL.md +0 -0
  187. /package/.claude/skills/{devflow-tdd-enforcer → guardrail/tdd-enforcer}/SKILL.md +0 -0
  188. /package/.claude/skills/{devflow-constitution-quick-ref → utility/constitution-quick-ref}/SKILL.md +0 -0
  189. /package/.claude/skills/{devflow-file-standards → utility/file-standards}/SKILL.md +0 -0
  190. /package/.claude/skills/{fractal-docs-generator → utility/fractal-docs}/SKILL.md +0 -0
  191. /package/.claude/skills/{npm-release → utility/npm-release}/SKILL.md +0 -0
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # worktree-list.sh - List all git worktrees
4
+ # =============================================================================
5
+ #
6
+ # Usage: worktree-list.sh [OPTIONS]
7
+ #
8
+ # OPTIONS:
9
+ # --json Output in JSON format
10
+ # --verbose, -v Show detailed information
11
+ # --help, -h Show help message
12
+ #
13
+ # [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
14
+
15
+ set -e
16
+
17
+ JSON_MODE=false
18
+ VERBOSE=false
19
+
20
+ while [[ $# -gt 0 ]]; do
21
+ case "$1" in
22
+ --json)
23
+ JSON_MODE=true
24
+ shift
25
+ ;;
26
+ --verbose|-v)
27
+ VERBOSE=true
28
+ shift
29
+ ;;
30
+ --help|-h)
31
+ cat << 'EOF'
32
+ Usage: worktree-list.sh [OPTIONS]
33
+
34
+ List all git worktrees.
35
+
36
+ OPTIONS:
37
+ --json Output in JSON format
38
+ --verbose, -v Show detailed information
39
+ --help, -h Show help message
40
+ EOF
41
+ exit 0
42
+ ;;
43
+ *)
44
+ echo "ERROR: Unknown option '$1'. Use --help for usage." >&2
45
+ exit 1
46
+ ;;
47
+ esac
48
+ done
49
+
50
+ # =============================================================================
51
+ # Source Common Functions
52
+ # =============================================================================
53
+
54
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
+ COMMON_SH="$SCRIPT_DIR/../../../scripts/common.sh"
56
+
57
+ if [[ -f "$COMMON_SH" ]]; then
58
+ source "$COMMON_SH"
59
+ fi
60
+
61
+ # =============================================================================
62
+ # Get Main Repo
63
+ # =============================================================================
64
+
65
+ MAIN_REPO=$(git rev-parse --show-toplevel 2>/dev/null)
66
+ if [[ -z "$MAIN_REPO" ]]; then
67
+ echo "ERROR: Not in a git repository" >&2
68
+ exit 1
69
+ fi
70
+
71
+ # =============================================================================
72
+ # List Worktrees
73
+ # =============================================================================
74
+
75
+ if $JSON_MODE; then
76
+ echo "["
77
+ first=true
78
+ while IFS= read -r line; do
79
+ if [[ "$line" =~ ^worktree ]]; then
80
+ if ! $first; then
81
+ echo ","
82
+ fi
83
+ first=false
84
+ path="${line#worktree }"
85
+ elif [[ "$line" =~ ^HEAD ]]; then
86
+ head="${line#HEAD }"
87
+ elif [[ "$line" =~ ^branch ]]; then
88
+ branch="${line#branch refs/heads/}"
89
+ # Extract REQ_ID from path
90
+ req_id=""
91
+ if [[ "$path" =~ -([A-Z]+-[0-9]+)$ ]]; then
92
+ req_id="${BASH_REMATCH[1]}"
93
+ fi
94
+ printf '{"path":"%s","branch":"%s","head":"%s","req_id":"%s"}' \
95
+ "$path" "$branch" "$head" "$req_id"
96
+ elif [[ "$line" =~ ^detached ]]; then
97
+ branch="(detached)"
98
+ req_id=""
99
+ if [[ "$path" =~ -([A-Z]+-[0-9]+)$ ]]; then
100
+ req_id="${BASH_REMATCH[1]}"
101
+ fi
102
+ printf '{"path":"%s","branch":"%s","head":"%s","req_id":"%s"}' \
103
+ "$path" "$branch" "$head" "$req_id"
104
+ fi
105
+ done < <(git worktree list --porcelain)
106
+ echo ""
107
+ echo "]"
108
+ else
109
+ echo "Git Worktrees:"
110
+ echo ""
111
+
112
+ if $VERBOSE; then
113
+ git worktree list --porcelain | while IFS= read -r line; do
114
+ if [[ "$line" =~ ^worktree ]]; then
115
+ path="${line#worktree }"
116
+ echo "Path: $path"
117
+ elif [[ "$line" =~ ^HEAD ]]; then
118
+ echo "HEAD: ${line#HEAD }"
119
+ elif [[ "$line" =~ ^branch ]]; then
120
+ echo "Branch: ${line#branch refs/heads/}"
121
+ echo ""
122
+ elif [[ "$line" =~ ^detached ]]; then
123
+ echo "Branch: (detached)"
124
+ echo ""
125
+ fi
126
+ done
127
+ else
128
+ git worktree list
129
+ fi
130
+ fi
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # worktree-status.sh - Check current worktree status
4
+ # =============================================================================
5
+ #
6
+ # Usage: worktree-status.sh [OPTIONS]
7
+ #
8
+ # OPTIONS:
9
+ # --json Output in JSON format
10
+ # --help, -h Show help message
11
+ #
12
+ # [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
13
+
14
+ set -e
15
+
16
+ JSON_MODE=false
17
+
18
+ while [[ $# -gt 0 ]]; do
19
+ case "$1" in
20
+ --json)
21
+ JSON_MODE=true
22
+ shift
23
+ ;;
24
+ --help|-h)
25
+ cat << 'EOF'
26
+ Usage: worktree-status.sh [OPTIONS]
27
+
28
+ Check current worktree status.
29
+
30
+ OPTIONS:
31
+ --json Output in JSON format
32
+ --help, -h Show help message
33
+ EOF
34
+ exit 0
35
+ ;;
36
+ *)
37
+ echo "ERROR: Unknown option '$1'. Use --help for usage." >&2
38
+ exit 1
39
+ ;;
40
+ esac
41
+ done
42
+
43
+ # =============================================================================
44
+ # Source Common Functions
45
+ # =============================================================================
46
+
47
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
48
+ COMMON_SH="$SCRIPT_DIR/../../../scripts/common.sh"
49
+
50
+ if [[ -f "$COMMON_SH" ]]; then
51
+ source "$COMMON_SH"
52
+ fi
53
+
54
+ # =============================================================================
55
+ # Gather Information
56
+ # =============================================================================
57
+
58
+ CURRENT_DIR=$(pwd)
59
+ GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "")
60
+
61
+ if [[ -z "$GIT_ROOT" ]]; then
62
+ if $JSON_MODE; then
63
+ printf '{"error":"not_git_repo"}\n'
64
+ else
65
+ echo "ERROR: Not in a git repository" >&2
66
+ fi
67
+ exit 1
68
+ fi
69
+
70
+ # Check if in worktree
71
+ IS_WORKTREE=false
72
+ MAIN_REPO=""
73
+ WORKTREE_COUNT=0
74
+
75
+ # Get worktree info
76
+ GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
77
+ if [[ "$GIT_DIR" == *".git/worktrees/"* ]]; then
78
+ IS_WORKTREE=true
79
+ # Extract main repo path from gitdir file
80
+ MAIN_REPO=$(cat "$GIT_ROOT/.git" 2>/dev/null | sed 's/gitdir: //' | sed 's|/.git/worktrees/.*||')
81
+ else
82
+ MAIN_REPO="$GIT_ROOT"
83
+ fi
84
+
85
+ # Count worktrees
86
+ WORKTREE_COUNT=$(git worktree list | wc -l | tr -d ' ')
87
+
88
+ # Get current branch
89
+ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
90
+
91
+ # Extract REQ_ID from path or branch
92
+ REQ_ID=""
93
+ if [[ "$GIT_ROOT" =~ -([A-Z]+-[0-9]+)$ ]]; then
94
+ REQ_ID="${BASH_REMATCH[1]}"
95
+ elif [[ "$BRANCH" =~ (REQ-[0-9]+|BUG-[0-9]+) ]]; then
96
+ REQ_ID="${BASH_REMATCH[1]}"
97
+ fi
98
+
99
+ # Check git status
100
+ HAS_CHANGES=false
101
+ if [[ -n $(git status --porcelain 2>/dev/null) ]]; then
102
+ HAS_CHANGES=true
103
+ fi
104
+
105
+ # =============================================================================
106
+ # Output
107
+ # =============================================================================
108
+
109
+ if $JSON_MODE; then
110
+ printf '{"current_dir":"%s","git_root":"%s","is_worktree":%s,"main_repo":"%s","branch":"%s","req_id":"%s","worktree_count":%d,"has_changes":%s}\n' \
111
+ "$CURRENT_DIR" \
112
+ "$GIT_ROOT" \
113
+ "$IS_WORKTREE" \
114
+ "$MAIN_REPO" \
115
+ "$BRANCH" \
116
+ "$REQ_ID" \
117
+ "$WORKTREE_COUNT" \
118
+ "$HAS_CHANGES"
119
+ else
120
+ echo "Worktree Status"
121
+ echo "==============="
122
+ echo ""
123
+ echo "Current Directory: $CURRENT_DIR"
124
+ echo "Git Root: $GIT_ROOT"
125
+ echo "Is Worktree: $IS_WORKTREE"
126
+ echo "Main Repo: $MAIN_REPO"
127
+ echo "Branch: $BRANCH"
128
+ if [[ -n "$REQ_ID" ]]; then
129
+ echo "Requirement ID: $REQ_ID"
130
+ fi
131
+ echo "Total Worktrees: $WORKTREE_COUNT"
132
+ echo "Has Changes: $HAS_CHANGES"
133
+ echo ""
134
+
135
+ if $IS_WORKTREE; then
136
+ echo "You are in a worktree. Main repo is at: $MAIN_REPO"
137
+ else
138
+ echo "You are in the main repository."
139
+ fi
140
+ fi
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # worktree-switch.sh - Switch to a worktree by REQ_ID
4
+ # =============================================================================
5
+ #
6
+ # Usage: worktree-switch.sh REQ_ID
7
+ #
8
+ # This script outputs the path to switch to. Use with:
9
+ # cd $(worktree-switch.sh REQ-123)
10
+ #
11
+ # [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
12
+
13
+ set -e
14
+
15
+ REQ_ID=""
16
+
17
+ while [[ $# -gt 0 ]]; do
18
+ case "$1" in
19
+ --help|-h)
20
+ cat << 'EOF'
21
+ Usage: worktree-switch.sh REQ_ID
22
+
23
+ Switch to a worktree by REQ_ID.
24
+
25
+ This script outputs the path to switch to. Use with:
26
+ cd $(worktree-switch.sh REQ-123)
27
+
28
+ Or use the zw shell function:
29
+ zw REQ-123
30
+ EOF
31
+ exit 0
32
+ ;;
33
+ -*)
34
+ echo "ERROR: Unknown option '$1'. Use --help for usage." >&2
35
+ exit 1
36
+ ;;
37
+ *)
38
+ REQ_ID="$1"
39
+ shift
40
+ ;;
41
+ esac
42
+ done
43
+
44
+ if [[ -z "$REQ_ID" ]]; then
45
+ echo "ERROR: REQ_ID is required. Use --help for usage." >&2
46
+ exit 1
47
+ fi
48
+
49
+ # Normalize to uppercase
50
+ REQ_ID=$(echo "$REQ_ID" | tr '[:lower:]' '[:upper:]')
51
+
52
+ # =============================================================================
53
+ # Find Worktree
54
+ # =============================================================================
55
+
56
+ MAIN_REPO=$(git rev-parse --show-toplevel 2>/dev/null)
57
+ if [[ -z "$MAIN_REPO" ]]; then
58
+ echo "ERROR: Not in a git repository" >&2
59
+ exit 1
60
+ fi
61
+
62
+ REPO_NAME=$(basename "$MAIN_REPO")
63
+ WORKTREE_DIR="$(dirname "$MAIN_REPO")/${REPO_NAME}-${REQ_ID}"
64
+
65
+ if [[ -d "$WORKTREE_DIR" ]]; then
66
+ echo "$WORKTREE_DIR"
67
+ else
68
+ echo "ERROR: Worktree not found: $WORKTREE_DIR" >&2
69
+ exit 1
70
+ fi
@@ -264,6 +264,77 @@
264
264
  "should I.*?(test first|write implementation)"
265
265
  ]
266
266
  }
267
+ },
268
+ "journey-coherence-checker": {
269
+ "type": "domain",
270
+ "enforcement": "suggest",
271
+ "priority": "high",
272
+ "description": "Use when completing a requirement, checking milestone progress, or asking about project status. Detects gaps between requirements, unmet dependencies, and cumulative scope drift.",
273
+ "promptTriggers": {
274
+ "keywords": [
275
+ "需求完成",
276
+ "REQ完成",
277
+ "里程碑",
278
+ "milestone",
279
+ "项目进度",
280
+ "可以发布",
281
+ "发布前检查",
282
+ "全局检查",
283
+ "M1进度",
284
+ "M2进度",
285
+ "M3进度",
286
+ "M4进度",
287
+ "所有需求",
288
+ "依赖满足",
289
+ "journey check",
290
+ "coherence check"
291
+ ],
292
+ "intentPatterns": [
293
+ "(需求|REQ|requirement).*?(完成|done|finished)",
294
+ "(里程碑|milestone).*?(进度|status|完成)",
295
+ "(项目|project).*?(进度|status|如何)",
296
+ "(可以|ready).*?(发布|release)",
297
+ "(所有|all).*?(需求|requirement).*?(完成|done)",
298
+ "(检查|check).*?(全局|global|依赖|dependency)"
299
+ ]
300
+ },
301
+ "fileTriggers": {
302
+ "pathPatterns": [
303
+ "devflow/ROADMAP.md",
304
+ "devflow/requirements/**/orchestration_status.json"
305
+ ]
306
+ }
307
+ },
308
+ "npm-release": {
309
+ "type": "domain",
310
+ "enforcement": "suggest",
311
+ "priority": "high",
312
+ "description": "Standardized release process for cc-devflow npm package. Handles version bumping, changelog updates, and publishing checks.",
313
+ "promptTriggers": {
314
+ "keywords": [
315
+ "publish npm",
316
+ "release version",
317
+ "npm publish",
318
+ "bump version",
319
+ "new release",
320
+ "publish package",
321
+ "update changelog",
322
+ "release workflow"
323
+ ],
324
+ "intentPatterns": [
325
+ "(publish|release).*?(npm|package|version)",
326
+ "(bump|update).*?(version|semver)",
327
+ "(create|generate).*?(release|changelog)",
328
+ "ready to publish",
329
+ "deploy to npm"
330
+ ]
331
+ },
332
+ "fileTriggers": {
333
+ "pathPatterns": [
334
+ "package.json",
335
+ "CHANGELOG.md"
336
+ ]
337
+ }
267
338
  }
268
339
  },
269
340
  "notes": {
@@ -285,4 +356,4 @@
285
356
  "skip_conditions": "All guardrails support session skip, file markers, and env override"
286
357
  }
287
358
  }
288
- }
359
+ }
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: journey-coherence-checker
3
+ description: "Use when completing a requirement, checking milestone progress, or asking about project status. Detects gaps between requirements, unmet dependencies, and cumulative scope drift."
4
+ ---
5
+
6
+ # Journey Coherence Checker
7
+
8
+ ## The Iron Law
9
+
10
+ ```
11
+ STATUS COMPLETE ≠ DEPENDENCY SATISFIED
12
+ CODE EXISTS ≠ JOURNEY WORKS
13
+ REQUIREMENTS DONE ≠ VISION ACHIEVED
14
+ ```
15
+
16
+ ## Overview
17
+
18
+ 单需求验证只检查"这个需求内部是否一致"。
19
+ 本 Skill 检查"所有需求加起来是否等于愿景"。
20
+
21
+ ```
22
+ 问题:
23
+ REQ-001 ✅ + REQ-002 ✅ + REQ-003 ✅ = 愿景 ❓
24
+
25
+ 现实:
26
+ 每个需求"稍微偏差" × N = 巨大偏差
27
+ 需求间的"空隙"没人负责
28
+ 最终产品 ≠ 初始愿景
29
+ ```
30
+
31
+ ## When to Use
32
+
33
+ ```dot
34
+ digraph when {
35
+ "触发场景" [shape=box];
36
+ "需求完成时" [shape=box];
37
+ "检查里程碑时" [shape=box];
38
+ "询问项目进度时" [shape=box];
39
+ "发布前" [shape=box];
40
+
41
+ "触发场景" -> "需求完成时";
42
+ "触发场景" -> "检查里程碑时";
43
+ "触发场景" -> "询问项目进度时";
44
+ "触发场景" -> "发布前";
45
+ }
46
+ ```
47
+
48
+ **触发关键词**:
49
+ - "需求完成了"、"REQ-XXX 做完了"
50
+ - "M1/M2/M3/M4 进度"、"里程碑完成了吗"
51
+ - "项目进度如何"、"可以发布了吗"
52
+ - "所有需求都完成了"
53
+
54
+ ## Coherence Check Protocol
55
+
56
+ ### Step 1: 读取最小上下文 (< 200 tokens)
57
+
58
+ ```yaml
59
+ read:
60
+ - ROADMAP.md: 只读 Milestone 的 Success Criteria 段落
61
+ - orchestration_status.json: 只读 status, dependencies, roadmap_item 字段
62
+ - PRD.md: 只读 User Stories 标题列表(不读内容)
63
+ ```
64
+
65
+ **禁止**: 读取完整文档。上下文越多,偏差越大。
66
+
67
+ ### Step 2: 依赖满足检查
68
+
69
+ ```
70
+ 对于每个声明的依赖:
71
+ 1. 找到依赖的 REQ
72
+ 2. 读取依赖 REQ 的 contracts/ 或 TECH_DESIGN.md 的"输出"章节
73
+ 3. 读取当前 REQ 的 PRD.md 的"输入假设"章节
74
+ 4. 比较: 输出 ⊇ 输入期望?
75
+
76
+ 如果不匹配:
77
+ → 报告: "依赖 RM-XXX 的输出不满足 REQ-YYY 的输入期望"
78
+ → 具体说明: 期望 X,实际提供 Y
79
+ ```
80
+
81
+ ### Step 3: 旅程完整性检查
82
+
83
+ ```
84
+ 对于 ROADMAP 中的每个 Milestone:
85
+ 1. 读取 Success Criteria
86
+ 2. 对于每个 Criterion:
87
+ - 找到负责的 REQ
88
+ - 验证 REQ 的实现是否满足 Criterion
89
+ - 不是看状态,是看实际输出
90
+
91
+ 如果有 Criterion 未满足:
92
+ → 报告: "M4 Success Criteria 'X' 未满足"
93
+ → 具体说明: 需要 A,实际只有 B
94
+ ```
95
+
96
+ ### Step 4: 空隙检测
97
+
98
+ ```
99
+ 对于 ROADMAP 中的每个用户旅程:
100
+ 1. 列出旅程的所有步骤
101
+ 2. 对于每个步骤:
102
+ - 找到负责的 REQ
103
+ - 如果没有 REQ 负责 → 空隙
104
+ 3. 对于相邻步骤:
105
+ - 检查步骤 N 的输出是否是步骤 N+1 的输入
106
+ - 如果不匹配 → 空隙
107
+
108
+ 如果发现空隙:
109
+ → 报告: "旅程步骤 X 和 Y 之间存在空隙"
110
+ → 具体说明: X 输出 A,Y 期望 B,没有 REQ 负责转换
111
+ ```
112
+
113
+ ### Step 5: 累积偏差检测
114
+
115
+ ```
116
+ 对于每个 Milestone:
117
+ 1. 读取 ROADMAP 中的原始 Deliverables
118
+ 2. 读取每个 REQ 的 PRD 中的实际 Scope
119
+ 3. 计算: 实际覆盖 / 原始计划
120
+
121
+ 如果覆盖率 < 80%:
122
+ → 报告: "M4 累积偏差 40%,原始计划 7 项,实际覆盖 4 项"
123
+ → 列出: 被削减的 Deliverables
124
+ ```
125
+
126
+ ## Output Format
127
+
128
+ ```markdown
129
+ ## Journey Coherence Report
130
+
131
+ ### 依赖满足 ✅/❌
132
+ | 依赖 | 期望输入 | 实际输出 | 状态 |
133
+ |------|---------|---------|------|
134
+ | RM-007 | CommandEmitter API | ✅ 提供 | PASS |
135
+ | RM-006 | AdapterRegistry | ✅ 提供 | PASS |
136
+
137
+ ### 旅程完整性 ✅/❌
138
+ | 旅程 | 步骤 | 负责 REQ | 状态 |
139
+ |------|------|---------|------|
140
+ | 开发者旅程 | /flow-init | REQ-001 | ✅ |
141
+ | 开发者旅程 | /flow-prd | REQ-002 | ✅ |
142
+ | 开发者旅程 | /flow-dev → /flow-release | ❓ | ⚠️ 空隙 |
143
+
144
+ ### Success Criteria ✅/❌
145
+ | Milestone | Criterion | 验证结果 | 状态 |
146
+ |-----------|-----------|---------|------|
147
+ | M4 | 4 platforms execute core workflows | 2/4 platforms | ❌ FAIL |
148
+ | M4 | Integration tests passing | 未运行 | ❌ FAIL |
149
+
150
+ ### 累积偏差
151
+ | Milestone | 原始计划 | 实际覆盖 | 偏差率 |
152
+ |-----------|---------|---------|--------|
153
+ | M4 | 7 deliverables | 4 deliverables | 43% |
154
+
155
+ ### 建议
156
+ 1. 补充 RM-009/010/011/012 的实现
157
+ 2. 添加端到端集成测试
158
+ 3. 定义 /flow-dev → /flow-release 的衔接 REQ
159
+ ```
160
+
161
+ ## Rationalization Prevention
162
+
163
+ | Excuse | Reality |
164
+ |--------|---------|
165
+ | "依赖已经标记完成了" | 完成 ≠ 满足。检查实际输出是否匹配期望输入。 |
166
+ | "每个需求都通过了验证" | 单需求验证 ≠ 全局一致性。部分之和 ≠ 整体。 |
167
+ | "ROADMAP 是规划,不是承诺" | Success Criteria 是承诺。不满足就是未完成。 |
168
+ | "这超出了我的检查范围" | 这正是你的检查范围。全局一致性是隐含要求。 |
169
+ | "状态是 complete" | 状态是自我声明。验证是外部检查。 |
170
+ | "代码存在" | 存在 ≠ 能跑。运行验证才算数。 |
171
+ | "用户没有要求检查全局" | 全局检查是隐含要求。用户问"完成了吗"就是在问全局。 |
172
+ | "我已经检查了很多了" | 检查多 ≠ 检查对。按 Protocol 检查。 |
173
+
174
+ ## Red Flags - STOP
175
+
176
+ 如果你发现自己:
177
+ - 只看 `orchestration_status.json` 的 `status` 字段就说"完成了"
178
+ - 没有比较依赖的输出和当前需求的输入期望
179
+ - 没有验证 Success Criteria 的每一条
180
+ - 没有检查旅程步骤之间的衔接
181
+ - 数 REQ 数量而不是验证实际功能
182
+
183
+ **STOP。执行 Coherence Check Protocol。**
184
+
185
+ ## Integration
186
+
187
+ ### 触发点
188
+ - `/flow-release` Exit Gate(发布前强制检查)
189
+ - `/flow-verify --global`(全局验证模式)
190
+ - 用户询问里程碑进度时
191
+
192
+ ### 与其他 Skill 的关系
193
+ - `flow-verify`: 单需求内部一致性 → 本 Skill: 跨需求全局一致性
194
+ - `constitution-guardian`: 代码质量 → 本 Skill: 业务完整性
195
+ - `flow-attention-refresh`: 防止单需求目标遗忘 → 本 Skill: 防止全局愿景遗忘
196
+
197
+ ---
198
+
199
+ **[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md