cc-devflow 4.1.0 → 4.1.2
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/commands/flow/new.md +89 -252
- package/.claude/commands/util/git-commit.md +1 -4
- package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +51 -91
- package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +10 -2
- package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +9 -1
- package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +9 -1
- package/CHANGELOG.md +76 -0
- package/README.md +14 -18
- package/README.zh-CN.md +14 -12
- package/bin/adapt.js +4 -0
- package/lib/compiler/CLAUDE.md +5 -3
- package/lib/compiler/__tests__/compile-regression.test.js +94 -0
- package/lib/compiler/__tests__/parser.test.js +46 -0
- package/lib/compiler/__tests__/resource-copier.test.js +26 -0
- package/lib/compiler/__tests__/skill-discovery.test.js +72 -0
- package/lib/compiler/emitters/antigravity-emitter.js +35 -36
- package/lib/compiler/emitters/base-emitter.js +3 -1
- package/lib/compiler/emitters/codex-emitter.js +34 -35
- package/lib/compiler/emitters/cursor-emitter.js +14 -34
- package/lib/compiler/emitters/qwen-emitter.js +14 -34
- package/lib/compiler/index.js +124 -0
- package/lib/compiler/parser.js +43 -8
- package/lib/compiler/resource-copier.js +6 -0
- package/lib/compiler/skill-discovery.js +68 -0
- package/lib/compiler/skills-registry.js +8 -41
- package/package.json +1 -1
|
@@ -1,77 +1,50 @@
|
|
|
1
1
|
# Flow-New Orchestration Template
|
|
2
2
|
|
|
3
|
-
> Execution flow for `/flow-new` one-shot requirement development
|
|
3
|
+
> Execution flow for `/flow-new` one-shot requirement development (v4.1)
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Stage Execution Skeleton
|
|
8
8
|
|
|
9
|
-
### [1/
|
|
9
|
+
### [1/6] /flow-init
|
|
10
10
|
- 创建需求目录 + Git 分支
|
|
11
|
-
-
|
|
12
|
-
- Exit Gate:
|
|
13
|
-
|
|
14
|
-
### [2/8] /flow-prd
|
|
15
|
-
- 生成 PRD.md (用户故事 + GWT 验收标准)
|
|
16
|
-
- Constitution 符合性检查
|
|
17
|
-
|
|
18
|
-
### [2.3/8] /flow-checklist (可选, 80% 门禁)
|
|
19
|
-
- 触发条件: `quality-rules.yml` 中 `checklist_gate_enabled: true`
|
|
20
|
-
- 生成 checklists/*.md (5 维度质量验证)
|
|
21
|
-
- 闸门: 完成度 ≥ 80%
|
|
22
|
-
|
|
23
|
-
### [2.5/8] /flow-ui (条件触发)
|
|
24
|
-
**UI Detection Logic** (JavaScript):
|
|
25
|
-
```javascript
|
|
26
|
-
function detectUIRequirement(prdContent, projectRoot) {
|
|
27
|
-
const uiKeywords = ['用户界面', '前端', 'Web页面', 'UI', '界面设计', '交互',
|
|
28
|
-
'页面', '表单', '按钮', '导航', '布局', '组件'];
|
|
29
|
-
const hasUIKeywords = uiKeywords.some(kw => prdContent.includes(kw));
|
|
30
|
-
const hasFrontendStack = fs.existsSync(`${projectRoot}/package.json`);
|
|
31
|
-
const isBackendOnly = prdContent.includes('纯后端');
|
|
32
|
-
return (hasUIKeywords || hasFrontendStack) && !isBackendOnly;
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
- 输出: UI_PROTOTYPE.html + research/ui_design_strategy.md
|
|
36
|
-
- 跳过: orchestration_status.json.ui_skipped = true
|
|
11
|
+
- 研究材料收集 + `BRAINSTORM.md` 初始化
|
|
12
|
+
- Exit Gate: `orchestration_status.status == initialized`
|
|
37
13
|
|
|
38
|
-
### [2
|
|
39
|
-
-
|
|
40
|
-
- 输出:
|
|
41
|
-
-
|
|
14
|
+
### [2/6] /flow-clarify (可选)
|
|
15
|
+
- 触发条件: 需求歧义、边界冲突、验收标准不明确
|
|
16
|
+
- 输出: `clarifications/*.md`
|
|
17
|
+
- 若跳过: 标记 `clarify_skipped: true`
|
|
42
18
|
|
|
43
|
-
### [3/
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
19
|
+
### [3/6] /flow-spec
|
|
20
|
+
- 统一规格阶段: PRD → Tech+UI(并行) → Epic/TASKS
|
|
21
|
+
- 支持模式: `--skip-tech` / `--skip-ui`
|
|
22
|
+
- Exit Gate: 规格产物完整,`status = spec_complete`
|
|
47
23
|
|
|
48
|
-
### [4/
|
|
24
|
+
### [4/6] /flow-dev
|
|
49
25
|
**TDD 执行模式**:
|
|
50
26
|
```
|
|
51
27
|
Phase 1: 分析现有代码
|
|
52
28
|
Phase 2: 编写测试 (Tests First)
|
|
53
29
|
↓
|
|
54
|
-
|
|
30
|
+
TDD CHECKPOINT → 测试必须先失败
|
|
55
31
|
↓
|
|
56
32
|
Phase 3: 实现代码
|
|
57
33
|
Phase 4: 测试验证 → 测试必须通过
|
|
58
|
-
Phase 5: Git 提交并标记完成
|
|
59
34
|
```
|
|
60
|
-
- 输出: 实现代码 + 测试代码 + TASKS.md
|
|
61
|
-
|
|
62
|
-
### [5/
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
- 最终构建
|
|
74
|
-
- 创建 GitHub Pull Request
|
|
35
|
+
- 输出: 实现代码 + 测试代码 + `TASKS.md` 勾选更新
|
|
36
|
+
|
|
37
|
+
### [5/6] /flow-quality --full
|
|
38
|
+
**统一质量验证**:
|
|
39
|
+
- 规格合规审查
|
|
40
|
+
- 代码质量审查
|
|
41
|
+
- 安全扫描与测试门禁
|
|
42
|
+
- 输出: `SPEC_REVIEW.md`, `CODE_QUALITY_REVIEW.md`, `SECURITY_REPORT.md`
|
|
43
|
+
|
|
44
|
+
### [6/6] /flow-release
|
|
45
|
+
- 生成 `RELEASE_PLAN.md`
|
|
46
|
+
- 执行发布分支策略(PR/merge/squash 等)
|
|
47
|
+
- 必要时更新 `CLAUDE.md`
|
|
75
48
|
|
|
76
49
|
---
|
|
77
50
|
|
|
@@ -83,65 +56,52 @@ Phase 5: Git 提交并标记完成
|
|
|
83
56
|
|
|
84
57
|
需求: REQ-123 | 支持用户下单
|
|
85
58
|
|
|
86
|
-
[1/
|
|
87
|
-
[2/
|
|
88
|
-
[
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[
|
|
92
|
-
[5/8] ⏳ 等待质量保证...
|
|
93
|
-
[6/8] ⏳ 等待发布管理...
|
|
59
|
+
[1/6] ✅ 初始化完成
|
|
60
|
+
[2/6] ✅ 澄清完成 (可选)
|
|
61
|
+
[3/6] ✅ 统一规格完成
|
|
62
|
+
[4/6] 🔄 开发执行中... (8/18 已完成)
|
|
63
|
+
[5/6] ⏳ 等待质量验证...
|
|
64
|
+
[6/6] ⏳ 等待发布管理...
|
|
94
65
|
```
|
|
95
66
|
|
|
96
|
-
**状态图标**:
|
|
97
|
-
- ✅ 已完成
|
|
98
|
-
- 🔄 执行中
|
|
99
|
-
- ⏳ 等待执行
|
|
100
|
-
- ⚡️ 条件触发已执行
|
|
101
|
-
- 🔧 必需步骤已完成
|
|
102
|
-
|
|
103
67
|
---
|
|
104
68
|
|
|
105
69
|
## Output Structure
|
|
106
70
|
|
|
107
71
|
```
|
|
108
72
|
devflow/requirements/${REQ_ID}/
|
|
109
|
-
├──
|
|
110
|
-
├──
|
|
111
|
-
├──
|
|
112
|
-
├──
|
|
113
|
-
├── TECH_DESIGN.md
|
|
114
|
-
├──
|
|
115
|
-
├──
|
|
116
|
-
├──
|
|
117
|
-
├──
|
|
118
|
-
├──
|
|
119
|
-
├──
|
|
120
|
-
|
|
121
|
-
└── RELEASE_PLAN.md # [6/8]
|
|
73
|
+
├── BRAINSTORM.md
|
|
74
|
+
├── research/
|
|
75
|
+
├── clarifications/ # 可选
|
|
76
|
+
├── PRD.md
|
|
77
|
+
├── TECH_DESIGN.md # 若未跳过 tech
|
|
78
|
+
├── UI_PROTOTYPE.html # 若未跳过 ui 且识别到 UI 需求
|
|
79
|
+
├── EPIC.md
|
|
80
|
+
├── TASKS.md
|
|
81
|
+
├── SPEC_REVIEW.md # flow-quality --full
|
|
82
|
+
├── CODE_QUALITY_REVIEW.md # flow-quality --full
|
|
83
|
+
├── SECURITY_REPORT.md # flow-quality --full
|
|
84
|
+
└── RELEASE_PLAN.md
|
|
122
85
|
```
|
|
123
86
|
|
|
124
87
|
---
|
|
125
88
|
|
|
126
89
|
## Status Tracking
|
|
127
90
|
|
|
128
|
-
**orchestration_status.json
|
|
91
|
+
**orchestration_status.json 推荐字段**:
|
|
129
92
|
```json
|
|
130
93
|
{
|
|
131
94
|
"status": "dev_complete",
|
|
132
95
|
"phase": "execution",
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"ui_skipped": false, // 或 ui_complete: true
|
|
137
|
-
"tech_design_complete": true,
|
|
138
|
-
"epic_complete": true,
|
|
96
|
+
"initialized": true,
|
|
97
|
+
"clarify_complete": true,
|
|
98
|
+
"spec_complete": true,
|
|
139
99
|
"dev_complete": true,
|
|
140
|
-
"
|
|
100
|
+
"quality_complete": false,
|
|
141
101
|
"release_complete": false
|
|
142
102
|
}
|
|
143
103
|
```
|
|
144
104
|
|
|
145
105
|
---
|
|
146
106
|
|
|
147
|
-
**Last Updated**:
|
|
107
|
+
**Last Updated**: 2026-02-07
|
|
@@ -85,7 +85,15 @@ done
|
|
|
85
85
|
|
|
86
86
|
# Source common functions
|
|
87
87
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
88
|
-
|
|
88
|
+
COMMON_SH="$SCRIPT_DIR/common.sh"
|
|
89
|
+
if [[ ! -f "$COMMON_SH" ]]; then
|
|
90
|
+
COMMON_SH="$SCRIPT_DIR/../../../../scripts/common.sh"
|
|
91
|
+
fi
|
|
92
|
+
if [[ ! -f "$COMMON_SH" ]]; then
|
|
93
|
+
echo "ERROR: common.sh not found (checked local + .claude/scripts)" >&2
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
source "$COMMON_SH"
|
|
89
97
|
|
|
90
98
|
# Get requirement paths
|
|
91
99
|
eval $(get_requirement_paths)
|
|
@@ -229,4 +237,4 @@ else
|
|
|
229
237
|
check_file "$ANALYSIS_FILE" "ANALYSIS.md"
|
|
230
238
|
check_file "$PLAN_FILE" "PLAN.md"
|
|
231
239
|
fi
|
|
232
|
-
fi
|
|
240
|
+
fi
|
|
@@ -173,7 +173,15 @@ done
|
|
|
173
173
|
|
|
174
174
|
# Source common functions
|
|
175
175
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
176
|
-
|
|
176
|
+
COMMON_SH="$SCRIPT_DIR/common.sh"
|
|
177
|
+
if [[ ! -f "$COMMON_SH" ]]; then
|
|
178
|
+
COMMON_SH="$SCRIPT_DIR/../../../../scripts/common.sh"
|
|
179
|
+
fi
|
|
180
|
+
if [[ ! -f "$COMMON_SH" ]]; then
|
|
181
|
+
echo "ERROR: common.sh not found (checked local + .claude/scripts)" >&2
|
|
182
|
+
exit 1
|
|
183
|
+
fi
|
|
184
|
+
source "$COMMON_SH"
|
|
177
185
|
REPO_ROOT=$(get_repo_root)
|
|
178
186
|
|
|
179
187
|
# Interactive mode
|
|
@@ -28,7 +28,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
28
28
|
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
29
29
|
|
|
30
30
|
# shellcheck source=.claude/scripts/common.sh
|
|
31
|
-
|
|
31
|
+
COMMON_SH="$SCRIPT_DIR/common.sh"
|
|
32
|
+
if [[ ! -f "$COMMON_SH" ]]; then
|
|
33
|
+
COMMON_SH="$SCRIPT_DIR/../../../../scripts/common.sh"
|
|
34
|
+
fi
|
|
35
|
+
if [[ ! -f "$COMMON_SH" ]]; then
|
|
36
|
+
echo "ERROR: common.sh not found (checked local + .claude/scripts)" >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
source "$COMMON_SH"
|
|
32
40
|
|
|
33
41
|
STRICT_MODE=false
|
|
34
42
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,82 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [4.1.2] - 2026-02-07
|
|
11
|
+
|
|
12
|
+
### 🔧 Adapt Compiler Migration Reliability Fixes
|
|
13
|
+
|
|
14
|
+
v4.1.2 fixes regressions in multi-platform `adapt` output generation and adds regression coverage to prevent command/skill migration gaps.
|
|
15
|
+
|
|
16
|
+
#### Fixed
|
|
17
|
+
|
|
18
|
+
- **Nested command compilation restored**
|
|
19
|
+
- `adapt` now recursively scans `.claude/commands/**` instead of top-level only
|
|
20
|
+
- Preserves relative command paths (for example `flow/new` → platform subdirectories)
|
|
21
|
+
- Ensures command outputs are emitted to matching platform folder structures
|
|
22
|
+
|
|
23
|
+
- **Skills migration completeness restored**
|
|
24
|
+
- Added recursive Skill discovery for grouped and root-level skills
|
|
25
|
+
- Registry and platform emitters now discover the same full skill set
|
|
26
|
+
- Resolved missing Codex/Cursor/Qwen/Antigravity skill outputs
|
|
27
|
+
|
|
28
|
+
- **Module emission restored in main compile path**
|
|
29
|
+
- `adapt` main flow now emits skills/agents/rules/hooks in addition to commands
|
|
30
|
+
- CLI output now reports module-level emission statistics for easier verification
|
|
31
|
+
|
|
32
|
+
- **Resource copy reliability improved**
|
|
33
|
+
- Handles Skill resource symlinks more robustly during emitter copy
|
|
34
|
+
- Ignores glob-style inline paths to avoid false missing-file warnings
|
|
35
|
+
- Fixed broken workflow skill symlink targets under `.claude/skills/workflow/*`
|
|
36
|
+
|
|
37
|
+
#### Added
|
|
38
|
+
|
|
39
|
+
- **Regression tests for adapt migration pipeline**
|
|
40
|
+
- Parser recursive command discovery tests
|
|
41
|
+
- Skill discovery tests (grouped + root-level)
|
|
42
|
+
- Compile end-to-end regression test
|
|
43
|
+
- Resource copier glob-filter test
|
|
44
|
+
|
|
45
|
+
#### Benefits
|
|
46
|
+
|
|
47
|
+
- ✅ `cc-devflow adapt --platform <target>` now generates complete expected outputs
|
|
48
|
+
- ✅ Cross-platform command/skill migration behavior is consistent and test-protected
|
|
49
|
+
- ✅ Release/debug verification is faster with explicit module emission metrics
|
|
50
|
+
|
|
51
|
+
## [4.1.1] - 2026-02-07
|
|
52
|
+
|
|
53
|
+
### 🔧 Flow-Init Script Reliability + Flow Docs Alignment
|
|
54
|
+
|
|
55
|
+
v4.1.1 focuses on execution reliability for embedded flow-init scripts and removes stale command guidance from flow documentation.
|
|
56
|
+
|
|
57
|
+
#### Fixed
|
|
58
|
+
|
|
59
|
+
- **Flow-Init embedded scripts** now resolve shared `common.sh` safely
|
|
60
|
+
- Added fallback loading path from `skills/workflow/flow-init/scripts/*` to `.claude/scripts/common.sh`
|
|
61
|
+
- Prevents runtime failure when running bundled scripts directly from skill directories
|
|
62
|
+
- Affects:
|
|
63
|
+
- `check-prerequisites.sh`
|
|
64
|
+
- `create-requirement.sh`
|
|
65
|
+
- `validate-research.sh`
|
|
66
|
+
|
|
67
|
+
#### Changed
|
|
68
|
+
|
|
69
|
+
- **Flow command docs aligned with actual v4.1 workflow**
|
|
70
|
+
- Updated `/flow-new` orchestration to `flow-init → flow-clarify(optional) → flow-spec → flow-dev → flow-quality → flow-release`
|
|
71
|
+
- Removed outdated references to deprecated `/flow-review` and `/flow-qa` in active workflow guidance
|
|
72
|
+
- Synced bilingual README command links to namespace paths under `.claude/commands/flow/`
|
|
73
|
+
|
|
74
|
+
#### Maintenance
|
|
75
|
+
|
|
76
|
+
- **Lockfile metadata synchronized**
|
|
77
|
+
- Normalized `package-lock.json` package version markers to match `package.json`
|
|
78
|
+
|
|
79
|
+
#### Benefits
|
|
80
|
+
|
|
81
|
+
- ✅ `flow-init` script execution no longer fails due to missing local `common.sh`
|
|
82
|
+
- ✅ Command docs now map to real command files and current workflow semantics
|
|
83
|
+
- ✅ Release metadata consistency improved for publish pipeline
|
|
84
|
+
|
|
85
|
+
|
|
10
86
|
## [4.1.0] - 2026-02-07
|
|
11
87
|
|
|
12
88
|
### 🤖 Claude Team Integration: Multi-Agent Parallel Collaboration
|
package/README.md
CHANGED
|
@@ -262,14 +262,13 @@ bash .claude/tests/constitution/run_all_constitution_tests.sh
|
|
|
262
262
|
|---------|---------|---------------|---------------|
|
|
263
263
|
| `/flow-new` | 🎯 Start New Requirement | `/flow-new "REQ-123\|Feature"` | [→](docs/commands/flow-new.md) |
|
|
264
264
|
| `/flow-init` | 📦 Initialize Requirement | `/flow-init "REQ-123\|Feature"` | [→](docs/commands/flow-init.md) |
|
|
265
|
-
| `/flow-clarify` | 🔎 Clarify Ambiguities | `/flow-clarify "REQ-123"` | [→](.claude/commands/flow
|
|
266
|
-
| `/flow-spec` | 📋 Unified Specification (v4.1) | `/flow-spec "REQ-123"` | [→](.claude/commands/flow
|
|
267
|
-
| `/flow-checklist` | ✅ Requirement Quality Check | `/flow-checklist --type ux` | [→](.claude/commands/flow
|
|
268
|
-
| `/flow-
|
|
269
|
-
| `/flow-fix` | 🐛 Systematic Bug Fix | `/flow-fix "BUG-123\|Description"` | [→](.claude/commands/flow
|
|
270
|
-
| `/flow-verify` | 🔍 Verify Consistency | `/flow-verify "REQ-123"` | [→](
|
|
271
|
-
| `/flow-
|
|
272
|
-
| `/flow-release` | 🚢 Create Release | `/flow-release "REQ-123"` | [→](docs/commands/flow-release.md) |
|
|
265
|
+
| `/flow-clarify` | 🔎 Clarify Ambiguities | `/flow-clarify "REQ-123"` | [→](.claude/commands/flow/clarify.md) |
|
|
266
|
+
| `/flow-spec` | 📋 Unified Specification (v4.1) | `/flow-spec "REQ-123"` | [→](.claude/commands/flow/spec.md) |
|
|
267
|
+
| `/flow-checklist` | ✅ Requirement Quality Check | `/flow-checklist --type ux` | [→](.claude/commands/flow/checklist.md) |
|
|
268
|
+
| `/flow-quality` | ✅ Combined Quality Verification | `/flow-quality "REQ-123" --full` | [→](.claude/commands/flow/quality.md) |
|
|
269
|
+
| `/flow-fix` | 🐛 Systematic Bug Fix | `/flow-fix "BUG-123\|Description"` | [→](.claude/commands/flow/fix.md) |
|
|
270
|
+
| `/flow-verify` | 🔍 Verify Consistency | `/flow-verify "REQ-123"` | [→](.claude/commands/flow/verify.md) |
|
|
271
|
+
| `/flow-release` | 🚢 Create Release | `/flow-release "REQ-123"` | [→](.claude/commands/flow/release.md) |
|
|
273
272
|
|
|
274
273
|
📚 [Complete Command Reference](docs/commands/README.md)
|
|
275
274
|
|
|
@@ -288,7 +287,7 @@ Your Scenario:
|
|
|
288
287
|
├─ Continue interrupted development? → /flow-restart "REQ-123"
|
|
289
288
|
├─ Check development progress? → /flow-status REQ-123
|
|
290
289
|
├─ Found document inconsistencies? → /flow-verify "REQ-123"
|
|
291
|
-
├─ Development complete, need
|
|
290
|
+
├─ Development complete, need verification? → /flow-quality "REQ-123" --full
|
|
292
291
|
├─ Fix production bug? → /flow-fix "BUG-001|Description"
|
|
293
292
|
└─ Ready to release? → /flow-release "REQ-123"
|
|
294
293
|
```
|
|
@@ -322,11 +321,9 @@ graph TB
|
|
|
322
321
|
|
|
323
322
|
FlowSpec --> FlowDev["/flow-dev<br/>TASKS.md execution<br/>TDD Checkpoint"]
|
|
324
323
|
|
|
325
|
-
FlowDev -->
|
|
324
|
+
FlowDev --> FlowQuality["/flow-quality<br/>Quick/Full Verification<br/>Spec + Quality + Security"]
|
|
326
325
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
FlowQA --> FlowRelease["/flow-release<br/>PR creation<br/>Branch decision"]
|
|
326
|
+
FlowQuality --> FlowRelease["/flow-release<br/>PR creation<br/>Branch decision"]
|
|
330
327
|
|
|
331
328
|
FlowRelease --> FlowVerify["/flow-verify<br/>Consistency check"]
|
|
332
329
|
|
|
@@ -340,8 +337,7 @@ graph TB
|
|
|
340
337
|
style FlowClarify fill:#fff9c4
|
|
341
338
|
style FlowSpec fill:#e8f5e9
|
|
342
339
|
style FlowDev fill:#f3e5f5
|
|
343
|
-
style
|
|
344
|
-
style FlowQA fill:#fce4ec
|
|
340
|
+
style FlowQuality fill:#e1bee7
|
|
345
341
|
style FlowRelease fill:#e0f2f1
|
|
346
342
|
style FlowVerify fill:#e3f2fd
|
|
347
343
|
```
|
|
@@ -351,7 +347,7 @@ graph TB
|
|
|
351
347
|
- **Requirement-Level Commands** (light orange): Execute once per requirement (REQ-XXX)
|
|
352
348
|
- **Unified /flow-spec** (v4.1): Replaces flow-prd/flow-tech/flow-ui/flow-epic with parallel execution
|
|
353
349
|
- **Brainstorming** (v2.3.0): `/flow-init` now generates `BRAINSTORM.md` as requirement "North Star"
|
|
354
|
-
- **
|
|
350
|
+
- **Unified Quality Verification** (v3.0.0): `/flow-quality --full` combines spec compliance, code quality, and security
|
|
355
351
|
- **Optional Steps** (yellow): `/flow-clarify` is optional; skip if requirements are clear
|
|
356
352
|
- **TDD Checkpoint** (v2.3.0): `/flow-dev` includes mandatory TDD checkpoint (tests must FAIL first)
|
|
357
353
|
- **Quality Gates**: Each stage has entry/exit gates ensuring document quality and Constitution compliance
|
|
@@ -713,7 +709,7 @@ v2.3.0 upgrades the Constitution from a "document" to an "executable discipline
|
|
|
713
709
|
- Cross-reference to `rationalization-library.md`
|
|
714
710
|
|
|
715
711
|
**📁 New Files**:
|
|
716
|
-
- `.claude/commands/cancel-ralph.md` - Cancel Ralph loop command
|
|
712
|
+
- `.claude/commands/util/cancel-ralph.md` - Cancel Ralph loop command
|
|
717
713
|
- `.claude/skills/flow-attention-refresh/SKILL.md` - 4 attention refresh protocols
|
|
718
714
|
- `.claude/hooks/ralph-stop-hook.sh` - Stop Hook for self-referential loops
|
|
719
715
|
- `.claude/hooks/hooks.json` - Hook registration configuration
|
|
@@ -722,7 +718,7 @@ v2.3.0 upgrades the Constitution from a "document" to an "executable discipline
|
|
|
722
718
|
- `.claude/docs/templates/ATTEMPT_TEMPLATE.md` - Research attempt log format
|
|
723
719
|
- `.claude/agents/spec-reviewer.md` - Stage 1 spec compliance reviewer
|
|
724
720
|
- `.claude/agents/code-quality-reviewer.md` - Stage 2 code quality reviewer
|
|
725
|
-
- `.claude/commands/flow-review.md` - Two-stage review command
|
|
721
|
+
- `.claude/commands/flow-review.md` - Two-stage review command (legacy, replaced by `.claude/commands/flow/quality.md`)
|
|
726
722
|
- `.claude/rules/rationalization-library.md` - Centralized rationalization defense
|
|
727
723
|
- `.claude/scripts/verify-gate.sh` - Exit gate verification script
|
|
728
724
|
- `.claude/skills/flow-brainstorming/` - Brainstorming skill
|
package/README.zh-CN.md
CHANGED
|
@@ -256,12 +256,13 @@ bash .claude/tests/constitution/run_all_constitution_tests.sh
|
|
|
256
256
|
|------|------|----------|----------|
|
|
257
257
|
| `/flow-new` | 🎯 启动新需求 | `/flow-new "REQ-123\|功能"` | [→](docs/commands/flow-new.zh-CN.md) |
|
|
258
258
|
| `/flow-init` | 📦 初始化需求 | `/flow-init "REQ-123\|功能"` | [→](docs/commands/flow-init.zh-CN.md) |
|
|
259
|
-
| `/flow-clarify` | 🔎 澄清歧义 | `/flow-clarify "REQ-123"` | [→](.claude/commands/flow
|
|
260
|
-
| `/flow-spec` | 📋 统一规格阶段 (v4.1) | `/flow-spec "REQ-123"` | [→](.claude/commands/flow
|
|
261
|
-
| `/flow-checklist` | ✅ 需求质量检查 | `/flow-checklist --type ux` | [→](.claude/commands/flow
|
|
262
|
-
| `/flow-
|
|
263
|
-
| `/flow-
|
|
264
|
-
| `/flow-
|
|
259
|
+
| `/flow-clarify` | 🔎 澄清歧义 | `/flow-clarify "REQ-123"` | [→](.claude/commands/flow/clarify.md) |
|
|
260
|
+
| `/flow-spec` | 📋 统一规格阶段 (v4.1) | `/flow-spec "REQ-123"` | [→](.claude/commands/flow/spec.md) |
|
|
261
|
+
| `/flow-checklist` | ✅ 需求质量检查 | `/flow-checklist --type ux` | [→](.claude/commands/flow/checklist.md) |
|
|
262
|
+
| `/flow-quality` | ✅ 统一质量验证 | `/flow-quality "REQ-123" --full` | [→](.claude/commands/flow/quality.md) |
|
|
263
|
+
| `/flow-fix` | 🐛 系统化缺陷修复 | `/flow-fix "BUG-123\|描述"` | [→](.claude/commands/flow/fix.md) |
|
|
264
|
+
| `/flow-verify` | 🔍 验证一致性 | `/flow-verify "REQ-123"` | [→](.claude/commands/flow/verify.md) |
|
|
265
|
+
| `/flow-release` | 🚢 创建发布 | `/flow-release "REQ-123"` | [→](.claude/commands/flow/release.md) |
|
|
265
266
|
|
|
266
267
|
📚 [完整命令参考](docs/commands/README.zh-CN.md)
|
|
267
268
|
|
|
@@ -281,7 +282,7 @@ bash .claude/tests/constitution/run_all_constitution_tests.sh
|
|
|
281
282
|
├─ 开发中断需要继续? → /flow-restart "REQ-123"
|
|
282
283
|
├─ 检查开发进度? → /flow-status REQ-123
|
|
283
284
|
├─ 发现文档不一致? → /flow-verify "REQ-123"
|
|
284
|
-
├─
|
|
285
|
+
├─ 开发完成需要验证? → /flow-quality "REQ-123" --full
|
|
285
286
|
├─ 修复生产 Bug? → /flow-fix "BUG-001|描述"
|
|
286
287
|
└─ 准备发布? → /flow-release "REQ-123"
|
|
287
288
|
```
|
|
@@ -315,9 +316,9 @@ graph TB
|
|
|
315
316
|
|
|
316
317
|
FlowSpec --> FlowDev["/flow-dev<br/>TASKS.md 执行<br/>TDD 强制"]
|
|
317
318
|
|
|
318
|
-
FlowDev -->
|
|
319
|
+
FlowDev --> FlowQuality["/flow-quality<br/>快速/完整验证<br/>规格 + 质量 + 安全"]
|
|
319
320
|
|
|
320
|
-
|
|
321
|
+
FlowQuality --> FlowRelease["/flow-release<br/>PR 创建 & 部署"]
|
|
321
322
|
|
|
322
323
|
FlowRelease --> FlowVerify["/flow-verify<br/>一致性检查"]
|
|
323
324
|
|
|
@@ -331,7 +332,7 @@ graph TB
|
|
|
331
332
|
style FlowClarify fill:#fff9c4
|
|
332
333
|
style FlowSpec fill:#e8f5e9
|
|
333
334
|
style FlowDev fill:#f3e5f5
|
|
334
|
-
style
|
|
335
|
+
style FlowQuality fill:#fce4ec
|
|
335
336
|
style FlowRelease fill:#e0f2f1
|
|
336
337
|
style FlowVerify fill:#e3f2fd
|
|
337
338
|
```
|
|
@@ -340,6 +341,7 @@ graph TB
|
|
|
340
341
|
- **项目级命令**(浅蓝色):项目初始化时执行一次,建立全局标准(SSOT)
|
|
341
342
|
- **需求级命令**(浅橙色):每个需求(REQ-XXX)执行一次
|
|
342
343
|
- **统一 /flow-spec** (v4.1):替代 flow-prd/flow-tech/flow-ui/flow-epic,支持并行执行
|
|
344
|
+
- **统一质量验证** (v3.0.0):`/flow-quality --full` 合并规格合规、代码质量与安全检查
|
|
343
345
|
- **可选步骤**(黄色):`/flow-clarify` 为可选步骤,需求清晰时可跳过
|
|
344
346
|
- **质量闸门**:每个阶段都有入口/出口闸门,确保文档质量和 Constitution 合规性
|
|
345
347
|
- **TDD 强制执行**:`/flow-dev` 严格强制执行测试驱动开发顺序
|
|
@@ -701,7 +703,7 @@ v2.3.0 将 Constitution 从"文档"升级为"可执行纪律系统",借鉴 sup
|
|
|
701
703
|
- 交叉引用到 `rationalization-library.md`
|
|
702
704
|
|
|
703
705
|
**📁 新增文件**:
|
|
704
|
-
- `.claude/commands/cancel-ralph.md` - 取消 Ralph 循环命令
|
|
706
|
+
- `.claude/commands/util/cancel-ralph.md` - 取消 Ralph 循环命令
|
|
705
707
|
- `.claude/skills/flow-attention-refresh/SKILL.md` - 4 个注意力刷新协议
|
|
706
708
|
- `.claude/hooks/ralph-stop-hook.sh` - 自引用循环 Stop Hook
|
|
707
709
|
- `.claude/hooks/hooks.json` - Hook 注册配置
|
|
@@ -710,7 +712,7 @@ v2.3.0 将 Constitution 从"文档"升级为"可执行纪律系统",借鉴 sup
|
|
|
710
712
|
- `.claude/docs/templates/ATTEMPT_TEMPLATE.md` - 研究尝试日志格式
|
|
711
713
|
- `.claude/agents/spec-reviewer.md` - 阶段 1 规格合规性审查员
|
|
712
714
|
- `.claude/agents/code-quality-reviewer.md` - 阶段 2 代码质量审查员
|
|
713
|
-
- `.claude/commands/flow-review.md` -
|
|
715
|
+
- `.claude/commands/flow-review.md` - 两阶段审查命令(legacy,已由 `.claude/commands/flow/quality.md` 取代)
|
|
714
716
|
- `.claude/rules/rationalization-library.md` - 集中式合理化防御
|
|
715
717
|
- `.claude/scripts/verify-gate.sh` - 出口闸门验证脚本
|
|
716
718
|
- `.claude/skills/flow-brainstorming/` - 头脑风暴技能
|
package/bin/adapt.js
CHANGED
|
@@ -215,6 +215,10 @@ async function main() {
|
|
|
215
215
|
console.log(` Files skipped: ${result.filesSkipped}`);
|
|
216
216
|
console.log(` Resources copied: ${result.resourcesCopied}`);
|
|
217
217
|
console.log(` Resources skipped: ${result.resourcesSkipped}`);
|
|
218
|
+
console.log(` Skills emitted: ${result.skillsEmitted}`);
|
|
219
|
+
console.log(` Agents emitted: ${result.agentsEmitted}`);
|
|
220
|
+
console.log(` Module rules emitted: ${result.moduleRulesEmitted}`);
|
|
221
|
+
console.log(` Hooks emitted: ${result.hooksEmitted}`);
|
|
218
222
|
console.log(` Skills registered: ${result.skillsRegistered}`);
|
|
219
223
|
console.log(` Rules generated: ${result.rulesGenerated}`);
|
|
220
224
|
process.exit(0);
|
package/lib/compiler/CLAUDE.md
CHANGED
|
@@ -13,6 +13,8 @@ lib/compiler/
|
|
|
13
13
|
├── schemas.js # Zod validation schemas (CommandIR, Manifest)
|
|
14
14
|
├── errors.js # Custom error types (MissingFrontmatter, UnknownAlias, etc.)
|
|
15
15
|
├── skills-registry.js # Generate skills registry from .claude/skills/
|
|
16
|
+
├── skill-discovery.js # Recursive SKILL.md discovery (grouped + root skills)
|
|
17
|
+
├── resource-copier.js # Resource collection/copy and .claude path rewriting
|
|
16
18
|
├── platforms.js # Platform configuration registry (v2.0)
|
|
17
19
|
├── context-expander.js # context.jsonl expansion (v3.0)
|
|
18
20
|
├── index.js # Compiler entry point, orchestrates pipeline
|
|
@@ -69,7 +71,7 @@ Platform-specific output directories
|
|
|
69
71
|
## CLI Usage
|
|
70
72
|
|
|
71
73
|
```bash
|
|
72
|
-
#
|
|
74
|
+
# Compile commands + modules
|
|
73
75
|
npm run adapt # Compile all platforms
|
|
74
76
|
npm run adapt -- --platform codex # Compile single platform
|
|
75
77
|
npm run adapt -- --check # Drift detection only
|
|
@@ -81,8 +83,8 @@ npm run adapt -- --modules skills --platform cursor
|
|
|
81
83
|
|
|
82
84
|
## Key APIs
|
|
83
85
|
|
|
84
|
-
### compile(options) -
|
|
85
|
-
Compiles commands
|
|
86
|
+
### compile(options) - Main Flow
|
|
87
|
+
Compiles commands and emits platform modules (skills, agents, rules, hooks).
|
|
86
88
|
|
|
87
89
|
### compileMultiModule(options) - v3.0
|
|
88
90
|
Compiles all specified modules.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* T043: Compile Regression Tests
|
|
3
|
+
*
|
|
4
|
+
* [INPUT]: 临时 .claude 项目
|
|
5
|
+
* [OUTPUT]: compile() 端到端回归验证
|
|
6
|
+
* [POS]: 修复 adapt 回归,确保命令与技能正确落盘
|
|
7
|
+
* [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const os = require('os');
|
|
13
|
+
|
|
14
|
+
const { compile } = require('../index.js');
|
|
15
|
+
|
|
16
|
+
function writeFile(filePath, content) {
|
|
17
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
18
|
+
fs.writeFileSync(filePath, content);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function setupProjectFixture(rootDir) {
|
|
22
|
+
writeFile(path.join(rootDir, '.claude/commands/flow/new.md'), `---
|
|
23
|
+
name: flow-new
|
|
24
|
+
description: Create new requirement
|
|
25
|
+
---
|
|
26
|
+
# Flow New
|
|
27
|
+
|
|
28
|
+
Run flow new
|
|
29
|
+
`);
|
|
30
|
+
|
|
31
|
+
writeFile(path.join(rootDir, '.claude/skills/workflow/flow-dev/SKILL.md'), `---
|
|
32
|
+
name: flow-dev
|
|
33
|
+
description: Workflow dev skill
|
|
34
|
+
---
|
|
35
|
+
# flow-dev
|
|
36
|
+
`);
|
|
37
|
+
|
|
38
|
+
writeFile(path.join(rootDir, '.claude/skills/orchestrator/SKILL.md'), `---
|
|
39
|
+
name: orchestrator
|
|
40
|
+
description: Root level skill
|
|
41
|
+
---
|
|
42
|
+
# orchestrator
|
|
43
|
+
`);
|
|
44
|
+
|
|
45
|
+
writeFile(path.join(rootDir, '.claude/agents/planner.md'), `---
|
|
46
|
+
name: planner
|
|
47
|
+
description: Plan tasks
|
|
48
|
+
---
|
|
49
|
+
# planner
|
|
50
|
+
`);
|
|
51
|
+
|
|
52
|
+
writeFile(path.join(rootDir, '.claude/rules/base-rule.md'), `---
|
|
53
|
+
description: Base rule
|
|
54
|
+
alwaysApply: true
|
|
55
|
+
---
|
|
56
|
+
# rule
|
|
57
|
+
`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
describe('compile() regression', () => {
|
|
61
|
+
let tempDir;
|
|
62
|
+
let originalCwd;
|
|
63
|
+
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'compile-regression-'));
|
|
66
|
+
setupProjectFixture(tempDir);
|
|
67
|
+
originalCwd = process.cwd();
|
|
68
|
+
process.chdir(tempDir);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
process.chdir(originalCwd);
|
|
73
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('should compile nested commands and emit skills for codex', async () => {
|
|
77
|
+
const result = await compile({
|
|
78
|
+
sourceDir: '.claude/commands',
|
|
79
|
+
skillsDir: '.claude/skills',
|
|
80
|
+
outputBaseDir: '.',
|
|
81
|
+
platforms: ['codex'],
|
|
82
|
+
verbose: false
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
expect(result.success).toBe(true);
|
|
86
|
+
expect(result.filesCompiled).toBe(1);
|
|
87
|
+
expect(result.skillsRegistered).toBe(2);
|
|
88
|
+
expect(result.skillsEmitted).toBe(2);
|
|
89
|
+
expect(fs.existsSync('.codex/prompts/flow/new.md')).toBe(true);
|
|
90
|
+
expect(fs.existsSync('.codex/skills/flow-dev/SKILL.md')).toBe(true);
|
|
91
|
+
expect(fs.existsSync('.codex/skills/orchestrator/SKILL.md')).toBe(true);
|
|
92
|
+
expect(fs.existsSync('AGENTS.md')).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
});
|