export type Environment = 'production' | 'stage' | 'development'; interface UserData { id: string; email: string; name?: string; } interface EnvironmentConfig { authUrl: string; backendUrl: string; clientId: string; } export declare const ENV_CONFIG: Record; /** * 获取当前环境 * 优先级:BI_CLI_ENV 环境变量 > token.json 的 env 字段 > 默认 production */ export declare function getCurrentEnvironment(): Environment; /** * 获取当前环境的配置信息 */ export declare function getCurrentEnvConfig(): EnvironmentConfig; /** * 保存认证令牌到 ~/.optima/token.json */ export declare function saveTokens(access_token: string, refresh_token: string, expires_in: number, env: Environment, user?: UserData): void; /** * 获取访问令牌 * 优先级:BI_CLI_TOKEN > OPTIMA_TOKEN > ~/.optima/token.json */ export declare function getAccessToken(): string | null; /** * 获取 refresh token */ export declare function getRefreshToken(): string | null; /** * 获取 token 过期时间 */ export declare function getTokenExpiresAt(): number | null; /** * 检查 token 是否过期 */ export declare function isTokenExpired(): boolean; /** * 检查是否已认证 */ export declare function isAuthenticated(): boolean; /** * 保存用户信息到 token.json */ export declare function saveUser(user: UserData): void; /** * 获取当前用户信息 */ export declare function getUser(): UserData | null; /** * 清除配置(登出)- 删除 token.json */ export declare function clearAuth(): void; /** * 获取配置文件路径 */ export declare function getConfigPath(): string; /** * 获取 BI API URL * 优先级:BI_CLI_BACKEND_URL 环境变量 > 当前环境配置 */ export declare function getBackendUrl(): string; /** * 获取 Auth API URL * 优先级:BI_CLI_AUTH_URL 环境变量 > 当前环境配置 */ export declare function getAuthUrl(): string; export interface CliConfig { environment: Environment; authUrl: string; backendUrl: string; accessToken?: string; refreshToken?: string; } /** * Get CLI configuration (兼容旧接口) */ export declare function getConfig(): CliConfig; /** * Set config (兼容旧接口 - 现在只支持保存 token) */ export declare function setConfig(key: keyof CliConfig, value: string): void; export {}; //# sourceMappingURL=index.d.ts.map