/** * Marker System for Lex-generated content * * Implements LEX:BEGIN/END markers for idempotent updates to host-specific * instruction files. Human content outside markers is preserved exactly. */ /** * Marker constants - exact strings used in instruction files */ export declare const LEX_BEGIN = ""; export declare const LEX_END = ""; /** * Result of extracting marked content from a file */ export interface ExtractResult { /** Content before the LEX:BEGIN marker (empty string if at start) */ before: string; /** Content between markers, or null if no markers found */ lex: string | null; /** Content after the LEX:END marker (empty string if at end) */ after: string; /** Whether valid markers were found */ hasMarkers: boolean; /** Whether variant (non-standard) markers were detected */ hasVariantMarkers?: boolean; /** The actual BEGIN marker found (for diagnostics) */ foundBeginMarker?: string; /** The actual END marker found (for diagnostics) */ foundEndMarker?: string; } /** * Wrap content with LEX:BEGIN/END markers * * @param content - The Lex-generated content to wrap * @returns Content wrapped with markers and header comment * * @example * ```ts * const wrapped = wrapWithMarkers("## Lex Section\nContent here"); * // Returns: * // * // * // * // ## Lex Section * // Content here * // * // * ``` */ export declare function wrapWithMarkers(content: string): string; /** * Extract marked content from a file, preserving human sections * * Supports both standard markers and variant formats: * - Standard: `` and `` * - Variant: ``, ``, etc. * * @param fileContent - Full content of the file * @returns Object with before, lex (if found), and after sections * * @example * ```ts * const result = extractMarkedContent(fileContent); * if (result.hasMarkers) { * console.log("Lex section:", result.lex); * console.log("Human content preserved:", result.before + result.after); * if (result.hasVariantMarkers) { * console.warn("Non-standard markers detected, will be normalized on next generate"); * } * } * ``` */ export declare function extractMarkedContent(fileContent: string): ExtractResult; /** * Replace marked content in a file, preserving human sections * * If no markers exist, appends the new content at the end of the file. * * @param fileContent - Current file content * @param newLexContent - New Lex-generated content (without markers) * @returns Updated file content with new Lex section * * @example * ```ts * // Update existing marked section * const updated = replaceMarkedContent(existingFile, "## Updated Lex\nNew content"); * * // Append to file without markers * const appended = replaceMarkedContent(noMarkersFile, "## Lex Section\nContent"); * ``` */ export declare function replaceMarkedContent(fileContent: string, newLexContent: string): string; /** * Check if content appears to have valid Lex markers * * Supports both standard markers and variant formats. * * @param content - File content to check * @returns True if both BEGIN and END markers are present in correct order */ export declare function hasValidMarkers(content: string): boolean; /** * Check if content has variant (non-standard) markers that should be normalized * * @param content - File content to check * @returns True if variant markers were detected */ export declare function hasVariantMarkers(content: string): boolean; /** * Remove Lex-generated content from a file, preserving human sections * * @param fileContent - Current file content * @returns File content with Lex section removed, or original if no markers * * @example * ```ts * const cleaned = removeMarkedContent(fileWithLex); * // Returns file with only human content (before + after sections) * ``` */ export declare function removeMarkedContent(fileContent: string): { content: string; removed: boolean; removedContent: string | null; };