zhuge-workflow 0.1.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/dist/index.js +801 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
- package/templates/claude/CLAUDE-ccg.md +258 -0
- package/templates/claude/CLAUDE.md +106 -0
- package/templates/claude/commands/ccg/_context.md +152 -0
- package/templates/claude/commands/ccg/spec-impl.md +161 -0
- package/templates/claude/commands/ccg/spec-plan-trellis.md +239 -0
- package/templates/claude/commands/ccg/spec-plan.md +225 -0
- package/templates/claude/commands/ccg/spec-research.md +113 -0
- package/templates/claude/commands/ccg/spec-review.md +127 -0
- package/templates/claude/commands/developer/brainstorm.md +5 -0
- package/templates/claude/commands/developer/design-checklist.md +81 -0
- package/templates/claude/commands/developer/design-doc.md +188 -0
- package/templates/claude/commands/developer/requirement-doc.md +150 -0
- package/templates/claude/commands/developer/requirement-interrogate.md +71 -0
- package/templates/claude/commands/developer/status.md +55 -0
- package/templates/claude/rules/bash-style.md +46 -0
- package/templates/claude/rules/claude-code-defensive.md +99 -0
- package/templates/claude/rules/doc-sync.md +49 -0
- package/templates/claude/rules/ops-safety.md +32 -0
- package/templates/claude/skills/bash-style/SKILL.md +244 -0
- package/templates/claude/skills/brainstorming/SKILL.md +48 -0
- package/templates/claude/skills/dotnet-dev/SKILL.md +250 -0
- package/templates/claude/skills/dotnet-dev/references/dotnet-style.md +991 -0
- package/templates/claude/skills/mcp-builder/LICENSE.txt +202 -0
- package/templates/claude/skills/mcp-builder/SKILL.md +328 -0
- package/templates/claude/skills/mcp-builder/reference/evaluation.md +602 -0
- package/templates/claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
- package/templates/claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
- package/templates/claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
- package/templates/claude/skills/mcp-builder/scripts/connections.py +151 -0
- package/templates/claude/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/templates/claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/templates/claude/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/templates/claude/skills/ops-safety/SKILL.md +130 -0
- package/templates/claude/skills/python-dev/SKILL.md +281 -0
- package/templates/claude/skills/skill-creator/LICENSE.txt +202 -0
- package/templates/claude/skills/skill-creator/SKILL.md +209 -0
- package/templates/claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/templates/claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/templates/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/templates/claude/skills/sqlserver-executor/SKILL.md +201 -0
- package/templates/claude/skills/sqlserver-executor/assets/config-example.json +26 -0
- package/templates/claude/skills/sqlserver-executor/config.json +12 -0
- package/templates/claude/skills/sqlserver-executor/scripts/sql_executor.py +404 -0
- package/templates/claude/skills/ui-ux-pro-max/SKILL.md +228 -0
- package/templates/claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/templates/claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/templates/claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/templates/claude/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/templates/claude/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/templates/claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/templates/claude/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/templates/claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/templates/claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/templates/claude/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
- package/templates/claude/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/templates/claude/skills/ui-ux-pro-max/scripts/core.py +238 -0
- package/templates/claude/skills/ui-ux-pro-max/scripts/search.py +61 -0
- package/templates/claude/skills/webapp-testing/LICENSE.txt +202 -0
- package/templates/claude/skills/webapp-testing/SKILL.md +96 -0
- package/templates/claude/skills/webapp-testing/examples/console_logging.py +35 -0
- package/templates/claude/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/templates/claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/templates/claude/skills/webapp-testing/scripts/with_server.py +106 -0
- package/templates/init/claude-agents/ccg-impl.md +199 -0
- package/templates/init/claude-agents/ccg-review.md +146 -0
- package/templates/init/claude-agents/dispatch.md +253 -0
- package/templates/init/claude-hooks/inject-subagent-context.py +964 -0
- package/templates/init/trellis-scripts/task.sh +1326 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '多模型分析 → 消除歧义 → 零决策可执行计划'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:PLAN:START -->
|
|
5
|
+
|
|
6
|
+
> ⚠️ **上下文注入(阶段一)**
|
|
7
|
+
> 执行本命令前,必须先读取基础规范。参考:`~/.claude/commands/ccg/_context.md`
|
|
8
|
+
>
|
|
9
|
+
> **必读规范**:
|
|
10
|
+
> 1. `.trellis/spec/guides/index.md` - 思维指南
|
|
11
|
+
> 2. 根据开发类型读取 `backend/index.md` 或 `frontend/index.md`
|
|
12
|
+
|
|
13
|
+
**Core Philosophy**
|
|
14
|
+
- The goal is to eliminate ALL decision points—implementation should be pure mechanical execution.
|
|
15
|
+
- Every ambiguity must be resolved into explicit constraints before proceeding.
|
|
16
|
+
- Multi-model collaboration surfaces blind spots and conflicting assumptions.
|
|
17
|
+
- Every requirement must have Property-Based Testing (PBT) properties—focus on invariants.
|
|
18
|
+
|
|
19
|
+
**Guardrails**
|
|
20
|
+
- Do not proceed to implementation until every ambiguity is resolved.
|
|
21
|
+
- Multi-model collaboration is **mandatory**: use both Codex and Gemini.
|
|
22
|
+
- If constraints cannot be fully specified, escalate to user or return to research phase.
|
|
23
|
+
- Refer to `openspec/config.yaml` for project conventions.
|
|
24
|
+
|
|
25
|
+
**Steps**
|
|
26
|
+
1. **Select Change**
|
|
27
|
+
- Run `/opsx:list` to display Active Changes.
|
|
28
|
+
- Confirm with user which change ID to refine.
|
|
29
|
+
- Run `/opsx:status <change_id>` to review current state.
|
|
30
|
+
|
|
31
|
+
2. **Multi-Model Implementation Analysis (PARALLEL)**
|
|
32
|
+
- **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
|
|
33
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
|
|
34
|
+
|
|
35
|
+
**Step 2.1**: In ONE message, make TWO parallel Bash calls:
|
|
36
|
+
|
|
37
|
+
**FIRST Bash call (Codex)**:
|
|
38
|
+
```
|
|
39
|
+
Bash({
|
|
40
|
+
command: "/Users/blackzhuge/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nAnalyze change <change_id> from backend perspective:\n- Implementation approach\n- Technical risks\n- Alternative architectures\n- Edge cases and failure modes\nOUTPUT: JSON with analysis\nEOF",
|
|
41
|
+
run_in_background: true,
|
|
42
|
+
timeout: 300000,
|
|
43
|
+
description: "Codex: backend analysis"
|
|
44
|
+
})
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
48
|
+
```
|
|
49
|
+
Bash({
|
|
50
|
+
command: "/Users/blackzhuge/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nAnalyze change <change_id> from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF",
|
|
51
|
+
run_in_background: true,
|
|
52
|
+
timeout: 300000,
|
|
53
|
+
description: "Gemini: frontend analysis"
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Step 2.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
|
|
58
|
+
```
|
|
59
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
60
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- Synthesize responses and present consolidated options to user.
|
|
64
|
+
|
|
65
|
+
3. **Uncertainty Elimination Audit**
|
|
66
|
+
- **Codex**: "Review proposal for unspecified decision points. List each as: [AMBIGUITY] → [REQUIRED CONSTRAINT]"
|
|
67
|
+
- **Gemini**: "Identify implicit assumptions. Specify: [ASSUMPTION] → [EXPLICIT CONSTRAINT NEEDED]"
|
|
68
|
+
|
|
69
|
+
**Anti-Pattern Detection** (flag and reject):
|
|
70
|
+
- Information collection without decision boundaries
|
|
71
|
+
- Technical comparisons without selection criteria
|
|
72
|
+
- Deferred decisions marked "to be determined during implementation"
|
|
73
|
+
|
|
74
|
+
**Target Pattern** (required for approval):
|
|
75
|
+
- Explicit technology choices with parameters (e.g., "JWT with TTL=15min")
|
|
76
|
+
- Concrete algorithm selections with configs (e.g., "bcrypt cost=12")
|
|
77
|
+
- Precise behavioral rules (e.g., "Lock account 30min after 5 failed attempts")
|
|
78
|
+
|
|
79
|
+
Iterate with user until ALL ambiguities resolved.
|
|
80
|
+
|
|
81
|
+
4. **PBT Property Extraction**
|
|
82
|
+
- **Codex**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
|
|
83
|
+
- **Gemini**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
|
|
84
|
+
|
|
85
|
+
**Property Categories**:
|
|
86
|
+
- **Commutativity/Associativity**: Order-independent operations
|
|
87
|
+
- **Idempotency**: Repeated operations yield same result
|
|
88
|
+
- **Round-trip**: Encode→Decode returns original
|
|
89
|
+
- **Invariant Preservation**: State constraints maintained
|
|
90
|
+
- **Monotonicity**: Ordering guarantees (e.g., timestamps increase)
|
|
91
|
+
- **Bounds**: Value ranges, size limits, rate constraints
|
|
92
|
+
|
|
93
|
+
5. **Update OPSX Artifacts**
|
|
94
|
+
- The agent will use OpenSpec skills to generate/update:
|
|
95
|
+
* specs (Requirements + PBT)
|
|
96
|
+
* design (Technical decisions)
|
|
97
|
+
* tasks (Zero-decision implementation plan)
|
|
98
|
+
- Ensure all resolved constraints and PBT properties are included in the generated artifacts.
|
|
99
|
+
|
|
100
|
+
**tasks.md 格式约束(强制)**:
|
|
101
|
+
|
|
102
|
+
每个任务必须使用 checkbox 格式,便于跟踪进度:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
### 1.1 任务标题
|
|
106
|
+
|
|
107
|
+
- [ ] **文件**: `path/to/file.cs`
|
|
108
|
+
|
|
109
|
+
**实现要点**:
|
|
110
|
+
- 要点1
|
|
111
|
+
- 要点2
|
|
112
|
+
|
|
113
|
+
**验收**: 验收标准
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**格式规则**:
|
|
117
|
+
- 每个任务条目必须以 `- [ ]` 开头(待完成)
|
|
118
|
+
- 完成后标记为 `- [x]`
|
|
119
|
+
- 文件末尾必须包含进度统计表
|
|
120
|
+
|
|
121
|
+
**测试任务(强制)**:
|
|
122
|
+
- 每个功能实现任务必须有对应的测试任务
|
|
123
|
+
- 单元测试:覆盖核心逻辑、边界条件、异常处理
|
|
124
|
+
- 集成测试:覆盖 API 端点、数据库交互、跨模块协作
|
|
125
|
+
- 测试任务使用独立编号(如 1.2 实现 → 1.3 单元测试 → 1.4 集成测试)
|
|
126
|
+
- 具体测试框架参考 `openspec/config.yaml` 中的项目约定
|
|
127
|
+
- **禁止**:跳过测试任务或标记为"后续补充"
|
|
128
|
+
|
|
129
|
+
**进度统计表**:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
## 进度统计
|
|
133
|
+
|
|
134
|
+
| Phase | 总任务 | 已完成 | 进度 |
|
|
135
|
+
|-------|--------|--------|------|
|
|
136
|
+
| Phase 1 | N | 0 | 0% |
|
|
137
|
+
| **总计** | **N** | **0** | **0%** |
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
6. **创建任务专属上下文配置 (ccg-context.jsonl)**
|
|
141
|
+
|
|
142
|
+
基于研究和规划结果,为每个 task 创建上下文配置。
|
|
143
|
+
|
|
144
|
+
**6.1 读取 tasks.md 获取任务列表**
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
cat openspec/changes/<change-id>/tasks.md
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**6.2 为每个任务分析所需规范**
|
|
151
|
+
|
|
152
|
+
使用语义化查询找到与每个任务相关的规范:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
mcp__ace-tool__search_context({
|
|
156
|
+
project_root_path: "$PWD",
|
|
157
|
+
query: "<任务N描述> 需要遵循的具体规范文件"
|
|
158
|
+
})
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**6.3 创建 ccg-context.jsonl**
|
|
162
|
+
|
|
163
|
+
每条规范关联到具体的 task 编号,**必须使用 tasks.md 中的 Phase.Section 编号格式**:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cat > openspec/changes/<change-id>/ccg-context.jsonl << 'EOF'
|
|
167
|
+
{"task": "*", "file": "<通用规范路径>", "reason": "所有任务通用"}
|
|
168
|
+
{"task": "1.1,1.2", "file": "<规范路径>", "reason": "Phase 1.1-1.2 DTO设计需要此规范"}
|
|
169
|
+
{"task": "2.5", "file": "<规范路径>", "reason": "Phase 2.5 组件开发需要此规范"}
|
|
170
|
+
{"task": "3.1", "file": "<规范路径>", "reason": "Phase 3.1 E2E测试需要此规范"}
|
|
171
|
+
EOF
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**字段说明**:
|
|
175
|
+
- `task`: 任务编号,**必须与 tasks.md 的 Phase.Section 编号一致**(如 `"1.1"`, `"2.5"`, `"3.1"`)
|
|
176
|
+
- `"*"` 表示所有任务通用
|
|
177
|
+
- 多个任务用逗号分隔:`"1.1,1.2,1.3"`
|
|
178
|
+
- 范围表达式不支持,需逐个列出
|
|
179
|
+
- `file`: 规范文件路径
|
|
180
|
+
- `reason`: 为什么该规范与此任务相关
|
|
181
|
+
|
|
182
|
+
**编号规则(强制)**:
|
|
183
|
+
- 必须使用 `Phase.Section` 格式(如 `1.1`, `2.5`),禁止使用连续数字(如 `1`, `7`, `16`)
|
|
184
|
+
- 从 tasks.md 提取编号时,保留原始 Phase.Section 格式
|
|
185
|
+
- 示例映射:
|
|
186
|
+
- `### 1.1 预设 DTO` → task: `"1.1"`
|
|
187
|
+
- `### 2.5 预设选择器组件` → task: `"2.5"`
|
|
188
|
+
- `### 3.1 E2E 测试` → task: `"3.1"`
|
|
189
|
+
|
|
190
|
+
**选择原则**:
|
|
191
|
+
- 每条规范关联到具体任务,避免注入不相关内容
|
|
192
|
+
- 所有任务都需要的规范用 `"*"` 标记
|
|
193
|
+
- 优先选择 index.md 之外的具体规范文件
|
|
194
|
+
|
|
195
|
+
**6.4 验证配置**
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
cat openspec/changes/<change-id>/ccg-context.jsonl | while read line; do
|
|
199
|
+
file=$(echo "$line" | jq -r '.file')
|
|
200
|
+
if [ ! -f "$file" ]; then
|
|
201
|
+
echo "警告: $file 不存在"
|
|
202
|
+
fi
|
|
203
|
+
done
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
7. **Context Checkpoint**
|
|
207
|
+
- Report current context usage.
|
|
208
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-impl`"
|
|
209
|
+
|
|
210
|
+
**Exit Criteria**
|
|
211
|
+
A change is ready for implementation only when:
|
|
212
|
+
- [ ] All multi-model analyses completed and synthesized
|
|
213
|
+
- [ ] Zero ambiguities remain (verified by step 3 audit)
|
|
214
|
+
- [ ] All PBT properties documented with falsification strategies
|
|
215
|
+
- [ ] Artifacts (specs, design, tasks) generated via OpenSpec skills
|
|
216
|
+
- [ ] **tasks.md 包含单元测试和集成测试任务**(无"后续补充"标记)
|
|
217
|
+
- [ ] **ccg-context.jsonl 已创建**(供 spec-impl/spec-review 使用)
|
|
218
|
+
- [ ] User has explicitly approved all constraint decisions
|
|
219
|
+
|
|
220
|
+
**Reference**
|
|
221
|
+
- Inspect change: `/opsx:status <id>`
|
|
222
|
+
- Check conflicts: `/opsx:schemas`
|
|
223
|
+
- Search patterns: `rg -n "INVARIANT:|PROPERTY:" openspec/`
|
|
224
|
+
- Use `AskUserQuestion` for ANY ambiguity—never assume
|
|
225
|
+
<!-- CCG:SPEC:PLAN:END -->
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:RESEARCH:START -->
|
|
5
|
+
|
|
6
|
+
> ⚠️ **上下文注入(阶段一)**
|
|
7
|
+
> 执行本命令前,必须先读取基础规范。参考:`~/.claude/commands/ccg/_context.md`
|
|
8
|
+
>
|
|
9
|
+
> **执行步骤**:
|
|
10
|
+
> 1. 发现规范目录:`find .trellis/spec -type d`
|
|
11
|
+
> 2. 读取相关目录的 `index.md`
|
|
12
|
+
> 3. 根据任务类型选择性读取具体规范
|
|
13
|
+
|
|
14
|
+
**Core Philosophy**
|
|
15
|
+
- Research produces **constraint sets**, not information dumps. Each constraint narrows the solution space.
|
|
16
|
+
- Constraints tell subsequent stages "don't consider this direction," enabling mechanical execution without decisions.
|
|
17
|
+
- Output: 约束集合 + 可验证的成功判据 (constraint sets + verifiable success criteria).
|
|
18
|
+
- Strictly adhere to OPSX rules when writing spec-structured documents.
|
|
19
|
+
|
|
20
|
+
**Guardrails**
|
|
21
|
+
- **STOP! BEFORE ANY OTHER ACTION**: You MUST call `mcp__ace-tool__enhance_prompt` FIRST. This is NON-NEGOTIABLE.
|
|
22
|
+
- **NEVER** divide subagent tasks by roles (e.g., "架构师agent", "安全专家agent").
|
|
23
|
+
- **ALWAYS** divide by context boundaries (e.g., "user-related code", "authentication logic").
|
|
24
|
+
- Each subagent context must be self-contained with independent output.
|
|
25
|
+
- Use `mcp__ace-tool__search_context` to minimize grep/find operations.
|
|
26
|
+
- Do not make architectural decisions—surface constraints that guide decisions.
|
|
27
|
+
|
|
28
|
+
**Steps**
|
|
29
|
+
0. **MANDATORY: Enhance Requirement FIRST**
|
|
30
|
+
- **DO THIS IMMEDIATELY. DO NOT SKIP. DO NOT CALL ANY OTHER TOOL FIRST.**
|
|
31
|
+
- Call:
|
|
32
|
+
```
|
|
33
|
+
mcp__ace-tool__enhance_prompt({
|
|
34
|
+
prompt: "$ARGUMENTS",
|
|
35
|
+
conversation_history: "<recent conversation>",
|
|
36
|
+
project_root_path: "$PWD"
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
- Wait for enhanced prompt result.
|
|
40
|
+
- Use enhanced prompt for ALL subsequent steps.
|
|
41
|
+
|
|
42
|
+
1. **Generate OPSX Change**
|
|
43
|
+
- Create a new change using OPSX command:
|
|
44
|
+
```bash
|
|
45
|
+
/opsx:new "<brief-descriptive-name>"
|
|
46
|
+
```
|
|
47
|
+
- This scaffolds `openspec/changes/<name>/` with proposal.md.
|
|
48
|
+
- If change already exists, use `/opsx:list` to find it and continue.
|
|
49
|
+
|
|
50
|
+
2. **Initial Codebase Assessment**
|
|
51
|
+
- Use `mcp__ace-tool__search_context` to scan codebase.
|
|
52
|
+
- Determine project scale: single vs multi-directory structure.
|
|
53
|
+
- **Decision**: If multi-directory → enable parallel Explore subagents.
|
|
54
|
+
|
|
55
|
+
3. **Define Exploration Boundaries (Context-Based)**
|
|
56
|
+
- Identify natural context boundaries (NOT functional roles):
|
|
57
|
+
* Subagent 1: User domain code (models, services, UI)
|
|
58
|
+
* Subagent 2: Auth & authorization (middleware, session, tokens)
|
|
59
|
+
* Subagent 3: Infrastructure (configs, deployments, builds)
|
|
60
|
+
- Each boundary should be self-contained: no cross-communication needed.
|
|
61
|
+
|
|
62
|
+
4. **Parallel Multi-Model Exploration**
|
|
63
|
+
- Dispatch Explore subagents with unified output template:
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"module_name": "context boundary explored",
|
|
67
|
+
"existing_structures": ["key patterns found"],
|
|
68
|
+
"existing_conventions": ["standards in use"],
|
|
69
|
+
"constraints_discovered": ["hard constraints limiting solution space"],
|
|
70
|
+
"open_questions": ["ambiguities requiring user input"],
|
|
71
|
+
"dependencies": ["cross-module dependencies"],
|
|
72
|
+
"risks": ["potential blockers"],
|
|
73
|
+
"success_criteria_hints": ["observable success behaviors"]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
- Run Codex for backend boundaries, Gemini for frontend boundaries.
|
|
77
|
+
|
|
78
|
+
5. **Aggregate and Synthesize**
|
|
79
|
+
- Collect all subagent outputs.
|
|
80
|
+
- Merge into unified constraint sets:
|
|
81
|
+
* **Hard constraints**: Technical limitations, patterns that cannot be violated
|
|
82
|
+
* **Soft constraints**: Conventions, preferences, style guides
|
|
83
|
+
* **Dependencies**: Cross-module relationships affecting implementation order
|
|
84
|
+
* **Risks**: Blockers needing mitigation
|
|
85
|
+
|
|
86
|
+
6. **User Interaction for Ambiguity Resolution**
|
|
87
|
+
- Compile prioritized list of open questions.
|
|
88
|
+
- Use `AskUserQuestion` tool to present systematically:
|
|
89
|
+
* Group related questions
|
|
90
|
+
* Provide context for each
|
|
91
|
+
* Suggest defaults when applicable
|
|
92
|
+
- Capture responses as additional constraints.
|
|
93
|
+
|
|
94
|
+
7. **Finalize OPSX Proposal**
|
|
95
|
+
- Transform constraint sets into OPSX format:
|
|
96
|
+
* **Context**: User need + discovered constraints
|
|
97
|
+
* **Requirements**: Each constraint becomes requirement with scenario
|
|
98
|
+
* **Success Criteria**: Derived from hints and user confirmations
|
|
99
|
+
- Ensure proposal includes:
|
|
100
|
+
* All discovered constraints as requirements
|
|
101
|
+
* Verifiable scenarios for each requirement
|
|
102
|
+
* Clear dependencies and sequencing
|
|
103
|
+
* Risk mitigation strategies
|
|
104
|
+
|
|
105
|
+
8. **Context Checkpoint**
|
|
106
|
+
- Report current context usage.
|
|
107
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-plan`"
|
|
108
|
+
|
|
109
|
+
**Reference**
|
|
110
|
+
- OPSX CLI: `/opsx:status`, `/opsx:show`
|
|
111
|
+
- Check prior research: `ls openspec/changes/*/`
|
|
112
|
+
- Use `AskUserQuestion` for ANY ambiguity—never assume or guess
|
|
113
|
+
<!-- CCG:SPEC:RESEARCH:END -->
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '双模型交叉审查(独立工具,随时可用)'
|
|
3
|
+
---
|
|
4
|
+
<!-- CCG:SPEC:REVIEW:START -->
|
|
5
|
+
|
|
6
|
+
> ⚠️ **上下文注入(阶段一 + 阶段二)**
|
|
7
|
+
> 执行本命令前,必须完成上下文注入。参考:`~/.claude/commands/ccg/_context.md`
|
|
8
|
+
>
|
|
9
|
+
> **阶段一**:发现并读取 `.trellis/spec/` 下相关目录的规范
|
|
10
|
+
> **阶段二**:读取 `openspec/changes/<change-id>/ccg-context.jsonl` 中配置的规范文件
|
|
11
|
+
|
|
12
|
+
**Core Philosophy**
|
|
13
|
+
- Dual-model cross-validation catches blind spots single-model review would miss.
|
|
14
|
+
- Critical findings SHOULD be addressed before proceeding.
|
|
15
|
+
- Review validates implementation against spec constraints and code quality.
|
|
16
|
+
- This is an independent review tool—can be used anytime, not tied to archive workflow.
|
|
17
|
+
|
|
18
|
+
**Guardrails**
|
|
19
|
+
- **MANDATORY**: Both Codex AND Gemini must complete review before synthesis.
|
|
20
|
+
- Review scope is strictly limited to the proposal's changes—no scope creep.
|
|
21
|
+
- Refer to `openspec/AGENTS.md` for spec conventions if reviewing OpenSpec proposals.
|
|
22
|
+
|
|
23
|
+
**Steps**
|
|
24
|
+
1. **Select Proposal**
|
|
25
|
+
- Run `/opsx:list` to display Active Changes.
|
|
26
|
+
- Confirm with user which proposal ID to review.
|
|
27
|
+
- Run `/opsx:show <proposal_id>` to load spec and tasks.
|
|
28
|
+
|
|
29
|
+
2. **Collect Implementation Artifacts**
|
|
30
|
+
- Identify all files modified by this proposal.
|
|
31
|
+
- Use `git diff` or `/opsx:diff <proposal_id>` to get change summary.
|
|
32
|
+
- Load relevant spec constraints and PBT properties from `openspec/changes/<id>/specs/`.
|
|
33
|
+
|
|
34
|
+
3. **Multi-Model Review (PARALLEL)**
|
|
35
|
+
- **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
|
|
36
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
|
|
37
|
+
|
|
38
|
+
**Step 3.1**: In ONE message, make TWO parallel Bash calls:
|
|
39
|
+
|
|
40
|
+
**FIRST Bash call (Codex)**:
|
|
41
|
+
```
|
|
42
|
+
Bash({
|
|
43
|
+
command: "/Users/blackzhuge/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Codex Review Dimensions\n1. **Spec Compliance**: Verify ALL constraints from spec are satisfied\n2. **PBT Properties**: Check invariants, idempotency, bounds are correctly implemented\n3. **Logic Correctness**: Edge cases, error handling, algorithm correctness\n4. **Backend Security**: Injection vulnerabilities, auth checks, input validation\n5. **Regression Risk**: Interface compatibility, type safety, breaking changes\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"spec_compliance|pbt|logic|security|regression\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"constraint_violated\": \"Constraint ID from spec (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified constraints/properties\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
|
|
44
|
+
run_in_background: true,
|
|
45
|
+
timeout: 300000,
|
|
46
|
+
description: "Codex: backend/logic review"
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
|
|
51
|
+
```
|
|
52
|
+
Bash({
|
|
53
|
+
command: "/Users/blackzhuge/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Gemini Review Dimensions\n1. **Pattern Consistency**: Naming conventions, code style, project patterns\n2. **Maintainability**: Readability, complexity, documentation adequacy\n3. **Integration Risk**: Dependency changes, cross-module impacts\n4. **Frontend Security**: XSS, CSRF, sensitive data exposure\n5. **Spec Alignment**: Implementation matches spec intent (not just letter)\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"patterns|maintainability|integration|security|alignment\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"spec_reference\": \"Spec section (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified aspects\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
|
|
54
|
+
run_in_background: true,
|
|
55
|
+
timeout: 300000,
|
|
56
|
+
description: "Gemini: patterns/integration review"
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Step 3.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
|
|
61
|
+
```
|
|
62
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
63
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
4. **Synthesize Findings**
|
|
67
|
+
- Merge findings from both models.
|
|
68
|
+
- Deduplicate overlapping issues.
|
|
69
|
+
- Classify by severity:
|
|
70
|
+
* **Critical**: Spec violation, security vulnerability, breaking change → MUST fix
|
|
71
|
+
* **Warning**: Pattern deviation, maintainability concern → SHOULD fix
|
|
72
|
+
* **Info**: Minor improvement suggestion → MAY fix
|
|
73
|
+
|
|
74
|
+
5. **Present Review Report**
|
|
75
|
+
- Display findings grouped by severity:
|
|
76
|
+
```
|
|
77
|
+
## Review Report: <proposal_id>
|
|
78
|
+
|
|
79
|
+
### Critical (X issues) - MUST FIX
|
|
80
|
+
- [ ] [SPEC] file.ts:42 - Constraint X violated: description
|
|
81
|
+
- [ ] [SEC] api.ts:15 - SQL injection vulnerability
|
|
82
|
+
|
|
83
|
+
### Warning (Y issues) - SHOULD FIX
|
|
84
|
+
- [ ] [PATTERN] utils.ts:88 - Inconsistent naming convention
|
|
85
|
+
|
|
86
|
+
### Info (Z issues) - MAY FIX
|
|
87
|
+
- [ ] [MAINT] helper.ts:20 - Consider extracting to separate function
|
|
88
|
+
|
|
89
|
+
### Passed Checks
|
|
90
|
+
- ✅ PBT: Idempotency property verified
|
|
91
|
+
- ✅ Security: No XSS vulnerabilities found
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
6. **Decision Gate**
|
|
95
|
+
- **If Critical > 0**:
|
|
96
|
+
* Present findings to user.
|
|
97
|
+
* Ask: "Fix now or return to `/ccg:spec-impl` to address?"
|
|
98
|
+
* Do NOT allow archiving.
|
|
99
|
+
|
|
100
|
+
- **If Critical = 0**:
|
|
101
|
+
* Ask user: "All critical checks passed. Proceed to archive?"
|
|
102
|
+
* If Warning > 0, recommend addressing before archive.
|
|
103
|
+
|
|
104
|
+
7. **Optional: Inline Fix Mode**
|
|
105
|
+
- If user chooses "Fix now" for Critical issues:
|
|
106
|
+
* Route each fix to appropriate model (backend→Codex, frontend→Gemini).
|
|
107
|
+
* Apply fix using unified diff patch pattern.
|
|
108
|
+
* Re-run affected review dimension.
|
|
109
|
+
* Repeat until Critical = 0.
|
|
110
|
+
|
|
111
|
+
8. **Context Checkpoint**
|
|
112
|
+
- Report current context usage.
|
|
113
|
+
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-review` or `/ccg:spec-impl`"
|
|
114
|
+
|
|
115
|
+
**Exit Criteria**
|
|
116
|
+
Review is complete when:
|
|
117
|
+
- [ ] Both Codex and Gemini reviews completed
|
|
118
|
+
- [ ] All findings synthesized and classified
|
|
119
|
+
- [ ] Zero Critical issues remain (fixed or user-acknowledged)
|
|
120
|
+
- [ ] User decision captured (archive / return to impl / defer)
|
|
121
|
+
|
|
122
|
+
**Reference**
|
|
123
|
+
- View proposal: `/opsx:show <id>`
|
|
124
|
+
- Check spec constraints: `rg -n "CONSTRAINT:|MUST|INVARIANT:" openspec/changes/<id>/specs/`
|
|
125
|
+
- View implementation diff: `/opsx:diff <id>` or `git diff`
|
|
126
|
+
- Archive (after passing): `/ccg:spec-impl` → Step 10
|
|
127
|
+
<!-- CCG:SPEC:REVIEW:END -->
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 生成设计质量检查清单
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
基于 S-Tier SaaS 设计标准(参考 Stripe、Airbnb、Linear),对「$ARGUMENTS」进行设计质量检查。
|
|
6
|
+
|
|
7
|
+
## 检查清单
|
|
8
|
+
|
|
9
|
+
### 一、核心设计原则
|
|
10
|
+
|
|
11
|
+
- [ ] **用户优先**:界面是否以用户任务为中心设计
|
|
12
|
+
- [ ] **简洁清晰**:信息层次是否清晰,无冗余元素
|
|
13
|
+
- [ ] **一致性**:颜色、字体、组件是否与现有系统一致
|
|
14
|
+
- [ ] **可访问性**:对比度是否达标(WCAG AA 4.5:1)
|
|
15
|
+
|
|
16
|
+
### 二、视觉设计
|
|
17
|
+
|
|
18
|
+
#### 颜色
|
|
19
|
+
- [ ] 主色调使用是否克制(不超过 3 种主色)
|
|
20
|
+
- [ ] 语义色是否正确(成功=绿、错误=红、警告=黄、信息=蓝)
|
|
21
|
+
- [ ] 深色模式是否考虑(如需要)
|
|
22
|
+
|
|
23
|
+
#### 字体
|
|
24
|
+
- [ ] 标题层级是否清晰(H1 > H2 > H3 > Body)
|
|
25
|
+
- [ ] 正文字号是否舒适(14-16px)
|
|
26
|
+
- [ ] 行高是否合适(1.5-1.7)
|
|
27
|
+
|
|
28
|
+
#### 间距
|
|
29
|
+
- [ ] 是否使用 8px 基准网格
|
|
30
|
+
- [ ] 元素间距是否一致
|
|
31
|
+
- [ ] 留白是否充足
|
|
32
|
+
|
|
33
|
+
### 三、交互设计
|
|
34
|
+
|
|
35
|
+
- [ ] 按钮状态是否完整(默认、悬停、激活、禁用)
|
|
36
|
+
- [ ] 表单验证反馈是否及时
|
|
37
|
+
- [ ] 加载状态是否有提示
|
|
38
|
+
- [ ] 空状态是否有引导
|
|
39
|
+
- [ ] 错误状态是否有恢复建议
|
|
40
|
+
|
|
41
|
+
### 四、响应式
|
|
42
|
+
|
|
43
|
+
- [ ] 桌面端(1440px)布局是否正常
|
|
44
|
+
- [ ] 平板端(768px)是否适配
|
|
45
|
+
- [ ] 移动端(375px)是否可用
|
|
46
|
+
- [ ] 无水平滚动条
|
|
47
|
+
|
|
48
|
+
### 五、可访问性(WCAG 2.1 AA)
|
|
49
|
+
|
|
50
|
+
- [ ] Tab 键导航顺序是否合理
|
|
51
|
+
- [ ] 焦点状态是否可见
|
|
52
|
+
- [ ] 图片是否有 alt 文本
|
|
53
|
+
- [ ] 表单标签是否关联
|
|
54
|
+
|
|
55
|
+
### 六、性能
|
|
56
|
+
|
|
57
|
+
- [ ] 图片是否优化(WebP、懒加载)
|
|
58
|
+
- [ ] 动画是否流畅(60fps)
|
|
59
|
+
- [ ] 首屏加载是否快速
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 输出格式
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
### 设计检查报告:[功能名称]
|
|
67
|
+
|
|
68
|
+
**总体评分**:⭐⭐⭐⭐☆ (X/5)
|
|
69
|
+
|
|
70
|
+
#### ✅ 通过项
|
|
71
|
+
- [列出通过的检查项]
|
|
72
|
+
|
|
73
|
+
#### ⚠️ 建议改进
|
|
74
|
+
- [问题描述] → [改进建议]
|
|
75
|
+
|
|
76
|
+
#### ❌ 必须修复
|
|
77
|
+
- [问题描述] → [修复方案]
|
|
78
|
+
|
|
79
|
+
#### 截图/示意(如有)
|
|
80
|
+
[相关截图或 ASCII 示意]
|
|
81
|
+
```
|