/** * CLI Configuration Types * * Defines interfaces for global, project, and resolved configuration * used throughout the CLI application. */ /** * Output format options for CLI commands */ export type OutputFormat = 'json' | 'toon'; /** * Source tracking for configuration values * Used for diagnostics and debugging (e.g., `specforge doctor`) */ export type ConfigSource = 'env' | 'global' | 'project' | 'default' | null; /** * Global configuration stored in ~/.specforge/config.json * * This file contains user-level settings that apply across all projects. * The API key is stored here for security (not in project files). * * @example * ```json * { * "apiKey": "sf_live_abc123...", * "format": "toon", * "defaultProjectId": "proj_xyz" * } * ``` */ export interface GlobalConfig { /** API key for SpecForge authentication (format: sf_live_*) */ apiKey?: string; /** Default output format for CLI commands */ format?: OutputFormat; /** Default project ID when not in a project directory */ defaultProjectId?: string; } /** * Project configuration stored in .specforge.json * * This file is created in the project root when running `specforge init`. * It links the local directory to a SpecForge project and specification. * * @example * ```json * { * "projectId": "proj_abc123", * "specificationId": "spec_xyz789", * "format": "json", * "autoSetContext": true * } * ``` */ export interface ProjectConfig { /** SpecForge project ID this directory is linked to */ projectId?: string; /** Active specification ID for this project */ specificationId?: string; /** Output format override for this project */ format?: OutputFormat; /** Automatically set working context when CLI runs */ autoSetContext?: boolean; } /** * Resolved configuration merged from all sources * * This is the final configuration used by CLI commands after merging: * - Environment variables (highest priority) * - Project config (.specforge.json) * - Global config (~/.specforge/config.json) * - Default values (lowest priority) */ export interface ResolvedConfig { /** API key for authentication (null if not authenticated) */ apiKey: string | null; /** API endpoint URL */ apiUrl: string; /** Output format for CLI commands */ format: OutputFormat; /** Current project ID (null if not in project context) */ projectId: string | null; /** Current specification ID (null if not set) */ specificationId: string | null; /** Whether to auto-set working context */ autoSetContext: boolean; /** Debug mode enabled */ debug: boolean; /** * Source tracking for each config value * Useful for diagnostics and understanding where values come from */ sources: ConfigSources; } /** * Tracks the source of each resolved configuration value */ export interface ConfigSources { /** Where the API key was loaded from */ apiKey: 'env' | 'global' | null; /** Where the project ID was loaded from */ projectId: 'env' | 'project' | 'global' | null; /** Where the specification ID was loaded from */ specificationId: 'project' | null; /** Where the format setting was loaded from */ format: 'env' | 'project' | 'global' | 'default'; } /** * Configuration file paths used by the CLI */ export interface ConfigPaths { /** Global config directory (~/.specforge/) */ globalDir: string; /** Global config file (~/.specforge/config.json) */ globalConfig: string; /** Project config file (./.specforge.json) */ projectConfig: string; /** MCP config file for Claude Code (./.mcp.json) */ mcpConfig: string; } /** * Default configuration values */ export declare const CONFIG_DEFAULTS: { readonly apiUrl: "https://mcp.specforge.com.br/mcp"; readonly format: OutputFormat; readonly autoSetContext: true; readonly debug: false; }; /** * Environment variable names for configuration */ export declare const CONFIG_ENV_VARS: { readonly API_KEY: "SPECFORGE_API_KEY"; readonly API_URL: "SPECFORGE_API_URL"; readonly FORMAT: "SPECFORGE_FORMAT"; readonly DEBUG: "SPECFORGE_DEBUG"; }; /** * Configuration file names */ export declare const CONFIG_FILES: { readonly GLOBAL_DIR: ".specforge"; readonly GLOBAL_CONFIG: "config.json"; readonly PROJECT_CONFIG: ".specforge.json"; readonly MCP_CONFIG: ".mcp.json"; }; //# sourceMappingURL=types.d.ts.map