/** * Shared flags and error types for the audit pipeline. * * Extracted from audit-pipeline.ts into its own module to break the circular * import that would otherwise occur between audit-pipeline.ts and * llm/layer4-stage.ts (both would need to reference these types). * * audit-pipeline.ts re-exports everything from here for backward compatibility. */ import type { Spinner } from "../util/spinner.js"; /** * Thrown when no LLM connector is configured and --static-only is not set. * The CLI layer catches this error and exits with code 1. */ export declare class RefuseToRunError extends Error { name: string; } /** * Thrown when `--scope changed`/`--staged` cannot resolve the git-changed set * (not a git repo, or an unresolvable base ref). The CLI catches it and exits * with code 64 (EX_USAGE) and a clear message. */ export declare class ScopeError extends Error { name: string; } /** * CLI-level flags that override config-file values for a single audit run. * All fields are optional; omitting a field means "use the config/env value". */ export interface AuditFlags { /** Skip Layer 4 LLM augmentation; report Layers 1+2 score only (~30% coverage). */ staticOnly?: boolean; /** Override the LLM cost cap for this run (USD). */ costCapUsd?: number; /** If true, bypass the cache and force a fresh LLM call. */ noCache?: boolean; /** Override the LLM provider (e.g. "anthropic" | "openai" | "ollama"). */ llmProvider?: string; /** Override the LLM model identifier. */ llmModel?: string; /** * When set, only this single dimension is audited by the LLM (focused mode). * ~9x cost reduction by sending only that dimension's prompt section. * Valid values: tokens | components | a11y | stories | themes | motion | patterns | naming | documentation */ llmDimension?: string; /** CLI `--llm` / `--no-llm`: per-run opt in/out of the LLM layer. */ llm?: boolean; /** * Resolved LLM consent for this run (set by the CLI audit entry via * resolveLlmConsentNonInteractive). Gates the connector auto-detect path: source is never * sent to an auto-detected `claude` CLI unless this is true (#115). */ llmConsented?: boolean; /** * Optional progress reporter. When provided, the pipeline calls * `update()` at phase boundaries (file discovery, parsing, loading, rules, * scoring). Issuing `start()` / `succeed()` / `fail()` is the CLI's job — * the pipeline never owns the outcome label. * * Pass `undefined` (or a no-op spinner) from non-interactive callers * (MCP, share) to keep stderr quiet. */ progress?: Spinner; /** * Limit the audit to git-changed files: `"changed"` (committed vs `base`), * `"staged"` (files in the index), or `"uncommitted"` (working-tree changes * vs HEAD + untracked — the right scope for verifying an agent's edits). * Omitted = audit the whole tree. */ scope?: "changed" | "staged" | "uncommitted"; /** Base ref for `scope: "changed"` (default `"origin/main"`). */ base?: string; /** Opt-in: render the token layer in headless Chromium to detect computed-value drift. */ render?: boolean; /** Optional Storybook source for the runtime-axe sub-stage: a static dir (relative to repo root or absolute) or a running URL. */ storybook?: string; /** * Override the scoring formula for this run: "v3" (default) or "v2" (opt-in * legacy escape hatch). Highest-precedence source in `resolveScoreModel` * (flag > env > config > `DEFAULT_SCORE_MODEL`). Omitted = fall through to * env/config/default. */ scoreModel?: "v2" | "v3"; }