Skip to content

Feat/rho usage support - #1455

Closed
matthewyjiang wants to merge 2 commits into
ccusage:mainfrom
matthewyjiang:feat/rho-usage-support
Closed

matthewyjiang wants to merge 2 commits into
ccusage:mainfrom
matthewyjiang:feat/rho-usage-support

Conversation

@matthewyjiang

@matthewyjiang matthewyjiang commented Jul 18, 2026 •

Copy link
Copy Markdown

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Adds Rho usage support by reading its SQLite usage ledger (schema v1) for daily, weekly, monthly, and session reports, and includes Rho in unified reports. Also adds an Arch Linux PKGBUILD to build and package the native CLI.

  • New Features

    • New rho adapter reads ~/.rho/usage.sqlite3 (override with RHO_HOME), opens read-only.
    • Commands: ccusage rho daily, ccusage rho weekly, ccusage rho monthly, ccusage rho session.
    • Unified reports now auto-detect Rho usage.
    • Cost modes supported: auto (uses provider USD micros when present), calculate, display.
    • Preserves cache-read/write token categories and unclassified extra total tokens; keeps provider/model as recorded.
    • CLI help, parser, tests, progress labels, and docs updated; config schema adds rho.defaults and rho.commands options.
    • Adds PKGBUILD with pinned LiteLLM pricing snapshot for reproducible Arch builds.
  • Migration

    • Use a Rho build that writes usage ledger schema version 1; see docs/guide/rho/ and rho-usage-ledger-instructions.md.
    • Set RHO_HOME if your database is not in ~/.rho.
    • Run focused or unified reports, e.g. ccusage rho daily or ccusage daily.

Written for commit fa76109. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added support for Rho usage data.
    • Added daily, weekly, monthly, and session reports with JSON/JQ output.
    • Added configurable Rho options, cost modes, timezone handling, and pricing overrides.
    • Added Arch Linux packaging support.
  • Documentation

    • Added Rho setup, configuration, usage, and troubleshooting guidance.
    • Added Rho to supported-source navigation and examples.

Add daily, weekly, monthly, and session reporting for Rho's versioned
SQLite usage ledger. Preserve provider costs, cache categories,
unclassified total tokens, and session metadata while opening the ledger
read-only for compatibility with a running Rho process.

Include Rho in unified reports, CLI help, configuration schema, adapter
references, and user documentation. Document the producer-side ledger
contract needed for Rho to emit compatible accounting events.
Add a checksummed PKGBUILD for x86_64 and aarch64 that builds the native
Rust CLI and installs its license. Fetch the pinned LiteLLM pricing
snapshot as a package source so Cargo can build offline with frozen
inputs.

Disable makepkg's C/C++ LTO because it breaks the bundled AWS-LC archive;
the Rust workspace release profile continues to apply fat LTO.
@github-actions

Copy link
Copy Markdown
Contributor

This PR was auto-closed. Only contributors approved with lgtm can open PRs. Open an issue first.

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 lgtmi, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open.

See CONTRIBUTING.md.

@github-actions github-actions Bot closed this Jul 18, 2026
@matthewyjiang
matthewyjiang deleted the feat/rho-usage-support branch July 18, 2026 03:47
@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bb2c0f4a-104f-4109-9e11-4bcb414c6fd9

📥 Commits

Reviewing files that changed from the base of the PR and between 7acee6c and fa76109.

⛔ Files ignored due to path filters (2)
  • rust/crates/ccusage-cli/src/snapshots/ccusage_cli__tests__root_help.snap is excluded by !**/*.snap
  • rust/crates/ccusage/src/snapshots/ccusage__config_schema__tests__snapshots_schema_agent_specific_option_edges.snap is excluded by !**/*.snap
📒 Files selected for processing (28)
  • .agents/skills/agent-sources/SKILL.md
  • PKGBUILD
  • apps/ccusage/README.md
  • apps/ccusage/config-schema.json
  • docs/.vitepress/config.ts
  • docs/guide/config-files.md
  • docs/guide/index.md
  • docs/guide/rho/index.md
  • docs/guide/weekly-reports.md
  • docs/index.md
  • rho-usage-ledger-instructions.md
  • rust/crates/ccusage-cli/src/cli-commands.json
  • rust/crates/ccusage-cli/src/parser.rs
  • rust/crates/ccusage-cli/src/tests.rs
  • rust/crates/ccusage-cli/src/types.rs
  • rust/crates/ccusage/src/adapter/all/loader.rs
  • rust/crates/ccusage/src/adapter/all/report.rs
  • rust/crates/ccusage/src/adapter/all/tests.rs
  • rust/crates/ccusage/src/adapter/mod.rs
  • rust/crates/ccusage/src/adapter/rho/README.md
  • rust/crates/ccusage/src/adapter/rho/loader.rs
  • rust/crates/ccusage/src/adapter/rho/mod.rs
  • rust/crates/ccusage/src/adapter/rho/parser.rs
  • rust/crates/ccusage/src/adapter/rho/paths.rs
  • rust/crates/ccusage/src/adapter/rho/report.rs
  • rust/crates/ccusage/src/config_schema.rs
  • rust/crates/ccusage/src/main.rs
  • rust/crates/ccusage/src/progress.rs

📝 Walkthrough

Walkthrough

Adds experimental Rho support across SQLite ingestion, cost handling, daily/weekly/monthly/session reports, unified loading, CLI commands, configuration schemas, documentation, and Arch packaging. It also adds a separate Rho usage-ledger design document.

Changes

Rho integration

Layer / File(s) Summary
Rho database adapter
rust/crates/ccusage/src/adapter/rho/*, rust/crates/ccusage/src/adapter/mod.rs
Loads usage_events from usage.sqlite3, maps events into internal entries, handles cost modes and fallbacks, and tests database discovery and parsing.
Rho reporting and unified loading
rust/crates/ccusage/src/adapter/all/*, rust/crates/ccusage/src/adapter/rho/{mod,report}.rs, rust/crates/ccusage/src/main.rs, rust/crates/ccusage/src/progress.rs
Adds Rho aggregation, JSON/table output, unified loading, progress labels, and integration coverage.
Rho CLI commands
rust/crates/ccusage-cli/src/*
Adds rho with daily, weekly, monthly, and session commands, shared options, parser validation, metadata, and tests.
Rho configuration schema
rust/crates/ccusage/src/config_schema.rs, apps/ccusage/config-schema.json
Adds Rho defaults and per-command configuration definitions.
Rho documentation and references
apps/ccusage/README.md, docs/guide/..., docs/.vitepress/config.ts, .agents/skills/agent-sources/SKILL.md
Documents Rho commands, storage, configuration, report behavior, navigation, and supported-source listings.

Arch packaging

Layer / File(s) Summary
Arch package build
PKGBUILD
Defines pinned sources, Cargo preparation/build/test steps, package metadata, and installation paths.

Rho ledger design

Layer / File(s) Summary
Usage ledger instructions
rho-usage-ledger-instructions.md
Describes the SQLite usage-ledger schema, event persistence, cost/token semantics, concurrency handling, and acceptance tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant RhoAdapter
  participant SQLite
  participant Report
  User->>CLI: Run ccusage rho daily
  CLI->>RhoAdapter: Dispatch Rho command
  RhoAdapter->>SQLite: Read usage_events
  SQLite-->>RhoAdapter: Return usage events
  RhoAdapter->>Report: Aggregate entries
  Report-->>User: Render JSON or usage table
Loading

Possibly related PRs

  • ccusage/ccusage#1032: Parallel new-agent integration across CLI, configuration, progress, and adapter wiring.
  • ccusage/ccusage#1066: Changes to the unified all-agent loading pipeline used by the Rho loader.
  • ccusage/ccusage#1157: Refactoring of the CLI parsing surface extended here for the Rho command.

Suggested reviewers: ryoppippi

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@matthewyjiang
matthewyjiang restored the feat/rho-usage-support branch July 18, 2026 03:49
@matthewyjiang
matthewyjiang deleted the feat/rho-usage-support branch July 18, 2026 03:50
@matthewyjiang

Copy link
Copy Markdown
Author

sorry, made this by accident. meant to do it to my fork

@ryoppippi ryoppippi added the triage:excluded Excluded from the current maintenance scope. label Aug 31, 2026
@ryoppippi

Copy link
Copy Markdown
Member

Historical audit: this pull request was auto-closed by the legacy contributor gate. That closure did not assess technical importance.

Audit result: excluded from the current maintenance scope. This change depends on an unsupported external source, unavailable schema or fixture, platform or release infrastructure the project cannot reliably maintain, an operational service, or an unsafe or underspecified design. It is not a candidate for automatic revival or implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:excluded Excluded from the current maintenance scope.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants