UNPKG

ailock

Version:

AI-Proof File Guard - Protect sensitive files from accidental AI modifications

216 lines 6.51 kB
/** * Project unit types for the new quota system */ export type ProjectType = 'git' | 'directory'; /** * A protected project unit (Git repository or standalone directory) */ export interface ProjectUnit { id: string; rootPath: string; type: ProjectType; name: string; protectedPaths: string[]; createdAt: Date; lastAccessedAt?: Date; } /** * User configuration interface for growth system integration */ export interface UserConfig { machineUuid: string; authToken?: string; projectQuota: number; protectedProjects: ProjectUnit[]; directoryQuota?: number; lockedDirectories?: string[]; lastSyncAt?: Date; apiEndpoint?: string; offlineMode?: boolean; analyticsEnabled: boolean; version: string; machineFingerprint?: string; privacyLevel?: 'minimal' | 'standard' | 'enhanced'; telemetryOptOut?: boolean; hasAcceptedPrivacyPolicy?: boolean; } /** * Default user configuration */ export declare const DEFAULT_USER_CONFIG: UserConfig; /** * Get the user config file path */ export declare function getUserConfigPath(): string; /** * Load user configuration from disk * Creates default config if file doesn't exist */ export declare function loadUserConfig(): Promise<UserConfig>; /** * Save user configuration to disk */ export declare function saveUserConfig(config: UserConfig): Promise<void>; /** * Get current user's directory quota (legacy compatibility) */ export declare function getUserQuota(): Promise<number>; /** * Get current user's project quota */ export declare function getProjectQuota(): Promise<number>; /** * Get locked directories count (legacy compatibility) */ export declare function getLockedDirectoryCount(): Promise<number>; /** * Get protected projects count */ export declare function getProtectedProjectCount(): Promise<number>; /** * Get all protected projects */ export declare function getProtectedProjects(): Promise<ProjectUnit[]>; /** * Check if user is within their directory quota (legacy compatibility) */ export declare function isWithinQuota(): Promise<boolean>; /** * Check if user is within their project quota */ export declare function isWithinProjectQuota(): Promise<boolean>; /** * Add a directory to the locked directories list */ export declare function addLockedDirectory(dirPath: string): Promise<void>; /** * Remove a directory from the locked directories list */ export declare function removeLockedDirectory(dirPath: string): Promise<void>; /** * Update user's directory quota (legacy compatibility) */ export declare function updateDirectoryQuota(newQuota: number): Promise<void>; /** * Update user's project quota (typically after auth code redemption) */ export declare function updateProjectQuota(newQuota: number): Promise<void>; /** * Add a protected project */ export declare function addProtectedProject(project: ProjectUnit): Promise<void>; /** * Remove a protected project by root path */ export declare function removeProtectedProject(rootPath: string): Promise<void>; /** * Find a protected project by root path */ export declare function findProtectedProject(rootPath: string): Promise<ProjectUnit | null>; /** * Update protected paths for a project */ export declare function updateProjectProtectedPaths(rootPath: string, protectedPaths: string[]): Promise<void>; /** * Set user's auth token */ export declare function setAuthToken(token: string): Promise<void>; /** * Clear user's auth token */ export declare function clearAuthToken(): Promise<void>; /** * Update user's machine UUID in config */ export declare function updateMachineUuid(uuid: string): Promise<void>; /** * Set analytics preference */ export declare function setAnalyticsEnabled(enabled: boolean): Promise<void>; /** * Get analytics preference */ export declare function getAnalyticsEnabled(): Promise<boolean>; /** * Set offline mode */ export declare function setOfflineMode(offline: boolean): Promise<void>; /** * Get offline mode status */ export declare function getOfflineMode(): Promise<boolean>; /** * Set privacy level */ export declare function setPrivacyLevel(level: 'minimal' | 'standard' | 'enhanced'): Promise<void>; /** * Get privacy level */ export declare function getPrivacyLevel(): Promise<'minimal' | 'standard' | 'enhanced'>; /** * Set telemetry opt-out */ export declare function setTelemetryOptOut(optOut: boolean): Promise<void>; /** * Get telemetry opt-out status */ export declare function getTelemetryOptOut(): Promise<boolean>; /** * Validate machine fingerprint for security * Returns true if the configuration appears to be on the same machine */ export declare function validateMachineFingerprint(): Promise<boolean>; /** * Check if analytics should be collected based on privacy settings */ export declare function shouldCollectAnalytics(): Promise<boolean>; /** * Sanitize user config for safe logging/transmission */ export declare function sanitizeUserConfig(config: UserConfig): Partial<UserConfig>; /** * Get user configuration for debugging */ export declare function getUserConfigDebugInfo(): Promise<Omit<UserConfig, 'authToken'>>; /** * Reset user configuration to defaults (useful for testing) */ export declare function resetUserConfig(): Promise<void>; /** * Validate user configuration integrity */ export declare function validateUserConfig(config: UserConfig): string[]; /** * Create backup of user configuration */ export declare function backupUserConfig(): Promise<string>; /** * Restore user configuration from backup */ export declare function restoreUserConfig(backupPath: string): Promise<void>; /** * Repair a user config object (synchronous version for testing) */ export declare function repairUserConfig(config: UserConfig): UserConfig; /** * Repair corrupted user configuration (async version) * Attempts to fix issues automatically or reset to defaults */ export declare function repairUserConfigAsync(): Promise<{ repaired: boolean; issuesFixed: string[]; hadToReset: boolean; }>; /** * Migrate legacy lockedDirectories to protectedProjects */ export declare function migrateLegacyDirectoriesToProjects(config: UserConfig): Promise<UserConfig>; /** * Safe configuration operation wrapper */ export declare function safeConfigOperation<T>(operation: () => Promise<T>, operationName: string, fallbackValue?: T): Promise<{ success: boolean; result?: T; error?: string; }>; //# sourceMappingURL=user-config.d.ts.map