zcf 3.0.2 → 3.1.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 { 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';
4
+ import { a5 as ensureI18nInitialized, a0 as i18n, a8 as readCcrConfig, a9 as isCcrInstalled, aa as installCcr, ab as configureCcrFeature, ac as handleExitPromptError, ad as handleGeneralError, p as SUPPORTED_LANGS, a7 as addNumbersToChoices, q as LANG_LABELS, ae as updateZcfConfig, af as changeLanguage, ag as readZcfConfig, o as openSettingsJson, d as importRecommendedPermissions, b as importRecommendedEnv, T as applyAiLanguageDirective, ah as configureOutputStyle, Q as getExistingModelConfig, N as updateCustomModel, O as updateDefaultModel, ai as isWindows, t as readMcpConfig, y as fixWindowsMcpConfig, w as writeMcpConfig, aj as selectMcpServices, u as backupMcpConfig, ak as getMcpServices, x as buildMcpServerConfig, v as mergeMcpServers, al as setupCcrConfiguration, R as getExistingApiConfig, V as promptApiConfigurationAction, am as modifyApiConfigPartially, an as validateApiKey, K as configureApi, ao as formatApiKeyDisplay, U as switchToOfficialLogin, ap as COMETIX_COMMAND_NAME, aq as COMETIX_COMMANDS, ar as installCometixLine, as as checkAndUpdateTools, at as readJsonConfig, au as writeJsonConfig, j as ZCF_CONFIG_FILE, av as displayBanner, aw as runCodexUpdate, ax as version, ay as resolveAiOutputLanguage, az as updatePromptOnly, aA as selectAndInstallWorkflows, aB as checkClaudeCodeVersionAndPrompt, n as isCodeToolType, D as DEFAULT_CODE_TOOL_TYPE, aC as displayBannerWithInfo, l as CODE_TOOL_BANNERS, aD as runCodexUninstall, aE as configureCodexMcp, aF as configureCodexApi, aG as runCodexWorkflowImport, aH as runCodexFullInit, i as init, aI as listCodexProviders, aJ as getCurrentCodexProvider, aK as switchCodexProvider, a1 as readCodexConfig, aL as switchToOfficialLogin$1, aM as switchToProvider, aN as readZcfConfigAsync, aO as initI18n, aP 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';
@@ -246,59 +246,25 @@ async function handleCancellation() {
246
246
  ensureI18nInitialized();
247
247
  console.log(ansis.yellow(i18n.t("common:cancelled")));
248
248
  }
249
- async function configureApiFeature() {
249
+ async function handleOfficialLoginMode() {
250
250
  ensureI18nInitialized();
251
- const existingApiConfig = getExistingApiConfig();
252
- if (existingApiConfig) {
253
- console.log(`
254
- ${ansis.blue(`\u2139 ${i18n.t("api:existingApiConfig")}`)}`);
255
- console.log(ansis.gray(` ${i18n.t("api:apiConfigUrl")}: ${existingApiConfig.url || i18n.t("common:notConfigured")}`));
256
- console.log(
257
- ansis.gray(
258
- ` ${i18n.t("api:apiConfigKey")}: ${existingApiConfig.key ? formatApiKeyDisplay(existingApiConfig.key) : i18n.t("common:notConfigured")}`
259
- )
260
- );
261
- console.log(
262
- ansis.gray(` ${i18n.t("api:apiConfigAuthType")}: ${existingApiConfig.authType || i18n.t("common:notConfigured")}
263
- `)
264
- );
265
- const { action } = await inquirer.prompt({
266
- type: "list",
267
- name: "action",
268
- message: i18n.t("api:selectApiAction"),
269
- choices: addNumbersToChoices([
270
- { name: i18n.t("api:keepExistingConfig"), value: "keep" },
271
- { name: i18n.t("api:modifyAllConfig"), value: "modify-all" },
272
- { name: i18n.t("api:modifyPartialConfig"), value: "modify-partial" },
273
- { name: i18n.t("api:useCcrProxy"), value: "use-ccr" }
274
- ])
275
- });
276
- if (!action) {
277
- await handleCancellation();
278
- return;
279
- }
280
- if (action === "keep") {
251
+ const success = switchToOfficialLogin();
252
+ if (success) {
253
+ console.log(ansis.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
254
+ } else {
255
+ console.log(ansis.red(i18n.t("api:officialLoginFailed")));
256
+ }
257
+ }
258
+ async function handleCustomApiMode() {
259
+ ensureI18nInitialized();
260
+ const existingConfig = getExistingApiConfig();
261
+ if (existingConfig) {
262
+ const configAction = await promptApiConfigurationAction();
263
+ if (configAction === "keep-existing") {
281
264
  console.log(ansis.green(`\u2714 ${i18n.t("api:keepExistingConfig")}`));
282
- try {
283
- addCompletedOnboarding();
284
- } catch (error) {
285
- console.error(ansis.red(i18n.t("errors:failedToSetOnboarding")), error);
286
- }
287
- return;
288
- } else if (action === "modify-partial") {
289
- await modifyApiConfigPartially(existingApiConfig);
290
265
  return;
291
- } else if (action === "use-ccr") {
292
- const ccrStatus = await isCcrInstalled();
293
- if (!ccrStatus.hasCorrectPackage) {
294
- await installCcr();
295
- } else {
296
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
297
- }
298
- const ccrConfigured = await setupCcrConfiguration();
299
- if (ccrConfigured) {
300
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
301
- }
266
+ } else if (configAction === "modify-partial") {
267
+ await modifyApiConfigPartially(existingConfig);
302
268
  return;
303
269
  }
304
270
  }
@@ -317,28 +283,11 @@ ${ansis.blue(`\u2139 ${i18n.t("api:existingApiConfig")}`)}`);
317
283
  value: "api_key",
318
284
  short: i18n.t("api:useApiKey")
319
285
  },
320
- {
321
- name: `${i18n.t("api:useCcrProxy")} - ${ansis.gray(i18n.t("api:ccrProxyDesc"))}`,
322
- value: "ccr_proxy",
323
- short: i18n.t("api:useCcrProxy")
324
- },
325
286
  { name: i18n.t("api:skipApi"), value: "skip" }
326
287
  ])
327
288
  });
328
289
  if (!apiChoice || apiChoice === "skip") {
329
- return;
330
- }
331
- if (apiChoice === "ccr_proxy") {
332
- const ccrStatus = await isCcrInstalled();
333
- if (!ccrStatus.hasCorrectPackage) {
334
- await installCcr();
335
- } else {
336
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
337
- }
338
- const ccrConfigured = await setupCcrConfiguration();
339
- if (ccrConfigured) {
340
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
341
- }
290
+ await handleCancellation();
342
291
  return;
343
292
  }
344
293
  const { url } = await inquirer.prompt({
@@ -389,6 +338,51 @@ ${ansis.blue(`\u2139 ${i18n.t("api:existingApiConfig")}`)}`);
389
338
  console.log(ansis.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
390
339
  }
391
340
  }
341
+ async function handleCcrProxyMode() {
342
+ ensureI18nInitialized();
343
+ const ccrStatus = await isCcrInstalled();
344
+ if (!ccrStatus.hasCorrectPackage) {
345
+ await installCcr();
346
+ } else {
347
+ console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
348
+ }
349
+ const ccrConfigured = await setupCcrConfiguration();
350
+ if (ccrConfigured) {
351
+ console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
352
+ }
353
+ }
354
+ async function configureApiFeature() {
355
+ ensureI18nInitialized();
356
+ const { mode } = await inquirer.prompt({
357
+ type: "list",
358
+ name: "mode",
359
+ message: i18n.t("api:apiModePrompt"),
360
+ choices: addNumbersToChoices([
361
+ { name: i18n.t("api:apiModeOfficial"), value: "official" },
362
+ { name: i18n.t("api:apiModeCustom"), value: "custom" },
363
+ { name: i18n.t("api:apiModeCcr"), value: "ccr" },
364
+ { name: i18n.t("api:apiModeSkip"), value: "skip" }
365
+ ])
366
+ });
367
+ if (!mode || mode === "skip") {
368
+ await handleCancellation();
369
+ return;
370
+ }
371
+ switch (mode) {
372
+ case "official":
373
+ await handleOfficialLoginMode();
374
+ break;
375
+ case "custom":
376
+ await handleCustomApiMode();
377
+ break;
378
+ case "ccr":
379
+ await handleCcrProxyMode();
380
+ break;
381
+ default:
382
+ await handleCancellation();
383
+ break;
384
+ }
385
+ }
392
386
  async function configureMcpFeature() {
393
387
  ensureI18nInitialized();
394
388
  if (isWindows()) {
@@ -476,15 +470,15 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingModelConfig") || "Existing
476
470
  value: "opus"
477
471
  },
478
472
  {
479
- name: i18n.t("configuration:opusPlanModelOption") || "OpusPlan - Use Opus for planning, write code with sonnet, recommended",
480
- value: "opusplan"
473
+ name: i18n.t("configuration:sonnet1mModelOption") || "Sonnet 1M - 1M context version",
474
+ value: "sonnet[1m]"
481
475
  },
482
476
  {
483
477
  name: i18n.t("configuration:customModelOption") || "Custom - Specify custom model names",
484
478
  value: "custom"
485
479
  }
486
480
  ]),
487
- default: existingModel ? ["default", "opus", "opusplan", "custom"].indexOf(existingModel) : 0
481
+ default: existingModel ? ["default", "opus", "sonnet[1m]", "custom"].indexOf(existingModel) : 0
488
482
  });
489
483
  if (!model) {
490
484
  await handleCancellation();
@@ -559,7 +553,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
559
553
  return;
560
554
  }
561
555
  }
562
- const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aN; });
556
+ const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
563
557
  const aiOutputLang = await selectAiOutputLanguage();
564
558
  applyAiLanguageDirective(aiOutputLang);
565
559
  updateZcfConfig({ aiOutputLang });
@@ -592,7 +586,7 @@ async function changeScriptLanguageFeature(currentLang) {
592
586
  }
593
587
  async function configureCodexDefaultModelFeature() {
594
588
  ensureI18nInitialized();
595
- const { readCodexConfig } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
589
+ const { readCodexConfig } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
596
590
  const existingConfig = readCodexConfig();
597
591
  const currentModel = existingConfig?.model;
598
592
  if (currentModel) {
@@ -697,7 +691,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
697
691
  return;
698
692
  }
699
693
  }
700
- const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aN; });
694
+ const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
701
695
  const aiOutputLang = await selectAiOutputLanguage();
702
696
  await updateCodexLanguageDirective(aiOutputLang);
703
697
  updateZcfConfig({ aiOutputLang });
@@ -705,14 +699,14 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
705
699
  } else if (option === "systemPrompt") {
706
700
  const zcfConfig = readZcfConfig();
707
701
  const currentLang = zcfConfig?.aiOutputLang || "English";
708
- const { runCodexSystemPromptSelection } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
702
+ const { runCodexSystemPromptSelection } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
709
703
  await runCodexSystemPromptSelection();
710
704
  await ensureLanguageDirectiveInAgents(currentLang);
711
705
  console.log(ansis.green(`\u2714 ${i18n.t("configuration:systemPromptConfigured")}`));
712
706
  }
713
707
  }
714
708
  async function updateCodexModelProvider(modelProvider) {
715
- const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
709
+ const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
716
710
  const backupPath = backupCodexConfig();
717
711
  if (backupPath) {
718
712
  console.log(ansis.gray(getBackupMessage(backupPath)));
@@ -733,7 +727,7 @@ async function updateCodexModelProvider(modelProvider) {
733
727
  writeCodexConfig(updatedConfig);
734
728
  }
735
729
  async function ensureLanguageDirectiveInAgents(aiOutputLang) {
736
- const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aM; });
730
+ const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aQ; });
737
731
  const { homedir } = await import('node:os');
738
732
  const { join } = await import('pathe');
739
733
  const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
@@ -751,7 +745,7 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
751
745
  const langLabel = languageLabels[aiOutputLang] || aiOutputLang;
752
746
  const hasLanguageDirective = /\*\*Most Important:\s*Always respond in [^*]+\*\*/i.test(content);
753
747
  if (!hasLanguageDirective) {
754
- const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aO; });
748
+ const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
755
749
  const backupPath = backupCodexAgents();
756
750
  if (backupPath) {
757
751
  console.log(ansis.gray(getBackupMessage(backupPath)));
@@ -768,8 +762,8 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
768
762
  }
769
763
  }
770
764
  async function updateCodexLanguageDirective(aiOutputLang) {
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; });
765
+ const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aQ; });
766
+ const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
773
767
  const { homedir } = await import('node:os');
774
768
  const { join } = await import('pathe');
775
769
  const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
@@ -1830,7 +1824,7 @@ async function update(options = {}) {
1830
1824
  }
1831
1825
  return;
1832
1826
  }
1833
- const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aN; });
1827
+ const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
1834
1828
  const configLang = await resolveTemplateLanguage(
1835
1829
  options.configLang,
1836
1830
  // Command line option
@@ -2273,7 +2267,7 @@ async function handleInteractiveSwitch() {
2273
2267
  }
2274
2268
  let success = false;
2275
2269
  if (selectedConfig === "official") {
2276
- success = await switchToOfficialLogin();
2270
+ success = await switchToOfficialLogin$1();
2277
2271
  } else {
2278
2272
  success = await switchToProvider(selectedConfig);
2279
2273
  }
@@ -25,11 +25,22 @@
25
25
  "modifyAuthType": "Modify auth type",
26
26
  "modifyPartialConfig": "Modify partial configuration",
27
27
  "selectApiAction": "Select API processing operation",
28
+ "selectApiMode": "Select API configuration mode",
29
+ "selectCustomConfigAction": "Select custom configuration action",
28
30
  "selectModifyItems": "Select items to modify",
29
31
  "selectNewAuthType": "Select new auth type (current: {type})",
30
32
  "skipApi": "Skip (configure manually later)",
33
+ "customApiConfig": "Custom API configuration",
31
34
  "urlRequired": "URL is required",
32
35
  "useApiKey": "Use API Key (Key authentication)",
33
36
  "useAuthToken": "Use Auth Token (OAuth authentication)",
34
- "useCcrProxy": "Use CCR Proxy"
37
+ "useCcrProxy": "Use CCR Proxy",
38
+ "useOfficialLogin": "Use Official Login",
39
+ "officialLoginConfigured": "Switched to official login mode",
40
+ "officialLoginFailed": "Failed to switch to official login mode",
41
+ "apiModeOfficial": "Use Official Login (No API Configuration)",
42
+ "apiModeCustom": "Custom API Configuration",
43
+ "apiModeCcr": "Use CCR Proxy",
44
+ "apiModeSkip": "Skip",
45
+ "apiModePrompt": "Select API configuration mode"
35
46
  }
@@ -38,7 +38,7 @@
38
38
  "openSettingsJsonDesc": "Advanced user customization",
39
39
  "openingSettingsJson": "Opening settings.json...",
40
40
  "opusModelOption": "Opus - Only use opus, high token consumption, use with caution",
41
- "opusPlanModelOption": "OpusPlan - Use Opus for planning, write code with sonnet, recommended",
41
+ "sonnet1mModelOption": "Sonnet 1M - 1M context version",
42
42
  "outputStyleInstalled": "Output styles installed successfully",
43
43
  "outputStyles.default.description": "Claude completes coding tasks efficiently and provides concise responses (Claude Code built-in)",
44
44
  "outputStyles.default.name": "Default",
@@ -52,6 +52,8 @@
52
52
  "outputStyles.learning.name": "Learning",
53
53
  "outputStyles.nekomata-engineer.description": "Professional catgirl engineer UFO Nya, combining rigorous engineering with cute catgirl traits",
54
54
  "outputStyles.nekomata-engineer.name": "Nekomata Engineer",
55
+ "outputStyles.ojousama-engineer.description": "Tsundere blonde ojou-sama programmer Halley-chan, combining rigorous engineering excellence with tsundere ojou-sama traits",
56
+ "outputStyles.ojousama-engineer.name": "Ojou-sama Engineer",
55
57
  "permissionsImportSuccess": "Permissions imported",
56
58
  "selectAtLeastOne": "Please select at least one output style",
57
59
  "selectDefaultModel": "Select default model",
@@ -10,7 +10,7 @@
10
10
  "invalidOutputStyle": "Invalid output style: {style}. Available styles: {validStyles}",
11
11
  "invalidDefaultOutputStyle": "Invalid default output style: {style}. Available styles: {validStyles}",
12
12
  "invalidWorkflow": "Invalid workflow: {workflow}. Available workflows: {validWorkflows}",
13
- "invalidModel": "Invalid model: {model}. Expected 'opus', 'sonnet', or 'opusplan'",
13
+ "invalidModel": "Invalid model: {model}. Expected 'opus', 'sonnet', or 'sonnet[1m]'",
14
14
  "invalidEnvConfig": "Invalid env configuration: expected object",
15
15
  "invalidBaseUrl": "Invalid ANTHROPIC_BASE_URL: expected string",
16
16
  "invalidApiKeyConfig": "Invalid ANTHROPIC_API_KEY: expected string",
@@ -17,5 +17,6 @@
17
17
  "services.spec-workflow.description": "Structured feature development workflow, systematic approach from requirements to implementation",
18
18
  "services.spec-workflow.name": "Spec Workflow",
19
19
  "apiKeyApprovalFailed": "Failed to manage API key approval status",
20
- "apiKeyPrompt": "Enter API Key"
20
+ "apiKeyPrompt": "Enter API Key",
21
+ "primaryApiKeySetFailed": "Failed to set primaryApiKey"
21
22
  }
@@ -9,7 +9,7 @@
9
9
  "menuDescriptions.configureApiOrCcr": "Configure API URL, authentication or CCR proxy",
10
10
  "menuDescriptions.configureEnvPermission": "Import privacy protection environment variables and system permissions",
11
11
  "menuDescriptions.configureMcp": "Configure MCP services (includes Windows fix)",
12
- "menuDescriptions.configureModel": "Set default model (opus/sonnet/opusplan/custom)",
12
+ "menuDescriptions.configureModel": "Set default model (opus/sonnet/sonnet 1m/custom)",
13
13
  "menuDescriptions.fullInit": "Install Claude Code + Import workflow + Configure API or CCR proxy + Configure MCP services",
14
14
  "menuDescriptions.importWorkflow": "Import/update workflow-related files only",
15
15
  "menuOptions.ccrManagement": "CCR",
@@ -25,11 +25,22 @@
25
25
  "modifyAuthType": "修改认证类型",
26
26
  "modifyPartialConfig": "修改部分配置",
27
27
  "selectApiAction": "请选择API处理操作",
28
+ "selectApiMode": "请选择 API 配置模式",
29
+ "selectCustomConfigAction": "请选择自定义配置操作",
28
30
  "selectModifyItems": "请选择要修改的项",
29
31
  "selectNewAuthType": "选择新的认证类型(当前:{type})",
30
32
  "skipApi": "跳过(稍后手动配置)",
33
+ "customApiConfig": "自定义 API 配置",
31
34
  "urlRequired": "URL 为必填项",
32
35
  "useApiKey": "使用 API Key (密钥认证)",
33
36
  "useAuthToken": "使用 Auth Token (OAuth 认证)",
34
- "useCcrProxy": "使用 CCR 代理"
37
+ "useCcrProxy": "使用 CCR 代理",
38
+ "useOfficialLogin": "使用官方登录",
39
+ "officialLoginConfigured": "已切换到官方登录模式",
40
+ "officialLoginFailed": "切换到官方登录模式失败",
41
+ "apiModeOfficial": "使用官方登录(不配置 API)",
42
+ "apiModeCustom": "自定义 API 配置",
43
+ "apiModeCcr": "使用CCR代理",
44
+ "apiModeSkip": "跳过",
45
+ "apiModePrompt": "请选择 API 配置模式"
35
46
  }
@@ -38,7 +38,7 @@
38
38
  "openSettingsJsonDesc": "高级用户自定义",
39
39
  "openingSettingsJson": "正在打开 settings.json...",
40
40
  "opusModelOption": "Opus - 只用opus,token消耗高,慎用",
41
- "opusPlanModelOption": "OpusPlan - Opus做计划,sonnet编写代码,推荐",
41
+ "sonnet1mModelOption": "Sonnet 1M - 1M上下文版本",
42
42
  "outputStyleInstalled": "输出风格安装成功",
43
43
  "outputStyles.default.description": "完成编码任务时高效且提供简洁响应 (Claude Code自带)",
44
44
  "outputStyles.default.name": "默认风格",
@@ -52,6 +52,8 @@
52
52
  "outputStyles.learning.name": "学习风格",
53
53
  "outputStyles.nekomata-engineer.description": "专业的猫娘工程师幽浮喵,结合严谨工程师素养与可爱猫娘特质",
54
54
  "outputStyles.nekomata-engineer.name": "猫娘工程师",
55
+ "outputStyles.ojousama-engineer.description": "傲娇金发大小姐程序员哈雷酱,融合严谨工程师素养与傲娇大小姐特质",
56
+ "outputStyles.ojousama-engineer.name": "傲娇大小姐工程师",
55
57
  "permissionsImportSuccess": "权限配置已导入",
56
58
  "selectAtLeastOne": "请至少选择一个输出风格",
57
59
  "selectDefaultModel": "选择默认模型",
@@ -10,7 +10,7 @@
10
10
  "invalidOutputStyle": "无效的输出样式:{style}。可用的样式:{validStyles}",
11
11
  "invalidDefaultOutputStyle": "无效的默认输出样式:{style}。可用的样式:{validStyles}",
12
12
  "invalidWorkflow": "无效的工作流:{workflow}。可用的工作流:{validWorkflows}",
13
- "invalidModel": "无效的模型:{model}。期望的值:'opus', 'sonnet', 或 'opusplan'",
13
+ "invalidModel": "无效的模型:{model}。期望的值:'opus', 'sonnet', 或 'sonnet[1m]'",
14
14
  "invalidEnvConfig": "无效的环境配置:期望对象类型",
15
15
  "invalidBaseUrl": "无效的 ANTHROPIC_BASE_URL:期望字符串类型",
16
16
  "invalidApiKeyConfig": "无效的 ANTHROPIC_API_KEY:期望字符串类型",
@@ -17,5 +17,6 @@
17
17
  "services.spec-workflow.description": "规范化特性开发工作流程,从需求到实现的系统化方法",
18
18
  "services.spec-workflow.name": "Spec 工作流",
19
19
  "apiKeyApprovalFailed": "API密钥批准状态管理失败",
20
- "apiKeyPrompt": "请输入 API Key"
20
+ "apiKeyPrompt": "请输入 API Key",
21
+ "primaryApiKeySetFailed": "设置 primaryApiKey 失败"
21
22
  }
@@ -9,7 +9,7 @@
9
9
  "menuDescriptions.configureApiOrCcr": "配置 API URL、认证信息或 CCR 代理",
10
10
  "menuDescriptions.configureEnvPermission": "导入隐私保护环境变量和系统权限配置",
11
11
  "menuDescriptions.configureMcp": "配置 MCP 服务(含 Windows 修复)",
12
- "menuDescriptions.configureModel": "设置默认模型(opus/sonnet/opusplan/自定义)",
12
+ "menuDescriptions.configureModel": "设置默认模型(opus/sonnet/sonnet 1m/自定义)",
13
13
  "menuDescriptions.fullInit": "安装 Claude Code + 导入工作流 + 配置 API 或 CCR 代理 + 配置 MCP 服务",
14
14
  "menuDescriptions.importWorkflow": "仅导入/更新工作流相关文件",
15
15
  "menuOptions.ccrManagement": "CCR",
package/dist/index.d.mts CHANGED
@@ -2,6 +2,7 @@ declare const CLAUDE_DIR: string;
2
2
  declare const SETTINGS_FILE: string;
3
3
  declare const CLAUDE_MD_FILE: string;
4
4
  declare const ClAUDE_CONFIG_FILE: string;
5
+ declare const CLAUDE_VSC_CONFIG_FILE: string;
5
6
  declare const ZCF_CONFIG_DIR: string;
6
7
  declare const ZCF_CONFIG_FILE: string;
7
8
  declare const LEGACY_ZCF_CONFIG_FILES: string[];
@@ -76,6 +77,7 @@ interface ClaudeConfiguration {
76
77
  rejected: string[];
77
78
  };
78
79
  env?: Record<string, string>;
80
+ primaryApiKey?: string;
79
81
  }
80
82
 
81
83
  declare function getMcpConfigPath(): string;
@@ -105,6 +107,12 @@ declare function removeApiKeyFromRejected(config: ClaudeConfiguration, apiKey: s
105
107
  * @param apiKey - The API key to ensure is approved (e.g., 'sk-zcf-x-ccr')
106
108
  */
107
109
  declare function manageApiKeyApproval(apiKey: string): void;
110
+ /**
111
+ * Sets the primaryApiKey field in ~/.claude/config.json (VSCode extension config)
112
+ * This is required for Claude Code 2.0 to properly recognize third-party API configurations
113
+ * and prevent redirecting to official login page
114
+ */
115
+ declare function setPrimaryApiKey(): void;
108
116
 
109
117
  /**
110
118
  * API configuration for Claude Code
@@ -128,10 +136,10 @@ declare function mergeConfigs(sourceFile: string, targetFile: string): void;
128
136
  declare function updateCustomModel(primaryModel?: string, fastModel?: string): void;
129
137
  /**
130
138
  * Update the default model configuration in settings.json
131
- * @param model - The model type to set: opus, sonnet, opusplan, default, or custom
139
+ * @param model - The model type to set: opus, sonnet, sonnet[1m], default, or custom
132
140
  * Note: 'custom' model type is handled differently - it should use environment variables instead
133
141
  */
134
- declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'opusplan' | 'default' | 'custom'): void;
142
+ declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom'): void;
135
143
  /**
136
144
  * Merge settings.json intelligently
137
145
  * Preserves user's environment variables and custom configurations
@@ -140,12 +148,24 @@ declare function mergeSettingsFile(templatePath: string, targetPath: string): vo
140
148
  /**
141
149
  * Get existing model configuration from settings.json
142
150
  */
143
- declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'opusplan' | 'default' | 'custom' | null;
151
+ declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom' | null;
144
152
  /**
145
153
  * Get existing API configuration from settings.json
146
154
  */
147
155
  declare function getExistingApiConfig(): ApiConfig | null;
148
156
  declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
157
+ /**
158
+ * Switch to official login mode - remove all third-party API configurations
159
+ * Removes: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY from settings.json
160
+ * Removes: primaryApiKey from ~/.claude/config.json
161
+ * Removes: hasCompletedOnboarding from ~/.claude.json
162
+ */
163
+ declare function switchToOfficialLogin(): boolean;
164
+ /**
165
+ * Prompt user for API configuration action when existing config is found
166
+ * Returns the user's choice for how to handle existing configuration
167
+ */
168
+ declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
149
169
 
150
170
  declare function isClaudeCodeInstalled(): Promise<boolean>;
151
171
  declare function installClaudeCode(): Promise<void>;
@@ -194,5 +214,5 @@ declare function importRecommendedEnv(): Promise<void>;
194
214
  declare function importRecommendedPermissions(): Promise<void>;
195
215
  declare function openSettingsJson(): Promise<void>;
196
216
 
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 };
217
+ export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, CLAUDE_VSC_CONFIG_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, promptApiConfigurationAction, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, setPrimaryApiKey, switchToOfficialLogin, updateCustomModel, updateDefaultModel, writeMcpConfig };
198
218
  export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, CodeToolType, InstallationStatus, McpServerConfig, McpService, SupportedLang };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ declare const CLAUDE_DIR: string;
2
2
  declare const SETTINGS_FILE: string;
3
3
  declare const CLAUDE_MD_FILE: string;
4
4
  declare const ClAUDE_CONFIG_FILE: string;
5
+ declare const CLAUDE_VSC_CONFIG_FILE: string;
5
6
  declare const ZCF_CONFIG_DIR: string;
6
7
  declare const ZCF_CONFIG_FILE: string;
7
8
  declare const LEGACY_ZCF_CONFIG_FILES: string[];
@@ -76,6 +77,7 @@ interface ClaudeConfiguration {
76
77
  rejected: string[];
77
78
  };
78
79
  env?: Record<string, string>;
80
+ primaryApiKey?: string;
79
81
  }
80
82
 
81
83
  declare function getMcpConfigPath(): string;
@@ -105,6 +107,12 @@ declare function removeApiKeyFromRejected(config: ClaudeConfiguration, apiKey: s
105
107
  * @param apiKey - The API key to ensure is approved (e.g., 'sk-zcf-x-ccr')
106
108
  */
107
109
  declare function manageApiKeyApproval(apiKey: string): void;
110
+ /**
111
+ * Sets the primaryApiKey field in ~/.claude/config.json (VSCode extension config)
112
+ * This is required for Claude Code 2.0 to properly recognize third-party API configurations
113
+ * and prevent redirecting to official login page
114
+ */
115
+ declare function setPrimaryApiKey(): void;
108
116
 
109
117
  /**
110
118
  * API configuration for Claude Code
@@ -128,10 +136,10 @@ declare function mergeConfigs(sourceFile: string, targetFile: string): void;
128
136
  declare function updateCustomModel(primaryModel?: string, fastModel?: string): void;
129
137
  /**
130
138
  * Update the default model configuration in settings.json
131
- * @param model - The model type to set: opus, sonnet, opusplan, default, or custom
139
+ * @param model - The model type to set: opus, sonnet, sonnet[1m], default, or custom
132
140
  * Note: 'custom' model type is handled differently - it should use environment variables instead
133
141
  */
134
- declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'opusplan' | 'default' | 'custom'): void;
142
+ declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom'): void;
135
143
  /**
136
144
  * Merge settings.json intelligently
137
145
  * Preserves user's environment variables and custom configurations
@@ -140,12 +148,24 @@ declare function mergeSettingsFile(templatePath: string, targetPath: string): vo
140
148
  /**
141
149
  * Get existing model configuration from settings.json
142
150
  */
143
- declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'opusplan' | 'default' | 'custom' | null;
151
+ declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'sonnet[1m]' | 'default' | 'custom' | null;
144
152
  /**
145
153
  * Get existing API configuration from settings.json
146
154
  */
147
155
  declare function getExistingApiConfig(): ApiConfig | null;
148
156
  declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
157
+ /**
158
+ * Switch to official login mode - remove all third-party API configurations
159
+ * Removes: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY from settings.json
160
+ * Removes: primaryApiKey from ~/.claude/config.json
161
+ * Removes: hasCompletedOnboarding from ~/.claude.json
162
+ */
163
+ declare function switchToOfficialLogin(): boolean;
164
+ /**
165
+ * Prompt user for API configuration action when existing config is found
166
+ * Returns the user's choice for how to handle existing configuration
167
+ */
168
+ declare function promptApiConfigurationAction(): Promise<'modify-partial' | 'modify-all' | 'keep-existing' | null>;
149
169
 
150
170
  declare function isClaudeCodeInstalled(): Promise<boolean>;
151
171
  declare function installClaudeCode(): Promise<void>;
@@ -194,5 +214,5 @@ declare function importRecommendedEnv(): Promise<void>;
194
214
  declare function importRecommendedPermissions(): Promise<void>;
195
215
  declare function openSettingsJson(): Promise<void>;
196
216
 
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 };
217
+ export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, CLAUDE_VSC_CONFIG_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, promptApiConfigurationAction, readMcpConfig, removeApiKeyFromRejected, removeLocalClaudeCode, setPrimaryApiKey, switchToOfficialLogin, updateCustomModel, updateDefaultModel, writeMcpConfig };
198
218
  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, 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';
1
+ export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, h as CLAUDE_VSC_CONFIG_FILE, l as CODE_TOOL_BANNERS, k as CODE_TOOL_TYPES, f as ClAUDE_CONFIG_FILE, D as DEFAULT_CODE_TOOL_TYPE, q as LANG_LABELS, L as LEGACY_ZCF_CONFIG_FILES, S as SETTINGS_FILE, p as SUPPORTED_LANGS, Z as ZCF_CONFIG_DIR, j as ZCF_CONFIG_FILE, z as addCompletedOnboarding, T as applyAiLanguageDirective, I as backupExistingConfig, u as backupMcpConfig, x as buildMcpServerConfig, c as cleanupPermissions, a as commandExists, K as configureApi, J as copyConfigFiles, B as ensureApiKeyApproved, H as ensureClaudeDir, y as fixWindowsMcpConfig, r as getAiOutputLanguageLabel, R as getExistingApiConfig, Q as getExistingModelConfig, _ as getInstallationStatus, s as getMcpConfigPath, g as getPlatform, b as importRecommendedEnv, d as importRecommendedPermissions, i as init, X as installClaudeCode, W as isClaudeCodeInstalled, n as isCodeToolType, Y as isLocalClaudeCodeInstalled, F as manageApiKeyApproval, m as mergeAndCleanPermissions, M as mergeConfigs, v as mergeMcpServers, P as mergeSettingsFile, o as openSettingsJson, V as promptApiConfigurationAction, t as readMcpConfig, E as removeApiKeyFromRejected, $ as removeLocalClaudeCode, G as setPrimaryApiKey, U as switchToOfficialLogin, N as updateCustomModel, O as updateDefaultModel, w as writeMcpConfig } from './chunks/simple-config.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:process';
4
4
  import 'ansis';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "3.0.2",
4
+ "version": "3.1.0",
5
5
  "description": "Zero-Config Code Flow - One-click configuration tool for Claude Code",
6
6
  "author": {
7
7
  "name": "Miao Da",
@@ -10,9 +10,7 @@
10
10
  "permissions": {
11
11
  "allow": [
12
12
  "Bash",
13
- "LS",
14
13
  "Read",
15
- "Agent",
16
14
  "Write",
17
15
  "Edit",
18
16
  "MultiEdit",