import { type HygieneCommonOptions } from "../shared.js"; export interface AuditFindReplaceOptions extends HygieneCommonOptions { /** Required. Regex pattern (without slashes) or literal string to search for. */ pattern: string; /** Treat `pattern` as a literal string instead of a regex. */ literal?: boolean; /** Regex flags. Default `g` (case-sensitive). Combined with `i` if `--ignore-case`. */ flags?: string; /** Lowercase the search before matching. */ ignoreCase?: boolean; /** * Only inspect these field names. Default: all author-facing fields * (non-`__`-prefixed). Multiple values may be passed as a * comma-separated list at the CLI layer. */ fields?: string[]; /** Include `__`-prefixed system fields in the search. Off by default. */ includeSystemFields?: boolean; /** Content root. Default `/sitecore/content`. */ root?: string; index?: string; limit?: number; includeSystem?: boolean; language?: string; batchSize?: number; concurrency?: number; pageParallelism?: number; cache?: boolean; /** Cap on matches reported per item (default 10). */ maxMatchesPerItem?: number; } export interface FindReplaceMatch { itemId: string; path: string; templateName: string | null; language: string | null; matches: Array<{ fieldName: string; matchCount: number; /** Up to `--max-matches-per-item` example match snippets (≤ 80 chars each). */ samples: string[]; }>; } declare const compilePattern: (pattern: string, options: AuditFindReplaceOptions) => RegExp; /** * Audit content for fields matching a pattern. Read-only; pair with * `scai hygiene cleanup find-replace` to apply replacements. * * Strategy: * 1. Enumerate items via `scanItemsAndFields` (full perf-knobs + * cache support). * 2. For each field that survives the `--fields` filter (and the * system-field exclusion), run the compiled pattern, count * matches, capture up to `--max-matches-per-item` sample * snippets. * 3. Emit one report row per (item, field) pair that has at least * one match. * * Patterns: * - Default: full regex. Operators escape special chars themselves. * - `--literal`: treat pattern as a literal string (special chars * auto-escaped). Useful for find-and-replace of URLs, GUIDs, etc. * - `--ignore-case`: append `i` to the flags. Combines with `--literal`. * * Notes: * - The patterns are JS regex (`RegExp`), not Sitecore Lucene query * syntax. This means `\\b`, capture groups, lookaheads, and back- * references all work; whereas Sitecore search index queries * wouldn't accept those. * - Field-level matches are reported with snippets containing 30 * chars of context on each side. Whitespace runs are normalized * for display. */ export declare const runAuditFindReplace: (options: AuditFindReplaceOptions) => Promise; export { compilePattern as _compilePatternForTest };