/** * Prompt Installer - Creates directory structure and installs default prompt files * while preserving user customizations. * * This is a TDD stub implementation. All methods throw "Not implemented" errors. */ import { z } from 'zod'; export declare const DEFAULT_BASE_DIR = "~/.llxprt/prompts"; export declare const REQUIRED_DIRECTORIES: readonly ["", "env", "tools", "providers"]; export interface InstallOptions { force?: boolean; dryRun?: boolean; verbose?: boolean; } export type PromptConflictReason = 'default-newer' | 'user-newer' | 'content-diff' | 'user-modified' | 'user-protected' | 'unknown-baseline'; export interface PromptConflictDetails { path: string; userTimestamp?: string; defaultTimestamp?: string; reason: PromptConflictReason; } export interface PromptConflictSummary extends PromptConflictDetails { action: 'kept' | 'overwritten'; reviewFile?: string; } export interface InstallResult { success: boolean; installed: string[]; skipped: string[]; errors: string[]; baseDir?: string; conflicts: PromptConflictSummary[]; notices: string[]; } export interface UninstallOptions { removeUserFiles?: boolean; dryRun?: boolean; } export interface UninstallResult { success: boolean; removed: string[]; errors: string[]; } export interface ValidationResult { isValid: boolean; errors: string[]; warnings: string[]; missing: string[]; baseDir: string; } export interface RepairOptions { verbose?: boolean; } export interface RepairResult { success: boolean; repaired: string[]; errors: string[]; stillInvalid: string[]; } export interface BackupResult { success: boolean; backupPath?: string; fileCount?: number; totalSize?: number; error?: string; } export declare const DefaultsMapSchema: z.ZodRecord; export type DefaultsMap = z.infer; /** * PromptInstaller handles installation, validation, and maintenance of prompt files */ export declare class PromptInstaller { private defaultSourceDirs; /** * Install default prompt files * @param baseDir - Base directory for prompts (defaults to DEFAULT_BASE_DIR) * @param defaults - Map of relative path to file content * @param options - Installation options * @returns Installation result with success status and details */ install(baseDir: string | null, defaults: DefaultsMap, options?: InstallOptions): Promise; private handleExistingFile; /** * Create a keep decision with optional review file */ private createKeepDecision; private getDefaultSourceDirectories; private getDefaultFileStats; private generateReviewFilename; private formatTimestamp; private getReviewTimestamp; private buildConflictNotice; /** * Uninstall prompt files * @param baseDir - Base directory for prompts * @param options - Uninstallation options * @returns Uninstallation result with removed files */ uninstall(baseDir: string | null, options?: UninstallOptions): Promise; /** * Helper method to recursively collect all files in a directory */ private collectAllFiles; /** * Validate prompt installation * @param baseDir - Base directory to validate * @returns Validation result with issues found */ validate(baseDir: string | null): Promise; /** * Repair prompt installation * @param baseDir - Base directory to repair * @param defaults - Map of default files to restore * @param options - Repair options * @returns Repair result with fixed issues */ repair(baseDir: string | null, defaults: DefaultsMap, options?: RepairOptions): Promise; /** * Create backup of current prompts * @param baseDir - Base directory to backup * @param backupPath - Where to save backup * @returns Backup result with location and stats */ backup(baseDir: string | null, backupPath: string): Promise; /** * Helper method to copy a directory recursively */ private copyDirectory; /** * Helper method to count files in a directory */ private countFiles; /** * Helper method to fix file permissions recursively */ private fixFilePermissions; /** * Expand path with home directory and environment variables * @param path - Path to expand * @returns Expanded absolute path */ expandPath(inputPath: string): string; /** * Compute SHA-256 hash of content * @param content - Content to hash * @returns Hex-encoded SHA-256 hash */ hashContent(content: string): string; /** * Check if content has NO OVERWRITE flag * Hash-based patterns (#, # LLXPRT:) must be at absolute start of file * HTML comment pattern () can be anywhere in file */ private hasNoOverwriteFlag; /** * Load installed manifest from disk with Zod validation */ private loadManifest; /** * Save manifest to disk */ private saveManifest; /** * Get installed hash for a file from manifest */ private getInstalledHash; /** * Update manifest entry for a file */ private updateManifestEntry; }