zcf
Version:
Zero-Config Claude-Code Flow - One-click configuration tool for Claude Code
171 lines (159 loc) • 6.56 kB
TypeScript
type SupportedLang$1 = 'zh-CN' | 'en';
interface TranslationStructure {
common: any;
language: any;
installation: any;
api: any;
bmad: any;
workflow: any;
configuration: any;
mcp: any;
menu: any;
cli: any;
errors: any;
tools: any;
ccr: any;
cometix: any;
updater: any;
}
interface McpService {
id: string;
name: {
'en': string;
'zh-CN': string;
};
description: {
'en': string;
'zh-CN': string;
};
requiresApiKey: boolean;
apiKeyPrompt?: {
'en': string;
'zh-CN': string;
};
apiKeyPlaceholder?: string;
apiKeyEnvVar?: string;
config: McpServerConfig;
}
interface McpServerConfig {
type: 'stdio' | 'sse';
command?: string;
args?: string[];
url?: string;
env?: Record<string, string>;
}
interface ClaudeConfiguration {
mcpServers: Record<string, McpServerConfig>;
hasCompletedOnboarding?: boolean;
}
declare const CLAUDE_DIR: string;
declare const SETTINGS_FILE: string;
declare const CLAUDE_MD_FILE: string;
declare const ClAUDE_CONFIG_FILE: string;
declare const LEGACY_ZCF_CONFIG_FILE: string;
declare const ZCF_CONFIG_FILE: string;
declare const SUPPORTED_LANGS: readonly ["zh-CN", "en"];
type SupportedLang = (typeof SUPPORTED_LANGS)[number];
declare const LANG_LABELS: {
readonly 'zh-CN': "简体中文";
readonly en: "English";
};
declare const AI_OUTPUT_LANGUAGES: {
readonly 'zh-CN': {
readonly label: "简体中文";
readonly directive: "Always respond in Chinese-simplified";
};
readonly en: {
readonly label: "English";
readonly directive: "Always respond in English";
};
readonly custom: {
readonly label: "Custom";
readonly directive: "";
};
};
type AiOutputLanguage = keyof typeof AI_OUTPUT_LANGUAGES;
declare const I18N: Record<SupportedLang$1, TranslationStructure>;
declare const MCP_SERVICES: McpService[];
interface InitOptions {
lang?: SupportedLang;
configLang?: SupportedLang;
aiOutputLang?: AiOutputLanguage | string;
force?: boolean;
skipBanner?: boolean;
skipPrompt?: boolean;
configAction?: 'new' | 'backup' | 'merge' | 'docs-only' | 'skip';
apiType?: 'auth_token' | 'api_key' | 'ccr_proxy' | 'skip';
apiKey?: string;
apiUrl?: string;
mcpServices?: string[] | string | boolean;
workflows?: string[] | string | boolean;
aiPersonality?: string;
allLang?: string;
installCometixLine?: string | boolean;
}
declare function init(options?: InitOptions): Promise<void>;
/**
* API configuration for Claude Code
*/
interface ApiConfig {
url: string;
key: string;
authType?: 'auth_token' | 'api_key';
}
declare function ensureClaudeDir(): void;
declare function backupExistingConfig(): string | null;
declare function copyConfigFiles(lang: SupportedLang, onlyMd?: boolean): void;
declare function configureApi(apiConfig: ApiConfig | null): ApiConfig | null;
declare function mergeConfigs(sourceFile: string, targetFile: string): void;
declare function updateDefaultModel(model: 'opus' | 'sonnet' | 'opusplan' | 'default'): void;
/**
* Merge settings.json intelligently
* Preserves user's environment variables and custom configurations
*/
declare function mergeSettingsFile(templatePath: string, targetPath: string): void;
/**
* Get existing model configuration from settings.json
*/
declare function getExistingModelConfig(): 'opus' | 'sonnet' | 'opusplan' | 'default' | null;
/**
* Get existing API configuration from settings.json
*/
declare function getExistingApiConfig(): ApiConfig | null;
declare function applyAiLanguageDirective(aiOutputLang: AiOutputLanguage | string): void;
declare function isClaudeCodeInstalled(): Promise<boolean>;
declare function installClaudeCode(lang: SupportedLang): Promise<void>;
declare function getMcpConfigPath(): string;
declare function readMcpConfig(): ClaudeConfiguration | null;
declare function writeMcpConfig(config: ClaudeConfiguration): void;
declare function backupMcpConfig(): string | null;
declare function mergeMcpServers(existing: ClaudeConfiguration | null, newServers: Record<string, McpServerConfig>): ClaudeConfiguration;
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string, envVarName?: string): McpServerConfig;
declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
declare function addCompletedOnboarding(): void;
/**
* Clean up and deduplicate permissions array
* Removes invalid and redundant permissions based on template
*/
/**
* Clean up permissions array by removing invalid and redundant entries
* @param templatePermissions - Permissions from template (source of truth)
* @param userPermissions - User's existing permissions
* @returns Cleaned permissions array
*/
declare function cleanupPermissions(templatePermissions: string[], userPermissions: string[]): string[];
/**
* Merge and clean permissions arrays
* Combines template and user permissions while removing invalid/redundant entries
* @param templatePermissions - Permissions from template
* @param userPermissions - User's existing permissions
* @returns Merged and cleaned permissions array
*/
declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
declare function getPlatform(): "windows" | "macos" | "linux";
declare function commandExists(command: string): Promise<boolean>;
declare function importRecommendedEnv(): Promise<void>;
declare function importRecommendedPermissions(): Promise<void>;
declare function openSettingsJson(): Promise<void>;
export { AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, I18N, LANG_LABELS, LEGACY_ZCF_CONFIG_FILE, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_FILE, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getExistingModelConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };