Skip to main content

Crate tokmd_cockpit

Crate tokmd_cockpit 

Source
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§

BreakingChange
Breaking change detected by semver check.
ChangeSurface
Change surface metrics.
CliSubGate
CLI sub-gate for contract diff.
CockpitReceipt
Cockpit receipt containing all PR metrics.
CodeHealth
Code health indicators for DevEx.
ComplexityGate
Complexity gate results.
Composition
File composition breakdown.
ContractDiffGate
Contract diff gate results (compound gate).
Contracts
Contract change indicators.
DeterminismGate
Determinism gate results.
DiffCoverageGate
Diff coverage gate results.
Evidence
Evidence section containing hard gates.
FileStat
File stat from git diff –numstat. File stat from git diff –numstat.
GateMeta
Common metadata for all gates.
HealthWarning
Health warning for specific files.
HighComplexityFile
A file with high cyclomatic complexity.
MutationGate
Mutation testing gate results.
MutationSurvivor
A mutation that survived testing (escaped detection).
ReviewItem
Review plan item.
Risk
Risk indicators.
SchemaSubGate
Schema sub-gate for contract diff.
ScopeCoverage
Scope coverage for a gate.
SemverSubGate
Semver sub-gate for contract diff.
SupplyChainGate
Supply chain gate results.
TrendComparison
Trend comparison between current state and baseline.
TrendIndicator
Complexity trend indicator.
TrendMetric
A trend metric with current, previous, delta values.
UncoveredHunk
Uncovered hunk in diff coverage.
Vulnerability
Vulnerability from cargo-audit.

Enums§

CommitMatch
Commit match quality for evidence.
ComplexityIndicator
Complexity indicator levels.
EvidenceSource
Source of evidence/gate results.
GateStatus
Status of a gate check.
RiskLevel
Risk level classification.
TrendDirection
Direction of a trend.
WarningType
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.