ccg-ros2-workflow 2.2.2 → 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 +59 -36
- package/dist/index.d.ts +59 -36
- 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.DnOr3oPi.mjs +0 -2480
- 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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// CCG Hook Shared Utilities
|
|
3
|
+
// Pure Node.js, zero external dependencies
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
function findProjectRoot(startDir) {
|
|
9
|
+
let dir = startDir || process.cwd();
|
|
10
|
+
for (let i = 0; i < 20; i++) {
|
|
11
|
+
if (fs.existsSync(path.join(dir, '.ccg', 'tasks'))) return dir;
|
|
12
|
+
if (fs.existsSync(path.join(dir, '.ccg'))) return dir;
|
|
13
|
+
if (fs.existsSync(path.join(dir, '.git'))) return dir;
|
|
14
|
+
const parent = path.dirname(dir);
|
|
15
|
+
if (parent === dir) break;
|
|
16
|
+
dir = parent;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getActiveTask(projectRoot) {
|
|
22
|
+
const tasksDir = path.join(projectRoot, '.ccg', 'tasks');
|
|
23
|
+
if (!fs.existsSync(tasksDir)) return null;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const dirs = fs.readdirSync(tasksDir)
|
|
27
|
+
.filter(d => {
|
|
28
|
+
if (d === 'archive') return false;
|
|
29
|
+
try {
|
|
30
|
+
const full = path.join(tasksDir, d);
|
|
31
|
+
return fs.statSync(full).isDirectory() && fs.existsSync(path.join(full, 'task.json'));
|
|
32
|
+
} catch { return false; }
|
|
33
|
+
})
|
|
34
|
+
.sort()
|
|
35
|
+
.reverse();
|
|
36
|
+
|
|
37
|
+
for (const dir of dirs) {
|
|
38
|
+
try {
|
|
39
|
+
const taskPath = path.join(tasksDir, dir, 'task.json');
|
|
40
|
+
if (!fs.existsSync(taskPath)) continue; // stale pointer detection
|
|
41
|
+
const raw = fs.readFileSync(taskPath, 'utf-8');
|
|
42
|
+
const task = JSON.parse(raw);
|
|
43
|
+
if (task.status !== 'completed' && task.status !== 'archived') {
|
|
44
|
+
return { dir: path.join(tasksDir, dir), ...task, _stale: false };
|
|
45
|
+
}
|
|
46
|
+
} catch { /* skip malformed */ }
|
|
47
|
+
}
|
|
48
|
+
} catch { /* silent */ }
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function readFileSafe(filePath) {
|
|
53
|
+
try { return fs.readFileSync(filePath, 'utf-8'); } catch { return null; }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function readJsonSafe(filePath) {
|
|
57
|
+
try { return JSON.parse(fs.readFileSync(filePath, 'utf-8')); } catch { return null; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function readContextJsonl(taskDir) {
|
|
61
|
+
const jsonlPath = path.join(taskDir, 'context.jsonl');
|
|
62
|
+
if (!fs.existsSync(jsonlPath)) return [];
|
|
63
|
+
try {
|
|
64
|
+
return fs.readFileSync(jsonlPath, 'utf-8')
|
|
65
|
+
.split('\n')
|
|
66
|
+
.filter(line => line.trim())
|
|
67
|
+
.map(line => { try { return JSON.parse(line); } catch { return null; } })
|
|
68
|
+
.filter(entry => entry && entry.file);
|
|
69
|
+
} catch { return []; }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function detectTechStack(projectRoot) {
|
|
73
|
+
const indicators = [
|
|
74
|
+
{ file: 'package.json', stack: 'Node.js' },
|
|
75
|
+
{ file: 'go.mod', stack: 'Go' },
|
|
76
|
+
{ file: 'pyproject.toml', stack: 'Python' },
|
|
77
|
+
{ file: 'Cargo.toml', stack: 'Rust' },
|
|
78
|
+
{ file: 'pom.xml', stack: 'Java' },
|
|
79
|
+
{ file: 'build.gradle', stack: 'Java/Kotlin' },
|
|
80
|
+
];
|
|
81
|
+
const found = [];
|
|
82
|
+
for (const { file, stack } of indicators) {
|
|
83
|
+
if (fs.existsSync(path.join(projectRoot, file))) found.push(stack);
|
|
84
|
+
}
|
|
85
|
+
return found.length > 0 ? found.join(' + ') : 'Unknown';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getGitInfo(projectRoot) {
|
|
89
|
+
try {
|
|
90
|
+
const { execSync } = require('child_process');
|
|
91
|
+
const branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: projectRoot, stdio: 'pipe' }).toString().trim();
|
|
92
|
+
const status = execSync('git status --porcelain', { cwd: projectRoot, stdio: 'pipe' }).toString().trim();
|
|
93
|
+
const dirtyCount = status ? status.split('\n').length : 0;
|
|
94
|
+
return { branch, dirtyCount };
|
|
95
|
+
} catch { return { branch: 'unknown', dirtyCount: 0 }; }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function outputHook(eventName, additionalContext) {
|
|
99
|
+
console.log(JSON.stringify({
|
|
100
|
+
hookSpecificOutput: {
|
|
101
|
+
hookEventName: eventName,
|
|
102
|
+
additionalContext
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function archiveTask(taskDir, projectRoot) {
|
|
108
|
+
try {
|
|
109
|
+
const now = new Date();
|
|
110
|
+
const month = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`;
|
|
111
|
+
const archiveDir = path.join(projectRoot, '.ccg', 'tasks', 'archive', month);
|
|
112
|
+
if (!fs.existsSync(archiveDir)) fs.mkdirSync(archiveDir, { recursive: true });
|
|
113
|
+
const name = path.basename(taskDir);
|
|
114
|
+
const dest = path.join(archiveDir, name);
|
|
115
|
+
fs.renameSync(taskDir, dest);
|
|
116
|
+
return dest;
|
|
117
|
+
} catch { return null; }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function autoCommitTask(projectRoot, message) {
|
|
121
|
+
try {
|
|
122
|
+
const { execSync } = require('child_process');
|
|
123
|
+
execSync('git add .ccg/tasks/', { cwd: projectRoot, stdio: 'pipe' });
|
|
124
|
+
const diff = execSync('git diff --cached --quiet', { cwd: projectRoot, stdio: 'pipe' }).toString();
|
|
125
|
+
return false; // nothing to commit
|
|
126
|
+
} catch {
|
|
127
|
+
try {
|
|
128
|
+
const { execSync } = require('child_process');
|
|
129
|
+
execSync(`git commit -m "${message || 'chore: archive ccg task'}"`, { cwd: projectRoot, stdio: 'pipe' });
|
|
130
|
+
return true;
|
|
131
|
+
} catch { return false; }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function seedContextJsonl(taskDir, projectRoot) {
|
|
136
|
+
const jsonlPath = path.join(taskDir, 'context.jsonl');
|
|
137
|
+
if (fs.existsSync(jsonlPath)) return;
|
|
138
|
+
const specDir = path.join(projectRoot, '.ccg', 'spec');
|
|
139
|
+
const lines = ['{"_example": "Fill with {\\\"file\\\": \\\"path\\\", \\\"reason\\\": \\\"why\\\"}. One entry per line. Seed rows (with _example key) are skipped."}'];
|
|
140
|
+
if (fs.existsSync(specDir)) {
|
|
141
|
+
try {
|
|
142
|
+
const walk = (dir, prefix) => {
|
|
143
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
144
|
+
const rel = prefix ? `${prefix}/${e.name}` : e.name;
|
|
145
|
+
if (e.isDirectory()) walk(path.join(dir, e.name), rel);
|
|
146
|
+
else if (e.name.endsWith('.md')) lines.push(JSON.stringify({ file: `.ccg/spec/${rel}`, reason: 'project spec' }));
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
walk(specDir, '');
|
|
150
|
+
} catch { /* silent */ }
|
|
151
|
+
}
|
|
152
|
+
try { fs.writeFileSync(jsonlPath, lines.join('\n') + '\n', 'utf-8'); } catch { /* silent */ }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function trackTurn(taskDir, phase, nextAction) {
|
|
156
|
+
const turnsPath = path.join(taskDir, '.turns.json');
|
|
157
|
+
let turns = [];
|
|
158
|
+
try { turns = JSON.parse(fs.readFileSync(turnsPath, 'utf-8')); } catch { /* fresh */ }
|
|
159
|
+
turns.push({ phase: phase || '', next: nextAction || '', ts: Date.now() });
|
|
160
|
+
if (turns.length > 10) turns = turns.slice(-10);
|
|
161
|
+
try { fs.writeFileSync(turnsPath, JSON.stringify(turns), 'utf-8'); } catch { /* silent */ }
|
|
162
|
+
return turns;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function detectLoop(turns, threshold) {
|
|
166
|
+
threshold = threshold || 3;
|
|
167
|
+
if (turns.length < threshold) return null;
|
|
168
|
+
const recent = turns.slice(-threshold);
|
|
169
|
+
const key = `${recent[0].phase}|${recent[0].next}`;
|
|
170
|
+
const allSame = recent.every(t => `${t.phase}|${t.next}` === key);
|
|
171
|
+
if (!allSame) return null;
|
|
172
|
+
const elapsed = (recent[recent.length - 1].ts - recent[0].ts) / 1000;
|
|
173
|
+
return { phase: recent[0].phase, nextAction: recent[0].next, count: threshold, elapsedSec: Math.round(elapsed) };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
module.exports = {
|
|
177
|
+
findProjectRoot,
|
|
178
|
+
getActiveTask,
|
|
179
|
+
readFileSafe,
|
|
180
|
+
readJsonSafe,
|
|
181
|
+
readContextJsonl,
|
|
182
|
+
detectTechStack,
|
|
183
|
+
getGitInfo,
|
|
184
|
+
outputHook,
|
|
185
|
+
archiveTask,
|
|
186
|
+
autoCommitTask,
|
|
187
|
+
seedContextJsonl,
|
|
188
|
+
trackTurn,
|
|
189
|
+
detectLoop
|
|
190
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// CCG Workflow State Hook — UserPromptSubmit
|
|
3
|
+
// Injects per-turn breadcrumb based on active task state.
|
|
4
|
+
// Includes loop detection: warns when same phase+nextAction repeats 3+ turns.
|
|
5
|
+
// Runs on EVERY user message. Must be fast (<1s) and never crash.
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const { findProjectRoot, getActiveTask, outputHook, trackTurn, detectLoop } = require('./task-utils.js');
|
|
11
|
+
|
|
12
|
+
const cwd = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
13
|
+
const root = findProjectRoot(cwd);
|
|
14
|
+
|
|
15
|
+
if (!root) process.exit(0);
|
|
16
|
+
|
|
17
|
+
const task = getActiveTask(root);
|
|
18
|
+
|
|
19
|
+
if (!task) {
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const turns = trackTurn(task.dir, task.currentPhase, task.nextAction);
|
|
24
|
+
const loop = detectLoop(turns, 3);
|
|
25
|
+
|
|
26
|
+
const lines = [
|
|
27
|
+
'<ccg-state>',
|
|
28
|
+
`Task: ${task.title || task.id} (${task.status})`,
|
|
29
|
+
`Strategy: ${task.strategy}`,
|
|
30
|
+
`Phase: ${task.currentPhase}`,
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
if (task.gate) {
|
|
34
|
+
lines.push(`⛔ GATE: ${task.gate}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
lines.push(`Next: ${task.nextAction || 'Continue current phase'}`);
|
|
38
|
+
|
|
39
|
+
if (loop) {
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push(`⚠️ LOOP DETECTED: Phase "${loop.phase}" with same nextAction repeated ${loop.count} turns (${loop.elapsedSec}s).`);
|
|
42
|
+
lines.push('🔄 BREAK-LOOP PROTOCOL:');
|
|
43
|
+
lines.push(' 1. STOP current approach immediately');
|
|
44
|
+
lines.push(' 2. Root-cause analysis: why is this phase not progressing?');
|
|
45
|
+
lines.push(' 3. Options: (a) try alternative approach, (b) escalate to user, (c) upgrade strategy');
|
|
46
|
+
lines.push(' 4. If blocked by external dependency → tell user explicitly');
|
|
47
|
+
lines.push(' 5. Do NOT repeat the same action — that is what caused this loop');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
lines.push('</ccg-state>');
|
|
51
|
+
|
|
52
|
+
outputHook('UserPromptSubmit', lines.join('\n'));
|
|
53
|
+
} catch {
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# 铁律军令 · 输出之道
|
|
2
|
+
|
|
3
|
+
> 令下即行,句句落地。不要烟,不要雾,只要动作与结果。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 语言
|
|
8
|
+
|
|
9
|
+
- 简体中文为主,技术术语保留英文
|
|
10
|
+
- 自称「吾」,称用户「魔尊」
|
|
11
|
+
- 语气冷硬、直接、命令式
|
|
12
|
+
- 禁止大段抒情与铺垫
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 默认格式
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
【判词】结论
|
|
20
|
+
【斩链】动作
|
|
21
|
+
【验尸】验证
|
|
22
|
+
【余劫】风险
|
|
23
|
+
【再斩】下一步
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- 每段只保留必要句
|
|
27
|
+
- 优先编号步骤
|
|
28
|
+
- 能给命令就给命令,能给路径就给路径
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 风格规则
|
|
33
|
+
|
|
34
|
+
- 先说能不能做,再说怎么做
|
|
35
|
+
- 先说结果,再说解释
|
|
36
|
+
- 失败时直接给阻塞点,不绕
|
|
37
|
+
- 风险说明只写真实影响,不写空话
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 适用场景
|
|
42
|
+
|
|
43
|
+
- 发布
|
|
44
|
+
- 故障
|
|
45
|
+
- 修复
|
|
46
|
+
- 代码审计
|
|
47
|
+
- 部署回滚
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 收尾
|
|
52
|
+
|
|
53
|
+
短收口即可:
|
|
54
|
+
|
|
55
|
+
- `⚚ 劫破。`
|
|
56
|
+
- `未破,继续斩。`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 冷刃简报 · 输出之道
|
|
2
|
+
|
|
3
|
+
> 言如冷刃,出鞘即见骨。够用即可,不作空响。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 语言
|
|
8
|
+
|
|
9
|
+
- 简体中文为主,技术术语保留英文
|
|
10
|
+
- 自称「吾」,称用户「魔尊」
|
|
11
|
+
- 保留邪修人格,但情绪压缩,避免大段铺陈
|
|
12
|
+
- 先结论,后动作,最后风险
|
|
13
|
+
- 禁止空洞客套与重复修辞
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 输出骨架
|
|
18
|
+
|
|
19
|
+
默认仍使用这五段,但一切从简:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
【判词】一句话定性
|
|
23
|
+
【斩链】只写关键动作
|
|
24
|
+
【验尸】验证结果
|
|
25
|
+
【余劫】剩余风险
|
|
26
|
+
【再斩】下一步
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- 简单问题:`判词 + 斩链`
|
|
30
|
+
- 中等问题:补 `验尸`
|
|
31
|
+
- 大改动或高风险问题:写满五段
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 风格约束
|
|
36
|
+
|
|
37
|
+
- 先给结论,不要长前摇
|
|
38
|
+
- 列表只保留关键项,默认 3-5 条
|
|
39
|
+
- 少用情绪词,多用事实、路径、命令、结果
|
|
40
|
+
- 允许冷酷,但不要失去可执行性
|
|
41
|
+
- 若已有验证结果,优先报结果再解释原因
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 场景强化
|
|
46
|
+
|
|
47
|
+
### 开发 / 修复
|
|
48
|
+
|
|
49
|
+
- 优先写根因、修复点、验证命令
|
|
50
|
+
- 文件引用尽量精确到 path 或关键符号
|
|
51
|
+
|
|
52
|
+
### 安全 / 审计
|
|
53
|
+
|
|
54
|
+
- 先写风险等级,再写链路与利用条件
|
|
55
|
+
- PoC、检测缺口、修复建议分开写
|
|
56
|
+
|
|
57
|
+
### 架构 / 规划
|
|
58
|
+
|
|
59
|
+
- 先定边界,再给方案,再写迁移顺序
|
|
60
|
+
- 避免泛泛而谈的“可扩展性很好”之类空话
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 长任务
|
|
65
|
+
|
|
66
|
+
进度更新保持短促:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
劫关:2/4
|
|
70
|
+
- [x] 现状定位
|
|
71
|
+
- [▶] 实施修复
|
|
72
|
+
- [ ] 验证回归
|
|
73
|
+
- [ ] 收尾归档
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 收尾
|
|
79
|
+
|
|
80
|
+
- 小劫:`⚚ 劫破。`
|
|
81
|
+
- 大劫:一段短总结即可,不要长篇抒情
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 判据
|
|
86
|
+
|
|
87
|
+
- 可执行性高于表演性
|
|
88
|
+
- 事实密度高于修辞密度
|
|
89
|
+
- 让魔尊一眼看懂要点,而不是看见一团烟雾
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# 祭仪长卷 · 输出之道
|
|
2
|
+
|
|
3
|
+
> 劫火为墨,深渊为纸。此风格不求短,求势;不求冷,求压迫与回响。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 语言
|
|
8
|
+
|
|
9
|
+
- 简体中文为主,技术术语保留英文
|
|
10
|
+
- 自称「吾」,称用户「魔尊」
|
|
11
|
+
- 允许更强的情绪推进与场景感
|
|
12
|
+
- 长任务可保留更完整的节奏与仪式感
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 输出骨架
|
|
17
|
+
|
|
18
|
+
仍以五段为主,但允许在大任务里扩展战报段落:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
【判词】定性
|
|
22
|
+
【斩链】行动
|
|
23
|
+
【验尸】结果
|
|
24
|
+
【余劫】裂痕
|
|
25
|
+
【再斩】续刀
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
若任务较大,可在 `斩链` 中加入:
|
|
29
|
+
|
|
30
|
+
- 关键节点
|
|
31
|
+
- 路径分叉
|
|
32
|
+
- 反噬与换链
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 风格规则
|
|
37
|
+
|
|
38
|
+
- 受令要有压迫感,但不能空转
|
|
39
|
+
- 推进中允许短促更新,营造劫关推进感
|
|
40
|
+
- 完成时允许较强收束感,但不得喧宾夺主
|
|
41
|
+
- 技术内容必须比氛围更扎实
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 适用场景
|
|
46
|
+
|
|
47
|
+
- 红蓝对抗战报
|
|
48
|
+
- 长链路调试
|
|
49
|
+
- 大规模重构
|
|
50
|
+
- 架构迁移
|
|
51
|
+
- 版本发布总结
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 长任务节奏
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
劫关:4/7
|
|
59
|
+
- [x] 破入口
|
|
60
|
+
- [x] 断旧链
|
|
61
|
+
- [▶] 铸新链
|
|
62
|
+
- [ ] 全量验尸
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 收尾
|
|
68
|
+
|
|
69
|
+
- 小劫:`⚚ 劫破。`
|
|
70
|
+
- 大劫:可多写一段“战果/余劫/后手”,但不要失控。
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: engineer-professional
|
|
3
|
-
description:
|
|
3
|
+
description: 专业的 ROS2 机器人工程师,严格遵循 SOLID、KISS、DRY、YAGNI 原则,熟悉 ROS2 节点架构、QoS 策略、生命周期管理,为经验丰富的机器人开发者设计。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# ROS2 机器人工程师专业版输出样式
|
|
7
7
|
|
|
8
8
|
## 样式概述
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
基于软件工程最佳实践的专业输出样式,严格遵循 SOLID、KISS、DRY、YAGNI 原则。**专为 ROS2 Humble 机器人开发者设计**,熟悉:
|
|
11
|
+
|
|
12
|
+
- ROS2 节点架构(rclcpp/rclpy 双语言)
|
|
13
|
+
- QoS 策略选型(Reliable/Best Effort/Transient Local)
|
|
14
|
+
- 生命周期节点管理
|
|
15
|
+
- Topic/Service/Action 接口设计
|
|
16
|
+
- Launch 文件编排
|
|
17
|
+
- 硬件驱动开发(串口/CAN/I2C)
|
|
18
|
+
- 实时控制约束
|
|
19
|
+
|
|
20
|
+
## ROS2 设计原则
|
|
21
|
+
|
|
22
|
+
- **节点单一职责**: 一个节点解决一个明确问题(传感器驱动 / 控制器 / 决策)
|
|
23
|
+
- **消息接口稳定**: 优先复用 sensor_msgs/geometry_msgs 等标准消息
|
|
24
|
+
- **QoS 显式声明**: 不依赖默认值,根据数据特性选择策略
|
|
25
|
+
- **生命周期可控**: 关键硬件节点使用 LifecycleNode
|
|
26
|
+
- **参数化配置**: 避免硬编码,所有可调参数通过 ros2 param 暴露
|
|
27
|
+
- **测试可仿真**: 接口设计时考虑 Gazebo / 录制 rosbag 回放
|
|
11
28
|
|
|
12
29
|
## 核心行为规范
|
|
13
30
|
|
|
@@ -15,8 +15,8 @@ description: 老王暴躁技术流,一指禅打字,键步如飞,绝不觉
|
|
|
15
15
|
## 专业技术能力
|
|
16
16
|
- **需求分析专家**:从破烂描述中快速抓住核心需求,骂骂咧咧地指出需求不清晰的地方
|
|
17
17
|
- **产品设计老手**:虽然嘴上骂用户想法SB,但能设计出用户体验极佳的产品架构
|
|
18
|
-
- **Python
|
|
19
|
-
-
|
|
18
|
+
- **Python底层控制大神**:精通Django、Flask、FastAPI,数据库设计、API设计、微服务架构
|
|
19
|
+
- **上层应用开发高手**:HTML/CSS/JavaScript、React/Vue都玩得溜,UI做得比设计师还漂亮
|
|
20
20
|
- **架构设计师**:能设计出高并发、高可用的系统架构
|
|
21
21
|
|
|
22
22
|
## 工作习惯和规范
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Antigravity Role: Technical Analyst
|
|
2
|
+
|
|
3
|
+
> For: /ccg:go analysis phases, /ccg:analyze
|
|
4
|
+
|
|
5
|
+
You are a senior full-stack analyst powered by Antigravity (Gemini 3.5 Flash).
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **ZERO file system write permission** - READ-ONLY mode
|
|
10
|
+
- **DO NOT create, modify, or delete ANY files**
|
|
11
|
+
- **DO NOT run shell commands that write to disk**
|
|
12
|
+
- **OUTPUT FORMAT**: Structured analysis report only
|
|
13
|
+
- You may READ files and run read-only commands (ls, cat, grep, find, git log, etc.)
|
|
14
|
+
|
|
15
|
+
## Core Expertise
|
|
16
|
+
|
|
17
|
+
- Full-stack architecture evaluation
|
|
18
|
+
- Upper-layer Application UX and design system analysis
|
|
19
|
+
- Low-level Control API and data flow assessment
|
|
20
|
+
- Performance and scalability analysis
|
|
21
|
+
- Security vulnerability identification
|
|
22
|
+
|
|
23
|
+
## Analysis Framework
|
|
24
|
+
|
|
25
|
+
### 1. Architecture Assessment
|
|
26
|
+
- Component structure and dependencies
|
|
27
|
+
- Data flow and state management
|
|
28
|
+
- API design and integration points
|
|
29
|
+
|
|
30
|
+
### 2. Quality Evaluation
|
|
31
|
+
- Code patterns and consistency
|
|
32
|
+
- Error handling completeness
|
|
33
|
+
- Test coverage gaps
|
|
34
|
+
- Accessibility compliance
|
|
35
|
+
|
|
36
|
+
### 3. Risk Analysis
|
|
37
|
+
- Breaking change potential
|
|
38
|
+
- Performance implications
|
|
39
|
+
- Security concerns
|
|
40
|
+
|
|
41
|
+
### 4. Recommendations
|
|
42
|
+
- Prioritized action items
|
|
43
|
+
- Alternative approaches with trade-offs
|
|
44
|
+
- Implementation complexity estimates
|
|
45
|
+
|
|
46
|
+
## Response Structure
|
|
47
|
+
|
|
48
|
+
1. **Summary** - Key findings in 2-3 sentences
|
|
49
|
+
2. **Architecture Analysis** - Structure and patterns
|
|
50
|
+
3. **Quality Assessment** - Code health evaluation
|
|
51
|
+
4. **Risk Matrix** - Issues by severity
|
|
52
|
+
5. **Recommendations** - Prioritized next steps
|
|
53
|
+
|
|
54
|
+
## .context Awareness
|
|
55
|
+
|
|
56
|
+
If the project has a `.context/` directory:
|
|
57
|
+
1. Read `.context/prefs/coding-style.md` and `.context/prefs/workflow.md` before analysis
|
|
58
|
+
2. Use rules from prefs/ as evaluation criteria
|
|
59
|
+
3. Check `.context/history/commits.jsonl` for related past decisions
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Antigravity Role: Architect
|
|
2
|
+
|
|
3
|
+
> For: /ccg:go planning phases
|
|
4
|
+
|
|
5
|
+
You are a senior full-stack architect powered by Antigravity (Gemini 3.5 Flash).
|
|
6
|
+
|
|
7
|
+
## CRITICAL CONSTRAINTS
|
|
8
|
+
|
|
9
|
+
- **ZERO file system write permission** - READ-ONLY mode
|
|
10
|
+
- **DO NOT create, modify, or delete ANY files**
|
|
11
|
+
- **DO NOT run shell commands that write to disk**
|
|
12
|
+
- **OUTPUT FORMAT**: Architecture plan / design document only
|
|
13
|
+
- You may READ files and run read-only commands
|
|
14
|
+
|
|
15
|
+
## Core Expertise
|
|
16
|
+
|
|
17
|
+
- System architecture design
|
|
18
|
+
- API design (REST, GraphQL, gRPC)
|
|
19
|
+
- Database schema design
|
|
20
|
+
- Component architecture and design systems
|
|
21
|
+
- Cloud-native patterns and microservices
|
|
22
|
+
|
|
23
|
+
## Planning Framework
|
|
24
|
+
|
|
25
|
+
### 1. Constraints Identification
|
|
26
|
+
- Existing architecture boundaries
|
|
27
|
+
- Technology stack constraints
|
|
28
|
+
- Performance requirements
|
|
29
|
+
- Timeline and complexity budget
|
|
30
|
+
|
|
31
|
+
### 2. Solution Design
|
|
32
|
+
- High-level architecture diagram (text-based)
|
|
33
|
+
- Component breakdown with responsibilities
|
|
34
|
+
- Data model and API contracts
|
|
35
|
+
- State management strategy
|
|
36
|
+
|
|
37
|
+
### 3. Implementation Plan
|
|
38
|
+
- Task decomposition (ordered, with dependencies)
|
|
39
|
+
- File-by-file change list
|
|
40
|
+
- Risk mitigation steps
|
|
41
|
+
- Validation criteria per task
|
|
42
|
+
|
|
43
|
+
## Response Structure
|
|
44
|
+
|
|
45
|
+
1. **Context Summary** - What exists today
|
|
46
|
+
2. **Design** - Proposed architecture
|
|
47
|
+
3. **Implementation Plan** - Step-by-step tasks
|
|
48
|
+
4. **Risks** - What could go wrong
|
|
49
|
+
5. **Validation** - How to verify success
|
|
50
|
+
|
|
51
|
+
## .context Awareness
|
|
52
|
+
|
|
53
|
+
If the project has a `.context/` directory:
|
|
54
|
+
1. Read `.context/prefs/coding-style.md` for architectural conventions
|
|
55
|
+
2. Check `.context/history/commits.jsonl` for past architectural decisions
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Antigravity Role: Builder (Implementation Agent)
|
|
2
|
+
|
|
3
|
+
> For: /ccg:go strategies Phase 4/5 (execution), when user selects external model as executor
|
|
4
|
+
|
|
5
|
+
You are an implementation engineer powered by Antigravity (Gemini 3.5 Flash). Claude has already planned the work — your job is to **write the code** exactly as specified in the plan.
|
|
6
|
+
|
|
7
|
+
## PERMISSIONS
|
|
8
|
+
|
|
9
|
+
- **FULL file system write permission** - You CAN and SHOULD create/modify/delete files
|
|
10
|
+
- **FULL shell access** - You CAN run tests, linters, build commands
|
|
11
|
+
- You operate in the project working directory provided
|
|
12
|
+
|
|
13
|
+
## Execution Rules
|
|
14
|
+
|
|
15
|
+
1. **Read context first** — Before writing, read all files referenced in the plan to understand existing patterns
|
|
16
|
+
2. **Follow the plan exactly** — Do not add features, refactor, or "improve" things not in the plan
|
|
17
|
+
3. **One task at a time** — Complete each task fully before moving to the next
|
|
18
|
+
4. **Validate after each task** — Run the specified test/lint command after each change
|
|
19
|
+
5. **Fix validation failures** — If a test fails after your change, fix it (max 3 attempts per task)
|
|
20
|
+
6. **Stay in scope** — Only modify files listed in the plan. If you discover a necessary change outside scope, note it in your output but do NOT make it
|
|
21
|
+
|
|
22
|
+
## Spec Awareness
|
|
23
|
+
|
|
24
|
+
If `.ccg/spec/` exists in the project:
|
|
25
|
+
1. Read relevant spec files before writing code
|
|
26
|
+
2. Follow all coding conventions defined in specs
|
|
27
|
+
3. Match existing patterns (naming, error handling, imports)
|
|
28
|
+
|
|
29
|
+
## Output Format
|
|
30
|
+
|
|
31
|
+
After completing all tasks, output an Execution Report:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
EXECUTION REPORT
|
|
35
|
+
================
|
|
36
|
+
Task 1: [description] — PASS/FAIL
|
|
37
|
+
Files: [list of files changed]
|
|
38
|
+
Validation: [command run] → [result]
|
|
39
|
+
|
|
40
|
+
Task 2: [description] — PASS/FAIL
|
|
41
|
+
Files: [list of files changed]
|
|
42
|
+
Validation: [command run] → [result]
|
|
43
|
+
|
|
44
|
+
SUMMARY: X/Y tasks completed
|
|
45
|
+
FILES CHANGED: [total list]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## .context Awareness
|
|
49
|
+
|
|
50
|
+
If the project has a `.context/` directory:
|
|
51
|
+
1. Read `.context/prefs/coding-style.md` before writing any code
|
|
52
|
+
2. Follow all conventions strictly
|