cached-context 0.3.0

File cache with diff tracking for AI coding agents
Documentation
//! Types module

use serde::{Deserialize, Serialize};
use std::path::PathBuf;

/// Configuration for cached-context
#[derive(Debug, Clone)]
pub struct CacheConfig {
    pub db_path: PathBuf,
    pub session_id: String,
    pub workdir: PathBuf,
}

impl Default for CacheConfig {
    fn default() -> Self {
        Self {
            db_path: PathBuf::from(".cached-context/cache.db"),
            session_id: uuid::Uuid::new_v4().to_string(),
            workdir: std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")),
        }
    }
}

/// Result of a file read operation
#[derive(Debug, Serialize, Deserialize)]
pub struct FileReadResult {
    pub cached: bool,
    pub content: String,
    pub hash: String,
    pub total_lines: usize,
    pub lines_changed: Option<usize>,
    pub diff: Option<String>,
}

/// Cache statistics
#[derive(Debug, Serialize, Deserialize)]
pub struct CacheStats {
    pub files_tracked: usize,
    pub tokens_saved: u64,
    pub session_tokens_saved: u64,
}