feat: add status CLI subcommand for terminal diagnostics#170
Open
H-TTTTT wants to merge 1 commit into
Open
Conversation
Adds `opencode-quota status` so terminal users can access the same
diagnostics as the `/quota_status` slash command without launching
OpenCode.
- Plain-text report reuses buildQuotaStatusReport (identical format to
the slash command). Report gathering is extracted into a shared,
exported buildStatusReportData() that returns both the rendered text
and a structured payload, keeping the slash-command path unchanged.
- --json emits { version, generatedAt, config, providers, pricing,
liveProbes }.
- --provider <id> filters provider availability and live probes to one
provider.
- Rejects --threshold with a redirect to `show --json --threshold`.
- Exit codes: 0 success, 1 error/disabled, 2 no comparable provider
data (--json only).
- Fully local/deterministic report building; no LLM/model API calls.
Fixes slkiser#163
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #163
Adds
opencode-quota status— a terminal equivalent of the/quota_statusslash command, so CI scripts, SSH sessions, and desktop debugging can access diagnostics without launching OpenCode.Features
/quota_status)--jsonfor scripts:{ version, generatedAt, config, providers, pricing, liveProbes }--provider <id>to filter to one provider0success,1error/disabled,2no comparable data (--jsononly)--thresholdrejected with redirect toshow --json --thresholdImplementation
Reuses existing
buildQuotaStatusReportvia extractedbuildStatusReportData(refactor; TUI behavior unchanged).Test plan
cli-statustests + 3 dispatch testspnpm run typecheck+pnpm run build— clean