/** * Spec coverage analysis: how much of the project surface is documented in specs. * * Two metrics: * - Linter rule coverage: % of enabled linter rules with enforce() declarations * - Script coverage: % of npm scripts documented in spec commands * * Configurable thresholds in .vigilesrc.json trigger warnings or errors when * coverage drops below the minimum. */ import { type GlobIgnore } from "./glob-ignore.js"; import type { CoverageThresholds } from "./types.js"; import type { ClaudeSpec } from "./spec.js"; export interface CoverageMetric { name: string; total: number; covered: number; percent: number; threshold: number | undefined; passing: boolean; /** Items that ARE covered. */ coveredItems: string[]; /** Items that are NOT covered. */ uncoveredItems: string[]; } export interface CoverageReport { metrics: CoverageMetric[]; passing: boolean; } /** * Read npm script names from package.json. Reuses readPackageScripts * from compile.ts and returns sorted keys. */ export declare function readNpmScripts(basePath: string): string[]; /** * Collect commands documented in specs by loading spec source files directly. * Reads the structured `commands` field — no markdown parsing. */ export declare function collectDocumentedCommands(basePath: string, specs: ClaudeSpec[] | undefined, ignore: GlobIgnore): Set; /** * Compute script coverage: what % of npm scripts are documented in specs. */ export declare function computeScriptCoverage(basePath: string, threshold: number | undefined, specs: ClaudeSpec[] | undefined, ignore: GlobIgnore): CoverageMetric; /** * Compute linter rule coverage from pre-computed totals. * The actual linter scanning is done by the existing discover() in cli.ts. */ export declare function computeLinterRuleCoverage(enabled: number, documented: number, threshold?: number): CoverageMetric; /** * Check all coverage metrics against thresholds. */ export declare function checkCoverage(basePath: string, thresholds: CoverageThresholds, linterEnabled: number, linterDocumented: number, specs: ClaudeSpec[] | undefined, ignore: GlobIgnore): CoverageReport; /** * Format coverage report as human-readable text. */ export declare function formatCoverageReport(report: CoverageReport): string; /** * What `vigiles lint` says under the linter-rule coverage line when some enabled * rules are undocumented. Empty when nothing is. * * 🔴 IT MUST NOT TELL ANYONE TO WRITE MORE INTO THE INSTRUCTION FILE. This used * to read "Consider adding enforce() rules for frequently-triggered undocumented * rules", which turns a coverage percentage into a to-do list for CLAUDE.md — * the one file whose every line is loaded into every request and every subagent. * An enabled linter rule is already enforced: the agent meets it as a failing * lint with the rule's own message. Documentation only earns its place where the * WHY is not in that message, and then it belongs where it is read on demand. */ export declare function undocumentedRulesAdvice(totals: Readonly<{ enabled: number; documented: number; }>): readonly string[]; //# sourceMappingURL=coverage.d.ts.map