ailock
Version:
AI-Proof File Guard - Protect sensitive files from accidental AI modifications
61 lines • 2.23 kB
TypeScript
import { SecureCommandExecutor } from '../../security/CommandExecutor.js';
import { SecurePathValidator } from '../../security/PathValidator.js';
import { AtomicFileManager } from '../../security/AtomicFileManager.js';
import { SecureErrorHandler } from '../../security/ErrorHandler.js';
import type { PlatformAdapter, SecurityInfo, Platform } from '../platform.js';
/**
* Base abstract class for platform-specific file locking adapters
*/
export declare abstract class BasePlatformAdapter implements PlatformAdapter {
protected commandExecutor: SecureCommandExecutor;
protected pathValidator: SecurePathValidator;
protected fileManager?: AtomicFileManager;
protected errorHandler: SecureErrorHandler;
protected abstract platformType: Platform;
constructor();
/**
* Lock a file to prevent modifications
*/
abstract lockFile(filePath: string): Promise<void>;
/**
* Unlock a file to allow modifications
*/
abstract unlockFile(filePath: string): Promise<void>;
/**
* Check if a file is locked
*/
abstract isLocked(filePath: string): Promise<boolean>;
/**
* Check if the platform supports immutable file attributes
*/
abstract supportsImmutable(): boolean;
/**
* Validate file security settings
*/
validateSecurity(filePath: string): Promise<boolean>;
/**
* Get security information about a file
*/
getSecurityInfo(filePath: string): Promise<SecurityInfo>;
/**
* Check if a file has immutable attributes (platform-specific)
*/
protected abstract checkImmutable(filePath: string): Promise<boolean>;
/**
* Common method to make a file read-only using chmod
*/
protected makeReadOnly(filePath: string): Promise<void>;
/**
* Common method to make a file writable using chmod
*/
protected makeWritable(filePath: string): Promise<void>;
/**
* Common method to check if a file is read-only
*/
protected isReadOnly(filePath: string): Promise<boolean>;
/**
* Verify file access permissions
*/
protected verifyAccess(filePath: string, mode: number): Promise<boolean>;
}
//# sourceMappingURL=BasePlatformAdapter.d.ts.map