ccg-workflow 1.3.7 → 1.4.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 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 { r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, a as i18n } from './shared/ccg-workflow.MFY9c1yE.mjs';
4
+ import { r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, a as i18n } from './shared/ccg-workflow.DaI-Qubz.mjs';
5
5
  import 'inquirer';
6
6
  import 'node:os';
7
7
  import 'pathe';
@@ -13,7 +13,7 @@ import 'smol-toml';
13
13
  import 'node:child_process';
14
14
  import 'node:util';
15
15
 
16
- const version = "1.3.7";
16
+ const version = "1.4.0";
17
17
 
18
18
  function customizeHelp(sections) {
19
19
  sections.unshift({
package/dist/index.d.mts CHANGED
@@ -150,6 +150,30 @@ declare function installAceTool(config: AceToolConfig): Promise<{
150
150
  configPath?: string;
151
151
  }>;
152
152
 
153
+ /**
154
+ * Migration utilities for v1.4.0
155
+ * Handles automatic migration from old directory structure to new one
156
+ */
157
+ interface MigrationResult {
158
+ success: boolean;
159
+ migratedFiles: string[];
160
+ errors: string[];
161
+ skipped: string[];
162
+ }
163
+ /**
164
+ * Migrate from v1.3.x to v1.4.0
165
+ *
166
+ * Changes:
167
+ * 1. ~/.ccg/ → ~/.claude/.ccg/
168
+ * 2. ~/.claude/prompts/ccg/ → ~/.claude/.ccg/prompts/
169
+ * 3. ~/.claude/commands/ccg/_config.md → ~/.claude/.ccg/shared-config.md
170
+ */
171
+ declare function migrateToV1_4_0(): Promise<MigrationResult>;
172
+ /**
173
+ * Check if migration is needed
174
+ */
175
+ declare function needsMigration(): Promise<boolean>;
176
+
153
177
  /**
154
178
  * Get current installed version from package.json
155
179
  */
@@ -172,5 +196,5 @@ declare function checkForUpdates(): Promise<{
172
196
  latestVersion: string | null;
173
197
  }>;
174
198
 
175
- export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installWorkflows, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
199
+ export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
176
200
  export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
package/dist/index.d.ts CHANGED
@@ -150,6 +150,30 @@ declare function installAceTool(config: AceToolConfig): Promise<{
150
150
  configPath?: string;
151
151
  }>;
152
152
 
153
+ /**
154
+ * Migration utilities for v1.4.0
155
+ * Handles automatic migration from old directory structure to new one
156
+ */
157
+ interface MigrationResult {
158
+ success: boolean;
159
+ migratedFiles: string[];
160
+ errors: string[];
161
+ skipped: string[];
162
+ }
163
+ /**
164
+ * Migrate from v1.3.x to v1.4.0
165
+ *
166
+ * Changes:
167
+ * 1. ~/.ccg/ → ~/.claude/.ccg/
168
+ * 2. ~/.claude/prompts/ccg/ → ~/.claude/.ccg/prompts/
169
+ * 3. ~/.claude/commands/ccg/_config.md → ~/.claude/.ccg/shared-config.md
170
+ */
171
+ declare function migrateToV1_4_0(): Promise<MigrationResult>;
172
+ /**
173
+ * Check if migration is needed
174
+ */
175
+ declare function needsMigration(): Promise<boolean>;
176
+
153
177
  /**
154
178
  * Get current installed version from package.json
155
179
  */
@@ -172,5 +196,5 @@ declare function checkForUpdates(): Promise<{
172
196
  latestVersion: string | null;
173
197
  }>;
174
198
 
175
- export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installWorkflows, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
199
+ export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
176
200
  export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as changeLanguage, q as checkForUpdates, t as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, o as getCurrentVersion, p as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, k as installWorkflows, r as readCcgConfig, s as showMainMenu, n as uninstallAceTool, m as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.MFY9c1yE.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.DaI-Qubz.mjs';
2
2
  import 'ansis';
3
3
  import 'inquirer';
4
4
  import 'node:os';
@@ -352,7 +352,7 @@ async function changeLanguage(lang) {
352
352
  await i18n.changeLanguage(lang);
353
353
  }
354
354
 
355
- const CCG_DIR = join(homedir(), ".ccg");
355
+ const CCG_DIR = join(homedir(), ".claude", ".ccg");
356
356
  const CONFIG_FILE = join(CCG_DIR, "config.toml");
357
357
  function getCcgDir() {
358
358
  return CCG_DIR;
@@ -381,7 +381,7 @@ async function writeCcgConfig(config) {
381
381
  function createDefaultConfig(options) {
382
382
  return {
383
383
  general: {
384
- version: "1.3.5",
384
+ version: "1.4.0",
385
385
  language: options.language,
386
386
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
387
387
  },
@@ -391,7 +391,8 @@ function createDefaultConfig(options) {
391
391
  },
392
392
  paths: {
393
393
  commands: join(homedir(), ".claude", "commands", "ccg"),
394
- prompts: join(homedir(), ".claude", "prompts", "ccg"),
394
+ prompts: join(CCG_DIR, "prompts"),
395
+ // v1.4.0: 移到配置目录
395
396
  backup: join(CCG_DIR, "backup")
396
397
  },
397
398
  mcp: {
@@ -667,8 +668,10 @@ async function installWorkflows(workflowIds, installDir, force = false) {
667
668
  configPath: ""
668
669
  };
669
670
  const commandsDir = join(installDir, "commands", "ccg");
670
- const promptsDir = join(installDir, "prompts", "ccg");
671
+ const ccgConfigDir = join(installDir, ".ccg");
672
+ const promptsDir = join(ccgConfigDir, "prompts");
671
673
  await fs.ensureDir(commandsDir);
674
+ await fs.ensureDir(ccgConfigDir);
672
675
  await fs.ensureDir(promptsDir);
673
676
  const templateDir = join(PACKAGE_ROOT$1, "templates");
674
677
  for (const workflowId of workflowIds) {
@@ -706,11 +709,11 @@ ${workflow.description}
706
709
  }
707
710
  }
708
711
  }
709
- const configSrcFile = join(templateDir, "commands", "_config.md");
710
- const configDestFile = join(commandsDir, "_config.md");
711
- if (await fs.pathExists(configSrcFile)) {
712
- if (force || !await fs.pathExists(configDestFile)) {
713
- await fs.copy(configSrcFile, configDestFile);
712
+ const sharedConfigSrcFile = join(templateDir, "config", "shared-config.md");
713
+ const sharedConfigDestFile = join(ccgConfigDir, "shared-config.md");
714
+ if (await fs.pathExists(sharedConfigSrcFile)) {
715
+ if (force || !await fs.pathExists(sharedConfigDestFile)) {
716
+ await fs.copy(sharedConfigSrcFile, sharedConfigDestFile);
714
717
  }
715
718
  }
716
719
  const agentsSrcDir = join(templateDir, "commands", "agents");
@@ -936,6 +939,108 @@ async function installAceTool(config) {
936
939
  }
937
940
  }
938
941
 
942
+ async function migrateToV1_4_0() {
943
+ const result = {
944
+ success: true,
945
+ migratedFiles: [],
946
+ errors: [],
947
+ skipped: []
948
+ };
949
+ const oldCcgDir = join(homedir(), ".ccg");
950
+ const newCcgDir = join(homedir(), ".claude", ".ccg");
951
+ const oldPromptsDir = join(homedir(), ".claude", "prompts", "ccg");
952
+ const newPromptsDir = join(newCcgDir, "prompts");
953
+ const oldConfigFile = join(homedir(), ".claude", "commands", "ccg", "_config.md");
954
+ const newConfigFile = join(newCcgDir, "shared-config.md");
955
+ try {
956
+ await fs.ensureDir(newCcgDir);
957
+ if (await fs.pathExists(oldCcgDir)) {
958
+ const files = await fs.readdir(oldCcgDir);
959
+ for (const file of files) {
960
+ const srcFile = join(oldCcgDir, file);
961
+ const destFile = join(newCcgDir, file);
962
+ try {
963
+ if (await fs.pathExists(destFile)) {
964
+ result.skipped.push(`~/.ccg/${file} (already exists in new location)`);
965
+ continue;
966
+ }
967
+ await fs.copy(srcFile, destFile);
968
+ result.migratedFiles.push(`~/.ccg/${file} \u2192 ~/.claude/.ccg/${file}`);
969
+ } catch (error) {
970
+ result.errors.push(`Failed to migrate ${file}: ${error}`);
971
+ result.success = false;
972
+ }
973
+ }
974
+ try {
975
+ const remaining = await fs.readdir(oldCcgDir);
976
+ if (remaining.length === 0) {
977
+ await fs.remove(oldCcgDir);
978
+ result.migratedFiles.push("Removed old ~/.ccg/ directory");
979
+ } else {
980
+ result.skipped.push(`~/.ccg/ (not empty, keeping for safety)`);
981
+ }
982
+ } catch (error) {
983
+ result.skipped.push(`~/.ccg/ (could not remove: ${error})`);
984
+ }
985
+ } else {
986
+ result.skipped.push("~/.ccg/ (does not exist, nothing to migrate)");
987
+ }
988
+ if (await fs.pathExists(oldPromptsDir)) {
989
+ try {
990
+ if (await fs.pathExists(newPromptsDir)) {
991
+ result.skipped.push("~/.claude/prompts/ccg/ (already exists in new location)");
992
+ } else {
993
+ await fs.copy(oldPromptsDir, newPromptsDir);
994
+ result.migratedFiles.push("~/.claude/prompts/ccg/ \u2192 ~/.claude/.ccg/prompts/");
995
+ await fs.remove(oldPromptsDir);
996
+ result.migratedFiles.push("Removed old ~/.claude/prompts/ccg/ directory");
997
+ const promptsParentDir = join(homedir(), ".claude", "prompts");
998
+ const remaining = await fs.readdir(promptsParentDir);
999
+ if (remaining.length === 0) {
1000
+ await fs.remove(promptsParentDir);
1001
+ result.migratedFiles.push("Removed empty ~/.claude/prompts/ directory");
1002
+ }
1003
+ }
1004
+ } catch (error) {
1005
+ result.errors.push(`Failed to migrate prompts: ${error}`);
1006
+ result.success = false;
1007
+ }
1008
+ } else {
1009
+ result.skipped.push("~/.claude/prompts/ccg/ (does not exist, nothing to migrate)");
1010
+ }
1011
+ if (await fs.pathExists(oldConfigFile)) {
1012
+ try {
1013
+ if (await fs.pathExists(newConfigFile)) {
1014
+ result.skipped.push("_config.md (already exists in new location)");
1015
+ } else {
1016
+ await fs.copy(oldConfigFile, newConfigFile);
1017
+ result.migratedFiles.push("~/.claude/commands/ccg/_config.md \u2192 ~/.claude/.ccg/shared-config.md");
1018
+ await fs.remove(oldConfigFile);
1019
+ result.migratedFiles.push("Removed old _config.md from commands directory");
1020
+ }
1021
+ } catch (error) {
1022
+ result.errors.push(`Failed to migrate _config.md: ${error}`);
1023
+ result.success = false;
1024
+ }
1025
+ } else {
1026
+ result.skipped.push("_config.md (does not exist, nothing to migrate)");
1027
+ }
1028
+ } catch (error) {
1029
+ result.errors.push(`Migration failed: ${error}`);
1030
+ result.success = false;
1031
+ }
1032
+ return result;
1033
+ }
1034
+ async function needsMigration() {
1035
+ const oldCcgDir = join(homedir(), ".ccg");
1036
+ const oldPromptsDir = join(homedir(), ".claude", "prompts", "ccg");
1037
+ const oldConfigFile = join(homedir(), ".claude", "commands", "ccg", "_config.md");
1038
+ const hasOldCcgDir = await fs.pathExists(oldCcgDir);
1039
+ const hasOldPromptsDir = await fs.pathExists(oldPromptsDir);
1040
+ const hasOldConfigFile = await fs.pathExists(oldConfigFile);
1041
+ return hasOldCcgDir || hasOldPromptsDir || hasOldConfigFile;
1042
+ }
1043
+
939
1044
  async function init(options = {}) {
940
1045
  console.log();
941
1046
  console.log(ansis.cyan.bold(` CCG - Claude + Codex + Gemini`));
@@ -1131,6 +1236,34 @@ async function init(options = {}) {
1131
1236
  }
1132
1237
  const spinner = ora(i18n.t("init:installing")).start();
1133
1238
  try {
1239
+ if (await needsMigration()) {
1240
+ spinner.text = "Migrating from v1.3.x to v1.4.0...";
1241
+ const migrationResult = await migrateToV1_4_0();
1242
+ if (migrationResult.migratedFiles.length > 0) {
1243
+ spinner.info(ansis.cyan("Migration completed:"));
1244
+ console.log();
1245
+ for (const file of migrationResult.migratedFiles) {
1246
+ console.log(` ${ansis.green("\u2713")} ${file}`);
1247
+ }
1248
+ if (migrationResult.skipped.length > 0) {
1249
+ console.log();
1250
+ console.log(ansis.gray(" Skipped:"));
1251
+ for (const file of migrationResult.skipped) {
1252
+ console.log(` ${ansis.gray("\u25CB")} ${file}`);
1253
+ }
1254
+ }
1255
+ console.log();
1256
+ spinner.start(i18n.t("init:installing"));
1257
+ }
1258
+ if (migrationResult.errors.length > 0) {
1259
+ spinner.warn(ansis.yellow("Migration completed with errors:"));
1260
+ for (const error of migrationResult.errors) {
1261
+ console.log(` ${ansis.red("\u2717")} ${error}`);
1262
+ }
1263
+ console.log();
1264
+ spinner.start(i18n.t("init:installing"));
1265
+ }
1266
+ }
1134
1267
  await ensureCcgDir();
1135
1268
  const config = createDefaultConfig({
1136
1269
  language,
@@ -1516,4 +1649,4 @@ async function uninstall() {
1516
1649
  console.log();
1517
1650
  }
1518
1651
 
1519
- export { 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, uninstallWorkflows as m, uninstallAceTool as n, getCurrentVersion as o, getLatestVersion as p, checkForUpdates as q, readCcgConfig as r, showMainMenu as s, compareVersions as t, update as u, writeCcgConfig as w };
1652
+ export { 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, uninstallWorkflows as m, uninstallAceTool as n, migrateToV1_4_0 as o, needsMigration as p, getCurrentVersion as q, readCcgConfig as r, showMainMenu as s, getLatestVersion as t, update as u, checkForUpdates as v, writeCcgConfig as w, compareVersions as x };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccg-workflow",
3
- "version": "1.3.7",
3
+ "version": "1.4.0",
4
4
  "description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.17.1",