/** * The per-repo harness optimizer's DETERMINISTIC spine — folded INLINE into the * default `vigiles audit` report (each finding carries its fix; NOT its own * `optimize` verb, and no longer a `--fix-plan` flag: until the measured A/B half * lands, an "optimizer" that only re-prints audit's findings doesn't earn a * separate surface; see research/roadmap.md §P2 "reconsider an `optimize` verb"). * * A2 in the measurement-authority pivot is the ADOPTION product: measure a user's * own skills/model/rules on their tasks and recommend add/drop/swap with a MEASURED * delta. The measured delta is the real-model layer (gated on the Pro/Max * subscription, costs tokens); this v0 ships the deterministic HALF — the free * pre-filter that runs on every commit with no model. * * It answers "what should I fix in my harness, and why" using only the cross-ref * findings the linter already computes: it reuses `scoreReport` for the headline * structural-health score and `explainScore` for the per-surface cause + one-line * fix (one-detector-no-drift — it never re-detects). The result is a prioritized, * typed action list — the spine the measured A/B (the behavioral delta) stacks on. * * This is the "linting as a free pre-filter to measurement" thesis made a command: * clear the structural dead-ends a model can't help with FIRST (free, certain), * THEN spend tokens measuring whether the structurally-clean skills earn their keep. * * Distinct from `vigiles explain` (which diagnoses ONE underperforming surface a * measurement flagged): `optimize` is the whole-repo adoption view — health score + * the ranked fix list + the hand-off to the measured layer. Same findings, the * optimization framing. See research/measurement-authority.md (A2) + roadmap §P1. */ import { type PluginScore } from "./score-core.js"; import { type ExplanationConfidence } from "./score-explainer.js"; import type { ScanReport } from "./scan.js"; import type { GradedView } from "./core/apply-rules.js"; /** * The action a recommendation asks for. The deterministic detectors yield two: * `"differentiate"` (a description-overlap PAIR — make the two distinct so the * selector can disambiguate) and `"fix"` (every other structural dead-end — * correct/add/remove the offending bit). The richer add/drop/swap vocabulary * belongs to the MEASURED layer, once a behavioral delta ranks the alternatives. */ export type OptimizeAction = "fix" | "differentiate"; export interface Recommendation { /** The affected surface (a skill/agent/hook name or path, or an `a ↔ b` pair). */ readonly surface: string; readonly action: OptimizeAction; /** The deterministic cause (the detector's own message — no drift). */ readonly rationale: string; /** A single, actionable fix. */ readonly fix: string; /** The lint rule that found it (open `docs/rules/.md`). */ readonly detector: string; readonly confidence: ExplanationConfidence; } export interface OptimizeReport { readonly dir: string; /** Structural-health score 0–100 (the same `scoreReport` the leaderboard uses). */ readonly score: number; readonly grade: PluginScore["grade"]; /** The free deterministic fixes, `likely` dead-ends first (explainScore's order). */ readonly recommendations: readonly Recommendation[]; /** * No loadable surface at all (not a plugin, or a broken load) — distinct from a * clean-and-loaded harness with zero findings, so the formatter doesn't call an * EMPTY machine "clean". Mirrors `scoreReport`'s empty-machine case. */ readonly empty: boolean; } /** * Turn a scan report into a prioritized optimization plan: the structural-health * score + a typed recommendation per deterministic finding (`likely` dead-ends * before `possible` proxies, via explainScore's own ordering). Pure over the report. */ export declare function optimize(report: GradedView): OptimizeReport; /** * Just the deterministic fix list (no score header) — folded into the default * `vigiles audit` report so every finding carries its fix inline (replaces the * former `--fix-plan`/`--explain` flags). Empty string when there's nothing to * fix (or no loadable surface), so the caller can skip the section entirely. */ export declare function formatRecommendations(rep: OptimizeReport): string; /** Render an optimization plan for the CLI. */ export declare function formatOptimize(rep: OptimizeReport): string; //# sourceMappingURL=optimize.d.ts.map