ccg-workflow 3.0.9 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccg-workflow.DF2nGUzy.mjs → ccg-workflow.B4hxlK6F.mjs} +127 -53
- package/package.json +2 -1
- package/templates/codex/AGENTS.md +78 -11
- package/templates/codex/agents/ccg-implement.toml +19 -17
- package/templates/codex/agents/ccg-review.toml +18 -23
- package/templates/codex/config.toml +2 -0
- package/templates/codex/hooks/ccg-workflow.py +36 -0
- package/templates/commands/go.md +3 -2
- package/templates/engine/strategies/full-collaborate.md +30 -18
- package/templates/engine/strategies/guided-develop.md +41 -17
- 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/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 {
|
|
4
|
+
import { B as diagnoseMcpConfig, C as isWindows, D as readClaudeCodeConfig, E as fixWindowsMcpConfig, F as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, a as i18n, s as showMainMenu, i as init, G as configMcp, H as version } from './shared/ccg-workflow.B4hxlK6F.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'ora';
|
|
7
7
|
import 'node:child_process';
|
package/dist/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ interface CliOptions {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
type SupportedLang = 'zh-CN' | 'en';
|
|
16
|
-
type ModelType = 'codex' | 'gemini' | 'claude';
|
|
16
|
+
type ModelType = 'codex' | 'gemini' | 'claude' | 'antigravity';
|
|
17
17
|
type CollaborationMode = 'parallel' | 'smart' | 'sequential';
|
|
18
18
|
type RoutingStrategy = 'parallel' | 'fallback' | 'round-robin';
|
|
19
19
|
interface ModelRouting {
|
|
@@ -162,6 +162,14 @@ declare function installCodexMode(): Promise<{
|
|
|
162
162
|
success: boolean;
|
|
163
163
|
message: string;
|
|
164
164
|
}>;
|
|
165
|
+
/**
|
|
166
|
+
* Uninstall CCG Codex mode — only removes files installed by CCG, preserves user files.
|
|
167
|
+
*/
|
|
168
|
+
declare function uninstallCodexMode(): Promise<{
|
|
169
|
+
success: boolean;
|
|
170
|
+
removed: string[];
|
|
171
|
+
skipped: string[];
|
|
172
|
+
}>;
|
|
165
173
|
declare function installWorkflows(workflowIds: string[], installDir: string, force?: boolean, config?: {
|
|
166
174
|
routing?: {
|
|
167
175
|
mode?: string;
|
|
@@ -244,5 +252,5 @@ declare function checkForUpdates(): Promise<{
|
|
|
244
252
|
latestVersion: string | null;
|
|
245
253
|
}>;
|
|
246
254
|
|
|
247
|
-
export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installAceToolRs, installCodexMode, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
|
|
255
|
+
export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installAceToolRs, installCodexMode, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallCodexMode, uninstallWorkflows, update, writeCcgConfig };
|
|
248
256
|
export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, FastContextConfig, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface CliOptions {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
type SupportedLang = 'zh-CN' | 'en';
|
|
16
|
-
type ModelType = 'codex' | 'gemini' | 'claude';
|
|
16
|
+
type ModelType = 'codex' | 'gemini' | 'claude' | 'antigravity';
|
|
17
17
|
type CollaborationMode = 'parallel' | 'smart' | 'sequential';
|
|
18
18
|
type RoutingStrategy = 'parallel' | 'fallback' | 'round-robin';
|
|
19
19
|
interface ModelRouting {
|
|
@@ -162,6 +162,14 @@ declare function installCodexMode(): Promise<{
|
|
|
162
162
|
success: boolean;
|
|
163
163
|
message: string;
|
|
164
164
|
}>;
|
|
165
|
+
/**
|
|
166
|
+
* Uninstall CCG Codex mode — only removes files installed by CCG, preserves user files.
|
|
167
|
+
*/
|
|
168
|
+
declare function uninstallCodexMode(): Promise<{
|
|
169
|
+
success: boolean;
|
|
170
|
+
removed: string[];
|
|
171
|
+
skipped: string[];
|
|
172
|
+
}>;
|
|
165
173
|
declare function installWorkflows(workflowIds: string[], installDir: string, force?: boolean, config?: {
|
|
166
174
|
routing?: {
|
|
167
175
|
mode?: string;
|
|
@@ -244,5 +252,5 @@ declare function checkForUpdates(): Promise<{
|
|
|
244
252
|
latestVersion: string | null;
|
|
245
253
|
}>;
|
|
246
254
|
|
|
247
|
-
export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installAceToolRs, installCodexMode, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
|
|
255
|
+
export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installAceToolRs, installCodexMode, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallCodexMode, uninstallWorkflows, update, writeCcgConfig };
|
|
248
256
|
export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, FastContextConfig, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as changeLanguage,
|
|
1
|
+
export { c as changeLanguage, z as checkForUpdates, A as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, x as getCurrentVersion, y as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, n as installCodexMode, k as installWorkflows, t as migrateToV1_4_0, v as needsMigration, r as readCcgConfig, s as showMainMenu, q as uninstallAceTool, o as uninstallCodexMode, p as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.B4hxlK6F.mjs';
|
|
2
2
|
import 'ansis';
|
|
3
3
|
import 'inquirer';
|
|
4
4
|
import 'ora';
|
|
@@ -10,7 +10,7 @@ import fs from 'fs-extra';
|
|
|
10
10
|
import { parse, stringify } from 'smol-toml';
|
|
11
11
|
import i18next from 'i18next';
|
|
12
12
|
|
|
13
|
-
const version = "3.0
|
|
13
|
+
const version = "3.1.0";
|
|
14
14
|
|
|
15
15
|
function cmd(id, order, category, name, nameEn, description, descriptionEn, cmdOverride) {
|
|
16
16
|
return {
|
|
@@ -121,7 +121,7 @@ function findPackageRoot$1(startDir) {
|
|
|
121
121
|
);
|
|
122
122
|
return startDir;
|
|
123
123
|
}
|
|
124
|
-
const PACKAGE_ROOT
|
|
124
|
+
const PACKAGE_ROOT = findPackageRoot$1(__dirname$2);
|
|
125
125
|
const MCP_PROVIDERS = {
|
|
126
126
|
"ace-tool": { tool: "mcp__ace-tool__search_context", param: "query" },
|
|
127
127
|
"ace-tool-rs": { tool: "mcp__ace-tool__search_context", param: "query" },
|
|
@@ -131,15 +131,15 @@ const MCP_PROVIDERS = {
|
|
|
131
131
|
function injectConfigVariables(content, config) {
|
|
132
132
|
let processed = content;
|
|
133
133
|
const routing = config.routing || {};
|
|
134
|
-
const frontendModels = routing.frontend?.models || ["
|
|
135
|
-
const frontendPrimary = routing.frontend?.primary || "
|
|
134
|
+
const frontendModels = routing.frontend?.models || ["antigravity"];
|
|
135
|
+
const frontendPrimary = routing.frontend?.primary || "antigravity";
|
|
136
136
|
processed = processed.replace(/\{\{FRONTEND_MODELS\}\}/g, JSON.stringify(frontendModels));
|
|
137
137
|
processed = processed.replace(/\{\{FRONTEND_PRIMARY\}\}/g, frontendPrimary);
|
|
138
138
|
const backendModels = routing.backend?.models || ["codex"];
|
|
139
139
|
const backendPrimary = routing.backend?.primary || "codex";
|
|
140
140
|
processed = processed.replace(/\{\{BACKEND_MODELS\}\}/g, JSON.stringify(backendModels));
|
|
141
141
|
processed = processed.replace(/\{\{BACKEND_PRIMARY\}\}/g, backendPrimary);
|
|
142
|
-
const reviewModels = routing.review?.models || ["codex", "
|
|
142
|
+
const reviewModels = routing.review?.models || ["codex", "antigravity"];
|
|
143
143
|
processed = processed.replace(/\{\{REVIEW_MODELS\}\}/g, JSON.stringify(reviewModels));
|
|
144
144
|
const routingMode = routing.mode || "smart";
|
|
145
145
|
processed = processed.replace(/\{\{ROUTING_MODE\}\}/g, routingMode);
|
|
@@ -814,7 +814,7 @@ async function removeFastContextPrompt() {
|
|
|
814
814
|
await removeFromFile(join(homedir(), ".gemini", "GEMINI.md"));
|
|
815
815
|
}
|
|
816
816
|
|
|
817
|
-
const EXPECTED_BINARY_VERSION = "5.
|
|
817
|
+
const EXPECTED_BINARY_VERSION = "5.11.0";
|
|
818
818
|
const GITHUB_REPO = "fengshao1227/ccg-workflow";
|
|
819
819
|
const RELEASE_TAG = "preset";
|
|
820
820
|
const BINARY_SOURCES = [
|
|
@@ -957,7 +957,7 @@ async function installPromptFiles(ctx) {
|
|
|
957
957
|
ctx.result.errors.push(`Prompts template directory not found: ${promptsTemplateDir}`);
|
|
958
958
|
return;
|
|
959
959
|
}
|
|
960
|
-
for (const model of ["codex", "gemini", "claude"]) {
|
|
960
|
+
for (const model of ["codex", "gemini", "claude", "antigravity"]) {
|
|
961
961
|
try {
|
|
962
962
|
const installed = await copyMdTemplates(
|
|
963
963
|
ctx,
|
|
@@ -1093,7 +1093,7 @@ async function installSkillGeneratedCommands(ctx) {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
async function installCodexMode() {
|
|
1096
|
-
const codexTemplateDir = join(PACKAGE_ROOT
|
|
1096
|
+
const codexTemplateDir = join(PACKAGE_ROOT, "templates", "codex");
|
|
1097
1097
|
if (!await fs.pathExists(codexTemplateDir)) {
|
|
1098
1098
|
return { success: false, message: "Codex template directory not found" };
|
|
1099
1099
|
}
|
|
@@ -1137,6 +1137,50 @@ async function installCodexMode() {
|
|
|
1137
1137
|
return { success: false, message: `Failed to install Codex mode: ${error}` };
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
+
async function uninstallCodexMode() {
|
|
1141
|
+
const codexHome = join(homedir(), ".codex");
|
|
1142
|
+
const removed = [];
|
|
1143
|
+
const skipped = [];
|
|
1144
|
+
const ccgFiles = [
|
|
1145
|
+
join(codexHome, "agents", "ccg-implement.toml"),
|
|
1146
|
+
join(codexHome, "agents", "ccg-review.toml"),
|
|
1147
|
+
join(codexHome, "agents", "ccg-research.toml"),
|
|
1148
|
+
join(codexHome, "hooks", "ccg-workflow.py"),
|
|
1149
|
+
join(codexHome, "hooks.json")
|
|
1150
|
+
];
|
|
1151
|
+
const agentsMd = join(codexHome, "AGENTS.md");
|
|
1152
|
+
try {
|
|
1153
|
+
for (const file of ccgFiles) {
|
|
1154
|
+
if (await fs.pathExists(file)) {
|
|
1155
|
+
await fs.remove(file);
|
|
1156
|
+
removed.push(file.replace(homedir(), "~"));
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (await fs.pathExists(agentsMd)) {
|
|
1160
|
+
const content = await fs.readFile(agentsMd, "utf-8");
|
|
1161
|
+
if (content.includes("<!-- CCG:START")) {
|
|
1162
|
+
await fs.remove(agentsMd);
|
|
1163
|
+
removed.push("~/.codex/AGENTS.md");
|
|
1164
|
+
} else {
|
|
1165
|
+
skipped.push("~/.codex/AGENTS.md (not managed by CCG)");
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
skipped.push("~/.codex/config.toml (preserved \u2014 may contain user settings)");
|
|
1169
|
+
for (const dir of ["agents", "hooks"]) {
|
|
1170
|
+
const dirPath = join(codexHome, dir);
|
|
1171
|
+
if (await fs.pathExists(dirPath)) {
|
|
1172
|
+
const files = await fs.readdir(dirPath);
|
|
1173
|
+
if (files.length === 0) {
|
|
1174
|
+
await fs.remove(dirPath);
|
|
1175
|
+
removed.push(`~/.codex/${dir}/ (empty, removed)`);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
return { success: true, removed, skipped };
|
|
1180
|
+
} catch (error) {
|
|
1181
|
+
return { success: false, removed, skipped: [...skipped, `Error: ${error}`] };
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1140
1184
|
async function installRuleFiles(ctx) {
|
|
1141
1185
|
try {
|
|
1142
1186
|
const installed = await copyMdTemplates(
|
|
@@ -1348,15 +1392,15 @@ async function installWorkflows(workflowIds, installDir, force = false, config)
|
|
|
1348
1392
|
config: {
|
|
1349
1393
|
routing: config?.routing || {
|
|
1350
1394
|
mode: "smart",
|
|
1351
|
-
frontend: { models: ["
|
|
1395
|
+
frontend: { models: ["antigravity"], primary: "antigravity" },
|
|
1352
1396
|
backend: { models: ["codex"], primary: "codex" },
|
|
1353
|
-
review: { models: ["codex", "
|
|
1397
|
+
review: { models: ["codex", "antigravity"] }
|
|
1354
1398
|
},
|
|
1355
1399
|
liteMode: config?.liteMode || false,
|
|
1356
1400
|
mcpProvider: config?.mcpProvider || "fast-context",
|
|
1357
1401
|
skipImpeccable: config?.skipImpeccable || false
|
|
1358
1402
|
},
|
|
1359
|
-
templateDir: join(PACKAGE_ROOT
|
|
1403
|
+
templateDir: join(PACKAGE_ROOT, "templates"),
|
|
1360
1404
|
result: {
|
|
1361
1405
|
success: true,
|
|
1362
1406
|
installedCommands: [],
|
|
@@ -1366,7 +1410,7 @@ async function installWorkflows(workflowIds, installDir, force = false, config)
|
|
|
1366
1410
|
}
|
|
1367
1411
|
};
|
|
1368
1412
|
if (!await fs.pathExists(ctx.templateDir)) {
|
|
1369
|
-
const errorMsg = `Template directory not found: ${ctx.templateDir} (PACKAGE_ROOT=${PACKAGE_ROOT
|
|
1413
|
+
const errorMsg = `Template directory not found: ${ctx.templateDir} (PACKAGE_ROOT=${PACKAGE_ROOT}). This usually means the npm package is incomplete or the cache is corrupted. Try: npm cache clean --force && npx ccg-workflow@latest`;
|
|
1370
1414
|
ctx.result.errors.push(errorMsg);
|
|
1371
1415
|
ctx.result.success = false;
|
|
1372
1416
|
return ctx.result;
|
|
@@ -1492,6 +1536,7 @@ const installer = {
|
|
|
1492
1536
|
syncMcpToCodex: syncMcpToCodex,
|
|
1493
1537
|
syncMcpToGemini: syncMcpToGemini,
|
|
1494
1538
|
uninstallAceTool: uninstallAceTool,
|
|
1539
|
+
uninstallCodexMode: uninstallCodexMode,
|
|
1495
1540
|
uninstallContextWeaver: uninstallContextWeaver,
|
|
1496
1541
|
uninstallFastContext: uninstallFastContext,
|
|
1497
1542
|
uninstallMcpServer: uninstallMcpServer,
|
|
@@ -2899,8 +2944,8 @@ function createDefaultConfig(options) {
|
|
|
2899
2944
|
function createDefaultRouting() {
|
|
2900
2945
|
return {
|
|
2901
2946
|
frontend: {
|
|
2902
|
-
models: ["
|
|
2903
|
-
primary: "
|
|
2947
|
+
models: ["antigravity"],
|
|
2948
|
+
primary: "antigravity",
|
|
2904
2949
|
strategy: "parallel"
|
|
2905
2950
|
},
|
|
2906
2951
|
backend: {
|
|
@@ -2909,7 +2954,7 @@ function createDefaultRouting() {
|
|
|
2909
2954
|
strategy: "parallel"
|
|
2910
2955
|
},
|
|
2911
2956
|
review: {
|
|
2912
|
-
models: ["codex", "
|
|
2957
|
+
models: ["codex", "antigravity"],
|
|
2913
2958
|
strategy: "parallel"
|
|
2914
2959
|
},
|
|
2915
2960
|
mode: "smart"
|
|
@@ -2990,6 +3035,18 @@ async function migrateToV1_4_0() {
|
|
|
2990
3035
|
return result;
|
|
2991
3036
|
}
|
|
2992
3037
|
async function needsMigration() {
|
|
3038
|
+
try {
|
|
3039
|
+
const configPath = join(homedir(), ".claude", ".ccg", "config.toml");
|
|
3040
|
+
if (await fs.pathExists(configPath)) {
|
|
3041
|
+
const content = await fs.readFile(configPath, "utf-8");
|
|
3042
|
+
const versionMatch = content.match(/version\s*=\s*"([^"]+)"/);
|
|
3043
|
+
if (versionMatch) {
|
|
3044
|
+
const major = Number.parseInt(versionMatch[1].split(".")[0], 10);
|
|
3045
|
+
if (major >= 2) return false;
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
} catch {
|
|
3049
|
+
}
|
|
2993
3050
|
const oldCcgDir = join(homedir(), ".ccg");
|
|
2994
3051
|
const oldPromptsDir = join(homedir(), ".claude", "prompts", "ccg");
|
|
2995
3052
|
const oldConfigFile = join(homedir(), ".claude", "commands", "ccg", "_config.md");
|
|
@@ -3146,7 +3203,7 @@ async function init(options = {}) {
|
|
|
3146
3203
|
language = options.lang;
|
|
3147
3204
|
await initI18n(language);
|
|
3148
3205
|
}
|
|
3149
|
-
let frontendModels = ["
|
|
3206
|
+
let frontendModels = ["antigravity"];
|
|
3150
3207
|
let backendModels = ["codex"];
|
|
3151
3208
|
let geminiModel = "gemini-3.1-pro-preview";
|
|
3152
3209
|
const mode = "smart";
|
|
@@ -3154,7 +3211,7 @@ async function init(options = {}) {
|
|
|
3154
3211
|
if (options.skipPrompt) {
|
|
3155
3212
|
const existingConfig = await readCcgConfig();
|
|
3156
3213
|
if (existingConfig?.routing) {
|
|
3157
|
-
frontendModels = existingConfig.routing.frontend?.models || ["
|
|
3214
|
+
frontendModels = existingConfig.routing.frontend?.models || ["antigravity"];
|
|
3158
3215
|
backendModels = existingConfig.routing.backend?.models || ["codex"];
|
|
3159
3216
|
geminiModel = existingConfig.routing.geminiModel || "gemini-3.1-pro-preview";
|
|
3160
3217
|
}
|
|
@@ -3278,11 +3335,12 @@ async function init(options = {}) {
|
|
|
3278
3335
|
name: "selectedFrontend",
|
|
3279
3336
|
message: i18n.t("init:model.selectFrontend"),
|
|
3280
3337
|
choices: [
|
|
3281
|
-
{ name: `
|
|
3338
|
+
{ name: `Antigravity ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "antigravity" },
|
|
3339
|
+
{ name: "Gemini", value: "gemini" },
|
|
3282
3340
|
{ name: "Codex", value: "codex" },
|
|
3283
3341
|
...navSentinels(canGoBack)
|
|
3284
3342
|
],
|
|
3285
|
-
default: frontendModels[0] || "
|
|
3343
|
+
default: frontendModels[0] || "antigravity"
|
|
3286
3344
|
}]);
|
|
3287
3345
|
if (selectedFrontend === BACK_SENTINEL)
|
|
3288
3346
|
return "back";
|
|
@@ -3293,8 +3351,9 @@ async function init(options = {}) {
|
|
|
3293
3351
|
name: "selectedBackend",
|
|
3294
3352
|
message: i18n.t("init:model.selectBackend"),
|
|
3295
3353
|
choices: [
|
|
3296
|
-
{ name: "
|
|
3297
|
-
{ name:
|
|
3354
|
+
{ name: `Codex ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "codex" },
|
|
3355
|
+
{ name: "Antigravity", value: "antigravity" },
|
|
3356
|
+
{ name: "Gemini", value: "gemini" }
|
|
3298
3357
|
],
|
|
3299
3358
|
default: backendModels[0] || "codex"
|
|
3300
3359
|
}]);
|
|
@@ -3983,30 +4042,11 @@ function findPackageRoot(startDir) {
|
|
|
3983
4042
|
dir = parentDir;
|
|
3984
4043
|
}
|
|
3985
4044
|
}
|
|
3986
|
-
|
|
3987
|
-
async function readPackageVersion(pkgPath) {
|
|
3988
|
-
try {
|
|
3989
|
-
if (!await fs.pathExists(pkgPath)) {
|
|
3990
|
-
return null;
|
|
3991
|
-
}
|
|
3992
|
-
const pkg = await fs.readJSON(pkgPath);
|
|
3993
|
-
return pkg.version || null;
|
|
3994
|
-
} catch {
|
|
3995
|
-
return null;
|
|
3996
|
-
}
|
|
3997
|
-
}
|
|
4045
|
+
findPackageRoot(__dirname$1);
|
|
3998
4046
|
async function getCurrentVersion() {
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
if (relativeVersion) {
|
|
4002
|
-
return relativeVersion;
|
|
4003
|
-
}
|
|
4004
|
-
const rootPkgPath = join(PACKAGE_ROOT, "package.json");
|
|
4005
|
-
const rootVersion = await readPackageVersion(rootPkgPath);
|
|
4006
|
-
if (rootVersion) {
|
|
4007
|
-
return rootVersion;
|
|
4047
|
+
{
|
|
4048
|
+
return version;
|
|
4008
4049
|
}
|
|
4009
|
-
return process.env.npm_package_version || "0.0.0";
|
|
4010
4050
|
}
|
|
4011
4051
|
async function getLatestVersion(packageName = "ccg-workflow") {
|
|
4012
4052
|
try {
|
|
@@ -4641,7 +4681,7 @@ async function configModelRouting() {
|
|
|
4641
4681
|
console.log();
|
|
4642
4682
|
console.log(ansis.cyan.bold(` ${i18n.t("init:model.title")}`));
|
|
4643
4683
|
console.log();
|
|
4644
|
-
const currentFrontend = config?.routing?.frontend?.primary || "
|
|
4684
|
+
const currentFrontend = config?.routing?.frontend?.primary || "antigravity";
|
|
4645
4685
|
const currentBackend = config?.routing?.backend?.primary || "codex";
|
|
4646
4686
|
const currentGeminiModel = config?.routing?.geminiModel || "gemini-3.1-pro-preview";
|
|
4647
4687
|
console.log(ansis.gray(` ${i18n.t("init:model.currentRouting")}:`));
|
|
@@ -4656,7 +4696,8 @@ async function configModelRouting() {
|
|
|
4656
4696
|
name: "selectedFrontend",
|
|
4657
4697
|
message: i18n.t("init:model.selectFrontend"),
|
|
4658
4698
|
choices: [
|
|
4659
|
-
{ name: `
|
|
4699
|
+
{ name: `Antigravity ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "antigravity" },
|
|
4700
|
+
{ name: "Gemini", value: "gemini" },
|
|
4660
4701
|
{ name: "Codex", value: "codex" }
|
|
4661
4702
|
],
|
|
4662
4703
|
default: currentFrontend
|
|
@@ -4666,8 +4707,9 @@ async function configModelRouting() {
|
|
|
4666
4707
|
name: "selectedBackend",
|
|
4667
4708
|
message: i18n.t("init:model.selectBackend"),
|
|
4668
4709
|
choices: [
|
|
4669
|
-
{ name: "
|
|
4670
|
-
{ name:
|
|
4710
|
+
{ name: `Codex ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "codex" },
|
|
4711
|
+
{ name: "Antigravity", value: "antigravity" },
|
|
4712
|
+
{ name: "Gemini", value: "gemini" }
|
|
4671
4713
|
],
|
|
4672
4714
|
default: currentBackend
|
|
4673
4715
|
}]);
|
|
@@ -4791,16 +4833,48 @@ async function handleCodexMode() {
|
|
|
4791
4833
|
console.log();
|
|
4792
4834
|
console.log(ansis.cyan.bold(isZh ? " Codex \u591A\u6A21\u578B\u7F16\u6392\u6A21\u5F0F" : " Codex Multi-Model Orchestration Mode"));
|
|
4793
4835
|
console.log();
|
|
4836
|
+
const { action } = await inquirer.prompt([{
|
|
4837
|
+
type: "list",
|
|
4838
|
+
name: "action",
|
|
4839
|
+
message: isZh ? "\u9009\u62E9\u64CD\u4F5C" : "Select action",
|
|
4840
|
+
choices: [
|
|
4841
|
+
{ name: isZh ? "\u5B89\u88C5 / \u66F4\u65B0 Codex \u6A21\u5F0F" : "Install / Update Codex Mode", value: "install" },
|
|
4842
|
+
{ name: isZh ? "\u5378\u8F7D Codex \u6A21\u5F0F\uFF08\u53EA\u5220 CCG \u6587\u4EF6\uFF0C\u4FDD\u7559\u7528\u6237\u914D\u7F6E\uFF09" : "Uninstall Codex Mode (CCG files only, preserves user config)", value: "uninstall" },
|
|
4843
|
+
{ name: isZh ? "\u8FD4\u56DE" : "Back", value: "back" }
|
|
4844
|
+
]
|
|
4845
|
+
}]);
|
|
4846
|
+
if (action === "back") return;
|
|
4847
|
+
if (action === "uninstall") {
|
|
4848
|
+
const spinner2 = ora(isZh ? "\u5378\u8F7D Codex \u6A21\u5F0F..." : "Uninstalling Codex mode...").start();
|
|
4849
|
+
const result2 = await uninstallCodexMode();
|
|
4850
|
+
if (result2.success) {
|
|
4851
|
+
spinner2.succeed(isZh ? "Codex \u6A21\u5F0F\u5DF2\u5378\u8F7D" : "Codex mode uninstalled");
|
|
4852
|
+
if (result2.removed.length > 0) {
|
|
4853
|
+
console.log();
|
|
4854
|
+
for (const f of result2.removed) {
|
|
4855
|
+
console.log(` ${ansis.red("\u2717")} ${f}`);
|
|
4856
|
+
}
|
|
4857
|
+
}
|
|
4858
|
+
if (result2.skipped.length > 0) {
|
|
4859
|
+
console.log();
|
|
4860
|
+
for (const f of result2.skipped) {
|
|
4861
|
+
console.log(` ${ansis.gray("\u25CB")} ${f}`);
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
} else {
|
|
4865
|
+
spinner2.fail(isZh ? "\u5378\u8F7D\u5931\u8D25" : "Uninstall failed");
|
|
4866
|
+
}
|
|
4867
|
+
return;
|
|
4868
|
+
}
|
|
4794
4869
|
console.log(
|
|
4795
|
-
isZh ? " \u5B89\u88C5 CCG Codex \u6A21\u5F0F\u5230 ~/.codex/\uFF0C\u8BA9 Codex CLI \u4F5C\u4E3A\u4E3B\u5BFC\u8005\u7F16\u6392
|
|
4870
|
+
isZh ? " \u5B89\u88C5 CCG Codex \u6A21\u5F0F\u5230 ~/.codex/\uFF0C\u8BA9 Codex CLI \u4F5C\u4E3A\u4E3B\u5BFC\u8005\u7F16\u6392\u591A\u6A21\u578B\u3002" : " Install CCG Codex mode to ~/.codex/, enabling Codex CLI as lead orchestrator."
|
|
4796
4871
|
);
|
|
4797
4872
|
console.log();
|
|
4798
4873
|
console.log(isZh ? " \u5C06\u5B89\u88C5:" : " Will install:");
|
|
4799
|
-
console.log(" ~/.codex/AGENTS.md \u2014
|
|
4874
|
+
console.log(" ~/.codex/AGENTS.md \u2014 orchestration instructions");
|
|
4800
4875
|
console.log(" ~/.codex/config.toml \u2014 multi-agent + timeout config");
|
|
4801
|
-
console.log(" ~/.codex/
|
|
4802
|
-
console.log(" ~/.codex/agents/ccg-
|
|
4803
|
-
console.log(" ~/.codex/agents/ccg-research.toml");
|
|
4876
|
+
console.log(" ~/.codex/hooks.json + hooks/ \u2014 adaptive guardrail hook");
|
|
4877
|
+
console.log(" ~/.codex/agents/ccg-*.toml \u2014 sub-agent definitions");
|
|
4804
4878
|
console.log();
|
|
4805
4879
|
const { confirm } = await inquirer.prompt([{
|
|
4806
4880
|
type: "confirm",
|
|
@@ -5077,4 +5151,4 @@ async function uninstallCCometixLine() {
|
|
|
5077
5151
|
}
|
|
5078
5152
|
}
|
|
5079
5153
|
|
|
5080
|
-
export {
|
|
5154
|
+
export { compareVersions as A, diagnoseMcpConfig as B, isWindows as C, readClaudeCodeConfig as D, fixWindowsMcpConfig as E, writeClaudeCodeConfig as F, configMcp as G, version as H, i18n as a, initI18n as b, changeLanguage as c, createDefaultConfig as d, createDefaultRouting as e, getConfigPath as f, getCcgDir as g, getWorkflowConfigs as h, init as i, getWorkflowById as j, installWorkflows as k, installAceTool as l, installAceToolRs as m, installCodexMode as n, uninstallCodexMode as o, uninstallWorkflows as p, uninstallAceTool as q, readCcgConfig as r, showMainMenu as s, migrateToV1_4_0 as t, update as u, needsMigration as v, writeCcgConfig as w, getCurrentVersion as x, getLatestVersion as y, checkForUpdates as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccg-workflow",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
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",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"templates/prompts/gemini/reviewer.md",
|
|
43
43
|
"templates/prompts/gemini/tester.md",
|
|
44
44
|
"templates/prompts/claude/",
|
|
45
|
+
"templates/prompts/antigravity/",
|
|
45
46
|
"templates/output-styles/",
|
|
46
47
|
"templates/skills/",
|
|
47
48
|
"templates/rules/"
|
|
@@ -178,27 +178,94 @@ EOF
|
|
|
178
178
|
### 并行调用提醒
|
|
179
179
|
M+ 复杂度的分析和审查,使用上方的"双模型并行"模板。不要分开调用,用 `&` + `wait` 并行执行。
|
|
180
180
|
|
|
181
|
-
## 5. Implementation —
|
|
181
|
+
## 5. Implementation — 写代码
|
|
182
182
|
|
|
183
|
-
###
|
|
183
|
+
### 模式选择
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
| 复杂度 | 模式 | 说明 |
|
|
186
|
+
|--------|------|------|
|
|
187
|
+
| **S-M** | **Inline** — 你自己写 | 逐文件按 plan 顺序,最稳定 |
|
|
188
|
+
| **L+** | **Parallel** — spawn 子代理 | 按文件归属拆分,并行写,快 2-4x |
|
|
186
189
|
|
|
187
|
-
###
|
|
190
|
+
### 模式 A: Inline(S-M 复杂度)
|
|
191
|
+
|
|
192
|
+
按 plan.md 步骤顺序逐个文件写:
|
|
193
|
+
1. 先写底层(store/model/util),再写上层(route/middleware)
|
|
194
|
+
2. 每写完一个文件跑测试/类型检查
|
|
195
|
+
3. 全部完成后跑完整测试套件
|
|
196
|
+
4. `git diff` 确认变更在 plan 范围内
|
|
197
|
+
|
|
198
|
+
### 模式 B: Parallel Spawn(L+ 复杂度)
|
|
199
|
+
|
|
200
|
+
#### Step 1: 从 plan.md 拆分子任务
|
|
201
|
+
|
|
202
|
+
按**文件归属**拆分,确保子任务互不重叠:
|
|
203
|
+
- **Layer 1** — 无依赖的任务(可并行)
|
|
204
|
+
- **Layer 2** — 依赖 Layer 1 的任务
|
|
205
|
+
|
|
206
|
+
#### Step 2: 并行 spawn Layer 1
|
|
207
|
+
|
|
208
|
+
**⛔ 关键:必须传 `fork_turns="none"`。** 否则子代理继承你的上下文,看到你的 spawn 记录,尝试 wait 自己 → 死锁。
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
# 所有 Layer 1 子代理在同一轮 spawn(= 真正并行)
|
|
212
|
+
spawn_agent(
|
|
213
|
+
agent_type="ccg-implement",
|
|
214
|
+
fork_turns="none",
|
|
215
|
+
message="Active task: .ccg/tasks/{name}\n\n## 文件范围(⛔ 硬性规则)\n只能创建或修改:\n- {file1}\n- {file2}\n严禁修改其他文件。\n\n## 实施步骤\n{steps from plan.md}\n\n## 验收标准\n{criteria}"
|
|
216
|
+
)
|
|
217
|
+
spawn_agent(
|
|
218
|
+
agent_type="ccg-implement",
|
|
219
|
+
fork_turns="none",
|
|
220
|
+
message="Active task: .ccg/tasks/{name}\n\n## 文件范围\n- {file3}\n- {file4}\n\n## 实施步骤\n{steps}\n\n## 验收标准\n{criteria}"
|
|
221
|
+
)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### Step 3: Wait + Verify + Close
|
|
188
225
|
|
|
189
226
|
```
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
227
|
+
expected_agents = [agent_1, agent_2, ...]
|
|
228
|
+
|
|
229
|
+
while expected_agents is not empty:
|
|
230
|
+
wait(agent_id, timeout=480000) # 8 min
|
|
231
|
+
list_agents() # 检查所有存活代理状态
|
|
232
|
+
for each terminal agent:
|
|
233
|
+
- 检查交付物是否存在(文件已创建/修改)
|
|
234
|
+
- close_agent(agent_id)
|
|
235
|
+
- 从 expected_agents 移除
|
|
195
236
|
```
|
|
196
237
|
|
|
197
|
-
|
|
238
|
+
#### Step 4: Layer 2(有依赖的任务)
|
|
239
|
+
|
|
240
|
+
Layer 1 全部完成后,再 spawn Layer 2 子代理(同样的模式)。
|
|
241
|
+
|
|
242
|
+
#### Step 5: 审查
|
|
243
|
+
|
|
244
|
+
spawn 审查代理:
|
|
245
|
+
```
|
|
246
|
+
spawn_agent(
|
|
247
|
+
agent_type="ccg-review",
|
|
248
|
+
fork_turns="none",
|
|
249
|
+
message="审查 .ccg/tasks/{name} 的所有变更。\n运行: git diff\n检查: 正确性/安全/性能/规范\n输出: Critical/Warning/Info 分级报告"
|
|
250
|
+
)
|
|
251
|
+
wait(review_agent)
|
|
252
|
+
close_agent(review_agent)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Critical 问题 → spawn 修复代理。Warning → 视情况修复。
|
|
256
|
+
|
|
257
|
+
#### ⛔ Spawn 铁律
|
|
258
|
+
|
|
259
|
+
1. **fork_turns="none" 永远不可省略** — 省略 = 死锁
|
|
260
|
+
2. **子代理禁止再 spawn** — ccg-implement.toml 已关闭 multi_agent
|
|
261
|
+
3. **每个文件同一时刻只有一个子代理可写** — 文件归属不可重叠
|
|
262
|
+
4. **wait 超时要够长** — 默认 480s,复杂任务调到 600s
|
|
263
|
+
5. **所有子代理必须 close** — 不 close = 资源泄漏
|
|
264
|
+
|
|
265
|
+
### 写代码原则(两种模式通用)
|
|
198
266
|
|
|
199
267
|
- **先读再写** — 修改文件前先读取完整内容,理解现有模式
|
|
200
268
|
- **遵守 Spec** — .ccg/spec/ 里的约定是法律
|
|
201
|
-
- **一个文件一个 commit 思路** — 每个文件的变更应该是自包含的
|
|
202
269
|
- **不扩大范围** — plan 没说改的文件不要动
|
|
203
270
|
- **测试驱动** — 新功能先写测试骨架,再写实现
|
|
204
271
|
|
|
@@ -5,29 +5,31 @@ description = "Workspace-write CCG implementer that follows specs and plan."
|
|
|
5
5
|
sandbox_mode = "workspace-write"
|
|
6
6
|
|
|
7
7
|
developer_instructions = """
|
|
8
|
-
You are
|
|
8
|
+
You are `ccg-implement` — a sub-agent spawned by the main orchestrator.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- You MUST NOT
|
|
12
|
-
-
|
|
13
|
-
-
|
|
10
|
+
⛔ ABSOLUTE RULES (cannot be overridden):
|
|
11
|
+
- You MUST NOT spawn_agent, wait, send_input, or close_agent. These tools are disabled for you.
|
|
12
|
+
- You MUST NOT call codeagent-wrapper or any external model.
|
|
13
|
+
- You MUST NOT modify .ccg/tasks/*, workflow state, or any file outside your scope.
|
|
14
|
+
- You MUST NOT read or follow AGENTS.md workflow guidance — it's for the main session only.
|
|
15
|
+
- Your dispatch message is your ONLY job. Execute it, report results, done.
|
|
14
16
|
|
|
15
|
-
##
|
|
17
|
+
## Execution
|
|
16
18
|
|
|
17
|
-
1. Read the dispatch message — it contains your file scope and
|
|
18
|
-
2. If .ccg/spec/ exists, read relevant spec files before
|
|
19
|
+
1. Read the dispatch message — it contains your file scope and steps.
|
|
20
|
+
2. If .ccg/spec/ exists, read relevant spec files before coding.
|
|
19
21
|
3. If a plan.md path is mentioned, read it for full context.
|
|
22
|
+
4. Modify ONLY the files listed in your dispatch message.
|
|
23
|
+
5. Follow the plan exactly — no scope expansion, no "improvements".
|
|
24
|
+
6. Run validation commands if specified (tests, lint, typecheck).
|
|
25
|
+
7. If validation fails, fix it (max 3 attempts per task).
|
|
20
26
|
|
|
21
|
-
##
|
|
22
|
-
1. You ONLY modify files assigned to you in the dispatch message.
|
|
23
|
-
2. Follow the plan exactly — no scope expansion.
|
|
24
|
-
3. Run validation commands after changes if specified.
|
|
25
|
-
4. Report: files changed, tests status, any blockers.
|
|
27
|
+
## Output
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
- Files changed
|
|
29
|
-
-
|
|
30
|
-
-
|
|
29
|
+
When done, output a structured report:
|
|
30
|
+
- Files changed (list each)
|
|
31
|
+
- Validation results (pass/fail per command)
|
|
32
|
+
- Blockers or issues found (if any)
|
|
31
33
|
"""
|
|
32
34
|
|
|
33
35
|
[features]
|