/** A single file operation recorded by the virtual tree. */ export type FileChange = { path: string; type: 'CREATE' | 'UPDATE'; content: string; }; /** Abstraction over `node:fs` used by the virtual tree for disk I/O. */ export type FileSystemAdapter = { readFile: (path: string, encoding: 'utf8') => Promise; writeFile: (path: string, content: string) => Promise; exists: (path: string) => Promise; mkdir: (path: string, options: { recursive: true; }) => Promise; unlink: (path: string) => Promise; }; /** Virtual file system that buffers writes in memory until flushed to disk. */ export type Tree = { root: string; exists: (filePath: string) => Promise; read: (filePath: string) => Promise; write: (filePath: string, content: string) => Promise; listChanges: () => FileChange[]; flush: () => Promise; }; /** Internal pending-entry shape held by the virtual tree. */ export type PendingEntry = { content: string; type: 'CREATE' | 'UPDATE'; original: string | null; };