ccman 3.3.16 → 3.3.17
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/index.js +44 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var init_package = __esm({
|
|
|
15
15
|
"../core/package.json"() {
|
|
16
16
|
package_default = {
|
|
17
17
|
name: "@ccman/core",
|
|
18
|
-
version: "3.3.
|
|
18
|
+
version: "3.3.17",
|
|
19
19
|
type: "module",
|
|
20
20
|
description: "Core business logic for ccman - Manage Codex, Claude Code, Gemini CLI, OpenCode, OpenClaw, and MCP configurations",
|
|
21
21
|
main: "./dist/index.js",
|
|
@@ -7154,8 +7154,16 @@ import inquirer38 from "inquirer";
|
|
|
7154
7154
|
var DEFAULT_PROVIDER_NAME2 = "gmn";
|
|
7155
7155
|
var VALID_PLATFORMS = ["codex", "opencode", "openclaw"];
|
|
7156
7156
|
var DEFAULT_PLATFORMS = ["codex", "opencode"];
|
|
7157
|
-
var
|
|
7158
|
-
|
|
7157
|
+
var GMN_PROFILE = {
|
|
7158
|
+
commandName: "gmn",
|
|
7159
|
+
title: "GMN",
|
|
7160
|
+
openaiBaseUrl: "https://gmn.chuangzuoli.com"
|
|
7161
|
+
};
|
|
7162
|
+
var GMN1_PROFILE = {
|
|
7163
|
+
commandName: "gmn1",
|
|
7164
|
+
title: "GMN1",
|
|
7165
|
+
openaiBaseUrl: "https://gmncode.cn"
|
|
7166
|
+
};
|
|
7159
7167
|
var TOTAL_STEPS = 3;
|
|
7160
7168
|
function renderStep(current, total, title) {
|
|
7161
7169
|
const barLength = total;
|
|
@@ -7163,7 +7171,7 @@ function renderStep(current, total, title) {
|
|
|
7163
7171
|
const bar = `${"\u25A0".repeat(filledLength)}${"\u25A1".repeat(barLength - filledLength)}`;
|
|
7164
7172
|
return `\u6B65\u9AA4 ${current}/${total} [${bar}] ${title}`;
|
|
7165
7173
|
}
|
|
7166
|
-
function printBanner() {
|
|
7174
|
+
function printBanner(title) {
|
|
7167
7175
|
printLogo();
|
|
7168
7176
|
console.log(
|
|
7169
7177
|
chalk54.cyanBright(
|
|
@@ -7174,7 +7182,7 @@ function printBanner() {
|
|
|
7174
7182
|
" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551",
|
|
7175
7183
|
" \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551",
|
|
7176
7184
|
" \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D",
|
|
7177
|
-
|
|
7185
|
+
` CCMAN ${title} \u4E00\u952E\u914D\u7F6E\u5411\u5BFC`
|
|
7178
7186
|
].join("\n")
|
|
7179
7187
|
)
|
|
7180
7188
|
);
|
|
@@ -7225,12 +7233,12 @@ function parsePlatforms(platformArg) {
|
|
|
7225
7233
|
}
|
|
7226
7234
|
return platforms;
|
|
7227
7235
|
}
|
|
7228
|
-
async function promptApiKey() {
|
|
7236
|
+
async function promptApiKey(title) {
|
|
7229
7237
|
const answers = await inquirer38.prompt([
|
|
7230
7238
|
{
|
|
7231
7239
|
type: "password",
|
|
7232
7240
|
name: "apiKey",
|
|
7233
|
-
message:
|
|
7241
|
+
message: `\u8BF7\u8F93\u5165 ${title} API Key:`,
|
|
7234
7242
|
mask: "*",
|
|
7235
7243
|
validate: (value) => {
|
|
7236
7244
|
if (!value?.trim()) return "API Key \u4E0D\u80FD\u4E3A\u7A7A";
|
|
@@ -7240,7 +7248,7 @@ async function promptApiKey() {
|
|
|
7240
7248
|
]);
|
|
7241
7249
|
return answers.apiKey.trim();
|
|
7242
7250
|
}
|
|
7243
|
-
async function promptPlatforms() {
|
|
7251
|
+
async function promptPlatforms(title) {
|
|
7244
7252
|
const answers = await inquirer38.prompt([
|
|
7245
7253
|
{
|
|
7246
7254
|
type: "checkbox",
|
|
@@ -7250,7 +7258,7 @@ async function promptPlatforms() {
|
|
|
7250
7258
|
choices: [
|
|
7251
7259
|
{ name: "Codex\uFF08\u9700\u5355\u72EC\u8BA2\u9605 OpenAI \u5957\u9910\uFF09", value: "codex" },
|
|
7252
7260
|
{ name: "OpenCode\uFF08\u4E0E Codex \u5171\u4EAB OpenAI \u5957\u9910\uFF09", value: "opencode" },
|
|
7253
|
-
{ name:
|
|
7261
|
+
{ name: `OpenClaw\uFF08${title} /v1 \u7AEF\u70B9\uFF0C\u9ED8\u8BA4\u4E0D\u9009\u4E2D\uFF09`, value: "openclaw" },
|
|
7254
7262
|
{ name: "\u5168\u90E8\uFF08\u5C06\u4F9D\u6B21\u914D\u7F6E Codex\u3001OpenCode\u3001OpenClaw\uFF09", value: "all" }
|
|
7255
7263
|
],
|
|
7256
7264
|
default: DEFAULT_PLATFORMS,
|
|
@@ -7266,11 +7274,11 @@ async function promptPlatforms() {
|
|
|
7266
7274
|
}
|
|
7267
7275
|
return selected;
|
|
7268
7276
|
}
|
|
7269
|
-
async function resolvePlatforms(platformArg) {
|
|
7277
|
+
async function resolvePlatforms(platformArg, title = "GMN") {
|
|
7270
7278
|
if (platformArg && platformArg.trim().length > 0) {
|
|
7271
7279
|
return parsePlatforms(platformArg);
|
|
7272
7280
|
}
|
|
7273
|
-
return promptPlatforms();
|
|
7281
|
+
return promptPlatforms(title);
|
|
7274
7282
|
}
|
|
7275
7283
|
function resolveProviderName2(providerNameArg) {
|
|
7276
7284
|
if (providerNameArg === void 0) {
|
|
@@ -7357,14 +7365,18 @@ function rollbackFromBackupOrThrow(result) {
|
|
|
7357
7365
|
throw new Error(`\u56DE\u6EDA\u5931\u8D25: ${errors.join("; ")}`);
|
|
7358
7366
|
}
|
|
7359
7367
|
}
|
|
7360
|
-
|
|
7361
|
-
|
|
7368
|
+
function buildOpenClawBaseUrl(openaiBaseUrl) {
|
|
7369
|
+
const normalized = openaiBaseUrl.replace(/\/+$/, "");
|
|
7370
|
+
return `${normalized}/v1`;
|
|
7371
|
+
}
|
|
7372
|
+
async function runGmnCommand(profile, apiKey, platformArg, providerNameArg) {
|
|
7373
|
+
printBanner(profile.title);
|
|
7362
7374
|
let platforms;
|
|
7363
7375
|
let providerName;
|
|
7364
7376
|
try {
|
|
7365
7377
|
console.log(chalk54.cyan(`
|
|
7366
7378
|
${renderStep(1, TOTAL_STEPS, "\u9009\u62E9\u8981\u914D\u7F6E\u7684\u5DE5\u5177")}`));
|
|
7367
|
-
platforms = await resolvePlatforms(platformArg);
|
|
7379
|
+
platforms = await resolvePlatforms(platformArg, profile.title);
|
|
7368
7380
|
providerName = resolveProviderName2(providerNameArg);
|
|
7369
7381
|
} catch (error) {
|
|
7370
7382
|
console.error(chalk54.red(`\u274C ${error.message}`));
|
|
@@ -7377,7 +7389,7 @@ ${renderStep(1, TOTAL_STEPS, "\u9009\u62E9\u8981\u914D\u7F6E\u7684\u5DE5\u5177")
|
|
|
7377
7389
|
console.log(chalk54.cyan(`
|
|
7378
7390
|
${renderStep(2, TOTAL_STEPS, "\u8F93\u5165 API Key")}`));
|
|
7379
7391
|
if (!resolvedApiKey) {
|
|
7380
|
-
resolvedApiKey = await promptApiKey();
|
|
7392
|
+
resolvedApiKey = await promptApiKey(profile.title);
|
|
7381
7393
|
} else {
|
|
7382
7394
|
console.log(chalk54.gray("\u5DF2\u901A\u8FC7\u53C2\u6570\u63D0\u4F9B API Key\uFF08\u5DF2\u9690\u85CF\uFF09"));
|
|
7383
7395
|
}
|
|
@@ -7385,11 +7397,12 @@ ${renderStep(2, TOTAL_STEPS, "\u8F93\u5165 API Key")}`));
|
|
|
7385
7397
|
console.error(chalk54.red("\u274C \u9519\u8BEF: API Key \u4E0D\u80FD\u4E3A\u7A7A"));
|
|
7386
7398
|
process.exit(1);
|
|
7387
7399
|
}
|
|
7388
|
-
const openaiBaseUrl =
|
|
7400
|
+
const openaiBaseUrl = profile.openaiBaseUrl;
|
|
7401
|
+
const openclawBaseUrl = buildOpenClawBaseUrl(openaiBaseUrl);
|
|
7389
7402
|
const platformBaseUrls = {
|
|
7390
7403
|
codex: openaiBaseUrl,
|
|
7391
7404
|
opencode: openaiBaseUrl,
|
|
7392
|
-
openclaw:
|
|
7405
|
+
openclaw: openclawBaseUrl
|
|
7393
7406
|
};
|
|
7394
7407
|
console.log(chalk54.cyan(`
|
|
7395
7408
|
${renderStep(3, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
|
|
@@ -7398,14 +7411,14 @@ ${renderStep(3, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
|
|
|
7398
7411
|
console.log(chalk54.gray(`OpenAI Base URL: ${openaiBaseUrl}`));
|
|
7399
7412
|
}
|
|
7400
7413
|
if (platforms.includes("openclaw")) {
|
|
7401
|
-
console.log(chalk54.gray(`OpenClaw Base URL: ${
|
|
7414
|
+
console.log(chalk54.gray(`OpenClaw Base URL: ${openclawBaseUrl}`));
|
|
7402
7415
|
}
|
|
7403
7416
|
printWriteTargets(platforms);
|
|
7404
7417
|
console.log();
|
|
7405
7418
|
const backupRootDir = path15.join(
|
|
7406
7419
|
getCcmanDir(),
|
|
7407
7420
|
"backups",
|
|
7408
|
-
|
|
7421
|
+
`${profile.commandName}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
|
|
7409
7422
|
);
|
|
7410
7423
|
fs13.mkdirSync(backupRootDir, { recursive: true, mode: 448 });
|
|
7411
7424
|
console.log(chalk54.gray(`\u5907\u4EFD\u6839\u76EE\u5F55: ${backupRootDir}`));
|
|
@@ -7462,7 +7475,7 @@ ${renderStep(3, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
|
|
|
7462
7475
|
}
|
|
7463
7476
|
}
|
|
7464
7477
|
console.log(chalk54.green(`
|
|
7465
|
-
\u{1F389}
|
|
7478
|
+
\u{1F389} ${profile.title} \u914D\u7F6E\u5B8C\u6210\uFF01(${completed}/${tools.length})`));
|
|
7466
7479
|
console.log();
|
|
7467
7480
|
console.log(chalk54.bold("\u5907\u4EFD\u4FE1\u606F:"));
|
|
7468
7481
|
if (successBackups.length === 0) {
|
|
@@ -7481,6 +7494,12 @@ ${renderStep(3, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
|
|
|
7481
7494
|
}
|
|
7482
7495
|
console.log(chalk54.gray("\u63D0\u793A\uFF1A\u8BF7\u91CD\u542F\u5BF9\u5E94\u5DE5\u5177/\u63D2\u4EF6\u4EE5\u4F7F\u914D\u7F6E\u751F\u6548\u3002"));
|
|
7483
7496
|
}
|
|
7497
|
+
async function gmnCommand(apiKey, platformArg, providerNameArg) {
|
|
7498
|
+
await runGmnCommand(GMN_PROFILE, apiKey, platformArg, providerNameArg);
|
|
7499
|
+
}
|
|
7500
|
+
async function gmn1Command(apiKey, platformArg, providerNameArg) {
|
|
7501
|
+
await runGmnCommand(GMN1_PROFILE, apiKey, platformArg, providerNameArg);
|
|
7502
|
+
}
|
|
7484
7503
|
|
|
7485
7504
|
// src/index.ts
|
|
7486
7505
|
init_dist2();
|
|
@@ -7516,7 +7535,8 @@ program.on("command:*", (operands) => {
|
|
|
7516
7535
|
"sync",
|
|
7517
7536
|
"export",
|
|
7518
7537
|
"import",
|
|
7519
|
-
"gmn"
|
|
7538
|
+
"gmn",
|
|
7539
|
+
"gmn1"
|
|
7520
7540
|
];
|
|
7521
7541
|
const suggestions = availableCommands.filter(
|
|
7522
7542
|
(cmd) => cmd.includes(unknownCommand) || unknownCommand.includes(cmd)
|
|
@@ -7578,6 +7598,9 @@ importCommand(program);
|
|
|
7578
7598
|
program.command("gmn [apiKey]").description("\u914D\u7F6E GMN \u5230 Codex\u3001OpenCode\u3001OpenClaw").option("-p, --platform <platforms>", "\u6307\u5B9A\u5E73\u53F0 (codex,opencode,openclaw,all)").option("-n, --name <providerName>", "\u6307\u5B9A\u670D\u52A1\u5546\u540D\u79F0\uFF08\u9ED8\u8BA4: gmn\uFF09").action(async (apiKey, options) => {
|
|
7579
7599
|
await gmnCommand(apiKey, options.platform, options.name);
|
|
7580
7600
|
});
|
|
7601
|
+
program.command("gmn1 [apiKey]").description("\u914D\u7F6E GMN1 \u5230 Codex\u3001OpenCode\u3001OpenClaw\uFF08\u9ED8\u8BA4 URL: https://gmncode.cn\uFF09").option("-p, --platform <platforms>", "\u6307\u5B9A\u5E73\u53F0 (codex,opencode,openclaw,all)").option("-n, --name <providerName>", "\u6307\u5B9A\u670D\u52A1\u5546\u540D\u79F0\uFF08\u9ED8\u8BA4: gmn\uFF09").action(async (apiKey, options) => {
|
|
7602
|
+
await gmn1Command(apiKey, options.platform, options.name);
|
|
7603
|
+
});
|
|
7581
7604
|
(async () => {
|
|
7582
7605
|
if (!process.argv.slice(2).length) {
|
|
7583
7606
|
printLogo();
|