ccg-ros2-workflow 2.2.1 → 3.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/README.md +211 -96
- package/README.zh-CN.md +256 -0
- package/dist/cli.mjs +15 -15
- package/dist/index.d.mts +61 -34
- package/dist/index.d.ts +61 -34
- package/dist/index.mjs +4 -4
- package/dist/shared/ccg-ros2-workflow.Bhm8c7P1.mjs +5154 -0
- package/package.json +31 -12
- package/templates/codex/AGENTS.md +348 -0
- package/templates/codex/agents/ccg-implement.toml +73 -0
- package/templates/codex/agents/ccg-research.toml +73 -0
- package/templates/codex/agents/ccg-review.toml +82 -0
- package/templates/codex/config.toml +21 -0
- package/templates/codex/hooks/ccg-workflow.py +253 -0
- package/templates/codex/hooks.json +15 -0
- package/templates/commands/agents/planner.md +97 -122
- package/templates/commands/agents/system-integrator.md +2 -2
- package/templates/commands/agents/team-architect.md +97 -0
- package/templates/commands/agents/team-qa.md +121 -0
- package/templates/commands/agents/team-reviewer.md +112 -0
- package/templates/commands/commit.md +30 -1
- package/templates/commands/context.md +332 -0
- package/templates/commands/go.md +206 -0
- package/templates/commands/init.md +1 -1
- package/templates/commands/spec-impl.md +41 -21
- package/templates/commands/spec-init.md +21 -27
- package/templates/commands/spec-plan.md +54 -21
- package/templates/commands/spec-research.md +78 -26
- package/templates/commands/spec-review.md +20 -16
- package/templates/{commands → commands-legacy}/analyze.md +1 -1
- package/templates/commands-legacy/backend.md +224 -0
- package/templates/commands-legacy/codex-exec.md +411 -0
- package/templates/{commands → commands-legacy}/debug.md +1 -1
- package/templates/commands-legacy/enhance.md +55 -0
- package/templates/{commands → commands-legacy}/feat.md +2 -2
- package/templates/commands-legacy/frontend.md +213 -0
- package/templates/{commands → commands-legacy}/optimize.md +1 -1
- package/templates/{commands → commands-legacy}/plan.md +1 -15
- package/templates/{commands → commands-legacy}/team-plan.md +1 -1
- package/templates/commands-legacy/team.md +475 -0
- package/templates/{commands → commands-legacy}/test.md +1 -1
- package/templates/commands-legacy/workflow.md +283 -0
- package/templates/engine/model-router.md +123 -0
- package/templates/engine/phase-guide.md +207 -0
- package/templates/engine/strategies/debug-investigate.md +169 -0
- package/templates/engine/strategies/deep-research.md +141 -0
- package/templates/engine/strategies/direct-fix.md +108 -0
- package/templates/engine/strategies/full-collaborate.md +389 -0
- package/templates/engine/strategies/git-action.md +43 -0
- package/templates/engine/strategies/guided-develop.md +282 -0
- package/templates/engine/strategies/optimize-measure.md +103 -0
- package/templates/engine/strategies/quick-implement.md +96 -0
- package/templates/engine/strategies/refactor-safely.md +180 -0
- package/templates/engine/strategies/review-audit.md +123 -0
- package/templates/hooks/session-start.js +100 -0
- package/templates/hooks/skill-router.js +144 -0
- package/templates/hooks/subagent-context.js +161 -0
- package/templates/hooks/task-utils.js +190 -0
- package/templates/hooks/workflow-state.js +55 -0
- package/templates/output-styles/abyss-command.md +56 -0
- package/templates/output-styles/abyss-concise.md +89 -0
- package/templates/output-styles/abyss-ritual.md +70 -0
- package/templates/output-styles/engineer-professional.md +20 -3
- package/templates/output-styles/laowang-engineer.md +2 -2
- package/templates/prompts/antigravity/analyzer.md +59 -0
- package/templates/prompts/antigravity/architect.md +55 -0
- package/templates/prompts/antigravity/builder.md +52 -0
- package/templates/prompts/antigravity/debugger.md +48 -0
- package/templates/prompts/antigravity/frontend.md +50 -0
- package/templates/prompts/antigravity/optimizer.md +40 -0
- package/templates/prompts/antigravity/reviewer.md +67 -0
- package/templates/prompts/antigravity/tester.md +39 -0
- package/templates/prompts/claude/debugger.md +1 -1
- package/templates/prompts/claude/reviewer.md +1 -1
- package/templates/prompts/codex/analyzer.md +8 -0
- package/templates/prompts/codex/architect.md +9 -1
- package/templates/prompts/codex/builder.md +61 -0
- package/templates/prompts/codex/debugger.md +9 -1
- package/templates/prompts/codex/optimizer.md +7 -0
- package/templates/prompts/codex/reviewer.md +7 -0
- package/templates/prompts/codex/tester.md +8 -1
- package/templates/prompts/gemini/analyzer.md +11 -3
- package/templates/prompts/gemini/architect.md +10 -2
- package/templates/prompts/gemini/debugger.md +8 -0
- package/templates/prompts/gemini/frontend.md +10 -2
- package/templates/prompts/gemini/optimizer.md +9 -2
- package/templates/prompts/gemini/reviewer.md +7 -0
- package/templates/prompts/gemini/tester.md +8 -1
- package/templates/rules/ccg-skill-routing.md +91 -0
- package/templates/rules/ccg-skills.md +65 -0
- package/templates/skills/SKILL.md +92 -0
- package/templates/skills/domains/ai/SKILL.md +34 -0
- package/templates/skills/domains/ai/agent-dev.md +242 -0
- package/templates/skills/domains/ai/llm-security.md +288 -0
- package/templates/skills/domains/ai/prompt-and-eval.md +279 -0
- package/templates/skills/domains/ai/rag-system.md +542 -0
- package/templates/skills/domains/architecture/SKILL.md +42 -0
- package/templates/skills/domains/architecture/api-design.md +225 -0
- package/templates/skills/domains/architecture/caching.md +299 -0
- package/templates/skills/domains/architecture/cloud-native.md +285 -0
- package/templates/skills/domains/architecture/message-queue.md +329 -0
- package/templates/skills/domains/architecture/security-arch.md +297 -0
- package/templates/skills/domains/data-engineering/SKILL.md +207 -0
- package/templates/skills/domains/development/SKILL.md +46 -0
- package/templates/skills/domains/development/cpp.md +369 -0
- package/templates/skills/domains/development/go.md +323 -0
- package/templates/skills/domains/development/java.md +277 -0
- package/templates/skills/domains/development/python.md +487 -0
- package/templates/skills/domains/development/rust.md +313 -0
- package/templates/skills/domains/development/shell.md +313 -0
- package/templates/skills/domains/development/typescript.md +277 -0
- package/templates/skills/domains/devops/SKILL.md +39 -0
- package/templates/skills/domains/devops/cost-optimization.md +272 -0
- package/templates/skills/domains/devops/database.md +217 -0
- package/templates/skills/domains/devops/devsecops.md +198 -0
- package/templates/skills/domains/devops/git-workflow.md +181 -0
- package/templates/skills/domains/devops/observability.md +280 -0
- package/templates/skills/domains/devops/performance.md +336 -0
- package/templates/skills/domains/devops/testing.md +283 -0
- package/templates/skills/domains/infrastructure/SKILL.md +200 -0
- package/templates/skills/domains/mobile/SKILL.md +224 -0
- package/templates/skills/domains/orchestration/SKILL.md +29 -0
- package/templates/skills/domains/orchestration/multi-agent.md +263 -0
- package/templates/skills/domains/ros2-control/SKILL.md +206 -0
- package/templates/skills/domains/ros2-hardware/SKILL.md +277 -0
- package/templates/skills/domains/ros2-manipulation/SKILL.md +237 -0
- package/templates/skills/domains/ros2-navigation/SKILL.md +196 -0
- package/templates/skills/domains/ros2-perception/SKILL.md +166 -0
- package/templates/skills/domains/ros2-upper-app/SKILL.md +50 -0
- package/templates/skills/domains/ros2-upper-app/launch-files.md +224 -0
- package/templates/skills/domains/ros2-upper-app/parameters.md +192 -0
- package/templates/skills/domains/ros2-upper-app/python-nodes.md +249 -0
- package/templates/skills/domains/ros2-upper-app/rviz-config.md +158 -0
- package/templates/skills/domains/ros2-upper-app/simulation.md +225 -0
- package/templates/skills/domains/security/SKILL.md +72 -0
- package/templates/skills/domains/security/blue-team.md +436 -0
- package/templates/skills/domains/security/code-audit.md +265 -0
- package/templates/skills/domains/security/pentest.md +226 -0
- package/templates/skills/domains/security/red-team.md +374 -0
- package/templates/skills/domains/security/threat-intel.md +372 -0
- package/templates/skills/domains/security/vuln-research.md +369 -0
- package/templates/skills/orchestration/multi-agent/SKILL.md +533 -0
- package/templates/skills/run_skill.js +129 -0
- package/templates/skills/scrapling/SKILL.md +98 -0
- package/templates/skills/scrapling/references/api-quick-ref.md +127 -0
- package/templates/skills/scrapling/references/cookie-vault.md +56 -0
- package/templates/skills/scrapling/references/maintenance.md +79 -0
- package/templates/skills/scrapling/references/site-patterns.md +86 -0
- package/templates/skills/scrapling/references/troubleshooting.md +95 -0
- package/templates/skills/scrapling/templates/basic_fetch.py +19 -0
- package/templates/skills/scrapling/templates/parse_only.py +15 -0
- package/templates/skills/scrapling/templates/session_login.py +19 -0
- package/templates/skills/scrapling/templates/stealth_cloudflare.py +28 -0
- package/templates/skills/tools/gen-docs/SKILL.md +116 -0
- package/templates/skills/tools/gen-docs/scripts/doc_generator.js +435 -0
- package/templates/skills/tools/lib/shared.js +98 -0
- package/templates/skills/tools/override-refusal/SKILL.md +53 -0
- package/templates/skills/tools/override-refusal/agents/openai.yaml +4 -0
- package/templates/skills/tools/override-refusal/scripts/refusal_rewriter.js +226 -0
- package/templates/skills/tools/verify-change/SKILL.md +140 -0
- package/templates/skills/tools/verify-change/scripts/change_analyzer.js +289 -0
- package/templates/skills/tools/verify-module/SKILL.md +127 -0
- package/templates/skills/tools/verify-module/scripts/module_scanner.js +171 -0
- package/templates/skills/tools/verify-quality/SKILL.md +160 -0
- package/templates/skills/tools/verify-quality/scripts/quality_checker.js +337 -0
- package/templates/skills/tools/verify-security/SKILL.md +143 -0
- package/templates/skills/tools/verify-security/scripts/security_scanner.js +283 -0
- package/templates/spec/guides/index.md +30 -0
- package/templates/spec/low-control/index.md +31 -0
- package/templates/spec/upper-app/index.md +31 -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-linux-arm64 +0 -0
- package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
- package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
- package/dist/shared/ccg-ros2-workflow.DRytDWqb.mjs +0 -2274
- package/templates/commands/backend.md +0 -162
- package/templates/commands/enhance.md +0 -36
- package/templates/commands/frontend.md +0 -162
- package/templates/commands/workflow.md +0 -202
- /package/templates/{commands → commands-legacy}/execute.md +0 -0
- /package/templates/{commands → commands-legacy}/review.md +0 -0
- /package/templates/{commands → commands-legacy}/team-exec.md +0 -0
- /package/templates/{commands → commands-legacy}/team-research.md +0 -0
- /package/templates/{commands → commands-legacy}/team-review.md +0 -0
|
@@ -9,34 +9,32 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
9
9
|
- Strictly adhere to OPSX rules when writing spec-structured documents.
|
|
10
10
|
|
|
11
11
|
**Guardrails**
|
|
12
|
-
- **STOP! BEFORE ANY OTHER ACTION**: You MUST
|
|
12
|
+
- **STOP! BEFORE ANY OTHER ACTION**: You MUST perform Prompt Enhancement FIRST. This is NON-NEGOTIABLE.
|
|
13
13
|
- **NEVER** divide subagent tasks by roles (e.g., "架构师agent", "安全专家agent").
|
|
14
14
|
- **ALWAYS** divide by context boundaries (e.g., "user-related code", "authentication logic").
|
|
15
15
|
- Each subagent context must be self-contained with independent output.
|
|
16
16
|
- Use `{{MCP_SEARCH_TOOL}}` to minimize grep/find operations.
|
|
17
17
|
- Do not make architectural decisions—surface constraints that guide decisions.
|
|
18
|
+
- **USER GUIDANCE RULE**: When suggesting next steps to the user, ALWAYS use CCG commands (`/ccg:spec-research`, `/ccg:spec-plan`, `/ccg:spec-impl`, `/ccg:spec-review`). NEVER suggest `/opsx:*` commands to the user. If OpenSpec CLI returns error messages referencing OPSX skills, translate them to CCG equivalents.
|
|
19
|
+
- **PHASE BOUNDARY**: This phase ONLY generates the OPSX proposal artifact. Do NOT modify any source code. Do NOT proceed to planning or implementation. After the proposal is generated, STOP and inform the user: "Research complete. Run `/ccg:spec-plan` to continue."
|
|
18
20
|
|
|
19
21
|
**Steps**
|
|
20
22
|
0. **MANDATORY: Enhance Requirement FIRST**
|
|
21
|
-
- **DO THIS IMMEDIATELY. DO NOT SKIP
|
|
22
|
-
-
|
|
23
|
-
```
|
|
24
|
-
mcp__ace-tool__enhance_prompt({
|
|
25
|
-
prompt: "$ARGUMENTS",
|
|
26
|
-
conversation_history: "<recent conversation>",
|
|
27
|
-
project_root_path: "{{WORKDIR}}"
|
|
28
|
-
})
|
|
29
|
-
```
|
|
30
|
-
- Wait for enhanced prompt result.
|
|
23
|
+
- **DO THIS IMMEDIATELY. DO NOT SKIP.**
|
|
24
|
+
- **Prompt 增强**(按 `/ccg:enhance` 的逻辑执行):分析 $ARGUMENTS 的意图、缺失信息、隐含假设,补全为结构化需求(明确目标、技术约束、范围边界、验收标准)。
|
|
31
25
|
- Use enhanced prompt for ALL subsequent steps.
|
|
32
26
|
|
|
33
27
|
1. **Generate OPSX Change**
|
|
34
|
-
-
|
|
28
|
+
- Check if change already exists:
|
|
35
29
|
```bash
|
|
36
|
-
|
|
30
|
+
openspec list --json
|
|
31
|
+
```
|
|
32
|
+
- If change doesn't exist, create it:
|
|
33
|
+
```bash
|
|
34
|
+
openspec new change "<brief-descriptive-name>"
|
|
37
35
|
```
|
|
38
36
|
- This scaffolds `openspec/changes/<name>/` with proposal.md.
|
|
39
|
-
- If change already exists,
|
|
37
|
+
- If change already exists, continue with existing change.
|
|
40
38
|
|
|
41
39
|
2. **Initial Codebase Assessment**
|
|
42
40
|
- Use `{{MCP_SEARCH_TOOL}}` to scan codebase.
|
|
@@ -51,7 +49,11 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
51
49
|
- Each boundary should be self-contained: no cross-communication needed.
|
|
52
50
|
|
|
53
51
|
4. **Parallel Multi-Model Exploration**
|
|
54
|
-
-
|
|
52
|
+
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
|
|
53
|
+
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
|
|
54
|
+
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
55
|
+
|
|
56
|
+
**Output Template** (instruct both models to use this format):
|
|
55
57
|
```json
|
|
56
58
|
{
|
|
57
59
|
"module_name": "context boundary explored",
|
|
@@ -64,7 +66,37 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
64
66
|
"success_criteria_hints": ["observable success behaviors"]
|
|
65
67
|
}
|
|
66
68
|
```
|
|
67
|
-
|
|
69
|
+
|
|
70
|
+
**Step 4.1**: In ONE message, make TWO parallel Bash calls:
|
|
71
|
+
|
|
72
|
+
**FIRST Bash call ({{BACKEND_PRIMARY}} — backend boundaries)**:
|
|
73
|
+
```
|
|
74
|
+
Bash({
|
|
75
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nExplore backend context boundaries for <change description>:\n- Existing structures and patterns\n- Conventions in use\n- Hard constraints limiting solution space\n- Dependencies and risks\nOUTPUT: JSON using the output template above\nEOF",
|
|
76
|
+
run_in_background: true,
|
|
77
|
+
timeout: 300000,
|
|
78
|
+
description: "{{BACKEND_PRIMARY}}: backend boundary exploration"
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**SECOND Bash call ({{FRONTEND_PRIMARY}} — frontend boundaries) - IN THE SAME MESSAGE**:
|
|
83
|
+
```
|
|
84
|
+
Bash({
|
|
85
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nExplore frontend context boundaries for <change description>:\n- Existing structures and patterns\n- Conventions in use\n- Hard constraints limiting solution space\n- Dependencies and risks\nOUTPUT: JSON using the output template above\nEOF",
|
|
86
|
+
run_in_background: true,
|
|
87
|
+
timeout: 300000,
|
|
88
|
+
description: "{{FRONTEND_PRIMARY}}: frontend boundary exploration"
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Step 4.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
|
|
93
|
+
```
|
|
94
|
+
TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
|
|
95
|
+
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
⛔ **上层应用模型失败必须重试**:若上层应用模型调用失败,最多重试 2 次(间隔 5 秒)。3 次全败才跳过。
|
|
99
|
+
⛔ **底层控制模型结果必须等待**:底层控制模型执行 5-15 分钟属正常,超时后继续轮询,禁止跳过。
|
|
68
100
|
|
|
69
101
|
5. **Aggregate and Synthesize**
|
|
70
102
|
- Collect all subagent outputs.
|
|
@@ -83,22 +115,42 @@ description: '需求 → 约束集(并行探索 + OPSX 提案)'
|
|
|
83
115
|
- Capture responses as additional constraints.
|
|
84
116
|
|
|
85
117
|
7. **Finalize OPSX Proposal**
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
118
|
+
- **BEFORE calling `/opsx:continue`** (internal skill call — do NOT expose this command to user), output a structured summary for OPSX context:
|
|
119
|
+
```markdown
|
|
120
|
+
## Research Summary for OPSX
|
|
121
|
+
|
|
122
|
+
**Discovered Constraints**:
|
|
123
|
+
- [List all hard and soft constraints from Step 5]
|
|
124
|
+
|
|
125
|
+
**Dependencies**:
|
|
126
|
+
- [List cross-module dependencies]
|
|
127
|
+
|
|
128
|
+
**Risks & Mitigations**:
|
|
129
|
+
- [List identified risks and mitigation strategies]
|
|
130
|
+
|
|
131
|
+
**Success Criteria**:
|
|
132
|
+
- [List verifiable success behaviors]
|
|
133
|
+
|
|
134
|
+
**User Confirmations**:
|
|
135
|
+
- [List all user decisions from Step 6]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- Then call `/opsx:continue` internally to generate proposal artifact:
|
|
139
|
+
```
|
|
140
|
+
/opsx:continue
|
|
141
|
+
```
|
|
142
|
+
- The OPSX skill will use the above summary to write proposal.md.
|
|
143
|
+
- **Note**: This is an internal call. If this step fails, guide the user to re-run `/ccg:spec-research`.
|
|
144
|
+
- **STOP**: After proposal is generated, verify it exists and inform user:
|
|
145
|
+
"Research phase complete. Proposal generated. Run `/ccg:spec-plan` to continue planning."
|
|
146
|
+
Do NOT proceed to planning or implementation.
|
|
95
147
|
|
|
96
148
|
8. **Context Checkpoint**
|
|
97
149
|
- Report current context usage.
|
|
98
150
|
- If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-plan`"
|
|
99
151
|
|
|
100
152
|
**Reference**
|
|
101
|
-
- OPSX CLI:
|
|
153
|
+
- OPSX CLI: `openspec status --change "<id>" --json`, `openspec list --json`
|
|
102
154
|
- Check prior research: `ls openspec/changes/*/`
|
|
103
155
|
- Use `AskUserQuestion` for ANY ambiguity—never assume or guess
|
|
104
156
|
<!-- CCG:SPEC:RESEARCH:END -->
|
|
@@ -9,44 +9,45 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
9
9
|
- This is an independent review tool—can be used anytime, not tied to archive workflow.
|
|
10
10
|
|
|
11
11
|
**Guardrails**
|
|
12
|
-
- **MANDATORY**: Both
|
|
12
|
+
- **MANDATORY**: Both {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} must complete review before synthesis.
|
|
13
13
|
- Review scope is strictly limited to the proposal's changes—no scope creep.
|
|
14
|
-
- Refer to `openspec/
|
|
14
|
+
- Refer to `openspec/config.yaml` for project conventions when reviewing OpenSpec proposals.
|
|
15
15
|
|
|
16
16
|
**Steps**
|
|
17
17
|
1. **Select Proposal**
|
|
18
|
-
- Run
|
|
18
|
+
- Run `openspec list --json` to display Active Changes.
|
|
19
19
|
- Confirm with user which proposal ID to review.
|
|
20
|
-
- Run
|
|
20
|
+
- Run `openspec status --change "<proposal_id>" --json` to load spec and tasks.
|
|
21
21
|
|
|
22
22
|
2. **Collect Implementation Artifacts**
|
|
23
23
|
- Identify all files modified by this proposal.
|
|
24
|
-
- Use `git diff`
|
|
24
|
+
- Use `git diff` to get change summary.
|
|
25
25
|
- Load relevant spec constraints and PBT properties from `openspec/changes/<id>/specs/`.
|
|
26
26
|
|
|
27
27
|
3. **Multi-Model Review (PARALLEL)**
|
|
28
|
-
- **CRITICAL**: You MUST launch BOTH
|
|
28
|
+
- **CRITICAL**: You MUST launch BOTH {{BACKEND_PRIMARY}} AND {{FRONTEND_PRIMARY}} in a SINGLE message with TWO Bash tool calls.
|
|
29
29
|
- **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
|
|
30
|
+
- **工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
30
31
|
|
|
31
32
|
**Step 3.1**: In ONE message, make TWO parallel Bash calls:
|
|
32
33
|
|
|
33
|
-
**FIRST Bash call (
|
|
34
|
+
**FIRST Bash call ({{BACKEND_PRIMARY}})**:
|
|
34
35
|
```
|
|
35
36
|
Bash({
|
|
36
|
-
command: "~/.claude/bin/codeagent-wrapper --backend
|
|
37
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## {{BACKEND_PRIMARY}} 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",
|
|
37
38
|
run_in_background: true,
|
|
38
39
|
timeout: 300000,
|
|
39
|
-
description: "
|
|
40
|
+
description: "{{BACKEND_PRIMARY}}: backend/logic review"
|
|
40
41
|
})
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
**SECOND Bash call (
|
|
44
|
+
**SECOND Bash call ({{FRONTEND_PRIMARY}}) - IN THE SAME MESSAGE**:
|
|
44
45
|
```
|
|
45
46
|
Bash({
|
|
46
|
-
command: "~/.claude/bin/codeagent-wrapper --backend
|
|
47
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## {{FRONTEND_PRIMARY}} 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",
|
|
47
48
|
run_in_background: true,
|
|
48
49
|
timeout: 300000,
|
|
49
|
-
description: "
|
|
50
|
+
description: "{{FRONTEND_PRIMARY}}: patterns/integration review"
|
|
50
51
|
})
|
|
51
52
|
```
|
|
52
53
|
|
|
@@ -56,6 +57,9 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
56
57
|
TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
|
|
57
58
|
```
|
|
58
59
|
|
|
60
|
+
⛔ **上层应用模型失败必须重试**:若上层应用模型调用失败,最多重试 2 次(间隔 5 秒)。3 次全败才跳过。
|
|
61
|
+
⛔ **底层控制模型结果必须等待**:底层控制模型执行 5-15 分钟属正常,超时后继续轮询,禁止跳过。
|
|
62
|
+
|
|
59
63
|
4. **Synthesize Findings**
|
|
60
64
|
- Merge findings from both models.
|
|
61
65
|
- Deduplicate overlapping issues.
|
|
@@ -96,7 +100,7 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
96
100
|
|
|
97
101
|
7. **Optional: Inline Fix Mode**
|
|
98
102
|
- If user chooses "Fix now" for Critical issues:
|
|
99
|
-
* Route each fix to appropriate model (backend→
|
|
103
|
+
* Route each fix to appropriate model (backend→{{BACKEND_PRIMARY}}, frontend→{{FRONTEND_PRIMARY}}).
|
|
100
104
|
* Apply fix using unified diff patch pattern.
|
|
101
105
|
* Re-run affected review dimension.
|
|
102
106
|
* Repeat until Critical = 0.
|
|
@@ -107,14 +111,14 @@ description: '双模型交叉审查(独立工具,随时可用)'
|
|
|
107
111
|
|
|
108
112
|
**Exit Criteria**
|
|
109
113
|
Review is complete when:
|
|
110
|
-
- [ ] Both
|
|
114
|
+
- [ ] Both {{BACKEND_PRIMARY}} and {{FRONTEND_PRIMARY}} reviews completed
|
|
111
115
|
- [ ] All findings synthesized and classified
|
|
112
116
|
- [ ] Zero Critical issues remain (fixed or user-acknowledged)
|
|
113
117
|
- [ ] User decision captured (archive / return to impl / defer)
|
|
114
118
|
|
|
115
119
|
**Reference**
|
|
116
|
-
- View proposal:
|
|
120
|
+
- View proposal: `openspec status --change "<id>" --json`
|
|
117
121
|
- Check spec constraints: `rg -n "CONSTRAINT:|MUST|INVARIANT:" openspec/changes/<id>/specs/`
|
|
118
|
-
- View implementation diff:
|
|
122
|
+
- View implementation diff: `git diff`
|
|
119
123
|
- Archive (after passing): `/ccg:spec-impl` → Step 10
|
|
120
124
|
<!-- CCG:SPEC:REVIEW:END -->
|
|
@@ -79,7 +79,7 @@ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
|
|
|
79
79
|
|
|
80
80
|
### 🔍 阶段 0:Prompt 增强(可选)
|
|
81
81
|
|
|
82
|
-
`[模式:准备]` -
|
|
82
|
+
`[模式:准备]` - 直接将 $ARGUMENTS 作为后续多模型调用的输入。
|
|
83
83
|
|
|
84
84
|
### 🔍 阶段 1:上下文检索
|
|
85
85
|
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'ROS2 底层控制专项工作流(研究→构思→计划→执行→优化→评审),{{BACKEND_PRIMARY}} 主导'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Backend - ROS2 底层控制专项开发
|
|
6
|
+
|
|
7
|
+
## 使用方法
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
/backend <底层控制任务描述>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 上下文
|
|
14
|
+
|
|
15
|
+
- 底层控制任务:$ARGUMENTS
|
|
16
|
+
- {{BACKEND_PRIMARY}} 主导,{{FRONTEND_PRIMARY}} 辅助参考
|
|
17
|
+
- 适用:C++ 节点、硬件驱动、实时控制算法、消息定义、控制器实现
|
|
18
|
+
- 目标平台:ROS2 Humble
|
|
19
|
+
|
|
20
|
+
## 你的角色
|
|
21
|
+
|
|
22
|
+
你是**ROS2 底层控制编排者**,协调多模型完成 C++/驱动/实时控制任务(研究 → 构思 → 计划 → 执行 → 优化 → 评审),用中文协助用户。
|
|
23
|
+
|
|
24
|
+
**协作模型**:
|
|
25
|
+
- **{{BACKEND_PRIMARY}}** – 底层控制:C++、硬件驱动、实时算法(**底层权威,可信赖**)
|
|
26
|
+
- **{{FRONTEND_PRIMARY}}** – 上层视角(**底层意见仅供参考**)
|
|
27
|
+
- **Claude (自己)** – 编排、计划、执行、交付
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 多模型调用规范
|
|
32
|
+
|
|
33
|
+
**工作目录**:
|
|
34
|
+
- `{{WORKDIR}}`:**必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断
|
|
35
|
+
- 如果用户通过 `/add-dir` 添加了多个工作区,先用 Glob/Grep 确定任务相关的工作区
|
|
36
|
+
- 如果无法确定,用 `AskUserQuestion` 询问用户选择目标工作区
|
|
37
|
+
|
|
38
|
+
**调用语法**:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
# 新会话调用
|
|
42
|
+
Bash({
|
|
43
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'
|
|
44
|
+
ROLE_FILE: <角色提示词路径>
|
|
45
|
+
<TASK>
|
|
46
|
+
需求:<增强后的需求(如未增强则用 $ARGUMENTS)>
|
|
47
|
+
上下文:<前序阶段收集的项目上下文、分析结果等>
|
|
48
|
+
ROS2上下文:<colcon工作空间、package.xml、现有C++节点、消息定义、硬件接口等>
|
|
49
|
+
</TASK>
|
|
50
|
+
OUTPUT: 期望输出格式
|
|
51
|
+
EOF",
|
|
52
|
+
run_in_background: false,
|
|
53
|
+
timeout: 3600000,
|
|
54
|
+
description: "简短描述"
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
# 复用会话调用
|
|
58
|
+
Bash({
|
|
59
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}resume <BACKEND_SESSION> - \"{{WORKDIR}}\" <<'EOF'
|
|
60
|
+
ROLE_FILE: <角色提示词路径>
|
|
61
|
+
<TASK>
|
|
62
|
+
需求:<增强后的需求(如未增强则用 $ARGUMENTS)>
|
|
63
|
+
上下文:<前序阶段收集的项目上下文、分析结果等>
|
|
64
|
+
ROS2上下文:<colcon工作空间、package.xml、现有C++节点、消息定义、硬件接口等>
|
|
65
|
+
</TASK>
|
|
66
|
+
OUTPUT: 期望输出格式
|
|
67
|
+
EOF",
|
|
68
|
+
run_in_background: false,
|
|
69
|
+
timeout: 3600000,
|
|
70
|
+
description: "简短描述"
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**角色提示词**:
|
|
75
|
+
|
|
76
|
+
| 阶段 | 底层控制 |
|
|
77
|
+
|------|----------|
|
|
78
|
+
| 分析 | `~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/analyzer.md` |
|
|
79
|
+
| 规划 | `~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md` |
|
|
80
|
+
| 审查 | `~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md` |
|
|
81
|
+
|
|
82
|
+
**会话复用**:每次调用返回 `SESSION_ID: xxx`,后续阶段用 `resume xxx` 复用上下文。阶段 2 保存 `BACKEND_SESSION`,阶段 3 和 5 使用 `resume` 复用。
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 执行工作流
|
|
87
|
+
|
|
88
|
+
**任务描述**:$ARGUMENTS
|
|
89
|
+
|
|
90
|
+
### 🔍 阶段 1:研究与分析
|
|
91
|
+
|
|
92
|
+
`[模式:研究]` - 理解底层控制需求并收集 ROS2 上下文:
|
|
93
|
+
|
|
94
|
+
1. **ROS2 环境检测**:
|
|
95
|
+
- 检查 colcon 工作空间结构
|
|
96
|
+
- 扫描现有 C++ 节点和消息定义
|
|
97
|
+
- 识别硬件接口(CAN/串口/传感器)
|
|
98
|
+
2. **上下文检索**:调用 `{{MCP_SEARCH_TOOL}}`,重点检索 C++ 节点、消息定义、控制算法
|
|
99
|
+
3. **需求完整性评分**(0-10 分):
|
|
100
|
+
- 目标明确性(0-3)、预期结果(0-3)、边界范围(0-2)、约束条件(0-2)
|
|
101
|
+
- ≥7 分:继续 | <7 分:⛔ 停止,提出补充问题
|
|
102
|
+
|
|
103
|
+
### 💡 阶段 2:方案构思
|
|
104
|
+
|
|
105
|
+
`[模式:构思]` - 底层控制模型分析:
|
|
106
|
+
|
|
107
|
+
调用底层控制模型,使用分析提示词,输出:
|
|
108
|
+
- C++ 节点架构设计
|
|
109
|
+
- 控制算法选型(PID/MPC/LQR 等)
|
|
110
|
+
- 消息定义方案
|
|
111
|
+
- 硬件驱动接口设计
|
|
112
|
+
- 实时性保证策略
|
|
113
|
+
- 线程安全考虑
|
|
114
|
+
|
|
115
|
+
**📌 保存 SESSION_ID**(`BACKEND_SESSION`)。
|
|
116
|
+
|
|
117
|
+
综合分析,输出方案对比(至少 2 个方案),等待用户选择。
|
|
118
|
+
|
|
119
|
+
### 📋 阶段 3:详细规划
|
|
120
|
+
|
|
121
|
+
`[模式:计划]` - 底层控制详细规划:
|
|
122
|
+
|
|
123
|
+
调用底层控制模型(复用会话 `resume $BACKEND_SESSION`),使用规划提示词,输出:
|
|
124
|
+
- **C++ 节点清单**:每个节点的职责、订阅/发布的 Topic、提供的 Service
|
|
125
|
+
- **消息定义清单**:自定义消息的 .msg/.srv/.action 文件内容
|
|
126
|
+
- **控制算法清单**:算法实现细节、参数配置、性能指标
|
|
127
|
+
- **硬件驱动清单**:驱动接口、通信协议、错误处理
|
|
128
|
+
- **CMakeLists.txt 配置**:依赖库、编译选项、链接设置
|
|
129
|
+
- **文件清单**:需要创建/修改的文件列表
|
|
130
|
+
|
|
131
|
+
**⛔ HARD STOP**:展示计划,等待用户批准。未批准禁止进入执行阶段。
|
|
132
|
+
|
|
133
|
+
### ⚙️ 阶段 4:代码执行
|
|
134
|
+
|
|
135
|
+
`[模式:执行]` - Claude 主导实施:
|
|
136
|
+
|
|
137
|
+
根据批准的计划,按以下顺序实施:
|
|
138
|
+
|
|
139
|
+
1. **消息定义**(如需):
|
|
140
|
+
- 创建 `msg/`、`srv/`、`action/` 目录和文件
|
|
141
|
+
- 更新 `CMakeLists.txt` 和 `package.xml`
|
|
142
|
+
2. **C++ 节点实现**:
|
|
143
|
+
- 创建节点源文件(`src/`)和头文件(`include/`)
|
|
144
|
+
- 实现订阅/发布/服务/动作
|
|
145
|
+
- 实现控制算法
|
|
146
|
+
- 配置生命周期节点(如需)
|
|
147
|
+
3. **硬件驱动实现**(如需):
|
|
148
|
+
- 实现硬件通信接口(CAN/串口/I2C/SPI)
|
|
149
|
+
- 实现传感器数据解析
|
|
150
|
+
- 实现执行器控制
|
|
151
|
+
- 添加错误处理和重连逻辑
|
|
152
|
+
4. **CMakeLists.txt 配置**:
|
|
153
|
+
- 添加依赖库(rclcpp、sensor_msgs、geometry_msgs 等)
|
|
154
|
+
- 配置编译选项(C++17、优化级别)
|
|
155
|
+
- 添加可执行文件和库
|
|
156
|
+
5. **单元测试**(如需):
|
|
157
|
+
- 创建测试文件(`test/`)
|
|
158
|
+
- 使用 gtest 编写单元测试
|
|
159
|
+
- 配置 CMakeLists.txt 测试目标
|
|
160
|
+
|
|
161
|
+
每完成一个模块,运行 `colcon build` 验证编译。
|
|
162
|
+
|
|
163
|
+
### 🔧 阶段 5:优化审查
|
|
164
|
+
|
|
165
|
+
`[模式:优化]` - 底层控制模型审查:
|
|
166
|
+
|
|
167
|
+
调用底层控制模型(复用会话 `resume $BACKEND_SESSION`),使用审查提示词,审查:
|
|
168
|
+
- C++ 代码质量(内存管理、异常处理、RAII)
|
|
169
|
+
- 控制算法正确性和性能
|
|
170
|
+
- 消息定义合理性
|
|
171
|
+
- 硬件驱动稳定性
|
|
172
|
+
- 实时性保证(线程优先级、锁策略)
|
|
173
|
+
- 线程安全(互斥锁、原子操作)
|
|
174
|
+
|
|
175
|
+
综合审查意见,Claude 整合修复:
|
|
176
|
+
- **Critical 问题**:必须修复(内存泄漏、死锁、数据竞争、实时性违反)
|
|
177
|
+
- **Warning 问题**:建议修复(命名不规范、注释不足、异常处理缺失)
|
|
178
|
+
- **Info 建议**:可选优化(性能优化、代码风格)
|
|
179
|
+
|
|
180
|
+
### ✅ 阶段 6:最终评审
|
|
181
|
+
|
|
182
|
+
`[模式:评审]` - 质量把关:
|
|
183
|
+
|
|
184
|
+
1. **编译测试**:
|
|
185
|
+
```bash
|
|
186
|
+
colcon build --packages-select <package_name>
|
|
187
|
+
colcon test --packages-select <package_name>
|
|
188
|
+
```
|
|
189
|
+
2. **静态检查**:
|
|
190
|
+
- `cpplint` / `cppcheck`
|
|
191
|
+
- `clang-tidy`
|
|
192
|
+
3. **性能测试**:
|
|
193
|
+
- CPU 使用率
|
|
194
|
+
- 内存占用
|
|
195
|
+
- 消息延迟
|
|
196
|
+
- 控制周期稳定性
|
|
197
|
+
4. **硬件测试**(如有):
|
|
198
|
+
- 硬件连接测试
|
|
199
|
+
- 传感器数据验证
|
|
200
|
+
- 执行器响应测试
|
|
201
|
+
5. **文档完整性**:
|
|
202
|
+
- 代码注释充分
|
|
203
|
+
- README.md 包含使用说明
|
|
204
|
+
- 控制算法有文档说明
|
|
205
|
+
|
|
206
|
+
输出评审报告,等待用户确认。
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 完成标准
|
|
211
|
+
|
|
212
|
+
所有 6 个阶段完成后,输出最终交付清单:
|
|
213
|
+
|
|
214
|
+
- ✅ C++ 节点实现完成
|
|
215
|
+
- ✅ 消息定义正确(如有)
|
|
216
|
+
- ✅ 控制算法实现并验证
|
|
217
|
+
- ✅ 硬件驱动稳定(如有)
|
|
218
|
+
- ✅ 编译测试通过
|
|
219
|
+
- ✅ 单元测试通过(如有)
|
|
220
|
+
- ✅ 性能指标达标
|
|
221
|
+
- ✅ 代码审查通过
|
|
222
|
+
- ✅ 文档完整
|
|
223
|
+
|
|
224
|
+
**🎉 ROS2 底层控制开发完成!**
|