import { n as renderRulePrompt, t as renderAgentPlaybook } from "./rule-prompt-BIjAiZ40.js"; import { z } from "zod"; type RuleCategory = 'ai-slop' | 'reactivity' | 'composition' | 'performance' | 'template' | 'template-perf' | 'build-quality' | 'deps' | 'dead-code' | 'sfc' | 'vue-builtin' | 'structure' | 'modules-deps' | 'nitro' | 'seo' | 'cloudflare' | 'server-routes' | 'hydration' | 'data-fetching' | 'security' | 'design'; type RuleSource = 'doctor' | 'oxlint-builtin' | 'eslint-plugin-vue'; /** * Behavioral rule families, orthogonal to `category`. A rule can carry * several. Used by `list-rules --tag`, config `ignore.tags`, and the * per-surface `includeTags` / `excludeTags` controls. */ export declare const RULE_TAGS: readonly ["vue", "nuxt", "design", "ai-slop", "security-scan", "test-noise", "performance", "hydration", "dead-code", "migration-hint"]; type RuleTag = (typeof RULE_TAGS)[number]; interface RuleDefinition { readonly id: string; readonly severity: Severity; readonly category: RuleCategory; readonly source: RuleSource; readonly recommended: boolean; } interface RegisteredRule extends RuleDefinition { readonly tags: readonly RuleTag[]; } /** Derive a rule's tags from its id, category, and source. */ export declare function deriveRuleTags(rule: RuleDefinition): RuleTag[]; export declare const RULE_REGISTRY: readonly RegisteredRule[]; interface ListRulesFilter { readonly preset?: 'recommended' | 'all'; readonly category?: RuleCategory; readonly source?: RuleSource; readonly severity?: Severity; readonly tag?: RuleTag; } export declare function listRules(filter?: ListRulesFilter): RegisteredRule[]; type ScoreDimension = 'performance' | 'correctness' | 'security' | 'maintainability' | 'nuxt' | 'design'; export declare const SCORE_DIMENSIONS: readonly ScoreDimension[]; export declare function dimensionForCategory(category: RuleCategory): ScoreDimension; export declare function isScoreDimension(value: string): value is ScoreDimension; export declare function categoriesForDimension(dimension: ScoreDimension): RuleCategory[]; interface ScoreBreakdownEntry { ruleId: string; occurrences: number; weightPerOccurrence: number; penalty: number; } interface DimensionScore { score: number; totalFindings: number; errorCount: number; warnCount: number; infoCount: number; } interface ScoreResult { score: number; passed: boolean; threshold: number; totalFindings: number; errorCount: number; warnCount: number; infoCount: number; breakdown: ScoreBreakdownEntry[]; /** * Per-dimension sub-scores. Each is computed with the SAME √-decay formula * isolated to that dimension's diagnostics — diagnostic aids that do NOT sum * to the overall score. The single `score` above stays the authoritative value. */ byDimension: Readonly>; } interface ScoreConfig { rules?: Record; threshold?: number; } export declare function scoreDiagnostics(diagnostics: Diagnostic[], config?: ScoreConfig): ScoreResult; type Framework = 'vue' | 'nuxt' | 'unknown'; declare const CAPABILITIES: readonly ["vue:3", "vue:3.4", "vue:3.5", "vue:vapor", "nuxt:4", "nuxt:4.4", "nuxt4", "nuxt-config", "app-dir", "server-dir", "pages-dir", "wrangler", "auto-imports:vue", "components:auto", "pinia", "vue-router", "typescript", "typescript:6", "monorepo:pnpm", "monorepo:yarn", "monorepo:npm", "cf-pages:enabled", "nitro:node-server"]; type Capability = (typeof CAPABILITIES)[number]; type MonorepoKind = 'pnpm' | 'yarn' | 'npm' | 'turbo' | null; interface ProjectInfo { readonly framework: Framework; readonly frameworkDetected: boolean; readonly rootDirectory: string; readonly packageJsonPath: string | null; readonly vueVersion: string | null; readonly nuxtVersion: string | null; readonly typescriptVersion: string | null; readonly hasAutoImports: boolean; readonly hasComponentsAutoImport: boolean; readonly hasPinia: boolean; readonly hasVueRouter: boolean; readonly nitroPreset: string | null; readonly nuxtCompatibilityVersion: 3 | 4 | null; readonly monorepoKind: MonorepoKind; readonly nuxtConfigPath: string | null; readonly hasAppDir: boolean; readonly appDirPath: string | null; readonly hasServerDir: boolean; readonly hasPagesDir: boolean; readonly hasWranglerConfig: boolean; readonly capabilities: ReadonlySet; } interface ProjectInfoLite { readonly framework: Framework; readonly frameworkDetected: boolean; readonly vueVersion: string | null; readonly nuxtVersion: string | null; readonly capabilities: readonly string[]; readonly rootDirectory: string; } interface ReporterInput { readonly toolName: string; readonly toolVersion: string; readonly rootDirectory: string; readonly analyzedFileCount: number; readonly elapsedMs: number; readonly diagnostics: readonly Diagnostic[]; readonly score: ScoreResult; readonly projectInfo: ProjectInfoLite; readonly incomplete?: boolean; readonly skippedCheckReasons?: readonly SkippedCheckReason[]; readonly sourceRevision?: string; readonly configHash?: string; readonly baseline?: BaselineSummary; readonly scope?: ReportScope; /** * Whether test/story-file findings count toward the score and the gate. * Default `false`, matching `audit()`. */ readonly includeTestFiles?: boolean; } interface ReporterOptions { readonly color?: boolean; readonly quiet?: boolean; } type Severity = 'error' | 'warn' | 'info'; type DiagnosticSource = 'template' | 'oxlint' | 'sfc' | 'dead-code' | 'project' | 'deps'; interface Diagnostic { file: string; line: number; column: number; endLine?: number; endColumn?: number; ruleId: string; severity: Severity; message: string; source: DiagnosticSource; recommendation?: string; codeSnippet?: string; /** Present only for test/story/fixture files; omitted for prod source. */ surface?: 'test'; /** * Stable identity (rule + relative path + normalized source evidence, no * line numbers) used to match findings against a `--baseline` report. */ fingerprint?: string; /** * INTERNAL ownership ranges for `--scope contextual` (react.doctor's * `contextNodes`): when set they override the rule's `diffScope`, and the * finding is reported if any range intersects the change. Never written to * JSON, SARIF, or push payloads. */ contextRanges?: ReadonlyArray<{ line: number; endLine: number; }>; } /** Result of comparing a scan against a saved baseline (or base revision). */ interface BaselineSummary { /** The baseline report file, or `git:` for a base-revision comparison. */ file: string; /** Current findings that already existed in the baseline. */ matchedCount: number; /** Current findings that are new relative to the baseline. */ newCount: number; /** Baseline findings that no longer occur. */ fixedCount: number; } interface AuditConfig { rootDir?: string; include?: string[]; exclude?: string[]; rules?: Record; failOn?: 'error' | 'warn' | 'none'; deadCode?: boolean; lint?: boolean; threshold?: number; scopeFiles?: string[]; respectInlineDisables?: boolean; fix?: boolean; fixExcludes?: string[]; maxDurationMs?: number; includeTestFiles?: boolean; /** * Reuse already-detected project info instead of detecting it from * `rootDir` (a base-revision snapshot has no installed dependencies). */ projectInfo?: ProjectInfo; } /** How much of a change set a scan reports. */ type ScopeMode = 'full' | 'files' | 'changed' | 'lines' | 'contextual'; interface ReportScope { mode: ScopeMode; /** The ref the change set was computed against (absent for --staged). */ base?: string; } interface SkippedCheckReason { kind: 'time-budget-exhausted'; deadlineMs: number; elapsedMs: number; skippedPasses: readonly string[]; } interface AuditTimings { template: number; sfc: number; script: number; deadCode: number; total: number; } interface AuditReport { rootDir: string; filesScanned: number; diagnostics: Diagnostic[]; score: number; errorCount: number; warnCount: number; infoCount: number; exitCode: 0 | 1 | 2; scoreResult: ScoreResult; projectInfo: ProjectInfoLite; elapsedMs: number; timings: AuditTimings; ruleCounts: Record; incomplete: boolean; skippedCheckReasons?: readonly SkippedCheckReason[]; /** * Severity counts the `--fail-on` gate saw, when config `surfaces.ciGate` * made them differ from the scored counts. Absent otherwise. */ gate?: { errorCount: number; warnCount: number; }; /** * Findings the score and severity counts cover, when config `ignore` / * `surfaces` made them differ from the listed `diagnostics`. Absent = * the listed findings (minus test files unless `includeTestFiles`). * Lets a `--project` roll-up and `--push` use what each project scored. */ scoredDiagnostics?: Diagnostic[]; /** Findings the `--fail-on` gate sees, under the same rule as `scoredDiagnostics`. */ gatedDiagnostics?: Diagnostic[]; /** `git rev-parse HEAD` of the scanned tree, when it is a git checkout. */ sourceRevision?: string; /** Hash of the finding-affecting settings (see `computeConfigHash`). */ configHash?: string; /** Present when findings were narrowed to the new ones vs a baseline. */ baseline?: BaselineSummary; /** Present for every scope other than `full`. */ scope?: ReportScope; } interface AnnotationOptions { /** Test/story-file findings count toward the gate. Default `false`. */ readonly includeTestFiles?: boolean; } /** * One GitHub Actions workflow command per finding. A test/story-file finding * that the `--fail-on` gate ignores is emitted as a `notice` (title tagged * "test file, not gated"), so an `::error` line always means a gated error. */ export declare function encodeAnnotation(diagnostic: Diagnostic, options?: AnnotationOptions): string; export declare function encodeAnnotations(diagnostics: Diagnostic[], options?: AnnotationOptions): string; export declare function audit(config?: AuditConfig): Promise; /** * Rewrite `--kebab-case` flags to `--kebabCase` before cac parses argv. * * cac registers boolean options under their camelCase name, but its mri * parser sees the raw `--dry-run` token, does not recognise it as boolean, * and swallows the next positional as the flag's value * (`install --dry-run ./app` lost `./app`). The camelCase spelling is the * one cac stores, so mri then treats it as boolean and value-taking flags * keep working. `--no-*` negations and everything after `--` are untouched. */ export declare function normalizeCliArgv(argv: readonly string[]): string[]; export declare function checkBuildQuality(projectInfo: ProjectInfo): Promise; export declare function checkDeps(projectInfo: ProjectInfo): Promise; /** * A rule severity level as accepted in user config. `off` disables a rule * (removing it from the resolved preset base); the other three mirror the * internal {@link import('../types.js').Severity} vocabulary. */ export declare const LevelSchema: z.ZodEnum<{ error: "error"; warn: "warn"; info: "info"; off: "off"; }>; /** * The accepted shape of a single `rules` entry. Doctor config only ever takes * a bare severity string (no `[level, options]` tuple, no `{ level }` object) — * this matches the historical hand-rolled validator exactly. */ export declare const RuleEntrySchema: z.ZodEnum<{ error: "error"; warn: "warn"; info: "info"; off: "off"; }>; /** A per-glob rule suppression inside `ignore.overrides`. */ export declare const IgnoreOverrideSchema: z.ZodObject<{ files: z.ZodArray; rules: z.ZodOptional>; }, z.core.$strip>; /** * Post-lint ignore controls (react.doctor parity). `rules` drops a rule's * findings (the rule still runs), `files` excludes globs from the scan, * `tags` turns off every rule carrying the tag (an explicit `rules` level * wins), and `overrides` drops findings for matching files — every rule, or * just the listed ones. */ export declare const IgnoreSchema: z.ZodObject<{ rules: z.ZodOptional>; files: z.ZodOptional>; tags: z.ZodOptional>>; overrides: z.ZodOptional; rules: z.ZodOptional>; }, z.core.$strip>>>; }, z.core.$strip>; /** * Visibility controls for one output surface. Includes win over excludes; * they never change a rule's severity or whether it runs. */ export declare const SurfaceControlsSchema: z.ZodObject<{ includeRules: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>; /** * Per-surface visibility: `cli` (printed/JSON report), `score` (counted in * the score), `prComment` (the `--pr-comment` body), `ciGate` (counted by * the `--fail-on` exit-code gate). */ export declare const SurfacesSchema: z.ZodObject<{ cli: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; score: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; prComment: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; ciGate: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; /** * The single source of truth for doctor config validation. Wraps the base * object in a `superRefine` that rejects any unknown rule id with a * `rules.` path, so a typo'd rule surfaces as an `InvalidConfigError` * rather than silently doing nothing. */ export declare const DoctorUserConfigSchema: z.ZodObject<{ $schema: z.ZodOptional; rootDir: z.ZodOptional; include: z.ZodOptional>; exclude: z.ZodOptional>; failOn: z.ZodOptional>; threshold: z.ZodOptional; preset: z.ZodOptional>; extends: z.ZodOptional>; fixExcludes: z.ZodOptional>; includeTestFiles: z.ZodOptional; scope: z.ZodOptional>; base: z.ZodOptional; rules: z.ZodOptional>; }, z.core.$catchall>>>>; ignore: z.ZodOptional>; files: z.ZodOptional>; tags: z.ZodOptional>>; overrides: z.ZodOptional; rules: z.ZodOptional>; }, z.core.$strip>>>; }, z.core.$strip>>; surfaces: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; score: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; prComment: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; ciGate: z.ZodOptional>; excludeRules: z.ZodOptional>; includeTags: z.ZodOptional>>; excludeTags: z.ZodOptional>>; includeCategories: z.ZodOptional>; excludeCategories: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$loose>; /** The inferred user-config type — the single source of truth for the shape. */ type DoctorUserConfigInput = z.infer; /** * Generate the JSON Schema for the user config. Built from the base object * (not the refined wrapper) so `z.toJSONSchema` emits the full property set, * including every enumerated rule id. The result is what gets written to * `schema.json` and served from the docs site. */ export declare function buildJsonSchema(): Record; type ConfigSource = 'flag' | 'ts' | 'mjs' | 'js' | 'json' | 'jsonc' | 'package.json' | 'built-in'; /** * User-authored config shape, inferred from {@link DoctorUserConfigSchema} so * the zod schema is the single source of truth for the accepted fields. */ type DoctorUserConfig = DoctorUserConfigInput; /** * Resolved + normalized config that audit consumes. `failOn` and `preset` are * narrowed from the schema-derived user shape; `rules` is the merged effective * severity map (preset base + user overrides minus explicit offs), so it never * carries `'off'`. */ interface ResolvedDoctorConfig { rootDir: string; include: string[]; exclude: string[]; failOn: NonNullable; threshold: number; rules: Record; preset: NonNullable; source: ConfigSource; configFile?: string; fixExcludes?: string[]; includeTestFiles?: boolean; ignore?: DoctorIgnoreConfig; surfaces?: DoctorSurfacesConfig; /** Default `--scope` (CLI flags win). */ scope?: NonNullable; /** Default `--base` ref for non-full scopes (CLI flags win). */ base?: string; } type DoctorIgnoreConfig = NonNullable; type DoctorSurfacesConfig = NonNullable; type DoctorSurface = keyof DoctorSurfacesConfig; type SurfaceControls = NonNullable; export declare function dedupeDeadCodeAgainstLint(deadCode: Diagnostic[], lint: Diagnostic[]): Diagnostic[]; export declare class DeadCodeTimeoutError extends Error { name: "DeadCodeTimeoutError"; constructor(timeoutMs: number); } export declare class DeadCodeImportFailed extends Error { name: "DeadCodeImportFailed"; constructor(cause?: unknown); } interface CheckDeadCodeOptions { projectInfo: ProjectInfo; doctorConfig: ResolvedDoctorConfig; enabled: boolean; timeoutMs?: number; } export declare function checkDeadCode(options: CheckDeadCodeOptions): Promise; export declare function checkNuxtProject(projectInfo: ProjectInfo): Promise; export declare const BUILT_IN_RECOMMENDED: Omit; interface CliOverrides { include?: string[]; exclude?: string[]; failOn?: 'error' | 'warn' | 'none'; threshold?: number; rules?: Record; fixExcludes?: string[]; includeTestFiles?: boolean; } export declare function mergeCliOverrides(resolved: ResolvedDoctorConfig, cli: CliOverrides): ResolvedDoctorConfig; export declare class ConfigFileNotFoundError extends Error { name: "ConfigFileNotFoundError"; constructor(path: string); } export declare class ConfigCycleError extends Error { name: "ConfigCycleError"; constructor(chain: string[]); } export declare class InvalidConfigError extends Error { name: "InvalidConfigError"; readonly issues: readonly z.core.$ZodIssue[]; constructor(message: string, issues?: readonly z.core.$ZodIssue[]); } interface ApplyConfigFiltersOptions { readonly ignore?: DoctorIgnoreConfig; readonly surfaces?: DoctorSurfacesConfig; readonly failOn: 'error' | 'warn' | 'none'; readonly includeTestFiles?: boolean; /** Which surface the printed report is for. Default `cli`. */ readonly outputSurface?: 'cli' | 'prComment'; } /** * react.doctor `isDiagnosticOnSurface`: includes (rule, category, tag) win * over excludes. Unlike react.doctor there are no built-in default * exclusions \u2014 an unconfigured surface shows everything, so the score * stays identical for configs that never mention `surfaces`. */ export declare function isDiagnosticOnSurface(diagnostic: Diagnostic, controls: SurfaceControls | undefined): boolean; /** * Apply the config `ignore` and `surfaces` controls to an already * rule-filtered report (see `filterReportByRules`). * * - `ignore.rules` / `ignore.files` / `ignore.overrides` drop findings * from every surface. * - `surfaces.cli` (or `prComment` for the PR-comment body) decides which * findings the report lists; `surfaces.score` which ones count toward the * score and the severity counts; `surfaces.ciGate` which ones the * `--fail-on` gate sees (exposed as `report.gate`). The scored and gated * findings are kept as `scoredDiagnostics` / `gatedDiagnostics` so a * `--project` roll-up and `--push` can use them. * * Test/story findings stay out of the score and gate unless * `includeTestFiles` is set, matching `audit()`. A crashed-pass exit 2 is * preserved. With neither `ignore` nor `surfaces` configured the report is * returned unchanged. */ export declare function applyConfigFilters(report: AuditReport, options: ApplyConfigFiltersOptions): AuditReport; type RuleLevel = Severity | 'off'; interface SetRuleLevelOptions { readonly dir: string; readonly ruleId: string; readonly level: string; /** Plan the edit without writing. */ readonly dryRun?: boolean; } interface SetRuleLevelResult { /** The config file that was (or would be) written. */ readonly path: string; /** True when no config existed and a `doctor.config.json` was created. */ readonly created: boolean; readonly level: RuleLevel; readonly content: string; } export declare function isRuleLevel(value: string): value is RuleLevel; /** The registry default severity for a rule id, or `null` when unknown. */ export declare function defaultRuleLevel(ruleId: string): Severity | null; /** * Insert or update `rules['']` in a TS/JS config without a full AST * round-trip, so comments and formatting survive. Handles the shapes * `init` writes (`defineConfig({ ... })`, `export default { ... }`), with * or without an existing `rules` block. Returns `null` when the file has a * shape it cannot edit safely. */ export declare function upsertRuleInSource(source: string, ruleId: string, level: RuleLevel): string | null; /** * Set a rule's level in the project's doctor config, the way `init` lays it * out: an existing `doctor.config.{ts,mts,js,mjs}` is edited in place, a * `doctor.config.json{,c}` or `package.json#doctor` is edited as data, and * with no config at all a `doctor.config.json` is created. Throws on an * unknown rule id or level, or a TS/JS config it cannot edit safely. */ export declare function setRuleLevel(options: SetRuleLevelOptions): Promise; export declare function defineConfig(config: T): T; interface LoadDoctorConfigOptions { readonly explicitPath?: string; readonly presetOverride?: string; } export declare function loadDoctorConfig(rootDir: string, explicitPathOrOptions?: string | LoadDoctorConfigOptions): Promise; /** * Validate a raw, untrusted config object against the zod schema — the single * source of truth. Throws {@link InvalidConfigError} (carrying the full zod * issue list) on the first failure, mirroring the legacy validator's * throw-on-first-error contract. */ export declare function validateConfig(raw: unknown): void; export declare function detectProject(rootDirectory: string): Promise; type InitConfigFormat = 'ts' | 'json' | 'package-json'; type InitPreset = 'recommended' | 'strict' | 'minimal'; interface RawInitAnswers { target?: InitConfigFormat; preset?: InitPreset; threshold?: number; exclude?: string; } interface ResolvedInitAnswers { configFormat: InitConfigFormat; preset: InitPreset; threshold: number | undefined; exclude: string[] | undefined; } interface InitOptions { dir: string; configFormat: InitConfigFormat; preset: InitPreset; threshold: number | undefined; exclude: string[] | undefined; binName: string; } interface InitFileWrite { path: string; content: string; } interface InitPlan { writes: InitFileWrite[]; conflict: boolean; conflictPath: string | null; } export declare function parseExcludeList(raw: string | undefined): string[] | undefined; export declare function normalizeInitAnswers(raw: RawInitAnswers): ResolvedInitAnswers; export declare function renderDetectSummary(project: ProjectInfo, sfcCount: number): string; export declare function detectSummary(dir: string): Promise; export declare function planInit(options: InitOptions): Promise; type CiProvider = 'github' | 'gitlab' | 'unknown'; /** * Detects the CI provider from an explicit env snapshot. Takes the env as an * argument (instead of reading process.env) so provider detection stays a * deterministic, fully-testable pure function. */ export declare function detectCiProvider(env: Readonly>): CiProvider; type DoctorBin = 'vue-doctor' | 'nuxt-doctor'; interface AgentHooksOptions { readonly projectRoot: string; readonly bin: DoctorBin; } interface AgentHookWrite { readonly path: string; readonly content: string; } /** Seconds Cursor waits for the stop hook before giving up. */ export declare const AGENT_HOOK_TIMEOUT_SECONDS = 120; /** Follow-up turns a Cursor stop hook may trigger before it stays quiet. */ export declare const AGENT_HOOK_MAX_CONTINUATIONS = 1; export declare function claudeHookCommand(bin: DoctorBin): string; export declare function cursorHookCommand(bin: DoctorBin): string; /** * The end-of-turn hook script (react.doctor 0.9.13 behavior). It runs the * doctor on the files changed in the working tree; on findings it asks the * agent to keep going (Claude Code `Stop` → `{ decision: 'block' }`, Cursor * `stop` → `{ followup_message }`) with the report on stdout. Clean runs, * doctor errors (exit 2), a missing runner, or a re-entrant stop exit 0 * silently so the hook can never wedge the agent. */ export declare function buildAgentHookScript(bin: DoctorBin, event: 'Stop' | 'stop'): string; /** * Plan the Claude Code + Cursor hook files. Existing settings are merged, * never replaced: only our own hook entries are stripped and re-added (so a * re-run is idempotent), every other key, event, and hook survives. */ export declare function planAgentHooks(options: AgentHooksOptions): AgentHookWrite[]; /** Write the planned hook files, creating parent directories. */ export declare function writeAgentHooks(writes: readonly AgentHookWrite[]): void; interface CiScaffoldOptions { bin: 'vue-doctor' | 'nuxt-doctor'; framework: 'vue' | 'nuxt'; dir: string; provider?: 'github' | 'gitlab' | 'auto'; pr?: boolean; noComments?: boolean; force?: boolean; env?: Readonly>; /** * Project directory relative to `dir` (the repository root) when the * project is a nested package. Emitted as the action's * `working-directory` (GitHub) or a `cd` (GitLab). Omit or `''` for a * project at the repository root. */ workingDirectory?: string; } interface CiScaffoldPlan { writes: InitFileWrite[]; conflict: boolean; conflictPath: string | null; provider: 'github' | 'gitlab'; } export declare function scaffoldCiWorkflow(opts: CiScaffoldOptions): Promise; interface MonorepoResult { root: string; kind: MonorepoKind; } export declare function findMonorepoRoot(rootDirectory: string): Promise; interface ApplyInlineDisablesOptions { respect: boolean; } export declare function applyInlineDisables(diags: Diagnostic[], opts: ApplyInlineDisablesOptions): Diagnostic[]; interface DirectiveRange { start: number; end: number; rules: string[]; } interface DirectiveLine { line: number; rules: string[]; } interface DirectiveSet { blocks: DirectiveRange[]; nextLine: DirectiveLine[]; sameLine: DirectiveLine[]; } export declare function parseDirectives(text: string): DirectiveSet; type GitScopeMode = 'diff' | 'staged' | 'changed-from'; interface GitScopeOptions { rootDir: string; mode: GitScopeMode; ref?: string; includeUntracked?: boolean; } export declare function listChangedFiles(options: GitScopeOptions): Promise; /** * Environment for spawned `git` processes. Git sets `GIT_DIR` (and sometimes * `GIT_WORK_TREE`) when it runs a hook; inherited into a child `git` they pin * repository discovery to the hook's repo instead of `cwd`, which breaks * linked worktrees (`--staged` from a worktree's pre-commit hook). Clearing * both lets git rediscover the repository from `cwd`. `GIT_INDEX_FILE` is * deliberately kept: during a commit it points at the index being committed. */ export declare function gitEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv; /** * Top-level directory of the git checkout containing `dir` — for a linked * worktree that is the worktree root, not the main repository. `null` when * `dir` is not inside a git checkout (or git is unavailable). */ export declare function findGitRoot(dir: string): Promise; export declare const MIN_WARNING_EXIT_CODE = 2; export declare const MAX_WARNING_EXIT_CODE = 255; /** * Parse the `--warning-exit-code ` CLI value. Accepts a plain decimal * integer in 2-255: 0 and 1 already mean pass/fail, and POSIX exit statuses * cap at 255. Anything else throws so the CLI exits 2 instead of silently * falling back. */ export declare function parseWarningExitCode(value: string | number): number; interface ResolveExitCodeOptions { readonly failOn: 'error' | 'warn' | 'none'; readonly warningExitCode?: number; } /** * Final process exit code for an audit. Without `warningExitCode` this is * `report.exitCode` verbatim. With it, a run whose gate-relevant findings * are warnings only (no errors) exits with that code instead of 0 / 1, so a * CI job can tell "warnings only" apart from a hard failure (e.g. GitLab * `allow_failure.exit_codes`). Errors still exit 1, a crashed pass still * exits 2, and `failOn: 'none'` keeps the run advisory (exit 0). */ export declare function resolveExitCode(report: Pick, options: ResolveExitCodeOptions): number; interface PositionalScanInput { /** Project root the audit runs from. */ readonly rootDir: string; /** * Absolute files to restrict findings to. `undefined` means "the whole * project" (the historical single-`[path]` behavior). */ readonly scopeFiles: string[] | undefined; } /** * Resolve the positional CLI arguments into a project root plus an optional * file scope. * * - No args → the current directory, whole project. * - Exactly one arg that is a directory (or does not exist — the audit then * reports it as before) → that directory is the project root, whole * project. This keeps `vue-doctor ` backward compatible. * - Otherwise every arg is a file or directory INSIDE the current directory, * which becomes the project root; findings are restricted to the given * files plus the source files under the given directories. */ export declare function resolvePositionalScanInput(paths: readonly string[], cwd?: string): Promise; interface WorkspacePackage { name: string; dir: string; } export declare function listWorkspacePackages(rootDir: string): Promise; interface NestedWorkspaceExclusion { /** Workspace packages strictly below the scanned dir that were excluded. */ readonly excluded: WorkspacePackage[]; /** Exclude globs (relative to the scanned dir) for the excluded packages. */ readonly globs: string[]; } /** * Workspace packages are their own projects: each has its own package.json, * framework, and doctor config. Scanning an ancestor directory must not judge * a nested package's files against the ancestor's settings, so every pnpm * workspace package strictly below `rootDir` is excluded from that scan. * * A package is kept (explicitly selected) when one of `selectedFiles` lives * inside it — e.g. `vue-doctor packages/a/App.vue` run from the repo root. * Packages selected with `--project` are audited by their own scan, so they * stay excluded from any ancestor scan and are never counted twice. */ export declare function findNestedWorkspaceExclusion(rootDir: string, selectedFiles?: readonly string[]): Promise; /** * True when the path points at a Nuxt page component — a `.vue` file under * `pages/` (Nuxt 3 layout) or `app/pages/` (Nuxt 4 layout) at the project root. */ export declare function isNuxtPageFile(relPath: string): boolean; /** * True when the path points at a Nitro server file — a `.ts` file under the * project-root `server/` directory. */ export declare function isNuxtServerFile(relPath: string): boolean; /** * True when the path points at a Nuxt layout component — a `.vue` file under * `layouts/` (Nuxt 3 layout) or `app/layouts/` (Nuxt 4 layout) at the project * root. */ export declare function isNuxtLayoutFile(relPath: string): boolean; interface CrossFilePassOptions { files: string[]; projectInfo: ProjectInfo; } export declare function runCrossFilePass(opts: CrossFilePassOptions): Promise; export declare class OxlintSpawnFailed extends Error { name: "OxlintSpawnFailed"; constructor(exitCode: number | null, stderr: string); } export declare class OxlintOutputTooLarge extends Error { name: "OxlintOutputTooLarge"; constructor(maxBytes: number); } export declare function agentReport(input: ReporterInput, options?: ReporterOptions): string; interface FindingCounts { /** Findings the report lists. */ readonly listed: number; /** Findings that count toward the score and severity counts. */ readonly scored: number; /** Listed test/story-file findings left out of the score and the gate. */ readonly unscoredTestFiles: number; } /** * Listed vs scored totals for a report. Test/story-file findings are listed * but stay out of the score and the `--fail-on` gate unless * `includeTestFiles` is set, so the two totals can differ. */ export declare function findingCounts(input: ReporterInput): FindingCounts; /** * True when `path` looks like a test, story, or fixture file rather than * shipped production source. * * `path` must be RELATIVE to the audited project root. Absolute paths would * classify by segments of the machine's directory layout (e.g. a project * checked out under ~/dev/tests/) instead of the project's own structure. */ export declare function isTestSurfacePath(path: string): boolean; /** * The findings that count toward the score and the gate: every finding when * `includeTestFiles` is set, else only production-surface ones. */ export declare function scoredSurfaceDiagnostics(diagnostics: readonly T[], includeTestFiles: boolean): T[]; type FindingSets = Pick; /** The findings a report's score and severity counts cover. */ export declare function scoredFindings(report: FindingSets, includeTestFiles: boolean): Diagnostic[]; /** The findings a report's `--fail-on` gate sees. */ export declare function gatedFindings(report: FindingSets, includeTestFiles: boolean): Diagnostic[]; export declare function docsUrl(ruleId: string): string; export declare function sarifReport(input: ReporterInput): string; interface VerboseTraceOptions { configSource?: ConfigSource; } export declare function renderVerboseTrace(report: AuditReport, options: VerboseTraceOptions): string; type ReporterFormat = 'agent' | 'pretty' | 'json' | 'json-compact' | 'sarif' | 'html' | 'pr-comment'; export declare function format(input: ReporterInput, kind?: ReporterFormat, options?: ReporterOptions): string; export declare const DOCTOR_REPORT_SCHEMA_VERSION = "1"; interface DoctorReportDiagnostic { file: string; line: number; column: number; endLine?: number; endColumn?: number; ruleId: string; severity: Severity; message: string; source: string; recommendation?: string; surface?: 'test'; fingerprint?: string; } interface DoctorReportBreakdownEntry { ruleId: string; occurrences: number; weightPerOccurrence: number; penalty: number; } interface DoctorReport { schemaVersion: string; tool: { name: string; version: string; }; projectInfo: { framework: string; frameworkDetected: boolean; vueVersion: string | null; nuxtVersion: string | null; capabilities: string[]; rootDirectory: string; }; score: { value: number; threshold: number; passed: boolean; bySeverity: { error: number; warn: number; info: number; }; breakdown: DoctorReportBreakdownEntry[]; byDimension: Record; }; /** * Listed vs scored totals. `unscoredTestFiles` listed test/story-file * findings are left out of the score and the `--fail-on` gate. */ counts: FindingCounts; diagnostics: DoctorReportDiagnostic[]; timing: { elapsedMs: number; analyzedFileCount: number; }; incomplete?: boolean; skippedCheckReasons?: SkippedCheckReason[]; sourceRevision?: string; configHash?: string; baseline?: BaselineSummary; scope?: ReportScope; } export declare function buildDoctorReport(input: ReporterInput): DoctorReport; export declare function jsonReport(input: ReporterInput): string; export declare function jsonCompactReport(input: ReporterInput): string; export declare function prCommentReport(input: ReporterInput): string; export declare function prettyReport(input: ReporterInput, options?: ReporterOptions): string; interface RuleDoc { readonly id: string; readonly title: string; readonly severity: string; readonly category: string; readonly tags: readonly string[]; readonly recommended: boolean; readonly source: string; readonly helpUri: string; readonly description: string; readonly hasOverride: boolean; } interface LoadRuleDocOptions { readonly docsRoot?: string; } export declare function loadRuleDoc(ruleId: string, options?: LoadRuleDocOptions): RuleDoc | null; export declare function loadAllRuleDocs(options?: LoadRuleDocOptions): RuleDoc[]; /** * Filter `report.diagnostics` to a known set of allowed rule ids, then * recompute `score`, `errorCount`, `warnCount`, `infoCount`, `scoreResult`, * `ruleCounts`, and `exitCode` from the filtered array. * * Why: the CLI layer calls `audit()` and then applies its own * `allowedRuleIds` filter to drop suppressed (`off`) and preset-excluded * (`info` rules not in `recommended`) diagnostics. The audit's own * `score`/`counts` are computed BEFORE the CLI filter, so they still * include the suppressed findings. That desync surfaces to consumers * (the SaaS `--push` payload, the dashboard's counts-but-no-findings bug) * and to the `score` itself (suppressed findings still penalize). * * Invariant enforced here (over the SCORED subset — see includeTestFiles): * errorCount + warnCount + infoCount === scored.length * scoreResult.totalFindings === scored.length * * `exitCode=2` (oxlint crash) is preserved verbatim; `exitCode=1` is * recomputed from the surviving counts + the `failOn` gate. * * Test/story-surface diagnostics survive the filter (they stay visible in * the report) but are excluded from the score and gate unless * `includeTestFiles` is set — the same contract `audit()` applies. */ export declare function filterReportByRules(report: AuditReport, allowedRuleIds: ReadonlySet, failOn?: 'error' | 'warn' | 'none', oxlintStderr?: string, includeTestFiles?: boolean): AuditReport; interface CategoryScopeInput { categories?: readonly string[]; dimensions?: readonly string[]; } /** * Resolve `--category` + `--dimension` inputs to the concrete set of * RuleCategory values they cover. Returns undefined when no scope was * requested (run everything). Throws on an unknown category/dimension so the * CLI can exit 2 rather than silently ignore a typo. */ export declare function resolveCategoryScope(input: CategoryScopeInput): ReadonlySet | undefined; /** * Narrow `ruleIds` to those whose registered category is in `scope`. RuleIds * not in the registry are dropped (a category scope is an explicit allowlist). */ export declare function filterRuleIdsByCategory(ruleIds: Iterable, scope: ReadonlySet): Set; /** * The 6 fields the SaaS receives for each finding. * Everything else (message, codeSnippet, recommendation, etc.) is privacy-sensitive * and MUST be stripped before transmission. */ interface PushedFinding { file: string; line: number; col: number; ruleId: string; severity: Severity; category: string; } interface PushPayloadInput { project: string; score: number; errorCount: number; warnCount: number; infoCount: number; /** Monorepo sub-app path (e.g. "packages/v-maplibre"); omitted = single-app repo. */ workspace?: string; findings: PushedFinding[]; } interface PushPayload extends PushPayloadInput { commitSha?: string; branch?: string; prNumber?: number; } interface PushOptions { project: string; /** Monorepo sub-app path forwarded to the SaaS so two frameworks in one repo keep separate score series. */ workspace?: string; score: number; errorCount: number; warnCount: number; infoCount: number; diagnostics: Diagnostic[]; /** Project root used to relativize absolute finding file paths. */ rootDir?: string; url: string; apiKey: string; fetchImpl?: typeof fetch; /** Overrides for the request timeout (ms). Defaults to 5000. Test-only. */ timeoutMs?: number; } type PushResult = { ok: true; status?: number; error?: undefined; } | { ok: false; status?: number; error: string; }; /** Environment variable the CLIs read the SaaS API key from. */ export declare const API_KEY_ENV = "DOCTOR_API_KEY"; /** * The SaaS API key: the `--api-key` flag when set, else `DOCTOR_API_KEY`. * The env var keeps the key off argv, where `ps` and `npx` can show it. */ export declare function resolveApiKey(flag: string | undefined, env?: NodeJS.ProcessEnv): string | undefined; /** * Strip a list of Diagnostics down to the 6 allowed push fields. * Privacy boundary: this function is the single point of enforcement. * If you add a new privacy-sensitive field to Diagnostic, add it to the deny list here. * * Absolute file paths are relativized against rootDir so dashboards show * `src/Foo.vue` rather than the CI runner's `/home/runner/work//…`. */ export declare function stripFindings(diagnostics: Diagnostic[], rootDir?: string): PushedFinding[]; /** * Build the top-level POST body. CI fields (commitSha, branch, prNumber) are * included ONLY when the matching GITHUB_* env var is set. */ export declare function buildPushPayload(input: PushPayloadInput): PushPayload; /** * Strip + POST findings to a SaaS endpoint. Never throws — returns * `{ ok: false, error }` on any HTTP / network failure so the audit's * exit code is not affected by SaaS downtime. */ export declare function pushFindings(opts: PushOptions): Promise; export declare class BaselineError extends Error { constructor(message: string); } declare const BaselineReportSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<"1">; diagnostics: z.ZodArray; }, z.core.$loose>>; configHash: z.ZodOptional; sourceRevision: z.ZodOptional; baseline: z.ZodOptional; incomplete: z.ZodOptional; scope: z.ZodOptional>; }, z.core.$loose>; type BaselineReport = z.infer; /** * Read and validate a saved `--json` report for use as a baseline. Only a * complete, full-scope, non-comparison report from a version that records * fingerprints and a config hash is accepted — anything else would make * pre-existing findings look new (or hide new ones). */ export declare function readBaselineReport(file: string): BaselineReport; interface ApplyBaselineOptions { /** Path as given on the CLI (echoed in the summary). */ readonly baselineFile: string; readonly failOn: 'error' | 'warn' | 'none'; readonly includeTestFiles?: boolean; /** * Absolute head paths a `--scope` run covered. Baseline findings outside * them are ignored instead of being counted as fixed. */ readonly scopeFiles?: ReadonlySet; } /** * Narrow `report` to findings that are NEW relative to a saved baseline * report. The score is untouched (computed on all current findings); the * gate, severity counts, and displayed diagnostics cover new findings only, * and `report.baseline` records matched / new / fixed counts. */ export declare function applyBaseline(report: AuditReport, options: ApplyBaselineOptions): Promise; /** * Every setting that changes WHICH findings a scan can produce. Two reports * are only comparable as baseline/head when these match. */ interface ConfigHashInput { readonly rules: Readonly>; readonly include: readonly string[]; readonly exclude: readonly string[]; readonly respectInlineDisables: boolean; readonly lint: boolean; readonly deadCode: boolean; /** Config `ignore` / `surfaces` controls (any JSON-serializable shape). */ readonly filters?: unknown; } export declare function computeConfigHash(input: ConfigHashInput): string; /** One hash for a multi-project (`--project`) run: order-independent. */ export declare function combineConfigHashes(hashes: readonly string[]): string; /** The fields the delta matcher reads from a head or base diagnostic. */ interface DeltaDiagnostic { readonly file: string; readonly line: number; readonly ruleId: string; readonly message: string; readonly fingerprint?: string; } interface DiagnosticDeltaInput { readonly head: readonly H[]; readonly base: readonly DeltaDiagnostic[]; /** base file → head file, for files renamed between the two revisions. */ readonly renamedFiles?: ReadonlyMap; /** Maps a base line onto the head revision (git line-shift). */ readonly mapBaseLine?: (baseFile: string, line: number) => number; } interface DiagnosticDelta { readonly newDiagnostics: H[]; readonly matchedCount: number; readonly fixedCount: number; } /** * Count-based delta between a head scan and a base scan. * * Diagnostics are grouped by (file, ruleId), following renames. A group whose * head count does not exceed its base count reports nothing new — formatting * churn and moved code never surface as regressions. Only a group whose count * grew reports exactly `head − base` new findings; which ones is decided by * fingerprint + message, then fingerprint, then message (closest line wins), * and finally by message similarity / line distance. */ export declare function computeDiagnosticDelta(input: DiagnosticDeltaInput): DiagnosticDelta; /** * The source text a diagnostic points at, whitespace-collapsed. A span with an * end position yields exactly that span; a point diagnostic yields its whole * line. Falls back to the message when the source is unavailable, so every * diagnostic still carries a stable identity. */ export declare function diagnosticEvidence(diagnostic: Diagnostic, lines: readonly string[] | undefined): string; /** * Stable identity for a diagnostic: rule id + rootDir-relative POSIX path + * normalized source evidence. Line and column numbers are deliberately NOT * part of it, so unrelated edits that shift code up or down keep the * fingerprint unchanged. */ export declare function fingerprintDiagnostic(diagnostic: Diagnostic, rootDir: string, lines: readonly string[] | undefined): string; export declare function attachFingerprints(diagnostics: readonly Diagnostic[], rootDir: string): Promise; interface NarrowReportOptions { readonly failOn: 'error' | 'warn' | 'none'; readonly includeTestFiles?: boolean; } /** * Narrow a report to a subset of its findings (the new ones vs a baseline, * or the ones on changed lines) WITHOUT touching the score. * * The score — plus its `breakdown` / `byDimension` explanation and the * threshold `passed` verdict — stays computed over the report's full current * findings with the unchanged √-decay formula. Everything a gate or summary * reads (displayed diagnostics, severity counts, `ruleCounts`, the `--fail-on` * exit code) is recomputed from the kept subset only, still honouring the * report's `scoredDiagnostics` / `gatedDiagnostics` (config `surfaces`). An * oxlint-crash exit 2 is preserved. */ export declare function narrowReport(report: AuditReport, kept: readonly Diagnostic[], options: NarrowReportOptions): AuditReport; /** One `@@ -oldStart,oldCount +newStart,newCount @@` hunk (1-based lines). */ interface Hunk { readonly oldStart: number; readonly oldCount: number; readonly newStart: number; readonly newCount: number; } interface FileChange { /** rootDir-relative POSIX path in the working tree (head side). */ readonly path: string; /** rootDir-relative path on the base side; `null` for added files. */ readonly oldPath: string | null; readonly status: 'added' | 'modified' | 'renamed'; readonly hunks: readonly Hunk[]; } interface ChangeSetOptions { readonly rootDir: string; /** Diff against this revision (working tree vs ref). Omit for `HEAD`. */ readonly ref?: string; /** Compare the index against HEAD instead of the working tree. */ readonly cached?: boolean; /** Fold non-ignored untracked files in as whole-file additions. */ readonly includeUntracked?: boolean; } /** * Parse `git diff --unified=0 --find-renames` output into per-file changes. * Deleted files (`+++ /dev/null`) are dropped: they have no head-side lines. */ export declare function parseUnifiedDiff(stdout: string): FileChange[]; /** * Map a base-revision line onto the head revision using a file's hunks. Lines * inside a changed region map to the start of that region. */ export declare function mapLineThroughHunks(hunks: readonly Hunk[], line: number): number; /** `git rev-parse HEAD` for `rootDir`, or `undefined` outside a git checkout. */ export declare function readSourceRevision(rootDir: string): Promise; /** * Collect the changed files (with hunks) between `ref` and the working tree, * or between HEAD and the index when `cached` is set. Paths are relative to * `rootDir` (`--relative`), so monorepo subdirectory runs stay scoped. */ export declare function readChangeSet(options: ChangeSetOptions): Promise; export declare const SCOPE_MODES: readonly ScopeMode[]; export declare function isScopeMode(value: unknown): value is ScopeMode; export declare class ScopeError extends Error { constructor(message: string); } /** The deprecated pre-`--scope` flags, kept working as exact aliases. */ type LegacyScopeFlag = 'diff' | 'staged' | 'changed-files-from'; interface ScopeRequest { readonly mode: ScopeMode; /** Base ref; defaults to the merge-base with the default / PR base branch. */ readonly base?: string; /** Use the git index (staged changes vs HEAD) as the change set. */ readonly staged?: boolean; readonly includeUntracked?: boolean; /** Set when the request came from a deprecated alias flag. */ readonly legacy?: LegacyScopeFlag; } interface ScopePlan { readonly mode: Exclude; /** The ref as requested or detected (e.g. `origin/main`); absent for staged. */ readonly base?: string; /** Revision the change set was diffed against (merge-base sha or `HEAD`). */ readonly diffBase: string; /** Changed source files with their hunks (rootDir-relative paths). */ readonly changes: readonly FileChange[]; /** Absolute paths of the changed source files. */ readonly files: readonly string[]; } /** * The branch a change should be compared against: the PR base on CI * (`GITHUB_BASE_REF`), else `origin/HEAD`, else a local `main` / `master` * (preferring its `origin/` counterpart when present). */ export declare function detectDefaultBase(rootDir: string): Promise; /** * Resolve a `--scope` request into a concrete change set. Returns `null` for * `full` (nothing to compute). Throws {@link ScopeError} for an unresolvable * base so the CLI exits 2 instead of silently scanning nothing. */ export declare function resolveScopePlan(rootDir: string, request: ScopeRequest): Promise; interface BaseSnapshot { /** Temp directory mirroring the base revision of the changed files. */ readonly root: string; /** Absolute snapshot paths that were materialized. */ readonly files: readonly string[]; readonly cleanup: () => void; } /** * Write the base-revision content of every changed file that existed at * `plan.diffBase` into a temp tree at the same relative paths (renamed files * at their OLD path). Added files have no base side and are skipped. */ export declare function materializeBaseSnapshot(rootDir: string, plan: ScopePlan): Promise; interface CompareWithBaseOptions { readonly rootDir: string; /** * Audit the snapshot with the SAME settings as the head run (rules, * filters, include/exclude), scoped to `files`, dead-code off. */ readonly auditBase: (snapshotRoot: string, files: readonly string[]) => Promise; } interface BaseComparison { /** The head diagnostics this change introduced. */ readonly newDiagnostics: readonly Diagnostic[]; readonly summary: BaselineSummary; } /** * `--scope changed`: find the findings this change introduced by auditing * the base revision of the changed files and running the same count-based * delta as `--baseline`. */ export declare function compareWithBaseRevision(report: AuditReport, plan: ScopePlan, options: CompareWithBaseOptions): Promise; interface ScopeFlags { readonly scope?: string; readonly base?: string; readonly full?: boolean; readonly diff?: boolean; readonly staged?: boolean; readonly changedFilesFrom?: string; readonly includeUntracked?: boolean; } interface ScopeConfigDefaults { readonly scope?: ScopeMode; readonly base?: string; } /** * Translate CLI flags (+ config defaults) into a {@link ScopeRequest}. * * The deprecated selectors stay exact aliases of `--scope files`: * `--diff` = files changed vs HEAD (untracked folded in), `--staged` = files * in the index, `--changed-files-from ` = files changed vs `` * (direct diff, no merge-base). `--full` always wins. Conflicting selectors * throw {@link ScopeError} (CLI exit 2). */ export declare function scopeRequestFromFlags(flags: ScopeFlags, config?: ScopeConfigDefaults): ScopeRequest; interface ScopeGate { readonly failOn: 'error' | 'warn' | 'none'; readonly includeTestFiles?: boolean; } interface ApplyScopeOptions { readonly rootDir: string; /** * Skip the base-revision audit for `changed`: a `--baseline` report * replaces the git base as the comparison point. */ readonly skipBaseComparison?: boolean; readonly auditBase: (snapshotRoot: string, files: readonly string[]) => Promise; } interface ScopedReport { /** The input report tagged with `scope`; findings NOT yet narrowed. */ readonly report: AuditReport; /** Filter to apply (after any --baseline) via {@link finishScopedReport}. */ readonly keep?: (d: Diagnostic) => boolean; /** Base-revision delta summary (`changed`). */ readonly summary?: BaselineSummary; } /** * Evaluate a resolved scope plan against a report already restricted to the * plan's files. Narrowing is returned as a `keep` predicate rather than * applied, so multi-project aggregation and `--baseline` can run on the full * set of changed-file findings first (the score stays theirs). */ export declare function applyScopePlan(report: AuditReport, plan: ScopePlan, options: ApplyScopeOptions): Promise; interface ScopeParts { readonly scopeFiles?: readonly string[]; readonly keep?: (d: Diagnostic) => boolean; readonly summary?: BaselineSummary; } /** Combine per-project scope results for a `--project` aggregate run. */ export declare function mergeScopeParts(parts: readonly ScopeParts[]): ScopeParts; interface FinishScopeOptions extends ScopeGate { readonly keep?: (d: Diagnostic) => boolean; readonly summary?: BaselineSummary; } /** * Apply a deferred scope filter (and attach the base-revision summary). The * score is left as computed over the changed files' full findings. */ export declare function finishScopedReport(report: AuditReport, options: FinishScopeOptions): AuditReport; /** * Head-side lines after which a pure deletion happened (`0` = top of file). * A deletion belongs to an owner that spans both sides of the gap. */ export declare function deletionPoints(change: FileChange): number[]; /** * `--scope contextual`: keep a diagnostic when its own span touches a changed * line, OR when its owner — the rule's declared `diffScope` (template * element, function, component, file), or explicit `contextRanges` — contains * an edit or a deletion. Rules without an owner keep line matching, and an * owner that cannot be resolved (parse error, no enclosing node) falls back * to line matching too. */ export declare function createContextualMatcher(rootDir: string, changes: readonly FileChange[], readSource?: (file: string) => string): (d: Diagnostic) => boolean; /** * Which code a finding belongs to for `--scope contextual`: a finding is * reported when its owner's range intersects the change. The Vue-native * analogue of react.doctor's `diffScope` (`jsx-element` → `template-element`, * plus `component` for SFC-level structure). */ type DiffScope = 'line' | 'template-element' | 'function' | 'component' | 'file'; /** Explicit owner declarations; every other rule keeps `line` matching. */ export declare const RULE_DIFF_SCOPES: ReadonlyMap; export declare function getRuleDiffScope(ruleId: string): DiffScope; /** Inclusive 1-based line interval. */ type LineRange = readonly [start: number, end: number]; /** Head-side line ranges a change added or rewrote (pure deletions excluded). */ export declare function addedLineRanges(change: FileChange): LineRange[]; export declare function rangesIntersect(a: readonly LineRange[], b: readonly LineRange[]): boolean; /** A diagnostic's own source span as a line range. */ export declare function diagnosticRange(d: Diagnostic): LineRange; /** * `--scope lines`: keep a diagnostic only when its source span touches a * changed line. Line numbers are head-side, so renames and shifted code are * handled by git's own hunk math. */ export declare function createLinesMatcher(rootDir: string, changes: readonly FileChange[]): (d: Diagnostic) => boolean; /** * Resolve the line ranges a diagnostic's owner covers, or `null` when the * owner cannot be found (the matcher then keeps plain line matching). */ export declare function resolveOwnerRanges(filePath: string, source: string, d: Diagnostic, scope: Exclude): LineRange[] | null; export { type AgentHookWrite, type AgentHooksOptions, type AnnotationOptions, type ApplyBaselineOptions, type ApplyConfigFiltersOptions, type ApplyInlineDisablesOptions, type ApplyScopeOptions, type AuditConfig, type AuditReport, type AuditTimings, type BaseComparison, type BaseSnapshot, type BaselineReport, type BaselineSummary, type Capability, type ChangeSetOptions, type CiProvider, type CiScaffoldOptions, type CiScaffoldPlan, type CliOverrides, type CompareWithBaseOptions, type ConfigHashInput, type ConfigSource, type DeltaDiagnostic, type Diagnostic, type DiagnosticDelta, type DiagnosticDeltaInput, type DiagnosticSource, type DiffScope, type DimensionScore, type DirectiveLine, type DirectiveRange, type DirectiveSet, type DoctorBin, type DoctorIgnoreConfig, type DoctorReport, type DoctorSurface, type DoctorSurfacesConfig, type DoctorUserConfig, type DoctorUserConfigInput, type FileChange, type FindingCounts, type FinishScopeOptions, type Framework, type GitScopeMode, type Hunk, type InitConfigFormat, type InitFileWrite, type InitOptions, type InitPlan, type InitPreset, type LegacyScopeFlag, type LineRange, type ListRulesFilter, type LoadRuleDocOptions, type MonorepoKind, type MonorepoResult, type NarrowReportOptions, type NestedWorkspaceExclusion, type PositionalScanInput, type ProjectInfo, type ProjectInfoLite, type PushOptions, type PushPayload, type PushPayloadInput, type PushResult, type PushedFinding, type RawInitAnswers, type RegisteredRule, type ReportScope, type ReporterFormat, type ReporterInput, type ReporterOptions, type ResolveExitCodeOptions, type ResolvedDoctorConfig, type ResolvedInitAnswers, type RuleCategory, type RuleDefinition, type RuleDoc, type RuleLevel, type RuleSource, type RuleTag, type ScopeConfigDefaults, type ScopeFlags, type ScopeGate, type ScopeMode, type ScopeParts, type ScopePlan, type ScopeRequest, type ScopedReport, type ScoreBreakdownEntry, type ScoreConfig, type ScoreDimension, type ScoreResult, type SetRuleLevelOptions, type SetRuleLevelResult, type Severity, type SkippedCheckReason, type SurfaceControls, type VerboseTraceOptions, type WorkspacePackage, renderAgentPlaybook, renderRulePrompt }; //# sourceMappingURL=index.d.ts.map