Usage-statistics report — g stats.
Aggregates data from two sources:
- SQLite database (
~/.config/g/g.db) — command runs, commits recorded viag commit, branch events, workspace events, stack events. git log— real commit dates (all branches) for the heatmap, and per-commit line-change counts for the sparkline chart.
Folder layout
stats/
mod.rs ← this file: public `stats()` entry point + routing
shared.rs ← fmt helpers + the generic horizontal bar chart
overview.rs ← Usage Overview section
heatmap.rs ← 52-week commit heatmap
lines_chart.rs ← +/- lines sparkline (last 60 commits)
top_commands.rs ← Top Commands bar chart
commit_types.rs ← Conventional-commit type distribution
repo_activity.rs ← Repository activity ranking
active_hours.rs ← Activity-by-hour vertical chart
messages.rs ← `--message-stats` mode: length stats, trends, top authors
import.rs ← `--import` mode: backfill git history into the db
search.rs ← `--search` mode: fuzzy search of imported commits
duplicates.rs ← `--duplicates` mode: repeated commit subjects
Each section is its own focused file. Cross-section helpers (number
formatting, the generic bar chart) live in [shared] and are
pub(super)-scoped — they never leak outside stats/.
Source:
src/commands/stats/mod.rs