zcf 3.1.3 → 3.1.4
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/README.md +2 -3
- package/dist/chunks/simple-config.mjs +230 -42
- package/dist/cli.mjs +74 -19
- package/dist/i18n/locales/en/cli.json +2 -0
- package/dist/i18n/locales/en/errors.json +1 -0
- package/dist/i18n/locales/zh-CN/cli.json +2 -0
- package/dist/i18n/locales/zh-CN/errors.json +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
- package/templates/codex/en/workflow/git/prompts/git-cleanBranches.md +102 -0
- package/templates/codex/en/workflow/git/prompts/git-commit.md +157 -0
- package/templates/codex/en/workflow/git/prompts/git-rollback.md +90 -0
- package/templates/codex/en/workflow/git/prompts/git-worktree.md +276 -0
- package/templates/codex/en/workflow/sixStep/prompts/workflow.md +140 -121
- package/templates/codex/zh-CN/workflow/git/prompts/git-cleanBranches.md +102 -0
- package/templates/codex/zh-CN/workflow/git/prompts/git-commit.md +157 -0
- package/templates/codex/zh-CN/workflow/git/prompts/git-rollback.md +90 -0
- package/templates/codex/zh-CN/workflow/git/prompts/git-worktree.md +276 -0
- package/templates/codex/zh-CN/workflow/sixStep/prompts/workflow.md +16 -33
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Menu options include:
|
|
|
43
43
|
|
|
44
44
|
**Model Configuration (Option 5)**: Configure your default Claude model with flexible options:
|
|
45
45
|
- **Default**: Let Claude Code automatically choose the best model for each task
|
|
46
|
-
- **Opus**: Use Claude-
|
|
46
|
+
- **Opus**: Use Claude-4.1-Opus exclusively (high token consumption, use with caution)
|
|
47
47
|
- **Sonnet 1M**: Use Sonnet with 1M context window for larger context tasks
|
|
48
48
|
- **Custom**: Specify your own model names for both primary and fast tasks (supports any custom model)
|
|
49
49
|
|
|
@@ -351,8 +351,6 @@ After configuration:
|
|
|
351
351
|
- `/feat <task description>` - Start new feature development, divided into plan and UI phases
|
|
352
352
|
- `/workflow <task description>` - Execute complete development workflow, not automated, starts with multiple solution options, asks for user feedback at each step, allows plan modifications, maximum control
|
|
353
353
|
|
|
354
|
-
> **⚠️ Important Note for Codex Users**: Due to Codex functionality limitations, prompts cannot pass parameters directly. When using `/workflow`, you need to send the workflow command first, wait for AI response, then send your task description in a separate message.
|
|
355
|
-
|
|
356
354
|
> **PS**:
|
|
357
355
|
>
|
|
358
356
|
> - Both feat and workflow have their advantages, try both to compare
|
|
@@ -786,6 +784,7 @@ A huge thank you to all our sponsors for their generous support!
|
|
|
786
784
|
- r\*r (first anonymous sponsor🤣)
|
|
787
785
|
- \*\*康 (first KFC sponsor🍗)
|
|
788
786
|
- \*东 (first coffee sponsor☕️)
|
|
787
|
+
- 炼\*3 (first Termux user sponsor📱)
|
|
789
788
|
- 16°C coffee (My best friend🤪, offered Claude Code max $200 package)
|
|
790
789
|
|
|
791
790
|
## 📄 License
|
|
@@ -16,7 +16,7 @@ import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
|
|
|
16
16
|
import i18next from 'i18next';
|
|
17
17
|
import Backend from 'i18next-fs-backend';
|
|
18
18
|
|
|
19
|
-
const version = "3.1.
|
|
19
|
+
const version = "3.1.4";
|
|
20
20
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
21
21
|
|
|
22
22
|
const i18n = i18next.createInstance();
|
|
@@ -2498,12 +2498,15 @@ async function selectScriptLanguage(currentLang) {
|
|
|
2498
2498
|
});
|
|
2499
2499
|
return scriptLang;
|
|
2500
2500
|
}
|
|
2501
|
-
async function resolveAiOutputLanguage(scriptLang, commandLineOption, savedConfig) {
|
|
2501
|
+
async function resolveAiOutputLanguage(scriptLang, commandLineOption, savedConfig, skipPrompt) {
|
|
2502
2502
|
ensureI18nInitialized();
|
|
2503
2503
|
if (commandLineOption) {
|
|
2504
2504
|
return commandLineOption;
|
|
2505
2505
|
}
|
|
2506
2506
|
if (savedConfig?.aiOutputLang) {
|
|
2507
|
+
if (skipPrompt) {
|
|
2508
|
+
return savedConfig.aiOutputLang;
|
|
2509
|
+
}
|
|
2507
2510
|
const currentLanguageLabel = getAiOutputLanguageLabel(savedConfig.aiOutputLang) || savedConfig.aiOutputLang;
|
|
2508
2511
|
console.log(ansis.blue(`${i18n.t("language:currentConfigFound")}: ${currentLanguageLabel}`));
|
|
2509
2512
|
const { shouldModify } = await inquirer.prompt({
|
|
@@ -2522,6 +2525,9 @@ async function resolveAiOutputLanguage(scriptLang, commandLineOption, savedConfi
|
|
|
2522
2525
|
}
|
|
2523
2526
|
return await selectAiOutputLanguage(scriptLang);
|
|
2524
2527
|
}
|
|
2528
|
+
if (skipPrompt) {
|
|
2529
|
+
return scriptLang;
|
|
2530
|
+
}
|
|
2525
2531
|
return await selectAiOutputLanguage(scriptLang);
|
|
2526
2532
|
}
|
|
2527
2533
|
async function selectTemplateLanguage() {
|
|
@@ -2547,12 +2553,15 @@ async function selectTemplateLanguage() {
|
|
|
2547
2553
|
}
|
|
2548
2554
|
return lang;
|
|
2549
2555
|
}
|
|
2550
|
-
async function resolveTemplateLanguage(commandLineOption, savedConfig) {
|
|
2556
|
+
async function resolveTemplateLanguage(commandLineOption, savedConfig, skipPrompt) {
|
|
2551
2557
|
ensureI18nInitialized();
|
|
2552
2558
|
if (commandLineOption) {
|
|
2553
2559
|
return commandLineOption;
|
|
2554
2560
|
}
|
|
2555
2561
|
if (savedConfig?.templateLang) {
|
|
2562
|
+
if (skipPrompt) {
|
|
2563
|
+
return savedConfig.templateLang;
|
|
2564
|
+
}
|
|
2556
2565
|
const currentLanguageLabel = LANG_LABELS[savedConfig.templateLang];
|
|
2557
2566
|
console.log(ansis.blue(`${i18n.t("language:currentTemplateLanguageFound")}: ${currentLanguageLabel}`));
|
|
2558
2567
|
const { shouldModify } = await inquirer.prompt({
|
|
@@ -2572,6 +2581,9 @@ async function resolveTemplateLanguage(commandLineOption, savedConfig) {
|
|
|
2572
2581
|
return await selectTemplateLanguage();
|
|
2573
2582
|
}
|
|
2574
2583
|
if (savedConfig?.preferredLang && !savedConfig?.templateLang) {
|
|
2584
|
+
if (skipPrompt) {
|
|
2585
|
+
return savedConfig.preferredLang;
|
|
2586
|
+
}
|
|
2575
2587
|
console.log(ansis.yellow(`${i18n.t("language:usingFallbackTemplate")}: ${LANG_LABELS[savedConfig.preferredLang]}`));
|
|
2576
2588
|
const { shouldModify } = await inquirer.prompt({
|
|
2577
2589
|
type: "confirm",
|
|
@@ -2588,9 +2600,12 @@ async function resolveTemplateLanguage(commandLineOption, savedConfig) {
|
|
|
2588
2600
|
}
|
|
2589
2601
|
return await selectTemplateLanguage();
|
|
2590
2602
|
}
|
|
2603
|
+
if (skipPrompt) {
|
|
2604
|
+
return "en";
|
|
2605
|
+
}
|
|
2591
2606
|
return await selectTemplateLanguage();
|
|
2592
2607
|
}
|
|
2593
|
-
async function resolveSystemPromptStyle(availablePrompts, commandLineOption, savedConfig) {
|
|
2608
|
+
async function resolveSystemPromptStyle(availablePrompts, commandLineOption, savedConfig, skipPrompt) {
|
|
2594
2609
|
ensureI18nInitialized();
|
|
2595
2610
|
if (commandLineOption && availablePrompts.some((p) => p.id === commandLineOption)) {
|
|
2596
2611
|
return commandLineOption;
|
|
@@ -2599,6 +2614,9 @@ async function resolveSystemPromptStyle(availablePrompts, commandLineOption, sav
|
|
|
2599
2614
|
const currentStyleId = savedConfig.codex.systemPromptStyle;
|
|
2600
2615
|
const currentStyle = availablePrompts.find((p) => p.id === currentStyleId);
|
|
2601
2616
|
if (currentStyle) {
|
|
2617
|
+
if (skipPrompt) {
|
|
2618
|
+
return currentStyleId;
|
|
2619
|
+
}
|
|
2602
2620
|
console.log(ansis.blue(`${i18n.t("language:currentSystemPromptFound")}: ${currentStyle.name}`));
|
|
2603
2621
|
const { shouldModify } = await inquirer.prompt({
|
|
2604
2622
|
type: "confirm",
|
|
@@ -2616,6 +2634,9 @@ async function resolveSystemPromptStyle(availablePrompts, commandLineOption, sav
|
|
|
2616
2634
|
}
|
|
2617
2635
|
}
|
|
2618
2636
|
}
|
|
2637
|
+
if (skipPrompt) {
|
|
2638
|
+
return "engineer-professional";
|
|
2639
|
+
}
|
|
2619
2640
|
const { systemPrompt } = await inquirer.prompt([{
|
|
2620
2641
|
type: "list",
|
|
2621
2642
|
name: "systemPrompt",
|
|
@@ -3124,21 +3145,22 @@ async function runCodexWorkflowImport() {
|
|
|
3124
3145
|
async function runCodexWorkflowImportWithLanguageSelection(options) {
|
|
3125
3146
|
ensureI18nInitialized();
|
|
3126
3147
|
const zcfConfig = readZcfConfig();
|
|
3127
|
-
const { aiOutputLang: commandLineOption, skipPrompt } = options ?? {};
|
|
3128
|
-
const aiOutputLang =
|
|
3148
|
+
const { aiOutputLang: commandLineOption, skipPrompt = false } = options ?? {};
|
|
3149
|
+
const aiOutputLang = await resolveAiOutputLanguage(
|
|
3129
3150
|
i18n.language,
|
|
3130
3151
|
commandLineOption,
|
|
3131
|
-
zcfConfig
|
|
3152
|
+
zcfConfig,
|
|
3153
|
+
skipPrompt
|
|
3132
3154
|
);
|
|
3133
3155
|
updateZcfConfig({ aiOutputLang });
|
|
3134
3156
|
applyAiLanguageDirective(aiOutputLang);
|
|
3135
|
-
await runCodexSystemPromptSelection();
|
|
3157
|
+
await runCodexSystemPromptSelection(skipPrompt);
|
|
3136
3158
|
ensureCodexAgentsLanguageDirective(aiOutputLang);
|
|
3137
|
-
await runCodexWorkflowSelection();
|
|
3159
|
+
await runCodexWorkflowSelection(options);
|
|
3138
3160
|
console.log(ansis.green(i18n.t("codex:workflowInstall")));
|
|
3139
3161
|
return aiOutputLang;
|
|
3140
3162
|
}
|
|
3141
|
-
async function runCodexSystemPromptSelection() {
|
|
3163
|
+
async function runCodexSystemPromptSelection(skipPrompt = false) {
|
|
3142
3164
|
ensureI18nInitialized();
|
|
3143
3165
|
const rootDir = getRootDir$1();
|
|
3144
3166
|
const templateRoot = join(rootDir, "templates", "codex");
|
|
@@ -3149,7 +3171,9 @@ async function runCodexSystemPromptSelection() {
|
|
|
3149
3171
|
const preferredLang = await resolveTemplateLanguage(
|
|
3150
3172
|
void 0,
|
|
3151
3173
|
// No command line option for this function
|
|
3152
|
-
zcfConfig$1
|
|
3174
|
+
zcfConfig$1,
|
|
3175
|
+
skipPrompt
|
|
3176
|
+
// Pass skipPrompt flag
|
|
3153
3177
|
);
|
|
3154
3178
|
updateZcfConfig({ templateLang: preferredLang });
|
|
3155
3179
|
let langDir = join(templateRoot, preferredLang);
|
|
@@ -3187,7 +3211,9 @@ async function runCodexSystemPromptSelection() {
|
|
|
3187
3211
|
availablePrompts,
|
|
3188
3212
|
void 0,
|
|
3189
3213
|
// No command line option for this function
|
|
3190
|
-
tomlConfig
|
|
3214
|
+
tomlConfig,
|
|
3215
|
+
skipPrompt
|
|
3216
|
+
// Pass skipPrompt flag
|
|
3191
3217
|
);
|
|
3192
3218
|
if (!systemPrompt)
|
|
3193
3219
|
return;
|
|
@@ -3211,8 +3237,9 @@ async function runCodexSystemPromptSelection() {
|
|
|
3211
3237
|
console.error("Failed to update ZCF config:", error);
|
|
3212
3238
|
}
|
|
3213
3239
|
}
|
|
3214
|
-
async function runCodexWorkflowSelection() {
|
|
3240
|
+
async function runCodexWorkflowSelection(options) {
|
|
3215
3241
|
ensureI18nInitialized();
|
|
3242
|
+
const { skipPrompt = false, workflows: presetWorkflows = [] } = options ?? {};
|
|
3216
3243
|
const rootDir = getRootDir$1();
|
|
3217
3244
|
const templateRoot = join(rootDir, "templates", "codex");
|
|
3218
3245
|
const zcfConfig = readZcfConfig();
|
|
@@ -3227,6 +3254,29 @@ async function runCodexWorkflowSelection() {
|
|
|
3227
3254
|
const allWorkflows = getAllWorkflowFiles(workflowSrc);
|
|
3228
3255
|
if (allWorkflows.length === 0)
|
|
3229
3256
|
return;
|
|
3257
|
+
if (skipPrompt) {
|
|
3258
|
+
ensureDir(CODEX_PROMPTS_DIR);
|
|
3259
|
+
const backupPath2 = backupCodexPrompts();
|
|
3260
|
+
if (backupPath2) {
|
|
3261
|
+
console.log(ansis.gray(getBackupMessage(backupPath2)));
|
|
3262
|
+
}
|
|
3263
|
+
let workflowsToInstall;
|
|
3264
|
+
if (presetWorkflows.length > 0) {
|
|
3265
|
+
const selectedWorkflows = allWorkflows.filter(
|
|
3266
|
+
(workflow) => presetWorkflows.includes(workflow.name)
|
|
3267
|
+
);
|
|
3268
|
+
workflowsToInstall = expandSelectedWorkflowPaths(selectedWorkflows.map((w) => w.path), workflowSrc);
|
|
3269
|
+
} else {
|
|
3270
|
+
workflowsToInstall = expandSelectedWorkflowPaths(allWorkflows.map((w) => w.path), workflowSrc);
|
|
3271
|
+
}
|
|
3272
|
+
for (const workflowPath of workflowsToInstall) {
|
|
3273
|
+
const content = readFile(workflowPath);
|
|
3274
|
+
const filename = workflowPath.split("/").pop() || "workflow.md";
|
|
3275
|
+
const targetPath = join(CODEX_PROMPTS_DIR, filename);
|
|
3276
|
+
writeFile(targetPath, content);
|
|
3277
|
+
}
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
3230
3280
|
const { workflows } = await inquirer.prompt([{
|
|
3231
3281
|
type: "checkbox",
|
|
3232
3282
|
name: "workflows",
|
|
@@ -3245,13 +3295,15 @@ async function runCodexWorkflowSelection() {
|
|
|
3245
3295
|
if (backupPath) {
|
|
3246
3296
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
3247
3297
|
}
|
|
3248
|
-
|
|
3298
|
+
const finalWorkflowPaths = expandSelectedWorkflowPaths(workflows, workflowSrc);
|
|
3299
|
+
for (const workflowPath of finalWorkflowPaths) {
|
|
3249
3300
|
const content = readFile(workflowPath);
|
|
3250
3301
|
const filename = workflowPath.split("/").pop() || "workflow.md";
|
|
3251
3302
|
const targetPath = join(CODEX_PROMPTS_DIR, filename);
|
|
3252
3303
|
writeFile(targetPath, content);
|
|
3253
3304
|
}
|
|
3254
3305
|
}
|
|
3306
|
+
const GIT_GROUP_SENTINEL = "::gitGroup";
|
|
3255
3307
|
function getAllWorkflowFiles(dirPath) {
|
|
3256
3308
|
const workflows = [];
|
|
3257
3309
|
const sixStepDir = join(dirPath, "sixStep", "prompts");
|
|
@@ -3264,8 +3316,43 @@ function getAllWorkflowFiles(dirPath) {
|
|
|
3264
3316
|
});
|
|
3265
3317
|
}
|
|
3266
3318
|
}
|
|
3319
|
+
const gitPromptsDir = join(dirPath, "git", "prompts");
|
|
3320
|
+
if (exists(gitPromptsDir)) {
|
|
3321
|
+
workflows.push({
|
|
3322
|
+
name: i18n.t("workflow:workflowOption.gitWorkflow"),
|
|
3323
|
+
// Use sentinel path for grouped selection; expanded later
|
|
3324
|
+
path: GIT_GROUP_SENTINEL
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3267
3327
|
return workflows;
|
|
3268
3328
|
}
|
|
3329
|
+
function expandSelectedWorkflowPaths(paths, workflowSrc) {
|
|
3330
|
+
const expanded = [];
|
|
3331
|
+
for (const p of paths) {
|
|
3332
|
+
if (p === GIT_GROUP_SENTINEL) {
|
|
3333
|
+
expanded.push(...getGitPromptFiles(workflowSrc));
|
|
3334
|
+
} else {
|
|
3335
|
+
expanded.push(p);
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
return expanded;
|
|
3339
|
+
}
|
|
3340
|
+
function getGitPromptFiles(workflowSrc) {
|
|
3341
|
+
const gitDir = join(workflowSrc, "git", "prompts");
|
|
3342
|
+
const files = [
|
|
3343
|
+
"git-commit.md",
|
|
3344
|
+
"git-rollback.md",
|
|
3345
|
+
"git-cleanBranches.md",
|
|
3346
|
+
"git-worktree.md"
|
|
3347
|
+
];
|
|
3348
|
+
const resolved = [];
|
|
3349
|
+
for (const f of files) {
|
|
3350
|
+
const full = join(gitDir, f);
|
|
3351
|
+
if (exists(full))
|
|
3352
|
+
resolved.push(full);
|
|
3353
|
+
}
|
|
3354
|
+
return resolved;
|
|
3355
|
+
}
|
|
3269
3356
|
function toProvidersList(providers) {
|
|
3270
3357
|
return providers.map((provider) => ({ name: provider.name || provider.id, value: provider.id }));
|
|
3271
3358
|
}
|
|
@@ -3285,10 +3372,59 @@ function createApiConfigChoices(providers, currentProvider, isCommented) {
|
|
|
3285
3372
|
});
|
|
3286
3373
|
return choices;
|
|
3287
3374
|
}
|
|
3288
|
-
async function
|
|
3375
|
+
async function applyCustomApiConfig(customApiConfig) {
|
|
3376
|
+
const { type, token, baseUrl } = customApiConfig;
|
|
3377
|
+
const backupPath = backupCodexComplete();
|
|
3378
|
+
if (backupPath) {
|
|
3379
|
+
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
3380
|
+
}
|
|
3381
|
+
const providers = [];
|
|
3382
|
+
const authEntries = {};
|
|
3383
|
+
const providerId = type === "auth_token" ? "official-auth-token" : "custom-api-key";
|
|
3384
|
+
const providerName = type === "auth_token" ? "Official Auth Token" : "Custom API Key";
|
|
3385
|
+
providers.push({
|
|
3386
|
+
id: providerId,
|
|
3387
|
+
name: providerName,
|
|
3388
|
+
baseUrl: baseUrl || "https://api.anthropic.com",
|
|
3389
|
+
wireApi: "claude",
|
|
3390
|
+
envKey: `${providerId.toUpperCase()}_API_KEY`,
|
|
3391
|
+
requiresOpenaiAuth: false
|
|
3392
|
+
});
|
|
3393
|
+
if (token) {
|
|
3394
|
+
authEntries[providerId] = token;
|
|
3395
|
+
}
|
|
3396
|
+
const configData = {
|
|
3397
|
+
model: "claude-3-5-sonnet-20241022",
|
|
3398
|
+
modelProvider: providerId,
|
|
3399
|
+
modelProviderCommented: false,
|
|
3400
|
+
providers,
|
|
3401
|
+
mcpServices: []};
|
|
3402
|
+
writeFile(CODEX_CONFIG_FILE, renderCodexConfig(configData));
|
|
3403
|
+
writeJsonConfig(CODEX_AUTH_FILE, authEntries);
|
|
3404
|
+
updateZcfConfig({ codeToolType: "codex" });
|
|
3405
|
+
console.log(ansis.green(`\u2714 ${i18n.t("codex:apiConfigured")}`));
|
|
3406
|
+
}
|
|
3407
|
+
async function configureCodexApi(options) {
|
|
3289
3408
|
ensureI18nInitialized();
|
|
3409
|
+
const { skipPrompt = false, apiMode, customApiConfig } = options ?? {};
|
|
3290
3410
|
const existingConfig = readCodexConfig();
|
|
3291
3411
|
const existingAuth = readJsonConfig(CODEX_AUTH_FILE, { defaultValue: {} }) || {};
|
|
3412
|
+
if (skipPrompt) {
|
|
3413
|
+
if (apiMode === "skip") {
|
|
3414
|
+
return;
|
|
3415
|
+
}
|
|
3416
|
+
if (apiMode === "custom" && customApiConfig) {
|
|
3417
|
+
await applyCustomApiConfig(customApiConfig);
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
if (apiMode === "official") {
|
|
3421
|
+
const success = await switchToOfficialLogin();
|
|
3422
|
+
if (success) {
|
|
3423
|
+
updateZcfConfig({ codeToolType: "codex" });
|
|
3424
|
+
}
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3292
3428
|
const hasProviders = existingConfig?.providers && existingConfig.providers.length > 0;
|
|
3293
3429
|
const modeChoices = [
|
|
3294
3430
|
{ name: i18n.t("codex:apiModeOfficial"), value: "official" },
|
|
@@ -3477,9 +3613,13 @@ async function configureCodexApi() {
|
|
|
3477
3613
|
updateZcfConfig({ codeToolType: "codex" });
|
|
3478
3614
|
console.log(ansis.green(i18n.t("codex:apiConfigured")));
|
|
3479
3615
|
}
|
|
3480
|
-
async function configureCodexMcp() {
|
|
3616
|
+
async function configureCodexMcp(options) {
|
|
3481
3617
|
ensureI18nInitialized();
|
|
3618
|
+
const { skipPrompt = false } = options ?? {};
|
|
3482
3619
|
const existingConfig = readCodexConfig();
|
|
3620
|
+
if (skipPrompt) {
|
|
3621
|
+
return;
|
|
3622
|
+
}
|
|
3483
3623
|
const backupPath = backupCodexComplete();
|
|
3484
3624
|
if (backupPath) {
|
|
3485
3625
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -3593,8 +3733,8 @@ async function runCodexFullInit(options) {
|
|
|
3593
3733
|
ensureI18nInitialized();
|
|
3594
3734
|
await installCodexCli();
|
|
3595
3735
|
const aiOutputLang = await runCodexWorkflowImportWithLanguageSelection(options);
|
|
3596
|
-
await configureCodexApi();
|
|
3597
|
-
await configureCodexMcp();
|
|
3736
|
+
await configureCodexApi(options);
|
|
3737
|
+
await configureCodexMcp(options);
|
|
3598
3738
|
return aiOutputLang;
|
|
3599
3739
|
}
|
|
3600
3740
|
function ensureCodexAgentsLanguageDirective(aiOutputLang) {
|
|
@@ -3634,7 +3774,10 @@ function normalizeLanguageLabel(label) {
|
|
|
3634
3774
|
}
|
|
3635
3775
|
async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
3636
3776
|
ensureI18nInitialized();
|
|
3637
|
-
|
|
3777
|
+
console.log(ansis.bold.cyan(`
|
|
3778
|
+
\u{1F50D} ${i18n.t("updater:checkingTools")}
|
|
3779
|
+
`));
|
|
3780
|
+
const spinner = ora(i18n.t("updater:checkingVersion")).start();
|
|
3638
3781
|
try {
|
|
3639
3782
|
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCodexUpdate();
|
|
3640
3783
|
spinner.stop();
|
|
@@ -3897,6 +4040,43 @@ const codex = {
|
|
|
3897
4040
|
writeCodexConfig: writeCodexConfig
|
|
3898
4041
|
};
|
|
3899
4042
|
|
|
4043
|
+
const CODE_TYPE_ABBREVIATIONS = {
|
|
4044
|
+
cc: "claude-code",
|
|
4045
|
+
cx: "codex"
|
|
4046
|
+
};
|
|
4047
|
+
async function resolveCodeType(codeTypeParam) {
|
|
4048
|
+
if (codeTypeParam) {
|
|
4049
|
+
const normalizedParam = codeTypeParam.toLowerCase().trim();
|
|
4050
|
+
if (normalizedParam in CODE_TYPE_ABBREVIATIONS) {
|
|
4051
|
+
return CODE_TYPE_ABBREVIATIONS[normalizedParam];
|
|
4052
|
+
}
|
|
4053
|
+
if (isValidCodeType(normalizedParam)) {
|
|
4054
|
+
return normalizedParam;
|
|
4055
|
+
}
|
|
4056
|
+
const validAbbreviations = Object.keys(CODE_TYPE_ABBREVIATIONS);
|
|
4057
|
+
const validFullTypes = Object.values(CODE_TYPE_ABBREVIATIONS);
|
|
4058
|
+
const validOptions = [...validAbbreviations, ...validFullTypes].join(", ");
|
|
4059
|
+
throw new Error(
|
|
4060
|
+
i18n.t(
|
|
4061
|
+
"errors:invalidCodeType",
|
|
4062
|
+
`Invalid code type: "${codeTypeParam}". Valid options are: ${validOptions}.`,
|
|
4063
|
+
{ value: codeTypeParam, validOptions }
|
|
4064
|
+
)
|
|
4065
|
+
);
|
|
4066
|
+
}
|
|
4067
|
+
try {
|
|
4068
|
+
const config = await readZcfConfigAsync();
|
|
4069
|
+
if (config?.codeToolType && isValidCodeType(config.codeToolType)) {
|
|
4070
|
+
return config.codeToolType;
|
|
4071
|
+
}
|
|
4072
|
+
} catch {
|
|
4073
|
+
}
|
|
4074
|
+
return DEFAULT_CODE_TOOL_TYPE;
|
|
4075
|
+
}
|
|
4076
|
+
function isValidCodeType(value) {
|
|
4077
|
+
return ["claude-code", "codex"].includes(value);
|
|
4078
|
+
}
|
|
4079
|
+
|
|
3900
4080
|
function getPlatformStatusLineConfig() {
|
|
3901
4081
|
return {
|
|
3902
4082
|
type: "command",
|
|
@@ -4793,12 +4973,6 @@ function validateSkipPromptOptions(options) {
|
|
|
4793
4973
|
if (!options.configAction) {
|
|
4794
4974
|
options.configAction = "backup";
|
|
4795
4975
|
}
|
|
4796
|
-
if (!options.configLang) {
|
|
4797
|
-
options.configLang = "en";
|
|
4798
|
-
}
|
|
4799
|
-
if (!options.aiOutputLang) {
|
|
4800
|
-
options.aiOutputLang = "en";
|
|
4801
|
-
}
|
|
4802
4976
|
if (typeof options.outputStyles === "string") {
|
|
4803
4977
|
if (options.outputStyles === "skip") {
|
|
4804
4978
|
options.outputStyles = false;
|
|
@@ -4893,22 +5067,20 @@ function validateSkipPromptOptions(options) {
|
|
|
4893
5067
|
options.workflows = WORKFLOW_CONFIG_BASE.map((w) => w.id);
|
|
4894
5068
|
}
|
|
4895
5069
|
}
|
|
4896
|
-
function resolveCodeToolType(optionValue, savedValue) {
|
|
4897
|
-
if (isCodeToolType(optionValue)) {
|
|
4898
|
-
return optionValue;
|
|
4899
|
-
}
|
|
4900
|
-
if (savedValue && isCodeToolType(savedValue)) {
|
|
4901
|
-
return savedValue;
|
|
4902
|
-
}
|
|
4903
|
-
return DEFAULT_CODE_TOOL_TYPE;
|
|
4904
|
-
}
|
|
4905
5070
|
async function init(options = {}) {
|
|
4906
5071
|
if (options.skipPrompt) {
|
|
4907
5072
|
validateSkipPromptOptions(options);
|
|
4908
5073
|
}
|
|
4909
5074
|
try {
|
|
4910
5075
|
const zcfConfig = readZcfConfig();
|
|
4911
|
-
|
|
5076
|
+
let codeToolType;
|
|
5077
|
+
try {
|
|
5078
|
+
codeToolType = await resolveCodeType(options.codeType);
|
|
5079
|
+
} catch (error) {
|
|
5080
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5081
|
+
console.error(ansis.red(`${i18n.t("errors:generalError")} ${errorMessage}`));
|
|
5082
|
+
codeToolType = DEFAULT_CODE_TOOL_TYPE;
|
|
5083
|
+
}
|
|
4912
5084
|
options.codeType = codeToolType;
|
|
4913
5085
|
async function selectApiConfigurationMode() {
|
|
4914
5086
|
const { apiMode } = await inquirer.prompt({
|
|
@@ -5002,23 +5174,39 @@ async function init(options = {}) {
|
|
|
5002
5174
|
}
|
|
5003
5175
|
}
|
|
5004
5176
|
} else {
|
|
5005
|
-
if (!configLang
|
|
5177
|
+
if (!configLang) {
|
|
5006
5178
|
const { resolveTemplateLanguage } = await Promise.resolve().then(function () { return prompts; });
|
|
5007
5179
|
configLang = await resolveTemplateLanguage(
|
|
5008
5180
|
options.configLang,
|
|
5009
|
-
zcfConfig
|
|
5181
|
+
zcfConfig,
|
|
5182
|
+
options.skipPrompt
|
|
5010
5183
|
);
|
|
5011
|
-
} else if (!configLang && options.skipPrompt) {
|
|
5012
|
-
configLang = "en";
|
|
5013
5184
|
}
|
|
5014
5185
|
}
|
|
5015
5186
|
if (!configLang) {
|
|
5016
5187
|
configLang = "en";
|
|
5017
5188
|
}
|
|
5018
5189
|
if (codeToolType === "codex") {
|
|
5190
|
+
const apiMode = options.apiType === "auth_token" ? "official" : options.apiType === "api_key" ? "custom" : options.apiType === "skip" ? "skip" : options.skipPrompt ? "skip" : void 0;
|
|
5191
|
+
const customApiConfig = options.apiType === "api_key" && options.apiKey ? {
|
|
5192
|
+
type: "api_key",
|
|
5193
|
+
token: options.apiKey,
|
|
5194
|
+
baseUrl: options.apiUrl
|
|
5195
|
+
} : void 0;
|
|
5196
|
+
let selectedWorkflows;
|
|
5197
|
+
if (Array.isArray(options.workflows)) {
|
|
5198
|
+
selectedWorkflows = options.workflows;
|
|
5199
|
+
} else if (typeof options.workflows === "string") {
|
|
5200
|
+
selectedWorkflows = [options.workflows];
|
|
5201
|
+
} else if (options.workflows === true) {
|
|
5202
|
+
selectedWorkflows = [];
|
|
5203
|
+
}
|
|
5019
5204
|
const resolvedAiOutputLang = await runCodexFullInit({
|
|
5020
5205
|
aiOutputLang: options.aiOutputLang,
|
|
5021
|
-
skipPrompt: options.skipPrompt
|
|
5206
|
+
skipPrompt: options.skipPrompt,
|
|
5207
|
+
apiMode,
|
|
5208
|
+
customApiConfig,
|
|
5209
|
+
workflows: selectedWorkflows
|
|
5022
5210
|
});
|
|
5023
5211
|
updateZcfConfig({
|
|
5024
5212
|
version,
|
|
@@ -5032,7 +5220,7 @@ async function init(options = {}) {
|
|
|
5032
5220
|
console.log(ansis.green(i18n.t("codex:setupComplete")));
|
|
5033
5221
|
return;
|
|
5034
5222
|
}
|
|
5035
|
-
const aiOutputLang =
|
|
5223
|
+
const aiOutputLang = await resolveAiOutputLanguage(i18n.language, options.aiOutputLang, zcfConfig, options.skipPrompt);
|
|
5036
5224
|
const installationStatus = await getInstallationStatus();
|
|
5037
5225
|
if (installationStatus.hasGlobal || installationStatus.hasLocal) {
|
|
5038
5226
|
if (!options.skipPrompt) {
|
|
@@ -5434,4 +5622,4 @@ async function openSettingsJson() {
|
|
|
5434
5622
|
}
|
|
5435
5623
|
}
|
|
5436
5624
|
|
|
5437
|
-
export { removeLocalClaudeCode as $, AI_OUTPUT_LANGUAGES as A, ensureApiKeyApproved as B, CLAUDE_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, removeApiKeyFromRejected as E, manageApiKeyApproval as F, setPrimaryApiKey as G, ensureClaudeDir as H, backupExistingConfig as I, copyConfigFiles as J, configureApi as K, LEGACY_ZCF_CONFIG_FILES as L, mergeConfigs as M, updateCustomModel as N, updateDefaultModel as O, mergeSettingsFile as P, getExistingModelConfig as Q, getExistingApiConfig as R, SETTINGS_FILE as S, applyAiLanguageDirective as T, switchToOfficialLogin$1 as U, promptApiConfigurationAction as V, isClaudeCodeInstalled as W, installClaudeCode as X, isLocalClaudeCodeInstalled as Y, ZCF_CONFIG_DIR as Z, getInstallationStatus as _, commandExists as a, i18n as a0, readCodexConfig as a1, backupCodexComplete as a2, writeCodexConfig as a3, writeAuthFile as a4, ensureI18nInitialized as a5, detectConfigManagementMode as a6, addNumbersToChoices as a7, readCcrConfig as a8, isCcrInstalled as a9,
|
|
5625
|
+
export { removeLocalClaudeCode as $, AI_OUTPUT_LANGUAGES as A, ensureApiKeyApproved as B, CLAUDE_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, removeApiKeyFromRejected as E, manageApiKeyApproval as F, setPrimaryApiKey as G, ensureClaudeDir as H, backupExistingConfig as I, copyConfigFiles as J, configureApi as K, LEGACY_ZCF_CONFIG_FILES as L, mergeConfigs as M, updateCustomModel as N, updateDefaultModel as O, mergeSettingsFile as P, getExistingModelConfig as Q, getExistingApiConfig as R, SETTINGS_FILE as S, applyAiLanguageDirective as T, switchToOfficialLogin$1 as U, promptApiConfigurationAction as V, isClaudeCodeInstalled as W, installClaudeCode as X, isLocalClaudeCodeInstalled as Y, ZCF_CONFIG_DIR as Z, getInstallationStatus as _, commandExists as a, i18n as a0, readCodexConfig as a1, backupCodexComplete as a2, writeCodexConfig as a3, writeAuthFile as a4, ensureI18nInitialized as a5, detectConfigManagementMode as a6, addNumbersToChoices as a7, readCcrConfig as a8, isCcrInstalled as a9, updatePromptOnly as aA, selectAndInstallWorkflows as aB, checkClaudeCodeVersionAndPrompt as aC, displayBannerWithInfo as aD, runCodexUninstall as aE, configureCodexMcp as aF, configureCodexApi as aG, runCodexWorkflowImport as aH, runCodexFullInit as aI, listCodexProviders as aJ, getCurrentCodexProvider as aK, switchCodexProvider as aL, switchToOfficialLogin as aM, switchToProvider as aN, readZcfConfigAsync as aO, initI18n as aP, selectScriptLanguage as aQ, fsOperations as aR, prompts as aS, codex as aT, installCcr as aa, configureCcrFeature as ab, handleExitPromptError as ac, handleGeneralError as ad, updateZcfConfig as ae, changeLanguage as af, readZcfConfig as ag, configureOutputStyle as ah, isWindows as ai, selectMcpServices as aj, getMcpServices as ak, setupCcrConfiguration as al, modifyApiConfigPartially as am, validateApiKey as an, formatApiKeyDisplay as ao, COMETIX_COMMAND_NAME as ap, COMETIX_COMMANDS as aq, installCometixLine as ar, checkAndUpdateTools as as, runCodexUpdate as at, resolveCodeType as au, readJsonConfig as av, writeJsonConfig as aw, displayBanner as ax, version as ay, resolveAiOutputLanguage as az, importRecommendedEnv as b, cleanupPermissions as c, importRecommendedPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, CLAUDE_VSC_CONFIG_FILE as h, init as i, ZCF_CONFIG_FILE as j, CODE_TOOL_TYPES as k, CODE_TOOL_BANNERS as l, mergeAndCleanPermissions as m, isCodeToolType as n, openSettingsJson as o, SUPPORTED_LANGS as p, LANG_LABELS as q, getAiOutputLanguageLabel as r, getMcpConfigPath as s, readMcpConfig as t, backupMcpConfig as u, mergeMcpServers as v, writeMcpConfig as w, buildMcpServerConfig as x, fixWindowsMcpConfig as y, addCompletedOnboarding as z };
|