feat: support Antigravity CLI agent log tracking#1178
Conversation
|
@coderabbitai review |
|
This PR was auto-closed. Only contributors approved with Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply. If a maintainer replies See CONTRIBUTING.md. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (22)
📝 WalkthroughWalkthroughThis PR adds Antigravity CLI as a supported local data source in ccusage. The change includes transcript discovery and parsing, cost estimation with model selection detection, CLI command routing, configuration schema definitions, and user documentation for the new feature. ChangesAntigravity CLI Integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@kexi I have started the AI code review. It will take a few minutes to complete. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details
gh pr view 1178 --repo ryoppippi/ccusage --json title,body,files,additions,deletions 2>/dev/null | head -100
# Get the list of changed files
gh pr view 1178 --repo ryoppippi/ccusage --json files 2>/dev/null | jq -r '.files[].path'Length of output: 7329 🏁 Script executed: #!/bin/bash
# Get the full diff
gh pr diff 1178 --repo ryoppippi/ccusage 2>/dev/null | head -2000Length of output: 62581
Review: feat: support Antigravity CLI agent log trackingThe implementation is well-structured and follows the established adapter pattern. The code is clean, tests are included, and the documentation is clear about the beta/estimated nature of token counts. Below are my findings. 🔴 Issues1. Model name slugification produces invalid LiteLLM IDsFile: The test at the bottom confirms this — The parentheses (and their content) should either be stripped or mapped to known canonical LiteLLM model names: fn extract_model_from_settings_change(content: &str) -> Option<String> {
// ... existing parsing ...
// Strip parenthesized qualifiers before slugifying:
let raw_model = RAW_PARENS_RE.replace_all(raw_model.trim(), "");
let slug = raw_model.trim().to_lowercase().replace(' ', "-").replace("--", "-");
return Some(slug);Or better, maintain an explicit mapping from Antigravity display names to LiteLLM model IDs: match raw_model.trim().to_lowercase().as_str() {
"gemini 3.5 flash" | "gemini 3.5 flash (medium)" => "gemini-2.5-flash",
"gemini 3.5 pro" => "gemini-2.5-pro",
_ => /* fallback slug */
}🟡 Warnings2. Coupling to
|
There was a problem hiding this comment.
1 issue found across 24 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/guide/index.md">
<violation number="1" location="docs/guide/index.md:92">
P2: Documentation update is incomplete: Antigravity CLI was added to the data-source table but is still missing from the introductory capability lists, the "All Sources by Default" bullet, and the command examples on the same page.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| @@ -72,28 +72,29 @@ Each data source page covers the details that only apply to that source, includi | |||
|
|
|||
There was a problem hiding this comment.
P2: Documentation update is incomplete: Antigravity CLI was added to the data-source table but is still missing from the introductory capability lists, the "All Sources by Default" bullet, and the command examples on the same page.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/guide/index.md, line 92:
<comment>Documentation update is incomplete: Antigravity CLI was added to the data-source table but is still missing from the introductory capability lists, the "All Sources by Default" bullet, and the command examples on the same page.</comment>
<file context>
@@ -72,28 +72,29 @@ Each data source page covers the details that only apply to that source, includi
+| Qwen | `qwen` | `${QWEN_DATA_DIR:-~/.qwen}` |
+| Copilot CLI | `copilot` | `~/.copilot/otel/*.jsonl` |
+| Gemini CLI | `gemini` | `${GEMINI_DATA_DIR:-~/.gemini/tmp}` |
+| Antigravity CLI | `antigravity` | `${ANTIGRAVITY_DATA_DIR:-~/.gemini/antigravity-cli}` |
The tool automatically detects available data and aggregates all supported coding CLIs by default.
</file context>
|
@kexi hey, did you find the token info on log? last time i saw it i couldn't find it |
|
@ryoppippi |
Summary
Adds support for tracking usage from the Antigravity CLI as a new agent source in
ccusage. Antigravity stores per-conversation transcripts under~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript.jsonl, which ccusage now discovers, parses, and surfaces through the unified report model plus a focusedccusage antigravitynamespace (daily,monthly,session).What Changed
rust/crates/ccusage/src/adapter/antigravity/— new adapter withpaths,parser,loader, andreportmodules that read the transcript jsonl format, estimate token usage from character counts (Antigravity does not record raw token counts), and feed the unified loader.rust/crates/ccusage-cli/— registers theantigravitysubcommand, root-help listing, and snapshots.rust/crates/ccusage/src/adapter/all/— wires Antigravity into the unifiedallloader/report.rust/crates/ccusage/src/config*.rsandapps/ccusage/config-schema.json— addsantigravity-scoped configuration and updates the generated JSON schema.docs/guide/antigravity/index.mdanddocs/.vitepress/config.ts— new docs guide and nav entry;docs/guide/index.mdandsource-support-qa.mdupdated to mention Antigravity.Why
Antigravity CLI is a new Gemini-based coding agent and users have local transcripts but no built-in way to estimate cost or token usage. Adding it as a first-class source keeps parity with the other supported agents (Claude Code, Gemini CLI, Codex, etc.).
Notes
google/gemini-1.5-flashwhen the recorded model cannot be mapped via LiteLLM.ANTIGRAVITY_DATA_DIR(single dir or comma-separated list) overrides the default location.Testing
cargo test(via pre-push hook in the Nix dev shell)cargo fmt --check🤖 Generated with Claude Code
Summary by cubic
Adds Antigravity CLI as a tracked agent in
ccusage, readingtranscript.jsonllogs to estimate token and cost data. Antigravity usage now appears in unified reports and viaccusage antigravity daily|monthly|session.~/.gemini/antigravity-cli/brain/*/.system_generated/logs/transcript.jsonl, parses events, and estimates tokens from character counts (1.5 tokens/char), including reasoning tokens fromthinking.google/gemini-1.5-flash.antigravitywithdaily,monthly, andsessioncommands; included in the unifiedallloader/report by default.antigravitydefaults and per-command options; updated JSON schema.Written for commit ae6b230. Summary will update on new commits.
Review in cubic
Summary by CodeRabbit
Release Notes
New Features
Documentation