/** * Setup State Manager * * Manages persistent state for multi-repository setup with atomic operations. * Enables Ctrl+C recovery by saving progress incrementally. * * Features: * - Atomic file writes (temp → rename) * - Automatic backups before updates * - State validation and corruption recovery * - Resume detection for interrupted setups * - Secure permissions (0600) * * @module setup-state-manager */ /** * Repository architecture types * v0581: 'single' removed; 'parent' deprecated - kept for backward compatibility with old state files */ export type SetupArchitecture = 'multi-repo' | 'parent' | 'monorepo'; /** * Repository configuration */ export interface RepoConfig { id: string; displayName: string; owner: string; repo: string; visibility: 'private' | 'public'; created?: boolean; cloned?: boolean; path?: string; url?: string; } /** * Parent repository configuration * @deprecated v1.0.13 - Parent repo concept removed. Kept for backward compatibility with old state files. */ export interface ParentRepoConfig { name: string; owner: string; description: string; visibility: 'private' | 'public'; createOnGitHub: boolean; url?: string; } /** * Setup state structure * v1.0.13: parentRepo is deprecated but kept for backward compatibility */ export interface SetupState { version: string; architecture: SetupArchitecture; /** @deprecated v1.0.13 - Parent repo concept removed */ parentRepo?: ParentRepoConfig; repos: RepoConfig[]; currentStep: string; timestamp: string; envCreated: boolean; monorepoProjects?: string[]; } /** * Setup State Manager * * Handles atomic state persistence with backup/restore for Ctrl+C recovery. */ export declare class SetupStateManager { private projectRoot; private paths; constructor(projectRoot: string); /** * Save state atomically with backup * * Process: * 1. Create backup of existing state (if exists) * 2. Write to temp file * 3. Set permissions to 0600 * 4. Atomic rename temp → state * 5. On error, restore from backup * * @param state - State to save */ saveState(state: SetupState): Promise; /** * Load state with validation and corruption recovery * * Process: * 1. Try to load main state file * 2. Validate schema * 3. On corruption, try backup * 4. Return null if no valid state * * @returns Loaded state or null if not found/invalid */ loadState(): Promise; /** * Detect incomplete setup and prompt for resume * * @returns Setup state if incomplete, null otherwise */ detectAndResumeSetup(): Promise; /** * Delete state files (on successful completion) */ deleteState(): Promise; private validateState; private validateParentRepo; private validateRepo; /** * Get state file path (for testing) */ getStatePath(): string; /** * Get backup file path (for testing) */ getBackupPath(): string; } //# sourceMappingURL=setup-state-manager.d.ts.map