/** * ProseFixer — `revise` command engine (mechanical prose fixes) * * Deterministic, opt-in, reversible copy-edit fixes for chapter Markdown files. * There is NO LLM here: every transformation is a pure, line-based string * operation so the same input always produces the same output. * * Categories: * - `doubled-words` collapse accidental word repeats ("the the") * - `trailing-whitespace` strip trailing spaces/tabs at end of line * - `multiple-spaces` collapse runs of 2+ spaces between words * - `redundant-intensifiers` drop "very/really/quite" before a weak adjective * - `adverb-dialogue-tags` strip an -ly adverb after a dialogue tag verb * - `straight-to-curly-quotes` convert " and ' to typographic quotes * * Safety rules that apply to ALL categories: * - YAML frontmatter (a leading `---` … `---` block) is never modified. * - Lines inside fenced code blocks (``` or ~~~) are never modified. * - Original end-of-line style (LF vs CRLF) is preserved. * - Line numbers in the change list are 1-based across the whole file. * * File I/O lives in {@link ProseFixer}; the core transformation * ({@link ProseFixer._fixText}) is a pure static method exposed for unit tests. */ export type ReviseCategory = 'doubled-words' | 'trailing-whitespace' | 'multiple-spaces' | 'redundant-intensifiers' | 'adverb-dialogue-tags' | 'straight-to-curly-quotes'; /** * Canonical order in which fixers are applied to a line. Order is fixed and * independent of the order categories are requested in, so results are * deterministic. */ export declare const ALL_CATEGORIES: readonly ReviseCategory[]; /** A single line that was changed by one or more fixers. */ export interface ReviseChange { /** 1-based line number within the whole file. */ line: number; /** The verbatim line before any fix was applied. */ before: string; /** The line after all enabled fixes were applied. */ after: string; /** Which categories actually changed this line, in canonical order. */ categories: ReviseCategory[]; } /** Per-category and aggregate counts plus the rewritten text. */ export interface ReviseResult { /** Number of individual fixes per category (0 for untouched categories). */ counts: Record; /** Sum of all per-category counts. */ totalFixes: number; /** Number of distinct lines that changed. */ changedLines: number; /** The change list, in ascending line order. */ changes: ReviseChange[]; /** The fully rewritten file text (frontmatter + body, original EOL). */ output: string; } /** Type guard: is `value` a known revise category? */ export declare function isReviseCategory(value: string): value is ReviseCategory; export declare class ProseFixer { private readonly projectPath; constructor(projectPath: string); /** * Apply the requested mechanical fixes to a chapter file's text and, * optionally, write the result back to disk. * * @param chapterFile - Absolute path, or a basename resolved relative to * `projectPath/chapters/`. * @param categories - Categories to apply. * @param options.apply - When true, the rewritten file is written to disk. * When false (default) it is a dry run. */ reviseChapter(chapterFile: string, categories: ReviseCategory[], options?: { apply?: boolean; }): Promise; /** * Pure transformation core. Applies the enabled categories (always in * {@link ALL_CATEGORIES} order) to every eligible body line. * * Exposed as a static method so unit tests can run it without file I/O. */ static _fixText(raw: string, categories: ReviseCategory[]): ReviseResult; } //# sourceMappingURL=prose-fixer.d.ts.map