claude-dashboard 0.2.2

A terminal TUI dashboard that renders Claude Code usage reports with token stats, project breakdowns, and language distribution.
Documentation
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use crate::data::models::HistoryEntry;

pub fn parse_history(path: &Path) -> Result<Vec<HistoryEntry>, String> {
    let file = File::open(path)
        .map_err(|e| format!("Failed to open history.jsonl: {}", e))?;
    let reader = BufReader::new(file);
    let mut entries = Vec::new();

    for line in reader.lines() {
        let line = line.map_err(|e| format!("Failed to read line in history.jsonl: {}", e))?;
        if line.trim().is_empty() {
            continue;
        }
        match serde_json::from_str::<HistoryEntry>(&line) {
            Ok(entry) => entries.push(entry),
            Err(_) => continue, // skip malformed lines
        }
    }

    Ok(entries)
}