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-codemapper

v0.1.6

Published

OpenCode plugin exposing CodeMapper as small agent-facing code exploration tools.

Downloads

764

Readme

opencode-codemapper

OpenCode plugin that exposes the CodeMapper CLI (cm) as five agent-facing tools for code exploration.

This is the OpenCode equivalent of pi-codemapper.

Tools

| Tool | Description | |------|-------------| | search | Find symbols, doc headings, and endpoints by name or compact keyword | | map | Get repo/directory structure overview (stats + level-2 file map) | | outline | List all symbols in one file without reading the full file | | expand | Show a symbol's relationship radius: definition, callers, callees, tests | | path | Find shortest detected static call path between two symbols |

Prerequisites

  • OpenCode (tested with 1.3+)
  • CodeMapper cm binary available on PATH, ~/.local/bin/cm, or CODEMAPPER_BIN env var

Installing CodeMapper

Build from source (requires Rust):

git clone https://github.com/p1rallels/codemapper.git
cd codemapper
cargo build --release
sudo cp target/release/cm ~/.local/bin/cm

Quick check:

cm --help
cm stats . --format ai

Install

Option A — CLI (recommended):

opencode plugin opencode-codemapper --global

Option B — Manual config:

In your opencode.json (project-level) or ~/.config/opencode/opencode.jsonc (global), add:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-codemapper"]
}

Then restart OpenCode. The five tools will be available automatically.

Config location: OpenCode looks for opencode.json / opencode.jsonc in the project root. Global config lives at ~/.config/opencode/opencode.jsonc. Both .json and .jsonc (JSON with comments) are supported.

Local development

Clone this repo and point OpenCode at the local path:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["/absolute/path/to/opencode-codemapper"]
}

Usage

After installing, the five tools become available to the AI agent alongside built-in tools.

Typical workflows

1. Explore:  map({ path: "." })
2. Search:   search({ query: "auth|login|session" })
3. Outline:  outline({ file: "src/auth.ts" })
4. Expand:   expand({ symbol: "authenticateUser", path: "src", fuzzy: true })
5. Trace:    path({ from: "loginHandler", to: "verifyPassword", path: "src" })

Tool reference

search({ query, path?, exact? })

- query: string — symbol name, concept, route, or | -separated OR query
- path:  string (optional) — directory scope, defaults to "."
- exact: boolean (optional) — strict matching, defaults to false

Returns a JSON array of symbol, doc_section, and endpoint items.

map({ path? })

- path: string (optional) — directory scope, defaults to "."

Returns a JSON array with one stats item plus file items. Falls back to directory groups when the file map is too large.

outline({ file })

- file: string — file path (leading @ is stripped)

For code files, returns a JSON array with file metadata and symbol items. For Markdown files, returns h1-h3 section headings with line counts.

expand({ symbol, path?, fuzzy? })

- symbol: string — exact indexed symbol name to analyze (use fuzzy=true for partial matching)
- path:   string (optional) — directory scope, defaults to "."
- fuzzy:  boolean (optional) — enable fuzzy matching, defaults to false

Returns a JSON array combining definition, caller, callee, and test items.

path({ from, to, path?, fuzzy? })

- from:  string — exact source/start symbol name (use fuzzy=true for partial matching)
- to:    string — exact target/end symbol name
- path:  string (optional) — directory scope, defaults to "."
- fuzzy: boolean (optional) — enable fuzzy matching, defaults to false

Returns a JSON array with one call_path item, or [] if no static path is detected.

Configuration

Use CODEMAPPER_BIN when cm is not on OpenCode's runtime PATH:

CODEMAPPER_BIN=/absolute/path/to/cm opencode

The extension sets NO_COLOR=1 and TERM=dumb when invoking cm.

License

MIT