UNPKG

ccgo

Version:

Simple Claude Code launcher with config management and environment variable injection

118 lines 2.64 kB
/** * 配置管理器 * 负责读取、保存、验证 API 配置信息 */ /** * API 配置接口 */ export interface ApiConfig { apiKey: string; baseUrl: string; model?: string; smallFastModel?: string; configuredAt?: string; version?: string; } /** * 配置项(包含名称) */ export interface ProfileConfig extends ApiConfig { name: string; } /** * 完整配置结构 */ export interface FullConfig { profiles?: Record<string, ApiConfig>; } /** * 配置管理器类 */ export declare class ConfigManager { private config; constructor(); /** * 迁移旧版本的单配置到新的多配置结构 */ private migrateOldConfig; /** * 检查是否有任何配置 */ hasAnyProfile(): boolean; /** * 检查是否已配置 API Key(向后兼容) */ hasApiKey(): boolean; /** * 获取所有配置名称 */ getProfileNames(): string[]; /** * 获取配置数量 */ getProfileCount(): number; /** * 检查配置是否存在 */ hasProfile(name: string): boolean; /** * 获取指定配置 */ getProfile(name: string): ApiConfig | undefined; /** * 获取当前激活的配置(仅当只有一个配置时返回) */ getCurrentProfile(): { name: string; config: ApiConfig; } | undefined; /** * 获取 API Key(向后兼容) */ getApiKey(): string | undefined; /** * 获取 Base URL(向后兼容) */ getBaseUrl(): string | undefined; /** * 获取模型名称(可选) */ getModel(): string | undefined; /** * 获取小快速模型(可选) */ getSmallFastModel(): string | undefined; /** * 添加或更新配置 */ saveProfile(name: string, config: Omit<ApiConfig, 'configuredAt' | 'version'>): void; /** * 删除配置 */ removeProfile(name: string): void; /** * 保存 API 配置(向后兼容,保存为 default) */ saveApiConfig(config: Omit<ApiConfig, 'configuredAt' | 'version'>, name?: string): void; /** * 获取所有配置(含配置名称) */ getAllProfiles(): ProfileConfig[]; /** * 重置所有配置 */ reset(): void; /** * 获取所有配置 */ getAll(): FullConfig; /** * 获取配置文件路径 */ getConfigPath(): string; /** * 获取安全的配置信息(隐藏 API Key) */ getSafeApiConfig(name?: string): ApiConfig | undefined; } //# sourceMappingURL=manager.d.ts.map