Skip to content

feat(org): add remaining credit balance command - #652

Merged
ImLunaHey merged 2 commits into
mainfrom
luna/cli-credit-balance
Oct 27, 2026
Merged

ImLunaHey merged 2 commits into
mainfrom
luna/cli-credit-balance

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Expose the organization's posted Stripe invoice-credit balance through the CLI, following depot/api#6306.

# DEPOT_TOKEN must contain an organization or read-only organization token
depot org credits
depot org credits --output json
  • Human output shows currency-aware decimal amounts and observation time using exact integer arithmetic.
  • JSON preserves the API's minor-unit string, currency, timestamp, and explicit zero.
  • Authentication uses the token's organization, without login prompts or an organization override.
  • Polling-limit errors include Retry-After; failures exit without printing a balance or retrying.
  • Update the published Go protobuf clients and document the command.

Validation: go test ./..., go test -race ./pkg/cmd/org, golangci-lint, CLI build, module verification/tidy, and npm formatting/type checks pass locally. Cross-platform packaging and the Docker validation harness run in CI.

Closes DEP-7947


Note

Low Risk
Read-only billing visibility with org-token auth; no changes to build, push, or credential storage beyond a new API call path.

Overview
Adds depot org credits to read an organization’s posted Stripe invoice-credit balance via the new CreditService API client.

The command is aimed at automation: it requires an organization or read-only org token (DEPOT_TOKEN, --token, or stored config), does not prompt for login, and does not honor depot org switch or --org. Human output formats minor units with golang.org/x/text/currency; --output json emits the API protobuf JSON as-is. Rate-limit responses surface Retry-After; failures exit without printing a balance or retrying.

Also bumps the generated depot/api Connect/protobuf modules, wires NewCmdCredits under depot org, documents usage in the README, and adds broad unit tests (formats, auth, validation, errors).

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

Catch up on this pull request in Depot

@linear-code

linear-code Bot commented Oct 27, 2026

Copy link
Copy Markdown

DEP-7947

@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.

Risk: high. Left a non-blocking comment: Cursor Bugbot was present but did not reach a terminal state within the 8-minute wait, so this PR is not approved. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@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.

Risk: high. Approved: Cursor Bugbot completed successfully with no findings that need human review, and this billing CLI change is within the configured approval threshold. No reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@ImLunaHey
ImLunaHey merged commit 5b3ed18 into main Oct 27, 2026
12 checks passed
@ImLunaHey
ImLunaHey deleted the luna/cli-credit-balance branch October 27, 2026 15:37
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.

1 participant