cc-devflow 4.1.4 → 4.1.5

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 (26) hide show
  1. package/.claude/CLAUDE.md +4 -96
  2. package/.claude/commands/flow/fix.md +1 -6
  3. package/.claude/commands/flow/init.md +2 -13
  4. package/.claude/commands/flow/release.md +26 -76
  5. package/.claude/commands/flow/workspace.md +2 -19
  6. package/.claude/docs/guides/TEAM_MODE_GUIDE.md +0 -1
  7. package/.claude/hooks/teammate-idle-hook.ts +1 -1
  8. package/.claude/rules/devflow-conventions.md +2 -93
  9. package/.claude/scripts/CLAUDE.md +1 -4
  10. package/.claude/scripts/common.sh +12 -147
  11. package/.claude/skills/workflow/flow-init/SKILL.md +0 -36
  12. package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +15 -134
  13. package/.claude/skills/workflow/flow-release/SKILL.md +27 -84
  14. package/.claude/skills/workflow.yaml +2 -5
  15. package/CHANGELOG.md +41 -0
  16. package/package.json +1 -1
  17. package/.claude/scripts/flow-workspace-start.sh +0 -217
  18. package/.claude/scripts/flow-workspace-switch.sh +0 -234
  19. package/.claude/skills/domain/using-git-worktrees/SKILL.md +0 -252
  20. package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +0 -133
  21. package/.claude/skills/domain/using-git-worktrees/context.jsonl +0 -4
  22. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +0 -218
  23. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +0 -232
  24. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +0 -130
  25. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +0 -140
  26. package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +0 -70
package/.claude/CLAUDE.md CHANGED
@@ -11,7 +11,7 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
11
11
  │ ├── workflow.yaml # 工作流依赖图定义 [NEW: v4.0]
12
12
  │ │
13
13
  │ ├── workflow/ # 工作流 Skills [NEW: v4.0]
14
- │ │ ├── flow-init/ # 需求初始化 (支持 worktree)
14
+ │ │ ├── flow-init/ # 需求初始化
15
15
  │ │ │ ├── SKILL.md # 核心指令 (<500 行)
16
16
  │ │ │ ├── context.jsonl # 上下文定义 (借鉴 Trellis)
17
17
  │ │ │ ├── scripts/ # 内嵌脚本
@@ -23,13 +23,12 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
23
23
  │ │ ├── flow-ui/ # UI 原型 (deprecated, use flow-spec)
24
24
  │ │ ├── flow-epic/ # Epic/Tasks (deprecated, use flow-spec)
25
25
  │ │ ├── flow-dev/ # 开发执行
26
- │ │ └── flow-release/ # 发布管理 (支持 worktree 清理)
26
+ │ │ └── flow-release/ # 发布管理
27
27
  │ │
28
28
  │ ├── domain/ # 领域 Skills
29
29
  │ │ ├── tdd/ # TDD Iron Law
30
30
  │ │ ├── debugging/ # 系统化调试
31
- │ │ ├── brainstorming/ # 头脑风暴
32
- │ │ └── using-git-worktrees/ # Git Worktree 管理 [NEW: v4.3] ⭐
31
+ │ │ └── brainstorming/ # 头脑风暴
33
32
  │ │
34
33
  │ ├── guardrail/ # 守护 Skills
35
34
  │ │ ├── constitution-guardian/
@@ -53,8 +52,7 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
53
52
  │ └── team-types.d.ts # Team 状态类型定义 [NEW: v4.7]
54
53
  ├── scripts/ # 共享脚本
55
54
  │ ├── CLAUDE.md # scripts 子目录地图(成员清单与职责边界)
56
- ├── common.sh # 通用函数 (含 worktree 辅助函数)
57
- │ └── flow-workspace-switch.sh # workspace REQ 切换与 worktree 快捷切换
55
+ └── common.sh # 通用函数
58
56
  └── docs/templates/ # 共享模板
59
57
  └── _shared/ # 共享模板组件 [NEW: v4.1]
60
58
  ├── CONSTITUTION_CHECK.md
@@ -532,95 +530,6 @@ T2 └─────────┬──────────┘
532
530
  **Last Updated**: 2026-02-07
533
531
  **v4.1.0 Module**: Unified Specification Phase
534
532
 
535
- ---
536
-
537
- ## v4.3.0 Module: Git Worktree Integration
538
-
539
- ### Purpose
540
-
541
- 将所有 Git 分支操作改为 Git Worktree 方式,支持 3-5 个并行 Claude Code 会话,借鉴官方最佳实践。
542
-
543
- ### Key Changes
544
-
545
- | Before (v4.2) | After (v4.3) | Improvement |
546
- |---------------|--------------|-------------|
547
- | 传统分支切换 | Worktree 隔离 | 并行开发 |
548
- | stash/checkout | cd 切换 | 切换时间 -97% |
549
- | 单一 Claude 会话 | 多会话并行 | 效率 +200% |
550
-
551
- ### Worktree Directory Layout
552
-
553
- ```
554
- ~/projects/
555
- ├── cc-devflow/ # 主仓库 (main 分支)
556
- ├── cc-devflow-REQ-001/ # REQ-001 worktree
557
- ├── cc-devflow-REQ-002/ # REQ-002 worktree
558
- ├── cc-devflow-analysis/ # 只读分析 worktree (可选)
559
- └── cc-devflow-hotfix/ # 紧急修复 worktree (可选)
560
- ```
561
-
562
- ### New Skill: using-git-worktrees
563
-
564
- ```
565
- .claude/skills/domain/using-git-worktrees/
566
- ├── SKILL.md # 核心指令 (~200 行)
567
- ├── context.jsonl # 上下文定义
568
- ├── scripts/
569
- │ ├── worktree-create.sh # 创建 worktree
570
- │ ├── worktree-list.sh # 列出 worktree
571
- │ ├── worktree-switch.sh # 切换 worktree
572
- │ ├── worktree-cleanup.sh # 清理 worktree
573
- │ └── worktree-status.sh # 状态检查
574
- └── assets/
575
- └── SHELL_ALIASES.md # Shell 别名模板
576
- ```
577
-
578
- ### Modified Commands
579
-
580
- | Command | Change |
581
- |---------|--------|
582
- | `/flow-init` | 默认使用 worktree 模式,`--branch-only` 兼容旧模式 |
583
- | `/flow-release` | 自动清理 worktree |
584
-
585
- ### Shell Aliases (Recommended)
586
-
587
- ```bash
588
- alias za='cd $(git rev-parse --show-toplevel 2>/dev/null || echo .)'
589
- alias zl='git worktree list'
590
- alias zm='cd ~/projects/cc-devflow'
591
-
592
- zw() {
593
- local req_id="${1:-}"
594
- local repo_name=$(basename $(git rev-parse --show-toplevel 2>/dev/null))
595
- cd ~/projects/${repo_name}-${req_id}
596
- }
597
- ```
598
-
599
- ### New common.sh Functions
600
-
601
- | Function | Purpose |
602
- |----------|---------|
603
- | `is_in_worktree()` | 检测是否在 worktree 中 |
604
- | `get_main_repo_path()` | 获取主仓库路径 |
605
- | `get_worktree_path()` | 获取当前 worktree 路径 |
606
- | `get_worktree_dir_for_req()` | 获取指定 REQ 的 worktree 目录 |
607
- | `worktree_exists_for_req()` | 检查 worktree 是否存在 |
608
- | `get_req_id_from_worktree()` | 从 worktree 路径提取 REQ-ID |
609
- | `list_worktrees_with_req()` | 列出所有 worktree 及其 REQ-ID |
610
-
611
- ### Expected Improvements
612
-
613
- | Metric | Before | After | Improvement |
614
- |--------|--------|-------|-------------|
615
- | 并行需求数 | 1 | 3-5 | +400% |
616
- | 上下文切换时间 | 30s | 1s | -97% |
617
- | 紧急修复响应 | 需要 stash | 直接新建 | 即时 |
618
- | Claude 会话隔离 | 无 | 完全隔离 | 100% |
619
-
620
- ---
621
-
622
- **Last Updated**: 2026-02-07
623
- **v4.3.0 Module**: Git Worktree Integration
624
533
 
625
534
  ---
626
535
 
@@ -1102,7 +1011,6 @@ TaskCompleted Event
1102
1011
  | `.claude/hooks/types/team-types.d.ts` | Team 状态 TypeScript 类型 |
1103
1012
  | `.claude/scripts/parse-task-dependencies.js` | TASKS.md 任务依赖解析器 |
1104
1013
  | `.claude/scripts/detect-file-conflicts.sh` | 并行任务文件冲突检测 |
1105
- | `.claude/scripts/team-dev-init.sh` | flow-dev Team 模式初始化 |
1106
1014
  | `.claude/skills/workflow/flow-spec/scripts/team-init.sh` | flow-spec Team 模式初始化 |
1107
1015
  | `.claude/skills/workflow/flow-spec/scripts/team-communication.sh` | Teammate 通信协议 |
1108
1016
  | `.claude/skills/workflow/flow-spec/team-config.json` | spec-design-team 配置 |
@@ -73,14 +73,9 @@ Bug 修复不是猜测游戏。系统化调试 = 更快修复 + 更少回归。
73
73
  ### 阶段 0: Entry Gate
74
74
  ```
75
75
  1. 解析 BUG_ID、TITLE
76
- → 若 TITLE 含中文/非ASCII,使用模型意译生成 BRANCH_TITLE_EN(英文语义翻译,禁止拼音/音译)
77
- → 若意译不确定或未生成 ASCII 结果,向用户确认英文分支标题
78
76
  2. {SCRIPT:prereq} --json 验证:
79
77
  → devflow/bugs/${BUG_ID}/ 是否存在(首次执行将创建)
80
- Git 工作区干净
81
- 3. 创建目录与分支:
82
- → git checkout -b "bugfix/${BUG_ID}-${slug(BRANCH_TITLE_EN)}"
83
- → 初始化 devflow/bugs/${BUG_ID}/ 结构与 orchestration_status.json
78
+ 3. 初始化 devflow/bugs/${BUG_ID}/ 结构与 orchestration_status.json
84
79
  4. 检查 quickstart.md
85
80
  → 若需求目录已有 quickstart.md,复制引用用于测试执行
86
81
  ```
@@ -21,7 +21,6 @@ skill: workflow/flow-init
21
21
  | Stage | Purpose | Output |
22
22
  |-------|---------|--------|
23
23
  | 1 | Entry Gate | 参数验证 |
24
- | 1.2 | Git Worktree (默认) / Branch (--branch-only) | `../{repo}-{REQ_ID}` + `feature|bugfix/{REQ_ID}-{slug}` |
25
24
  | 1.5 | Context Loading | ROADMAP/ARCHITECTURE |
26
25
  | 2 | Directory Init | 目录结构 |
27
26
  | 2.3 | Brainstorming | BRAINSTORM.md |
@@ -29,20 +28,10 @@ skill: workflow/flow-init
29
28
  | 3 | README | README.md |
30
29
  | 4 | Exit Gate | 5-Level 验证 |
31
30
 
32
- ## Worktree Naming
33
-
34
- - 默认模式会创建独立 worktree(不是只建分支)。
35
- - 目录命名:`{repo-name}-{REQ_ID}`(示例:`cc-devflow-REQ-123`)。
36
- - 分支命名:
37
- - Requirement: `feature/{REQ_ID}-{slug(title)}`
38
- - Bug: `bugfix/{REQ_ID}-{slug(title)}`
39
- - `--branch-only` 才会退回传统单仓库分支模式。
40
-
41
31
  ## Session Continuity
42
32
 
43
33
  - 需求上下文由 `devflow/requirements/${REQ_ID}/` 下的文档和 `orchestration_status.json` 持久化。
44
- - REQ 识别优先级:`DEVFLOW_REQ_ID` → worktree 目录名 当前分支名。
45
- - 进入新会话时,应先进入目标 worktree 目录再继续命令;worktree 路径可按命名规则直接定位,或使用 `using-git-worktrees` 的切换脚本。
34
+ - REQ 识别优先级:`DEVFLOW_REQ_ID` → `devflow/workspace/.current-req`最新需求目录。
46
35
 
47
36
  ## Skill Location
48
37
 
@@ -56,5 +45,5 @@ skill: workflow/flow-init
56
45
  ## Next Step
57
46
 
58
47
  ```
59
- /flow-prd "${REQ_ID}"
48
+ /flow-spec "${REQ_ID}"
60
49
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: flow-release
3
- description: 'Create PR and manage release. Usage: /flow-release "REQ-123" or /flow-release'
3
+ description: 'Complete requirement and update progress. Usage: /flow-release "REQ-123" or /flow-release'
4
4
  scripts:
5
5
  prereq: .claude/scripts/check-prerequisites.sh
6
6
  check_tasks: .claude/scripts/check-task-status.sh
@@ -8,53 +8,18 @@ scripts:
8
8
  generate_status: .claude/scripts/generate-status-report.sh
9
9
  verify_gate: .claude/scripts/verify-gate.sh
10
10
  skills:
11
- finishing: .claude/skills/flow-finishing-branch/SKILL.md
12
11
  verification: .claude/skills/verification-before-completion/SKILL.md
13
12
  ---
14
13
 
15
14
  # Flow-Release - 发布管理命令
16
15
 
17
- ## 分支完成决策 (新增)
18
-
19
- 参考 `{SKILL:finishing}` 原则,发布前需要决定分支处理方式:
20
-
21
- ```yaml
22
- 决策选项:
23
- A) Fast-forward merge
24
- → 适用: 小改动,单人开发,无需审查记录
25
- → 命令: git checkout main && git merge --ff-only feature/xxx
26
-
27
- B) Create PR (推荐)
28
- → 适用: 需要记录,团队审查,CI 验证
29
- → 命令: gh pr create
30
-
31
- C) Squash and merge
32
- → 适用: 多个提交需合并为一个
33
- → 命令: gh pr merge --squash
34
-
35
- D) Cleanup only
36
- → 适用: 工作被废弃,只需清理分支
37
- → 命令: git checkout main && git branch -D feature/xxx
38
-
39
- 决策依据:
40
- - 改动大小 (>10 files → PR)
41
- - 是否需要审查 (团队项目 → PR)
42
- - 提交历史是否清晰 (混乱 → Squash)
43
- - 是否需要 CI 验证 (生产代码 → PR)
44
- ```
45
-
46
- ## 合并语义(关键)
47
-
48
- - `A) Fast-forward merge`:会在本地直接合并到 `main`。
49
- - `B) Create PR`:只创建/更新 PR,不会在当前步骤自动合并到 `main`。
50
- - `C) Squash and merge`:会通过 PR squash 合并到 `main`(通常在评审/CI 通过后执行)。
51
- - `D) Cleanup only`:不会合并,只清理分支/worktree。
16
+ > Git 分支/PR/合并由用户自行管理,DevFlow 仅负责进度更新和提交。
52
17
 
53
18
  ## User Input
54
19
  ```text
55
20
  $ARGUMENTS = "REQ_ID?"
56
21
  ```
57
- 未提供则根据当前分支或 `DEVFLOW_REQ_ID` 自动解析。
22
+ 未提供则根据 `DEVFLOW_REQ_ID` 或 `.current-req` 自动解析。
58
23
 
59
24
  ## 执行流程
60
25
 
@@ -62,15 +27,12 @@ $ARGUMENTS = "REQ_ID?"
62
27
  ```
63
28
  1. 解析 REQ_ID
64
29
  2. {SCRIPT:prereq} --json 校验:
65
- → 存在 PRD.md、TECH_DESIGN.md、data-model.md、contracts/、quickstart.md、EPIC.md、TASKS.md、TEST_REPORT.md、SECURITY_REPORT.md
30
+ → 存在 PRD.md、EPIC.md、TASKS.md、TEST_REPORT.md、SECURITY_REPORT.md
66
31
  → orchestration_status.status ∈ {"quality_complete", "qa_complete", "release_failed"}
67
32
  3. {SCRIPT:check_tasks} --json 确认 remaining == 0
68
33
  4. 验证 Quality gate:
69
34
  → TEST_REPORT.md / SECURITY_REPORT.md 中的 Gate 均为 PASS
70
- 5. Git 环境:
71
- → 当前在 feature/bugfix 分支
72
- → 分支已推送,若无 upstream 提示 push
73
- 6. Commit 规范门禁(工作区不干净时):
35
+ 5. Commit 规范门禁(工作区不干净时):
74
36
  → 必须先执行 `/util/git-commit`(规则见 `.claude/commands/util/git-commit.md`)
75
37
  → Commit message 必须遵循 Conventional Commits;多文件按同类变更拆分提交
76
38
  → 提交完成后重新执行 Entry Gate,直到工作区干净
@@ -79,9 +41,9 @@ $ARGUMENTS = "REQ_ID?"
79
41
  ### 阶段 2: 发布上下文准备
80
42
  ```
81
43
  1. 收集元数据:
82
- TITLE, branch, commits, changed files, coverage, security 状态
44
+ REQ_ID, TITLE, commits, changed files, coverage, security 状态
83
45
  2. 汇总文档:
84
- → PRD 成功指标、EPIC 范围、TASKS DoD、quickstart 验证命令
46
+ → PRD 成功指标、EPIC 范围、TASKS DoD
85
47
  3. 更新 orchestration_status:
86
48
  → status = "release_in_progress"
87
49
  → phase = "release"
@@ -94,56 +56,44 @@ Prompt 核心要求:
94
56
  - 确认 Constitution 校验无 ERROR:
95
57
  {SCRIPT:validate_constitution} --type all --severity error
96
58
  - 生成 RELEASE_PLAN.md:
97
- 范围概览、风险评估、回滚策略、监控计划、依赖项
98
- • 列出 data-model / contracts / quickstart 的变更摘要
99
- - 生成 PR 描述草稿:
100
- • 摘要、实现亮点、测试结果(引用 quickstart 命令)、安全结论、验证报告链接
59
+ 范围概览、风险评估、回滚策略、监控计划
101
60
  - 建议标签、检查清单
102
61
  ```
103
62
 
104
- ### 阶段 4: PR 创建与完结
63
+ ### 阶段 4: Progress Update
105
64
  ```
106
- 1. PR 前提交检查:
107
- `git status --porcelain` 非空,立即中止并回到 Entry Gate 第 6 步执行 `/util/git-commit`
108
- 2. 使用 gh CLI 创建或更新 PR
109
- 标题: "${REQ_ID}: ${TITLE}"
110
- 正文采用 agent 输出
111
- 3. 检查 CLAUDE.md:
112
- → 若 TECH_DESIGN 引入新基础设施/重大变更,更新 "## Technical Architecture"(≤15 行)
113
- 4. 状态更新:
114
- → orchestration_status.status = "release_complete"
65
+ 1. 更新 BACKLOG.md:
66
+ 找到对应 REQ 条目,更新状态为 completed/released
67
+ 2. 更新 ROADMAP.md:
68
+ 找到对应 REQ 条目,更新进度
69
+ 3. 更新 orchestration_status:
70
+ status = "release_complete"
115
71
  → completedSteps append "release"
116
- prUrl 记录到状态文件
117
- 5. EXECUTION_LOG 记录 PR 链接与发布时间
118
- 6. 可选: {SCRIPT:generate_status} 生成状态报告
72
+ 4. EXECUTION_LOG.md 记录发布完成
119
73
  ```
120
74
 
121
- ### 阶段 5: Worktree 清理策略
75
+ ### 阶段 5: Commit Gate
122
76
  ```
123
- 1. 若当前为 worktree 模式:
124
- 仅在分支已合并(或明确放弃该分支)后执行 `git worktree remove`
125
- 2. 若仅创建 PR 且尚未合并:
126
- 默认保留 worktree,等待后续评审/CI
127
- 3. 若已完成合并:
128
- → 删除 worktree + 删除已合并分支
77
+ 1. `git status --porcelain` 非空:
78
+ `/util/git-commit` 规范提交
79
+ 格式: chore(release): complete ${REQ_ID} - ${TITLE}
80
+ 2. 可选: {SCRIPT:generate_status} 生成状态报告
129
81
  ```
130
82
 
131
83
  ## 输出
132
84
  ```
133
85
  ✅ RELEASE_PLAN.md
134
- CLAUDE.md(如需更新)
135
- GitHub PR (gh)
86
+ BACKLOG.md (进度更新)
87
+ ROADMAP.md (进度更新)
136
88
  ✅ orchestration_status.json 更新 (release_complete)
137
89
  ✅ EXECUTION_LOG.md 发布记录
90
+ ✅ Changes committed (用户自行处理分支/PR/合并)
138
91
  ```
139
92
 
140
93
  ## 错误处理
141
94
  - Quality Gate 失败或 Constitution ERROR → 立即终止,标记 status="release_failed"。
142
- - Git push/PR 创建失败 → 输出命令和日志,保持可重试状态。
143
- - CLAUDE.md 更新遗漏 → 阻断发布并提示补写。
144
95
  - 工作区存在未提交改动且未按 `/util/git-commit` 规则处理 → 阻断发布。
145
96
 
146
97
  ## 下一步
147
- 1. 等待代码评审与 CI 通过。
148
- 2. 合并后更新主分支标签或发布记录。
149
- 3. 反馈验证结果,必要时触发 `/flow-verify` 复检。
98
+ 1. 用户自行处理分支合并 / PR 创建。
99
+ 2. 反馈验证结果,必要时触发 `/flow-verify` 复检。
@@ -63,9 +63,8 @@ Start a new session, recovering context from previous session.
63
63
  Process:
64
64
  1. Read `.current-req` to get current requirement
65
65
  2. Read latest journal entries
66
- 3. 校验并显示期望 worktree 路径(提示是否在正确目录)
67
- 4. Display context summary
68
- 5. Ready to continue work
66
+ 3. Display context summary
67
+ 4. Ready to continue work
69
68
 
70
69
  可选行为:
71
70
  - 传入 `REQ-XXX/BUG-XXX` 会先更新 `.current-req` 再恢复上下文
@@ -91,17 +90,6 @@ Switch to a different requirement.
91
90
  ```
92
91
 
93
92
  Updates `.current-req` and creates a new journal entry.
94
- 如果存在对应 worktree,建议立即切换到:
95
- ```bash
96
- cd "$(bash .claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh REQ-008)"
97
- ```
98
-
99
- 更便捷的一步切换:
100
- ```bash
101
- eval "$(bash .claude/scripts/flow-workspace-switch.sh REQ-008 --print-cd)"
102
- # 或
103
- source .claude/scripts/flow-workspace-switch.sh REQ-008 --cd
104
- ```
105
93
 
106
94
  ## Workspace Structure
107
95
 
@@ -144,9 +132,6 @@ When `/flow-init` creates a new requirement (and workspace already initialized):
144
132
  echo "REQ-XXX" > devflow/workspace/{developer}/.current-req
145
133
  ```
146
134
 
147
- `/flow-workspace start` 会基于 REQ-ID 推导期望 worktree 路径:
148
- `../{repo-name}-{REQ_ID}`,并提示是否已在正确 worktree。
149
-
150
135
  ### With flow-dev
151
136
 
152
137
  During development, progress is automatically recorded:
@@ -161,9 +146,7 @@ Journal is read at Protocol 3 (Ralph iteration start) to maintain context.
161
146
  ## Scripts
162
147
 
163
148
  - `.claude/scripts/flow-workspace-init.sh` - Initialize workspace
164
- - `.claude/scripts/flow-workspace-start.sh` - Start session
165
149
  - `.claude/scripts/flow-workspace-record.sh` - Record progress
166
- - `.claude/scripts/flow-workspace-switch.sh` - Switch REQ pointer and worktree action
167
150
 
168
151
  ## Related
169
152
 
@@ -162,7 +162,6 @@ T2 └─────────┬──────────┘
162
162
  |------|------|
163
163
  | **same_agent** | 冲突任务分配给同一 Agent 串行执行 |
164
164
  | **sequential** | 所有冲突任务按顺序执行 |
165
- | **worktree** | 使用 Git Worktree 隔离 (未来支持) |
166
165
 
167
166
  ---
168
167
 
@@ -117,7 +117,7 @@ function findRepoRoot(startPath: string): string | null {
117
117
  }
118
118
 
119
119
  /**
120
- * worktree 目录名或分支名提取 REQ-ID
120
+ * 从环境变量、.current-req 文件或目录扫描提取 REQ-ID
121
121
  */
122
122
  function extractReqId(repoRoot: string): string | null {
123
123
  // 尝试从目录名提取 (e.g., cc-devflow-REQ-123)
@@ -61,100 +61,9 @@ devflow/requirements/${reqId}/
61
61
 
62
62
  ---
63
63
 
64
- ## 🌿 Git Worktree 约定 (v4.3)
64
+ ## 🌿 Git 约定
65
65
 
66
- ### Worktree vs Branch 模式
67
-
68
- | 模式 | 命令 | 适用场景 |
69
- |------|------|----------|
70
- | **Worktree (默认)** | `/flow-init "REQ-123\|Title"` | 多需求并行、需要隔离环境 |
71
- | **Branch** | `/flow-init "REQ-123\|Title" --branch-only` | 单需求开发、简单修改 |
72
-
73
- ### Worktree 目录布局
74
-
75
- ```
76
- ~/projects/
77
- ├── cc-devflow/ # 主仓库 (main 分支)
78
- ├── cc-devflow-REQ-001/ # REQ-001 worktree
79
- ├── cc-devflow-REQ-002/ # REQ-002 worktree
80
- ├── cc-devflow-analysis/ # 只读分析 worktree (可选)
81
- └── cc-devflow-hotfix/ # 紧急修复 worktree (可选)
82
- ```
83
-
84
- ### 命名规范
85
-
86
- ```bash
87
- # Worktree 目录
88
- {repo-name}-{REQ_ID}
89
- # 示例: cc-devflow-REQ-123
90
-
91
- # 对应分支 (不变)
92
- feature/${reqId}-${slug(BRANCH_TITLE_EN)}
93
- # 示例: feature/REQ-123-user-order-support
94
- ```
95
-
96
- ### Worktree 操作流程
97
-
98
- 1. **创建** (flow-init 自动执行)
99
- ```bash
100
- git worktree add -b feature/REQ-123-title ../cc-devflow-REQ-123
101
- ```
102
-
103
- 2. **切换**
104
- ```bash
105
- cd ../cc-devflow-REQ-123
106
- # 或使用 shell 别名
107
- zw REQ-123
108
- ```
109
-
110
- 3. **开发**
111
- - 每个 worktree 独立的 Claude Code 会话
112
- - 互不干扰,保持上下文
113
-
114
- 4. **清理** (flow-release 自动执行)
115
- ```bash
116
- git worktree remove ../cc-devflow-REQ-123
117
- git branch -d feature/REQ-123-title
118
- ```
119
-
120
- ### Shell 别名推荐
121
-
122
- ```bash
123
- # 添加到 ~/.zshrc 或 ~/.bashrc
124
- alias za='cd $(git rev-parse --show-toplevel 2>/dev/null || echo .)'
125
- alias zl='git worktree list'
126
- alias zm='cd ~/projects/cc-devflow'
127
-
128
- zw() {
129
- local req_id="${1:-}"
130
- local repo_name=$(basename $(git rev-parse --show-toplevel 2>/dev/null))
131
- cd ~/projects/${repo_name}-${req_id}
132
- }
133
- ```
134
-
135
- ### 分支命名 (保持不变)
136
-
137
- ```bash
138
- # 标准格式
139
- feature/${reqId}-${slug(BRANCH_TITLE_EN)}
140
-
141
- # 示例
142
- feature/REQ-123-user-order-support
143
- feature/REQ-124-permission-management
144
- ```
145
-
146
- > BRANCH_TITLE_EN 为 TITLE 的英文意译 (语义为准,非拼音,使用模型意译)
147
-
148
- ### 分支操作流程 (Worktree 模式)
149
-
150
- 1. 确保主仓库在 main 分支且状态干净
151
- 2. 执行 `/flow-init` 创建 worktree + 分支
152
- 3. 切换到 worktree 目录
153
- 4. 启动新的 Claude Code 会话
154
- 5. 实施开发 (TDD方式)
155
- 6. 质量闸检查
156
- 7. 创建 PR
157
- 8. 合并后清理 worktree 和分支
66
+ > Git 分支、worktree、PR、合并由用户自行管理,DevFlow 不参与 Git 拓扑管理。
158
67
 
159
68
  ---
160
69
 
@@ -17,7 +17,7 @@ check-dependencies.sh: 依赖关系检查脚本。
17
17
  check-prerequisites.sh: 流程前置条件统一校验脚本。
18
18
  check-task-status.sh: TASKS 完成状态统计脚本。
19
19
  checklist-errors.sh: Checklist 错误码与诊断脚本。
20
- common.sh: 脚本公共函数库(REQ 识别、worktree 路径、日志工具等)。
20
+ common.sh: 脚本公共函数库(REQ 识别、日志工具等)。
21
21
  consolidate-research.sh: research 结果汇总脚本。
22
22
  create-requirement.sh: 创建需求目录与初始状态;同步 workspace 的 `.current-req`。
23
23
  delta-parser.ts: Delta 解析器。
@@ -36,8 +36,6 @@ flow-quality-full.sh: 全量质量检查脚本。
36
36
  flow-quality-quick.sh: 快速质量检查脚本。
37
37
  flow-workspace-init.sh: 开发者 workspace 初始化脚本。
38
38
  flow-workspace-record.sh: workspace journal 追加记录脚本。
39
- flow-workspace-start.sh: workspace 会话恢复脚本;支持 REQ 覆盖与 worktree 切换提示。
40
- flow-workspace-switch.sh: workspace REQ 切换脚本;支持 `--print-cd` 与 `--cd`。
41
39
  generate-clarification-questions.sh: Clarify 问题生成脚本。
42
40
  generate-clarification-report.sh: Clarify 报告生成脚本。
43
41
  generate-quickstart.sh: quickstart 文档生成脚本。
@@ -75,5 +73,4 @@ workflow-status.ts: 工作流状态类型化读取器。
75
73
  ## 设计约束
76
74
 
77
75
  - 需求识别统一复用 `common.sh`,避免多处正则分叉。
78
- - worktree 与 workspace 职责分离:代码隔离由 worktree 提供,连续上下文由 workspace 提供。
79
76
  - 新增脚本优先保持幂等与可重入,便于中断恢复。