ccg-workflow 3.0.10 → 3.1.1

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 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 { A as diagnoseMcpConfig, B as isWindows, C as readClaudeCodeConfig, D as fixWindowsMcpConfig, E as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, a as i18n, s as showMainMenu, i as init, F as configMcp, G as version } from './shared/ccg-workflow.Btj19K42.mjs';
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.k-Wk5rrs.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, y as checkForUpdates, z as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, v as getCurrentVersion, x 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, q as migrateToV1_4_0, t as needsMigration, r as readCcgConfig, s as showMainMenu, p as uninstallAceTool, o as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.Btj19K42.mjs';
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.k-Wk5rrs.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.10";
13
+ const version = "3.1.1";
14
14
 
15
15
  function cmd(id, order, category, name, nameEn, description, descriptionEn, cmdOverride) {
16
16
  return {
@@ -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 || ["gemini"];
135
- const frontendPrimary = routing.frontend?.primary || "gemini";
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", "gemini"];
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);
@@ -197,6 +197,79 @@ function replaceHomePathsInTemplate(content, installDir) {
197
197
  return processed;
198
198
  }
199
199
 
200
+ const CCG_DIR = join(homedir(), ".claude", ".ccg");
201
+ const CONFIG_FILE = join(CCG_DIR, "config.toml");
202
+ function getCcgDir() {
203
+ return CCG_DIR;
204
+ }
205
+ function getConfigPath() {
206
+ return CONFIG_FILE;
207
+ }
208
+ async function ensureCcgDir() {
209
+ await fs.ensureDir(CCG_DIR);
210
+ }
211
+ async function readCcgConfig() {
212
+ try {
213
+ if (await fs.pathExists(CONFIG_FILE)) {
214
+ const content = await fs.readFile(CONFIG_FILE, "utf-8");
215
+ return parse(content);
216
+ }
217
+ } catch {
218
+ }
219
+ return null;
220
+ }
221
+ async function writeCcgConfig(config) {
222
+ await ensureCcgDir();
223
+ const content = stringify(config);
224
+ await fs.writeFile(CONFIG_FILE, content, "utf-8");
225
+ }
226
+ function createDefaultConfig(options) {
227
+ return {
228
+ general: {
229
+ version: version,
230
+ language: options.language,
231
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
232
+ },
233
+ routing: options.routing,
234
+ workflows: {
235
+ installed: options.installedWorkflows
236
+ },
237
+ paths: {
238
+ commands: join(homedir(), ".claude", "commands", "ccg"),
239
+ prompts: join(CCG_DIR, "prompts"),
240
+ // v1.4.0: 移到配置目录
241
+ backup: join(CCG_DIR, "backup")
242
+ },
243
+ mcp: {
244
+ provider: options.mcpProvider || "fast-context",
245
+ setup_url: "https://augmentcode.com/"
246
+ },
247
+ performance: {
248
+ liteMode: options.liteMode || false,
249
+ skipImpeccable: options.skipImpeccable || false
250
+ }
251
+ };
252
+ }
253
+ function createDefaultRouting() {
254
+ return {
255
+ frontend: {
256
+ models: ["antigravity"],
257
+ primary: "antigravity",
258
+ strategy: "parallel"
259
+ },
260
+ backend: {
261
+ models: ["codex"],
262
+ primary: "codex",
263
+ strategy: "parallel"
264
+ },
265
+ review: {
266
+ models: ["codex", "antigravity"],
267
+ strategy: "parallel"
268
+ },
269
+ mode: "smart"
270
+ };
271
+ }
272
+
200
273
  const DEFAULT_ALLOWED_TOOLS = ["Read"];
201
274
  const NAME_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
202
275
  const TOOL_NAME_RE = /^[A-Z][A-Za-z0-9]*$/;
@@ -814,7 +887,7 @@ async function removeFastContextPrompt() {
814
887
  await removeFromFile(join(homedir(), ".gemini", "GEMINI.md"));
815
888
  }
816
889
 
817
- const EXPECTED_BINARY_VERSION = "5.10.0";
890
+ const EXPECTED_BINARY_VERSION = "5.11.0";
818
891
  const GITHUB_REPO = "fengshao1227/ccg-workflow";
819
892
  const RELEASE_TAG = "preset";
820
893
  const BINARY_SOURCES = [
@@ -957,7 +1030,7 @@ async function installPromptFiles(ctx) {
957
1030
  ctx.result.errors.push(`Prompts template directory not found: ${promptsTemplateDir}`);
958
1031
  return;
959
1032
  }
960
- for (const model of ["codex", "gemini", "claude"]) {
1033
+ for (const model of ["codex", "gemini", "claude", "antigravity"]) {
961
1034
  try {
962
1035
  const installed = await copyMdTemplates(
963
1036
  ctx,
@@ -1111,7 +1184,18 @@ async function installCodexMode() {
1111
1184
  }
1112
1185
  const agentsMdSrc = join(codexTemplateDir, "AGENTS.md");
1113
1186
  if (await fs.pathExists(agentsMdSrc)) {
1114
- await fs.copy(agentsMdSrc, join(codexHome, "AGENTS.md"), { overwrite: true });
1187
+ const config = await readCcgConfig();
1188
+ if (config) {
1189
+ let content = await fs.readFile(agentsMdSrc, "utf-8");
1190
+ content = injectConfigVariables(content, {
1191
+ routing: config.routing,
1192
+ liteMode: config.performance?.liteMode || false,
1193
+ mcpProvider: config.mcp?.provider || "skip"
1194
+ });
1195
+ await fs.writeFile(join(codexHome, "AGENTS.md"), content, "utf-8");
1196
+ } else {
1197
+ await fs.copy(agentsMdSrc, join(codexHome, "AGENTS.md"), { overwrite: true });
1198
+ }
1115
1199
  }
1116
1200
  const hooksSrc = join(codexTemplateDir, "hooks");
1117
1201
  if (await fs.pathExists(hooksSrc)) {
@@ -1137,6 +1221,50 @@ async function installCodexMode() {
1137
1221
  return { success: false, message: `Failed to install Codex mode: ${error}` };
1138
1222
  }
1139
1223
  }
1224
+ async function uninstallCodexMode() {
1225
+ const codexHome = join(homedir(), ".codex");
1226
+ const removed = [];
1227
+ const skipped = [];
1228
+ const ccgFiles = [
1229
+ join(codexHome, "agents", "ccg-implement.toml"),
1230
+ join(codexHome, "agents", "ccg-review.toml"),
1231
+ join(codexHome, "agents", "ccg-research.toml"),
1232
+ join(codexHome, "hooks", "ccg-workflow.py"),
1233
+ join(codexHome, "hooks.json")
1234
+ ];
1235
+ const agentsMd = join(codexHome, "AGENTS.md");
1236
+ try {
1237
+ for (const file of ccgFiles) {
1238
+ if (await fs.pathExists(file)) {
1239
+ await fs.remove(file);
1240
+ removed.push(file.replace(homedir(), "~"));
1241
+ }
1242
+ }
1243
+ if (await fs.pathExists(agentsMd)) {
1244
+ const content = await fs.readFile(agentsMd, "utf-8");
1245
+ if (content.includes("<!-- CCG:START")) {
1246
+ await fs.remove(agentsMd);
1247
+ removed.push("~/.codex/AGENTS.md");
1248
+ } else {
1249
+ skipped.push("~/.codex/AGENTS.md (not managed by CCG)");
1250
+ }
1251
+ }
1252
+ skipped.push("~/.codex/config.toml (preserved \u2014 may contain user settings)");
1253
+ for (const dir of ["agents", "hooks"]) {
1254
+ const dirPath = join(codexHome, dir);
1255
+ if (await fs.pathExists(dirPath)) {
1256
+ const files = await fs.readdir(dirPath);
1257
+ if (files.length === 0) {
1258
+ await fs.remove(dirPath);
1259
+ removed.push(`~/.codex/${dir}/ (empty, removed)`);
1260
+ }
1261
+ }
1262
+ }
1263
+ return { success: true, removed, skipped };
1264
+ } catch (error) {
1265
+ return { success: false, removed, skipped: [...skipped, `Error: ${error}`] };
1266
+ }
1267
+ }
1140
1268
  async function installRuleFiles(ctx) {
1141
1269
  try {
1142
1270
  const installed = await copyMdTemplates(
@@ -1348,9 +1476,9 @@ async function installWorkflows(workflowIds, installDir, force = false, config)
1348
1476
  config: {
1349
1477
  routing: config?.routing || {
1350
1478
  mode: "smart",
1351
- frontend: { models: ["gemini"], primary: "gemini" },
1479
+ frontend: { models: ["antigravity"], primary: "antigravity" },
1352
1480
  backend: { models: ["codex"], primary: "codex" },
1353
- review: { models: ["codex", "gemini"] }
1481
+ review: { models: ["codex", "antigravity"] }
1354
1482
  },
1355
1483
  liteMode: config?.liteMode || false,
1356
1484
  mcpProvider: config?.mcpProvider || "fast-context",
@@ -1492,6 +1620,7 @@ const installer = {
1492
1620
  syncMcpToCodex: syncMcpToCodex,
1493
1621
  syncMcpToGemini: syncMcpToGemini,
1494
1622
  uninstallAceTool: uninstallAceTool,
1623
+ uninstallCodexMode: uninstallCodexMode,
1495
1624
  uninstallContextWeaver: uninstallContextWeaver,
1496
1625
  uninstallFastContext: uninstallFastContext,
1497
1626
  uninstallMcpServer: uninstallMcpServer,
@@ -2843,79 +2972,6 @@ async function changeLanguage(lang) {
2843
2972
  await i18n.changeLanguage(lang);
2844
2973
  }
2845
2974
 
2846
- const CCG_DIR = join(homedir(), ".claude", ".ccg");
2847
- const CONFIG_FILE = join(CCG_DIR, "config.toml");
2848
- function getCcgDir() {
2849
- return CCG_DIR;
2850
- }
2851
- function getConfigPath() {
2852
- return CONFIG_FILE;
2853
- }
2854
- async function ensureCcgDir() {
2855
- await fs.ensureDir(CCG_DIR);
2856
- }
2857
- async function readCcgConfig() {
2858
- try {
2859
- if (await fs.pathExists(CONFIG_FILE)) {
2860
- const content = await fs.readFile(CONFIG_FILE, "utf-8");
2861
- return parse(content);
2862
- }
2863
- } catch {
2864
- }
2865
- return null;
2866
- }
2867
- async function writeCcgConfig(config) {
2868
- await ensureCcgDir();
2869
- const content = stringify(config);
2870
- await fs.writeFile(CONFIG_FILE, content, "utf-8");
2871
- }
2872
- function createDefaultConfig(options) {
2873
- return {
2874
- general: {
2875
- version: version,
2876
- language: options.language,
2877
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
2878
- },
2879
- routing: options.routing,
2880
- workflows: {
2881
- installed: options.installedWorkflows
2882
- },
2883
- paths: {
2884
- commands: join(homedir(), ".claude", "commands", "ccg"),
2885
- prompts: join(CCG_DIR, "prompts"),
2886
- // v1.4.0: 移到配置目录
2887
- backup: join(CCG_DIR, "backup")
2888
- },
2889
- mcp: {
2890
- provider: options.mcpProvider || "fast-context",
2891
- setup_url: "https://augmentcode.com/"
2892
- },
2893
- performance: {
2894
- liteMode: options.liteMode || false,
2895
- skipImpeccable: options.skipImpeccable || false
2896
- }
2897
- };
2898
- }
2899
- function createDefaultRouting() {
2900
- return {
2901
- frontend: {
2902
- models: ["gemini"],
2903
- primary: "gemini",
2904
- strategy: "parallel"
2905
- },
2906
- backend: {
2907
- models: ["codex"],
2908
- primary: "codex",
2909
- strategy: "parallel"
2910
- },
2911
- review: {
2912
- models: ["codex", "gemini"],
2913
- strategy: "parallel"
2914
- },
2915
- mode: "smart"
2916
- };
2917
- }
2918
-
2919
2975
  async function migrateToV1_4_0() {
2920
2976
  const result = {
2921
2977
  success: true,
@@ -3158,7 +3214,7 @@ async function init(options = {}) {
3158
3214
  language = options.lang;
3159
3215
  await initI18n(language);
3160
3216
  }
3161
- let frontendModels = ["gemini"];
3217
+ let frontendModels = ["antigravity"];
3162
3218
  let backendModels = ["codex"];
3163
3219
  let geminiModel = "gemini-3.1-pro-preview";
3164
3220
  const mode = "smart";
@@ -3166,7 +3222,7 @@ async function init(options = {}) {
3166
3222
  if (options.skipPrompt) {
3167
3223
  const existingConfig = await readCcgConfig();
3168
3224
  if (existingConfig?.routing) {
3169
- frontendModels = existingConfig.routing.frontend?.models || ["gemini"];
3225
+ frontendModels = existingConfig.routing.frontend?.models || ["antigravity"];
3170
3226
  backendModels = existingConfig.routing.backend?.models || ["codex"];
3171
3227
  geminiModel = existingConfig.routing.geminiModel || "gemini-3.1-pro-preview";
3172
3228
  }
@@ -3290,11 +3346,12 @@ async function init(options = {}) {
3290
3346
  name: "selectedFrontend",
3291
3347
  message: i18n.t("init:model.selectFrontend"),
3292
3348
  choices: [
3293
- { name: `Gemini ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "gemini" },
3349
+ { name: `Antigravity ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "antigravity" },
3350
+ { name: "Gemini", value: "gemini" },
3294
3351
  { name: "Codex", value: "codex" },
3295
3352
  ...navSentinels(canGoBack)
3296
3353
  ],
3297
- default: frontendModels[0] || "gemini"
3354
+ default: frontendModels[0] || "antigravity"
3298
3355
  }]);
3299
3356
  if (selectedFrontend === BACK_SENTINEL)
3300
3357
  return "back";
@@ -3305,8 +3362,9 @@ async function init(options = {}) {
3305
3362
  name: "selectedBackend",
3306
3363
  message: i18n.t("init:model.selectBackend"),
3307
3364
  choices: [
3308
- { name: "Gemini", value: "gemini" },
3309
- { name: `Codex ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "codex" }
3365
+ { name: `Codex ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "codex" },
3366
+ { name: "Antigravity", value: "antigravity" },
3367
+ { name: "Gemini", value: "gemini" }
3310
3368
  ],
3311
3369
  default: backendModels[0] || "codex"
3312
3370
  }]);
@@ -4634,7 +4692,7 @@ async function configModelRouting() {
4634
4692
  console.log();
4635
4693
  console.log(ansis.cyan.bold(` ${i18n.t("init:model.title")}`));
4636
4694
  console.log();
4637
- const currentFrontend = config?.routing?.frontend?.primary || "gemini";
4695
+ const currentFrontend = config?.routing?.frontend?.primary || "antigravity";
4638
4696
  const currentBackend = config?.routing?.backend?.primary || "codex";
4639
4697
  const currentGeminiModel = config?.routing?.geminiModel || "gemini-3.1-pro-preview";
4640
4698
  console.log(ansis.gray(` ${i18n.t("init:model.currentRouting")}:`));
@@ -4649,7 +4707,8 @@ async function configModelRouting() {
4649
4707
  name: "selectedFrontend",
4650
4708
  message: i18n.t("init:model.selectFrontend"),
4651
4709
  choices: [
4652
- { name: `Gemini ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "gemini" },
4710
+ { name: `Antigravity ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "antigravity" },
4711
+ { name: "Gemini", value: "gemini" },
4653
4712
  { name: "Codex", value: "codex" }
4654
4713
  ],
4655
4714
  default: currentFrontend
@@ -4659,8 +4718,9 @@ async function configModelRouting() {
4659
4718
  name: "selectedBackend",
4660
4719
  message: i18n.t("init:model.selectBackend"),
4661
4720
  choices: [
4662
- { name: "Gemini", value: "gemini" },
4663
- { name: `Codex ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "codex" }
4721
+ { name: `Codex ${ansis.green(`(${i18n.t("init:model.recommended")})`)}`, value: "codex" },
4722
+ { name: "Antigravity", value: "antigravity" },
4723
+ { name: "Gemini", value: "gemini" }
4664
4724
  ],
4665
4725
  default: currentBackend
4666
4726
  }]);
@@ -4784,16 +4844,48 @@ async function handleCodexMode() {
4784
4844
  console.log();
4785
4845
  console.log(ansis.cyan.bold(isZh ? " Codex \u591A\u6A21\u578B\u7F16\u6392\u6A21\u5F0F" : " Codex Multi-Model Orchestration Mode"));
4786
4846
  console.log();
4847
+ const { action } = await inquirer.prompt([{
4848
+ type: "list",
4849
+ name: "action",
4850
+ message: isZh ? "\u9009\u62E9\u64CD\u4F5C" : "Select action",
4851
+ choices: [
4852
+ { name: isZh ? "\u5B89\u88C5 / \u66F4\u65B0 Codex \u6A21\u5F0F" : "Install / Update Codex Mode", value: "install" },
4853
+ { 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" },
4854
+ { name: isZh ? "\u8FD4\u56DE" : "Back", value: "back" }
4855
+ ]
4856
+ }]);
4857
+ if (action === "back") return;
4858
+ if (action === "uninstall") {
4859
+ const spinner2 = ora(isZh ? "\u5378\u8F7D Codex \u6A21\u5F0F..." : "Uninstalling Codex mode...").start();
4860
+ const result2 = await uninstallCodexMode();
4861
+ if (result2.success) {
4862
+ spinner2.succeed(isZh ? "Codex \u6A21\u5F0F\u5DF2\u5378\u8F7D" : "Codex mode uninstalled");
4863
+ if (result2.removed.length > 0) {
4864
+ console.log();
4865
+ for (const f of result2.removed) {
4866
+ console.log(` ${ansis.red("\u2717")} ${f}`);
4867
+ }
4868
+ }
4869
+ if (result2.skipped.length > 0) {
4870
+ console.log();
4871
+ for (const f of result2.skipped) {
4872
+ console.log(` ${ansis.gray("\u25CB")} ${f}`);
4873
+ }
4874
+ }
4875
+ } else {
4876
+ spinner2.fail(isZh ? "\u5378\u8F7D\u5931\u8D25" : "Uninstall failed");
4877
+ }
4878
+ return;
4879
+ }
4787
4880
  console.log(
4788
- isZh ? " \u5B89\u88C5 CCG Codex \u6A21\u5F0F\u5230 ~/.codex/\uFF0C\u8BA9 Codex CLI \u4F5C\u4E3A\u4E3B\u5BFC\u8005\u7F16\u6392 Gemini + Claude\u3002" : " Install CCG Codex mode to ~/.codex/, enabling Codex CLI as lead orchestrator for Gemini + Claude."
4881
+ 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."
4789
4882
  );
4790
4883
  console.log();
4791
4884
  console.log(isZh ? " \u5C06\u5B89\u88C5:" : " Will install:");
4792
- console.log(" ~/.codex/AGENTS.md \u2014 Codex auto-read instructions");
4885
+ console.log(" ~/.codex/AGENTS.md \u2014 orchestration instructions");
4793
4886
  console.log(" ~/.codex/config.toml \u2014 multi-agent + timeout config");
4794
- console.log(" ~/.codex/agents/ccg-implement.toml");
4795
- console.log(" ~/.codex/agents/ccg-review.toml");
4796
- console.log(" ~/.codex/agents/ccg-research.toml");
4887
+ console.log(" ~/.codex/hooks.json + hooks/ \u2014 adaptive guardrail hook");
4888
+ console.log(" ~/.codex/agents/ccg-*.toml \u2014 sub-agent definitions");
4797
4889
  console.log();
4798
4890
  const { confirm } = await inquirer.prompt([{
4799
4891
  type: "confirm",
@@ -5070,4 +5162,4 @@ async function uninstallCCometixLine() {
5070
5162
  }
5071
5163
  }
5072
5164
 
5073
- export { diagnoseMcpConfig as A, isWindows as B, readClaudeCodeConfig as C, fixWindowsMcpConfig as D, writeClaudeCodeConfig as E, configMcp as F, version as G, 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, uninstallWorkflows as o, uninstallAceTool as p, migrateToV1_4_0 as q, readCcgConfig as r, showMainMenu as s, needsMigration as t, update as u, getCurrentVersion as v, writeCcgConfig as w, getLatestVersion as x, checkForUpdates as y, compareVersions as z };
5165
+ 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.10",
3
+ "version": "3.1.1",
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/"
@@ -127,13 +127,13 @@ ls .ccg/spec/ 2>/dev/null
127
127
  ### ⛔ 默认调用方式:双模型并行(M+ 复杂度必须用这个)
128
128
 
129
129
  ```bash
130
- ~/.claude/bin/codeagent-wrapper --progress --backend gemini - "$(pwd)" <<'GEMINI_EOF'
131
- ROLE_FILE: ~/.claude/.ccg/prompts/gemini/$ROLE.md
130
+ ~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} - "$(pwd)" <<'FRONTEND_EOF'
131
+ ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/$ROLE.md
132
132
  <TASK>
133
133
  {任务描述 + 上下文}
134
134
  </TASK>
135
135
  OUTPUT: {期望输出格式}
136
- GEMINI_EOF
136
+ FRONTEND_EOF
137
137
  &
138
138
  ~/.claude/bin/codeagent-wrapper --progress --backend claude - "$(pwd)" <<'CLAUDE_EOF'
139
139
  ROLE_FILE: ~/.claude/.ccg/prompts/claude/$ROLE.md
@@ -152,8 +152,8 @@ wait
152
152
 
153
153
  #### Gemini(前端/UI 分析)
154
154
  ```bash
155
- ~/.claude/bin/codeagent-wrapper --progress --backend gemini - "$(pwd)" <<'EOF'
156
- ROLE_FILE: ~/.claude/.ccg/prompts/gemini/$ROLE.md
155
+ ~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} - "$(pwd)" <<'EOF'
156
+ ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/$ROLE.md
157
157
  <TASK>
158
158
  {任务描述 + 上下文}
159
159
  </TASK>
@@ -178,27 +178,94 @@ EOF
178
178
  ### 并行调用提醒
179
179
  M+ 复杂度的分析和审查,使用上方的"双模型并行"模板。不要分开调用,用 `&` + `wait` 并行执行。
180
180
 
181
- ## 5. Implementation — 你自己写代码
181
+ ## 5. Implementation — 写代码
182
182
 
183
- ### 执行模式:Inline(你自己按 plan 顺序逐文件写)
183
+ ### 模式选择
184
184
 
185
- **不要 spawn 子代理。** 你自己按 plan.md 的步骤顺序逐个文件写代码。这比子代理更稳定、更快、更可控。
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
- 1. plan.md(如有)或回顾分析阶段的结论
191
- 2. 按依赖顺序逐文件写:先写底层(store/model/util),再写上层(route/middleware)
192
- 3. 每写完一个文件,跑一次测试/类型检查,确保不破坏现有功能
193
- 4. 全部写完后,跑完整测试套件
194
- 5. git diff 确认所有变更在 plan 范围内
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
 
@@ -220,8 +287,8 @@ M+ 复杂度的分析和审查,使用上方的"双模型并行"模板。不要
220
287
 
221
288
  ```bash
222
289
  # 必须并行调用两个模型审查 git diff
223
- ~/.claude/bin/codeagent-wrapper --progress --backend gemini - "$(pwd)" <<'EOF'
224
- ROLE_FILE: ~/.claude/.ccg/prompts/gemini/reviewer.md
290
+ ~/.claude/bin/codeagent-wrapper --progress --backend {{FRONTEND_PRIMARY}} - "$(pwd)" <<'EOF'
291
+ ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md
225
292
  <TASK>审查以下代码变更:$(git diff)</TASK>
226
293
  OUTPUT: Critical/Warning/Info 分级审查报告
227
294
  EOF