vibe_coding_tracker 0.14.0

Vibe Coding Tracker - AI coding assistant telemetry/usage parser, aggregate JSONL events into CodeAnalysis results
Documentation
//! Library crate behind the `vibe_coding_tracker` / `vct` CLI.
//!
//! The crate scans on-disk JSONL session logs written by four AI coding
//! assistants — Claude Code, OpenAI Codex, GitHub Copilot CLI, and Gemini
//! CLI — and rolls them up into two views:
//!
//! - **usage** — per-model token counts and LiteLLM-priced cost
//! - **analysis** — per-model file-operation and tool-call metrics
//!
//! # Pipeline
//!
//! Raw bytes flow through a two-stage pipeline. [`session`] owns the
//! "JSONL → typed [`CodeAnalysis`]" boundary (provider detection plus a
//! parser per provider); [`analysis`] and [`usage`] then aggregate those
//! typed records, and [`display`] renders the result as an interactive TUI,
//! a static table, plain text, or JSON. Both downstream views consume the
//! same parsed shape, so file parsing lives only in [`session`].
//!
//! 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).

pub mod analysis;
pub mod cache;
pub mod cli;
pub mod constants;
pub mod display;
pub mod models;
pub mod pricing;
pub mod quota;
pub mod session;
pub mod statusline;
pub mod update;
pub mod usage;
pub mod utils;

pub use cli::TimeRange;
pub use models::*;
pub use session::parser::{parse_session_file, parse_session_file_typed};
pub use usage::calculator::{UsageData, get_usage_from_directories};

/// 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.
pub const VERSION: &str = env!("BUILD_VERSION");
/// Crate name from `Cargo.toml` (`vibe_coding_tracker`).
pub const PKG_NAME: &str = env!("CARGO_PKG_NAME");
/// Crate description from `Cargo.toml`.
pub const PKG_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
/// `rustc` version string captured at build time by `build.rs`.
pub const RUST_VERSION: &str = env!("BUILD_RUST_VERSION");
/// `cargo` version string captured at build time by `build.rs`.
pub const CARGO_VERSION: &str = env!("BUILD_CARGO_VERSION");

/// Snapshots the build version, Rust toolchain, and Cargo version into a
/// [`VersionInfo`].
///
/// Reads the compile-time [`VERSION`], [`RUST_VERSION`], and
/// [`CARGO_VERSION`] constants; this is what backs the `vct version`
/// subcommand.
///
/// # Examples
///
/// ```
/// let info = vibe_coding_tracker::get_version_info();
/// assert_eq!(info.version, vibe_coding_tracker::VERSION);
/// ```
pub fn get_version_info() -> VersionInfo {
    VersionInfo {
        version: VERSION.to_string(),
        rust_version: RUST_VERSION.to_string(),
        cargo_version: CARGO_VERSION.to_string(),
    }
}

/// Build metadata reported by the `vct version` subcommand.
///
/// Construct via [`get_version_info`]; the fields mirror the [`VERSION`],
/// [`RUST_VERSION`], and [`CARGO_VERSION`] constants. Serializes to JSON
/// for the `--json` output mode.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct VersionInfo {
    /// Full build version (see [`VERSION`]).
    pub version: String,
    /// `rustc` version the binary was built with.
    pub rust_version: String,
    /// `cargo` version the binary was built with.
    pub cargo_version: String,
}