ccg-workflow 1.7.11 → 1.7.13
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 { 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.
|
|
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.D8c1Y4Eu.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:util';
|
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.
|
|
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.D8c1Y4Eu.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.
|
|
13
|
+
const version = "1.7.13";
|
|
14
14
|
|
|
15
15
|
function isWindows() {
|
|
16
16
|
return process.platform === "win32";
|
|
@@ -344,24 +344,30 @@ function injectConfigVariables(content, config) {
|
|
|
344
344
|
processed = processed.replace(/\{\{ROUTING_MODE\}\}/g, routingMode);
|
|
345
345
|
return processed;
|
|
346
346
|
}
|
|
347
|
-
function convertToGitBashPath(windowsPath) {
|
|
348
|
-
if (!isWindows()) {
|
|
349
|
-
return windowsPath;
|
|
350
|
-
}
|
|
351
|
-
let path = windowsPath.replace(/\\/g, "/");
|
|
352
|
-
path = path.replace(/^([A-Z]):/i, (_, drive) => `/${drive.toLowerCase()}`);
|
|
353
|
-
return path;
|
|
354
|
-
}
|
|
355
347
|
function replaceHomePathsInTemplate(content, installDir) {
|
|
356
348
|
const userHome = homedir();
|
|
357
349
|
const ccgDir = join(installDir, ".ccg");
|
|
358
350
|
const binDir = join(installDir, "bin");
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
351
|
+
const claudeDir = installDir;
|
|
352
|
+
let processed = content;
|
|
353
|
+
if (isWindows()) {
|
|
354
|
+
const ccgDirWin = ccgDir.replace(/\//g, "\\");
|
|
355
|
+
processed = processed.replace(/~\/\.claude\/\.ccg/g, ccgDirWin);
|
|
356
|
+
const binDirWin = binDir.replace(/\//g, "\\");
|
|
357
|
+
processed = processed.replace(/~\/\.claude\/bin/g, binDirWin);
|
|
358
|
+
const claudeDirWin = claudeDir.replace(/\//g, "\\");
|
|
359
|
+
processed = processed.replace(/~\/\.claude/g, claudeDirWin);
|
|
360
|
+
const userHomeWin = userHome.replace(/\//g, "\\");
|
|
361
|
+
processed = processed.replace(/~\//g, `${userHomeWin}\\`);
|
|
362
|
+
processed = processed.replace(/([A-Z]):([\\/][^\s"'<>|*?\n]+)/gi, (match, drive, rest) => {
|
|
363
|
+
return `${drive}:${rest.replace(/\//g, "\\")}`;
|
|
364
|
+
});
|
|
365
|
+
} else {
|
|
366
|
+
processed = processed.replace(/~\/\.claude\/\.ccg/g, ccgDir);
|
|
367
|
+
processed = processed.replace(/~\/\.claude\/bin/g, binDir);
|
|
368
|
+
processed = processed.replace(/~\/\.claude/g, claudeDir);
|
|
369
|
+
processed = processed.replace(/~\//g, `${userHome}/`);
|
|
370
|
+
}
|
|
365
371
|
return processed;
|
|
366
372
|
}
|
|
367
373
|
async function installWorkflows(workflowIds, installDir, force = false, config) {
|
|
@@ -1675,6 +1681,9 @@ async function update() {
|
|
|
1675
1681
|
const spinner = ora("\u6B63\u5728\u68C0\u67E5\u6700\u65B0\u7248\u672C...").start();
|
|
1676
1682
|
try {
|
|
1677
1683
|
const { hasUpdate, currentVersion, latestVersion } = await checkForUpdates();
|
|
1684
|
+
const config = await readCcgConfig();
|
|
1685
|
+
const localVersion = config?.general?.version || "0.0.0";
|
|
1686
|
+
const needsWorkflowUpdate = compareVersions(currentVersion, localVersion) > 0;
|
|
1678
1687
|
spinner.stop();
|
|
1679
1688
|
if (!latestVersion) {
|
|
1680
1689
|
console.log(ansis.red("\u274C \u65E0\u6CD5\u8FDE\u63A5\u5230 npm registry\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5"));
|
|
@@ -1682,19 +1691,31 @@ async function update() {
|
|
|
1682
1691
|
}
|
|
1683
1692
|
console.log(`\u5F53\u524D\u7248\u672C: ${ansis.yellow(`v${currentVersion}`)}`);
|
|
1684
1693
|
console.log(`\u6700\u65B0\u7248\u672C: ${ansis.green(`v${latestVersion}`)}`);
|
|
1694
|
+
if (localVersion !== "0.0.0") {
|
|
1695
|
+
console.log(`\u672C\u5730\u5DE5\u4F5C\u6D41: ${ansis.gray(`v${localVersion}`)}`);
|
|
1696
|
+
}
|
|
1685
1697
|
console.log();
|
|
1686
|
-
const
|
|
1698
|
+
const effectiveNeedsUpdate = hasUpdate || needsWorkflowUpdate;
|
|
1699
|
+
let message;
|
|
1700
|
+
if (hasUpdate) {
|
|
1701
|
+
message = `\u786E\u8BA4\u8981\u66F4\u65B0\u5230 v${latestVersion} \u5417\uFF1F\uFF08\u5148\u4E0B\u8F7D\u6700\u65B0\u5305 \u2192 \u5220\u9664\u65E7\u5DE5\u4F5C\u6D41 \u2192 \u5B89\u88C5\u65B0\u5DE5\u4F5C\u6D41\uFF09`;
|
|
1702
|
+
} else if (needsWorkflowUpdate) {
|
|
1703
|
+
message = `\u68C0\u6D4B\u5230\u672C\u5730\u5DE5\u4F5C\u6D41\u7248\u672C (v${localVersion}) \u4F4E\u4E8E\u5F53\u524D\u7248\u672C (v${currentVersion})\uFF0C\u662F\u5426\u66F4\u65B0\uFF1F`;
|
|
1704
|
+
} else {
|
|
1705
|
+
message = "\u5F53\u524D\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002\u8981\u91CD\u65B0\u5B89\u88C5\u5417\uFF1F\uFF08\u5148\u4E0B\u8F7D\u6700\u65B0\u5305 \u2192 \u5220\u9664\u65E7\u5DE5\u4F5C\u6D41 \u2192 \u5B89\u88C5\u65B0\u5DE5\u4F5C\u6D41\uFF09";
|
|
1706
|
+
}
|
|
1687
1707
|
const { confirmUpdate } = await inquirer.prompt([{
|
|
1688
1708
|
type: "confirm",
|
|
1689
1709
|
name: "confirmUpdate",
|
|
1690
1710
|
message,
|
|
1691
|
-
default:
|
|
1711
|
+
default: effectiveNeedsUpdate
|
|
1712
|
+
// Default to true if needs update
|
|
1692
1713
|
}]);
|
|
1693
1714
|
if (!confirmUpdate) {
|
|
1694
1715
|
console.log(ansis.gray("\u5DF2\u53D6\u6D88\u66F4\u65B0"));
|
|
1695
1716
|
return;
|
|
1696
1717
|
}
|
|
1697
|
-
await performUpdate(currentVersion, latestVersion || currentVersion, hasUpdate);
|
|
1718
|
+
await performUpdate(currentVersion, latestVersion || currentVersion, hasUpdate || needsWorkflowUpdate);
|
|
1698
1719
|
} catch (error) {
|
|
1699
1720
|
spinner.stop();
|
|
1700
1721
|
console.log(ansis.red(`\u274C \u66F4\u65B0\u5931\u8D25: ${error}`));
|