claude-code-workflow 6.3.48 → 6.3.49
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 +6 -8
- package/.claude/agents/action-planning-agent.md +28 -45
- package/.claude/agents/cli-lite-planning-agent.md +93 -1
- package/.claude/agents/code-developer.md +144 -27
- package/.claude/commands/ccw-coordinator.md +175 -21
- package/.claude/commands/ccw-debug.md +832 -0
- package/.claude/commands/ccw.md +90 -9
- package/.claude/commands/cli/cli-init.md +1 -0
- package/.claude/commands/issue/convert-to-plan.md +718 -0
- package/.claude/commands/issue/from-brainstorm.md +382 -0
- package/.claude/commands/memory/tips.md +332 -0
- package/.claude/commands/workflow/analyze-with-file.md +804 -0
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +18 -43
- package/.claude/commands/workflow/brainstorm/role-analysis.md +705 -0
- package/.claude/commands/workflow/brainstorm-with-file.md +1153 -0
- package/.claude/commands/workflow/debug-with-file.md +7 -5
- package/.claude/commands/workflow/execute.md +6 -4
- package/.claude/commands/workflow/lite-plan.md +2 -2
- package/.claude/commands/workflow/plan-verify.md +162 -327
- package/.claude/commands/workflow/plan.md +162 -26
- package/.claude/commands/workflow/replan.md +78 -2
- package/.claude/commands/workflow/{review-fix.md → review-cycle-fix.md} +6 -6
- package/.claude/commands/workflow/review-module-cycle.md +2 -2
- package/.claude/commands/workflow/review-session-cycle.md +2 -2
- package/.claude/commands/workflow/tools/conflict-resolution.md +16 -26
- package/.claude/commands/workflow/tools/context-gather.md +81 -118
- package/.claude/commands/workflow/tools/task-generate-agent.md +94 -10
- package/.claude/skills/ccw-help/command.json +4 -4
- package/.claude/skills/lite-skill-generator/SKILL.md +650 -0
- package/.claude/skills/lite-skill-generator/templates/simple-skill.md +68 -0
- package/.claude/skills/lite-skill-generator/templates/style-guide.md +64 -0
- package/.claude/skills/skill-generator/SKILL.md +277 -85
- package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +4 -15
- package/.claude/skills/skill-generator/phases/02-structure-generation.md +72 -17
- package/.claude/skills/skill-generator/phases/03-phase-generation.md +218 -51
- package/.claude/skills/skill-generator/phases/04-specs-templates.md +111 -41
- package/.claude/skills/skill-generator/phases/05-validation.md +139 -56
- package/.claude/skills/skill-generator/templates/autonomous-action.md +78 -268
- package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +14 -0
- package/.claude/skills/skill-generator/templates/code-analysis-action.md +12 -0
- package/.claude/skills/skill-generator/templates/llm-action.md +12 -0
- package/.claude/skills/skill-generator/templates/script-template.md +368 -0
- package/.claude/skills/skill-generator/templates/sequential-phase.md +14 -0
- package/.claude/skills/skill-generator/templates/skill-md.md +14 -0
- package/.claude/skills/skill-tuning/SKILL.md +130 -266
- package/.claude/skills/skill-tuning/phases/orchestrator.md +95 -283
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +90 -198
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +193 -1345
- package/.claude/workflows/cli-templates/schemas/plan-verify-agent-schema.json +47 -0
- package/.claude/workflows/cli-templates/schemas/verify-json-schema.json +158 -0
- package/.claude/workflows/cli-tools-usage.md +1 -1
- package/.codex/AGENTS.md +1 -3
- package/.codex/prompts/analyze-with-file.md +607 -0
- package/.codex/prompts/brainstorm-to-cycle.md +455 -0
- package/.codex/prompts/brainstorm-with-file.md +933 -0
- package/.codex/prompts/debug-with-file.md +15 -20
- package/.codex/skills/ccw-cli-tools/SKILL.md +559 -0
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +29 -5
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +2 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +62 -20
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.js +5 -3
- package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
- package/ccw/dist/config/litellm-provider-models.d.ts +73 -0
- package/ccw/dist/config/litellm-provider-models.d.ts.map +1 -0
- package/ccw/dist/config/litellm-provider-models.js +172 -0
- package/ccw/dist/config/litellm-provider-models.js.map +1 -0
- package/ccw/dist/config/provider-models.d.ts +25 -51
- package/ccw/dist/config/provider-models.d.ts.map +1 -1
- package/ccw/dist/config/provider-models.js +84 -149
- package/ccw/dist/config/provider-models.js.map +1 -1
- package/ccw/dist/config/storage-paths.d.ts.map +1 -1
- package/ccw/dist/config/storage-paths.js +23 -5
- package/ccw/dist/config/storage-paths.js.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +3 -3
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
- package/ccw/dist/core/dashboard-generator.js +3 -1
- package/ccw/dist/core/dashboard-generator.js.map +1 -1
- package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/claude-routes.js +206 -14
- package/ccw/dist/core/routes/claude-routes.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/commands-routes.d.ts +7 -0
- package/ccw/dist/core/routes/commands-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/commands-routes.js +480 -0
- package/ccw/dist/core/routes/commands-routes.js.map +1 -0
- package/ccw/dist/core/routes/model-routes.d.ts +11 -0
- package/ccw/dist/core/routes/model-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/model-routes.js +112 -0
- package/ccw/dist/core/routes/model-routes.js.map +1 -0
- package/ccw/dist/core/routes/nav-status-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/nav-status-routes.js +84 -1
- package/ccw/dist/core/routes/nav-status-routes.js.map +1 -1
- package/ccw/dist/core/routes/provider-routes.d.ts +11 -0
- package/ccw/dist/core/routes/provider-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/provider-routes.js +67 -0
- package/ccw/dist/core/routes/provider-routes.js.map +1 -0
- package/ccw/dist/core/routes/skills-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/skills-routes.js +219 -7
- package/ccw/dist/core/routes/skills-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +58 -6
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +13 -0
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/mcp-server/index.js +2 -2
- package/ccw/dist/mcp-server/index.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts +48 -11
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +146 -50
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/cli-config-manager.d.ts +1 -13
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
- package/ccw/dist/tools/cli-config-manager.js +3 -27
- package/ccw/dist/tools/cli-config-manager.js.map +1 -1
- package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-core.js +7 -2
- package/ccw/dist/tools/cli-executor-core.js.map +1 -1
- package/ccw/dist/tools/cli-executor-state.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.d.ts +11 -0
- package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
- package/ccw/dist/tools/cli-history-store.js +82 -2
- package/ccw/dist/tools/cli-history-store.js.map +1 -1
- package/ccw/dist/tools/command-registry.d.ts +7 -0
- package/ccw/dist/tools/command-registry.d.ts.map +1 -1
- package/ccw/dist/tools/command-registry.js +14 -1
- package/ccw/dist/tools/command-registry.js.map +1 -1
- package/ccw/dist/tools/generate-module-docs.d.ts.map +1 -1
- package/ccw/dist/tools/generate-module-docs.js +11 -7
- package/ccw/dist/tools/generate-module-docs.js.map +1 -1
- package/ccw/dist/tools/litellm-executor.d.ts +1 -0
- package/ccw/dist/tools/litellm-executor.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-executor.js +11 -9
- package/ccw/dist/tools/litellm-executor.js.map +1 -1
- package/ccw/dist/types/skill-types.d.ts +97 -0
- package/ccw/dist/types/skill-types.d.ts.map +1 -0
- package/ccw/dist/types/skill-types.js +6 -0
- package/ccw/dist/types/skill-types.js.map +1 -0
- package/ccw/src/commands/cli.ts +36 -5
- package/ccw/src/commands/issue.ts +81 -26
- package/ccw/src/config/litellm-api-config-manager.ts +5 -3
- package/ccw/src/config/litellm-provider-models.ts +222 -0
- package/ccw/src/config/provider-models.ts +91 -190
- package/ccw/src/config/storage-paths.ts +20 -5
- package/ccw/src/core/auth/csrf-middleware.ts +3 -3
- package/ccw/src/core/dashboard-generator.ts +3 -1
- package/ccw/src/core/routes/claude-routes.ts +233 -15
- package/ccw/src/core/routes/cli-routes.ts +2 -3
- package/ccw/src/core/routes/commands-routes.ts +620 -0
- package/ccw/src/core/routes/nav-status-routes.ts +95 -1
- package/ccw/src/core/routes/provider-routes.ts +78 -0
- package/ccw/src/core/routes/skills-routes.ts +266 -45
- package/ccw/src/core/routes/system-routes.ts +102 -50
- package/ccw/src/core/server.ts +13 -0
- package/ccw/src/mcp-server/index.ts +2 -2
- package/ccw/src/templates/dashboard-css/18-cli-settings.css +35 -0
- package/ccw/src/templates/dashboard-css/37-commands.css +193 -0
- package/ccw/src/templates/dashboard-js/components/navigation.js +4 -0
- package/ccw/src/templates/dashboard-js/i18n.js +116 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +249 -4
- package/ccw/src/templates/dashboard-js/views/commands-manager.js +503 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +7 -7
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +2 -7
- package/ccw/src/templates/dashboard-js/views/skills-manager.js +164 -23
- package/ccw/src/templates/dashboard.html +7 -0
- package/ccw/src/tools/claude-cli-tools.ts +170 -56
- package/ccw/src/tools/cli-config-manager.ts +2 -33
- package/ccw/src/tools/cli-executor-core.ts +8 -2
- package/ccw/src/tools/cli-history-store.ts +92 -2
- package/ccw/src/tools/command-registry.ts +16 -1
- package/ccw/src/tools/generate-module-docs.ts +11 -7
- package/ccw/src/tools/litellm-executor.ts +13 -9
- package/ccw/src/types/skill-types.ts +99 -0
- package/package.json +1 -1
- package/.claude/commands/enhance-prompt.md +0 -93
- package/.claude/commands/memory/code-map-memory.md +0 -687
- package/.claude/commands/memory/docs.md +0 -615
- package/.claude/commands/memory/load-skill-memory.md +0 -182
- package/.claude/commands/memory/skill-memory.md +0 -525
- package/.claude/commands/memory/swagger-docs.md +0 -773
- package/.claude/commands/memory/tech-research-rules.md +0 -310
- package/.claude/commands/memory/workflow-skill-memory.md +0 -517
- package/.claude/commands/task/breakdown.md +0 -208
- package/.claude/commands/task/create.md +0 -152
- package/.claude/commands/task/execute.md +0 -270
- package/.claude/commands/task/replan.md +0 -441
- package/.claude/commands/version.md +0 -254
- package/.claude/commands/workflow/action-plan-verify.md +0 -485
- package/.claude/commands/workflow/brainstorm/api-designer.md +0 -587
- package/.claude/commands/workflow/brainstorm/data-architect.md +0 -220
- package/.claude/commands/workflow/brainstorm/product-manager.md +0 -200
- package/.claude/commands/workflow/brainstorm/product-owner.md +0 -200
- package/.claude/commands/workflow/brainstorm/scrum-master.md +0 -200
- package/.claude/commands/workflow/brainstorm/subject-matter-expert.md +0 -200
- package/.claude/commands/workflow/brainstorm/system-architect.md +0 -389
- package/.claude/commands/workflow/brainstorm/ui-designer.md +0 -221
- package/.claude/commands/workflow/brainstorm/ux-expert.md +0 -221
- package/.claude/commands/workflow/debug.md +0 -331
- package/.claude/commands/workflow/develop-with-file.md +0 -1044
- package/.claude/skills/ccw-loop/README.md +0 -303
- package/.claude/skills/skill-generator/templates/script-bash.md +0 -277
- package/.claude/skills/skill-generator/templates/script-python.md +0 -198
- package/.codex/prompts/debug.md +0 -318
- package/ccw/src/core/routes/mcp-routes.ts.backup +0 -549
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
# CCW Loop Skill
|
|
2
|
-
|
|
3
|
-
无状态迭代开发循环工作流,支持开发 (Develop)、调试 (Debug)、验证 (Validate) 三个阶段,每个阶段都有独立的文件记录进展。
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
CCW Loop 是一个自主模式 (Autonomous) 的 Skill,通过文件驱动的无状态循环,帮助开发者系统化地完成开发任务。
|
|
8
|
-
|
|
9
|
-
### 核心特性
|
|
10
|
-
|
|
11
|
-
1. **无状态循环**: 每次执行从文件读取状态,不依赖内存
|
|
12
|
-
2. **文件驱动**: 所有进度记录在 Markdown 文件中,可审计、可回顾
|
|
13
|
-
3. **Gemini 辅助**: 关键决策点使用 CLI 工具进行深度分析
|
|
14
|
-
4. **可恢复**: 任何时候中断后可继续
|
|
15
|
-
5. **双模式**: 支持交互式和自动循环
|
|
16
|
-
|
|
17
|
-
### 三大阶段
|
|
18
|
-
|
|
19
|
-
- **Develop**: 任务分解 → 代码实现 → 进度记录
|
|
20
|
-
- **Debug**: 假设生成 → 证据收集 → 根因分析 → 修复验证
|
|
21
|
-
- **Validate**: 测试执行 → 覆盖率检查 → 质量评估
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
已包含在 `.claude/skills/ccw-loop/`,无需额外安装。
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
### 基本用法
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# 启动新循环
|
|
33
|
-
/ccw-loop "实现用户认证功能"
|
|
34
|
-
|
|
35
|
-
# 继续现有循环
|
|
36
|
-
/ccw-loop --resume LOOP-auth-2026-01-22
|
|
37
|
-
|
|
38
|
-
# 自动循环模式
|
|
39
|
-
/ccw-loop --auto "修复登录bug并添加测试"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 交互式流程
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
1. 启动: /ccw-loop "任务描述"
|
|
46
|
-
2. 初始化: 自动分析任务并生成子任务列表
|
|
47
|
-
3. 显示菜单:
|
|
48
|
-
- 📝 继续开发 (Develop)
|
|
49
|
-
- 🔍 开始调试 (Debug)
|
|
50
|
-
- ✅ 运行验证 (Validate)
|
|
51
|
-
- 📊 查看详情 (Status)
|
|
52
|
-
- 🏁 完成循环 (Complete)
|
|
53
|
-
- 🚪 退出 (Exit)
|
|
54
|
-
4. 执行选择的动作
|
|
55
|
-
5. 重复步骤 3-4 直到完成
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 自动循环流程
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
Develop (所有任务) → Debug (如有需要) → Validate → 完成
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Directory Structure
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
.workflow/.loop/{session-id}/
|
|
68
|
-
├── meta.json # 会话元数据 (不可修改)
|
|
69
|
-
├── state.json # 当前状态 (每次更新)
|
|
70
|
-
├── summary.md # 完成报告 (结束时生成)
|
|
71
|
-
├── develop/
|
|
72
|
-
│ ├── progress.md # 开发进度时间线
|
|
73
|
-
│ ├── tasks.json # 任务列表
|
|
74
|
-
│ └── changes.log # 代码变更日志 (NDJSON)
|
|
75
|
-
├── debug/
|
|
76
|
-
│ ├── understanding.md # 理解演变文档
|
|
77
|
-
│ ├── hypotheses.json # 假设历史
|
|
78
|
-
│ └── debug.log # 调试日志 (NDJSON)
|
|
79
|
-
└── validate/
|
|
80
|
-
├── validation.md # 验证报告
|
|
81
|
-
├── test-results.json # 测试结果
|
|
82
|
-
└── coverage.json # 覆盖率数据
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Action Reference
|
|
86
|
-
|
|
87
|
-
| Action | 描述 | 触发条件 |
|
|
88
|
-
|--------|------|----------|
|
|
89
|
-
| action-init | 初始化会话 | 首次启动 |
|
|
90
|
-
| action-menu | 显示操作菜单 | 交互模式下每次循环 |
|
|
91
|
-
| action-develop-with-file | 执行开发任务 | 有待处理任务 |
|
|
92
|
-
| action-debug-with-file | 假设驱动调试 | 需要调试 |
|
|
93
|
-
| action-validate-with-file | 运行测试验证 | 需要验证 |
|
|
94
|
-
| action-complete | 完成并生成报告 | 所有任务完成 |
|
|
95
|
-
|
|
96
|
-
详细说明见 [specs/action-catalog.md](specs/action-catalog.md)
|
|
97
|
-
|
|
98
|
-
## CLI Integration
|
|
99
|
-
|
|
100
|
-
CCW Loop 在关键决策点集成 CLI 工具:
|
|
101
|
-
|
|
102
|
-
### 任务分解 (action-init)
|
|
103
|
-
```bash
|
|
104
|
-
ccw cli -p "PURPOSE: 分解开发任务..."
|
|
105
|
-
--tool gemini
|
|
106
|
-
--mode analysis
|
|
107
|
-
--rule planning-breakdown-task-steps
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### 代码实现 (action-develop)
|
|
111
|
-
```bash
|
|
112
|
-
ccw cli -p "PURPOSE: 实现功能代码..."
|
|
113
|
-
--tool gemini
|
|
114
|
-
--mode write
|
|
115
|
-
--rule development-implement-feature
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### 假设生成 (action-debug - 探索)
|
|
119
|
-
```bash
|
|
120
|
-
ccw cli -p "PURPOSE: Generate debugging hypotheses..."
|
|
121
|
-
--tool gemini
|
|
122
|
-
--mode analysis
|
|
123
|
-
--rule analysis-diagnose-bug-root-cause
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 证据分析 (action-debug - 分析)
|
|
127
|
-
```bash
|
|
128
|
-
ccw cli -p "PURPOSE: Analyze debug log evidence..."
|
|
129
|
-
--tool gemini
|
|
130
|
-
--mode analysis
|
|
131
|
-
--rule analysis-diagnose-bug-root-cause
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### 质量评估 (action-validate)
|
|
135
|
-
```bash
|
|
136
|
-
ccw cli -p "PURPOSE: Analyze test results and coverage..."
|
|
137
|
-
--tool gemini
|
|
138
|
-
--mode analysis
|
|
139
|
-
--rule analysis-review-code-quality
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## State Management
|
|
143
|
-
|
|
144
|
-
### State Schema
|
|
145
|
-
|
|
146
|
-
参见 [phases/state-schema.md](phases/state-schema.md)
|
|
147
|
-
|
|
148
|
-
### State Transitions
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
pending → running → completed
|
|
152
|
-
↓
|
|
153
|
-
user_exit
|
|
154
|
-
↓
|
|
155
|
-
failed
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### State Recovery
|
|
159
|
-
|
|
160
|
-
如果 `state.json` 损坏,可从其他文件重建:
|
|
161
|
-
- develop/tasks.json → develop.*
|
|
162
|
-
- debug/hypotheses.json → debug.*
|
|
163
|
-
- validate/test-results.json → validate.*
|
|
164
|
-
|
|
165
|
-
## Examples
|
|
166
|
-
|
|
167
|
-
### Example 1: 功能开发
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
# 1. 启动循环
|
|
171
|
-
/ccw-loop "Add user profile page"
|
|
172
|
-
|
|
173
|
-
# 2. 系统初始化,生成任务:
|
|
174
|
-
# - task-001: Create profile component
|
|
175
|
-
# - task-002: Add API endpoints
|
|
176
|
-
# - task-003: Implement tests
|
|
177
|
-
|
|
178
|
-
# 3. 选择 "继续开发"
|
|
179
|
-
# → 执行 task-001 (Gemini 辅助实现)
|
|
180
|
-
# → 更新 progress.md
|
|
181
|
-
|
|
182
|
-
# 4. 重复开发直到所有任务完成
|
|
183
|
-
|
|
184
|
-
# 5. 选择 "运行验证"
|
|
185
|
-
# → 运行测试
|
|
186
|
-
# → 检查覆盖率
|
|
187
|
-
# → 生成 validation.md
|
|
188
|
-
|
|
189
|
-
# 6. 选择 "完成循环"
|
|
190
|
-
# → 生成 summary.md
|
|
191
|
-
# → 询问是否扩展为 Issue
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### Example 2: Bug 修复
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
# 1. 启动循环
|
|
198
|
-
/ccw-loop "Fix login timeout issue"
|
|
199
|
-
|
|
200
|
-
# 2. 选择 "开始调试"
|
|
201
|
-
# → 输入 bug 描述: "Login times out after 30s"
|
|
202
|
-
# → Gemini 生成假设 (H1, H2, H3)
|
|
203
|
-
# → 添加 NDJSON 日志
|
|
204
|
-
# → 提示复现 bug
|
|
205
|
-
|
|
206
|
-
# 3. 复现 bug (在应用中操作)
|
|
207
|
-
|
|
208
|
-
# 4. 再次选择 "开始调试"
|
|
209
|
-
# → 解析 debug.log
|
|
210
|
-
# → Gemini 分析证据
|
|
211
|
-
# → H2 确认为根因
|
|
212
|
-
# → 生成修复代码
|
|
213
|
-
# → 更新 understanding.md
|
|
214
|
-
|
|
215
|
-
# 5. 选择 "运行验证"
|
|
216
|
-
# → 测试通过
|
|
217
|
-
|
|
218
|
-
# 6. 完成
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
## Templates
|
|
222
|
-
|
|
223
|
-
- [progress-template.md](templates/progress-template.md): 开发进度文档模板
|
|
224
|
-
- [understanding-template.md](templates/understanding-template.md): 调试理解文档模板
|
|
225
|
-
- [validation-template.md](templates/validation-template.md): 验证报告模板
|
|
226
|
-
|
|
227
|
-
## Specifications
|
|
228
|
-
|
|
229
|
-
- [loop-requirements.md](specs/loop-requirements.md): 循环需求规范
|
|
230
|
-
- [action-catalog.md](specs/action-catalog.md): 动作目录
|
|
231
|
-
|
|
232
|
-
## Integration
|
|
233
|
-
|
|
234
|
-
### Dashboard Integration
|
|
235
|
-
|
|
236
|
-
CCW Loop 与 Dashboard Loop Monitor 集成:
|
|
237
|
-
- Dashboard 创建 Loop → 触发此 Skill
|
|
238
|
-
- state.json → Dashboard 实时显示
|
|
239
|
-
- 任务列表双向同步
|
|
240
|
-
- 控制按钮映射到 actions
|
|
241
|
-
|
|
242
|
-
### Issue System Integration
|
|
243
|
-
|
|
244
|
-
完成后可扩展为 Issue:
|
|
245
|
-
- 维度: test, enhance, refactor, doc
|
|
246
|
-
- 自动调用 `/issue:new`
|
|
247
|
-
- 上下文自动填充
|
|
248
|
-
|
|
249
|
-
## Error Handling
|
|
250
|
-
|
|
251
|
-
| 情况 | 处理 |
|
|
252
|
-
|------|------|
|
|
253
|
-
| Session 不存在 | 创建新会话 |
|
|
254
|
-
| state.json 损坏 | 从文件重建 |
|
|
255
|
-
| CLI 工具失败 | 回退到手动模式 |
|
|
256
|
-
| 测试失败 | 循环回到 develop/debug |
|
|
257
|
-
| >10 迭代 | 警告用户,建议拆分 |
|
|
258
|
-
|
|
259
|
-
## Limitations
|
|
260
|
-
|
|
261
|
-
1. **单会话限制**: 同一时间只能有一个活跃会话
|
|
262
|
-
2. **迭代限制**: 建议不超过 10 次迭代
|
|
263
|
-
3. **CLI 依赖**: 部分功能依赖 Gemini CLI 可用性
|
|
264
|
-
4. **测试框架**: 需要 package.json 中定义测试脚本
|
|
265
|
-
|
|
266
|
-
## Troubleshooting
|
|
267
|
-
|
|
268
|
-
### Q: 如何查看当前会话状态?
|
|
269
|
-
|
|
270
|
-
A: 在菜单中选择 "查看详情 (Status)"
|
|
271
|
-
|
|
272
|
-
### Q: 如何恢复中断的会话?
|
|
273
|
-
|
|
274
|
-
A: 使用 `--resume` 参数:
|
|
275
|
-
```bash
|
|
276
|
-
/ccw-loop --resume LOOP-xxx-2026-01-22
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Q: 如果 CLI 工具失败怎么办?
|
|
280
|
-
|
|
281
|
-
A: Skill 会自动降级到手动模式,提示用户手动输入
|
|
282
|
-
|
|
283
|
-
### Q: 如何添加自定义 action?
|
|
284
|
-
|
|
285
|
-
A: 参见 [specs/action-catalog.md](specs/action-catalog.md) 的 "Action Extensions" 部分
|
|
286
|
-
|
|
287
|
-
## Contributing
|
|
288
|
-
|
|
289
|
-
添加新功能:
|
|
290
|
-
1. 创建 action 文件在 `phases/actions/`
|
|
291
|
-
2. 更新 orchestrator 决策逻辑
|
|
292
|
-
3. 添加到 action-catalog.md
|
|
293
|
-
4. 更新 action-menu.md
|
|
294
|
-
|
|
295
|
-
## License
|
|
296
|
-
|
|
297
|
-
MIT
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
**Version**: 1.0.0
|
|
302
|
-
**Last Updated**: 2026-01-22
|
|
303
|
-
**Author**: CCW Team
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
# Bash Script Template
|
|
2
|
-
|
|
3
|
-
Bash 脚本模板,用于生成技能中的确定性脚本。
|
|
4
|
-
|
|
5
|
-
## 模板代码
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
#!/bin/bash
|
|
9
|
-
# {{script_description}}
|
|
10
|
-
|
|
11
|
-
set -euo pipefail
|
|
12
|
-
|
|
13
|
-
# ============================================================
|
|
14
|
-
# 参数解析
|
|
15
|
-
# ============================================================
|
|
16
|
-
|
|
17
|
-
INPUT_PATH=""
|
|
18
|
-
OUTPUT_DIR="" # 由调用方指定,不设默认值
|
|
19
|
-
|
|
20
|
-
show_help() {
|
|
21
|
-
echo "用法: $0 --input-path <path> --output-dir <dir>"
|
|
22
|
-
echo ""
|
|
23
|
-
echo "参数:"
|
|
24
|
-
echo " --input-path 输入文件路径 (必需)"
|
|
25
|
-
echo " --output-dir 输出目录 (必需,由调用方指定)"
|
|
26
|
-
echo " --help 显示帮助信息"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
while [[ "$#" -gt 0 ]]; do
|
|
30
|
-
case $1 in
|
|
31
|
-
--input-path)
|
|
32
|
-
INPUT_PATH="$2"
|
|
33
|
-
shift
|
|
34
|
-
;;
|
|
35
|
-
--output-dir)
|
|
36
|
-
OUTPUT_DIR="$2"
|
|
37
|
-
shift
|
|
38
|
-
;;
|
|
39
|
-
--help)
|
|
40
|
-
show_help
|
|
41
|
-
exit 0
|
|
42
|
-
;;
|
|
43
|
-
*)
|
|
44
|
-
echo "错误: 未知参数 $1" >&2
|
|
45
|
-
show_help >&2
|
|
46
|
-
exit 1
|
|
47
|
-
;;
|
|
48
|
-
esac
|
|
49
|
-
shift
|
|
50
|
-
done
|
|
51
|
-
|
|
52
|
-
# ============================================================
|
|
53
|
-
# 参数验证
|
|
54
|
-
# ============================================================
|
|
55
|
-
|
|
56
|
-
if [[ -z "$INPUT_PATH" ]]; then
|
|
57
|
-
echo "错误: --input-path 是必需参数" >&2
|
|
58
|
-
exit 1
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
if [[ -z "$OUTPUT_DIR" ]]; then
|
|
62
|
-
echo "错误: --output-dir 是必需参数" >&2
|
|
63
|
-
exit 1
|
|
64
|
-
fi
|
|
65
|
-
|
|
66
|
-
if [[ ! -f "$INPUT_PATH" ]]; then
|
|
67
|
-
echo "错误: 输入文件不存在: $INPUT_PATH" >&2
|
|
68
|
-
exit 1
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
# 检查 jq 是否可用(用于 JSON 输出)
|
|
72
|
-
if ! command -v jq &> /dev/null; then
|
|
73
|
-
echo "错误: 需要安装 jq" >&2
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
mkdir -p "$OUTPUT_DIR"
|
|
78
|
-
|
|
79
|
-
# ============================================================
|
|
80
|
-
# 核心逻辑
|
|
81
|
-
# ============================================================
|
|
82
|
-
|
|
83
|
-
OUTPUT_FILE="$OUTPUT_DIR/result.txt"
|
|
84
|
-
ITEMS_COUNT=0
|
|
85
|
-
|
|
86
|
-
# TODO: 实现处理逻辑
|
|
87
|
-
# 示例:处理输入文件
|
|
88
|
-
while IFS= read -r line; do
|
|
89
|
-
echo "$line" >> "$OUTPUT_FILE"
|
|
90
|
-
((ITEMS_COUNT++))
|
|
91
|
-
done < "$INPUT_PATH"
|
|
92
|
-
|
|
93
|
-
# ============================================================
|
|
94
|
-
# 输出 JSON 结果(使用 jq 构建,避免特殊字符问题)
|
|
95
|
-
# ============================================================
|
|
96
|
-
|
|
97
|
-
jq -n \
|
|
98
|
-
--arg output_file "$OUTPUT_FILE" \
|
|
99
|
-
--argjson items_processed "$ITEMS_COUNT" \
|
|
100
|
-
'{output_file: $output_file, items_processed: $items_processed, status: "success"}'
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## 变量说明
|
|
104
|
-
|
|
105
|
-
| 变量 | 说明 |
|
|
106
|
-
|------|------|
|
|
107
|
-
| `{{script_description}}` | 脚本功能描述 |
|
|
108
|
-
|
|
109
|
-
## 使用规范
|
|
110
|
-
|
|
111
|
-
### 脚本头部
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
#!/bin/bash
|
|
115
|
-
set -euo pipefail # 严格模式:出错退出、未定义变量报错、管道错误传递
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### 参数解析模式
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
while [[ "$#" -gt 0 ]]; do
|
|
122
|
-
case $1 in
|
|
123
|
-
--param-name)
|
|
124
|
-
PARAM_VAR="$2"
|
|
125
|
-
shift
|
|
126
|
-
;;
|
|
127
|
-
--flag)
|
|
128
|
-
FLAG_VAR=true
|
|
129
|
-
;;
|
|
130
|
-
*)
|
|
131
|
-
echo "Unknown: $1" >&2
|
|
132
|
-
exit 1
|
|
133
|
-
;;
|
|
134
|
-
esac
|
|
135
|
-
shift
|
|
136
|
-
done
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### 输出格式
|
|
140
|
-
|
|
141
|
-
- 最后一行打印单行 JSON
|
|
142
|
-
- **强烈推荐使用 `jq`**:自动处理转义和类型
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# 推荐:使用 jq 构建(安全、可靠)
|
|
146
|
-
jq -n \
|
|
147
|
-
--arg file "$FILE" \
|
|
148
|
-
--argjson count "$COUNT" \
|
|
149
|
-
'{output_file: $file, items_processed: $count}'
|
|
150
|
-
|
|
151
|
-
# 备选:简单场景手动拼接(注意特殊字符转义)
|
|
152
|
-
echo "{\"file\": \"$FILE\", \"count\": $COUNT}"
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
**jq 参数类型**:
|
|
156
|
-
- `--arg name value`:字符串类型
|
|
157
|
-
- `--argjson name value`:数字/布尔/null 类型
|
|
158
|
-
|
|
159
|
-
### 错误处理
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
# 验证错误
|
|
163
|
-
if [[ -z "$PARAM" ]]; then
|
|
164
|
-
echo "错误: 参数不能为空" >&2
|
|
165
|
-
exit 1
|
|
166
|
-
fi
|
|
167
|
-
|
|
168
|
-
# 命令错误
|
|
169
|
-
if ! command -v jq &> /dev/null; then
|
|
170
|
-
echo "错误: 需要安装 jq" >&2
|
|
171
|
-
exit 1
|
|
172
|
-
fi
|
|
173
|
-
|
|
174
|
-
# 运行时错误
|
|
175
|
-
if ! some_command; then
|
|
176
|
-
echo "错误: 命令执行失败" >&2
|
|
177
|
-
exit 1
|
|
178
|
-
fi
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## 常用模式
|
|
182
|
-
|
|
183
|
-
### 文件遍历
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
for file in "$INPUT_DIR"/*.json; do
|
|
187
|
-
[[ -f "$file" ]] || continue
|
|
188
|
-
echo "处理: $file"
|
|
189
|
-
# 处理逻辑...
|
|
190
|
-
done
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### 临时文件
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
TEMP_FILE=$(mktemp)
|
|
197
|
-
trap "rm -f $TEMP_FILE" EXIT
|
|
198
|
-
|
|
199
|
-
echo "data" > "$TEMP_FILE"
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### 调用其他工具
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
# 检查工具存在
|
|
206
|
-
require_command() {
|
|
207
|
-
if ! command -v "$1" &> /dev/null; then
|
|
208
|
-
echo "错误: 需要 $1" >&2
|
|
209
|
-
exit 1
|
|
210
|
-
fi
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
require_command jq
|
|
214
|
-
require_command curl
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### JSON 处理(使用 jq)
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
# 读取 JSON 字段
|
|
221
|
-
VALUE=$(jq -r '.field' "$INPUT_PATH")
|
|
222
|
-
|
|
223
|
-
# 修改 JSON
|
|
224
|
-
jq '.field = "new_value"' "$INPUT_PATH" > "$OUTPUT_FILE"
|
|
225
|
-
|
|
226
|
-
# 合并 JSON 文件
|
|
227
|
-
jq -s 'add' file1.json file2.json > merged.json
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## 生成函数
|
|
231
|
-
|
|
232
|
-
```javascript
|
|
233
|
-
function generateBashScript(scriptConfig) {
|
|
234
|
-
return `#!/bin/bash
|
|
235
|
-
# ${scriptConfig.description}
|
|
236
|
-
|
|
237
|
-
set -euo pipefail
|
|
238
|
-
|
|
239
|
-
# 参数定义
|
|
240
|
-
${scriptConfig.inputs.map(i =>
|
|
241
|
-
`${i.name.toUpperCase().replace(/-/g, '_')}="${i.default || ''}"`
|
|
242
|
-
).join('\n')}
|
|
243
|
-
|
|
244
|
-
# 参数解析
|
|
245
|
-
while [[ "$#" -gt 0 ]]; do
|
|
246
|
-
case $1 in
|
|
247
|
-
${scriptConfig.inputs.map(i =>
|
|
248
|
-
` --${i.name})
|
|
249
|
-
${i.name.toUpperCase().replace(/-/g, '_')}="$2"
|
|
250
|
-
shift
|
|
251
|
-
;;`
|
|
252
|
-
).join('\n')}
|
|
253
|
-
*)
|
|
254
|
-
echo "未知参数: $1" >&2
|
|
255
|
-
exit 1
|
|
256
|
-
;;
|
|
257
|
-
esac
|
|
258
|
-
shift
|
|
259
|
-
done
|
|
260
|
-
|
|
261
|
-
# 参数验证
|
|
262
|
-
${scriptConfig.inputs.filter(i => i.required).map(i =>
|
|
263
|
-
`if [[ -z "$${i.name.toUpperCase().replace(/-/g, '_')}" ]]; then
|
|
264
|
-
echo "错误: --${i.name} 是必需参数" >&2
|
|
265
|
-
exit 1
|
|
266
|
-
fi`
|
|
267
|
-
).join('\n\n')}
|
|
268
|
-
|
|
269
|
-
# TODO: 实现处理逻辑
|
|
270
|
-
|
|
271
|
-
# 输出结果
|
|
272
|
-
echo "{${scriptConfig.outputs.map(o =>
|
|
273
|
-
`\\"${o.name}\\": \\"\\$${o.name.toUpperCase().replace(/-/g, '_')}\\"`
|
|
274
|
-
).join(', ')}}"
|
|
275
|
-
`;
|
|
276
|
-
}
|
|
277
|
-
```
|