/** * XDG Configuration Management (v0.7.0 - BREAKING CHANGE) * * Filesystem implementation of XDGBase for XDG-compliant configuration management. * * This module provides filesystem-specific storage primitives for the Benchling Webhook system: * - Filesystem-based profile storage in ~/.config/benchling-webhook/ * - Per-profile deployment tracking * - Legacy configuration detection * - Atomic writes with automatic backups * * All business logic (validation, inheritance, deployment tracking) is handled by XDGBase. * * Directory Structure: * ``` * ~/.config/benchling-webhook/ * ├── default/ * │ ├── config.json # Profile configuration * │ └── deployments.json # Deployment history * └── dev/ * ├── config.json * └── deployments.json * ``` * * @module xdg-config * @version 0.7.0 */ import { ProfileConfig, DeploymentHistory } from "./types/config"; import { XDGBase } from "./xdg-base"; /** * XDG Configuration Manager * * Filesystem-based implementation extending XDGBase. * Manages profile-based configuration with deployment tracking. * NO backward compatibility with v0.6.x configuration files. * * @example * ```typescript * const xdg = new XDGConfig(); * * // Read profile configuration * const config = xdg.readProfile("default"); * * // Write profile configuration * xdg.writeProfile("default", config); * * // Record deployment * xdg.recordDeployment("default", { * stage: "prod", * timestamp: new Date().toISOString(), * imageTag: "0.7.0", * endpoint: "https://...", * stackName: "BenchlingWebhookStack", * region: "us-east-1" * }); * ``` */ export declare class XDGConfig extends XDGBase { private readonly baseDir; /** * Creates a new XDG Configuration Manager * * @param baseDir - Base configuration directory (defaults to ~/.config/benchling-webhook) */ constructor(baseDir?: string); /** * Reads raw profile configuration from filesystem without validation * * @param profile - Profile name * @returns Raw profile configuration * @throws {Error} If profile cannot be read */ protected readProfileRaw(profile: string): ProfileConfig; /** * Writes raw profile configuration to filesystem without validation * * Creates the profile directory if it doesn't exist. * Performs atomic write with automatic backup. * * @param profile - Profile name * @param config - Configuration to write * @throws {Error} If write fails */ protected writeProfileRaw(profile: string, config: ProfileConfig): void; /** * Deletes profile and all associated data from filesystem * * @param profile - Profile name * @throws {Error} If deletion fails */ protected deleteProfileRaw(profile: string): void; /** * Lists all profile names from filesystem * * @returns Array of profile names */ protected listProfilesRaw(): string[]; /** * Checks if profile exists on filesystem * * @param profile - Profile name * @returns True if profile exists */ protected profileExistsRaw(profile: string): boolean; /** * Reads raw deployment history from filesystem without validation * * @param profile - Profile name * @returns Deployment history or null if none exists * @throws {Error} If read fails */ protected readDeploymentsRaw(profile: string): DeploymentHistory | null; /** * Writes raw deployment history to filesystem without validation * * @param profile - Profile name * @param history - Deployment history to write * @throws {Error} If write fails */ protected writeDeploymentsRaw(profile: string, history: DeploymentHistory): void; /** * Gets the default XDG base directory * * Respects XDG_CONFIG_HOME environment variable per XDG Base Directory spec. * * @returns The default base directory path (~/.config/benchling-webhook or $XDG_CONFIG_HOME/benchling-webhook) */ private getDefaultBaseDir; /** * Ensures the base configuration directory exists * * @throws {Error} If directory creation fails */ private ensureBaseDirectoryExists; /** * Gets the directory path for a profile * * @param profile - Profile name * @returns Absolute path to profile directory */ private getProfilePath; /** * Gets the config.json path for a profile * * @param profile - Profile name * @returns Absolute path to config.json */ private getProfileConfigPath; /** * Gets the deployments.json path for a profile * * @param profile - Profile name * @returns Absolute path to deployments.json */ private getDeploymentsPath; /** * Detects legacy v0.6.x configuration files * * @returns True if legacy files are detected */ detectLegacyConfiguration(): boolean; /** * Builds a helpful error message when a profile is not found * * Overrides base class to add legacy configuration detection. * * @param profile - Profile name that was not found * @returns Formatted error message */ protected buildProfileNotFoundError(profile: string): string; } //# sourceMappingURL=xdg-config.d.ts.map