Skip to content

refactor: strip plugin to minimum needed #12 - #13

Merged
four-bytes-robby merged 8 commits into
mainfrom
refactor/12-strip-to-minimum
Jun 6, 2026
Merged

refactor: strip plugin to minimum needed #12#13
four-bytes-robby merged 8 commits into
mainfrom
refactor/12-strip-to-minimum

Conversation

@four-bytes-robby

Copy link
Copy Markdown
Member

Closes #12

Summary

Strips the deepseek-meter plugin to its absolute minimum needed functionality:

Removed

  • Unused @opentui/core dependency
  • YELLOW constant (never referenced)
  • is_available field from BalanceResponse (never read)
  • Separate BalanceInfo interface (inlined into BalanceResponse)
  • granted balance display line (non-essential)
  • createMemo and Show imports (no longer needed)
  • Over-engineered model URL checking in isDeepSeek() (now only checks provider id + baseURL)
  • DEEPSEEK_API_KEY env var reference (plugin reads from opencode provider state)
  • Complex Bun.build() in build script (now simple copy)

Result

  • tui.tsx: 131 → 101 lines
  • package.json: 46 → 45 lines, one less dependency
  • build.ts: 26 → 4 lines
  • README: simplified and accurate

@four-bytes-robby four-bytes-robby self-assigned this Jun 6, 2026
- Use createEffect + createMemo on session messages instead of setInterval
- 10s MIN_REFRESH_INTERVAL_MS throttle to avoid API spam
- Pass session_id from sidebar slot props to DeepseekView
- Removes onCleanup (no timer to clean)
- Server → dist/four-opencode-deepseek-meter.js
- TUI → dist/four-opencode-deepseek-meter-tui.jsx
- Single step: bun run build
…12

Replaced hardcoded hex constants (GREEN/ORANGE/RED) with theme().success,
theme().warning, theme().error - matching the RGBA type expected by fg prop.
Also removed the old getPalette() compat layer that was silently converting
RGBA to fallback strings.
…nsive guards #12

package.json:
- sidebar: change from string "true" back to boolean true
- add back enabled: true to both server and tui configs
- restore "." root export
- tighten peerDeps to >=1.16.2/0.3.2/1.9.13 (matching last working versions)

tui.tsx:
- add ?. guards on api.state and api.state.session
- prevents TypeError if state/session API surface is missing
- Build: tsc (jsx:preserve) for TUI + Bun.build for server
- TUI: theme.warning color when balance < 3.00
- package.json: proper .d.ts types, simplified exports
- Remove config blocks, move deps back to dependencies
@four-bytes-robby
four-bytes-robby merged commit c65bf2b into main Jun 6, 2026
1 check passed
@four-bytes-robby
four-bytes-robby deleted the refactor/12-strip-to-minimum branch June 6, 2026 20:50
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.

refactor: strip plugin to minimum needed

1 participant