Skip to content

feat: Go usage meter — TUI sidebar + go_usage tool (#1) - #2

Merged
four-bytes-robby merged 6 commits into
mainfrom
feat/1-go-usage-meter
Nov 30, 2026
Merged

four-bytes-robby merged 6 commits into
mainfrom
feat/1-go-usage-meter

Conversation

@four-bytes-robby

Copy link
Copy Markdown
Member

Description

OpenCode Go usage meter, modelled on four-opencode-deepseek-meter, plus an agent-callable tool.

Closes #1

Changes

  • go_usage tool: available: yes|no|unknown + 5-hour / weekly / monthly meters with reset times; never throws, key redacted from any upstream message
  • TUI sidebar row GO 5h 30% · wk 12% · mo 40% (green / yellow ≥80 % / red)
  • Key lookup: auth.json opencode-go (data → state dir) → ~/.secrets/opencode-go-key → OPENCODE_GO_API_KEY → OPENCODE_API_KEY
  • Official endpoint GET https://opencode.ai/inference/go/v1/usage (opencode.ai/docs/go)

Testing

  • bun run build passes
  • bunx tsc --noEmit 0 errors
  • bun test 31 pass
  • Manual test: live call with a valid Go key — pending, current key returns 401 api_key_expired (handled: INVALID KEY)

Review

Local code review 88 % → findings 1/2/4/5 fixed (key redaction, unrounded availability check, unknown status ≠ ok, tool-path never-throw tests), 3 documented (state-dir fallback is TUI-only).

🤖 Generated with Claude Code

@four-bytes-robby four-bytes-robby added the feature New feature label Nov 30, 2026
@four-bytes-robby four-bytes-robby self-assigned this Nov 30, 2026
@four-bytes-robby
four-bytes-robby merged commit 0b48d36 into main Nov 30, 2026
1 check was pending
@four-bytes-robby
four-bytes-robby deleted the feat/1-go-usage-meter branch November 30, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Go usage meter: TUI sidebar + go_usage tool

1 participant