Skip to main content

Crate vct_core

Crate vct_core 

Source
Expand description

Library crate behind the vibe_coding_tracker / vct CLI.

The crate scans on-disk session logs written by eight AI coding assistants: JSONL logs from Claude Code, OpenAI Codex, GitHub Copilot CLI, and Gemini CLI; signals.json plus sibling updates.jsonl from Grok CLI; SQLite data from OpenCode and Cursor; and usage-only SQLite data from Hermes. It exposes two views:

  • usage — per-model token counts and LiteLLM-priced cost
  • analysis — complete per-session data plus compact per-model file-operation and tool-call metrics

§Pipeline

Raw bytes flow through a two-stage pipeline. session owns the “local session data → typed CodeAnalysis” boundary (provider detection plus a parser per provider); analysis and usage then aggregate those typed records. The vct-tui crate renders the result as an interactive TUI, a static table, plain text, or JSON, and the vct-cli binary wires the clap surface to both. Both downstream views consume the same parsed shape, so file parsing lives only in session. This crate holds no terminal dependency, so a future GUI backend can reuse it directly.

Supporting modules: pricing (LiteLLM price lookup with a daily on-disk cache), cache (LRU file cache keyed by mtime), update (self-replace from the matching GitHub release asset), utils (path resolution and the glibc allocator tuning), and constants (capacity and buffer sizing).

Re-exports§

pub use session::parser::parse_session_file_to_value;
pub use session::parser::parse_session_file_typed;
pub use usage::aggregator::UsageData;
pub use usage::aggregator::aggregate_usage_from_home;
pub use usage::aggregator::aggregate_usage_from_paths;
pub use analysis::AnalysisData;
pub use analysis::project_code_analysis;
pub use scan::ScanDiagnostics;
pub use scan::ScanFailure;
pub use usage::PricedUsageRow;
pub use usage::price_usage_data;
pub use models::*;

Modules§

analysis
Collection and projection of normalized analysis sessions.
cache
Library-facing LRU cache of parsed session analyses.
config
Persistent user settings (~/.vct/config.toml).
constants
Compile-time sizing knobs: pre-allocation capacities and I/O buffer sizes.
logging
File-based diagnostic logging (~/.vct/logs/vct-YYYY-MM-DD.log).
models
Serde data models mirroring the supported assistants’ on-disk session formats plus the analyzer’s own aggregated result types.
pricing
Model pricing: fetch, cache, match, and cost calculation.
quota
Quota orchestration for the usage panels.
scan
Shared provider-scan primitives for the usage and analysis roll-ups.
session
Shared session-file parsing layer.
summary_cache
Process-local cache for compact usage and analysis scan contributions.
update
Self-update: replace the running binary from the matching GitHub release.
usage
Token-usage aggregation across provider session directories.
utils
Leaf helpers shared across the crate: directory walking, JSON/JSONL file IO, number/date formatting, git remote lookup, glibc heap tuning, path resolution, ISO timestamp parsing, and token-count extraction.

Structs§

VersionInfo
Build metadata reported by the vct version subcommand.

Constants§

CARGO_VERSION
cargo version string captured at build time by build.rs.
PKG_DESCRIPTION
Crate description from Cargo.toml.
PKG_NAME
Crate name from Cargo.toml (vct-core).
RUST_VERSION
rustc version string captured at build time by build.rs.
VERSION
Full build version: latest git tag plus commits-since and short SHA (with a -dirty suffix when the worktree is modified), generated by build.rs. Falls back to the Cargo.toml version outside a git tree.

Functions§

get_version_info
Snapshots the build version, Rust toolchain, and Cargo version into a VersionInfo.