/** * OpenLore managed-block utilities. * * A "managed block" is a region inside an existing text file (typically Markdown) * delimited by canonical comments. Re-running `openlore install` rewrites the * block in place. A SHA-256 fingerprint over the canonical content lets us * detect hand-edits and refuse to clobber them unless `--force` is passed. */ export declare const BLOCK_BEGIN = ""; export declare const BLOCK_END = ""; export interface ExtractedBlock { /** Index of the BEGIN marker in the source file. */ beginIndex: number; /** Index just past the END marker. */ endIndex: number; /** The raw text between BEGIN and END markers (excluding markers themselves). */ inner: string; /** The fingerprint we previously wrote, if present. */ fingerprint: string | null; } export declare function fingerprint(content: string): string; /** Build the full managed block (markers + fingerprint comment + content). */ export declare function renderBlock(content: string): string; export declare function extractBlock(source: string): ExtractedBlock | null; /** * Compute the fingerprint of the *current* inner content as it would be if we * had written `expectedContent`. Used to decide whether the block on disk * still matches what we last wrote. */ export declare function blockMatchesExpected(block: ExtractedBlock, expectedContent: string): boolean; export interface UpsertResult { /** The file contents to write back. */ next: string; /** What happened: 'created' (file/block was new), 'updated' (re-rendered), 'noop' (already matched). */ action: 'created' | 'updated' | 'noop'; } /** * Upsert the managed block in `existing`. If a block exists, replace it; otherwise * append. If the existing block's fingerprint matches the new content, do nothing. * * Caller is responsible for the `--force` / hand-edit check (use `isHandEdited`). */ export declare function upsertBlock(existing: string, content: string): UpsertResult; /** * True iff a block exists on disk and its inner contents no longer hash to its * fingerprint (i.e. someone edited inside the markers). */ export declare function isHandEdited(block: ExtractedBlock): boolean; /** * Remove the managed block from `existing`. Returns null if no block was present. */ export declare function removeBlock(existing: string): string | null; //# sourceMappingURL=block.d.ts.map