zcf 3.0.2 → 3.0.3
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 +27 -46
- package/dist/chunks/codex-config-switch.mjs +1 -1
- package/dist/chunks/codex-uninstaller.mjs +1 -1
- package/dist/chunks/simple-config.mjs +210 -89
- package/dist/cli.mjs +77 -83
- package/dist/i18n/locales/en/api.json +12 -1
- package/dist/i18n/locales/en/configuration.json +1 -1
- package/dist/i18n/locales/en/errors.json +1 -1
- package/dist/i18n/locales/en/mcp.json +2 -1
- package/dist/i18n/locales/en/menu.json +1 -1
- package/dist/i18n/locales/zh-CN/api.json +12 -1
- package/dist/i18n/locales/zh-CN/configuration.json +1 -1
- package/dist/i18n/locales/zh-CN/errors.json +1 -1
- package/dist/i18n/locales/zh-CN/mcp.json +2 -1
- package/dist/i18n/locales/zh-CN/menu.json +1 -1
- package/dist/index.d.mts +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/templates/claude-code/common/settings.json +0 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ Menu options include:
|
|
|
30
30
|
- `2` Import workflows (equivalent to `zcf u`)
|
|
31
31
|
- `3` Configure API or CCR - API configuration or CCR proxy setup
|
|
32
32
|
- `4` Configure MCP - MCP service configuration and management
|
|
33
|
-
- `5` Configure default model - Set default model (opus/sonnet/
|
|
33
|
+
- `5` Configure default model - Set default model (opus/sonnet/sonnet 1m/custom)
|
|
34
34
|
- `6` Configure AI memory - Configure AI output language and global output style
|
|
35
35
|
- `7` Configure environment permissions - Import environment variables and permissions
|
|
36
36
|
- `R` Claude Code Router management (enhanced in v2.8.1)
|
|
@@ -44,7 +44,7 @@ Menu options include:
|
|
|
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
46
|
- **Opus**: Use Claude-3.5-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
|
|
|
50
50
|
**AI Memory Configuration (Option 6)**: Personalize your AI assistant:
|
|
@@ -421,7 +421,7 @@ Select function:
|
|
|
421
421
|
2. Import workflow - Import/update workflow-related files only
|
|
422
422
|
3. Configure API - Configure API URL and authentication (supports CCR proxy)
|
|
423
423
|
4. Configure MCP - Configure MCP services (includes Windows fix)
|
|
424
|
-
5. Configure default model - Set default model (opus/sonnet/
|
|
424
|
+
5. Configure default model - Set default model (opus/sonnet/sonnet 1m/custom)
|
|
425
425
|
6. Configure Claude global memory - Configure AI output language and output styles
|
|
426
426
|
7. Import recommended environment variables and permissions - Import privacy protection environment variables and system permissions
|
|
427
427
|
|
|
@@ -443,15 +443,17 @@ Enter your choice: _
|
|
|
443
443
|
|
|
444
444
|
```bash
|
|
445
445
|
? Select Claude Code configuration language:
|
|
446
|
-
❯
|
|
447
|
-
|
|
446
|
+
❯ English (en) - English (recommended, lower token consumption)
|
|
447
|
+
简体中文 (zh-CN) - Chinese (easier for Chinese users to customize)
|
|
448
|
+
日本語 (ja) - Japanese (日本のユーザー向け)
|
|
448
449
|
|
|
449
450
|
? Select AI output language:
|
|
450
451
|
AI will respond to you in this language
|
|
451
|
-
❯
|
|
452
|
-
|
|
452
|
+
❯ English
|
|
453
|
+
简体中文
|
|
454
|
+
日本語
|
|
453
455
|
Custom
|
|
454
|
-
(Supports
|
|
456
|
+
(Supports French, German, and more)
|
|
455
457
|
|
|
456
458
|
? Claude Code not found. Install automatically? (Y/n)
|
|
457
459
|
|
|
@@ -464,12 +466,14 @@ Enter your choice: _
|
|
|
464
466
|
Skip - Skip configuration update
|
|
465
467
|
|
|
466
468
|
? Select API authentication method
|
|
467
|
-
❯ Use
|
|
469
|
+
❯ Use Official Login
|
|
470
|
+
Use official authentication system without API configuration
|
|
471
|
+
Use Auth Token (OAuth authentication)
|
|
468
472
|
For tokens obtained via OAuth or browser login
|
|
469
473
|
Use API Key (Key authentication)
|
|
470
474
|
For API keys from Anthropic Console
|
|
471
475
|
Configure CCR Proxy (Claude Code Router)
|
|
472
|
-
Use
|
|
476
|
+
Use multiple AI models via proxy routing to reduce costs and explore possibilities
|
|
473
477
|
Skip (configure manually later)
|
|
474
478
|
|
|
475
479
|
? Enter API URL: https://api.anthropic.com
|
|
@@ -483,30 +487,7 @@ Enter your choice: _
|
|
|
483
487
|
? Select global default output style:
|
|
484
488
|
❯ Engineer Professional
|
|
485
489
|
|
|
486
|
-
?
|
|
487
|
-
|
|
488
|
-
? Select MCP services to install:
|
|
489
|
-
❯ context7 - Get latest library and framework documentation
|
|
490
|
-
mcp-deepwiki - Access deepwiki.com knowledge base
|
|
491
|
-
Playwright - Browser automation and web testing
|
|
492
|
-
exa - Advanced search and enterprise research tools
|
|
493
|
-
|
|
494
|
-
? Select workflows to install:
|
|
495
|
-
❯ Common Tools Workflow - init-project and related agents
|
|
496
|
-
Six Steps Workflow - Complete six-stage development process
|
|
497
|
-
Feature Planning UX - Complete feature development lifecycle
|
|
498
|
-
Git Workflow - Git operations and branch management
|
|
499
|
-
BMad Workflow - AI-driven agile development methodology
|
|
500
|
-
|
|
501
|
-
? Install CCometixLine statusline tool? (Y/n)
|
|
502
|
-
|
|
503
|
-
✔ Setup complete! Claude Code environment is ready
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
✔ All config files backed up to ~/.claude/backup/xxx
|
|
507
|
-
✔ Config files copied to ~/.claude
|
|
508
|
-
|
|
509
|
-
? Select workflows to install (space to select, enter to confirm)
|
|
490
|
+
? Select workflows to install (space to select, enter to confirm):
|
|
510
491
|
❯ ◉ Common Tools (init-project + init-architect + get-current-datetime) - Essential project initialization and utility commands
|
|
511
492
|
◉ Six Steps Workflow (workflow) - Complete 6-phase development process
|
|
512
493
|
◉ Feature Planning and UX Design (feat + planner + ui-ux-designer) - Structured feature development
|
|
@@ -525,24 +506,24 @@ Enter your choice: _
|
|
|
525
506
|
✔ Installed command: zcf/bmad-init.md
|
|
526
507
|
✔ Workflow installation successful
|
|
527
508
|
|
|
528
|
-
✔ API configured
|
|
529
|
-
|
|
530
509
|
? Configure MCP services? (Y/n)
|
|
531
510
|
|
|
532
|
-
? Select MCP services to install (space to select, enter to confirm)
|
|
533
|
-
❯
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
◯
|
|
538
|
-
|
|
539
|
-
? Enter Exa API Key (get from https://dashboard.exa.ai/api-keys)
|
|
511
|
+
? Select MCP services to install (space to select, enter to confirm):
|
|
512
|
+
❯ ◉ Context7 Documentation Query - Query latest library docs and code examples
|
|
513
|
+
◉ DeepWiki - Query GitHub repository docs and examples
|
|
514
|
+
◉ Playwright Browser Control - Direct browser automation control
|
|
515
|
+
◉ Exa AI Search - Web search using Exa AI
|
|
516
|
+
◯ Install all services
|
|
540
517
|
|
|
541
518
|
✔ MCP services configured
|
|
542
519
|
|
|
520
|
+
? Install CCometixLine statusline tool? (Y/n)
|
|
521
|
+
|
|
522
|
+
✔ Setup complete! Claude Code environment is ready
|
|
523
|
+
|
|
543
524
|
🎉 Setup complete! Use 'claude' command to start.
|
|
544
525
|
|
|
545
|
-
|
|
526
|
+
```
|
|
546
527
|
|
|
547
528
|
### Command Line Options
|
|
548
529
|
|
|
@@ -581,7 +562,7 @@ npx zcf -h
|
|
|
581
562
|
# Show version
|
|
582
563
|
npx zcf --version
|
|
583
564
|
npx zcf -v
|
|
584
|
-
|
|
565
|
+
```
|
|
585
566
|
|
|
586
567
|
#### Usage Examples
|
|
587
568
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ansis from 'ansis';
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
|
-
import {
|
|
3
|
+
import { a1 as readCodexConfig, a2 as backupCodexComplete, a3 as writeCodexConfig, a4 as writeAuthFile, a5 as ensureI18nInitialized, a6 as detectConfigManagementMode, a0 as i18n, a7 as addNumbersToChoices } from './simple-config.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:process';
|
|
6
6
|
import 'node:child_process';
|
|
@@ -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 { a0 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.3";
|
|
20
20
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
21
21
|
|
|
22
22
|
const i18n = i18next.createInstance();
|
|
@@ -123,6 +123,15 @@ async function changeLanguage(lng) {
|
|
|
123
123
|
await i18n.changeLanguage(lng);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
const index = {
|
|
127
|
+
__proto__: null,
|
|
128
|
+
changeLanguage: changeLanguage,
|
|
129
|
+
ensureI18nInitialized: ensureI18nInitialized,
|
|
130
|
+
format: format,
|
|
131
|
+
i18n: i18n,
|
|
132
|
+
initI18n: initI18n
|
|
133
|
+
};
|
|
134
|
+
|
|
126
135
|
const MCP_SERVICE_CONFIGS = [
|
|
127
136
|
{
|
|
128
137
|
id: "context7",
|
|
@@ -355,6 +364,7 @@ const CLAUDE_DIR = join(homedir(), ".claude");
|
|
|
355
364
|
const SETTINGS_FILE = join(CLAUDE_DIR, "settings.json");
|
|
356
365
|
const CLAUDE_MD_FILE = join(CLAUDE_DIR, "CLAUDE.md");
|
|
357
366
|
const ClAUDE_CONFIG_FILE = join(homedir(), ".claude.json");
|
|
367
|
+
const CLAUDE_VSC_CONFIG_FILE = join(CLAUDE_DIR, "config.json");
|
|
358
368
|
const ZCF_CONFIG_DIR = join(homedir(), ".ufomiao", "zcf");
|
|
359
369
|
const ZCF_CONFIG_FILE = join(ZCF_CONFIG_DIR, "config.toml");
|
|
360
370
|
const LEGACY_ZCF_CONFIG_FILES = [
|
|
@@ -398,6 +408,7 @@ const constants = {
|
|
|
398
408
|
AI_OUTPUT_LANGUAGES: AI_OUTPUT_LANGUAGES,
|
|
399
409
|
CLAUDE_DIR: CLAUDE_DIR,
|
|
400
410
|
CLAUDE_MD_FILE: CLAUDE_MD_FILE,
|
|
411
|
+
CLAUDE_VSC_CONFIG_FILE: CLAUDE_VSC_CONFIG_FILE,
|
|
401
412
|
CODE_TOOL_BANNERS: CODE_TOOL_BANNERS,
|
|
402
413
|
CODE_TOOL_TYPES: CODE_TOOL_TYPES,
|
|
403
414
|
ClAUDE_CONFIG_FILE: ClAUDE_CONFIG_FILE,
|
|
@@ -992,6 +1003,19 @@ function manageApiKeyApproval(apiKey) {
|
|
|
992
1003
|
console.error(i18n.t("mcp:apiKeyApprovalFailed"), error);
|
|
993
1004
|
}
|
|
994
1005
|
}
|
|
1006
|
+
function setPrimaryApiKey() {
|
|
1007
|
+
try {
|
|
1008
|
+
let config = readJsonConfig(CLAUDE_VSC_CONFIG_FILE);
|
|
1009
|
+
if (!config) {
|
|
1010
|
+
config = {};
|
|
1011
|
+
}
|
|
1012
|
+
config.primaryApiKey = "zcf";
|
|
1013
|
+
writeJsonConfig(CLAUDE_VSC_CONFIG_FILE, config);
|
|
1014
|
+
} catch (error) {
|
|
1015
|
+
ensureI18nInitialized();
|
|
1016
|
+
console.error(i18n.t("mcp:primaryApiKeySetFailed"), error);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
995
1019
|
|
|
996
1020
|
const claudeConfig = {
|
|
997
1021
|
__proto__: null,
|
|
@@ -1005,6 +1029,7 @@ const claudeConfig = {
|
|
|
1005
1029
|
mergeMcpServers: mergeMcpServers,
|
|
1006
1030
|
readMcpConfig: readMcpConfig,
|
|
1007
1031
|
removeApiKeyFromRejected: removeApiKeyFromRejected,
|
|
1032
|
+
setPrimaryApiKey: setPrimaryApiKey,
|
|
1008
1033
|
writeMcpConfig: writeMcpConfig
|
|
1009
1034
|
};
|
|
1010
1035
|
|
|
@@ -1102,6 +1127,14 @@ function configureApi(apiConfig) {
|
|
|
1102
1127
|
settings.env.ANTHROPIC_BASE_URL = apiConfig.url;
|
|
1103
1128
|
}
|
|
1104
1129
|
writeJsonConfig(SETTINGS_FILE, settings);
|
|
1130
|
+
if (apiConfig.authType) {
|
|
1131
|
+
try {
|
|
1132
|
+
setPrimaryApiKey();
|
|
1133
|
+
} catch (error) {
|
|
1134
|
+
ensureI18nInitialized();
|
|
1135
|
+
console.error(i18n.t("mcp:primaryApiKeySetFailed"), error);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1105
1138
|
try {
|
|
1106
1139
|
addCompletedOnboarding();
|
|
1107
1140
|
} catch (error) {
|
|
@@ -1246,6 +1279,67 @@ function applyAiLanguageDirective(aiOutputLang) {
|
|
|
1246
1279
|
}
|
|
1247
1280
|
writeFile(claudeFile, directive);
|
|
1248
1281
|
}
|
|
1282
|
+
function switchToOfficialLogin$1() {
|
|
1283
|
+
try {
|
|
1284
|
+
ensureI18nInitialized();
|
|
1285
|
+
const settings = readJsonConfig(SETTINGS_FILE) || {};
|
|
1286
|
+
if (settings.env) {
|
|
1287
|
+
delete settings.env.ANTHROPIC_BASE_URL;
|
|
1288
|
+
delete settings.env.ANTHROPIC_AUTH_TOKEN;
|
|
1289
|
+
delete settings.env.ANTHROPIC_API_KEY;
|
|
1290
|
+
}
|
|
1291
|
+
writeJsonConfig(SETTINGS_FILE, settings);
|
|
1292
|
+
const vscConfig = readJsonConfig(CLAUDE_VSC_CONFIG_FILE);
|
|
1293
|
+
if (vscConfig) {
|
|
1294
|
+
delete vscConfig.primaryApiKey;
|
|
1295
|
+
writeJsonConfig(CLAUDE_VSC_CONFIG_FILE, vscConfig);
|
|
1296
|
+
}
|
|
1297
|
+
const mcpConfig = readMcpConfig();
|
|
1298
|
+
if (mcpConfig) {
|
|
1299
|
+
delete mcpConfig.hasCompletedOnboarding;
|
|
1300
|
+
writeMcpConfig(mcpConfig);
|
|
1301
|
+
}
|
|
1302
|
+
console.log(i18n.t("api:officialLoginConfigured"));
|
|
1303
|
+
return true;
|
|
1304
|
+
} catch (error) {
|
|
1305
|
+
ensureI18nInitialized();
|
|
1306
|
+
console.error(i18n.t("api:officialLoginFailed"), error);
|
|
1307
|
+
return false;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
async function promptApiConfigurationAction() {
|
|
1311
|
+
ensureI18nInitialized();
|
|
1312
|
+
const existingConfig = getExistingApiConfig();
|
|
1313
|
+
if (!existingConfig) {
|
|
1314
|
+
return null;
|
|
1315
|
+
}
|
|
1316
|
+
console.log(`
|
|
1317
|
+
${ansis.blue(`\u2139 ${i18n.t("api:existingApiConfig")}`)}`);
|
|
1318
|
+
console.log(ansis.gray(` ${i18n.t("api:apiConfigUrl")}: ${existingConfig.url || "N/A"}`));
|
|
1319
|
+
console.log(ansis.gray(` ${i18n.t("api:apiConfigKey")}: ${existingConfig.key ? `***${existingConfig.key.slice(-4)}` : "N/A"}`));
|
|
1320
|
+
console.log(ansis.gray(` ${i18n.t("api:apiConfigAuthType")}: ${existingConfig.authType || "N/A"}
|
|
1321
|
+
`));
|
|
1322
|
+
const { choice } = await inquirer.prompt({
|
|
1323
|
+
type: "list",
|
|
1324
|
+
name: "choice",
|
|
1325
|
+
message: i18n.t("api:selectCustomConfigAction"),
|
|
1326
|
+
choices: [
|
|
1327
|
+
{
|
|
1328
|
+
name: i18n.t("api:modifyPartialConfig"),
|
|
1329
|
+
value: "modify-partial"
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
name: i18n.t("api:modifyAllConfig"),
|
|
1333
|
+
value: "modify-all"
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
name: i18n.t("api:keepExistingConfig"),
|
|
1337
|
+
value: "keep-existing"
|
|
1338
|
+
}
|
|
1339
|
+
]
|
|
1340
|
+
});
|
|
1341
|
+
return choice || null;
|
|
1342
|
+
}
|
|
1249
1343
|
|
|
1250
1344
|
const PROVIDER_PRESETS_URL = "https://pub-0dc3e1677e894f07bbea11b17a29e032.r2.dev/providers.json";
|
|
1251
1345
|
async function fetchProviderPresets() {
|
|
@@ -1443,6 +1537,12 @@ async function configureCcrProxy(ccrConfig) {
|
|
|
1443
1537
|
settings.env.ANTHROPIC_BASE_URL = `http://${host}:${port}`;
|
|
1444
1538
|
settings.env.ANTHROPIC_API_KEY = apiKey;
|
|
1445
1539
|
writeJsonConfig(SETTINGS_FILE, settings);
|
|
1540
|
+
try {
|
|
1541
|
+
setPrimaryApiKey();
|
|
1542
|
+
} catch (error) {
|
|
1543
|
+
ensureI18nInitialized();
|
|
1544
|
+
console.error(i18n.t("mcp:primaryApiKeySetFailed"), error);
|
|
1545
|
+
}
|
|
1446
1546
|
}
|
|
1447
1547
|
async function selectCcrPreset() {
|
|
1448
1548
|
ensureI18nInitialized();
|
|
@@ -4014,6 +4114,11 @@ async function configureApiCompletely(preselectedAuthType) {
|
|
|
4014
4114
|
name: "authType",
|
|
4015
4115
|
message: i18n.t("api:configureApi"),
|
|
4016
4116
|
choices: addNumbersToChoices([
|
|
4117
|
+
{
|
|
4118
|
+
name: i18n.t("api:useOfficialLogin"),
|
|
4119
|
+
value: "official",
|
|
4120
|
+
short: i18n.t("api:useOfficialLogin")
|
|
4121
|
+
},
|
|
4017
4122
|
{
|
|
4018
4123
|
name: `${i18n.t("api:useAuthToken")} - ${ansis.gray(i18n.t("api:authTokenDesc"))}`,
|
|
4019
4124
|
value: "auth_token",
|
|
@@ -4032,6 +4137,15 @@ async function configureApiCompletely(preselectedAuthType) {
|
|
|
4032
4137
|
}
|
|
4033
4138
|
authType = selectedAuthType;
|
|
4034
4139
|
}
|
|
4140
|
+
if (authType === "official") {
|
|
4141
|
+
const success = switchToOfficialLogin$1();
|
|
4142
|
+
if (success) {
|
|
4143
|
+
return null;
|
|
4144
|
+
} else {
|
|
4145
|
+
console.log(ansis.red(i18n.t("api:officialLoginFailed")));
|
|
4146
|
+
return null;
|
|
4147
|
+
}
|
|
4148
|
+
}
|
|
4035
4149
|
const { url } = await inquirer.prompt({
|
|
4036
4150
|
type: "input",
|
|
4037
4151
|
name: "url",
|
|
@@ -4688,6 +4802,80 @@ async function init(options = {}) {
|
|
|
4688
4802
|
const zcfConfig = readZcfConfig();
|
|
4689
4803
|
const codeToolType = resolveCodeToolType(options.codeType, zcfConfig?.codeToolType);
|
|
4690
4804
|
options.codeType = codeToolType;
|
|
4805
|
+
async function selectApiConfigurationMode() {
|
|
4806
|
+
const { apiMode } = await inquirer.prompt({
|
|
4807
|
+
type: "list",
|
|
4808
|
+
name: "apiMode",
|
|
4809
|
+
message: i18n.t("api:selectApiMode"),
|
|
4810
|
+
choices: [
|
|
4811
|
+
{
|
|
4812
|
+
name: i18n.t("api:useOfficialLogin"),
|
|
4813
|
+
value: "official"
|
|
4814
|
+
},
|
|
4815
|
+
{
|
|
4816
|
+
name: i18n.t("api:customApiConfig"),
|
|
4817
|
+
value: "custom"
|
|
4818
|
+
},
|
|
4819
|
+
{
|
|
4820
|
+
name: i18n.t("api:useCcrProxy"),
|
|
4821
|
+
value: "ccr"
|
|
4822
|
+
},
|
|
4823
|
+
{
|
|
4824
|
+
name: i18n.t("api:skipApi"),
|
|
4825
|
+
value: "skip"
|
|
4826
|
+
}
|
|
4827
|
+
]
|
|
4828
|
+
});
|
|
4829
|
+
return apiMode;
|
|
4830
|
+
}
|
|
4831
|
+
async function handleCustomApiConfiguration(existingConfig) {
|
|
4832
|
+
if (existingConfig) {
|
|
4833
|
+
const customConfigAction = await promptApiConfigurationAction();
|
|
4834
|
+
if (customConfigAction === "modify-partial") {
|
|
4835
|
+
await modifyApiConfigPartially(existingConfig);
|
|
4836
|
+
return null;
|
|
4837
|
+
} else if (customConfigAction === "modify-all") {
|
|
4838
|
+
return await configureApiCompletely();
|
|
4839
|
+
} else if (customConfigAction === "keep-existing") {
|
|
4840
|
+
try {
|
|
4841
|
+
addCompletedOnboarding();
|
|
4842
|
+
} catch (error) {
|
|
4843
|
+
console.error(ansis.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
4844
|
+
}
|
|
4845
|
+
try {
|
|
4846
|
+
setPrimaryApiKey();
|
|
4847
|
+
} catch (error) {
|
|
4848
|
+
const { ensureI18nInitialized, i18n: i18nModule } = await Promise.resolve().then(function () { return index; });
|
|
4849
|
+
ensureI18nInitialized();
|
|
4850
|
+
console.error(i18nModule.t("mcp:primaryApiKeySetFailed"), error);
|
|
4851
|
+
}
|
|
4852
|
+
return null;
|
|
4853
|
+
}
|
|
4854
|
+
} else {
|
|
4855
|
+
const { apiChoice } = await inquirer.prompt({
|
|
4856
|
+
type: "list",
|
|
4857
|
+
name: "apiChoice",
|
|
4858
|
+
message: i18n.t("api:configureApi"),
|
|
4859
|
+
choices: [
|
|
4860
|
+
{
|
|
4861
|
+
name: `${i18n.t("api:useAuthToken")} - ${ansis.gray(i18n.t("api:authTokenDesc"))}`,
|
|
4862
|
+
value: "auth_token",
|
|
4863
|
+
short: i18n.t("api:useAuthToken")
|
|
4864
|
+
},
|
|
4865
|
+
{
|
|
4866
|
+
name: `${i18n.t("api:useApiKey")} - ${ansis.gray(i18n.t("api:apiKeyDesc"))}`,
|
|
4867
|
+
value: "api_key",
|
|
4868
|
+
short: i18n.t("api:useApiKey")
|
|
4869
|
+
}
|
|
4870
|
+
]
|
|
4871
|
+
});
|
|
4872
|
+
if (!apiChoice) {
|
|
4873
|
+
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
4874
|
+
process.exit(0);
|
|
4875
|
+
}
|
|
4876
|
+
return await configureApiCompletely(apiChoice);
|
|
4877
|
+
}
|
|
4878
|
+
}
|
|
4691
4879
|
if (!options.skipBanner) {
|
|
4692
4880
|
displayBannerWithInfo(CODE_TOOL_BANNERS[codeToolType] || "ZCF");
|
|
4693
4881
|
}
|
|
@@ -4859,94 +5047,22 @@ async function init(options = {}) {
|
|
|
4859
5047
|
}
|
|
4860
5048
|
} else {
|
|
4861
5049
|
const existingApiConfig = getExistingApiConfig();
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
` ${i18n.t("api:apiConfigKey")}: ${existingApiConfig.key ? formatApiKeyDisplay(existingApiConfig.key) : i18n.t("common:notConfigured")}`
|
|
4869
|
-
)
|
|
4870
|
-
);
|
|
4871
|
-
console.log(
|
|
4872
|
-
ansis.gray(` ${i18n.t("api:apiConfigAuthType")}: ${existingApiConfig.authType || i18n.t("common:notConfigured")}
|
|
4873
|
-
`)
|
|
4874
|
-
);
|
|
4875
|
-
const { action: apiAction } = await inquirer.prompt({
|
|
4876
|
-
type: "list",
|
|
4877
|
-
name: "action",
|
|
4878
|
-
message: i18n.t("api:selectApiAction"),
|
|
4879
|
-
choices: addNumbersToChoices([
|
|
4880
|
-
{ name: i18n.t("api:keepExistingConfig"), value: "keep" },
|
|
4881
|
-
{ name: i18n.t("api:modifyAllConfig"), value: "modify-all" },
|
|
4882
|
-
{ name: i18n.t("api:modifyPartialConfig"), value: "modify-partial" },
|
|
4883
|
-
{ name: i18n.t("api:useCcrProxy"), value: "use-ccr" },
|
|
4884
|
-
{ name: i18n.t("api:skipApi"), value: "skip" }
|
|
4885
|
-
])
|
|
4886
|
-
});
|
|
4887
|
-
if (!apiAction) {
|
|
4888
|
-
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
4889
|
-
process.exit(0);
|
|
4890
|
-
}
|
|
4891
|
-
if (apiAction === "keep" || apiAction === "skip") {
|
|
4892
|
-
apiConfig = null;
|
|
4893
|
-
if (apiAction === "keep") {
|
|
4894
|
-
try {
|
|
4895
|
-
addCompletedOnboarding();
|
|
4896
|
-
} catch (error) {
|
|
4897
|
-
console.error(ansis.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
4898
|
-
}
|
|
4899
|
-
}
|
|
4900
|
-
} else if (apiAction === "modify-partial") {
|
|
4901
|
-
await modifyApiConfigPartially(existingApiConfig);
|
|
4902
|
-
apiConfig = null;
|
|
4903
|
-
} else if (apiAction === "modify-all") {
|
|
4904
|
-
apiConfig = await configureApiCompletely();
|
|
4905
|
-
} else if (apiAction === "use-ccr") {
|
|
4906
|
-
const ccrStatus = await isCcrInstalled();
|
|
4907
|
-
if (!ccrStatus.hasCorrectPackage) {
|
|
4908
|
-
await installCcr();
|
|
4909
|
-
} else {
|
|
4910
|
-
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
|
|
4911
|
-
}
|
|
4912
|
-
const ccrConfigured = await setupCcrConfiguration();
|
|
4913
|
-
if (ccrConfigured) {
|
|
4914
|
-
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
|
|
5050
|
+
const apiMode = await selectApiConfigurationMode();
|
|
5051
|
+
switch (apiMode) {
|
|
5052
|
+
case "official": {
|
|
5053
|
+
const success = switchToOfficialLogin$1();
|
|
5054
|
+
if (success) {
|
|
5055
|
+
console.log(ansis.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
|
|
4915
5056
|
apiConfig = null;
|
|
5057
|
+
} else {
|
|
5058
|
+
console.log(ansis.red(i18n.t("api:officialLoginFailed")));
|
|
4916
5059
|
}
|
|
5060
|
+
break;
|
|
4917
5061
|
}
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
message: i18n.t("api:configureApi"),
|
|
4923
|
-
choices: [
|
|
4924
|
-
{
|
|
4925
|
-
name: `${i18n.t("api:useAuthToken")} - ${ansis.gray(i18n.t("api:authTokenDesc"))}`,
|
|
4926
|
-
value: "auth_token",
|
|
4927
|
-
short: i18n.t("api:useAuthToken")
|
|
4928
|
-
},
|
|
4929
|
-
{
|
|
4930
|
-
name: `${i18n.t("api:useApiKey")} - ${ansis.gray(i18n.t("api:apiKeyDesc"))}`,
|
|
4931
|
-
value: "api_key",
|
|
4932
|
-
short: i18n.t("api:useApiKey")
|
|
4933
|
-
},
|
|
4934
|
-
{
|
|
4935
|
-
name: `${i18n.t("api:useCcrProxy")} - ${ansis.gray(i18n.t("api:ccrProxyDesc"))}`,
|
|
4936
|
-
value: "ccr_proxy",
|
|
4937
|
-
short: i18n.t("api:useCcrProxy")
|
|
4938
|
-
},
|
|
4939
|
-
{
|
|
4940
|
-
name: i18n.t("api:skipApi"),
|
|
4941
|
-
value: "skip"
|
|
4942
|
-
}
|
|
4943
|
-
]
|
|
4944
|
-
});
|
|
4945
|
-
if (!apiChoice) {
|
|
4946
|
-
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
4947
|
-
process.exit(0);
|
|
4948
|
-
}
|
|
4949
|
-
if (apiChoice === "ccr_proxy") {
|
|
5062
|
+
case "custom":
|
|
5063
|
+
apiConfig = await handleCustomApiConfiguration(existingApiConfig);
|
|
5064
|
+
break;
|
|
5065
|
+
case "ccr": {
|
|
4950
5066
|
const ccrStatus = await isCcrInstalled();
|
|
4951
5067
|
if (!ccrStatus.hasCorrectPackage) {
|
|
4952
5068
|
await installCcr();
|
|
@@ -4958,9 +5074,14 @@ ${ansis.blue(`\u2139 ${i18n.t("api:existingApiConfig")}`)}`);
|
|
|
4958
5074
|
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
|
|
4959
5075
|
apiConfig = null;
|
|
4960
5076
|
}
|
|
4961
|
-
|
|
4962
|
-
apiConfig = await configureApiCompletely(apiChoice);
|
|
5077
|
+
break;
|
|
4963
5078
|
}
|
|
5079
|
+
case "skip":
|
|
5080
|
+
apiConfig = null;
|
|
5081
|
+
break;
|
|
5082
|
+
default:
|
|
5083
|
+
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
5084
|
+
process.exit(0);
|
|
4964
5085
|
}
|
|
4965
5086
|
}
|
|
4966
5087
|
}
|
|
@@ -5205,4 +5326,4 @@ async function openSettingsJson() {
|
|
|
5205
5326
|
}
|
|
5206
5327
|
}
|
|
5207
5328
|
|
|
5208
|
-
export {
|
|
5329
|
+
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, selectAndInstallWorkflows as aA, checkClaudeCodeVersionAndPrompt as aB, displayBannerWithInfo as aC, runCodexUninstall as aD, configureCodexMcp as aE, configureCodexApi as aF, runCodexWorkflowImport as aG, runCodexFullInit as aH, listCodexProviders as aI, getCurrentCodexProvider as aJ, switchCodexProvider as aK, switchToOfficialLogin as aL, switchToProvider as aM, readZcfConfigAsync as aN, initI18n as aO, selectScriptLanguage as aP, fsOperations as aQ, prompts as aR, codex as aS, 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, readJsonConfig as at, writeJsonConfig as au, displayBanner as av, runCodexUpdate as aw, version as ax, resolveAiOutputLanguage as ay, updatePromptOnly 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 };
|
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 { 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
|
|
249
|
+
async function handleOfficialLoginMode() {
|
|
250
250
|
ensureI18nInitialized();
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
console.log(`
|
|
254
|
-
|
|
255
|
-
console.log(ansis.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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 (
|
|
292
|
-
|
|
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
|
-
|
|
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:
|
|
480
|
-
value: "
|
|
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", "
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
772
|
-
const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
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.
|
|
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
|
-
"
|
|
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",
|
|
@@ -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 '
|
|
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/
|
|
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
|
-
"
|
|
41
|
+
"sonnet1mModelOption": "Sonnet 1M - 1M上下文版本",
|
|
42
42
|
"outputStyleInstalled": "输出风格安装成功",
|
|
43
43
|
"outputStyles.default.description": "完成编码任务时高效且提供简洁响应 (Claude Code自带)",
|
|
44
44
|
"outputStyles.default.name": "默认风格",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"invalidOutputStyle": "无效的输出样式:{style}。可用的样式:{validStyles}",
|
|
11
11
|
"invalidDefaultOutputStyle": "无效的默认输出样式:{style}。可用的样式:{validStyles}",
|
|
12
12
|
"invalidWorkflow": "无效的工作流:{workflow}。可用的工作流:{validWorkflows}",
|
|
13
|
-
"invalidModel": "无效的模型:{model}。期望的值:'opus', 'sonnet', 或 '
|
|
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/
|
|
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,
|
|
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' | '
|
|
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' | '
|
|
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,
|
|
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' | '
|
|
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' | '
|
|
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,
|
|
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