/** * Severity grading for prose/style flags (advisory mode). * * The deterministic analyzers (ProseAnalyzer & friends) emit per-occurrence * `ProseCheck`s with a blunt fixed `severity` ('info' | 'warning' | 'error'). * That treats every flag as pass/fail. This module re-grades those flags into a * softer, *advisory*, *density-relative* model that respects the author's voice * (Le Guin: don't condemn all telling — flag, don't forbid): * * - Flags are graded 'info' | 'suggestion' | 'warning' by how far the *density* * of that flag type exceeds the tolerance the project declares in * `style-targets.yml` (falling back to general-fiction tolerances). * - Wording is softened and non-imperative ("a stronger verb may carry the * weight" rather than "Remove this word"). * - A per-project `allow:` list in `style-targets.yml` suppresses any flag * whose flagged text the author has chosen to keep. * * This module never rewrites the analyzers; it post-processes their output. The * CLI opts back into hard, blunt flagging with `--strict`, which bypasses this * module entirely. */ import type { ProseCheck } from '../types/novel.js'; import { type StyleTargets } from './style-targets.js'; /** Advisory severity ladder — softer than the analyzers' raw severities. */ export type AdvisorySeverity = 'info' | 'suggestion' | 'warning'; /** A re-graded, advisory view of a single prose check. */ export interface GradedCheck { type: ProseCheck['type']; line: number; column?: number; /** The exact text the analyzer flagged. */ text: string; /** Re-graded advisory severity. */ severity: AdvisorySeverity; /** Softened, non-imperative guidance (no leading verb). */ message: string; } /** * Load the optional `allow:` list from a project's `style-targets.yml`. Entries * are words or phrases the author has chosen to keep; any flag whose text * matches one is suppressed. Returns lowercased, trimmed, non-empty entries. * Never throws — a missing or malformed file yields an empty list. */ export declare function loadAllowList(projectPath: string): string[]; /** * True when the flagged `text` is covered by the author's allow-list. Matching * is case-insensitive and substring-symmetric: an allow entry "old man" covers * a flag on "old man", and an allow entry "darkly" covers a flag on * "said darkly". */ export declare function isAllowed(text: string, allow: string[]): boolean; /** * Re-grade a set of analyzer `ProseCheck`s into advisory `GradedCheck`s. * * @param checks Raw checks from an analyzer. * @param wordCount Word count of the analyzed text (drives density). * @param targets Project style targets (scales the per-type tolerances). * @param allow Allow-list of words/phrases to suppress. * @returns Graded checks, allow-listed flags removed, ordered as input. */ export declare function gradeChecks(checks: ProseCheck[], wordCount: number, targets: StyleTargets, allow: string[]): GradedCheck[]; //# sourceMappingURL=severity.d.ts.map