zcf 1.1.5 → 1.1.6
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 +1 -1
- package/dist/index.d.mts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.mjs +1 -1
- package/dist/shared/{zcf.CeJug3gT.mjs → zcf.Dke_fzoC.mjs} +28 -10
- package/package.json +1 -1
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 { u as displayBanner, v as selectScriptLanguage, x as readZcfConfig, I as I18N, S as SETTINGS_FILE, d as SUPPORTED_LANGS, L as LANG_LABELS, y as resolveAiOutputLanguage, z as updatePromptOnly, B as updateZcfConfig, D as version, i as init } from './shared/zcf.Dke_fzoC.mjs';
|
|
5
5
|
import prompts from '@posva/prompts';
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
7
|
import 'node:os';
|
package/dist/index.d.mts
CHANGED
|
@@ -23,14 +23,15 @@ interface McpServerConfig {
|
|
|
23
23
|
url?: string;
|
|
24
24
|
env?: Record<string, string>;
|
|
25
25
|
}
|
|
26
|
-
interface
|
|
26
|
+
interface ClaudeConfiguration {
|
|
27
27
|
mcpServers: Record<string, McpServerConfig>;
|
|
28
|
+
hasCompletedOnboarding?: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
declare const CLAUDE_DIR: string;
|
|
31
32
|
declare const SETTINGS_FILE: string;
|
|
32
33
|
declare const CLAUDE_MD_FILE: string;
|
|
33
|
-
declare const
|
|
34
|
+
declare const ClAUDE_CONFIG_FILE: string;
|
|
34
35
|
declare const ZCF_CONFIG_FILE: string;
|
|
35
36
|
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en"];
|
|
36
37
|
type SupportedLang = (typeof SUPPORTED_LANGS)[number];
|
|
@@ -206,11 +207,12 @@ declare function mergeConfigs(sourceFile: string, targetFile: string): void;
|
|
|
206
207
|
declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
|
|
207
208
|
|
|
208
209
|
declare function getMcpConfigPath(): string;
|
|
209
|
-
declare function readMcpConfig():
|
|
210
|
-
declare function writeMcpConfig(config:
|
|
210
|
+
declare function readMcpConfig(): ClaudeConfiguration | null;
|
|
211
|
+
declare function writeMcpConfig(config: ClaudeConfiguration): void;
|
|
211
212
|
declare function backupMcpConfig(): string | null;
|
|
212
|
-
declare function mergeMcpServers(existing:
|
|
213
|
+
declare function mergeMcpServers(existing: ClaudeConfiguration | null, newServers: Record<string, McpServerConfig>): ClaudeConfiguration;
|
|
213
214
|
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string): McpServerConfig;
|
|
215
|
+
declare function addCompletedOnboarding(): void;
|
|
214
216
|
|
|
215
|
-
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, I18N, LANG_LABELS,
|
|
216
|
-
export type { AiOutputLanguage, ApiConfig,
|
|
217
|
+
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, getMcpConfigPath, getPlatform, init, installClaudeCode, isClaudeCodeInstalled, mergeConfigs, mergeMcpServers, readMcpConfig, writeMcpConfig };
|
|
218
|
+
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,14 +23,15 @@ interface McpServerConfig {
|
|
|
23
23
|
url?: string;
|
|
24
24
|
env?: Record<string, string>;
|
|
25
25
|
}
|
|
26
|
-
interface
|
|
26
|
+
interface ClaudeConfiguration {
|
|
27
27
|
mcpServers: Record<string, McpServerConfig>;
|
|
28
|
+
hasCompletedOnboarding?: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
declare const CLAUDE_DIR: string;
|
|
31
32
|
declare const SETTINGS_FILE: string;
|
|
32
33
|
declare const CLAUDE_MD_FILE: string;
|
|
33
|
-
declare const
|
|
34
|
+
declare const ClAUDE_CONFIG_FILE: string;
|
|
34
35
|
declare const ZCF_CONFIG_FILE: string;
|
|
35
36
|
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en"];
|
|
36
37
|
type SupportedLang = (typeof SUPPORTED_LANGS)[number];
|
|
@@ -206,11 +207,12 @@ declare function mergeConfigs(sourceFile: string, targetFile: string): void;
|
|
|
206
207
|
declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
|
|
207
208
|
|
|
208
209
|
declare function getMcpConfigPath(): string;
|
|
209
|
-
declare function readMcpConfig():
|
|
210
|
-
declare function writeMcpConfig(config:
|
|
210
|
+
declare function readMcpConfig(): ClaudeConfiguration | null;
|
|
211
|
+
declare function writeMcpConfig(config: ClaudeConfiguration): void;
|
|
211
212
|
declare function backupMcpConfig(): string | null;
|
|
212
|
-
declare function mergeMcpServers(existing:
|
|
213
|
+
declare function mergeMcpServers(existing: ClaudeConfiguration | null, newServers: Record<string, McpServerConfig>): ClaudeConfiguration;
|
|
213
214
|
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string): McpServerConfig;
|
|
215
|
+
declare function addCompletedOnboarding(): void;
|
|
214
216
|
|
|
215
|
-
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, I18N, LANG_LABELS,
|
|
216
|
-
export type { AiOutputLanguage, ApiConfig,
|
|
217
|
+
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, getMcpConfigPath, getPlatform, init, installClaudeCode, isClaudeCodeInstalled, mergeConfigs, mergeMcpServers, readMcpConfig, writeMcpConfig };
|
|
218
|
+
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, a as CLAUDE_MD_FILE, I as I18N, L as LANG_LABELS, M as
|
|
1
|
+
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, a as CLAUDE_MD_FILE, b as ClAUDE_CONFIG_FILE, I as I18N, L as LANG_LABELS, M as MCP_SERVICES, S as SETTINGS_FILE, d as SUPPORTED_LANGS, Z as ZCF_CONFIG_FILE, t as addCompletedOnboarding, n as applyAiLanguageDirective, j as backupExistingConfig, p as backupMcpConfig, s as buildMcpServerConfig, c as commandExists, l as configureApi, k as copyConfigFiles, h as ensureClaudeDir, o as getMcpConfigPath, g as getPlatform, i as init, f as installClaudeCode, e as isClaudeCodeInstalled, m as mergeConfigs, q as mergeMcpServers, r as readMcpConfig, w as writeMcpConfig } from './shared/zcf.Dke_fzoC.mjs';
|
|
2
2
|
import '@posva/prompts';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'node:fs';
|
|
@@ -6,12 +6,12 @@ import { join, dirname } from 'pathe';
|
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import { exec } from 'tinyexec';
|
|
8
8
|
|
|
9
|
-
const version = "1.1.
|
|
9
|
+
const version = "1.1.6";
|
|
10
10
|
|
|
11
11
|
const CLAUDE_DIR = join(homedir(), ".claude");
|
|
12
12
|
const SETTINGS_FILE = join(CLAUDE_DIR, "settings.json");
|
|
13
13
|
const CLAUDE_MD_FILE = join(CLAUDE_DIR, "CLAUDE.md");
|
|
14
|
-
const
|
|
14
|
+
const ClAUDE_CONFIG_FILE = join(homedir(), ".claude.json");
|
|
15
15
|
const ZCF_CONFIG_FILE = join(homedir(), ".zcf.json");
|
|
16
16
|
const SUPPORTED_LANGS = ["zh-CN", "en"];
|
|
17
17
|
const LANG_LABELS = {
|
|
@@ -444,14 +444,14 @@ async function installClaudeCode(lang) {
|
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
function getMcpConfigPath() {
|
|
447
|
-
return
|
|
447
|
+
return ClAUDE_CONFIG_FILE;
|
|
448
448
|
}
|
|
449
449
|
function readMcpConfig() {
|
|
450
|
-
if (!existsSync(
|
|
450
|
+
if (!existsSync(ClAUDE_CONFIG_FILE)) {
|
|
451
451
|
return null;
|
|
452
452
|
}
|
|
453
453
|
try {
|
|
454
|
-
const content = readFileSync(
|
|
454
|
+
const content = readFileSync(ClAUDE_CONFIG_FILE, "utf-8");
|
|
455
455
|
return JSON.parse(content);
|
|
456
456
|
} catch (error) {
|
|
457
457
|
console.error("Failed to parse MCP config:", error);
|
|
@@ -459,14 +459,14 @@ function readMcpConfig() {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
function writeMcpConfig(config) {
|
|
462
|
-
const dir = dirname(
|
|
462
|
+
const dir = dirname(ClAUDE_CONFIG_FILE);
|
|
463
463
|
if (!existsSync(dir)) {
|
|
464
464
|
mkdirSync(dir, { recursive: true });
|
|
465
465
|
}
|
|
466
|
-
writeFileSync(
|
|
466
|
+
writeFileSync(ClAUDE_CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
467
467
|
}
|
|
468
468
|
function backupMcpConfig() {
|
|
469
|
-
if (!existsSync(
|
|
469
|
+
if (!existsSync(ClAUDE_CONFIG_FILE)) {
|
|
470
470
|
return null;
|
|
471
471
|
}
|
|
472
472
|
const timestamp = dayjs().format("YYYY-MM-DD_HH-mm-ss");
|
|
@@ -476,7 +476,7 @@ function backupMcpConfig() {
|
|
|
476
476
|
if (!existsSync(backupBaseDir)) {
|
|
477
477
|
mkdirSync(backupBaseDir, { recursive: true });
|
|
478
478
|
}
|
|
479
|
-
const content = readFileSync(
|
|
479
|
+
const content = readFileSync(ClAUDE_CONFIG_FILE, "utf-8");
|
|
480
480
|
writeFileSync(backupPath, content);
|
|
481
481
|
return backupPath;
|
|
482
482
|
} catch (error) {
|
|
@@ -505,6 +505,19 @@ function buildMcpServerConfig(baseConfig, apiKey, placeholder = "YOUR_EXA_API_KE
|
|
|
505
505
|
}
|
|
506
506
|
return config;
|
|
507
507
|
}
|
|
508
|
+
function addCompletedOnboarding() {
|
|
509
|
+
try {
|
|
510
|
+
let config = readMcpConfig();
|
|
511
|
+
if (!config) {
|
|
512
|
+
config = { mcpServers: {} };
|
|
513
|
+
}
|
|
514
|
+
config.hasCompletedOnboarding = true;
|
|
515
|
+
writeMcpConfig(config);
|
|
516
|
+
} catch (error) {
|
|
517
|
+
console.error("Failed to add hasCompletedOnboarding flag:", error);
|
|
518
|
+
throw error;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
508
521
|
|
|
509
522
|
function readZcfConfig() {
|
|
510
523
|
try {
|
|
@@ -838,6 +851,11 @@ async function init(options = {}) {
|
|
|
838
851
|
console.log(ansis.green(`\u2714 ${i18n.apiConfigSuccess}`));
|
|
839
852
|
console.log(ansis.gray(` URL: ${configuredApi.url}`));
|
|
840
853
|
console.log(ansis.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
|
|
854
|
+
try {
|
|
855
|
+
addCompletedOnboarding();
|
|
856
|
+
} catch (error) {
|
|
857
|
+
console.error(ansis.red("Failed to set onboarding completion flag:"), error);
|
|
858
|
+
}
|
|
841
859
|
}
|
|
842
860
|
}
|
|
843
861
|
if (!onlyUpdateDocs) {
|
|
@@ -933,4 +951,4 @@ async function init(options = {}) {
|
|
|
933
951
|
}
|
|
934
952
|
}
|
|
935
953
|
|
|
936
|
-
export { AI_OUTPUT_LANGUAGES as A,
|
|
954
|
+
export { AI_OUTPUT_LANGUAGES as A, updateZcfConfig as B, CLAUDE_DIR as C, version as D, I18N as I, LANG_LABELS as L, MCP_SERVICES as M, SETTINGS_FILE as S, ZCF_CONFIG_FILE as Z, CLAUDE_MD_FILE as a, ClAUDE_CONFIG_FILE as b, commandExists as c, SUPPORTED_LANGS as d, isClaudeCodeInstalled as e, installClaudeCode as f, getPlatform as g, ensureClaudeDir as h, init as i, backupExistingConfig as j, copyConfigFiles as k, configureApi as l, mergeConfigs as m, applyAiLanguageDirective as n, getMcpConfigPath as o, backupMcpConfig as p, mergeMcpServers as q, readMcpConfig as r, buildMcpServerConfig as s, addCompletedOnboarding as t, displayBanner as u, selectScriptLanguage as v, writeMcpConfig as w, readZcfConfig as x, resolveAiOutputLanguage as y, updatePromptOnly as z };
|
package/package.json
CHANGED