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

opencommand-plugin

v0.0.18

Published

OpenCommand - CommandCode API Plugin for OpenCode

Downloads

2,327

Readme

OpenCommand

OpenCommand is één OpenCode/NPM-plugin voor CommandCode. De plugin registreert de provider opencommand, start lokaal een OpenAI-compatible proxy en bundelt die proxy-binaries zelf in het NPM-package.

Er is dus geen losse proxy-installatie of lokale repo-checkout meer nodig in OpenCode. De Go-code staat nog wel in proxy/, maar alleen als broncode: bij npm run build:proxy worden de binaries naar dist/proxy/ gebouwd en met opencommand-plugin gepubliceerd.

Huidige structuur

.
├── bin/opencode-plugin.js        # OpenCode plugin entrypoint
├── src/index.ts                  # plugin runtime/provider/proxy manager
├── proxy/                        # Go source voor de lokale proxy
├── scripts/build-proxy-binaries.mjs
├── tests/                        # Jest tests voor plugin/runtime
├── package.json                  # NPM package: opencommand-plugin
└── dist/                         # build output, niet getrackt

Gebruik met OpenCode

Gebruik na publicatie:

{
  "plugin": ["opencommand-plugin@latest"],
  "model": "opencommand/deepseek/deepseek-v4-flash",
  "small_model": "opencommand/deepseek/deepseek-v4-flash"
}

Voor een vaste versie kun je een specifieke versie pinnen, bijvoorbeeld [email protected].

Bij OpenCode-start doet de plugin dit automatisch:

  1. kiest de juiste gebundelde proxybinary voor macOS/Linux/Windows;
  2. start de proxy op een lokale poort;
  3. schrijft ~/.opencommand/proxy-config.json met de actieve URL;
  4. registreert provider opencommand met http://localhost:<port>/v1;
  5. detecteert het actieve CommandCode-plan en registreert de bijpassende modellen.

OpenCode moet opnieuw worden gestart nadat opencode.jsonc of de pluginversie is gewijzigd, want plugin-config wordt bij startup geladen.

Auth-model

Gebruik primair een CommandCode token (user_...). Zet secrets niet in gesyncte opencode.jsonc.

Prioriteit:

  1. inkomende Authorization: Bearer user_... requests;
  2. COMMAND_CODE_TOKEN;
  3. alias COMMANDCODE_API_KEY;
  4. lokale secret ~/.opencommand/opencommand-secrets.json met sleutel opencommand.command_code_token.

Voorbeeld:

{
  "opencommand.command_code_token": "user_xxx..."
}

De plugin maakt ~/.opencommand met 0700 permissies en schrijft secrets met 0600. CC_SESSION_COOKIE is alleen bedoeld voor CommandCode Studio usage scraping, niet als primaire model-auth.

Lokale bestanden

OpenCommand gebruikt alleen lokale bestanden buiten de repo:

  • ~/.opencommand/opencommand-secrets.json — CommandCode token en optionele Studio-cookie.
  • ~/.opencommand/proxy-config.json — actieve proxy URL/poort.
  • ~/.opencommand/model-cache.json — laatst bekende plan/model-lijst.

Voorbeeld proxy-config.json:

{
  "url": "http://localhost:3000",
  "port": 3000,
  "updatedAt": "2026-05-19T20:00:00.000Z"
}

Browser-cookie extractie

Voor usage scraping kan de plugin proberen een CommandCode Studio-cookie te vinden in lokale browserprofielen:

  • macOS: Chrome, Comet, Brave, Edge en Firefox.
  • Linux: Chrome, Chromium, Brave, Edge en Firefox.
  • Windows: Chrome, Chromium, Brave, Edge en Firefox.

Linux en Windows hebben hiervoor een sqlite3 CLI nodig om browser-cookie databases te lezen. Zet op Windows OPENCOMMAND_SQLITE_PATH naar sqlite3.exe als sqlite niet op je PATH staat.

Gevonden cookies worden lokaal opgeslagen als:

{
  "opencommand.cc_session_cookie": "..."
}

Cookie-waarden worden niet gelogd en niet in opencode.jsonc opgeslagen.

Model-detectie per plan

De proxy/plugin vraagt /alpha/billing/subscriptions op en filtert modellen per plan:

  • individual-go: open-source modellen.
  • individual-pro: open-source + premium, zonder Opus.
  • individual-max, individual-ultra, teams-pro: open-source + premium inclusief Opus.

Als plan-detectie faalt, valt OpenCommand terug op de lokale cached/static Go/open-source lijst zodat OpenCode alsnog kan starten.

De statische modelcatalogus staat in model-definitions/commandcode-models.json. npm run generate:models genereert hieruit (plus commandcode-plans.json en commandcode-protocol.json) de TypeScript- en Go-runtimebestanden, zodat plugin en proxy dezelfde modeldefinities, plan-regels en protocolversie gebruiken.

Upstream bijwerken: npm run bump:commandcode

Eén bewust commando werkt alle gebundelde CommandCode-data bij:

  1. Protocolversie — laatste CLI-versie via de npm-registry (command-code).
  2. Modelcatalogus — merge met de live provider-API; gecureerde velden (cost, output, category, reasoning) blijven behouden, nieuwe/verdwenen modellen worden gemeld.
  3. Prijzen — gescraped van de pricing-docs-pagina (doorgestreepte oude prijzen worden genegeerd).

Het script schrijft alleen de werkkopie; reviewen en committen blijft handwerk. De publish-workflow draait dezelfde check als gate: een release faalt zolang de gebundelde data achterloopt. De plugin waarschuwt daarnaast bij het starten (max. één registry-call per dag, cache in ~/.opencommand/version-check.json) als de gebundelde protocolversie achterloopt.

Voor tests/CI zijn de bronnen overridebaar via OPENCOMMAND_BUMP_REGISTRY_URL, OPENCOMMAND_BUMP_MODELS_URL, OPENCOMMAND_BUMP_PRICING_URL, OPENCOMMAND_BUMP_ROOT en OPENCOMMAND_BUMP_SKIP_GENERATE=1.

Lokale API

De proxy biedt OpenAI-compatible endpoints:

  • POST /v1/chat/completions — streaming en non-streaming chat completions.
  • GET /v1/models — plan-gefilterde OpenAI model-lijst.
  • GET /v1/models/allowed — CommandCode Studio allowed-models/usage info.
  • GET /v1/account/usage — usage summary.
  • GET /healthz — health check.

De proxy vertaalt OpenAI messages, tools, tool_choice en streaming responses naar/van het huidige CommandCode CLI-protocol.

Development

Root package:

npm ci
npm run generate:models
npm test -- --runInBand
npm run build
npm run build:proxy
npm pack --dry-run

Go proxy tests:

cd proxy
go vet ./...
go test -race ./...
go build -o proxy .

npm pack bevat alleen de runtimebestanden:

  • README.md
  • package.json
  • bin/opencode-plugin.js
  • dist/index.js
  • dist/index.d.ts
  • dist/proxy/opencommand-proxy-*

De bronmappen src/, tests/ en proxy/ worden niet gepubliceerd in het NPM-package.

Publicatie

Package: opencommand-plugin.

De publish workflow staat in .github/workflows/npm-publish.yml. Deze workflow bouwt/test de root package, bouwt de proxybinaries en controleert dat alle vereiste bestanden in het NPM-package zitten.

Release notes

v0.0.17

  • Proxy bindt alleen nog op 127.0.0.1 (was: alle netwerkinterfaces) en alle plugin-URLs gebruiken 127.0.0.1.
  • Lange streams worden niet meer na 120 seconden afgebroken; upstream-requests volgen de client-context.
  • Gecrashte of ontbrekende proxy wordt gedetecteerd: snelle foutmelding bij start en automatische herstart bij het volgende verzoek.
  • Verlopen Studio-cookie wordt bij start gevalideerd en zo nodig opnieuw uit de browser geëxtraheerd.
  • Plan-regels en protocolversie worden gegenereerd uit model-definitions/ (één bron voor TS en Go); plan-cache is per token.
  • Nieuw: npm run bump:commandcode werkt protocolversie, modelcatalogus en prijzen bij vanuit upstream; de publish-workflow dwingt dit af via een drift-gate en de plugin waarschuwt bij start als de gebundelde versie achterloopt.
  • CommandCode protocol headers bijgewerkt naar CLI-versie 0.36.0; modelcatalogus gesynchroniseerd (o.a. Claude Fable 5, Claude Opus 4.8, Gemini 3.5 Flash; claude-opus-4-6 vervallen) inclusief actuele prijzen.
  • Security/hygiëne: ~/.opencommand op 0700 en config/cache-bestanden op 0600; CI controleert coverage, npm-package-inhoud, plugin-export en actualiteit van generated files.

v0.0.16

  • MiniMax M3 (MiniMaxAI/MiniMax-M3) toegevoegd aan de open-source/Go-plan modellen.
  • Qwen 3.7 Max (Qwen/Qwen3.7-Max) toegevoegd aan de open-source/Go-plan modellen.
  • CommandCode protocol headers bijgewerkt naar CLI-versie 0.27.0.

v0.0.12

  • OpenAI-compatible chat schema voor OpenCode requests.
  • Deterministische samenvoeging van system/developer messages naar params.system.
  • Conversie van OpenAI tool calls/results naar CommandCode tool-call/tool-result parts.
  • Conversie van OpenAI tools en tool_choice naar CommandCode tool schema.
  • Fixes voor CommandCode 400-errors rond params.messages[0].role, string content en params.tools[0].name.
  • Repo-layout opgeschoond: root is nu het NPM/OpenCode package; proxy/ is alleen Go-source voor bundled binaries.

v0.0.11

  • NPM-package bundelt proxybinaries voor macOS, Linux en Windows.
  • OpenCode heeft alleen opencommand-plugin nodig; geen losse proxy-installatie.
  • Proxy vertaalt CommandCode streaming events naar OpenAI-compatible chat-completion chunks/responses.

v0.0.10

  • Plugin start de lokale proxy vanuit de OpenCode config hook.
  • Gesyncte opencode.jsonc heeft geen absolute lokale file:// plugin path meer nodig.

v0.0.9

  • CommandCode protocol headers bijgewerkt naar CLI-versie 0.26.3.
  • Productie CLI-environment en OpenCommand project slug toegevoegd.

v0.0.8

  • Non-blocking OpenCode startup: cached/static models direct, proxy/plan refresh op de achtergrond.