Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
1b985d4
feat: add git-ai activity command for local AI usage statistics
clarete May 22, 2026
ac58a02
feat: git-ai activity 1d period
clarete May 22, 2026
89c551d
fix: 1d not 71
clarete May 22, 2026
55a0cd2
fix: only count commits with AI lines in activity stats
clarete May 22, 2026
2a6d730
fix: update text
clarete May 22, 2026
341e9e8
feat: add 3d period to git ai activity
clarete May 22, 2026
b395245
fix: accumulate human lines before AI early-return in aggregate_commi…
clarete May 22, 2026
6a33d4c
feat: show AI acceptance rate in git-ai activity output
clarete May 22, 2026
a504cc2
feat: add activity over time, velocity, and time-of-day heatmap to gi…
clarete May 22, 2026
6a8411b
fix: show week range labels and move activity chart below sessions
clarete May 22, 2026
ebaf56a
refactor: restructure activity output into AI/Human stacked sections
clarete May 22, 2026
b43d0cf
refactor: replace two-bar split with a single combined AI/Human bar
clarete May 22, 2026
6eee0af
feat: show model alongside tool in activity breakdown
clarete May 22, 2026
5e2d093
refactor: list per-model breakdown one per line instead of inline
clarete May 22, 2026
25e2e62
Add 60d to period filter of git ai activity
clarete May 22, 2026
6826bae
fix spacing in CLI
clarete May 22, 2026
fdea10a
feat: add attribution coverage metric to git-ai activity
clarete May 22, 2026
7d251ad
refactor: move attribution coverage into per-bucket activity-over-time
clarete May 22, 2026
3939367
feat: add token usage and estimated cost to git-ai activity
clarete May 22, 2026
db07bcf
feat: add codex token usage parsing to git-ai activity
clarete May 22, 2026
ac577f1
feat: add yield classification to git-ai activity sessions
clarete May 22, 2026
ee62aaa
feat: add day-of-week dimension to git-ai activity
clarete May 22, 2026
980cb11
feat: add week-over-week spend comparison to git-ai activity
clarete May 22, 2026
bafecaf
feat: add cache efficiency ratio to git-ai activity token breakdown
clarete May 22, 2026
1962bc7
feat: add per-tool acceptance rate to git-ai activity
clarete May 22, 2026
2277184
add 60d period to user visible msg
clarete May 22, 2026
5ce2c28
spacing
clarete May 22, 2026
ee3e240
fix: suppress week-over-week spend when period covers less than 14 days
clarete May 22, 2026
e555bd1
fix: show per-tool acceptance rate only on first model variant line
clarete May 22, 2026
28bbaa1
refactor: eliminate double-parse of committed event tool/AI fields
clarete May 22, 2026
5d1868e
docs: document yield classification cross-repo limitation
clarete May 22, 2026
b82fb49
fix: start all-time activity at first event
clarete May 22, 2026
72de390
fix: bucket codex spend by usage time
clarete May 22, 2026
9b550aa
fix: avoid infinite activity spend deltas
clarete May 22, 2026
cc70b25
feat: interactive Ratatui TUI for git-ai activity
clarete May 22, 2026
c60a3fb
feat: per-repository breakdown for git-ai activity
clarete May 22, 2026
b3c1a5a
fix: always use global stats; repo filter was emptying historical data
clarete May 22, 2026
4047941
fix: re-enable repo filter now that existing events have repo_url set
clarete May 22, 2026
a4f7c44
feat: backfill today's git notes into local_events on activity startup
clarete May 22, 2026
b82eaeb
chore: remove notes_backfill — repo_url column fully backfilled in DB
clarete May 22, 2026
97eb88a
feat: add Sessions tab to git-ai activity TUI
clarete May 22, 2026
d940bbd
feat: extract and display session titles in Sessions tab
clarete May 22, 2026
d2651a6
fix: scope yield and ai_lines_committed to matching repo in session list
clarete May 22, 2026
0c38c66
feat: rename activity subcommand to usage
clarete May 22, 2026
9f567c0
feat: add cloud dashboard CTA to usage output
clarete May 22, 2026
1254f79
feat: remove TUI, fix Cost tab sessions count, show unknown repo
clarete May 23, 2026
c8b2ef6
feat: add --repo flag to git-ai usage with substring matching
clarete May 24, 2026
f8f270a
fix: show error and exit when --repo filter matches no data
clarete May 24, 2026
60ff073
fix: clarify output when --repo filter matches multiple repositories
clarete May 24, 2026
6eb49b0
feat: show --repo hint in footer when no filter is active
clarete May 24, 2026
f683c23
Move where the tip about --repo is
clarete May 24, 2026
a2d0de9
fix: escape LIKE special chars in repo_filter substring match
clarete May 24, 2026
42e33b3
fix: update schema version assertions in tests from 3 to 4
clarete May 24, 2026
935ac40
fix: surface >100% acceptance rate instead of silently dropping it
clarete May 24, 2026
52b70b4
fix: clarify that CommitSummary.total counts AI commits only
clarete May 24, 2026
3a1b45f
fix: two correctness bugs in metrics aggregation
clarete May 24, 2026
c64aaa2
fix: suppress zero-token model entries from token breakdown
clarete May 24, 2026
d6980da
fix: upgrade empty session_id in aggregate_session_tokens
clarete May 24, 2026
948970a
fix: replace unwrap with graceful break in Monthly bucket loop
clarete May 24, 2026
3888e49
fix: replace println!("") with println!() to satisfy clippy
clarete May 24, 2026
1159106
fix: don't report no-data when only human commits exist in the window
clarete May 24, 2026
e532fb5
docs: clarify why .contains() is correct in compute_repo_summaries fi…
clarete May 24, 2026
2ae1a0c
fix: upgrade unknown model in compute_session_list message map
clarete May 24, 2026
26b3182
fix: fold date-snapshot model variants into a single display row
clarete May 24, 2026
0de7d7a
fix: apply format_num to commits and sessions in repo breakdown table
clarete May 24, 2026
5e032be
fix: include checkpoint lines in no_data guard
clarete May 24, 2026
4f4784c
refactor: extract fetch_local_events and fetch_distinct_repo_urls hel…
clarete May 24, 2026
f41701f
refactor: promote YIELD_WINDOW_SECS to module-level constant
clarete May 24, 2026
9e5fbc5
refactor: extract strip_protocol helper in activity.rs
clarete May 24, 2026
b4009a0
refactor: deduplicate footer println in print_terminal
clarete May 24, 2026
bd70d0b
refactor: extract shared row mapper in get_local_events
clarete May 24, 2026
51ac070
refactor: remove redundant shorten_model call in build_token_summary
clarete May 24, 2026
a3b82ce
refactor: add CodexSessionAccum::to_token_accum() to remove duplication
clarete May 24, 2026
82e839c
refactor: extract ratio_bar helper to deduplicate block-bar rendering
clarete May 24, 2026
27c9a71
refactor: extract bucket_label to eliminate duplicate label format st…
clarete May 24, 2026
6aded15
fix: improve git-ai usage terminal output based on design feedback
clarete May 24, 2026
8f84775
fix: align model columns in AI and Tokens sections of git-ai usage
clarete May 24, 2026
5021668
perf: compute_repo_summaries fetches all events in a single DB query
clarete May 24, 2026
a35ceb2
refactor: remove dead code and eliminate double event iteration
clarete May 24, 2026
2c9599d
feat: prune local_events rows older than 30 days
clarete May 24, 2026
a094663
fix: drop 60d and all periods; local_events only retains 30 days
clarete May 24, 2026
e1759d2
fix: exclude NULL repo_url events from per-repo summaries
clarete May 24, 2026
7bf2cd7
fix: correct --period help text in git-ai usage (remove all/60d, add …
clarete May 24, 2026
1301ced
fix: write prune timestamp before DELETE in a single transaction
clarete May 24, 2026
bd1622f
fix: use u64 arithmetic in acceptance rate to prevent u32 overflow
clarete May 24, 2026
187b3cd
refactor: remove dead compute_session_list and its supporting code
clarete May 24, 2026
5e61482
refactor: rename activity module and handle_activity to usage/handle_…
clarete May 24, 2026
24e673d
fix: update remaining git-ai activity references to git-ai usage
clarete May 24, 2026
acc5833
remove redundant label
clarete May 24, 2026
a5aa912
fix: correct four bugs found in pre-PR review of git-ai usage
clarete May 24, 2026
c1e60fc
fix: handle concurrent ALTER TABLE in migration 3→4
svarlamov May 29, 2026
beb34c8
simplify metrics delivery tracking
svarlamov Jun 5, 2026
4d7491f
prune delivered metrics history
svarlamov Jun 5, 2026
a7875c9
fix metrics db flush invariants
svarlamov Jun 5, 2026
31e0b2a
prune metric rows after 45 days
svarlamov Jun 5, 2026
4a2448f
tighten metrics usage performance
svarlamov Jun 5, 2026
ec1deae
fix no-exec global config home fallback on Windows
svarlamov Jun 5, 2026
7f3a8d5
avoid cloning telemetry envelopes on successful submit
svarlamov Jun 5, 2026
731dfb9
fix git env bool parsing for no-system config
svarlamov Jun 6, 2026
058c677
fix telemetry db metric flush ordering
svarlamov Jun 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/commands/flush_metrics_db.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Handle flush-metrics-db command (kept for manual human use).
//!
//! Drains the metrics database queue by uploading batches to the API.
//! Uploads pending metrics database rows to the API.

use crate::api::{ApiClient, ApiContext, upload_metrics_with_retry};
use crate::metrics::db::MetricsDatabase;
Expand Down Expand Up @@ -69,9 +69,10 @@ pub fn handle_flush_metrics_db(_args: &[String]) {
record_ids.push(record.id);
} else {
total_invalid += 1;
// Invalid JSON - delete the record
// Invalid JSON cannot upload successfully. Mark it delivered so
// future flushes can continue past the malformed historical row.
if let Ok(mut db_lock) = db.lock() {
let _ = db_lock.delete_records(&[record.id]);
let _ = db_lock.mark_records_delivered(&[record.id], current_unix_ts());
}
}
}
Expand All @@ -92,10 +93,10 @@ pub fn handle_flush_metrics_db(_args: &[String]) {
" ✓ batch {} - uploaded {} events",
total_batches, event_count
);
// Success - delete ALL records from this batch
// Validation errors are logged to Sentry and won't succeed on retry
// Success - keep rows as history and mark them delivered.
// Validation errors are logged to Sentry and won't succeed on retry.
if let Ok(mut db_lock) = db.lock() {
let _ = db_lock.delete_records(&record_ids);
let _ = db_lock.mark_records_delivered(&record_ids, current_unix_ts());
}
}
Err(e) => {
Expand All @@ -111,7 +112,7 @@ pub fn handle_flush_metrics_db(_args: &[String]) {

if total_invalid > 0 {
eprintln!(
"flush-metrics-db: discarded {} invalid record(s)",
"flush-metrics-db: marked {} invalid record(s) delivered",
total_invalid
);
}
Expand All @@ -121,3 +122,10 @@ pub fn handle_flush_metrics_db(_args: &[String]) {
total_uploaded, total_batches
);
}

fn current_unix_ts() -> u64 {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_secs()
}
7 changes: 7 additions & 0 deletions src/commands/git_ai_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub fn handle_git_ai(args: &[String]) {
| "install-hooks"
| "install"
| "uninstall-hooks"
| "usage"
);
if needs_daemon {
use crate::daemon::telemetry_handle::{
Expand Down Expand Up @@ -108,6 +109,9 @@ pub fn handle_git_ai(args: &[String]) {
}
handle_stats(&args[1..]);
}
"usage" => {
commands::usage::handle_usage(&args[1..]);
}
"status" => {
commands::status::handle_status(&args[1..]);
}
Expand Down Expand Up @@ -335,6 +339,9 @@ fn print_help() {
);
eprintln!(" stats [commit] Show AI authorship statistics for a commit");
eprintln!(" --json Output in JSON format");
eprintln!(" usage Show local AI usage statistics");
eprintln!(" --period <1d|3d|7d|30d> Time window (default: 30d)");
eprintln!(" --json Output in JSON format");
eprintln!(" status Show uncommitted AI authorship status (debug)");
eprintln!(" --json Output in JSON format");
eprintln!(" show <rev|range> Display authorship logs for a revision or range");
Expand Down
1 change: 1 addition & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ pub mod show_prompt;
pub mod squash_authorship;
pub mod status;
pub mod upgrade;
pub mod usage;
pub mod whoami;
Loading
Loading