Skip to content

vox-code-audit API Reference (generated)

Crate: vox-code-audit · Version: 0.6.0 · Target: Library (lib.rs)

AI code quality stub detector — finds stubs, magic values, empty bodies, missing references, and DRY violations

Todo, Omitted wiring, Empty bodies, Stub functions, Too-early victory, Unresolved references, Broken DRY — detector.

TOESTUB mechanically detects AI coding anti-patterns that are banned by AGENTS.md but otherwise only caught during manual review.

Public modules and re-exports are intentionally thin; each detector/rule is documented in its own file where non-obvious heuristics exist.

DependencyKind
vox-bounded-fsNormal
vox-rule-packNormal
vox-scaling-policyNormal
vox-secretsNormal
vox-telemetryNormal
ModuleDescription
diagnosticsStable diagnostic ID catalog (vox/<category>/<name> scheme) and explain infrastructure.
ai_analyzeOptional LLM-backed triage: wraps provider-specific clients behind a small AiAnalyzer API.
analysisToken maps, optional syn AST, and other shared analysis for detectors.
detectorsConcrete TOESTUB rules (stubs, empty bodies, secrets, DRY, …) registered by [detectors::all_rules].
run_contextPer-run canary / rollout flags for detectors (set by [engine::ToestubEngine]).
suppressionStructured suppression store (contracts/toestub/suppression.v1.schema.json).
retirement_parityCR-L6 retirement-guard parity check — cross-references contracts/retirement/retired-surfaces.v1.yaml against the registered detectors and diagnostic IDs. Library home of the planned vox ci retirement-audit CLI command.
stdlib_parityStdlib-coverage parity check (non-CR-L tooling gate). Three-way diff between binary registrations in crates/vox-compiler/src/eval/builtins.rs, doc claims in docs/src/reference/ref-builtins-stdlib.md, and corpus call sites under scripts/. Library home of the vox audit stdlib-coverage subcommand. See docs/src/architecture/vox-stdlib-gap-audit-2026-05-23.md §10 / §12.D.
engineRuns configured detectors over a [scanner::Scanner] snapshot and aggregates [rules::Finding]s.
reportRenders findings to the terminal, JSON, or Markdown for CI and local CLI output.
reviewEnd-to-end code review flow: prompts, provider adapters (OpenAI, Ollama, …), SARIF/MD emit.
rulesShared model for a single finding, severity/language enums, and the [rules::DetectionRule] trait.
scannerCollects SourceFile entries from a repo path with language detection from extensions.
task_queueIn-memory bounded work queue used to cap parallel file/review tasks.
Dependency Topology, diagram 114 nodes, 13 edges: vox-code-audit → vox-bounded-fs; vox-code-audit → vox-rule-pack; vox-code-audit → vox-scaling-policy; vox-code-audit → vox-secrets; vox-code-audit → vox-telemetry; vox-audit → vox-code-audit; vox-cli → vox-code-audit; vox-cli-ci → vox-code-audit; vox-cli-research → vox-code-audi…vox-code-auditvox-bounded-fsvox-rule-packvox-scaling-policyvox-secretsvox-telemetryvox-auditvox-clivox-cli-civox-cli-researchvox-cli-reviewvox-drift-checkvox-orchestratorvox-orchestrator-mcp
Diagram source
graph {
direction: right
node vox_code_audit: "vox-code-audit"
node vox_bounded_fs: "vox-bounded-fs"
vox_code_audit -> vox_bounded_fs
node vox_rule_pack: "vox-rule-pack"
vox_code_audit -> vox_rule_pack
node vox_scaling_policy: "vox-scaling-policy"
vox_code_audit -> vox_scaling_policy
node vox_secrets: "vox-secrets"
vox_code_audit -> vox_secrets
node vox_telemetry: "vox-telemetry"
vox_code_audit -> vox_telemetry
node vox_audit: "vox-audit"
vox_audit -> vox_code_audit
node vox_cli: "vox-cli"
vox_cli -> vox_code_audit
node vox_cli_ci: "vox-cli-ci"
vox_cli_ci -> vox_code_audit
node vox_cli_research: "vox-cli-research"
vox_cli_research -> vox_code_audit
node vox_cli_review: "vox-cli-review"
vox_cli_review -> vox_code_audit
node vox_drift_check: "vox-drift-check"
vox_drift_check -> vox_code_audit
node vox_orchestrator: "vox-orchestrator"
vox_orchestrator -> vox_code_audit
node vox_orchestrator_mcp: "vox-orchestrator-mcp"
vox_orchestrator_mcp -> vox_code_audit
}
Consumer CrateRole
vox-auditDirect workspace dependent
vox-cliDirect workspace dependent
vox-cli-ciDirect workspace dependent
vox-cli-researchDirect workspace dependent
vox-cli-reviewDirect workspace dependent
vox-drift-checkDirect workspace dependent
vox-orchestratorDirect workspace dependent
vox-orchestrator-mcpDirect workspace dependent
KindSymbolSignatureSourceDescription
enumai_analyze::AiProviderpub enum AiProvidercrates/vox-code-audit/src/ai_analyze.rs#L26-L56Which AI backend to use for enhanced analysis.
structai_analyze::AiAnalyzerpub struct AiAnalyzercrates/vox-code-audit/src/ai_analyze.rs#L83-L85Performs AI-enhanced analysis on source files. This is intentionally synchronous and blocking for simplicity — AI analysis is opt-in and expected to be slower than static detection.
fnai_analyze::newpub fn new(provider: AiProvider) -> Selfcrates/vox-code-audit/src/ai_analyze.rs#L89-L91Wraps the given [AiProvider]; use [AiProvider::Disabled] when AI triage is off.
fnai_analyze::is_availablepub fn is_available(&self) -> boolcrates/vox-code-audit/src/ai_analyze.rs#L94-L96Check if AI analysis is available and configured.
fnai_analyze::build_promptpub fn build_prompt(file: &SourceFile, existing_findings: &[Finding]) -> Stringcrates/vox-code-audit/src/ai_analyze.rs#L99-L148Build the analysis prompt for a source file and its existing findings.
fnai_analyze::parse_responsepub fn parse_response(response: &str, file: &SourceFile) -> Vec<Finding>crates/vox-code-audit/src/ai_analyze.rs#L151-L201Parse an AI response into findings.
fnai_analyze::ollama_request_bodypub fn ollama_request_body(prompt: &str, model: &str) -> Stringcrates/vox-code-audit/src/ai_analyze.rs#L204-L215Generate the curl-compatible request body for Ollama.
fnai_analyze::gemini_request_bodypub fn gemini_request_body(prompt: &str) -> Stringcrates/vox-code-audit/src/ai_analyze.rs#L218-L231Generate the request body for Gemini API.
fnai_analyze::endpoint_urlpub fn endpoint_url(&self) -> Option<String>crates/vox-code-audit/src/ai_analyze.rs#L234-L266Get the API endpoint URL for the configured provider.
fnai_analyze::provider_namepub fn provider_name(&self) -> &strcrates/vox-code-audit/src/ai_analyze.rs#L269-L276Get the provider description for display purposes.
fndetectors::all_rulespub fn all_rules(schema_path: Option<std::path::PathBuf>) -> Vec<Box<dyn DetectionRule>>crates/vox-code-audit/src/detectors/mod.rs#L169-L246Returns all built-in detectors.
fndetectors::rule_countpub fn rule_count() -> usizecrates/vox-code-audit/src/detectors/mod.rs#L249-L251Returns the number of built-in rules.
enumengine::ToestubRunModepub enum ToestubRunModecrates/vox-code-audit/src/engine.rs#L17-L27How CI / CLI should treat findings for exit status.
structengine::ToestubConfigpub struct ToestubConfigcrates/vox-code-audit/src/engine.rs#L31-L67Configuration for a TOESTUB analysis run.
structengine::ToestubEnginepub struct ToestubEnginecrates/vox-code-audit/src/engine.rs#L180-L183The main analysis engine.
fnengine::newpub fn new(config: ToestubConfig) -> Selfcrates/vox-code-audit/src/engine.rs#L187-L204Create a new engine with the given config, loading all built-in rules.
fnengine::with_rulespub fn with_rules(config: ToestubConfig, rules: Vec<Box<dyn DetectionRule>>) -> Selfcrates/vox-code-audit/src/engine.rs#L207-L209Create an engine with a custom set of rules (useful for testing).
fnengine::check_source_filepub fn check_source_file(&self, file: &crate::rules::SourceFile) -> Vec<Finding>crates/vox-code-audit/src/engine.rs#L230-L260Run lint rules on a single pre-loaded source file without a filesystem scan. This is a lightweight alternative to [Self::run] for vox check --for-llm and similar single-file consumers that already have source in memory. Unlike [Self::run], this method: - Skips the [Scanner] (no directory walk). - Does not emit telemetry (no CR-L8 corpus events). - Does not apply suppression rules. - Sets up a default [crate::run_context::RunContext] (safe for single-file Vox linting; some Rust-specific rules that depend on workspace cross-refs will produce no findings on Vox files regardless). Severity filtering and deterministic sort are still applied so callers receive findings in the same order as a full [Self::run]. # Thread safety [crate::run_context::RunContext] uses a process-global mutex. Concurrent calls to this method (or to [Self::run]) will serialize; do not hold the returned Vec<Finding> across a second call on a different thread without copying first.
fnengine::minimal_repro_tablepub fn minimal_repro_table(&self) -> HashMap<&'static str, &'static str>crates/vox-code-audit/src/engine.rs#L267-L272Build a rule_id → minimal_repro lookup table for all registered rules. Used by vox check --for-llm to attach per-rule minimal reproduction snippets to LintFindingPayload without modifying the [Finding] struct (which would require updating every detector constructor).
fnengine::runpub fn run(&self) -> AnalysisResultcrates/vox-code-audit/src/engine.rs#L275Run the full analysis pipeline and return findings.
fnengine::run_and_reportpub fn run_and_report(&self) -> (AnalysisResult, String)crates/vox-code-audit/src/engine.rs#L408-L424Run analysis and produce formatted output as a String.
structengine::AnalysisResultpub struct AnalysisResultcrates/vox-code-audit/src/engine.rs#L446-L463The output of a TOESTUB analysis run.
fnengine::has_errorspub fn has_errors(&self) -> boolcrates/vox-code-audit/src/engine.rs#L467-L469Returns true if any findings are at or above [Severity::Error].
fnengine::should_fail_buildpub fn should_fail_build(&self, mode: ToestubRunMode) -> boolcrates/vox-code-audit/src/engine.rs#L472-L485Whether the process should exit with failure for the given mode.
fnengine::summarypub fn summary(&self) -> SeveritySummarycrates/vox-code-audit/src/engine.rs#L488-L499Summary counts by severity.
structengine::SeveritySummarypub struct SeveritySummarycrates/vox-code-audit/src/engine.rs#L503-L508—
structreport::RunSnapshotpub struct RunSnapshot<'a>crates/vox-code-audit/src/report.rs#L11-L19Borrowed snapshot of an engine run (avoids engine ↔ report cycles).
structreport::ToestubJsonReportV1pub struct ToestubJsonReportV1<'a>crates/vox-code-audit/src/report.rs#L23-L35JSON output wrapper (format: json) — includes findings and run telemetry (plan: report provenance).
enumreport::OutputFormatpub enum OutputFormatcrates/vox-code-audit/src/report.rs#L39-L49Output format for the report.
fnreport::parse_formatpub fn parse_format(s: &str) -> Selfcrates/vox-code-audit/src/report.rs#L53-L60Parses CLI strings: json, llm-json, markdown/md, anything else → [OutputFormat::Terminal].
structreport::Reporterpub struct Reportercrates/vox-code-audit/src/report.rs#L64Generates formatted output from findings.
fnreport::formatpub fn format(findings: &[Finding], format: OutputFormat, task_queue: &TaskQueue) -> Stringcrates/vox-code-audit/src/report.rs#L68-L75Format findings into the specified output format.
fnreport::format_runpub fn format_run(crates/vox-code-audit/src/report.rs#L78Full run formatting (JSON includes telemetry envelope).
fnreport::format_llm_jsonpub fn format_llm_json(findings: &[Finding]) -> Stringcrates/vox-code-audit/src/report.rs#L96-L137LLM-optimized JSON output. Includes rationale, alternatives, confidence, explain_url, and a 7-line minimal_excerpt so an agent can propose a fix without additional context fetches. Schema: vox.lint.llm-report.v1.
enumretirement_parity::ParityErrorpub enum ParityErrorcrates/vox-code-audit/src/retirement_parity.rs#L36-L40Errors that can arise while loading or interpreting the retirement contract.
structretirement_parity::RetirementContractpub struct RetirementContractcrates/vox-code-audit/src/retirement_parity.rs#L47-L55Top-level retirement contract shape. Mirrors contracts/retirement/retired-surfaces.v1.yaml. Forward-compat: unknown fields are tolerated via #[serde(default)].
structretirement_parity::RetiredSurfacepub struct RetiredSurfacecrates/vox-code-audit/src/retirement_parity.rs#L59-L68One row of the retirement contract.
structretirement_parity::Enforcementpub struct Enforcementcrates/vox-code-audit/src/retirement_parity.rs#L76-L102Tagged union of enforcement mechanisms. kind discriminates the variant; the additional fields are optional and depend on the kind. We deliberately use #[serde(deny_unknown_fields)] nowhere here — unknown fields are tolerated for forward compatibility.
enumretirement_parity::EnforcementKindpub enum EnforcementKindcrates/vox-code-audit/src/retirement_parity.rs#L107-L112Enforcement-mechanism discriminator.
structretirement_parity::ParityReportpub struct ParityReportcrates/vox-code-audit/src/retirement_parity.rs#L116-L129Parity-check outcome.
structretirement_parity::MissingDetectorRulepub struct MissingDetectorRulecrates/vox-code-audit/src/retirement_parity.rs#L133-L136A detector-kind row that references a rule_id we cannot resolve.
structretirement_parity::MissingDiagnosticIdpub struct MissingDiagnosticIdcrates/vox-code-audit/src/retirement_parity.rs#L140-L143A detector-kind row that references a diagnostic_id not in the catalog.
fnretirement_parity::is_cleanpub fn is_clean(&self) -> boolcrates/vox-code-audit/src/retirement_parity.rs#L147-L151Returns true iff there are no drift findings.
fnretirement_parity::summarypub fn summary(&self) -> Stringcrates/vox-code-audit/src/retirement_parity.rs#L154-L168Human-readable summary line.
fnretirement_parity::check_paritypub fn check_parity(yaml: &str) -> Result<ParityReport, ParityError>crates/vox-code-audit/src/retirement_parity.rs#L175-L247Run the parity check against the given retirement-contract YAML. Returns a [ParityReport] describing every row’s enforcement status; call [ParityReport::is_clean] to gate CI.