ccg-workflow 1.7.78 → 1.7.80
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 +3 -2
- package/README.zh-CN.md +4 -3
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccg-workflow.CiXIRxs4.mjs → ccg-workflow.DKLTZQCk.mjs} +151 -18
- package/package.json +4 -2
- package/templates/commands/commit.md +23 -1
- package/templates/commands/context.md +330 -0
- package/templates/prompts/codex/analyzer.md +8 -0
- package/templates/prompts/codex/architect.md +8 -0
- package/templates/prompts/codex/debugger.md +8 -0
- package/templates/prompts/codex/optimizer.md +7 -0
- package/templates/prompts/codex/reviewer.md +7 -0
- package/templates/prompts/codex/tester.md +7 -0
- package/templates/prompts/gemini/analyzer.md +8 -0
- package/templates/prompts/gemini/architect.md +8 -0
- package/templates/prompts/gemini/debugger.md +8 -0
- package/templates/prompts/gemini/frontend.md +8 -0
- package/templates/prompts/gemini/optimizer.md +7 -0
- package/templates/prompts/gemini/reviewer.md +7 -0
- package/templates/prompts/gemini/tester.md +7 -0
- package/templates/rules/ccg-skills.md +63 -0
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ A multi-model collaboration development system where Claude Code orchestrates Co
|
|
|
17
17
|
|
|
18
18
|
- **Zero-config model routing** — Frontend tasks automatically go to Gemini, backend tasks to Codex. No manual switching.
|
|
19
19
|
- **Security by design** — External models have no write access. They return patches; Claude reviews before applying.
|
|
20
|
-
- **
|
|
20
|
+
- **27 slash commands** — From planning to execution, git workflow to code review, all accessible via `/ccg:*`.
|
|
21
21
|
- **Spec-driven development** — Integrates [OPSX](https://github.com/fission-ai/opsx) to turn vague requirements into verifiable constraints, eliminating AI improvisation.
|
|
22
22
|
|
|
23
23
|
## Architecture
|
|
@@ -141,6 +141,7 @@ Supports: npm, homebrew, curl, powershell, cmd.
|
|
|
141
141
|
| Command | Description |
|
|
142
142
|
|---------|-------------|
|
|
143
143
|
| `/ccg:init` | Initialize project CLAUDE.md |
|
|
144
|
+
| `/ccg:context` | Project context management (.context/ init, log, compress, history) |
|
|
144
145
|
|
|
145
146
|
## Workflow Guides
|
|
146
147
|
|
|
@@ -352,4 +353,4 @@ MIT
|
|
|
352
353
|
|
|
353
354
|
---
|
|
354
355
|
|
|
355
|
-
v1.7.
|
|
356
|
+
v1.7.79 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues) | [Contributing](./CONTRIBUTING.md)
|
package/README.zh-CN.md
CHANGED
|
@@ -17,7 +17,7 @@ Claude Code 编排 Codex + Gemini 的多模型协作开发系统。前端任务
|
|
|
17
17
|
|
|
18
18
|
- **零配置模型路由** — 前端任务自动走 Gemini,后端任务自动走 Codex,无需手动切换。
|
|
19
19
|
- **安全设计** — 外部模型无写入权限,仅返回 Patch,由 Claude 审核后应用。
|
|
20
|
-
- **
|
|
20
|
+
- **27 个斜杠命令** — 从规划到执行、Git 工作流到代码审查,通过 `/ccg:*` 一站式访问。
|
|
21
21
|
- **规范驱动开发** — 集成 [OPSX](https://github.com/fission-ai/opsx),将模糊需求变成可验证约束,让 AI 没法自由发挥。
|
|
22
22
|
|
|
23
23
|
## 架构
|
|
@@ -141,6 +141,7 @@ npx ccg-workflow menu # 选择「安装 Claude Code」
|
|
|
141
141
|
| 命令 | 说明 |
|
|
142
142
|
|------|------|
|
|
143
143
|
| `/ccg:init` | 初始化项目 CLAUDE.md |
|
|
144
|
+
| `/ccg:context` | 项目上下文管理(.context 初始化/日志/压缩/历史) |
|
|
144
145
|
|
|
145
146
|
## 工作流指南
|
|
146
147
|
|
|
@@ -196,7 +197,7 @@ npx ccg-workflow menu # 选择「安装 Claude Code」
|
|
|
196
197
|
|
|
197
198
|
```
|
|
198
199
|
~/.claude/
|
|
199
|
-
├── commands/ccg/ #
|
|
200
|
+
├── commands/ccg/ # 27 个斜杠命令
|
|
200
201
|
├── agents/ccg/ # 子智能体
|
|
201
202
|
├── skills/ccg/ # 质量关卡 + 多 Agent 协同
|
|
202
203
|
├── bin/codeagent-wrapper
|
|
@@ -352,4 +353,4 @@ MIT
|
|
|
352
353
|
|
|
353
354
|
---
|
|
354
355
|
|
|
355
|
-
v1.7.
|
|
356
|
+
v1.7.79 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues) | [参与贡献](./CONTRIBUTING.md)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, a as i18n, s as showMainMenu, i as init, E as configMcp, F as version } from './shared/ccg-workflow.
|
|
4
|
+
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, a as i18n, s as showMainMenu, i as init, E as configMcp, F as version } from './shared/ccg-workflow.DKLTZQCk.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:util';
|
package/dist/index.d.mts
CHANGED
|
@@ -83,6 +83,7 @@ interface InstallResult {
|
|
|
83
83
|
installedCommands: string[];
|
|
84
84
|
installedPrompts: string[];
|
|
85
85
|
installedSkills?: number;
|
|
86
|
+
installedRules?: boolean;
|
|
86
87
|
errors: string[];
|
|
87
88
|
configPath: string;
|
|
88
89
|
binPath?: string;
|
|
@@ -149,6 +150,7 @@ interface UninstallResult {
|
|
|
149
150
|
removedPrompts: string[];
|
|
150
151
|
removedAgents: string[];
|
|
151
152
|
removedSkills: string[];
|
|
153
|
+
removedRules: boolean;
|
|
152
154
|
removedBin: boolean;
|
|
153
155
|
errors: string[];
|
|
154
156
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ interface InstallResult {
|
|
|
83
83
|
installedCommands: string[];
|
|
84
84
|
installedPrompts: string[];
|
|
85
85
|
installedSkills?: number;
|
|
86
|
+
installedRules?: boolean;
|
|
86
87
|
errors: string[];
|
|
87
88
|
configPath: string;
|
|
88
89
|
binPath?: string;
|
|
@@ -149,6 +150,7 @@ interface UninstallResult {
|
|
|
149
150
|
removedPrompts: string[];
|
|
150
151
|
removedAgents: string[];
|
|
151
152
|
removedSkills: string[];
|
|
153
|
+
removedRules: boolean;
|
|
152
154
|
removedBin: boolean;
|
|
153
155
|
errors: string[];
|
|
154
156
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.
|
|
1
|
+
export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.DKLTZQCk.mjs';
|
|
2
2
|
import 'ansis';
|
|
3
3
|
import 'inquirer';
|
|
4
4
|
import 'node:child_process';
|
|
@@ -10,7 +10,7 @@ import { parse, stringify } from 'smol-toml';
|
|
|
10
10
|
import i18next from 'i18next';
|
|
11
11
|
import ora from 'ora';
|
|
12
12
|
|
|
13
|
-
const version = "1.7.
|
|
13
|
+
const version = "1.7.80";
|
|
14
14
|
|
|
15
15
|
function isWindows() {
|
|
16
16
|
return process.platform === "win32";
|
|
@@ -174,16 +174,37 @@ function findPackageRoot$1(startDir) {
|
|
|
174
174
|
const PACKAGE_ROOT$1 = findPackageRoot$1(__dirname$2);
|
|
175
175
|
async function downloadBinaryFromRelease(binaryName, destPath) {
|
|
176
176
|
const url = `${BINARY_DOWNLOAD_URL}/${binaryName}`;
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
const MAX_ATTEMPTS = 3;
|
|
178
|
+
const TIMEOUT_MS = 6e4;
|
|
179
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
180
|
+
try {
|
|
181
|
+
const controller = new AbortController();
|
|
182
|
+
const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
183
|
+
const response = await fetch(url, { redirect: "follow", signal: controller.signal });
|
|
184
|
+
if (!response.ok) {
|
|
185
|
+
clearTimeout(timer);
|
|
186
|
+
if (attempt < MAX_ATTEMPTS) {
|
|
187
|
+
await new Promise((resolve) => setTimeout(resolve, attempt * 2e3));
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
193
|
+
clearTimeout(timer);
|
|
194
|
+
await fs.writeFile(destPath, buffer);
|
|
195
|
+
if (process.platform !== "win32") {
|
|
196
|
+
await fs.chmod(destPath, 493);
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
} catch {
|
|
200
|
+
if (attempt < MAX_ATTEMPTS) {
|
|
201
|
+
await new Promise((resolve) => setTimeout(resolve, attempt * 2e3));
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
185
206
|
}
|
|
186
|
-
return
|
|
207
|
+
return false;
|
|
187
208
|
}
|
|
188
209
|
const WORKFLOW_CONFIGS = [
|
|
189
210
|
{
|
|
@@ -482,6 +503,17 @@ const WORKFLOW_CONFIGS = [
|
|
|
482
503
|
order: 3,
|
|
483
504
|
description: "\u8BFB\u53D6 /ccg:plan \u8BA1\u5212\u6587\u4EF6\uFF0CCodex \u5168\u6743\u6267\u884C + \u591A\u6A21\u578B\u5BA1\u6838",
|
|
484
505
|
descriptionEn: "Read plan file from /ccg:plan, Codex executes + multi-model review"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
id: "context",
|
|
509
|
+
name: "\u9879\u76EE\u4E0A\u4E0B\u6587\u7BA1\u7406",
|
|
510
|
+
nameEn: "Project Context Manager",
|
|
511
|
+
category: "development",
|
|
512
|
+
commands: ["context"],
|
|
513
|
+
defaultSelected: true,
|
|
514
|
+
order: 4,
|
|
515
|
+
description: "\u521D\u59CB\u5316 .context \u76EE\u5F55\u3001\u8BB0\u5F55\u51B3\u7B56\u65E5\u5FD7\u3001\u538B\u7F29\u5F52\u6863\u3001\u67E5\u770B\u5386\u53F2",
|
|
516
|
+
descriptionEn: "Init .context dir, log decisions, compress, view history"
|
|
485
517
|
}
|
|
486
518
|
];
|
|
487
519
|
function getWorkflowConfigs() {
|
|
@@ -727,6 +759,28 @@ ${workflow.description}
|
|
|
727
759
|
result.success = false;
|
|
728
760
|
}
|
|
729
761
|
}
|
|
762
|
+
const rulesTemplateDir = join(templateDir, "rules");
|
|
763
|
+
const rulesDestDir = join(installDir, "rules");
|
|
764
|
+
if (await fs.pathExists(rulesTemplateDir)) {
|
|
765
|
+
try {
|
|
766
|
+
await fs.ensureDir(rulesDestDir);
|
|
767
|
+
const rulesFiles = await fs.readdir(rulesTemplateDir);
|
|
768
|
+
for (const file of rulesFiles) {
|
|
769
|
+
if (file.endsWith(".md")) {
|
|
770
|
+
const srcFile = join(rulesTemplateDir, file);
|
|
771
|
+
const destFile = join(rulesDestDir, file);
|
|
772
|
+
if (force || !await fs.pathExists(destFile)) {
|
|
773
|
+
const templateContent = await fs.readFile(srcFile, "utf-8");
|
|
774
|
+
const processedContent = replaceHomePathsInTemplate(templateContent, installDir);
|
|
775
|
+
await fs.writeFile(destFile, processedContent, "utf-8");
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
result.installedRules = true;
|
|
780
|
+
} catch (error) {
|
|
781
|
+
result.errors.push(`Failed to install rules: ${error}`);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
730
784
|
try {
|
|
731
785
|
const binDir = join(installDir, "bin");
|
|
732
786
|
await fs.ensureDir(binDir);
|
|
@@ -754,16 +808,13 @@ ${workflow.description}
|
|
|
754
808
|
result.binPath = binDir;
|
|
755
809
|
result.binInstalled = true;
|
|
756
810
|
} catch (verifyError) {
|
|
757
|
-
result.errors.push(`Binary verification failed: ${verifyError}`);
|
|
758
|
-
result.success = false;
|
|
811
|
+
result.errors.push(`Binary verification failed (non-blocking): ${verifyError}`);
|
|
759
812
|
}
|
|
760
813
|
} else {
|
|
761
|
-
result.errors.push(`Failed to download binary: ${binaryName} from GitHub Release. Check network or visit https://github.com/${GITHUB_REPO}/releases/tag/${RELEASE_TAG}`);
|
|
762
|
-
result.success = false;
|
|
814
|
+
result.errors.push(`Failed to download binary: ${binaryName} from GitHub Release (after 3 attempts). Check network or visit https://github.com/${GITHUB_REPO}/releases/tag/${RELEASE_TAG}`);
|
|
763
815
|
}
|
|
764
816
|
} catch (error) {
|
|
765
|
-
result.errors.push(`Failed to install codeagent-wrapper: ${error}`);
|
|
766
|
-
result.success = false;
|
|
817
|
+
result.errors.push(`Failed to install codeagent-wrapper (non-blocking): ${error}`);
|
|
767
818
|
}
|
|
768
819
|
result.configPath = commandsDir;
|
|
769
820
|
return result;
|
|
@@ -775,6 +826,7 @@ async function uninstallWorkflows(installDir) {
|
|
|
775
826
|
removedPrompts: [],
|
|
776
827
|
removedAgents: [],
|
|
777
828
|
removedSkills: [],
|
|
829
|
+
removedRules: false,
|
|
778
830
|
removedBin: false,
|
|
779
831
|
errors: []
|
|
780
832
|
};
|
|
@@ -782,6 +834,7 @@ async function uninstallWorkflows(installDir) {
|
|
|
782
834
|
join(installDir, ".ccg", "prompts");
|
|
783
835
|
const agentsDir = join(installDir, "agents", "ccg");
|
|
784
836
|
const skillsDir = join(installDir, "skills", "ccg");
|
|
837
|
+
const rulesDir = join(installDir, "rules");
|
|
785
838
|
const binDir = join(installDir, "bin");
|
|
786
839
|
const ccgConfigDir = join(installDir, ".ccg");
|
|
787
840
|
if (await fs.pathExists(commandsDir)) {
|
|
@@ -832,6 +885,20 @@ async function uninstallWorkflows(installDir) {
|
|
|
832
885
|
result.success = false;
|
|
833
886
|
}
|
|
834
887
|
}
|
|
888
|
+
if (await fs.pathExists(rulesDir)) {
|
|
889
|
+
try {
|
|
890
|
+
const ccgRuleFiles = ["ccg-skills.md", "ccg-grok-search.md"];
|
|
891
|
+
for (const ruleFile of ccgRuleFiles) {
|
|
892
|
+
const rulePath = join(rulesDir, ruleFile);
|
|
893
|
+
if (await fs.pathExists(rulePath)) {
|
|
894
|
+
await fs.remove(rulePath);
|
|
895
|
+
result.removedRules = true;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
} catch (error) {
|
|
899
|
+
result.errors.push(`Failed to remove rules: ${error}`);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
835
902
|
if (await fs.pathExists(binDir)) {
|
|
836
903
|
try {
|
|
837
904
|
const wrapperName = process.platform === "win32" ? "codeagent-wrapper.exe" : "codeagent-wrapper";
|
|
@@ -3103,6 +3170,12 @@ async function init(options = {}) {
|
|
|
3103
3170
|
console.log(` ${ansis.green("\u2713")} ${result.installedSkills} skills installed (quality gates + multi-agent)`);
|
|
3104
3171
|
console.log(ansis.gray(" \u2192 ~/.claude/skills/"));
|
|
3105
3172
|
}
|
|
3173
|
+
if (result.installedRules) {
|
|
3174
|
+
console.log();
|
|
3175
|
+
console.log(ansis.cyan(" Rules:"));
|
|
3176
|
+
console.log(` ${ansis.green("\u2713")} quality gate auto-trigger rules`);
|
|
3177
|
+
console.log(ansis.gray(" \u2192 ~/.claude/rules/ccg-skills.md"));
|
|
3178
|
+
}
|
|
3106
3179
|
if (result.errors.length > 0) {
|
|
3107
3180
|
console.log();
|
|
3108
3181
|
console.log(ansis.red(` \u26A0 ${i18n.t("init:installationErrors")}`));
|
|
@@ -3162,6 +3235,39 @@ ${exportCommand}
|
|
|
3162
3235
|
console.log(` ${ansis.cyan(exportCommand)}`);
|
|
3163
3236
|
}
|
|
3164
3237
|
}
|
|
3238
|
+
} else {
|
|
3239
|
+
const binDest = join(installDir, "bin");
|
|
3240
|
+
const binaryExt = process.platform === "win32" ? ".exe" : "";
|
|
3241
|
+
const platformLabel = process.platform === "darwin" ? process.arch === "arm64" ? "darwin-arm64" : "darwin-amd64" : process.platform === "linux" ? process.arch === "arm64" ? "linux-arm64" : "linux-amd64" : process.arch === "arm64" ? "windows-arm64" : "windows-amd64";
|
|
3242
|
+
const binaryFileName = `codeagent-wrapper-${platformLabel}${binaryExt}`;
|
|
3243
|
+
const destFileName = `codeagent-wrapper${binaryExt}`;
|
|
3244
|
+
const releaseUrl = `https://github.com/fengshao1227/ccg-workflow/releases/tag/preset`;
|
|
3245
|
+
console.log();
|
|
3246
|
+
console.log(ansis.red.bold(` \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557`));
|
|
3247
|
+
console.log(ansis.red.bold(` \u2551 \u26A0 codeagent-wrapper \u4E0B\u8F7D\u5931\u8D25 \u2551`));
|
|
3248
|
+
console.log(ansis.red.bold(` \u2551 Binary download failed (network issue) \u2551`));
|
|
3249
|
+
console.log(ansis.red.bold(` \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D`));
|
|
3250
|
+
console.log();
|
|
3251
|
+
console.log(ansis.yellow(` \u591A\u6A21\u578B\u534F\u4F5C\u547D\u4EE4 (/ccg:workflow, /ccg:plan \u7B49) \u9700\u8981\u6B64\u6587\u4EF6\u624D\u80FD\u5DE5\u4F5C\u3002`));
|
|
3252
|
+
console.log(ansis.yellow(` Multi-model commands require this binary to work.`));
|
|
3253
|
+
console.log();
|
|
3254
|
+
console.log(ansis.cyan(` \u624B\u52A8\u4FEE\u590D / Manual fix:`));
|
|
3255
|
+
console.log();
|
|
3256
|
+
console.log(ansis.white(` 1. \u4E0B\u8F7D / Download:`));
|
|
3257
|
+
console.log(ansis.cyan(` ${releaseUrl}`));
|
|
3258
|
+
console.log(ansis.gray(` \u2192 \u627E\u5230 ${ansis.white(binaryFileName)} \u5E76\u4E0B\u8F7D`));
|
|
3259
|
+
console.log();
|
|
3260
|
+
console.log(ansis.white(` 2. \u653E\u5230 / Place at:`));
|
|
3261
|
+
console.log(ansis.cyan(` ${binDest}/${destFileName}`));
|
|
3262
|
+
console.log();
|
|
3263
|
+
if (process.platform !== "win32") {
|
|
3264
|
+
console.log(ansis.white(` 3. \u52A0\u6743\u9650 / Make executable:`));
|
|
3265
|
+
console.log(ansis.cyan(` chmod +x "${binDest}/${destFileName}"`));
|
|
3266
|
+
console.log();
|
|
3267
|
+
}
|
|
3268
|
+
console.log(ansis.white(` \u6216\u91CD\u65B0\u5B89\u88C5 / Or re-install:`));
|
|
3269
|
+
console.log(ansis.cyan(` npx ccg-workflow@latest`));
|
|
3270
|
+
console.log();
|
|
3165
3271
|
}
|
|
3166
3272
|
if (mcpProvider === "skip" || (mcpProvider === "ace-tool" || mcpProvider === "ace-tool-rs") && !aceToolToken || mcpProvider === "contextweaver" && !contextWeaverApiKey) {
|
|
3167
3273
|
console.log();
|
|
@@ -3399,8 +3505,18 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
3399
3505
|
}
|
|
3400
3506
|
}
|
|
3401
3507
|
spinner = ora(i18n.t("update:removingOld")).start();
|
|
3508
|
+
const installDir = join(homedir(), ".claude");
|
|
3509
|
+
const binDir = join(installDir, "bin");
|
|
3510
|
+
const wrapperName = process.platform === "win32" ? "codeagent-wrapper.exe" : "codeagent-wrapper";
|
|
3511
|
+
const wrapperPath = join(binDir, wrapperName);
|
|
3512
|
+
const wrapperBackup = join(binDir, `${wrapperName}.bak`);
|
|
3513
|
+
let binaryBackedUp = false;
|
|
3402
3514
|
try {
|
|
3403
|
-
const
|
|
3515
|
+
const fsExtra = await import('fs-extra');
|
|
3516
|
+
if (await fsExtra.pathExists(wrapperPath)) {
|
|
3517
|
+
await fsExtra.copy(wrapperPath, wrapperBackup);
|
|
3518
|
+
binaryBackedUp = true;
|
|
3519
|
+
}
|
|
3404
3520
|
const uninstallResult = await uninstallWorkflows(installDir);
|
|
3405
3521
|
if (uninstallResult.success) {
|
|
3406
3522
|
spinner.succeed(i18n.t("update:oldRemoved"));
|
|
@@ -3416,13 +3532,19 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
3416
3532
|
spinner = ora(i18n.t("update:installingNew")).start();
|
|
3417
3533
|
try {
|
|
3418
3534
|
await execAsync$1(`npx --yes ccg-workflow@latest init --force --skip-mcp --skip-prompt`, {
|
|
3419
|
-
timeout:
|
|
3535
|
+
timeout: 3e5,
|
|
3536
|
+
// 5min — binary download from GitHub Release may be slow (especially in China)
|
|
3420
3537
|
env: {
|
|
3421
3538
|
...process.env,
|
|
3422
3539
|
CCG_UPDATE_MODE: "true"
|
|
3423
3540
|
}
|
|
3424
3541
|
});
|
|
3425
3542
|
spinner.succeed(i18n.t("update:installDone"));
|
|
3543
|
+
if (binaryBackedUp) {
|
|
3544
|
+
const fsExtra = await import('fs-extra');
|
|
3545
|
+
await fsExtra.remove(wrapperBackup).catch(() => {
|
|
3546
|
+
});
|
|
3547
|
+
}
|
|
3426
3548
|
const config = await readCcgConfig();
|
|
3427
3549
|
if (config?.workflows?.installed) {
|
|
3428
3550
|
console.log();
|
|
@@ -3433,6 +3555,17 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
3433
3555
|
}
|
|
3434
3556
|
} catch (error) {
|
|
3435
3557
|
spinner.fail(i18n.t("update:installFailed"));
|
|
3558
|
+
if (binaryBackedUp) {
|
|
3559
|
+
try {
|
|
3560
|
+
const fsExtra = await import('fs-extra');
|
|
3561
|
+
if (await fsExtra.pathExists(wrapperBackup)) {
|
|
3562
|
+
await fsExtra.ensureDir(binDir);
|
|
3563
|
+
await fsExtra.move(wrapperBackup, wrapperPath, { overwrite: true });
|
|
3564
|
+
console.log(ansis.yellow(` \u2022 codeagent-wrapper restored from backup`));
|
|
3565
|
+
}
|
|
3566
|
+
} catch {
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3436
3569
|
console.log(ansis.red(`${i18n.t("common:error")}: ${error}`));
|
|
3437
3570
|
console.log();
|
|
3438
3571
|
console.log(ansis.yellow(i18n.t("update:manualRetry")));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccg-workflow",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.80",
|
|
4
4
|
"description": "Claude + Codex + Gemini multi-model collaboration system - smart routing development workflow",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.17.1",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"templates/commands/team-exec.md",
|
|
55
55
|
"templates/commands/team-review.md",
|
|
56
56
|
"templates/commands/codex-exec.md",
|
|
57
|
+
"templates/commands/context.md",
|
|
57
58
|
"templates/commands/agents/",
|
|
58
59
|
"templates/prompts/codex/",
|
|
59
60
|
"templates/prompts/gemini/analyzer.md",
|
|
@@ -65,7 +66,8 @@
|
|
|
65
66
|
"templates/prompts/gemini/tester.md",
|
|
66
67
|
"templates/prompts/claude/",
|
|
67
68
|
"templates/output-styles/",
|
|
68
|
-
"templates/skills/"
|
|
69
|
+
"templates/skills/",
|
|
70
|
+
"templates/rules/"
|
|
69
71
|
],
|
|
70
72
|
"scripts": {
|
|
71
73
|
"dev": "tsx src/cli.ts",
|
|
@@ -68,7 +68,29 @@ description: '智能 Git 提交:分析改动生成 Conventional Commit 信息
|
|
|
68
68
|
|
|
69
69
|
**语言**:根据最近 50 次提交判断中文/英文
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### 📦 阶段 5:Context 压缩(若 .context/ 存在)
|
|
72
|
+
|
|
73
|
+
`[模式:上下文归档]`
|
|
74
|
+
|
|
75
|
+
仅在项目存在 `.context/` 目录时执行,否则跳过。
|
|
76
|
+
|
|
77
|
+
1. 获取当前分支名:`git branch --show-current`
|
|
78
|
+
2. 检查 `.context/current/branches/<branch>/session.log` 是否存在且非空
|
|
79
|
+
3. 若有内容:
|
|
80
|
+
- **脱敏**:扫描 token/key/password/secret 模式 → 替换为 `[REDACTED]`
|
|
81
|
+
- **压缩**:从 session.log 提取 decisions / bugs / alternatives,生成 ContextEntry JSON
|
|
82
|
+
- **追加**:将 ContextEntry 作为一行追加到 `.context/history/commits.jsonl`
|
|
83
|
+
- **重生成**:更新 `.context/history/commits.md` 人类视图
|
|
84
|
+
- **暂存**:`git add .context/history/`
|
|
85
|
+
- **清空**:清空 session.log(不删除文件)
|
|
86
|
+
- **Trailer**:在 commit message 中添加 `Context-Id: <uuid>` trailer
|
|
87
|
+
4. 若 session.log 为空或不存在,跳过此阶段
|
|
88
|
+
|
|
89
|
+
**ContextEntry 格式**参见 `/ccg:context` 命令中的 Schema 定义。
|
|
90
|
+
|
|
91
|
+
**失败降级**:若压缩过程出错,不阻断提交。写入 minimal ContextEntry(仅 summary + error),继续正常提交。
|
|
92
|
+
|
|
93
|
+
### ✅ 阶段 6:执行提交
|
|
72
94
|
|
|
73
95
|
`[模式:执行]`
|
|
74
96
|
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: '项目上下文管理:初始化 .context 目录、记录决策日志、压缩归档、查看历史'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Context - 项目上下文管理
|
|
6
|
+
|
|
7
|
+
管理 `.context/` 目录结构,为 LLM 工具提供决策审计链。
|
|
8
|
+
|
|
9
|
+
## 使用方法
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/context <subcommand> [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 子命令
|
|
16
|
+
|
|
17
|
+
| 子命令 | 说明 |
|
|
18
|
+
|--------|------|
|
|
19
|
+
| `init` | 初始化 `.context/` 目录结构 |
|
|
20
|
+
| `log <message>` | 手动追加决策日志到 session.log |
|
|
21
|
+
| `show` | 查看当前分支的 session.log |
|
|
22
|
+
| `compress` | 压缩 session.log → uncommit.md |
|
|
23
|
+
| `history` | 查看 history/commits.md |
|
|
24
|
+
| `squash <ids...>` | 合并多条 history 记录(配合 git squash) |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 执行工作流
|
|
29
|
+
|
|
30
|
+
### 子命令:init
|
|
31
|
+
|
|
32
|
+
`[模式:初始化]`
|
|
33
|
+
|
|
34
|
+
在当前项目根目录创建 `.context/` 结构:
|
|
35
|
+
|
|
36
|
+
1. 检测项目根目录(查找 `.git/`)
|
|
37
|
+
2. 若 `.context/` 已存在,跳过已有文件,仅补全缺失
|
|
38
|
+
3. 创建以下结构:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
.context/
|
|
42
|
+
├── .gitignore
|
|
43
|
+
├── .gitattributes
|
|
44
|
+
├── prefs/
|
|
45
|
+
│ ├── coding-style.md
|
|
46
|
+
│ └── workflow.md
|
|
47
|
+
├── current/
|
|
48
|
+
│ └── branches/
|
|
49
|
+
│ └── .gitkeep
|
|
50
|
+
└── history/
|
|
51
|
+
├── commits.jsonl
|
|
52
|
+
├── commits.md
|
|
53
|
+
└── archives/
|
|
54
|
+
└── .gitkeep
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
4. **创建 `.context/.gitignore`**:
|
|
58
|
+
|
|
59
|
+
```gitignore
|
|
60
|
+
# Ephemeral workspace — never commit
|
|
61
|
+
current/
|
|
62
|
+
|
|
63
|
+
# Raw interaction logs — always local only
|
|
64
|
+
**/session.log
|
|
65
|
+
**/session.raw.log
|
|
66
|
+
**/*.session.log
|
|
67
|
+
**/*.raw.log
|
|
68
|
+
|
|
69
|
+
# Editor / temp
|
|
70
|
+
**/*.tmp
|
|
71
|
+
**/*.bak
|
|
72
|
+
**/*.swp
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
5. **创建 `.context/.gitattributes`**:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
# JSONL append-only: 'union' merge reduces conflicts
|
|
79
|
+
history/commits.jsonl merge=union
|
|
80
|
+
history/archives/*.jsonl merge=union
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
6. **创建 `.context/prefs/coding-style.md`**(团队编码规范模板):
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
# Coding Style Guide
|
|
87
|
+
|
|
88
|
+
> 此文件定义团队编码规范,所有 LLM 工具在修改代码时必须遵守。
|
|
89
|
+
> 提交到 Git,团队共享。
|
|
90
|
+
|
|
91
|
+
## General
|
|
92
|
+
- Prefer small, reviewable changes; avoid unrelated refactors.
|
|
93
|
+
- Keep functions short (<50 lines); avoid deep nesting (≤3 levels).
|
|
94
|
+
- Name things explicitly; no single-letter variables except loop counters.
|
|
95
|
+
- Handle errors explicitly; never swallow errors silently.
|
|
96
|
+
|
|
97
|
+
## Language-Specific
|
|
98
|
+
<!-- 根据项目语言补充,例如:-->
|
|
99
|
+
<!-- ### TypeScript -->
|
|
100
|
+
<!-- - Use strict mode; prefer `interface` over `type` for object shapes. -->
|
|
101
|
+
|
|
102
|
+
## Git Commits
|
|
103
|
+
- Conventional Commits, imperative mood.
|
|
104
|
+
- Atomic commits: one logical change per commit.
|
|
105
|
+
|
|
106
|
+
## Testing
|
|
107
|
+
- Every feat/fix MUST include corresponding tests.
|
|
108
|
+
- Coverage must not decrease.
|
|
109
|
+
- Fix flow: write failing test FIRST, then fix code.
|
|
110
|
+
|
|
111
|
+
## Security
|
|
112
|
+
- Never log secrets (tokens/keys/cookies/JWT).
|
|
113
|
+
- Validate inputs at trust boundaries.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
7. **创建 `.context/prefs/workflow.md`**(LLM 工作流规则):
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
# Development Workflow Rules
|
|
120
|
+
|
|
121
|
+
> 此文件定义 LLM 开发工作流的强制规则。
|
|
122
|
+
> 所有 LLM 工具在执行任务时必须遵守,不可跳过任何步骤。
|
|
123
|
+
|
|
124
|
+
## Full Flow (MUST follow, no exceptions)
|
|
125
|
+
|
|
126
|
+
### feat (新功能)
|
|
127
|
+
1. 理解需求,分析影响范围
|
|
128
|
+
2. 读取现有代码,理解模式
|
|
129
|
+
3. 编写实现代码
|
|
130
|
+
4. 编写对应测试
|
|
131
|
+
5. 运行测试,修复失败
|
|
132
|
+
6. 更新文档(若 API 变更)
|
|
133
|
+
7. 自查 lint / type-check
|
|
134
|
+
|
|
135
|
+
### fix (缺陷修复)
|
|
136
|
+
1. 复现问题,确认症状
|
|
137
|
+
2. 定位根因
|
|
138
|
+
3. 编写失败测试(先有红灯)
|
|
139
|
+
4. 修复代码
|
|
140
|
+
5. 验证测试通过(变绿灯)
|
|
141
|
+
6. 回归测试
|
|
142
|
+
|
|
143
|
+
### refactor (重构)
|
|
144
|
+
1. 确保现有测试通过
|
|
145
|
+
2. 小步重构,每步可验证
|
|
146
|
+
3. 重构后测试必须全部通过
|
|
147
|
+
4. 不改变外部行为
|
|
148
|
+
|
|
149
|
+
## Context Logging (决策记录)
|
|
150
|
+
|
|
151
|
+
当你做出以下决策时,MUST 追加到 `.context/current/branches/<当前分支>/session.log`:
|
|
152
|
+
|
|
153
|
+
1. **方案选择**:选 A 不选 B 时,记录原因
|
|
154
|
+
2. **Bug 发现与修复**:根因 + 修复方法 + 教训
|
|
155
|
+
3. **API/架构决策**:接口设计选择
|
|
156
|
+
4. **放弃的方案**:为什么放弃
|
|
157
|
+
|
|
158
|
+
追加格式:
|
|
159
|
+
|
|
160
|
+
## <ISO-8601 时间>
|
|
161
|
+
**Decision**: <你选择了什么>
|
|
162
|
+
**Alternatives**: <被排除的方案>
|
|
163
|
+
**Reason**: <为什么>
|
|
164
|
+
**Risk**: <潜在风险>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
8. **创建 `.context/history/commits.jsonl`**(空文件)
|
|
168
|
+
|
|
169
|
+
9. **创建 `.context/history/commits.md`**(人类视图模板):
|
|
170
|
+
|
|
171
|
+
```markdown
|
|
172
|
+
# Commit Decision History
|
|
173
|
+
|
|
174
|
+
> 此文件是 `commits.jsonl` 的人类可读视图,可由工具重生成。
|
|
175
|
+
> Canonical store: `commits.jsonl` (JSONL, append-only)
|
|
176
|
+
|
|
177
|
+
| Date | Context-Id | Commit | Summary | Decisions | Bugs | Risk |
|
|
178
|
+
|------|-----------|--------|---------|-----------|------|------|
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
10. **注入 CLAUDE.md 引用**(若项目存在 CLAUDE.md):
|
|
182
|
+
|
|
183
|
+
检测项目根目录是否有 `CLAUDE.md`,若有则在末尾追加:
|
|
184
|
+
|
|
185
|
+
```markdown
|
|
186
|
+
|
|
187
|
+
## .context 项目上下文
|
|
188
|
+
|
|
189
|
+
> 项目使用 `.context/` 管理开发决策上下文。
|
|
190
|
+
|
|
191
|
+
- 编码规范:`.context/prefs/coding-style.md`
|
|
192
|
+
- 工作流规则:`.context/prefs/workflow.md`
|
|
193
|
+
- 决策历史:`.context/history/commits.md`
|
|
194
|
+
|
|
195
|
+
**规则**:修改代码前必读 prefs/,做决策时按 workflow.md 规则记录日志。
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
11. 输出初始化结果摘要
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### 子命令:log
|
|
203
|
+
|
|
204
|
+
`[模式:记录]`
|
|
205
|
+
|
|
206
|
+
1. 获取当前 Git 分支名:`git branch --show-current`
|
|
207
|
+
2. 确保 `.context/current/branches/<branch>/` 目录存在
|
|
208
|
+
3. 将 `<message>` 以结构化格式追加到 `session.log`:
|
|
209
|
+
|
|
210
|
+
```markdown
|
|
211
|
+
## <ISO-8601 当前时间>
|
|
212
|
+
<message>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### 子命令:show
|
|
218
|
+
|
|
219
|
+
`[模式:查看]`
|
|
220
|
+
|
|
221
|
+
1. 获取当前分支名
|
|
222
|
+
2. 读取 `.context/current/branches/<branch>/session.log`
|
|
223
|
+
3. 若不存在,提示 "当前分支暂无决策日志"
|
|
224
|
+
4. 输出内容
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### 子命令:compress
|
|
229
|
+
|
|
230
|
+
`[模式:压缩]`
|
|
231
|
+
|
|
232
|
+
将 `session.log` 压缩为结构化 `uncommit.md`,供提交前审查。
|
|
233
|
+
|
|
234
|
+
1. 读取 `.context/current/branches/<branch>/session.log`
|
|
235
|
+
2. 若为空,提示无内容可压缩
|
|
236
|
+
3. **脱敏**:扫描并替换潜在敏感信息(token/key/password → `[REDACTED]`)
|
|
237
|
+
4. **结构化提取**:从日志中提取 decisions / bugs / alternatives
|
|
238
|
+
5. **生成 uncommit.md**:
|
|
239
|
+
|
|
240
|
+
```markdown
|
|
241
|
+
# Pre-commit Summary: <branch-name>
|
|
242
|
+
|
|
243
|
+
| Time | Summary | Decision | Method | Result & Bug |
|
|
244
|
+
|------|---------|----------|--------|--------------|
|
|
245
|
+
| ... | ... | ... | ... | ... |
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
6. 输出压缩结果供用户审查
|
|
249
|
+
7. 提示用户:确认后可执行 `/ccg:commit` 提交
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### 子命令:history
|
|
254
|
+
|
|
255
|
+
`[模式:查看]`
|
|
256
|
+
|
|
257
|
+
1. 读取 `.context/history/commits.md`
|
|
258
|
+
2. 若不存在,提示 "暂无历史记录,请先使用 /ccg:context init"
|
|
259
|
+
3. 输出内容
|
|
260
|
+
4. 若用户指定文件路径,从 `commits.jsonl` 检索 `changes.files` 包含该路径的条目
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### 子命令:squash
|
|
265
|
+
|
|
266
|
+
`[模式:合并]`
|
|
267
|
+
|
|
268
|
+
配合 `git squash` 使用,合并多条 ContextEntry。
|
|
269
|
+
|
|
270
|
+
1. 接收 Context-Id 列表
|
|
271
|
+
2. 从 `commits.jsonl` 读取对应条目
|
|
272
|
+
3. 生成新的聚合 ContextEntry:
|
|
273
|
+
- 新 `context_id`(UUIDv7)
|
|
274
|
+
- `Context-Refs` = 所有被 squash 的 ids
|
|
275
|
+
- 合并 decisions / bugs / changes
|
|
276
|
+
4. 追加到 `commits.jsonl`
|
|
277
|
+
5. 重生成 `commits.md`
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## ContextEntry Schema (v1.0.0)
|
|
282
|
+
|
|
283
|
+
每条 JSONL 记录格式:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"schema_version": "1.0.0",
|
|
288
|
+
"context_id": "<UUIDv7>",
|
|
289
|
+
"created_at": "<ISO-8601>",
|
|
290
|
+
"producer": {
|
|
291
|
+
"tool": "<tool-name>",
|
|
292
|
+
"llm": { "provider": "<provider>", "model": "<model>" }
|
|
293
|
+
},
|
|
294
|
+
"git": {
|
|
295
|
+
"branch": "<branch>",
|
|
296
|
+
"commit_sha": "<short-sha>",
|
|
297
|
+
"trailers": { "Context-Id": "<uuid>" }
|
|
298
|
+
},
|
|
299
|
+
"summary": "<one-line summary>",
|
|
300
|
+
"decisions": [{
|
|
301
|
+
"title": "<decision title>",
|
|
302
|
+
"rationale": "<why>",
|
|
303
|
+
"tradeoffs": ["<tradeoff>"],
|
|
304
|
+
"assumptions": ["<assumption>"],
|
|
305
|
+
"rejected_alternatives": [{ "option": "<alt>", "reason": "<why rejected>" }],
|
|
306
|
+
"side_effects": ["<side effect>"]
|
|
307
|
+
}],
|
|
308
|
+
"bugs": [{
|
|
309
|
+
"symptom": "<what happened>",
|
|
310
|
+
"root_cause": "<why>",
|
|
311
|
+
"fix": "<how fixed>",
|
|
312
|
+
"lesson": "<takeaway>"
|
|
313
|
+
}],
|
|
314
|
+
"changes": { "files": ["<path>"] },
|
|
315
|
+
"tests": [{ "command": "<cmd>", "result": "<pass/fail>", "coverage": "<pct>" }],
|
|
316
|
+
"privacy": { "classification": "internal", "redactions_applied": true }
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 关键规则
|
|
323
|
+
|
|
324
|
+
1. **prefs/ 提交到 Git** — 团队共享编码规范
|
|
325
|
+
2. **current/ 永不提交** — 原始日志仅本地
|
|
326
|
+
3. **history/ 提交到 Git** — 永久决策归档
|
|
327
|
+
4. **commits.jsonl 是 canonical** — commits.md 可重生成
|
|
328
|
+
5. **UUIDv7 为主键** — 不依赖 commit SHA(rebase-safe)
|
|
329
|
+
6. **merge=union** — JSONL append 冲突自动合并
|
|
330
|
+
7. **脱敏先于一切** — 任何写入 history 前必须脱敏
|
|
@@ -48,3 +48,11 @@ You are a senior technical analyst specializing in architecture evaluation, solu
|
|
|
48
48
|
3. **Options** - Alternative approaches with pros/cons
|
|
49
49
|
4. **Recommendation** - Preferred approach with rationale
|
|
50
50
|
5. **Action Items** - Concrete next steps
|
|
51
|
+
|
|
52
|
+
## .context Awareness
|
|
53
|
+
|
|
54
|
+
If the project has a `.context/` directory:
|
|
55
|
+
1. Read `.context/prefs/coding-style.md` and `.context/prefs/workflow.md` before analysis
|
|
56
|
+
2. Use rules from prefs/ as evaluation criteria
|
|
57
|
+
3. When analyzing, check `.context/history/commits.jsonl` for related past decisions
|
|
58
|
+
4. Document your key decisions and trade-offs clearly in your output (they will be captured for future context)
|
|
@@ -44,3 +44,11 @@ You are a senior backend architect specializing in scalable API design, database
|
|
|
44
44
|
2. **Architecture Decision** - Key design choices with rationale
|
|
45
45
|
3. **Implementation** - Unified Diff Patch
|
|
46
46
|
4. **Considerations** - Performance, security, scaling notes
|
|
47
|
+
|
|
48
|
+
## .context Awareness
|
|
49
|
+
|
|
50
|
+
If the project has a `.context/` directory:
|
|
51
|
+
1. Read `.context/prefs/coding-style.md` and `.context/prefs/workflow.md` before designing
|
|
52
|
+
2. Follow all coding conventions defined in prefs/
|
|
53
|
+
3. Check `.context/history/commits.jsonl` for past architectural decisions on related modules
|
|
54
|
+
4. In your Architecture Decision section, clearly state: rationale, rejected alternatives, assumptions, and potential side effects (these will be captured as ContextEntry for future reference)
|
|
@@ -64,3 +64,11 @@ You are a senior debugging specialist focusing on backend systems, API issues, d
|
|
|
64
64
|
### Probable Root Cause
|
|
65
65
|
[Conclusion with reasoning]
|
|
66
66
|
```
|
|
67
|
+
|
|
68
|
+
## .context Awareness
|
|
69
|
+
|
|
70
|
+
If the project has a `.context/` directory:
|
|
71
|
+
1. Read `.context/prefs/workflow.md` for project-specific debugging rules
|
|
72
|
+
2. Check `.context/history/commits.jsonl` for past bugs on related files — search `bugs[]` and `changes.files` fields
|
|
73
|
+
3. Past decision context (assumptions, rejected alternatives) may reveal why code was written a certain way
|
|
74
|
+
4. Document your diagnosis clearly: symptom, root cause, fix, and lesson learned (will be captured for future context)
|
|
@@ -72,3 +72,10 @@ You are a senior performance engineer specializing in backend optimization, data
|
|
|
72
72
|
- Expected After: [metrics]
|
|
73
73
|
- How to measure: [commands/tools]
|
|
74
74
|
```
|
|
75
|
+
|
|
76
|
+
## .context Awareness
|
|
77
|
+
|
|
78
|
+
If the project has a `.context/` directory:
|
|
79
|
+
1. Read `.context/prefs/coding-style.md` for project performance conventions
|
|
80
|
+
2. Check `.context/history/commits.jsonl` for past optimization decisions — avoid re-doing work or reverting previous optimizations without reason
|
|
81
|
+
3. Document optimization trade-offs clearly in your output (will be captured for future context)
|
|
@@ -64,3 +64,10 @@ RECOMMENDATION: [PASS/NEEDS_IMPROVEMENT]
|
|
|
64
64
|
2. **Critical Issues** - Must fix before merge
|
|
65
65
|
3. **Suggestions** - Nice to have improvements
|
|
66
66
|
4. **Positive Notes** - What's done well
|
|
67
|
+
|
|
68
|
+
## .context Awareness
|
|
69
|
+
|
|
70
|
+
If the project has a `.context/` directory:
|
|
71
|
+
1. Read `.context/prefs/coding-style.md` as the primary review standard
|
|
72
|
+
2. Read `.context/prefs/workflow.md` to verify the full development flow was followed (tests written, docs updated, etc.)
|
|
73
|
+
3. Check `.context/history/commits.jsonl` for past decisions on the same files — flag if current changes contradict previous architectural decisions without justification
|
|
@@ -53,3 +53,10 @@ You are a senior test engineer specializing in backend testing, API testing, and
|
|
|
53
53
|
2. **Test Cases** - List of scenarios to cover
|
|
54
54
|
3. **Implementation** - Unified Diff Patch for test files
|
|
55
55
|
4. **Coverage Notes** - What's covered and what's not
|
|
56
|
+
|
|
57
|
+
## .context Awareness
|
|
58
|
+
|
|
59
|
+
If the project has a `.context/` directory:
|
|
60
|
+
1. Read `.context/prefs/coding-style.md` for testing conventions (naming, patterns, coverage requirements)
|
|
61
|
+
2. Read `.context/prefs/workflow.md` to understand required test flow (e.g., failing test first for bug fixes)
|
|
62
|
+
3. Check `.context/history/commits.jsonl` for past bugs on related files — ensure regression tests cover previously fixed issues
|
|
@@ -51,3 +51,11 @@ You are a senior UI/UX analyst specializing in design systems, user experience e
|
|
|
51
51
|
3. **Technical Considerations** - Frontend architecture impact
|
|
52
52
|
4. **Options** - Alternative approaches with trade-offs
|
|
53
53
|
5. **Recommendation** - Preferred approach with rationale
|
|
54
|
+
|
|
55
|
+
## .context Awareness
|
|
56
|
+
|
|
57
|
+
If the project has a `.context/` directory:
|
|
58
|
+
1. Read `.context/prefs/coding-style.md` and `.context/prefs/workflow.md` before analysis
|
|
59
|
+
2. Use rules from prefs/ as evaluation criteria
|
|
60
|
+
3. When analyzing, check `.context/history/commits.jsonl` for related past decisions
|
|
61
|
+
4. Document your key decisions and trade-offs clearly in your output (they will be captured for future context)
|
|
@@ -45,3 +45,11 @@ You are a senior frontend architect specializing in UI/UX design systems, compon
|
|
|
45
45
|
2. **Architecture Decision** - Key design choices with rationale
|
|
46
46
|
3. **Implementation Plan** - Step-by-step with pseudo-code
|
|
47
47
|
4. **Considerations** - Performance, accessibility, maintainability notes
|
|
48
|
+
|
|
49
|
+
## .context Awareness
|
|
50
|
+
|
|
51
|
+
If the project has a `.context/` directory:
|
|
52
|
+
1. Read `.context/prefs/coding-style.md` and `.context/prefs/workflow.md` before designing
|
|
53
|
+
2. Follow all coding conventions defined in prefs/
|
|
54
|
+
3. Check `.context/history/commits.jsonl` for past architectural decisions on related components
|
|
55
|
+
4. In your Architecture Decision section, clearly state: rationale, rejected alternatives, assumptions, and potential side effects (these will be captured as ContextEntry for future reference)
|
|
@@ -68,3 +68,11 @@ You are a senior frontend debugging specialist focusing on UI issues, component
|
|
|
68
68
|
### Probable Root Cause
|
|
69
69
|
[Conclusion with reasoning]
|
|
70
70
|
```
|
|
71
|
+
|
|
72
|
+
## .context Awareness
|
|
73
|
+
|
|
74
|
+
If the project has a `.context/` directory:
|
|
75
|
+
1. Read `.context/prefs/workflow.md` for project-specific debugging rules
|
|
76
|
+
2. Check `.context/history/commits.jsonl` for past bugs on related components — search `bugs[]` and `changes.files` fields
|
|
77
|
+
3. Past decision context (assumptions, rejected alternatives) may reveal why UI was built a certain way
|
|
78
|
+
4. Document your diagnosis clearly: symptom, root cause, fix, and lesson learned (will be captured for future context)
|
|
@@ -54,3 +54,11 @@ You are a senior frontend developer specializing in React applications, responsi
|
|
|
54
54
|
2. **Design Decisions** - UI/UX choices with rationale
|
|
55
55
|
3. **Implementation** - Unified Diff Patch
|
|
56
56
|
4. **Usage Example** - How to use the component
|
|
57
|
+
|
|
58
|
+
## .context Awareness
|
|
59
|
+
|
|
60
|
+
If the project has a `.context/` directory:
|
|
61
|
+
1. Read `.context/prefs/coding-style.md` and `.context/prefs/workflow.md` before coding
|
|
62
|
+
2. Follow all conventions (naming, patterns, testing requirements)
|
|
63
|
+
3. When making design decisions (choosing component patterns, state management, etc.), clearly state rationale and rejected alternatives in your output
|
|
64
|
+
4. Follow the full development flow from workflow.md (implement → test → docs)
|
|
@@ -75,3 +75,10 @@ You are a senior frontend performance engineer specializing in React optimizatio
|
|
|
75
75
|
- Expected after: [score]
|
|
76
76
|
- How to measure: [tools]
|
|
77
77
|
```
|
|
78
|
+
|
|
79
|
+
## .context Awareness
|
|
80
|
+
|
|
81
|
+
If the project has a `.context/` directory:
|
|
82
|
+
1. Read `.context/prefs/coding-style.md` for project performance conventions
|
|
83
|
+
2. Check `.context/history/commits.jsonl` for past optimization decisions — avoid re-doing work or reverting previous optimizations without reason
|
|
84
|
+
3. Document optimization trade-offs clearly in your output (will be captured for future context)
|
|
@@ -71,3 +71,10 @@ RECOMMENDATION: [PASS/NEEDS_IMPROVEMENT]
|
|
|
71
71
|
3. **Design Issues** - Inconsistencies
|
|
72
72
|
4. **Suggestions** - Improvements
|
|
73
73
|
5. **Positive Notes** - What's done well
|
|
74
|
+
|
|
75
|
+
## .context Awareness
|
|
76
|
+
|
|
77
|
+
If the project has a `.context/` directory:
|
|
78
|
+
1. Read `.context/prefs/coding-style.md` as the primary review standard
|
|
79
|
+
2. Read `.context/prefs/workflow.md` to verify the full development flow was followed (tests written, docs updated, etc.)
|
|
80
|
+
3. Check `.context/history/commits.jsonl` for past decisions on the same components — flag if current changes contradict previous design decisions without justification
|
|
@@ -59,3 +59,10 @@ You are a senior test engineer specializing in frontend testing, component testi
|
|
|
59
59
|
2. **Test Cases** - Scenarios to cover
|
|
60
60
|
3. **Implementation** - Unified Diff Patch for test files
|
|
61
61
|
4. **Accessibility Notes** - a11y test coverage
|
|
62
|
+
|
|
63
|
+
## .context Awareness
|
|
64
|
+
|
|
65
|
+
If the project has a `.context/` directory:
|
|
66
|
+
1. Read `.context/prefs/coding-style.md` for testing conventions (naming, patterns, coverage requirements)
|
|
67
|
+
2. Read `.context/prefs/workflow.md` to understand required test flow (e.g., failing test first for bug fixes)
|
|
68
|
+
3. Check `.context/history/commits.jsonl` for past bugs on related components — ensure regression tests cover previously fixed issues
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# CCG Quality Gates — Auto-trigger Rules
|
|
2
|
+
|
|
3
|
+
When working in a project, automatically invoke the corresponding quality gate skills based on the scenario below. These skills are installed at `~/.claude/skills/ccg/` and can be called directly.
|
|
4
|
+
|
|
5
|
+
## Trigger Rules
|
|
6
|
+
|
|
7
|
+
### New Module Created
|
|
8
|
+
|
|
9
|
+
When a new module/package/directory is created with source code:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/gen-docs <module-path> → Generate README.md + DESIGN.md skeleton
|
|
13
|
+
↓ (after development)
|
|
14
|
+
/verify-module <module-path> → Check structure completeness
|
|
15
|
+
↓
|
|
16
|
+
/verify-security <module-path> → Scan for security vulnerabilities
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Code Changes > 30 Lines
|
|
20
|
+
|
|
21
|
+
When a single task produces code changes exceeding 30 lines:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/verify-change → Analyze change impact, check doc sync
|
|
25
|
+
↓
|
|
26
|
+
/verify-quality <changed-path> → Check complexity, code smells, naming
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Security-Related Changes
|
|
30
|
+
|
|
31
|
+
When changes involve authentication, authorization, encryption, input validation, or secrets management:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
/verify-security <changed-path> → Scan for vulnerabilities
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Refactoring
|
|
38
|
+
|
|
39
|
+
When refactoring existing code:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
/verify-change → Ensure docs reflect the refactoring
|
|
43
|
+
↓
|
|
44
|
+
/verify-quality <refactored-path> → Verify quality improved
|
|
45
|
+
↓
|
|
46
|
+
/verify-security <refactored-path> → No new vulnerabilities introduced
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Execution Rules
|
|
50
|
+
|
|
51
|
+
1. **Non-blocking** — Quality gates produce reports but do NOT block delivery unless Critical issues are found
|
|
52
|
+
2. **Chainable** — Run gates in the order specified above; skip if previous gate fails
|
|
53
|
+
3. **Silent on pass** — Only report findings; do not output "all clear" messages for every gate
|
|
54
|
+
4. **Critical = must fix** — Only `Critical` / `High` severity findings require action before delivery
|
|
55
|
+
5. **Idempotent** — Safe to re-run; same input produces same output
|
|
56
|
+
|
|
57
|
+
## Multi-Agent Coordination
|
|
58
|
+
|
|
59
|
+
When a task involves 3+ independent files/modules or 2+ parallel workflows, refer to the multi-agent orchestration skill at `~/.claude/skills/ccg/orchestration/multi-agent/SKILL.md` for:
|
|
60
|
+
|
|
61
|
+
- Agent role assignment (Lead / Scout / Worker / Soldier / Drone)
|
|
62
|
+
- File ownership locking (one writer per file at any time)
|
|
63
|
+
- Task decomposition strategy (by file, by module, or by pipeline)
|