Skip to main content

vct_core/utils/
mod.rs

1//! Leaf helpers shared across the crate: directory walking, JSON/JSONL file
2//! IO, number/date formatting, git remote lookup, glibc heap tuning, path
3//! resolution, ISO timestamp parsing, and token-count extraction.
4//!
5//! The most frequently used items are re-exported at this module's root so
6//! callers can write `utils::format_number` instead of reaching into the
7//! per-concern submodules.
8
9pub mod directory;
10pub mod file;
11pub mod format;
12pub mod git;
13pub mod heap;
14pub mod paths;
15pub mod time;
16pub mod token_extractor;
17pub mod token_merge;
18pub mod usage_processor;
19
20// Public API exports (commonly used across modules)
21pub use directory::{
22    COPILOT_SESSION_MAX_DEPTH, GROK_SESSION_MAX_DEPTH, collect_files_with_dates,
23    collect_files_with_max_depth, is_claude_session_file, is_codex_session_file,
24    is_copilot_session_file, is_gemini_session_file, is_grok_session_file,
25};
26pub use file::{
27    count_lines, read_json, read_jsonl, save_json_pretty, write_json_atomic,
28    write_json_atomic_pretty, write_string_atomic,
29};
30pub use format::{
31    format_compact, format_cost, format_cost_compact, format_duration_until, format_number,
32    get_current_date,
33};
34pub use git::get_git_remote_url;
35pub use heap::{release_freed_heap, tune_system_allocator};
36pub use paths::{
37    HelperPaths, find_pricing_cache_for_date, find_pricing_cache_for_date_in, get_cache_dir,
38    get_claude_credentials_path, get_claude_usage_cache_path, get_codex_usage_cache_path,
39    get_config_path, get_copilot_config_path, get_copilot_usage_cache_path, get_current_user,
40    get_cursor_auth_path, get_cursor_usage_cache_path, get_grok_auth_path,
41    get_grok_usage_cache_path, get_machine_id, get_pricing_cache_path, get_pricing_cache_path_in,
42    get_self_version_cache_path, list_pricing_cache_files, list_pricing_cache_files_in,
43    network_disabled, resolve_paths, resolve_paths_from_home,
44};
45pub use time::{now_rfc3339_utc_nanos, parse_iso_timestamp, rfc3339_utc_nanos};
46pub use token_extractor::{TokenCounts, extract_token_counts};
47pub(crate) use token_merge::merge_usage_values;
48pub use token_merge::normalize_usage_value;
49pub use usage_processor::{
50    CodexTokenTotals, accumulate_i64_fields, accumulate_nested_object, claude_request_context,
51    process_claude_usage, process_codex_usage, process_gemini_usage,
52};