/** * @fileoverview Skill Activation Manager for one-click skill installation * @module @skillsmith/core/activation/ActivationManager * @see Phase 4: Trigger System Architecture - One-Click Activation * * Provides infrastructure for: * - Pre-validation before activation * - Background skill prefetching * - Hot-reload activation (no restart) * - Undo/rollback capability * * @example * const manager = new ActivationManager(); * const result = await manager.activateSkill({ * skill_id: 'anthropic/commit', * validate_first: true, * hot_reload: true * }); */ /** * Options for skill activation */ export interface ActivationOptions { /** Skill ID to activate */ skill_id: string; /** Validate skill before activating (default: true) */ validate_first?: boolean; /** Enable hot-reload without restart (default: true) */ hot_reload?: boolean; /** Auto-configure with defaults (default: false) */ auto_configure?: boolean; /** Force reinstall even if already installed */ force?: boolean; } /** * Result of skill activation */ export interface ActivationResult { /** Whether activation succeeded */ success: boolean; /** Skill ID that was activated */ skill_id: string; /** Time taken to activate (ms) */ activation_time_ms: number; /** Whether Claude restart is required */ requires_restart: boolean; /** Undo token for rollback (if successful) */ undo_token?: string; /** Error message (if failed) */ error?: string; /** Installation path */ install_path?: string; } /** * Undo snapshot for rollback */ interface UndoSnapshot { /** Unique undo token */ token: string; /** Skill ID */ skill_id: string; /** Installation path */ install_path: string; /** Timestamp of activation */ activated_at: string; /** Previous state (null if new installation) */ previous_state: { existed: boolean; backup_path?: string; }; } /** * ActivationManager - Manages skill installation and activation * * Provides one-click skill activation with validation, prefetching, * hot-reload, and rollback capabilities. */ export declare class ActivationManager { private readonly skillsDir; private readonly undoSnapshots; private readonly prefetchCache; constructor(skillsDir?: string); /** * Activate a skill with optional validation and hot-reload * * @param options - Activation options * @returns Activation result */ activateSkill(options: ActivationOptions): Promise; /** * Undo a previous activation using undo token * * @param undoToken - Undo token from activation * @returns Whether undo succeeded */ undo(undoToken: string): Promise; /** * Check if a skill is already installed */ private isInstalled; /** * Get installation path for a skill */ private getInstallPath; /** * Validate skill before activation */ private validateSkill; /** * Prefetch skill metadata and files */ private prefetchSkill; /** * Install skill to filesystem */ private installSkill; /** * Create backup of existing installation */ private createBackup; /** * Hot-reload skill without restarting Claude * * @returns Whether hot-reload succeeded */ private hotReload; /** * Create undo snapshot for rollback * * @param skillId - Skill identifier (author/name) * @param installPath - Absolute install path * @param previouslyInstalled - Whether a prior install existed at installPath * @param backupPath - Path to the pre-reinstall backup directory, if one was * created by `createBackup`. When present, `undo()` will restore the backup * to `installPath`. When undefined, `undo()` will simply remove the install. */ private createUndoSnapshot; /** * Get all undo snapshots */ getUndoHistory(): UndoSnapshot[]; /** * Clear undo history (e.g., on session end) */ clearUndoHistory(): void; } export default ActivationManager; //# sourceMappingURL=ActivationManager.d.ts.map