Skip to content

feat(cli): show monthly usage and charges - #356

Merged
designcode merged 1 commit into
mainfrom
feat/cli-usage
Oct 6, 2026
Merged

designcode merged 1 commit into
mainfrom
feat/cli-usage

Conversation

@designcode

@designcode designcode commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds tigris usage: the active organization's usage and charges for a billing month — the data behind the console's Usage page (GET {mgmt}/usage/invoice?month=YYYY-MM).

$ tigris usage
October 2026 · Free trial plan · as of 2026-10-06

┌───────────────────────────────────────────┬────────────────┬────────────────┬────────┐
│ Type                                      │ Used           │ Billed         │ Amount │
├───────────────────────────────────────────┼────────────────┼────────────────┼────────┤
│ PUT, COPY, POST, LIST Requests            │   826 Requests │   826 Requests │  $0.00 │
│ GET, SELECT, and all other Requests       │   126 Requests │   126 Requests │  $0.00 │
│ Storage used - Standard                   │ 43.7 GiB-Month │ 43.7 GiB-Month │  $0.00 │
│ Storage used - Standard Infrequent Access │ 0.02 GiB-Month │ 0.02 GiB-Month │  $0.00 │
│ Object Notifications                      │   5,738 Events │   5,738 Events │  $0.00 │
├───────────────────────────────────────────┼────────────────┼────────────────┼────────┤
│ Subtotal                                  │                │                │  $0.00 │
│ Total                                     │                │                │  $0.00 │
└───────────────────────────────────────────┴────────────────┴────────────────┴────────┘
  • Used is the metered quantity, Billed the quantity charged (they differ when a plan minimum applies). --month YYYY-MM for another month (default: current); --all also lists line items with zero usage; --format json returns the full invoice; --format xml emits the charges with raw values plus the invoice amounts. The footer mirrors the console: Minimum Commitment (when the plan has one), Subtotal, each credit, Total — also when nothing was metered. Since the commitment is a floor (total = max(subtotal, minimum commitment) − credits), a note under the table spells it out: "Minimum commitment: your plan bills at least $10.00 a month, before credits." A pay/receipt link is printed as a hint when present. Requires OAuth login.
  • @tigrisdata/iam: getUsage({ month, config }) against the management endpoint, returning a camelCase UsageResponse (charges with tiers, subtotal, credits, total, plan, invoice state). Validates the month before any request; Go zero-times become undefined.
  • formatTable gains an optional footer argument: summary rows set apart by a rule, with column widths that account for them.

Test plan

  • @tigrisdata/iam and @tigrisdata/cli unit tests (new: usage/get.test.ts, test/lib/usage.test.ts, footer cases in format.test.ts); specs-completeness passes with the new entry
  • Verified live against the gateway: tigris usage, --all, --month 2026-09, --format json, --format xml, and --month 2026-13 → exit 1 with a clear message
  • tsc, Biome, README regenerated

🤖 Generated with Claude Code


Note

Medium Risk
Read-only billing/invoice data over the management API behind OAuth, with new client mapping logic; no payment or auth flow changes, but mistakes could misrepresent charges.

Overview
Adds tigris usage so OAuth-authenticated users can view the active org’s monthly usage and charges (console Usage page parity), with --month YYYY-MM, --all for zero lines, and --format table / json / xml.

The CLI calls new @tigrisdata/iam getUsage (GET /usage/invoice), which validates the month, maps the invoice (charges, tiers, credits, minimum commit, checkout/receipt URLs), and strips Go zero timestamps. Table output hides unused line items by default, prints invoice footer rows (commitment, subtotal, credits, total), optional minimum-commitment note, and payment/receipt hints. formatTable gains an optional footer separated by a rule, with column widths including footer text.

Reviewed by Cursor Bugbot for commit 61647d1. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5 Tier: plus

[Medium risk] Adds a new CLI command to display billing usage and charges.

The PR appears safe to merge; no new actionable issue was established.

Summary

Adds tigris usage for monthly invoice data through the IAM management API.

  • Supports table, JSON, and XML output, with month and zero-usage options.
  • Adds invoice footer rows, response mapping, tests, and CLI documentation.

Reviews (5) · Last reviewed commit: "feat(cli): show monthly usage and charge..."

Comment thread packages/cli/src/lib/usage.ts Outdated
Comment thread packages/cli/src/lib/usage.ts Outdated
Comment thread packages/cli/src/lib/usage.ts Outdated
Comment thread packages/cli/src/lib/usage.ts
Comment thread packages/cli/src/utils/format.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 04290bc. Configure here.

Comment thread packages/cli/src/lib/usage.ts
@designcode
designcode force-pushed the feat/cli-usage branch 2 times, most recently from 2043ece to d8895c3 Compare October 6, 2026 13:52
Comment thread packages/cli/src/lib/usage.ts Outdated
Comment thread packages/iam/src/lib/usage/get.ts
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Assisted-by: Claude Fable 5.1 via Claude Code
@designcode
designcode merged commit ef397c4 into main Oct 6, 2026
3 checks passed
@designcode
designcode deleted the feat/cli-usage branch October 6, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants