ccg-workflow 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +434 -0
- package/bin/ccg.mjs +2 -0
- package/bin/codeagent-wrapper-darwin-amd64 +0 -0
- package/bin/codeagent-wrapper-darwin-arm64 +0 -0
- package/bin/codeagent-wrapper-linux-amd64 +0 -0
- package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +97 -0
- package/dist/index.d.mts +134 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.mjs +10 -0
- package/dist/shared/ccg-workflow.D_RkPyZ0.mjs +1117 -0
- package/package.json +63 -0
- package/prompts/claude/analyzer.md +59 -0
- package/prompts/claude/architect.md +54 -0
- package/prompts/claude/debugger.md +71 -0
- package/prompts/claude/optimizer.md +73 -0
- package/prompts/claude/reviewer.md +63 -0
- package/prompts/claude/tester.md +69 -0
- package/prompts/codex/analyzer.md +50 -0
- package/prompts/codex/architect.md +46 -0
- package/prompts/codex/debugger.md +66 -0
- package/prompts/codex/optimizer.md +74 -0
- package/prompts/codex/reviewer.md +66 -0
- package/prompts/codex/tester.md +55 -0
- package/prompts/gemini/analyzer.md +53 -0
- package/prompts/gemini/debugger.md +70 -0
- package/prompts/gemini/frontend.md +56 -0
- package/prompts/gemini/optimizer.md +77 -0
- package/prompts/gemini/reviewer.md +73 -0
- package/prompts/gemini/tester.md +61 -0
- package/templates/commands/_config.md +85 -0
- package/templates/commands/analyze.md +73 -0
- package/templates/commands/backend.md +81 -0
- package/templates/commands/bugfix.md +55 -0
- package/templates/commands/clean-branches.md +102 -0
- package/templates/commands/code.md +169 -0
- package/templates/commands/commit.md +158 -0
- package/templates/commands/debug.md +104 -0
- package/templates/commands/dev.md +153 -0
- package/templates/commands/enhance.md +49 -0
- package/templates/commands/frontend.md +80 -0
- package/templates/commands/init.md +53 -0
- package/templates/commands/optimize.md +69 -0
- package/templates/commands/review.md +85 -0
- package/templates/commands/rollback.md +90 -0
- package/templates/commands/test.md +53 -0
- package/templates/commands/think.md +73 -0
- package/templates/commands/worktree.md +276 -0
- package/templates/prompts/claude/analyzer.md +59 -0
- package/templates/prompts/claude/architect.md +54 -0
- package/templates/prompts/claude/debugger.md +71 -0
- package/templates/prompts/claude/optimizer.md +73 -0
- package/templates/prompts/claude/reviewer.md +63 -0
- package/templates/prompts/claude/tester.md +69 -0
- package/templates/prompts/codex/analyzer.md +50 -0
- package/templates/prompts/codex/architect.md +46 -0
- package/templates/prompts/codex/debugger.md +66 -0
- package/templates/prompts/codex/optimizer.md +74 -0
- package/templates/prompts/codex/reviewer.md +66 -0
- package/templates/prompts/codex/tester.md +55 -0
- package/templates/prompts/gemini/analyzer.md +53 -0
- package/templates/prompts/gemini/debugger.md +70 -0
- package/templates/prompts/gemini/frontend.md +56 -0
- package/templates/prompts/gemini/optimizer.md +77 -0
- package/templates/prompts/gemini/reviewer.md +73 -0
- package/templates/prompts/gemini/tester.md +61 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 后端/逻辑/算法任务,自动路由到配置的后端模型进行原型生成和审计
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 调用语法见 `_config.md`
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
`/backend <LOGIC_TASK_DESCRIPTION>`
|
|
9
|
+
|
|
10
|
+
## 上下文
|
|
11
|
+
- Backend/logic task to implement: $ARGUMENTS
|
|
12
|
+
- This command routes to your configured backend models.
|
|
13
|
+
- Default authority for algorithms, APIs, and business logic.
|
|
14
|
+
|
|
15
|
+
## 配置
|
|
16
|
+
**首先读取 `~/.ccg/config.toml` 获取模型路由配置**:
|
|
17
|
+
```toml
|
|
18
|
+
[routing.backend]
|
|
19
|
+
models = ["codex", "gemini"] # 用户配置的后端模型列表
|
|
20
|
+
primary = "codex" # 主模型
|
|
21
|
+
strategy = "parallel" # 路由策略: parallel | fallback | round-robin
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 你的角色
|
|
25
|
+
You are the **Backend Orchestrator** specializing in server-side logic. You coordinate:
|
|
26
|
+
1. **ace-tool** – for retrieving existing backend code and architecture
|
|
27
|
+
2. **Configured Backend Models** – for generating logic, algorithms, and API implementations
|
|
28
|
+
3. **Claude (Self)** – for refactoring prototypes into production code
|
|
29
|
+
|
|
30
|
+
## 流程
|
|
31
|
+
|
|
32
|
+
### Step 1: 读取配置
|
|
33
|
+
1. Read `~/.ccg/config.toml` to get backend model configuration
|
|
34
|
+
2. Identify which models to use based on `routing.backend.models`
|
|
35
|
+
3. If config doesn't exist, default to `codex`
|
|
36
|
+
|
|
37
|
+
### Step 2: 上下文检索
|
|
38
|
+
1. Call `mcp__ace-tool__search_context` to understand existing architecture
|
|
39
|
+
2. Identify API patterns, data models, services, and dependencies
|
|
40
|
+
|
|
41
|
+
### Step 3: 模型原型生成
|
|
42
|
+
|
|
43
|
+
**根据配置的 strategy 执行**:
|
|
44
|
+
- **parallel**: 同时调用所有配置的后端模型,综合结果
|
|
45
|
+
- **fallback**: 调用主模型,失败则调用次模型
|
|
46
|
+
- **round-robin**: 轮询调用
|
|
47
|
+
|
|
48
|
+
遍历 `routing.backend.models`,为每个模型发送调用:
|
|
49
|
+
- **Codex**: 使用 `architect` 角色
|
|
50
|
+
- **Gemini**: 使用 `analyzer` 角色(Gemini 无专门后端角色)
|
|
51
|
+
- 输出: `Unified Diff Patch ONLY`
|
|
52
|
+
|
|
53
|
+
**如果 strategy = parallel 且有多个模型**:
|
|
54
|
+
使用 `run_in_background: true` 并行调用所有模型,然后用 `TaskOutput` 收集结果。
|
|
55
|
+
|
|
56
|
+
### Step 4: 重构与实施
|
|
57
|
+
1. Review model prototype(s) as "dirty prototype"
|
|
58
|
+
2. If multiple models, cross-validate and select best patterns
|
|
59
|
+
3. Refactor into clean, maintainable code
|
|
60
|
+
4. Ensure proper error handling and security
|
|
61
|
+
|
|
62
|
+
### Step 5: 审计
|
|
63
|
+
|
|
64
|
+
Call configured backend model(s) to review the final implementation:
|
|
65
|
+
- 使用 `reviewer` 角色
|
|
66
|
+
- 审查内容: security, performance, error handling
|
|
67
|
+
- 输出: `Review comments only`
|
|
68
|
+
|
|
69
|
+
## 输出格式
|
|
70
|
+
1. **Configuration** – models and strategy being used
|
|
71
|
+
2. **Architecture Analysis** – existing patterns and dependencies
|
|
72
|
+
3. **Model Prototype(s)** – raw prototypes from configured models
|
|
73
|
+
4. **Refined Implementation** – production-ready backend code
|
|
74
|
+
5. **Audit Feedback** – security and performance review
|
|
75
|
+
|
|
76
|
+
## 注意事项
|
|
77
|
+
- Codex excels at complex logic and debugging
|
|
78
|
+
- Codex uses read-only sandbox by default
|
|
79
|
+
- Read `~/.ccg/config.toml` at start of execution
|
|
80
|
+
- Always request Unified Diff Patch format
|
|
81
|
+
- Use HEREDOC syntax (`<<'EOF'`) to avoid shell escaping issues
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 质量门控修复(双模型交叉验证,90%+ 通过)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 调用语法见 `_config.md`
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
`/bugfix <bug描述>`
|
|
9
|
+
|
|
10
|
+
## 上下文
|
|
11
|
+
- Bug 描述: $ARGUMENTS
|
|
12
|
+
- 使用双模型交叉验证确保修复质量
|
|
13
|
+
- 质量门控:90%+ 评分才能通过,最多 3 轮迭代
|
|
14
|
+
|
|
15
|
+
## 流程
|
|
16
|
+
|
|
17
|
+
### Phase 1: Bug 分析
|
|
18
|
+
1. 调用 `mcp__ace-tool__search_context` 检索相关代码
|
|
19
|
+
2. 分析 bug 类型:前端/后端/全栈
|
|
20
|
+
3. 收集复现步骤、错误日志、预期行为
|
|
21
|
+
|
|
22
|
+
### Phase 2: 双模型诊断
|
|
23
|
+
**并行调用**(`run_in_background: true`):
|
|
24
|
+
- **Codex** + `architect` 角色 → 后端分析
|
|
25
|
+
- **Gemini** + `frontend` 角色 → 前端分析
|
|
26
|
+
|
|
27
|
+
输出: `Unified Diff Patch for the fix`
|
|
28
|
+
|
|
29
|
+
### Phase 3: 修复整合
|
|
30
|
+
1. 收集双模型的修复方案(`TaskOutput`)
|
|
31
|
+
2. 综合分析:识别共同点、合并互补修复、选择最优方案
|
|
32
|
+
3. Claude 重构为生产级代码
|
|
33
|
+
|
|
34
|
+
### Phase 4: 实施修复
|
|
35
|
+
应用修复代码,记录变更内容
|
|
36
|
+
|
|
37
|
+
### Phase 5: 质量门控验证
|
|
38
|
+
**并行调用** Codex + Gemini + `reviewer` 角色验证
|
|
39
|
+
|
|
40
|
+
### Phase 6: 质量门控决策
|
|
41
|
+
```
|
|
42
|
+
综合评分 = (Codex 评分 + Gemini 评分) / 2
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| 综合评分 | 结果 | 动作 |
|
|
46
|
+
|----------|------|------|
|
|
47
|
+
| ≥ 90% | ✅ PASS | 完成修复,可提交 |
|
|
48
|
+
| 70-89% | ⚠️ ITERATE | 返回 Phase 3,携带反馈 |
|
|
49
|
+
| 3轮后 < 90% | ❌ FAIL | 需人工介入 |
|
|
50
|
+
|
|
51
|
+
## 关键原则
|
|
52
|
+
1. **双模型交叉验证** - 避免单一视角的盲区
|
|
53
|
+
2. **量化质量评估** - 使用评分制而非主观判断
|
|
54
|
+
3. **迭代改进** - 每轮携带具体反馈
|
|
55
|
+
4. **止损机制** - 最多 3 轮,防止无限循环
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 安全查找并清理已合并或过期的 Git 分支,支持 dry-run 模式与自定义基准/保护分支
|
|
3
|
+
allowed-tools: Read(**), Exec(git fetch, git config, git branch, git remote, git push, git for-each-ref, git log), Write()
|
|
4
|
+
argument-hint: [--base <branch>] [--stale <days>] [--remote] [--force] [--dry-run] [--yes]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-cleanBranches --dry-run
|
|
7
|
+
# - /git-cleanBranches --base release/v2.1 --stale 90
|
|
8
|
+
# - /git-cleanBranches --remote --yes
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Claude Command: Clean Branches
|
|
12
|
+
|
|
13
|
+
该命令**安全地**识别并清理**已合并**或**长期未更新 (stale)** 的 Git 分支。
|
|
14
|
+
默认以**只读预览 (`--dry-run`)** 模式运行,需明确指令才会执行删除操作。
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# [最安全] 预览将要清理的分支,不执行任何删除
|
|
22
|
+
/git-cleanBranches --dry-run
|
|
23
|
+
|
|
24
|
+
# 清理已合并到 main 且超过 90 天未动的本地分支 (需逐一确认)
|
|
25
|
+
/git-cleanBranches --stale 90
|
|
26
|
+
|
|
27
|
+
# 清理已合并到 release/v2.1 的本地与远程分支 (自动确认)
|
|
28
|
+
/git-cleanBranches --base release/v2.1 --remote --yes
|
|
29
|
+
|
|
30
|
+
# [危险] 强制删除一个未合并的本地分支
|
|
31
|
+
/git-cleanBranches --force outdated-feature
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Options
|
|
35
|
+
|
|
36
|
+
- `--base <branch>`:指定清理的基准分支(默认为仓库的 `main`/`master`)。
|
|
37
|
+
- `--stale <days>`:清理超过指定天数未提交的分支(默认不启用)。
|
|
38
|
+
- `--remote`:同时清理远程已合并/过期的分支。
|
|
39
|
+
- `--dry-run`:**默认行为**。仅列出将要删除的分支,不执行任何操作。
|
|
40
|
+
- `--yes`:跳过逐一确认的步骤,直接删除所有已识别的分支(适合 CI/CD)。
|
|
41
|
+
- `--force`:使用 `-D` 强制删除本地分支(即使未合并)。
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## What This Command Does
|
|
46
|
+
|
|
47
|
+
1. **配置与安全预检**
|
|
48
|
+
- **更新信息**:自动执行 `git fetch --all --prune`,确保分支状态最新。
|
|
49
|
+
- **读取保护分支**:从 Git 配置读取不应被清理的分支列表(见下文“Configuration”)。
|
|
50
|
+
- **确定基准**:使用 `--base` 参数或自动识别的 `main`/`master` 作为比较基准。
|
|
51
|
+
|
|
52
|
+
2. **分析识别(Find)**
|
|
53
|
+
- **已合并分支**:找出已完全合并到 `--base` 的本地(及远程,如加 `--remote`)分支。
|
|
54
|
+
- **过期分支**:如指定 `--stale <days>`,找出最后一次提交在 N 天前的分支。
|
|
55
|
+
- **排除保护分支**:从待清理列表中移除所有已配置的保护分支。
|
|
56
|
+
|
|
57
|
+
3. **报告预览(Report)**
|
|
58
|
+
- 清晰列出“将要删除的已合并分支”与“将要删除的过期分支”。
|
|
59
|
+
- 若无 `--yes` 参数,**命令到此结束**,等待用户确认后再次执行(不带 `--dry-run`)。
|
|
60
|
+
|
|
61
|
+
4. **执行清理(Execute)**
|
|
62
|
+
- **仅在不带 `--dry-run` 且用户确认后**(或带 `--yes`)执行。
|
|
63
|
+
- 逐一删除已识别的分支,除非用户在交互式确认中选择跳过。
|
|
64
|
+
- 本地用 `git branch -d <branch>`;远程用 `git push origin --delete <branch>`。
|
|
65
|
+
- 若指定 `--force`,本地删除会改用 `git branch -D <branch>`。
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Configuration (一次配置,永久生效)
|
|
70
|
+
|
|
71
|
+
为防止误删重要分支(如 `develop`, `release/*`),请在仓库的 Git 配置中添加保护规则。命令会自动读取。
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 保护 develop 分支
|
|
75
|
+
git config --add branch.cleanup.protected develop
|
|
76
|
+
|
|
77
|
+
# 保护所有 release/ 开头的分支 (通配符)
|
|
78
|
+
git config --add branch.cleanup.protected 'release/*'
|
|
79
|
+
|
|
80
|
+
# 查看所有已配置的保护分支
|
|
81
|
+
git config --get-all branch.cleanup.protected
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Best Practices for Embedded Devs
|
|
87
|
+
|
|
88
|
+
- **优先 `--dry-run`**:养成先预览再执行的习惯。
|
|
89
|
+
- **活用 `--base`**:维护长期 `release` 分支时,用它来清理已合并到该 release 的 `feature` 或 `hotfix` 分支。
|
|
90
|
+
- **谨慎 `--force`**:除非你百分百确定某个未合并分支是无用功,否则不要强制删除。
|
|
91
|
+
- **团队协作**:在清理共享的远程分支前,先在团队频道通知一声。
|
|
92
|
+
- **定期运行**:每月或每季度运行一次,保持仓库清爽。
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Why This Version Is Better
|
|
97
|
+
|
|
98
|
+
- ✅ **更安全**:默认只读预览,且有可配置的保护分支列表。
|
|
99
|
+
- ✅ **更灵活**:支持自定义基准分支,完美适配 `release` / `develop` 工作流。
|
|
100
|
+
- ✅ **更兼容**:避免了在不同系统上行为不一的 `date -d` 等命令。
|
|
101
|
+
- ✅ **更直观**:将复杂的 16 步清单,浓缩成一个带安全选项的、可直接执行的命令。
|
|
102
|
+
- ✅ **风格一致**:与 `/commit` 命令共享相似的参数设计与文档结构。
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 三模型代码生成(Codex + Gemini + Claude 并行原型,集各家所长)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 调用语法见 `_config.md`
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
`/code <功能描述>`
|
|
9
|
+
|
|
10
|
+
## 上下文
|
|
11
|
+
- 功能描述: $ARGUMENTS
|
|
12
|
+
- **三模型并行生成原型**,编排者集各家所长
|
|
13
|
+
- 生成的原型经 Claude (编排者) 重构为生产级代码
|
|
14
|
+
|
|
15
|
+
## 工作流程
|
|
16
|
+
|
|
17
|
+
### Phase 1: 需求分析
|
|
18
|
+
|
|
19
|
+
1. 调用 `mcp__ace-tool__search_context` 检索:
|
|
20
|
+
- 相关模块和文件结构
|
|
21
|
+
- 现有代码模式和风格
|
|
22
|
+
- 依赖和接口定义
|
|
23
|
+
2. 分析任务类型:
|
|
24
|
+
- **前端**: UI 组件、样式、用户交互
|
|
25
|
+
- **后端**: API、业务逻辑、数据库操作
|
|
26
|
+
- **全栈**: 同时涉及前后端
|
|
27
|
+
|
|
28
|
+
### Phase 2: 三模型并行原型生成
|
|
29
|
+
|
|
30
|
+
**同时调用三个模型**(`run_in_background: true`):
|
|
31
|
+
|
|
32
|
+
1. **Codex** + `architect` 角色 → 后端架构视角
|
|
33
|
+
2. **Gemini** + `frontend` 角色 → 前端 UI 视角
|
|
34
|
+
3. **Claude** + `architect` 角色 → 全栈整合视角
|
|
35
|
+
|
|
36
|
+
输出: `Unified Diff Patch ONLY`
|
|
37
|
+
|
|
38
|
+
**三模型差异化价值**:
|
|
39
|
+
| 模型 | 专注点 | 独特贡献 |
|
|
40
|
+
|------|--------|----------|
|
|
41
|
+
| Codex | 后端逻辑、算法、API | 深度后端专业知识 |
|
|
42
|
+
| Gemini | 前端 UI、样式、交互 | 视觉设计和用户体验 |
|
|
43
|
+
| Claude | 全栈整合、契约设计 | 桥接前后端视角 |
|
|
44
|
+
|
|
45
|
+
定义清晰的接口契约:
|
|
46
|
+
```
|
|
47
|
+
API Contract:
|
|
48
|
+
- Endpoint: POST /api/xxx
|
|
49
|
+
- Request: { field1: string, field2: number }
|
|
50
|
+
- Response: { data: T, error?: string }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Phase 3: 原型整合
|
|
54
|
+
|
|
55
|
+
1. 收集三个模型输出(使用 `TaskOutput`)
|
|
56
|
+
2. 将 Unified Diff 视为"脏原型"
|
|
57
|
+
3. **交叉验证,集各家所长**:
|
|
58
|
+
- Codex 的后端逻辑和 API 设计
|
|
59
|
+
- Gemini 的前端组件和 UI 交互
|
|
60
|
+
- Claude 的整合视角和契约一致性
|
|
61
|
+
4. Claude (编排者) 重构:
|
|
62
|
+
- 统一代码风格
|
|
63
|
+
- 确保前后端接口一致
|
|
64
|
+
- 优化实现细节
|
|
65
|
+
- 移除冗余代码
|
|
66
|
+
|
|
67
|
+
### Phase 4: 代码实施
|
|
68
|
+
|
|
69
|
+
1. 应用重构后的代码
|
|
70
|
+
2. 确保不破坏现有功能
|
|
71
|
+
3. 验证编译/类型检查通过
|
|
72
|
+
|
|
73
|
+
### Phase 5: 三模型审查
|
|
74
|
+
|
|
75
|
+
**并行启动审查**(`run_in_background: true`):
|
|
76
|
+
- **Codex** + `reviewer` 角色 → 安全性、性能、错误处理
|
|
77
|
+
- **Gemini** + `reviewer` 角色 → 可访问性、响应式、设计一致性
|
|
78
|
+
- **Claude** + `reviewer` 角色 → 集成正确性、契约一致性
|
|
79
|
+
- 输出: `Review comments with specific line references`
|
|
80
|
+
|
|
81
|
+
### Phase 6: 修正与交付
|
|
82
|
+
|
|
83
|
+
1. 综合三模型审查意见
|
|
84
|
+
2. 修正发现的问题
|
|
85
|
+
3. 最终交付
|
|
86
|
+
|
|
87
|
+
## 输出格式
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
## 🚀 Code: <功能描述>
|
|
91
|
+
|
|
92
|
+
### Phase 1: 需求分析
|
|
93
|
+
- 任务类型: [前端/后端/全栈]
|
|
94
|
+
- 相关文件: <文件列表>
|
|
95
|
+
- 现有模式: <识别的模式>
|
|
96
|
+
|
|
97
|
+
### Phase 2: 代码生成
|
|
98
|
+
#### Codex 原型 (后端视角)
|
|
99
|
+
<Unified Diff 摘要>
|
|
100
|
+
|
|
101
|
+
#### Gemini 原型 (前端视角)
|
|
102
|
+
<Unified Diff 摘要>
|
|
103
|
+
|
|
104
|
+
#### Claude 原型 (全栈视角)
|
|
105
|
+
<Unified Diff 摘要>
|
|
106
|
+
|
|
107
|
+
### Phase 3: 整合重构
|
|
108
|
+
<重构说明>
|
|
109
|
+
|
|
110
|
+
### Phase 4: 实施
|
|
111
|
+
<变更文件列表>
|
|
112
|
+
|
|
113
|
+
### Phase 5: 审查
|
|
114
|
+
#### Codex 审查 (安全/性能)
|
|
115
|
+
- <审查意见 1>
|
|
116
|
+
- <审查意见 2>
|
|
117
|
+
|
|
118
|
+
#### Gemini 审查 (可访问性/设计)
|
|
119
|
+
- <审查意见 1>
|
|
120
|
+
- <审查意见 2>
|
|
121
|
+
|
|
122
|
+
#### Claude 审查 (集成/契约)
|
|
123
|
+
- <审查意见 1>
|
|
124
|
+
- <审查意见 2>
|
|
125
|
+
|
|
126
|
+
### Phase 6: 交付
|
|
127
|
+
✅ 实施完成
|
|
128
|
+
- 新增文件: X
|
|
129
|
+
- 修改文件: Y
|
|
130
|
+
- 代码行数: +N / -M
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 任务类型检测
|
|
134
|
+
|
|
135
|
+
| 关键词 | 类型 | 路由 |
|
|
136
|
+
|--------|------|------|
|
|
137
|
+
| component, UI, style, CSS, React, Vue | 前端 | Gemini |
|
|
138
|
+
| API, endpoint, database, auth, backend | 后端 | Codex |
|
|
139
|
+
| full-stack, 全栈, 页面+接口 | 全栈 | 并行 |
|
|
140
|
+
|
|
141
|
+
## 代码质量标准
|
|
142
|
+
|
|
143
|
+
### 前端代码 (Gemini 专注)
|
|
144
|
+
- [ ] TypeScript 类型完整
|
|
145
|
+
- [ ] 响应式设计
|
|
146
|
+
- [ ] 无障碍属性
|
|
147
|
+
- [ ] 加载/错误状态
|
|
148
|
+
- [ ] 遵循设计系统
|
|
149
|
+
|
|
150
|
+
### 后端代码 (Codex 专注)
|
|
151
|
+
- [ ] 输入验证
|
|
152
|
+
- [ ] 错误处理
|
|
153
|
+
- [ ] 安全检查
|
|
154
|
+
- [ ] 查询优化
|
|
155
|
+
- [ ] API 一致性
|
|
156
|
+
|
|
157
|
+
### 全栈整合 (Claude 专注)
|
|
158
|
+
- [ ] 前后端接口一致
|
|
159
|
+
- [ ] 类型定义共享
|
|
160
|
+
- [ ] 错误码统一
|
|
161
|
+
- [ ] 契约文档完整
|
|
162
|
+
|
|
163
|
+
## 关键原则
|
|
164
|
+
|
|
165
|
+
1. **三模型并行** - 同时获取三个视角的原型
|
|
166
|
+
2. **集各家所长** - 交叉验证,取最优方案
|
|
167
|
+
3. **接口优先** - 先定义 API 契约
|
|
168
|
+
4. **编排者重构** - 原型需要 Claude (编排者) 整合
|
|
169
|
+
5. **三重审查** - 代码必须经过三模型审查
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 仅用 Git 分析改动并自动生成 conventional commit 信息(可选 emoji);必要时建议拆分提交,默认运行本地 Git 钩子(可 --no-verify 跳过)
|
|
3
|
+
allowed-tools: Read(**), Exec(git status, git diff, git add, git restore --staged, git commit, git rev-parse, git config), Write(.git/COMMIT_EDITMSG)
|
|
4
|
+
argument-hint: [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <scope>] [--type <type>]
|
|
5
|
+
# examples:
|
|
6
|
+
# - /git-commit # 分析当前改动,生成提交信息
|
|
7
|
+
# - /git-commit --all # 暂存所有改动并提交
|
|
8
|
+
# - /git-commit --no-verify # 跳过 Git 钩子检查
|
|
9
|
+
# - /git-commit --emoji # 在提交信息中包含 emoji
|
|
10
|
+
# - /git-commit --scope ui --type feat # 指定作用域和类型
|
|
11
|
+
# - /git-commit --amend --signoff # 修补上次提交并签名
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Claude Command: Commit (Git-only)
|
|
15
|
+
|
|
16
|
+
该命令在**不依赖任何包管理器/构建工具**的前提下,仅通过 **Git**:
|
|
17
|
+
|
|
18
|
+
- 读取改动(staged/unstaged)
|
|
19
|
+
- 判断是否需要**拆分为多次提交**
|
|
20
|
+
- 为每个提交生成 **Conventional Commits** 风格的信息(可选 emoji)
|
|
21
|
+
- 按需执行 `git add` 与 `git commit`(默认运行本地 Git 钩子;可 `--no-verify` 跳过)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
/git-commit
|
|
29
|
+
/git-commit --no-verify
|
|
30
|
+
/git-commit --emoji
|
|
31
|
+
/git-commit --all --signoff
|
|
32
|
+
/git-commit --amend
|
|
33
|
+
/git-commit --scope ui --type feat --emoji
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Options
|
|
37
|
+
|
|
38
|
+
- `--no-verify`:跳过本地 Git 钩子(`pre-commit`/`commit-msg` 等)。
|
|
39
|
+
- `--all`:当暂存区为空时,自动 `git add -A` 将所有改动纳入本次提交。
|
|
40
|
+
- `--amend`:在不创建新提交的情况下**修补**上一次提交(保持提交作者与时间,除非本地 Git 配置另有指定)。
|
|
41
|
+
- `--signoff`:附加 `Signed-off-by` 行(遵循 DCO 流程时使用)。
|
|
42
|
+
- `--emoji`:在提交信息中包含 emoji 前缀(省略则使用纯文本)。
|
|
43
|
+
- `--scope <scope>`:指定提交作用域(如 `ui`、`docs`、`api`),写入消息头部。
|
|
44
|
+
- `--type <type>`:强制提交类型(如 `feat`、`fix`、`docs` 等),覆盖自动判断。
|
|
45
|
+
|
|
46
|
+
> 注:如框架不支持交互式确认,可在 front-matter 中开启 `confirm: true` 以避免误操作。
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## What This Command Does
|
|
51
|
+
|
|
52
|
+
1. **仓库/分支校验**
|
|
53
|
+
- 通过 `git rev-parse --is-inside-work-tree` 判断是否位于 Git 仓库。
|
|
54
|
+
- 读取当前分支/HEAD 状态;如处于 rebase/merge 冲突状态,先提示处理冲突后再继续。
|
|
55
|
+
|
|
56
|
+
2. **改动检测**
|
|
57
|
+
- 用 `git status --porcelain` 与 `git diff` 获取已暂存与未暂存的改动。
|
|
58
|
+
- 若已暂存文件为 0:
|
|
59
|
+
- 若传入 `--all` → 执行 `git add -A`。
|
|
60
|
+
- 否则提示你选择:继续仅分析未暂存改动并给出**建议**,或取消命令后手动分组暂存。
|
|
61
|
+
|
|
62
|
+
3. **拆分建议(Split Heuristics)**
|
|
63
|
+
- 按**关注点**、**文件模式**、**改动类型**聚类(示例:源代码 vs 文档、测试;不同目录/包;新增 vs 删除)。
|
|
64
|
+
- 若检测到**多组独立变更**或 diff 规模过大(如 > 300 行 / 跨多个顶级目录),建议拆分提交,并给出每一组的 pathspec(便于后续执行 `git add <paths>`)。
|
|
65
|
+
|
|
66
|
+
4. **提交信息生成(Conventional 规范,可选 Emoji)**
|
|
67
|
+
- 自动推断 `type`(`feat`/`fix`/`docs`/`refactor`/`test`/`chore`/`perf`/`style`/`ci`/`revert` …)与可选 `scope`。
|
|
68
|
+
- 生成消息头:`[<emoji>] <type>(<scope>)?: <subject>`(首行 ≤ 72 字符,祈使语气,仅在使用 `--emoji` 时包含 emoji)。
|
|
69
|
+
- 生成消息体:要点列表(动机、实现要点、影响范围、BREAKING CHANGE 如有)。
|
|
70
|
+
- 根据 Git 历史提交的主要语言选择提交信息语言。优先检查最近提交主题(例如 `git log -n 50 --pretty=%s`)判断中文/英文;若无法判断,则回退到仓库主要语言或英文。
|
|
71
|
+
- 将草稿写入 `.git/COMMIT_EDITMSG`,并用于 `git commit`。
|
|
72
|
+
|
|
73
|
+
5. **执行提交**
|
|
74
|
+
- 单提交场景:`git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSG`
|
|
75
|
+
- 多提交场景(如接受拆分建议):按分组给出 `git add <paths> && git commit ...` 的明确指令;若允许执行则逐一完成。
|
|
76
|
+
|
|
77
|
+
6. **安全回滚**
|
|
78
|
+
- 如误暂存,可用 `git restore --staged <paths>` 撤回暂存(命令会给出指令,不修改文件内容)。
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Best Practices for Commits
|
|
83
|
+
|
|
84
|
+
- **Atomic commits**:一次提交只做一件事,便于回溯与审阅。
|
|
85
|
+
- **先分组再提交**:按目录/模块/功能点拆分。
|
|
86
|
+
- **清晰主题**:首行 ≤ 72 字符,祈使语气(如 “add… / fix…”)。
|
|
87
|
+
- **正文含上下文**:说明动机、方案、影响范围、风险与后续工作。
|
|
88
|
+
- **遵循 Conventional Commits**:`<type>(<scope>): <subject>`。
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Type 与 Emoji 映射(使用 --emoji 时)
|
|
93
|
+
|
|
94
|
+
- ✨ `feat`:新增功能
|
|
95
|
+
- 🐛 `fix`:缺陷修复(含 🔥 删除代码/文件、🚑️ 紧急修复、👽️ 适配外部 API 变更、🔒️ 安全修复、🚨 解决告警、💚 修复 CI)
|
|
96
|
+
- 📝 `docs`:文档与注释
|
|
97
|
+
- 🎨 `style`:风格/格式(不改语义)
|
|
98
|
+
- ♻️ `refactor`:重构(不新增功能、不修缺陷)
|
|
99
|
+
- ⚡️ `perf`:性能优化
|
|
100
|
+
- ✅ `test`:新增/修复测试、快照
|
|
101
|
+
- 🔧 `chore`:构建/工具/杂务(合并分支、更新配置、发布标记、依赖 pin、.gitignore 等)
|
|
102
|
+
- 👷 `ci`:CI/CD 配置与脚本
|
|
103
|
+
- ⏪️ `revert`:回滚提交
|
|
104
|
+
- 💥 `feat`:破坏性变更(`BREAKING CHANGE:` 段落中说明)
|
|
105
|
+
|
|
106
|
+
> 若传入 `--type`/`--scope`,将**覆盖**自动推断。
|
|
107
|
+
> 仅在指定 `--emoji` 标志时才会包含 emoji。
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Guidelines for Splitting Commits
|
|
112
|
+
|
|
113
|
+
1. **不同关注点**:互不相关的功能/模块改动应拆分。
|
|
114
|
+
2. **不同类型**:不要将 `feat`、`fix`、`refactor` 混在同一提交。
|
|
115
|
+
3. **文件模式**:源代码 vs 文档/测试/配置分组提交。
|
|
116
|
+
4. **规模阈值**:超大 diff(示例:>300 行或跨多个顶级目录)建议拆分。
|
|
117
|
+
5. **可回滚性**:确保每个提交可独立回退。
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Examples
|
|
122
|
+
|
|
123
|
+
**Good (使用 --emoji)**
|
|
124
|
+
|
|
125
|
+
- ✨ feat(ui): add user authentication flow
|
|
126
|
+
- 🐛 fix(api): handle token refresh race condition
|
|
127
|
+
- 📝 docs: update API usage examples
|
|
128
|
+
- ♻️ refactor(core): extract retry logic into helper
|
|
129
|
+
- ✅ test: add unit tests for rate limiter
|
|
130
|
+
- 🔧 chore: update git hooks and repository settings
|
|
131
|
+
- ⏪️ revert: revert "feat(core): introduce streaming API"
|
|
132
|
+
|
|
133
|
+
**Good (不使用 --emoji)**
|
|
134
|
+
|
|
135
|
+
- feat(ui): add user authentication flow
|
|
136
|
+
- fix(api): handle token refresh race condition
|
|
137
|
+
- docs: update API usage examples
|
|
138
|
+
- refactor(core): extract retry logic into helper
|
|
139
|
+
- test: add unit tests for rate limiter
|
|
140
|
+
- chore: update git hooks and repository settings
|
|
141
|
+
- revert: revert "feat(core): introduce streaming API"
|
|
142
|
+
|
|
143
|
+
**Split Example**
|
|
144
|
+
|
|
145
|
+
- `feat(types): add new type defs for payment method`
|
|
146
|
+
- `docs: update API docs for new types`
|
|
147
|
+
- `test: add unit tests for payment types`
|
|
148
|
+
- `fix: address linter warnings in new files` ←(如你的仓库有钩子报错)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Important Notes
|
|
153
|
+
|
|
154
|
+
- **仅使用 Git**:不调用任何包管理器/构建命令(无 `pnpm`/`npm`/`yarn` 等)。
|
|
155
|
+
- **尊重钩子**:默认执行本地 Git 钩子;使用 `--no-verify` 可跳过。
|
|
156
|
+
- **不改源码内容**:命令只读写 `.git/COMMIT_EDITMSG` 与暂存区;不会直接编辑工作区文件。
|
|
157
|
+
- **安全提示**:在 rebase/merge 冲突、detached HEAD 等状态下会先提示处理/确认再继续。
|
|
158
|
+
- **可审可控**:如开启 `confirm: true`,每个实际 `git add`/`git commit` 步骤都会进行二次确认。
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: UltraThink 多模型调试(Codex 后端诊断 + Gemini 前端诊断)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 调用语法见 `_config.md`
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
`/debug <问题描述>`
|
|
9
|
+
|
|
10
|
+
## 上下文
|
|
11
|
+
- 问题描述: $ARGUMENTS
|
|
12
|
+
- 使用 ace-tool 检索相关代码上下文
|
|
13
|
+
- Codex 专注后端/逻辑问题,Gemini 专注前端/UI问题
|
|
14
|
+
|
|
15
|
+
## 流程
|
|
16
|
+
|
|
17
|
+
### Phase 1: 上下文检索
|
|
18
|
+
|
|
19
|
+
1. 调用 `mcp__ace-tool__search_context` 检索相关代码
|
|
20
|
+
2. 收集错误日志、堆栈信息、复现步骤
|
|
21
|
+
3. 识别问题涉及的模块(前端/后端/全栈)
|
|
22
|
+
|
|
23
|
+
### Phase 2: 并行诊断
|
|
24
|
+
|
|
25
|
+
**同时启动两个后台任务**(`run_in_background: true`):
|
|
26
|
+
|
|
27
|
+
- **Codex** + `debugger` 角色 → 后端诊断
|
|
28
|
+
- **Gemini** + `debugger` 角色 → 前端诊断
|
|
29
|
+
- 输出: `Structured diagnostic report. No code modifications.`
|
|
30
|
+
|
|
31
|
+
### Phase 3: 假设整合
|
|
32
|
+
|
|
33
|
+
1. 收集两个模型的诊断报告(使用 `TaskOutput`)
|
|
34
|
+
2. 交叉验证:识别重叠和互补的假设
|
|
35
|
+
3. **UltraThink 综合**:
|
|
36
|
+
- 整合所有假设,按可能性排序
|
|
37
|
+
- 筛选出 **Top 1-2 最可能原因**
|
|
38
|
+
- 设计验证策略
|
|
39
|
+
|
|
40
|
+
### Phase 4: 用户确认(Hard Stop)
|
|
41
|
+
|
|
42
|
+
输出格式:
|
|
43
|
+
```
|
|
44
|
+
## 🔍 诊断结果
|
|
45
|
+
|
|
46
|
+
### Codex 分析(后端视角)
|
|
47
|
+
<Codex 诊断摘要>
|
|
48
|
+
|
|
49
|
+
### Gemini 分析(前端视角)
|
|
50
|
+
<Gemini 诊断摘要>
|
|
51
|
+
|
|
52
|
+
### 综合诊断
|
|
53
|
+
**最可能原因**:<具体诊断>
|
|
54
|
+
**证据**:<支持证据>
|
|
55
|
+
**验证方案**:<如何确认>
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
**确认后我将执行修复。是否继续?(Y/N)**
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
⚠️ **必须等待用户确认后才能进入 Phase 5**
|
|
62
|
+
|
|
63
|
+
### Phase 5: 修复与验证
|
|
64
|
+
|
|
65
|
+
1. 根据确认的诊断实施修复
|
|
66
|
+
2. 修复完成后,**并行调用** Codex + Gemini + `reviewer` 角色审查修复
|
|
67
|
+
3. 综合审查意见,确认问题解决
|
|
68
|
+
|
|
69
|
+
## 输出格式
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
## Phase 1: 上下文检索
|
|
73
|
+
- 检索到 X 个相关文件
|
|
74
|
+
- 问题类型: [前端/后端/全栈]
|
|
75
|
+
|
|
76
|
+
## Phase 2: 并行诊断
|
|
77
|
+
### Codex 诊断
|
|
78
|
+
<诊断内容>
|
|
79
|
+
|
|
80
|
+
### Gemini 诊断
|
|
81
|
+
<诊断内容>
|
|
82
|
+
|
|
83
|
+
## Phase 3: 综合分析
|
|
84
|
+
### Top 假设
|
|
85
|
+
1. [最可能原因] - 可能性: High
|
|
86
|
+
2. [次可能原因] - 可能性: Medium
|
|
87
|
+
|
|
88
|
+
### 验证策略
|
|
89
|
+
- [具体验证步骤]
|
|
90
|
+
|
|
91
|
+
## Phase 4: 确认
|
|
92
|
+
**是否按此诊断进行修复?(Y/N)**
|
|
93
|
+
|
|
94
|
+
## Phase 5: 修复验证(用户确认后)
|
|
95
|
+
- 修复内容: <具体修改>
|
|
96
|
+
- 双模型审查: <审查结果>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 关键原则
|
|
100
|
+
|
|
101
|
+
1. **不假设,先验证** - 所有假设需要证据支持
|
|
102
|
+
2. **并行诊断** - 充分利用双模型的不同视角
|
|
103
|
+
3. **用户确认** - 修复前必须获得确认
|
|
104
|
+
4. **交叉审查** - 修复后双模型验证
|