CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

Add CLI cards view

Open DonnieFi opened this issue 4 months ago • 5 comments

Summary

  • Add codexbar cards, a one-shot terminal usage snapshot with a responsive provider card grid.
  • Add codexbar cards --brief, a compact Provider / Usage / Reset table with source/plan detail and enhanced terminal colors.
  • Reuse the existing codexbar usage fetch pipeline, summarize provider failures in a footer, and document the new command.

Test plan

  • swift test --filter 'CLICards|CLITerminalCapabilities' (19 tests)
  • swift build --product CodexBarCLI -c release
  • git diff --check
  • make check reaches SwiftFormat cleanly, then fails on this Linux host when SwiftLint/SourceKit cannot load libsourcekitdInProc.so.

Terminal proof (redacted)

codexbar cards --no-color on Linux (head 7566af4):

╭─────────────────────────────────────╮  ╭─────────────────────────────────────╮
│ Codex [oauth]             PLAN Free │  │ Cursor [web]        PLAN Cursor Pro │
│ @ [email protected]                  │  │ @ [email protected]                  │
│ ─────────────────────────────────── │  │ ─────────────────────────────────── │
│ Limit Reset Credits:    0 available │  │ Total                      43% left │
│                                     │  │ [ ━━━━━━━━━━━━━                   ] │
│ Session                    50% left │  │ Reset in 20d 13h                    │
│ [ ━━━━━━━━━━━━━━━                 ] │  │                                     │
│ Reset in 19d 31m                    │  │ Auto                       49% left │
│                                     │  │ [ ━━━━━━━━━━━━━━━                 ] │
│                                     │  │ Reset in 20d 13h                    │
╰─────────────────────────────────────╯  ╰─────────────────────────────────────╯

codexbar cards --brief --no-color on Linux (head 7566af4):

codexbar • AI Usage & Limits                                2026-07-05 21:13 ADT
Next reset: Antigravity in 5h

┌───────────────────────────────────┬──────────────────────────────┬──────────┐
│ Provider                          │ Usage                        │    Reset │
├───────────────────────────────────┼──────────────────────────────┼──────────┤
│ Codex · oauth · Free              │ 50% ███████████░░░░░░░░░░░   │  19d 31m │
│ Cursor · web · Cursor Pro         │ 57% ████████████░░░░░░░░░░   │  20d 13h │
│ Antigravity · cli · Google Ai Pro │ 0% ░░░░░░░░░░░░░░░░░░░░░░    │       5h │
│ OpenRouter · api · Balance: $7.55 │ 100% ██████████████████████  │        — │
│ Grok · web · Supergrok            │ 18% ███░░░░░░░░░░░░░░░░░░░   │   4d 21h │
└───────────────────────────────────┴──────────────────────────────┴──────────┘

⚠ Warnings: OpenRouter approaching session limit

Notes

  • Root screenshot artifacts and the release-owned changelog entry were removed from the branch after review feedback.
  • Package.swift and Package.resolved are intentionally unchanged in the final PR surface.
  • Enhanced rendering now defaults only on Kitty/Ghostty/WezTerm/truecolor-capable terminals, with CODEXBAR_CARDS_ENHANCED=1 as an explicit override.
  • 7566af4 fixes zero-usage/zero-remaining bar rendering in standard brief and card grid paths.

DonnieFi avatar Jul 05 '26 23:07 DonnieFi

Codex review: stale review; fresh review needed.

Summary The latest durable ClawSweeper review was for head 95ebe252e92608e7040aad46f7404e550d01fb2b, but the PR head is now 523dd33bc2686ce3e8fd3903c3b0861599a6ed9d. Its old verdict and PR readiness labels are no longer current.

Next step Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (6 earlier review cycles)
  • reviewed 2026-07-05T23:08:56.785Z sha 6e046c103c9a2209dd6b6345de55ab931c96cd85 :: found issues before merge. :: [P1] Preserve musl imports for the CLI target | [P2] Render used bars from the used percentage | [P2] Gate enhanced cards to capable terminals | [P3] Remove release-owned and generated artifacts
  • reviewed 2026-07-05T23:23:15.516Z sha 1ddc00247fbc200d6f1ad1b965b68786d71ef97a :: needs real behavior proof before merge. :: [P2] Let standard brief bars show zero usage as empty
  • reviewed 2026-07-05T23:28:39.927Z sha 1ddc00247fbc200d6f1ad1b965b68786d71ef97a :: needs real behavior proof before merge. :: [P2] Let standard brief bars show zero usage as empty
  • reviewed 2026-07-05T23:34:22.853Z sha 70e28fe86eae161ae242b9a0c9f489e51b80af69 :: needs real behavior proof before merge. :: [P2] Let standard brief bars show zero usage as empty
  • reviewed 2026-07-06T00:20:37.084Z sha 7566af4d9876ce623c4d0c0771d2dfdca3ea9f3f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-06T22:16:23.371Z sha 95ebe252e92608e7040aad46f7404e550d01fb2b :: needs maintainer review before merge. :: none

clawsweeper[bot] avatar Jul 05 '26 23:07 clawsweeper[bot]

Addressed the ClawSweeper findings in 1ddc002:

  • preserved musl compatibility by using canImport(Glibc) / canImport(Musl) / canImport(Darwin)
  • fixed enhanced brief bars to fill from used percentage, with 0% and 100% coverage
  • gated enhanced cards to truecolor-capable terminals unless explicitly opted in
  • removed committed root screenshots
  • removed the release-owned changelog and Package.swift changes from the net PR diff

Validation:

  • swift test --filter 'CLICards|CLITerminalCapabilities'
  • swift build --product CodexBarCLI -c release
  • git diff --check
  • make check still reaches SwiftFormat cleanly, then hits the local Linux SwiftLint/SourceKit load issue (libsourcekitdInProc.so).

@clawsweeper re-review

DonnieFi avatar Jul 05 '26 23:07 DonnieFi

🦞🧹 ClawSweeper re-review requested.

I asked ClawSweeper to review this item again. Action: item re-review queued (workflow sweep.yml, event repository_dispatch). Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

clawsweeper[bot] avatar Jul 05 '26 23:07 clawsweeper[bot]

@clawsweeper re-review — pushed 7566af4 with zero-bar fixes, expanded tests, and redacted terminal proof in the PR body.

DonnieFi avatar Jul 06 '26 00:07 DonnieFi

🦞🧹 ClawSweeper re-review requested.

I asked ClawSweeper to review this item again. Action: item re-review queued (workflow sweep.yml, event repository_dispatch). Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

clawsweeper[bot] avatar Jul 06 '26 00:07 clawsweeper[bot]