export declare function assertNotSymbolicLink(filePath: string, action: string): Promise; export declare function assertManagedPathInsideRoot(managedPath: string, rootPath: string, action: string): Promise; /** * Searches upwards from startPath to find a directory named .ruler. * If not found locally and checkGlobal is true, checks for global config at XDG_CONFIG_HOME/ruler. * Returns the path to the .ruler directory, or null if not found. */ export declare function findRulerDir(startPath: string, checkGlobal?: boolean): Promise; export declare function resolveProjectRootForRulerDir(requestedProjectRoot: string, rulerDir: string): string; /** * Options for {@link readMarkdownFiles}. */ export interface ReadMarkdownFilesOptions { /** * When true, include `.ruler/agents/*.md` in the returned set so they are * concatenated into the top-level generated rule files. When false or * omitted, `.ruler/agents/` is skipped, mirroring `.ruler/skills/`. */ includeAgents?: boolean; } /** * Recursively reads all Markdown (.md) files in rulerDir, returning their paths and contents. * Files are sorted alphabetically by path. * * `.ruler/skills/` is always skipped (skills are propagated separately). * `.ruler/agents/` is skipped unless `options.includeAgents` is `true`. */ export declare function readMarkdownFiles(rulerDir: string, options?: ReadMarkdownFilesOptions): Promise<{ path: string; content: string; }[]>; /** * Writes content to filePath, creating parent directories if necessary. */ export declare function writeGeneratedFile(filePath: string, content: string, containmentRoot?: string): Promise; /** * Creates a backup of the given filePath by copying it to filePath.bak if it exists. * Keeps an existing backup intact so repeated applies preserve the original file. */ export declare function backupFile(filePath: string, containmentRoot?: string): Promise; /** * Ensures that the given directory exists by creating it recursively. */ export declare function ensureDirExists(dirPath: string): Promise; /** * Finds the global ruler configuration directory at XDG_CONFIG_HOME/ruler. * Returns the path if it exists, null otherwise. */ export declare function findGlobalRulerDir(): Promise; /** * Searches the entire directory tree from startPath to find all .ruler directories. * Returns an array of .ruler directory paths from most specific to least specific. */ export declare function findAllRulerDirs(startPath: string): Promise;