update(opencode-go): fix dashboard scraping + display all three usage windows#62
Closed
capyBearista wants to merge 2 commits intoslkiser:mainfrom
Closed
update(opencode-go): fix dashboard scraping + display all three usage windows#62capyBearista wants to merge 2 commits intoslkiser:mainfrom
capyBearista wants to merge 2 commits intoslkiser:mainfrom
Conversation
Implemented a multi-strategy parsing approach for the OpenCode Go dashboard to handle varied SolidJS hydration patterns and pure JSON objects. Added smart URL normalization for workspace IDs and enhanced error reporting with masked HTML snippets to aid future debugging without leaking sensitive data.
Parses rolling, weekly, and monthly usage from the OpenCode Go dashboard using string-aware brace matching with strict anchor isolation against SolidJS $R[...] hydration markers. The old regex-only approach was fragile against dashboard markup changes. - Rolling timer is blank when idle (0% usage), active otherwise - Weekly/Monthly always show live countdowns (fixed cycles) - Ordered Rolling -> Weekly -> Monthly in the TUI sidebar - forceAllWindows ensures all three display regardless of formatStyle - Plural forms added to duration ranking (weeks, days, months, years)
This was referenced Apr 27, 2026
Owner
|
@capyBearista I took somethings and added them to #65 (scraping was better here in #62) |
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
This PR adds support for all three OpenCode Go usage windows—Rolling, Weekly, and Monthly—alongside a rewritten dashboard scraper (for robustness).
The previous implementation only parsed
monthlyUsageand relied on brittle regex patterns that broke on dashboard markup changes (e.g., extra fields like status appearing between usage data). The scraper has been replaced with a strategy-based approach; [according to an LLM explaining the regex] it now uses "string-aware brace-depth matching and strict anchor isolation against $R[...] hydration markers". This correctly handles decoy keys (like billing metadata), braces inside string literals, and field order variations.Behavioral details:
Rolling: Timer is blank when idle (0% usage), showing a live countdown only once usage beginsWeekly/Monthly: Timers always display live countdowns since they don't depend on the user to initiate a session/quota_statusnow report all three windows separatelyExample:
What it looks like now:
Linked Issue
No existing issue. Rationale: The OpenCode Go quota was failing to be scraped, "throwing a vague
live_fetch_errorand was previously also limited to a single monthly usage window. This expands the provider to parity with the actual dashboard, which has always exposed all three windows.OpenCode Validation
Quality Checklist
npm run typechecknpm testnpm run buildREADME.mdandCONTRIBUTING.mdwhen applicable)