ccg-workflow 1.7.25 → 1.7.26

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.
Binary file
Binary file
Binary file
Binary file
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 { y as diagnoseMcpConfig, z as isWindows, A as readClaudeCodeConfig, B as fixWindowsMcpConfig, C as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, D as configMcp, E as version, a as i18n } from './shared/ccg-workflow.DJlWxdzA.mjs';
4
+ import { y as diagnoseMcpConfig, z as isWindows, A as readClaudeCodeConfig, B as fixWindowsMcpConfig, C as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, D as configMcp, E as version, a as i18n } from './shared/ccg-workflow.CqFZ5tot.mjs';
5
5
  import 'inquirer';
6
6
  import 'node:child_process';
7
7
  import 'node:util';
@@ -141,7 +141,7 @@ async function setupCommands(cli) {
141
141
  }
142
142
  await showMainMenu();
143
143
  });
144
- cli.command("init", "Initialize CCG multi-model collaboration system").alias("i").option("--lang, -l <lang>", "Display language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").option("--frontend, -F <models>", "Frontend models (comma-separated: gemini,codex,claude)").option("--backend, -B <models>", "Backend models (comma-separated: codex,gemini,claude)").option("--mode, -m <mode>", "Collaboration mode (parallel, smart, sequential)").option("--workflows, -w <workflows>", 'Workflows to install (comma-separated or "all")').option("--install-dir, -d <path>", "Installation directory (default: ~/.claude)").action(async (options) => {
144
+ cli.command("init", "Initialize CCG multi-model collaboration system").alias("i").option("--lang, -l <lang>", "Display language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").option("--skip-mcp", "Skip MCP configuration (used during update)").option("--frontend, -F <models>", "Frontend models (comma-separated: gemini,codex,claude)").option("--backend, -B <models>", "Backend models (comma-separated: codex,gemini,claude)").option("--mode, -m <mode>", "Collaboration mode (parallel, smart, sequential)").option("--workflows, -w <workflows>", 'Workflows to install (comma-separated or "all")').option("--install-dir, -d <path>", "Installation directory (default: ~/.claude)").action(async (options) => {
145
145
  if (options.lang) {
146
146
  await initI18n(options.lang);
147
147
  }
package/dist/index.d.mts CHANGED
@@ -4,6 +4,7 @@ interface CliOptions {
4
4
  lang?: SupportedLang;
5
5
  force?: boolean;
6
6
  skipPrompt?: boolean;
7
+ skipMcp?: boolean;
7
8
  frontend?: string;
8
9
  backend?: string;
9
10
  mode?: CollaborationMode;
@@ -66,6 +67,7 @@ interface WorkflowConfig {
66
67
  interface InitOptions {
67
68
  lang?: SupportedLang;
68
69
  skipPrompt?: boolean;
70
+ skipMcp?: boolean;
69
71
  force?: boolean;
70
72
  frontend?: string;
71
73
  backend?: string;
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ interface CliOptions {
4
4
  lang?: SupportedLang;
5
5
  force?: boolean;
6
6
  skipPrompt?: boolean;
7
+ skipMcp?: boolean;
7
8
  frontend?: string;
8
9
  backend?: string;
9
10
  mode?: CollaborationMode;
@@ -66,6 +67,7 @@ interface WorkflowConfig {
66
67
  interface InitOptions {
67
68
  lang?: SupportedLang;
68
69
  skipPrompt?: boolean;
70
+ skipMcp?: boolean;
69
71
  force?: boolean;
70
72
  frontend?: string;
71
73
  backend?: string;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as changeLanguage, v as checkForUpdates, x as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, q as getCurrentVersion, t as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, k as installWorkflows, o as migrateToV1_4_0, p as needsMigration, r as readCcgConfig, s as showMainMenu, n as uninstallAceTool, m as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.DJlWxdzA.mjs';
1
+ export { c as changeLanguage, v as checkForUpdates, x as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, q as getCurrentVersion, t as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, k as installWorkflows, o as migrateToV1_4_0, p as needsMigration, r as readCcgConfig, s as showMainMenu, n as uninstallAceTool, m as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.CqFZ5tot.mjs';
2
2
  import 'ansis';
3
3
  import 'inquirer';
4
4
  import 'node:child_process';
@@ -10,7 +10,7 @@ import i18next from 'i18next';
10
10
  import ora from 'ora';
11
11
  import { parse, stringify } from 'smol-toml';
12
12
 
13
- const version = "1.7.25";
13
+ const version = "1.7.26";
14
14
 
15
15
  function isWindows() {
16
16
  return process.platform === "win32";
@@ -721,17 +721,6 @@ async function installAceTool(config) {
721
721
  }
722
722
  }
723
723
 
724
- const installer = {
725
- __proto__: null,
726
- getAllCommandIds: getAllCommandIds,
727
- getWorkflowById: getWorkflowById,
728
- getWorkflowConfigs: getWorkflowConfigs,
729
- installAceTool: installAceTool,
730
- installWorkflows: installWorkflows,
731
- uninstallAceTool: uninstallAceTool,
732
- uninstallWorkflows: uninstallWorkflows
733
- };
734
-
735
724
  async function configMcp() {
736
725
  console.log();
737
726
  console.log(ansis.cyan.bold(` \u914D\u7F6E ace-tool MCP`));
@@ -1326,7 +1315,9 @@ async function init(options = {}) {
1326
1315
  let mcpProvider = "ace-tool";
1327
1316
  let aceToolBaseUrl = "";
1328
1317
  let aceToolToken = "";
1329
- if (!options.skipPrompt) {
1318
+ if (options.skipMcp) {
1319
+ mcpProvider = "skip";
1320
+ } else if (!options.skipPrompt) {
1330
1321
  console.log();
1331
1322
  console.log(ansis.cyan.bold(` \u{1F527} MCP \u5DE5\u5177\u914D\u7F6E`));
1332
1323
  console.log();
@@ -1532,75 +1523,37 @@ async function init(options = {}) {
1532
1523
  console.log();
1533
1524
  console.log(ansis.cyan(` ${i18n.t("init:installedBinary")}`));
1534
1525
  console.log(` ${ansis.green("\u2713")} codeagent-wrapper ${ansis.gray(`\u2192 ${result.binPath}`)}`);
1535
- console.log();
1536
1526
  const platform = process.platform;
1537
- const exportCommand = `export PATH="${result.binPath}:$PATH"`;
1538
1527
  if (platform === "win32") {
1539
- console.log(ansis.yellow(` \u26A0 ${i18n.t("init:pathWarning")}`));
1540
- console.log();
1541
- console.log(ansis.cyan(` ${i18n.t("init:windowsPathInstructions")}`));
1542
- console.log(ansis.gray(` 1. ${i18n.t("init:windowsStep1")}`));
1543
- console.log(ansis.gray(` 2. ${i18n.t("init:windowsStep2")}`));
1544
- console.log(ansis.gray(` 3. ${i18n.t("init:windowsStep3")}`));
1545
- console.log(ansis.gray(` ${result.binPath.replace(/\//g, "\\")}`));
1546
- console.log(ansis.gray(` 4. ${i18n.t("init:windowsStep4")}`));
1547
- console.log();
1548
- console.log(ansis.cyan(` ${i18n.t("init:orUsePowerShell")}`));
1549
1528
  const windowsPath = result.binPath.replace(/\//g, "\\");
1550
- console.log(ansis.gray(` $currentPath = [System.Environment]::GetEnvironmentVariable('PATH', 'User')`));
1551
- console.log(ansis.gray(` $newPath = '${windowsPath}'`));
1552
- console.log(ansis.gray(` if ($currentPath -notlike "*$newPath*") {`));
1553
- console.log(ansis.gray(` [System.Environment]::SetEnvironmentVariable('PATH', "$currentPath;$newPath", 'User')`));
1554
- console.log(ansis.gray(` }`));
1555
- } else {
1556
- console.log(ansis.yellow(` \u26A0 ${i18n.t("init:pathWarning")}`));
1557
- if (!options.skipPrompt) {
1558
- console.log();
1559
- const { autoConfigurePath } = await inquirer.prompt([{
1560
- type: "confirm",
1561
- name: "autoConfigurePath",
1562
- message: i18n.t("init:autoConfigurePathPrompt"),
1563
- default: true
1564
- }]);
1565
- if (autoConfigurePath) {
1566
- const shellRc = process.env.SHELL?.includes("zsh") ? join(homedir(), ".zshrc") : join(homedir(), ".bashrc");
1567
- const shellRcDisplay = process.env.SHELL?.includes("zsh") ? "~/.zshrc" : "~/.bashrc";
1568
- try {
1569
- let rcContent = "";
1570
- if (await fs.pathExists(shellRc)) {
1571
- rcContent = await fs.readFile(shellRc, "utf-8");
1572
- }
1573
- if (rcContent.includes(result.binPath) || rcContent.includes("/.claude/bin")) {
1574
- console.log(ansis.green(` \u2713 ${i18n.t("init:pathAlreadyConfigured", { file: shellRcDisplay })}`));
1575
- } else {
1576
- const configLine = `
1529
+ try {
1530
+ const { execSync } = await import('node:child_process');
1531
+ const currentPath = execSync(`powershell -Command "[System.Environment]::GetEnvironmentVariable('PATH', 'User')"`, { encoding: "utf-8" }).trim();
1532
+ if (!currentPath.includes(windowsPath) && !currentPath.includes(".claude\\bin")) {
1533
+ execSync(`powershell -Command "[System.Environment]::SetEnvironmentVariable('PATH', '$env:PATH;${windowsPath}', 'User')"`, { stdio: "pipe" });
1534
+ console.log(` ${ansis.green("\u2713")} PATH ${ansis.gray("\u2192 \u7528\u6237\u73AF\u5883\u53D8\u91CF")}`);
1535
+ }
1536
+ } catch {
1537
+ }
1538
+ } else if (!options.skipPrompt) {
1539
+ const exportCommand = `export PATH="${result.binPath}:$PATH"`;
1540
+ const shellRc = process.env.SHELL?.includes("zsh") ? join(homedir(), ".zshrc") : join(homedir(), ".bashrc");
1541
+ const shellRcDisplay = process.env.SHELL?.includes("zsh") ? "~/.zshrc" : "~/.bashrc";
1542
+ try {
1543
+ let rcContent = "";
1544
+ if (await fs.pathExists(shellRc)) {
1545
+ rcContent = await fs.readFile(shellRc, "utf-8");
1546
+ }
1547
+ if (rcContent.includes(result.binPath) || rcContent.includes("/.claude/bin")) {
1548
+ } else {
1549
+ const configLine = `
1577
1550
  # CCG multi-model collaboration system
1578
1551
  ${exportCommand}
1579
1552
  `;
1580
- await fs.appendFile(shellRc, configLine, "utf-8");
1581
- console.log(ansis.green(` \u2713 ${i18n.t("init:pathConfigured", { file: shellRcDisplay })}`));
1582
- console.log();
1583
- console.log(ansis.cyan(` ${i18n.t("init:restartShellPrompt")}`));
1584
- console.log(ansis.gray(` source ${shellRcDisplay}`));
1585
- }
1586
- } catch (error) {
1587
- console.log(ansis.red(` \u2717 ${i18n.t("init:pathConfigFailed")}`));
1588
- console.log(ansis.gray(` ${i18n.t("init:manualConfigInstructions", { file: shellRcDisplay })}`));
1589
- console.log(ansis.gray(` ${exportCommand}`));
1590
- }
1591
- } else {
1592
- const shellRc = process.env.SHELL?.includes("zsh") ? "~/.zshrc" : "~/.bashrc";
1593
- console.log();
1594
- console.log(ansis.cyan(` ${i18n.t("init:manualConfigInstructions", { file: shellRc })}`));
1595
- console.log(ansis.gray(` ${exportCommand}`));
1596
- console.log(ansis.gray(` source ${shellRc}`));
1553
+ await fs.appendFile(shellRc, configLine, "utf-8");
1554
+ console.log(` ${ansis.green("\u2713")} PATH ${ansis.gray(`\u2192 ${shellRcDisplay}`)}`);
1597
1555
  }
1598
- } else {
1599
- const shellRc = process.env.SHELL?.includes("zsh") ? "~/.zshrc" : "~/.bashrc";
1600
- console.log();
1601
- console.log(ansis.cyan(` ${i18n.t("init:manualConfigInstructions", { file: shellRc })}`));
1602
- console.log(ansis.gray(` ${exportCommand}`));
1603
- console.log(ansis.gray(` source ${shellRc}`));
1556
+ } catch {
1604
1557
  }
1605
1558
  }
1606
1559
  }
@@ -1827,42 +1780,46 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
1827
1780
  console.log();
1828
1781
  }
1829
1782
  }
1830
- const config = await readCcgConfig();
1831
- spinner = ora("\u6B63\u5728\u66F4\u65B0\u5DE5\u4F5C\u6D41\u548C codeagent-wrapper \u4E8C\u8FDB\u5236...").start();
1783
+ spinner = ora("\u6B63\u5728\u5220\u9664\u65E7\u5DE5\u4F5C\u6D41...").start();
1832
1784
  try {
1833
- const { getAllCommandIds } = await Promise.resolve().then(function () { return installer; });
1834
- const workflows = getAllCommandIds();
1835
1785
  const installDir = join(homedir(), ".claude");
1836
- const result = await installWorkflows(workflows, installDir, true, {
1837
- routing: config?.routing
1838
- // Use existing routing (fixed: Gemini frontend + Codex backend)
1786
+ const uninstallResult = await uninstallWorkflows(installDir);
1787
+ if (uninstallResult.success) {
1788
+ spinner.succeed("\u65E7\u5DE5\u4F5C\u6D41\u5DF2\u5220\u9664");
1789
+ } else {
1790
+ spinner.warn("\u90E8\u5206\u6587\u4EF6\u5220\u9664\u5931\u8D25\uFF0C\u7EE7\u7EED\u5B89\u88C5...");
1791
+ for (const error of uninstallResult.errors) {
1792
+ console.log(ansis.yellow(` \u2022 ${error}`));
1793
+ }
1794
+ }
1795
+ } catch (error) {
1796
+ spinner.warn(`\u5220\u9664\u65E7\u5DE5\u4F5C\u6D41\u65F6\u51FA\u9519: ${error}\uFF0C\u7EE7\u7EED\u5B89\u88C5...`);
1797
+ }
1798
+ spinner = ora("\u6B63\u5728\u5B89\u88C5\u65B0\u7248\u672C\u5DE5\u4F5C\u6D41\u548C\u4E8C\u8FDB\u5236...").start();
1799
+ try {
1800
+ await execAsync$1(`npx --yes ccg-workflow@latest init --force --skip-mcp`, {
1801
+ timeout: 12e4,
1802
+ env: {
1803
+ ...process.env,
1804
+ CCG_UPDATE_MODE: "true"
1805
+ // Signal to init that this is an update
1806
+ }
1839
1807
  });
1840
- if (result.success) {
1841
- spinner.succeed("\u5DE5\u4F5C\u6D41\u548C\u4E8C\u8FDB\u5236\u6587\u4EF6\u66F4\u65B0\u6210\u529F");
1808
+ spinner.succeed("\u65B0\u7248\u672C\u5B89\u88C5\u6210\u529F");
1809
+ const config = await readCcgConfig();
1810
+ if (config?.workflows?.installed) {
1842
1811
  console.log();
1843
- console.log(ansis.cyan(`\u5DF2\u66F4\u65B0 ${result.installedCommands.length} \u4E2A\u547D\u4EE4:`));
1844
- for (const cmd of result.installedCommands) {
1812
+ console.log(ansis.cyan(`\u5DF2\u5B89\u88C5 ${config.workflows.installed.length} \u4E2A\u547D\u4EE4:`));
1813
+ for (const cmd of config.workflows.installed) {
1845
1814
  console.log(` ${ansis.gray("\u2022")} /ccg:${cmd}`);
1846
1815
  }
1847
- if (config) {
1848
- config.general.version = toVersion;
1849
- config.workflows = {
1850
- installed: workflows
1851
- // Update to include all current commands
1852
- };
1853
- await writeCcgConfig(config);
1854
- }
1855
- } else {
1856
- spinner.fail("\u66F4\u65B0\u5931\u8D25");
1857
- console.log(ansis.red("\u90E8\u5206\u6587\u4EF6\u66F4\u65B0\u5931\u8D25:"));
1858
- for (const error of result.errors) {
1859
- console.log(ansis.red(` \u2022 ${error}`));
1860
- }
1861
- return;
1862
1816
  }
1863
1817
  } catch (error) {
1864
- spinner.fail("\u66F4\u65B0\u5931\u8D25");
1818
+ spinner.fail("\u5B89\u88C5\u65B0\u7248\u672C\u5931\u8D25");
1865
1819
  console.log(ansis.red(`\u9519\u8BEF: ${error}`));
1820
+ console.log();
1821
+ console.log(ansis.yellow("\u8BF7\u5C1D\u8BD5\u624B\u52A8\u8FD0\u884C:"));
1822
+ console.log(ansis.cyan(" npx ccg-workflow@latest"));
1866
1823
  return;
1867
1824
  }
1868
1825
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccg-workflow",
3
- "version": "1.7.25",
3
+ "version": "1.7.26",
4
4
  "description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.17.1",
@@ -51,6 +51,15 @@ EOF",
51
51
 
52
52
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
53
53
 
54
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
55
+
56
+ ```
57
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
58
+ ```
59
+
60
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
61
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
62
+
54
63
  ---
55
64
 
56
65
  ## 执行工作流
@@ -42,6 +42,15 @@ EOF",
42
42
 
43
43
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
44
44
 
45
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
46
+
47
+ ```
48
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
49
+ ```
50
+
51
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
52
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
53
+
45
54
  ---
46
55
 
47
56
  ## 执行工作流
@@ -57,6 +57,15 @@ EOF",
57
57
 
58
58
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
59
59
 
60
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
61
+
62
+ ```
63
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
64
+ ```
65
+
66
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
67
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
68
+
60
69
  ---
61
70
 
62
71
  ## 核心工作流程
@@ -48,6 +48,15 @@ EOF",
48
48
 
49
49
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
50
50
 
51
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
52
+
53
+ ```
54
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
55
+ ```
56
+
57
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
58
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
59
+
51
60
  ---
52
61
 
53
62
  ## 执行工作流
@@ -38,6 +38,15 @@ EOF",
38
38
 
39
39
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
40
40
 
41
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
42
+
43
+ ```
44
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
45
+ ```
46
+
47
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
48
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
49
+
41
50
  ---
42
51
 
43
52
  ## 执行工作流
@@ -60,6 +60,15 @@ EOF",
60
60
 
61
61
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
62
62
 
63
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
64
+
65
+ ```
66
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
67
+ ```
68
+
69
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
70
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
71
+
63
72
  ---
64
73
 
65
74
  ## 执行工作流
@@ -79,6 +79,15 @@ EOF",
79
79
 
80
80
  **并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
81
81
 
82
+ **等待后台任务**(使用最大超时 600000ms = 10分钟):
83
+
84
+ ```
85
+ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
86
+ ```
87
+
88
+ **重要**:必须指定 `timeout: 600000`,否则默认只有 30 秒会导致提前超时。
89
+ 如果 10 分钟后仍未完成,继续用 `TaskOutput` 轮询,**绝对不要 Kill 进程**。
90
+
82
91
  ---
83
92
 
84
93
  ## 沟通守则