Expand description
§tokmd-cockpit
Tier 2 (Computation & Rendering)
Cockpit PR metrics computation and rendering for tokmd. Provides functions to compute change surface, code health, risk, composition, evidence gates, and review plans for pull requests.
§What belongs here
- Cockpit metric computation functions
- Evidence gate computation (mutation, diff coverage, complexity, etc.)
- Markdown/JSON/sections rendering
- Determinism hashing helpers
§What does NOT belong here
- CLI argument parsing (use tokmd-config)
- Type definitions (use tokmd-types::cockpit)
Modules§
- determinism
- Shared BLAKE3 hashing helpers for determinism verification.
- render
- Rendering functions for cockpit receipts.
Structs§
- Breaking
Change - Breaking change detected by semver check.
- Change
Surface - Change surface metrics.
- CliSub
Gate - CLI sub-gate for contract diff.
- Cockpit
Receipt - Cockpit receipt containing all PR metrics.
- Code
Health - Code health indicators for DevEx.
- Complexity
Gate - Complexity gate results.
- Composition
- File composition breakdown.
- Contract
Diff Gate - Contract diff gate results (compound gate).
- Contracts
- Contract change indicators.
- Determinism
Gate - Determinism gate results.
- Diff
Coverage Gate - Diff coverage gate results.
- Evidence
- Evidence section containing hard gates.
- File
Stat - File stat from git diff –numstat. File stat from git diff –numstat.
- Gate
Meta - Common metadata for all gates.
- Health
Warning - Health warning for specific files.
- High
Complexity File - A file with high cyclomatic complexity.
- Mutation
Gate - Mutation testing gate results.
- Mutation
Survivor - A mutation that survived testing (escaped detection).
- Review
Item - Review plan item.
- Risk
- Risk indicators.
- Schema
SubGate - Schema sub-gate for contract diff.
- Scope
Coverage - Scope coverage for a gate.
- Semver
SubGate - Semver sub-gate for contract diff.
- Supply
Chain Gate - Supply chain gate results.
- Trend
Comparison - Trend comparison between current state and baseline.
- Trend
Indicator - Complexity trend indicator.
- Trend
Metric - A trend metric with current, previous, delta values.
- Uncovered
Hunk - Uncovered hunk in diff coverage.
- Vulnerability
- Vulnerability from cargo-audit.
Enums§
- Commit
Match - Commit match quality for evidence.
- Complexity
Indicator - Complexity indicator levels.
- Evidence
Source - Source of evidence/gate results.
- Gate
Status - Status of a gate check.
- Risk
Level - Risk level classification.
- Trend
Direction - Direction of a trend.
- Warning
Type - Types of health warnings.
Constants§
- COCKPIT_
SCHEMA_ VERSION - Cockpit receipt schema version.
- COMPLEXITY_
THRESHOLD - Cyclomatic complexity threshold for high complexity.
Functions§
- compute_
cockpit - Compute the full cockpit receipt for a PR.
- compute_
code_ health - Compute code health metrics.
- compute_
complexity_ trend - Compute complexity trend indicator.
- compute_
composition - Compute composition metrics.
- compute_
determinism_ gate - Compute determinism gate. Compares expected source hash (from baseline) with a fresh hash of the repo.
- compute_
metric_ trend - Compute trend metric with direction.
- compute_
risk - Compute risk metrics for borrowed file stats.
- detect_
contracts - Detect contract changes.
- format_
signed_ f64 - Format a float with a sign prefix.
- generate_
review_ plan - Generate review plan.
- get_
file_ stats - Get file stats for changed files.
- load_
and_ compute_ trend - Load baseline receipt and compute trend comparison.
- now_
iso8601 - Return the current time as an ISO 8601 string.
- round_
pct - Round a float to two decimal places.
- sparkline
- Render a sparkline string from a slice of values.
- trend_
direction_ label - Human-readable label for a trend direction.