UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

129 lines 3.51 kB
/** * User-Level Configuration Manager * * Manages the ~/.aiwg/ (or ~/.config/aiwg/) user configuration directory. * Provides get/set/list/validate/reset/path operations for all config files. * * Resolution order: * 1. AIWG_CONFIG env var (explicit override) * 2. --config-dir CLI flag (explicit override) * 3. ~/.aiwg (primary — simple, discoverable) * 4. ~/.config/aiwg (fallback — XDG-compliant) * * New config files are created in whichever path already exists, * defaulting to ~/.aiwg if neither exists. * * @implements #545 */ /** * Top-level user preferences schema */ export interface UserConfigData { apiVersion: string; kind: string; defaults: { provider?: string; verbosity?: 'normal' | 'quiet' | 'verbose'; opsHome?: string; }; telemetry: { enabled: boolean; }; updates: { channel?: 'stable' | 'next' | 'nightly'; checkOnStartup?: boolean; }; } /** * Config file metadata for the subsystem registration pattern */ export interface ConfigFileSpec { filename: string; description: string; schema?: string; } /** * Known config files in the user config directory */ export declare const KNOWN_CONFIG_FILES: ConfigFileSpec[]; /** * Default user config values */ export declare const DEFAULT_USER_CONFIG: UserConfigData; /** * Resolve the active user config directory * * Resolution order: * 1. Explicit override (AIWG_CONFIG env or --config-dir) * 2. ~/.aiwg (primary) * 3. ~/.config/aiwg (fallback) * 4. ~/.aiwg (default if neither exists) */ export declare function resolveConfigDir(overridePath?: string): string; /** * User-level configuration manager */ export declare class UserConfig { private readonly configDir; private configCache; constructor(overridePath?: string); /** * Get the resolved config directory path */ getPath(): string; /** * Ensure the config directory exists */ ensureDir(): Promise<void>; /** * Get a config value by dot-notation key * * Supports keys like: * - "defaults.provider" * - "telemetry.enabled" * - "updates.channel" */ get(key: string): Promise<unknown>; /** * Set a config value by dot-notation key */ set(key: string, value: string): Promise<void>; /** * List all config values (merged view across all files) */ list(): Promise<Record<string, unknown>>; /** * Validate all config files * * Returns array of validation issues (empty = all valid) */ validate(): Promise<ValidationIssue[]>; /** * Reset a key to its default value, or reset all config */ reset(key?: string): Promise<void>; /** * Load config.yaml, creating defaults if it doesn't exist */ private loadConfig; /** * Save config.yaml */ private saveConfig; } export interface ValidationIssue { file: string; severity: 'error' | 'warning' | 'info'; message: string; } /** * Minimal YAML parser for flat/nested config files. * Handles the subset we use: scalars, nested objects (2 levels). * For complex YAML, users should use a full parser. */ export declare function parseYamlSimple(content: string): Record<string, unknown>; /** * Minimal YAML serializer for our config format */ export declare function serializeYamlSimple(obj: Record<string, unknown>, indent?: number): string; //# sourceMappingURL=user-config.d.ts.map