npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wakatime/opencode-wakatime

v1.0.0

Published

Official WakaTime plugin for OpenCode: Track your OpenCode usage with WakaTime

Readme

WakaTime for OpenCode

Track AI coding activity, file changes, token usage, costs, and more from OpenCode v2 with WakaTime.

Installation

Add the official package to your ~/.config/opencode/opencode.json (or your project's opencode.json):

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["@wakatime/opencode-wakatime"]
}

Keep any existing entries in the plugins array. OpenCode installs npm plugins automatically at startup. Restart OpenCode after changing the config. See OpenCode's plugin documentation.

Add your WakaTime API key to ~/.wakatime.cfg:

[settings]
api_key = waka_123

The plugin automatically downloads wakatime-cli into ~/.wakatime/. No global npm install or manual CLI installation is required. The npm package must be published before the package-name installation above is available.

What is tracked

Like the official Claude Code and Codex CLI plugins, this plugin delegates transcript parsing and delivery to the official wakatime-cli. It requires CLI v2.26.6 or newer and automatically upgrades older installations.

  • File creation, edits, and deletions from successful write, edit, and apply_patch tools.
  • Added and deleted lines from OpenCode's diff metadata, reported as WakaTime's signed ai_line_changes (additions minus deletions). For example, +5/-2 is reported as 3; deleting 5 lines is -5.
  • Input tokens, cached input tokens, and output tokens. The CLI includes cache writes in input tokens and reasoning in output tokens.
  • User prompt lengths in Unicode characters, without sending prompt text as heartbeat data.
  • Session, model, project, and OpenCode version information (read directly from the v2 host).

OpenCode v2's SQLite transcripts (session_v2 and session_message) are supported. The CLI honors XDG_DATA_HOME, OPENCODE_DATA_DIR, and OPENCODE_DB_PREFIX when locating transcripts.

Syncs are coalesced and serialized, and wait for active turns (including subagents) to become idle so completed tools and token totals are persisted. Failed or interrupted executions and plugin cleanup also trigger pending syncs when no turn remains active. Network failures are logged without interrupting OpenCode; the CLI handles offline storage and deduplication.

Configuration and troubleshooting

The standard ~/.wakatime.cfg settings apply. Set debug = true under [settings] to enable debug logs. Downloader proxy settings (proxy, no_ssl_verify) follow the official Codex plugin. WAKATIME_HOME selects an alternate existing home directory containing .wakatime.cfg and .wakatime/.

Plugin logs: ~/.wakatime/opencode.log. CLI logs: ~/.wakatime/wakatime.log. Update checks are cached for four hours; an unavailable update does not replace a working CLI.

Optional diagnostic commands:

npx @wakatime/opencode-wakatime --install
npx @wakatime/opencode-wakatime --sync /path/to/project

Development

Node.js 20+; no npm dependencies or build step are required.

npm test
npm run check
npm pack --dry-run

Integration tests require Node.js 22.13+ and use a released CLI with isolated synthetic OpenCode storage. All HTTP requests are sent to a local mock WakaTime API:

WAKATIME_CLI_TEST_PATH=/path/to/wakatime-cli npm run test:integration

For local OpenCode testing before publication, add "file:///absolute/path/to/opencode-wakatime" to the plugins array in opencode.json.

The downloader is adapted from the official Codex CLI plugin under the BSD-3-Clause license. The plugin uses the v2 default export, event subscription, and cleanup API described in OpenCode’s plugin documentation.