cc-devflow 4.1.3 → 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.
- package/.claude/CLAUDE.md +5 -96
- package/.claude/commands/flow/fix.md +1 -6
- package/.claude/commands/flow/init.md +6 -2
- package/.claude/commands/flow/release.md +33 -59
- package/.claude/commands/flow/workspace.md +12 -3
- package/.claude/docs/guides/TEAM_MODE_GUIDE.md +0 -1
- package/.claude/hooks/teammate-idle-hook.ts +1 -1
- package/.claude/rules/devflow-conventions.md +2 -93
- package/.claude/scripts/CLAUDE.md +76 -0
- package/.claude/scripts/common.sh +12 -147
- package/.claude/scripts/create-requirement.sh +12 -0
- package/.claude/skills/workflow/flow-init/SKILL.md +0 -29
- package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +15 -134
- package/.claude/skills/workflow/flow-release/SKILL.md +26 -70
- package/.claude/skills/workflow.yaml +2 -5
- package/CHANGELOG.md +78 -0
- package/package.json +1 -1
- package/.claude/scripts/flow-workspace-start.sh +0 -88
- package/.claude/skills/domain/using-git-worktrees/SKILL.md +0 -252
- package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +0 -133
- package/.claude/skills/domain/using-git-worktrees/context.jsonl +0 -4
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +0 -218
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +0 -232
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +0 -130
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +0 -140
- 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/ # 需求初始化
|
|
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/ # 发布管理
|
|
26
|
+
│ │ └── flow-release/ # 发布管理
|
|
27
27
|
│ │
|
|
28
28
|
│ ├── domain/ # 领域 Skills
|
|
29
29
|
│ │ ├── tdd/ # TDD Iron Law
|
|
30
30
|
│ │ ├── debugging/ # 系统化调试
|
|
31
|
-
│ │
|
|
32
|
-
│ │ └── using-git-worktrees/ # Git Worktree 管理 [NEW: v4.3] ⭐
|
|
31
|
+
│ │ └── brainstorming/ # 头脑风暴
|
|
33
32
|
│ │
|
|
34
33
|
│ ├── guardrail/ # 守护 Skills
|
|
35
34
|
│ │ ├── constitution-guardian/
|
|
@@ -52,7 +51,8 @@ This directory contains Claude Code CLI extensions for the CC-DevFlow developmen
|
|
|
52
51
|
│ └── types/
|
|
53
52
|
│ └── team-types.d.ts # Team 状态类型定义 [NEW: v4.7]
|
|
54
53
|
├── scripts/ # 共享脚本
|
|
55
|
-
│
|
|
54
|
+
│ ├── CLAUDE.md # scripts 子目录地图(成员清单与职责边界)
|
|
55
|
+
│ └── common.sh # 通用函数
|
|
56
56
|
└── docs/templates/ # 共享模板
|
|
57
57
|
└── _shared/ # 共享模板组件 [NEW: v4.1]
|
|
58
58
|
├── CONSTITUTION_CHECK.md
|
|
@@ -530,95 +530,6 @@ T2 └─────────┬──────────┘
|
|
|
530
530
|
**Last Updated**: 2026-02-07
|
|
531
531
|
**v4.1.0 Module**: Unified Specification Phase
|
|
532
532
|
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
## v4.3.0 Module: Git Worktree Integration
|
|
536
|
-
|
|
537
|
-
### Purpose
|
|
538
|
-
|
|
539
|
-
将所有 Git 分支操作改为 Git Worktree 方式,支持 3-5 个并行 Claude Code 会话,借鉴官方最佳实践。
|
|
540
|
-
|
|
541
|
-
### Key Changes
|
|
542
|
-
|
|
543
|
-
| Before (v4.2) | After (v4.3) | Improvement |
|
|
544
|
-
|---------------|--------------|-------------|
|
|
545
|
-
| 传统分支切换 | Worktree 隔离 | 并行开发 |
|
|
546
|
-
| stash/checkout | cd 切换 | 切换时间 -97% |
|
|
547
|
-
| 单一 Claude 会话 | 多会话并行 | 效率 +200% |
|
|
548
|
-
|
|
549
|
-
### Worktree Directory Layout
|
|
550
|
-
|
|
551
|
-
```
|
|
552
|
-
~/projects/
|
|
553
|
-
├── cc-devflow/ # 主仓库 (main 分支)
|
|
554
|
-
├── cc-devflow-REQ-001/ # REQ-001 worktree
|
|
555
|
-
├── cc-devflow-REQ-002/ # REQ-002 worktree
|
|
556
|
-
├── cc-devflow-analysis/ # 只读分析 worktree (可选)
|
|
557
|
-
└── cc-devflow-hotfix/ # 紧急修复 worktree (可选)
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
### New Skill: using-git-worktrees
|
|
561
|
-
|
|
562
|
-
```
|
|
563
|
-
.claude/skills/domain/using-git-worktrees/
|
|
564
|
-
├── SKILL.md # 核心指令 (~200 行)
|
|
565
|
-
├── context.jsonl # 上下文定义
|
|
566
|
-
├── scripts/
|
|
567
|
-
│ ├── worktree-create.sh # 创建 worktree
|
|
568
|
-
│ ├── worktree-list.sh # 列出 worktree
|
|
569
|
-
│ ├── worktree-switch.sh # 切换 worktree
|
|
570
|
-
│ ├── worktree-cleanup.sh # 清理 worktree
|
|
571
|
-
│ └── worktree-status.sh # 状态检查
|
|
572
|
-
└── assets/
|
|
573
|
-
└── SHELL_ALIASES.md # Shell 别名模板
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
### Modified Commands
|
|
577
|
-
|
|
578
|
-
| Command | Change |
|
|
579
|
-
|---------|--------|
|
|
580
|
-
| `/flow-init` | 默认使用 worktree 模式,`--branch-only` 兼容旧模式 |
|
|
581
|
-
| `/flow-release` | 自动清理 worktree |
|
|
582
|
-
|
|
583
|
-
### Shell Aliases (Recommended)
|
|
584
|
-
|
|
585
|
-
```bash
|
|
586
|
-
alias za='cd $(git rev-parse --show-toplevel 2>/dev/null || echo .)'
|
|
587
|
-
alias zl='git worktree list'
|
|
588
|
-
alias zm='cd ~/projects/cc-devflow'
|
|
589
|
-
|
|
590
|
-
zw() {
|
|
591
|
-
local req_id="${1:-}"
|
|
592
|
-
local repo_name=$(basename $(git rev-parse --show-toplevel 2>/dev/null))
|
|
593
|
-
cd ~/projects/${repo_name}-${req_id}
|
|
594
|
-
}
|
|
595
|
-
```
|
|
596
|
-
|
|
597
|
-
### New common.sh Functions
|
|
598
|
-
|
|
599
|
-
| Function | Purpose |
|
|
600
|
-
|----------|---------|
|
|
601
|
-
| `is_in_worktree()` | 检测是否在 worktree 中 |
|
|
602
|
-
| `get_main_repo_path()` | 获取主仓库路径 |
|
|
603
|
-
| `get_worktree_path()` | 获取当前 worktree 路径 |
|
|
604
|
-
| `get_worktree_dir_for_req()` | 获取指定 REQ 的 worktree 目录 |
|
|
605
|
-
| `worktree_exists_for_req()` | 检查 worktree 是否存在 |
|
|
606
|
-
| `get_req_id_from_worktree()` | 从 worktree 路径提取 REQ-ID |
|
|
607
|
-
| `list_worktrees_with_req()` | 列出所有 worktree 及其 REQ-ID |
|
|
608
|
-
|
|
609
|
-
### Expected Improvements
|
|
610
|
-
|
|
611
|
-
| Metric | Before | After | Improvement |
|
|
612
|
-
|--------|--------|-------|-------------|
|
|
613
|
-
| 并行需求数 | 1 | 3-5 | +400% |
|
|
614
|
-
| 上下文切换时间 | 30s | 1s | -97% |
|
|
615
|
-
| 紧急修复响应 | 需要 stash | 直接新建 | 即时 |
|
|
616
|
-
| Claude 会话隔离 | 无 | 完全隔离 | 100% |
|
|
617
|
-
|
|
618
|
-
---
|
|
619
|
-
|
|
620
|
-
**Last Updated**: 2026-02-07
|
|
621
|
-
**v4.3.0 Module**: Git Worktree Integration
|
|
622
533
|
|
|
623
534
|
---
|
|
624
535
|
|
|
@@ -1100,7 +1011,6 @@ TaskCompleted Event
|
|
|
1100
1011
|
| `.claude/hooks/types/team-types.d.ts` | Team 状态 TypeScript 类型 |
|
|
1101
1012
|
| `.claude/scripts/parse-task-dependencies.js` | TASKS.md 任务依赖解析器 |
|
|
1102
1013
|
| `.claude/scripts/detect-file-conflicts.sh` | 并行任务文件冲突检测 |
|
|
1103
|
-
| `.claude/scripts/team-dev-init.sh` | flow-dev Team 模式初始化 |
|
|
1104
1014
|
| `.claude/skills/workflow/flow-spec/scripts/team-init.sh` | flow-spec Team 模式初始化 |
|
|
1105
1015
|
| `.claude/skills/workflow/flow-spec/scripts/team-communication.sh` | Teammate 通信协议 |
|
|
1106
1016
|
| `.claude/skills/workflow/flow-spec/team-config.json` | spec-design-team 配置 |
|
|
@@ -1217,4 +1127,3 @@ ralph_loop:
|
|
|
1217
1127
|
|
|
1218
1128
|
**Last Updated**: 2026-02-07
|
|
1219
1129
|
**v4.7.0 Module**: Claude Team Integration
|
|
1220
|
-
|
|
@@ -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
|
-
|
|
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 Branch | feature/REQ-xxx-title |
|
|
25
24
|
| 1.5 | Context Loading | ROADMAP/ARCHITECTURE |
|
|
26
25
|
| 2 | Directory Init | 目录结构 |
|
|
27
26
|
| 2.3 | Brainstorming | BRAINSTORM.md |
|
|
@@ -29,6 +28,11 @@ skill: workflow/flow-init
|
|
|
29
28
|
| 3 | README | README.md |
|
|
30
29
|
| 4 | Exit Gate | 5-Level 验证 |
|
|
31
30
|
|
|
31
|
+
## Session Continuity
|
|
32
|
+
|
|
33
|
+
- 需求上下文由 `devflow/requirements/${REQ_ID}/` 下的文档和 `orchestration_status.json` 持久化。
|
|
34
|
+
- REQ 识别优先级:`DEVFLOW_REQ_ID` → `devflow/workspace/.current-req` → 最新需求目录。
|
|
35
|
+
|
|
32
36
|
## Skill Location
|
|
33
37
|
|
|
34
38
|
**Full Implementation**: `.claude/skills/workflow/flow-init/SKILL.md`
|
|
@@ -41,5 +45,5 @@ skill: workflow/flow-init
|
|
|
41
45
|
## Next Step
|
|
42
46
|
|
|
43
47
|
```
|
|
44
|
-
/flow-
|
|
48
|
+
/flow-spec "${REQ_ID}"
|
|
45
49
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: flow-release
|
|
3
|
-
description: '
|
|
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,46 +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
|
-
```
|
|
16
|
+
> Git 分支/PR/合并由用户自行管理,DevFlow 仅负责进度更新和提交。
|
|
45
17
|
|
|
46
18
|
## User Input
|
|
47
19
|
```text
|
|
48
20
|
$ARGUMENTS = "REQ_ID?"
|
|
49
21
|
```
|
|
50
|
-
|
|
22
|
+
未提供则根据 `DEVFLOW_REQ_ID` 或 `.current-req` 自动解析。
|
|
51
23
|
|
|
52
24
|
## 执行流程
|
|
53
25
|
|
|
@@ -55,22 +27,23 @@ $ARGUMENTS = "REQ_ID?"
|
|
|
55
27
|
```
|
|
56
28
|
1. 解析 REQ_ID
|
|
57
29
|
2. {SCRIPT:prereq} --json 校验:
|
|
58
|
-
→ 存在 PRD.md、
|
|
30
|
+
→ 存在 PRD.md、EPIC.md、TASKS.md、TEST_REPORT.md、SECURITY_REPORT.md
|
|
59
31
|
→ orchestration_status.status ∈ {"quality_complete", "qa_complete", "release_failed"}
|
|
60
32
|
3. {SCRIPT:check_tasks} --json 确认 remaining == 0
|
|
61
33
|
4. 验证 Quality gate:
|
|
62
34
|
→ TEST_REPORT.md / SECURITY_REPORT.md 中的 Gate 均为 PASS
|
|
63
|
-
5.
|
|
64
|
-
→
|
|
65
|
-
→
|
|
35
|
+
5. Commit 规范门禁(工作区不干净时):
|
|
36
|
+
→ 必须先执行 `/util/git-commit`(规则见 `.claude/commands/util/git-commit.md`)
|
|
37
|
+
→ Commit message 必须遵循 Conventional Commits;多文件按同类变更拆分提交
|
|
38
|
+
→ 提交完成后重新执行 Entry Gate,直到工作区干净
|
|
66
39
|
```
|
|
67
40
|
|
|
68
41
|
### 阶段 2: 发布上下文准备
|
|
69
42
|
```
|
|
70
43
|
1. 收集元数据:
|
|
71
|
-
→
|
|
44
|
+
→ REQ_ID, TITLE, commits, changed files, coverage, security 状态
|
|
72
45
|
2. 汇总文档:
|
|
73
|
-
→ PRD 成功指标、EPIC 范围、TASKS DoD
|
|
46
|
+
→ PRD 成功指标、EPIC 范围、TASKS DoD
|
|
74
47
|
3. 更新 orchestration_status:
|
|
75
48
|
→ status = "release_in_progress"
|
|
76
49
|
→ phase = "release"
|
|
@@ -83,43 +56,44 @@ Prompt 核心要求:
|
|
|
83
56
|
- 确认 Constitution 校验无 ERROR:
|
|
84
57
|
{SCRIPT:validate_constitution} --type all --severity error
|
|
85
58
|
- 生成 RELEASE_PLAN.md:
|
|
86
|
-
•
|
|
87
|
-
• 列出 data-model / contracts / quickstart 的变更摘要
|
|
88
|
-
- 生成 PR 描述草稿:
|
|
89
|
-
• 摘要、实现亮点、测试结果(引用 quickstart 命令)、安全结论、验证报告链接
|
|
59
|
+
• 范围概览、风险评估、回滚策略、监控计划
|
|
90
60
|
- 建议标签、检查清单
|
|
91
61
|
```
|
|
92
62
|
|
|
93
|
-
### 阶段 4:
|
|
63
|
+
### 阶段 4: Progress Update
|
|
94
64
|
```
|
|
95
|
-
1.
|
|
96
|
-
→
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
→ 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"
|
|
102
71
|
→ completedSteps append "release"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
72
|
+
4. EXECUTION_LOG.md 记录发布完成
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 阶段 5: Commit Gate
|
|
76
|
+
```
|
|
77
|
+
1. 若 `git status --porcelain` 非空:
|
|
78
|
+
→ 按 `/util/git-commit` 规范提交
|
|
79
|
+
→ 格式: chore(release): complete ${REQ_ID} - ${TITLE}
|
|
80
|
+
2. 可选: {SCRIPT:generate_status} 生成状态报告
|
|
106
81
|
```
|
|
107
82
|
|
|
108
83
|
## 输出
|
|
109
84
|
```
|
|
110
85
|
✅ RELEASE_PLAN.md
|
|
111
|
-
✅
|
|
112
|
-
✅
|
|
86
|
+
✅ BACKLOG.md (进度更新)
|
|
87
|
+
✅ ROADMAP.md (进度更新)
|
|
113
88
|
✅ orchestration_status.json 更新 (release_complete)
|
|
114
89
|
✅ EXECUTION_LOG.md 发布记录
|
|
90
|
+
✅ Changes committed (用户自行处理分支/PR/合并)
|
|
115
91
|
```
|
|
116
92
|
|
|
117
93
|
## 错误处理
|
|
118
94
|
- Quality Gate 失败或 Constitution ERROR → 立即终止,标记 status="release_failed"。
|
|
119
|
-
-
|
|
120
|
-
- CLAUDE.md 更新遗漏 → 阻断发布并提示补写。
|
|
95
|
+
- 工作区存在未提交改动且未按 `/util/git-commit` 规则处理 → 阻断发布。
|
|
121
96
|
|
|
122
97
|
## 下一步
|
|
123
|
-
1.
|
|
124
|
-
2.
|
|
125
|
-
3. 反馈验证结果,必要时触发 `/flow-verify` 复检。
|
|
98
|
+
1. 用户自行处理分支合并 / PR 创建。
|
|
99
|
+
2. 反馈验证结果,必要时触发 `/flow-verify` 复检。
|
|
@@ -20,13 +20,16 @@ Enables context recovery across sessions and tracks development progress.
|
|
|
20
20
|
/flow-workspace init [developer]
|
|
21
21
|
|
|
22
22
|
# Start session (recover context)
|
|
23
|
-
/flow-workspace start
|
|
23
|
+
/flow-workspace start [REQ-XXX|BUG-XXX]
|
|
24
|
+
/flow-workspace start REQ-XXX --switch
|
|
25
|
+
/flow-workspace start BUG-XXX --switch --cd # 需 source/eval 场景
|
|
24
26
|
|
|
25
27
|
# Record progress to journal
|
|
26
28
|
/flow-workspace record "message"
|
|
27
29
|
|
|
28
30
|
# Switch to different requirement
|
|
29
31
|
/flow-workspace switch REQ-XXX
|
|
32
|
+
/flow-workspace switch BUG-XXX --cd # 需 source/eval 场景
|
|
30
33
|
```
|
|
31
34
|
|
|
32
35
|
## Subcommands
|
|
@@ -53,6 +56,8 @@ Start a new session, recovering context from previous session.
|
|
|
53
56
|
|
|
54
57
|
```bash
|
|
55
58
|
/flow-workspace start
|
|
59
|
+
/flow-workspace start REQ-008 --switch
|
|
60
|
+
/flow-workspace start BUG-008 --switch
|
|
56
61
|
```
|
|
57
62
|
|
|
58
63
|
Process:
|
|
@@ -61,6 +66,10 @@ Process:
|
|
|
61
66
|
3. Display context summary
|
|
62
67
|
4. Ready to continue work
|
|
63
68
|
|
|
69
|
+
可选行为:
|
|
70
|
+
- 传入 `REQ-XXX/BUG-XXX` 会先更新 `.current-req` 再恢复上下文
|
|
71
|
+
- `--switch` 输出切换建议;`--cd` 在脚本被 `source` 时可直接切换目录
|
|
72
|
+
|
|
64
73
|
### record
|
|
65
74
|
|
|
66
75
|
Record progress to the journal.
|
|
@@ -77,6 +86,7 @@ Switch to a different requirement.
|
|
|
77
86
|
|
|
78
87
|
```bash
|
|
79
88
|
/flow-workspace switch REQ-008
|
|
89
|
+
/flow-workspace switch REQ-008 --cd
|
|
80
90
|
```
|
|
81
91
|
|
|
82
92
|
Updates `.current-req` and creates a new journal entry.
|
|
@@ -116,7 +126,7 @@ devflow/workspace/
|
|
|
116
126
|
|
|
117
127
|
### With flow-init
|
|
118
128
|
|
|
119
|
-
When `/flow-init` creates a new requirement:
|
|
129
|
+
When `/flow-init` creates a new requirement (and workspace already initialized):
|
|
120
130
|
```bash
|
|
121
131
|
# Auto-update workspace
|
|
122
132
|
echo "REQ-XXX" > devflow/workspace/{developer}/.current-req
|
|
@@ -136,7 +146,6 @@ Journal is read at Protocol 3 (Ralph iteration start) to maintain context.
|
|
|
136
146
|
## Scripts
|
|
137
147
|
|
|
138
148
|
- `.claude/scripts/flow-workspace-init.sh` - Initialize workspace
|
|
139
|
-
- `.claude/scripts/flow-workspace-start.sh` - Start session
|
|
140
149
|
- `.claude/scripts/flow-workspace-record.sh` - Record progress
|
|
141
150
|
|
|
142
151
|
## Related
|
|
@@ -117,7 +117,7 @@ function findRepoRoot(startPath: string): string | null {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
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
|
|
64
|
+
## 🌿 Git 约定
|
|
65
65
|
|
|
66
|
-
|
|
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
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# scripts/
|
|
2
|
+
> L2 | 父级: .claude/CLAUDE.md
|
|
3
|
+
>
|
|
4
|
+
> [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
5
|
+
|
|
6
|
+
## 目录定位
|
|
7
|
+
|
|
8
|
+
`.claude/scripts/` 是命令层与 Skill 层共享的执行脚本库,负责状态检测、质量门禁、需求目录操作与会话恢复。
|
|
9
|
+
|
|
10
|
+
## 成员清单
|
|
11
|
+
|
|
12
|
+
analyze-upgrade-impact.sh: 升级影响分析脚本。
|
|
13
|
+
archive-requirement.sh: 需求归档与清理脚本。
|
|
14
|
+
calculate-checklist-completion.sh: Checklist 完成度统计脚本。
|
|
15
|
+
calculate-quarter.sh: 时间季度计算脚本。
|
|
16
|
+
check-dependencies.sh: 依赖关系检查脚本。
|
|
17
|
+
check-prerequisites.sh: 流程前置条件统一校验脚本。
|
|
18
|
+
check-task-status.sh: TASKS 完成状态统计脚本。
|
|
19
|
+
checklist-errors.sh: Checklist 错误码与诊断脚本。
|
|
20
|
+
common.sh: 脚本公共函数库(REQ 识别、日志工具等)。
|
|
21
|
+
consolidate-research.sh: research 结果汇总脚本。
|
|
22
|
+
create-requirement.sh: 创建需求目录与初始状态;同步 workspace 的 `.current-req`。
|
|
23
|
+
delta-parser.ts: Delta 解析器。
|
|
24
|
+
detect-file-conflicts.sh: 并行开发文件冲突检测脚本。
|
|
25
|
+
export-contracts.sh: 合同文档导出脚本。
|
|
26
|
+
extract-data-model.sh: 数据模型抽取脚本。
|
|
27
|
+
flow-context-add.sh: context JSONL 条目追加脚本。
|
|
28
|
+
flow-context-init.sh: context 目录初始化脚本。
|
|
29
|
+
flow-context-validate.sh: context 路径验证脚本。
|
|
30
|
+
flow-delta-apply.sh: Delta 应用脚本。
|
|
31
|
+
flow-delta-archive.sh: Delta 归档脚本。
|
|
32
|
+
flow-delta-create.sh: Delta 创建脚本。
|
|
33
|
+
flow-delta-list.sh: Delta 列表脚本。
|
|
34
|
+
flow-delta-status.sh: Delta 状态脚本。
|
|
35
|
+
flow-quality-full.sh: 全量质量检查脚本。
|
|
36
|
+
flow-quality-quick.sh: 快速质量检查脚本。
|
|
37
|
+
flow-workspace-init.sh: 开发者 workspace 初始化脚本。
|
|
38
|
+
flow-workspace-record.sh: workspace journal 追加记录脚本。
|
|
39
|
+
generate-clarification-questions.sh: Clarify 问题生成脚本。
|
|
40
|
+
generate-clarification-report.sh: Clarify 报告生成脚本。
|
|
41
|
+
generate-quickstart.sh: quickstart 文档生成脚本。
|
|
42
|
+
generate-research-tasks.sh: research 任务生成脚本。
|
|
43
|
+
generate-status-report.sh: 状态报告聚合脚本。
|
|
44
|
+
generate-tech-analysis.sh: 技术分析生成脚本。
|
|
45
|
+
get-workflow-status.sh: 工作流状态读取脚本。
|
|
46
|
+
locate-requirement-in-roadmap.sh: roadmap 需求定位脚本。
|
|
47
|
+
manage-constitution.sh: Constitution 管理脚本。
|
|
48
|
+
mark-task-complete.sh: 任务完成标记脚本。
|
|
49
|
+
parse-task-dependencies.js: 任务依赖解析器。
|
|
50
|
+
populate-research-tasks.sh: research 任务填充脚本。
|
|
51
|
+
record-quality-error.sh: 质量错误记录脚本。
|
|
52
|
+
recover-workflow.sh: 中断恢复脚本。
|
|
53
|
+
run-clarify-scan.sh: Clarify 扫描执行脚本。
|
|
54
|
+
run-high-review.sh: 高强度 review 执行脚本。
|
|
55
|
+
run-problem-analysis.sh: 问题分析执行脚本。
|
|
56
|
+
run-quality-gates.sh: 质量门禁执行脚本。
|
|
57
|
+
setup-epic.sh: Epic 初始化脚本。
|
|
58
|
+
setup-ralph-loop.sh: Ralph Loop 初始化脚本。
|
|
59
|
+
sync-roadmap-progress.sh: roadmap 进度同步脚本。
|
|
60
|
+
sync-task-marks.sh: TASKS 勾选同步脚本。
|
|
61
|
+
team-dev-init.sh: Team 开发并行初始化脚本。
|
|
62
|
+
team-state-recovery.sh: Team 状态恢复脚本。
|
|
63
|
+
test-clarify-scan.sh: Clarify 扫描测试脚本。
|
|
64
|
+
update-agent-context.sh: Agent 上下文更新脚本。
|
|
65
|
+
validate-constitution.sh: Constitution 校验脚本。
|
|
66
|
+
validate-hooks.sh: Hooks 校验脚本。
|
|
67
|
+
validate-research.sh: research 质量校验脚本。
|
|
68
|
+
validate-scope-boundary.sh: scope 边界校验脚本。
|
|
69
|
+
verify-gate.sh: Gate 校验脚本。
|
|
70
|
+
verify-setup.sh: 环境/安装验证脚本。
|
|
71
|
+
workflow-status.ts: 工作流状态类型化读取器。
|
|
72
|
+
|
|
73
|
+
## 设计约束
|
|
74
|
+
|
|
75
|
+
- 需求识别统一复用 `common.sh`,避免多处正则分叉。
|
|
76
|
+
- 新增脚本优先保持幂等与可重入,便于中断恢复。
|