Skip to main content

read_opencode_analysis

Function read_opencode_analysis 

Source
pub fn read_opencode_analysis(
    db_path: &Path,
    time_range: TimeRange,
    mode: ParseMode,
) -> Result<Vec<(String, CodeAnalysis)>>
Expand description

Reads per-session file-operation metrics from the OpenCode database.

Like read_opencode_usage, but also folds each session’s tool calls from the part table into tool_call_counts and the total_* line/character counts. mode controls whether the heavy per-operation detail bodies are retained (ParseMode::Full) or skipped (ParseMode::UsageOnly); the aggregated analysis view uses UsageOnly. Message/session metadata and tool parts are read inside one transaction so a concurrent OpenCode commit cannot split the result across two SQLite snapshots.

§Errors

Returns an error if the database cannot be opened or queried.