Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 1.24 KB

File metadata and controls

35 lines (29 loc) · 1.24 KB

AGENTS.md - Usage Tracking Plugin

OpenCode plugin for tracking AI provider usage, rate limits, and quotas.

Dev Flow

  • tsc --noEmit - MUST use for type-checking before any commit.
  • npm run build - Compiles project to dist/.
  • ? RECOMMENDATION: Implement a one-shot test command (e.g., bun test or vitest).
## Implementation Patterns - MUST implement `UsageProvider` interface from `src/providers/base.ts`. - MUST register new providers in `src/providers/index.ts`. - MUST use `src/usage/config.ts` for all configuration access.

Safety & Constraints

  • MUST NOT run long-running/blocking processes (dev servers, watch modes).
  • MUST NOT modify dist/ directly; it is generated by tsc.
  • MUST NOT modify package-lock.json unless changing dependencies.

Routing

  • Provider Logic: src/providers/ (See src/providers/AGENTS.md)
  • Plugin Entry: src/index.ts
  • Usage UI: src/ui.ts
  • Hook Handlers: src/hooks/

<context_hints>

  • src/types.ts - Shared schemas (UsageSnapshot, UsageEntry, PlanType).
  • src/state.ts - In-memory usage snapshot cache.
  • src/index.ts - Plugin entry point and hook registration.
  • Ignore: dist/, node_modules/, **/*.test.ts. </context_hints>