/** * Deterministic string-building helpers shared by capability templates. All * generated files flow through these so golden-file tests stay stable: no dates, * no random ordering, single trailing newline. */ /** * Strip trailing newlines in linear time. The idiomatic `/\n+$/` is a * polynomial-ReDoS footgun (CodeQL `js/polynomial-redos`): on a long run of * newlines followed by a non-newline a backtracking engine retries the run from * every start position — O(n²). A reverse scan is provably O(n) and byte-for-byte * identical (only `\n` (U+000A) is stripped, exactly as the old regex did, so * `\r` in a `\r\n` sequence is preserved either way). */ export declare function stripTrailingNewlines(text: string): string; /** Join parts (strings or string arrays) with newlines; exactly one trailing newline. */ export declare function lines(...parts: Array): string; /** Indent every non-empty line of `text` by `n` spaces. */ export declare function indent(text: string, n?: number): string; /** Render a YAML frontmatter block from ordered key/value pairs (insertion order). */ export declare function frontmatter(fields: Record): string; /** Stable 2-space JSON with a trailing newline (insertion order preserved). */ export declare function jsonFile(value: unknown): string; /** Ensure exactly one trailing newline. */ export declare function ensureTrailingNewline(text: string): string; /** Marker that opens an aih-managed region (comment syntax works in sh + PowerShell). */ export declare function beginMarker(scope: string): string; /** Marker that closes an aih-managed region. */ export declare function endMarker(scope: string): string; /** Wrap `body` in begin/end markers for in-place regeneration. */ export declare function managedBlock(scope: string, body: string): string;