zcf 3.0.1 → 3.0.2
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 +1 -0
- package/dist/chunks/codex-config-switch.mjs +4 -4
- package/dist/chunks/codex-uninstaller.mjs +1 -1
- package/dist/chunks/simple-config.mjs +120 -23
- package/dist/cli.mjs +13 -17
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -802,6 +802,7 @@ A huge thank you to all our sponsors for their generous support!
|
|
|
802
802
|
- Argolinhas (first ko-fi sponsor ٩(•̤̀ᵕ•̤́๑))
|
|
803
803
|
- r\*r (first anonymous sponsor🤣)
|
|
804
804
|
- \*\*康 (first KFC sponsor🍗)
|
|
805
|
+
- \*东 (first coffee sponsor☕️)
|
|
805
806
|
- 16°C coffee (My best friend🤪, offered Claude Code max $200 package)
|
|
806
807
|
|
|
807
808
|
## 📄 License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { Y as readCodexConfig, _ as backupCodexComplete, $ as writeCodexConfig, a0 as writeAuthFile, a1 as ensureI18nInitialized, a2 as detectConfigManagementMode, X as i18n, a3 as addNumbersToChoices } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'node:child_process';
|
|
@@ -206,7 +206,7 @@ async function configureIncrementalManagement() {
|
|
|
206
206
|
{ name: i18n.t("codex:addProvider"), value: "add" },
|
|
207
207
|
{ name: i18n.t("codex:editProvider"), value: "edit" },
|
|
208
208
|
{ name: i18n.t("codex:deleteProvider"), value: "delete" },
|
|
209
|
-
{ name: i18n.t("common:
|
|
209
|
+
{ name: i18n.t("common:skip"), value: "skip" }
|
|
210
210
|
];
|
|
211
211
|
const { action } = await inquirer.prompt([{
|
|
212
212
|
type: "list",
|
|
@@ -214,8 +214,8 @@ async function configureIncrementalManagement() {
|
|
|
214
214
|
message: i18n.t("codex:selectAction"),
|
|
215
215
|
choices: addNumbersToChoices(choices)
|
|
216
216
|
}]);
|
|
217
|
-
if (!action || action === "
|
|
218
|
-
console.log(ansis.yellow(i18n.t("common:
|
|
217
|
+
if (!action || action === "skip") {
|
|
218
|
+
console.log(ansis.yellow(i18n.t("common:skip")));
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
switch (action) {
|
|
@@ -2,7 +2,7 @@ import { homedir } from 'node:os';
|
|
|
2
2
|
import { pathExists } from 'fs-extra';
|
|
3
3
|
import { join } from 'pathe';
|
|
4
4
|
import { exec } from 'tinyexec';
|
|
5
|
-
import {
|
|
5
|
+
import { X as i18n } from './simple-config.mjs';
|
|
6
6
|
import { m as moveToTrash } from '../shared/zcf.DGjQxTq_.mjs';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'node:process';
|
|
@@ -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.0.
|
|
19
|
+
const version = "3.0.2";
|
|
20
20
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
21
21
|
|
|
22
22
|
const i18n = i18next.createInstance();
|
|
@@ -363,6 +363,10 @@ const LEGACY_ZCF_CONFIG_FILES = [
|
|
|
363
363
|
];
|
|
364
364
|
const CODE_TOOL_TYPES = ["claude-code", "codex"];
|
|
365
365
|
const DEFAULT_CODE_TOOL_TYPE = "claude-code";
|
|
366
|
+
const CODE_TOOL_BANNERS = {
|
|
367
|
+
"claude-code": "for Claude Code",
|
|
368
|
+
"codex": "for Codex"
|
|
369
|
+
};
|
|
366
370
|
function isCodeToolType(value) {
|
|
367
371
|
return CODE_TOOL_TYPES.includes(value);
|
|
368
372
|
}
|
|
@@ -394,6 +398,7 @@ const constants = {
|
|
|
394
398
|
AI_OUTPUT_LANGUAGES: AI_OUTPUT_LANGUAGES,
|
|
395
399
|
CLAUDE_DIR: CLAUDE_DIR,
|
|
396
400
|
CLAUDE_MD_FILE: CLAUDE_MD_FILE,
|
|
401
|
+
CODE_TOOL_BANNERS: CODE_TOOL_BANNERS,
|
|
397
402
|
CODE_TOOL_TYPES: CODE_TOOL_TYPES,
|
|
398
403
|
ClAUDE_CONFIG_FILE: ClAUDE_CONFIG_FILE,
|
|
399
404
|
DEFAULT_CODE_TOOL_TYPE: DEFAULT_CODE_TOOL_TYPE,
|
|
@@ -2209,7 +2214,15 @@ function migrateZcfConfigIfNeeded() {
|
|
|
2209
2214
|
if (!existsSync(ZCF_CONFIG_DIR)) {
|
|
2210
2215
|
mkdirSync(ZCF_CONFIG_DIR, { recursive: true });
|
|
2211
2216
|
}
|
|
2212
|
-
|
|
2217
|
+
try {
|
|
2218
|
+
renameSync(source, target);
|
|
2219
|
+
} catch (error) {
|
|
2220
|
+
if (error?.code !== "EXDEV") {
|
|
2221
|
+
throw error;
|
|
2222
|
+
}
|
|
2223
|
+
copyFileSync(source, target);
|
|
2224
|
+
rmSync(source, { force: true });
|
|
2225
|
+
}
|
|
2213
2226
|
for (const leftover of legacySources.slice(1)) {
|
|
2214
2227
|
try {
|
|
2215
2228
|
rmSync(leftover, { force: true });
|
|
@@ -2262,7 +2275,12 @@ function writeZcfConfig(config) {
|
|
|
2262
2275
|
...config,
|
|
2263
2276
|
codeToolType: sanitizeCodeToolType(config.codeToolType)
|
|
2264
2277
|
};
|
|
2278
|
+
const existingTomlConfig = readTomlConfig(ZCF_CONFIG_FILE);
|
|
2265
2279
|
const tomlConfig = convertLegacyToTomlConfig(sanitizedConfig);
|
|
2280
|
+
const nextSystemPromptStyle = sanitizedConfig.systemPromptStyle || existingTomlConfig?.codex?.systemPromptStyle;
|
|
2281
|
+
if (nextSystemPromptStyle) {
|
|
2282
|
+
tomlConfig.codex.systemPromptStyle = nextSystemPromptStyle;
|
|
2283
|
+
}
|
|
2266
2284
|
writeTomlConfig(ZCF_CONFIG_FILE, tomlConfig);
|
|
2267
2285
|
} catch {
|
|
2268
2286
|
}
|
|
@@ -2951,6 +2969,23 @@ async function runCodexWorkflowImport() {
|
|
|
2951
2969
|
await runCodexWorkflowSelection();
|
|
2952
2970
|
console.log(ansis.green(i18n.t("codex:workflowInstall")));
|
|
2953
2971
|
}
|
|
2972
|
+
async function runCodexWorkflowImportWithLanguageSelection(options) {
|
|
2973
|
+
ensureI18nInitialized();
|
|
2974
|
+
const zcfConfig = readZcfConfig();
|
|
2975
|
+
const { aiOutputLang: commandLineOption, skipPrompt } = options ?? {};
|
|
2976
|
+
const aiOutputLang = skipPrompt ? commandLineOption || zcfConfig?.aiOutputLang || "en" : await resolveAiOutputLanguage(
|
|
2977
|
+
i18n.language,
|
|
2978
|
+
commandLineOption,
|
|
2979
|
+
zcfConfig
|
|
2980
|
+
);
|
|
2981
|
+
updateZcfConfig({ aiOutputLang });
|
|
2982
|
+
applyAiLanguageDirective(aiOutputLang);
|
|
2983
|
+
await runCodexSystemPromptSelection();
|
|
2984
|
+
ensureCodexAgentsLanguageDirective(aiOutputLang);
|
|
2985
|
+
await runCodexWorkflowSelection();
|
|
2986
|
+
console.log(ansis.green(i18n.t("codex:workflowInstall")));
|
|
2987
|
+
return aiOutputLang;
|
|
2988
|
+
}
|
|
2954
2989
|
async function runCodexSystemPromptSelection() {
|
|
2955
2990
|
ensureI18nInitialized();
|
|
2956
2991
|
const rootDir = getRootDir$1();
|
|
@@ -2964,6 +2999,7 @@ async function runCodexSystemPromptSelection() {
|
|
|
2964
2999
|
// No command line option for this function
|
|
2965
3000
|
zcfConfig$1
|
|
2966
3001
|
);
|
|
3002
|
+
updateZcfConfig({ templateLang: preferredLang });
|
|
2967
3003
|
let langDir = join(templateRoot, preferredLang);
|
|
2968
3004
|
if (!exists(langDir))
|
|
2969
3005
|
langDir = join(templateRoot, "zh-CN");
|
|
@@ -3355,12 +3391,48 @@ async function configureCodexMcp() {
|
|
|
3355
3391
|
updateZcfConfig({ codeToolType: "codex" });
|
|
3356
3392
|
console.log(ansis.green(i18n.t("codex:mcpConfigured")));
|
|
3357
3393
|
}
|
|
3358
|
-
async function runCodexFullInit() {
|
|
3394
|
+
async function runCodexFullInit(options) {
|
|
3359
3395
|
ensureI18nInitialized();
|
|
3360
3396
|
await installCodexCli();
|
|
3361
|
-
await
|
|
3397
|
+
const aiOutputLang = await runCodexWorkflowImportWithLanguageSelection(options);
|
|
3362
3398
|
await configureCodexApi();
|
|
3363
3399
|
await configureCodexMcp();
|
|
3400
|
+
return aiOutputLang;
|
|
3401
|
+
}
|
|
3402
|
+
function ensureCodexAgentsLanguageDirective(aiOutputLang) {
|
|
3403
|
+
if (!exists(CODEX_AGENTS_FILE))
|
|
3404
|
+
return;
|
|
3405
|
+
const content = readFile(CODEX_AGENTS_FILE);
|
|
3406
|
+
const targetLabel = resolveCodexLanguageLabel(aiOutputLang);
|
|
3407
|
+
const directiveRegex = /\*\*Most Important:\s*Always respond in ([^*]+)\*\*/i;
|
|
3408
|
+
const existingMatch = directiveRegex.exec(content);
|
|
3409
|
+
if (existingMatch && normalizeLanguageLabel(existingMatch[1]) === normalizeLanguageLabel(targetLabel))
|
|
3410
|
+
return;
|
|
3411
|
+
let updatedContent = content.replace(/\*\*Most Important:\s*Always respond in [^*]+\*\*\s*/gi, "").trimEnd();
|
|
3412
|
+
if (updatedContent.length > 0 && !updatedContent.endsWith("\n"))
|
|
3413
|
+
updatedContent += "\n";
|
|
3414
|
+
updatedContent += `
|
|
3415
|
+
**Most Important:Always respond in ${targetLabel}**
|
|
3416
|
+
`;
|
|
3417
|
+
const backupPath = backupCodexAgents();
|
|
3418
|
+
if (backupPath)
|
|
3419
|
+
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
3420
|
+
writeFile(CODEX_AGENTS_FILE, updatedContent);
|
|
3421
|
+
console.log(ansis.gray(` ${i18n.t("configuration:addedLanguageDirective")}: ${targetLabel}`));
|
|
3422
|
+
}
|
|
3423
|
+
function resolveCodexLanguageLabel(aiOutputLang) {
|
|
3424
|
+
const directive = AI_OUTPUT_LANGUAGES[aiOutputLang]?.directive;
|
|
3425
|
+
if (directive) {
|
|
3426
|
+
const match = directive.match(/Always respond in\s+(.+)/i);
|
|
3427
|
+
if (match)
|
|
3428
|
+
return match[1].trim();
|
|
3429
|
+
}
|
|
3430
|
+
if (typeof aiOutputLang === "string")
|
|
3431
|
+
return aiOutputLang;
|
|
3432
|
+
return "English";
|
|
3433
|
+
}
|
|
3434
|
+
function normalizeLanguageLabel(label) {
|
|
3435
|
+
return label.trim().toLowerCase();
|
|
3364
3436
|
}
|
|
3365
3437
|
async function runCodexUpdate(force = false, skipPrompt = false) {
|
|
3366
3438
|
ensureI18nInitialized();
|
|
@@ -3529,12 +3601,21 @@ async function switchToOfficialLogin() {
|
|
|
3529
3601
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
3530
3602
|
}
|
|
3531
3603
|
try {
|
|
3604
|
+
let preservedModelProvider = existingConfig.modelProvider;
|
|
3605
|
+
if (!preservedModelProvider) {
|
|
3606
|
+
try {
|
|
3607
|
+
const rawContent = readFile(CODEX_CONFIG_FILE);
|
|
3608
|
+
const parsedToml = parse(rawContent);
|
|
3609
|
+
if (typeof parsedToml.model_provider === "string" && parsedToml.model_provider.trim().length > 0)
|
|
3610
|
+
preservedModelProvider = parsedToml.model_provider.trim();
|
|
3611
|
+
} catch {
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
const shouldCommentModelProvider = typeof preservedModelProvider === "string" && preservedModelProvider.length > 0;
|
|
3532
3615
|
const updatedConfig = {
|
|
3533
3616
|
...existingConfig,
|
|
3534
|
-
modelProvider: existingConfig.modelProvider,
|
|
3535
|
-
|
|
3536
|
-
modelProviderCommented: true
|
|
3537
|
-
// Mark as commented
|
|
3617
|
+
modelProvider: shouldCommentModelProvider ? preservedModelProvider : existingConfig.modelProvider,
|
|
3618
|
+
modelProviderCommented: shouldCommentModelProvider ? true : existingConfig.modelProviderCommented
|
|
3538
3619
|
};
|
|
3539
3620
|
writeCodexConfig(updatedConfig);
|
|
3540
3621
|
const auth = readJsonConfig(CODEX_AUTH_FILE, { defaultValue: {} }) || {};
|
|
@@ -3609,6 +3690,7 @@ const codex = {
|
|
|
3609
3690
|
runCodexUninstall: runCodexUninstall,
|
|
3610
3691
|
runCodexUpdate: runCodexUpdate,
|
|
3611
3692
|
runCodexWorkflowImport: runCodexWorkflowImport,
|
|
3693
|
+
runCodexWorkflowImportWithLanguageSelection: runCodexWorkflowImportWithLanguageSelection,
|
|
3612
3694
|
runCodexWorkflowSelection: runCodexWorkflowSelection,
|
|
3613
3695
|
switchCodexProvider: switchCodexProvider,
|
|
3614
3696
|
switchToOfficialLogin: switchToOfficialLogin,
|
|
@@ -4603,37 +4685,52 @@ async function init(options = {}) {
|
|
|
4603
4685
|
validateSkipPromptOptions(options);
|
|
4604
4686
|
}
|
|
4605
4687
|
try {
|
|
4688
|
+
const zcfConfig = readZcfConfig();
|
|
4689
|
+
const codeToolType = resolveCodeToolType(options.codeType, zcfConfig?.codeToolType);
|
|
4690
|
+
options.codeType = codeToolType;
|
|
4606
4691
|
if (!options.skipBanner) {
|
|
4607
|
-
displayBannerWithInfo();
|
|
4692
|
+
displayBannerWithInfo(CODE_TOOL_BANNERS[codeToolType] || "ZCF");
|
|
4608
4693
|
}
|
|
4609
4694
|
if (isTermux()) {
|
|
4610
4695
|
console.log(ansis.yellow(`
|
|
4611
4696
|
\u2139 ${i18n.t("installation:termuxDetected")}`));
|
|
4612
4697
|
console.log(ansis.gray(i18n.t("installation:termuxEnvironmentInfo")));
|
|
4613
4698
|
}
|
|
4614
|
-
const zcfConfig = readZcfConfig();
|
|
4615
4699
|
let configLang = options.configLang;
|
|
4616
|
-
if (
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4700
|
+
if (codeToolType === "codex") {
|
|
4701
|
+
if (!configLang) {
|
|
4702
|
+
if (options.skipPrompt) {
|
|
4703
|
+
configLang = zcfConfig?.templateLang || "en";
|
|
4704
|
+
} else {
|
|
4705
|
+
configLang = zcfConfig?.templateLang || i18n.language || "en";
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
} else {
|
|
4709
|
+
if (!configLang && !options.skipPrompt) {
|
|
4710
|
+
const { resolveTemplateLanguage } = await Promise.resolve().then(function () { return prompts; });
|
|
4711
|
+
configLang = await resolveTemplateLanguage(
|
|
4712
|
+
options.configLang,
|
|
4713
|
+
zcfConfig
|
|
4714
|
+
);
|
|
4715
|
+
} else if (!configLang && options.skipPrompt) {
|
|
4716
|
+
configLang = "en";
|
|
4717
|
+
}
|
|
4718
|
+
}
|
|
4719
|
+
if (!configLang) {
|
|
4624
4720
|
configLang = "en";
|
|
4625
4721
|
}
|
|
4626
|
-
const codeToolType = resolveCodeToolType(options.codeType, zcfConfig?.codeToolType);
|
|
4627
|
-
options.codeType = codeToolType;
|
|
4628
4722
|
if (codeToolType === "codex") {
|
|
4629
|
-
await runCodexFullInit(
|
|
4723
|
+
const resolvedAiOutputLang = await runCodexFullInit({
|
|
4724
|
+
aiOutputLang: options.aiOutputLang,
|
|
4725
|
+
skipPrompt: options.skipPrompt
|
|
4726
|
+
});
|
|
4630
4727
|
updateZcfConfig({
|
|
4631
4728
|
version,
|
|
4632
4729
|
preferredLang: i18n.language,
|
|
4633
4730
|
// ZCF界面语言
|
|
4634
4731
|
templateLang: configLang,
|
|
4635
4732
|
// 模板语言
|
|
4636
|
-
aiOutputLang: options.aiOutputLang
|
|
4733
|
+
aiOutputLang: resolvedAiOutputLang ?? options.aiOutputLang ?? zcfConfig?.aiOutputLang ?? "en",
|
|
4637
4734
|
codeToolType
|
|
4638
4735
|
});
|
|
4639
4736
|
console.log(ansis.green(i18n.t("codex:setupComplete")));
|
|
@@ -5108,4 +5205,4 @@ async function openSettingsJson() {
|
|
|
5108
5205
|
}
|
|
5109
5206
|
}
|
|
5110
5207
|
|
|
5111
|
-
export {
|
|
5208
|
+
export { writeCodexConfig as $, AI_OUTPUT_LANGUAGES as A, removeApiKeyFromRejected as B, CLAUDE_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, manageApiKeyApproval as E, ensureClaudeDir as F, backupExistingConfig as G, copyConfigFiles as H, configureApi as I, mergeConfigs as J, updateCustomModel as K, LEGACY_ZCF_CONFIG_FILES as L, updateDefaultModel as M, mergeSettingsFile as N, getExistingModelConfig as O, getExistingApiConfig as P, applyAiLanguageDirective as Q, isClaudeCodeInstalled as R, SETTINGS_FILE as S, installClaudeCode as T, isLocalClaudeCodeInstalled as U, getInstallationStatus as V, removeLocalClaudeCode as W, i18n as X, readCodexConfig as Y, ZCF_CONFIG_DIR as Z, backupCodexComplete as _, commandExists as a, writeAuthFile as a0, ensureI18nInitialized as a1, detectConfigManagementMode as a2, addNumbersToChoices as a3, readCcrConfig as a4, isCcrInstalled as a5, installCcr as a6, configureCcrFeature as a7, handleExitPromptError as a8, handleGeneralError as a9, configureCodexMcp as aA, configureCodexApi as aB, runCodexWorkflowImport as aC, runCodexFullInit as aD, listCodexProviders as aE, getCurrentCodexProvider as aF, switchCodexProvider as aG, switchToOfficialLogin as aH, switchToProvider as aI, readZcfConfigAsync as aJ, initI18n as aK, selectScriptLanguage as aL, fsOperations as aM, prompts as aN, codex as aO, updateZcfConfig as aa, changeLanguage as ab, readZcfConfig as ac, configureOutputStyle as ad, isWindows as ae, selectMcpServices as af, getMcpServices as ag, formatApiKeyDisplay as ah, modifyApiConfigPartially as ai, setupCcrConfiguration as aj, validateApiKey as ak, COMETIX_COMMAND_NAME as al, COMETIX_COMMANDS as am, installCometixLine as an, checkAndUpdateTools as ao, readJsonConfig as ap, writeJsonConfig as aq, displayBanner as ar, runCodexUpdate as as, version as at, resolveAiOutputLanguage as au, updatePromptOnly as av, selectAndInstallWorkflows as aw, checkClaudeCodeVersionAndPrompt as ax, displayBannerWithInfo as ay, runCodexUninstall as az, importRecommendedEnv as b, cleanupPermissions as c, importRecommendedPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, ZCF_CONFIG_FILE as h, init as i, CODE_TOOL_TYPES as j, CODE_TOOL_BANNERS as k, isCodeToolType as l, mergeAndCleanPermissions as m, SUPPORTED_LANGS as n, openSettingsJson as o, LANG_LABELS as p, getAiOutputLanguageLabel as q, getMcpConfigPath as r, readMcpConfig as s, backupMcpConfig as t, mergeMcpServers as u, buildMcpServerConfig as v, writeMcpConfig as w, fixWindowsMcpConfig as x, addCompletedOnboarding as y, ensureApiKeyApproved as z };
|
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 {
|
|
4
|
+
import { a1 as ensureI18nInitialized, X as i18n, a4 as readCcrConfig, a5 as isCcrInstalled, a6 as installCcr, a7 as configureCcrFeature, a8 as handleExitPromptError, a9 as handleGeneralError, n as SUPPORTED_LANGS, a3 as addNumbersToChoices, p as LANG_LABELS, aa as updateZcfConfig, ab as changeLanguage, ac as readZcfConfig, o as openSettingsJson, d as importRecommendedPermissions, b as importRecommendedEnv, Q as applyAiLanguageDirective, ad as configureOutputStyle, O as getExistingModelConfig, K as updateCustomModel, M as updateDefaultModel, ae as isWindows, s as readMcpConfig, x as fixWindowsMcpConfig, w as writeMcpConfig, af as selectMcpServices, t as backupMcpConfig, ag as getMcpServices, v as buildMcpServerConfig, u as mergeMcpServers, P as getExistingApiConfig, ah as formatApiKeyDisplay, y as addCompletedOnboarding, ai as modifyApiConfigPartially, aj as setupCcrConfiguration, ak as validateApiKey, I as configureApi, al as COMETIX_COMMAND_NAME, am as COMETIX_COMMANDS, an as installCometixLine, ao as checkAndUpdateTools, ap as readJsonConfig, aq as writeJsonConfig, h as ZCF_CONFIG_FILE, ar as displayBanner, as as runCodexUpdate, at as version, au as resolveAiOutputLanguage, av as updatePromptOnly, aw as selectAndInstallWorkflows, ax as checkClaudeCodeVersionAndPrompt, l as isCodeToolType, D as DEFAULT_CODE_TOOL_TYPE, ay as displayBannerWithInfo, k as CODE_TOOL_BANNERS, az as runCodexUninstall, aA as configureCodexMcp, aB as configureCodexApi, aC as runCodexWorkflowImport, aD as runCodexFullInit, i as init, aE as listCodexProviders, aF as getCurrentCodexProvider, aG as switchCodexProvider, Y as readCodexConfig, aH as switchToOfficialLogin, aI as switchToProvider, aJ as readZcfConfigAsync, aK as initI18n, aL as selectScriptLanguage } from './chunks/simple-config.mjs';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
7
|
import inquirer from 'inquirer';
|
|
@@ -559,7 +559,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
559
559
|
return;
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
562
|
+
const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aN; });
|
|
563
563
|
const aiOutputLang = await selectAiOutputLanguage();
|
|
564
564
|
applyAiLanguageDirective(aiOutputLang);
|
|
565
565
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -592,7 +592,7 @@ async function changeScriptLanguageFeature(currentLang) {
|
|
|
592
592
|
}
|
|
593
593
|
async function configureCodexDefaultModelFeature() {
|
|
594
594
|
ensureI18nInitialized();
|
|
595
|
-
const { readCodexConfig } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
595
|
+
const { readCodexConfig } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
|
|
596
596
|
const existingConfig = readCodexConfig();
|
|
597
597
|
const currentModel = existingConfig?.model;
|
|
598
598
|
if (currentModel) {
|
|
@@ -697,7 +697,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
700
|
+
const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aN; });
|
|
701
701
|
const aiOutputLang = await selectAiOutputLanguage();
|
|
702
702
|
await updateCodexLanguageDirective(aiOutputLang);
|
|
703
703
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -705,14 +705,14 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
|
|
|
705
705
|
} else if (option === "systemPrompt") {
|
|
706
706
|
const zcfConfig = readZcfConfig();
|
|
707
707
|
const currentLang = zcfConfig?.aiOutputLang || "English";
|
|
708
|
-
const { runCodexSystemPromptSelection } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
708
|
+
const { runCodexSystemPromptSelection } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
|
|
709
709
|
await runCodexSystemPromptSelection();
|
|
710
710
|
await ensureLanguageDirectiveInAgents(currentLang);
|
|
711
711
|
console.log(ansis.green(`\u2714 ${i18n.t("configuration:systemPromptConfigured")}`));
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
async function updateCodexModelProvider(modelProvider) {
|
|
715
|
-
const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
715
|
+
const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
|
|
716
716
|
const backupPath = backupCodexConfig();
|
|
717
717
|
if (backupPath) {
|
|
718
718
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -733,7 +733,7 @@ async function updateCodexModelProvider(modelProvider) {
|
|
|
733
733
|
writeCodexConfig(updatedConfig);
|
|
734
734
|
}
|
|
735
735
|
async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
736
|
-
const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
736
|
+
const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aM; });
|
|
737
737
|
const { homedir } = await import('node:os');
|
|
738
738
|
const { join } = await import('pathe');
|
|
739
739
|
const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
|
|
@@ -751,7 +751,7 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
|
751
751
|
const langLabel = languageLabels[aiOutputLang] || aiOutputLang;
|
|
752
752
|
const hasLanguageDirective = /\*\*Most Important:\s*Always respond in [^*]+\*\*/i.test(content);
|
|
753
753
|
if (!hasLanguageDirective) {
|
|
754
|
-
const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
754
|
+
const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
|
|
755
755
|
const backupPath = backupCodexAgents();
|
|
756
756
|
if (backupPath) {
|
|
757
757
|
console.log(ansis.gray(getBackupMessage(backupPath)));
|
|
@@ -768,8 +768,8 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
|
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
async function updateCodexLanguageDirective(aiOutputLang) {
|
|
771
|
-
const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
772
|
-
const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
771
|
+
const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aM; });
|
|
772
|
+
const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
|
|
773
773
|
const { homedir } = await import('node:os');
|
|
774
774
|
const { join } = await import('pathe');
|
|
775
775
|
const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
|
|
@@ -1830,7 +1830,7 @@ async function update(options = {}) {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
return;
|
|
1832
1832
|
}
|
|
1833
|
-
const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
1833
|
+
const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aN; });
|
|
1834
1834
|
const configLang = await resolveTemplateLanguage(
|
|
1835
1835
|
options.configLang,
|
|
1836
1836
|
// Command line option
|
|
@@ -1861,10 +1861,6 @@ const CODE_TOOL_LABELS = {
|
|
|
1861
1861
|
"claude-code": "Claude Code",
|
|
1862
1862
|
"codex": "Codex"
|
|
1863
1863
|
};
|
|
1864
|
-
const CODE_TOOL_BANNERS = {
|
|
1865
|
-
"claude-code": "for Claude Code",
|
|
1866
|
-
"codex": "for Codex"
|
|
1867
|
-
};
|
|
1868
1864
|
function getCurrentCodeTool() {
|
|
1869
1865
|
const config = readZcfConfig();
|
|
1870
1866
|
if (config?.codeToolType && isCodeToolType(config.codeToolType)) {
|
|
@@ -2413,10 +2409,10 @@ async function setupCommands(cli) {
|
|
|
2413
2409
|
await initI18n(defaultLang);
|
|
2414
2410
|
} catch {
|
|
2415
2411
|
}
|
|
2416
|
-
cli.command("", "Show interactive menu (default)").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex)"
|
|
2412
|
+
cli.command("", "Show interactive menu (default)").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex)").action(await withLanguageResolution(async () => {
|
|
2417
2413
|
await showMainMenu();
|
|
2418
2414
|
}));
|
|
2419
|
-
cli.command("init", "Initialize Claude Code configuration").alias("i").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--ai-output-lang, -a <lang>", "AI output language").option("--force, -f", "Force overwrite existing configuration").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").option("--config-action, -r <action>", `Config handling (new/backup/merge/docs-only/skip), ${i18n.t("cli:help.defaults.prefix")} backup`).option("--api-type, -t <type>", "API type (auth_token/api_key/ccr_proxy/skip)").option("--api-key, -k <key>", "API key (used for both API key and auth token types)").option("--api-url, -u <url>", "Custom API URL").option("--mcp-services, -m <services>", `Comma-separated MCP services to install (context7,mcp-deepwiki,Playwright,exa), "skip" to skip all, "all" for all non-key services, ${i18n.t("cli:help.defaults.prefix")} all`).option("--workflows, -w <workflows>", `Comma-separated workflows to install (sixStepsWorkflow,featPlanUx,gitWorkflow,bmadWorkflow), "skip" to skip all, "all" for all workflows, ${i18n.t("cli:help.defaults.prefix")} all`).option("--output-styles, -o <styles>", `Comma-separated output styles (engineer-professional,nekomata-engineer,laowang-engineer,default,explanatory,learning), "skip" to skip all, "all" for all custom styles, ${i18n.t("cli:help.defaults.prefix")} all`).option("--default-output-style, -d <style>", `Default output style, ${i18n.t("cli:help.defaults.prefix")} engineer-professional`).option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex)"
|
|
2415
|
+
cli.command("init", "Initialize Claude Code configuration").alias("i").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--ai-output-lang, -a <lang>", "AI output language").option("--force, -f", "Force overwrite existing configuration").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").option("--config-action, -r <action>", `Config handling (new/backup/merge/docs-only/skip), ${i18n.t("cli:help.defaults.prefix")} backup`).option("--api-type, -t <type>", "API type (auth_token/api_key/ccr_proxy/skip)").option("--api-key, -k <key>", "API key (used for both API key and auth token types)").option("--api-url, -u <url>", "Custom API URL").option("--mcp-services, -m <services>", `Comma-separated MCP services to install (context7,mcp-deepwiki,Playwright,exa), "skip" to skip all, "all" for all non-key services, ${i18n.t("cli:help.defaults.prefix")} all`).option("--workflows, -w <workflows>", `Comma-separated workflows to install (sixStepsWorkflow,featPlanUx,gitWorkflow,bmadWorkflow), "skip" to skip all, "all" for all workflows, ${i18n.t("cli:help.defaults.prefix")} all`).option("--output-styles, -o <styles>", `Comma-separated output styles (engineer-professional,nekomata-engineer,laowang-engineer,default,explanatory,learning), "skip" to skip all, "all" for all custom styles, ${i18n.t("cli:help.defaults.prefix")} all`).option("--default-output-style, -d <style>", `Default output style, ${i18n.t("cli:help.defaults.prefix")} engineer-professional`).option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex)").option("--install-cometix-line, -x <value>", `Install CCometixLine statusline tool (true/false), ${i18n.t("cli:help.defaults.prefix")} true`).action(await withLanguageResolution(async (options) => {
|
|
2420
2416
|
await init(options);
|
|
2421
2417
|
}));
|
|
2422
2418
|
cli.command("update", "Update Claude Code prompts only").alias("u").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").action(await withLanguageResolution(async (options) => {
|
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ declare const LEGACY_ZCF_CONFIG_FILES: string[];
|
|
|
8
8
|
declare const CODE_TOOL_TYPES: readonly ["claude-code", "codex"];
|
|
9
9
|
type CodeToolType = (typeof CODE_TOOL_TYPES)[number];
|
|
10
10
|
declare const DEFAULT_CODE_TOOL_TYPE: CodeToolType;
|
|
11
|
+
declare const CODE_TOOL_BANNERS: Record<CodeToolType, string>;
|
|
11
12
|
declare function isCodeToolType(value: any): value is CodeToolType;
|
|
12
13
|
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en"];
|
|
13
14
|
type SupportedLang = (typeof SUPPORTED_LANGS)[number];
|
|
@@ -193,5 +194,5 @@ declare function importRecommendedEnv(): Promise<void>;
|
|
|
193
194
|
declare function importRecommendedPermissions(): Promise<void>;
|
|
194
195
|
declare function openSettingsJson(): Promise<void>;
|
|
195
196
|
|
|
196
|
-
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureApiKeyApproved, ensureClaudeDir, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, isCodeToolType, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, updateCustomModel, updateDefaultModel, writeMcpConfig };
|
|
197
|
+
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureApiKeyApproved, ensureClaudeDir, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, isCodeToolType, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, updateCustomModel, updateDefaultModel, writeMcpConfig };
|
|
197
198
|
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const LEGACY_ZCF_CONFIG_FILES: string[];
|
|
|
8
8
|
declare const CODE_TOOL_TYPES: readonly ["claude-code", "codex"];
|
|
9
9
|
type CodeToolType = (typeof CODE_TOOL_TYPES)[number];
|
|
10
10
|
declare const DEFAULT_CODE_TOOL_TYPE: CodeToolType;
|
|
11
|
+
declare const CODE_TOOL_BANNERS: Record<CodeToolType, string>;
|
|
11
12
|
declare function isCodeToolType(value: any): value is CodeToolType;
|
|
12
13
|
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en"];
|
|
13
14
|
type SupportedLang = (typeof SUPPORTED_LANGS)[number];
|
|
@@ -193,5 +194,5 @@ declare function importRecommendedEnv(): Promise<void>;
|
|
|
193
194
|
declare function importRecommendedPermissions(): Promise<void>;
|
|
194
195
|
declare function openSettingsJson(): Promise<void>;
|
|
195
196
|
|
|
196
|
-
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureApiKeyApproved, ensureClaudeDir, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, isCodeToolType, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, updateCustomModel, updateDefaultModel, writeMcpConfig };
|
|
197
|
+
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, CODE_TOOL_BANNERS, CODE_TOOL_TYPES, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureApiKeyApproved, ensureClaudeDir, fixWindowsMcpConfig, getAiOutputLanguageLabel, getExistingApiConfig, getExistingModelConfig, getInstallationStatus, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, isCodeToolType, isLocalClaudeCodeInstalled, manageApiKeyApproval, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, updateCustomModel, updateDefaultModel, writeMcpConfig };
|
|
197
198
|
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, j as CODE_TOOL_TYPES, f as ClAUDE_CONFIG_FILE, D as DEFAULT_CODE_TOOL_TYPE,
|
|
1
|
+
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, k as CODE_TOOL_BANNERS, j as CODE_TOOL_TYPES, f as ClAUDE_CONFIG_FILE, D as DEFAULT_CODE_TOOL_TYPE, p as LANG_LABELS, L as LEGACY_ZCF_CONFIG_FILES, S as SETTINGS_FILE, n as SUPPORTED_LANGS, Z as ZCF_CONFIG_DIR, h as ZCF_CONFIG_FILE, y as addCompletedOnboarding, Q as applyAiLanguageDirective, G as backupExistingConfig, t as backupMcpConfig, v as buildMcpServerConfig, c as cleanupPermissions, a as commandExists, I as configureApi, H as copyConfigFiles, z as ensureApiKeyApproved, F as ensureClaudeDir, x as fixWindowsMcpConfig, q as getAiOutputLanguageLabel, P as getExistingApiConfig, O as getExistingModelConfig, V as getInstallationStatus, r as getMcpConfigPath, g as getPlatform, b as importRecommendedEnv, d as importRecommendedPermissions, i as init, T as installClaudeCode, R as isClaudeCodeInstalled, l as isCodeToolType, U as isLocalClaudeCodeInstalled, E as manageApiKeyApproval, m as mergeAndCleanPermissions, J as mergeConfigs, u as mergeMcpServers, N as mergeSettingsFile, o as openSettingsJson, s as readMcpConfig, B as removeApiKeyFromRejected, W as removeLocalClaudeCode, K as updateCustomModel, M as updateDefaultModel, w as writeMcpConfig } from './chunks/simple-config.mjs';
|
|
2
2
|
import 'node:fs';
|
|
3
3
|
import 'node:process';
|
|
4
4
|
import 'ansis';
|