Skip to content

Studio Code CLI: show remaining AI credits in the end-of-turn stats line - #4712

Merged
youknowriad merged 1 commit into
trunkfrom
claude/studio-code-cli-credits-stats-65842e
Aug 28, 2026
Merged

Studio Code CLI: show remaining AI credits in the end-of-turn stats line#4712
youknowriad merged 1 commit into
trunkfrom
claude/studio-code-cli-credits-stats-65842e

Conversation

@youknowriad

@youknowriad youknowriad commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • N/A

How AI was used in this PR

Implemented with Claude Code (design discussed and reviewed by the author).

Proposed Changes

When a Studio Code turn finishes in the CLI, the end-of-turn stats line now also shows the account's remaining AI credit balance:

Thought for 42s · 3 turns · 1,110,000 credits left

This gives terminal users the same at-a-glance balance the browser UI's credits control already offers, right where they'd look after each turn — no need to open the app or the usage settings to know how much is left.

The stats line still renders immediately; the balance is fetched from the WordPress.com quota endpoint in the background and appended in place when it arrives. The segment is quietly omitted whenever it wouldn't be meaningful: sessions replayed from history, turns run on the user's own Anthropic API key (no credits burned), signed-out sessions, a failed quota fetch, or accounts without the AI Credits feature (where the server omits the per-pool balances — deliberately treated as "hide", not a zero balance).

Testing Instructions

  • npm run cli:build && node apps/cli/dist/cli/main.mjs code with the WordPress.com provider, send a prompt, and check the stats line after the turn ends shows · N credits left.
  • Switch to the Anthropic API key provider (/provider) and confirm the line stays bare.
  • Unit tests: npm test -- apps/cli/ai/tests/ui.test.ts

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing ccb85e4 vs trunk

app-size

Metric trunk ccb85e4 Diff Change
App Size (Mac) 1422.12 MB 1422.09 MB 0.04 MB ⚪ 0.0%

site-editor

Metric trunk ccb85e4 Diff Change
load 1163 ms 1136 ms 27 ms ⚪ 0.0%

site-startup

Metric trunk ccb85e4 Diff Change
siteCreation 7520 ms 7495 ms 25 ms ⚪ 0.0%
siteStartup 2866 ms 2915 ms +49 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad
youknowriad merged commit 2bae514 into trunk Aug 28, 2026
15 checks passed
@youknowriad
youknowriad deleted the claude/studio-code-cli-credits-stats-65842e branch August 28, 2026 11:00
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