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

opencode-mega-agent

v0.4.0

Published

OpenCode plugin for MegaRouter cloud agents — auto-discovers and registers specialist AI agents (code review, security audit, debugging, etc.) as native subagents

Readme

opencode-mega-agent

OpenCode plugin that connects MegaRouter cloud agents to your editor. Agents are domain-trained specialist AIs (code reviewer, security auditor, debugger, etc.) that can read files, run commands, and search your codebase.

Quick Start

npm install opencode-mega-agent

Add to opencode.json:

{
  "plugin": ["opencode-mega-agent"],
  "provider": {
    "mega-router": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.megarouter.ai/v1",
        "apiKey": "sk-mega-..."
      }
    }
  }
}

Restart OpenCode. Done — cloud agents appear as native subagents.

Getting an API Key

Sign in at megarouter.ai with your wallet, navigate to API Keys, and click Create New Key. Copy the key immediately — it's shown only once. First key creation grants free credits.

How It Works

On startup the plugin:

  1. Discovers agents — calls GET /api/v1/agents to fetch the catalog
  2. Injects config — registers each agent as a native subagent (cfg.agent) and model (cfg.provider.models)
  3. Caches manifest — writes .opencode/.mega-router-agents.json for offline resilience
  4. Injects system prompt — teaches the AI about available agents and how to invoke them

Invocation

Cloud agents run as native OpenCode subagents with full tool access (read files, run commands, edit code):

task(subagent_type="code-reviewer", prompt="Review auth.go for security issues")

Available Agents

| Agent | Specialty | |-------|-----------| | code-reviewer | Code review — bugs, security, style | | security-reviewer | OWASP security audit | | frontend-advisor | Frontend/UX — components, a11y, performance | | code-debugger | Root cause debugging | | devops-cli | Infrastructure & deployment | | doc-writer | Technical documentation | | data-analyst | Data analysis & visualization | | research-assistant | Deep research with citations | | git-assistant | Git workflow — commits, rebases | | api-tester | API endpoint testing | | office-hours | Product/business brainstorming | | creative-writer | Stories, poems, copywriting |

Offline / Backend Down

If the MegaRouter API is unreachable at startup, the plugin loads agents from:

  1. Disk cache (.opencode/.mega-router-agents.json) — from last successful discovery
  2. Hardcoded fallback — built-in list of 12 standard agents

Configuration

| Source | Priority | Notes | |--------|----------|-------| | opencode.json provider.mega-router.options | 1st | Recommended | | MEGAROUTER_BASE_URL / MEGAROUTER_API_KEY env vars | 2nd | Fallback |

Troubleshooting

"Authentication failed" — API key is invalid or expired. Check opencode.jsonprovider.mega-router.options.apiKey.

"Insufficient credits" — MegaRouter balance is too low. Top up at the dashboard.

Agents not showing up — Ensure the backend is reachable at the configured baseURL. Check .opencode/.mega-router-agents.json for cached state.

Using with Claude Code

For Claude Code users, cloud agents are available via the MCP server (mega-router-mcp) or through the cloud_agent tool defined in CLAUDE.md. See the project root for setup instructions.

Local Development

For contributors working on the MegaRouter codebase:

# 1. Start all services
make dev                    # starts PostgreSQL, backend, frontend

# 2. Generate a dev API key (auto-updates opencode.json)
make genkey

# 3. Use local plugin path in opencode.json
{
  "plugin": ["./plugins/opencode-cloud-agent"],
  "provider": {
    "mega-router": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "http://127.0.0.1:8080/v1",
        "apiKey": "sk-mega-..."
      }
    }
  }
}

# 4. Run plugin tests
cd plugins/opencode-cloud-agent && npx vitest run

# 5. Run backend tests
cd backend && go test -race ./...

# 6. CLI integration test (headless)
opencode run --format json "use the code-reviewer agent to review main.go"

Publishing

# Bump version in package.json, then:
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTOMATION_TOKEN
npm publish --access public
npm config delete //registry.npmjs.org/:_authToken