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-semantic-search

v0.1.0

Published

Local-first semantic search plugin for OpenCode — hybrid vector + BM25 search, AST chunking, smart grep override.

Readme

opencode-semantic-search

Local-first semantic search plugin for OpenCode, with smart grep routing and incremental indexing.

Quickstart

Prerequisites

Install

Option A — bunx (recommended after the package is on npm)

Runs the same installer as install.sh from the published package (no clone):

# Global shim (~/.config/opencode/plugins) — default
bunx opencode-semantic-search@latest

# Project-local only (./.opencode/plugins)
bunx opencode-semantic-search@latest install --local

Other flags match install.sh (see below).

Option B — Remote install.sh (curl)

curl -fsSL https://raw.githubusercontent.com/jainprashul/opencode-semantic-search/main/install.sh | bash

Use bash -s -- --local after the pipe for a project-local shim instead of the default global install.

Option C — Git clone

git clone https://github.com/jainprashul/opencode-semantic-search.git
cd opencode-semantic-search

# Global (default): ~/.config/opencode/plugins
bash install.sh

# Project-local only: ./.opencode/plugins
bash install.sh --local

Common installer modes (clone or remote script):

# explicit global install (default)
bash install.sh --global

# project-local only
bash install.sh --local

# OpenAI embeddings instead of Ollama
bash install.sh --openai-key-env OPENAI_API_KEY --skip-ollama

# custom Ollama model
bash install.sh --ollama-model nomic-embed-text

# skip Ollama checks/model pull
bash install.sh --skip-ollama

The script installs dependencies, writes a plugin shim, optionally pulls the Ollama model, writes config, and runs integration self-tests when the test scripts are present (git clone); npm installs skip that step.

Start

# Ollama users
ollama serve

# open your codebase
cd /path/to/your/repo
opencode

Available tools

  • semantic_search(query, top_k?, threshold?, path?)
  • grep(pattern|query, ...) smart route: conceptual -> semantic, exact/regex -> rg
  • index_status() health and coverage stats
  • reindex() full index rebuild
  • diagnostic_bundle() JSON support bundle (provider, index, routing history)

Optional slash aliases (/sem-status, /sem-search, etc.): add Markdown stubs under .opencode/commands/ as described in SETUP.md. Each stub body is an LLM prompt that asks the assistant to call the matching tool.

Verify it works

From this plugin repo:

bun run check
bun run test:integration
bun run diagnostic:bundle

Expected:

  • bun run check exits successfully (no TypeScript errors).
  • bun run test:integration prints JSON with "ok":true from both suites.
  • bun run diagnostic:bundle prints one JSON bundle with provider health, index stats, DB path, and recent routing outcomes.

In OpenCode (after startup indexing):

  • index_status() should report provider_healthy: true, files_indexed > 0, total_chunks > 0.
  • semantic_search("authentication flow") should return JSON results with file paths and scores.
  • grep("auth retry flow") should return scored semantic matches (score=...) when provider/index are healthy.

Debugging pointers

  • No semantic results: ensure embedder is reachable (ollama serve or valid OpenAI key) and run reindex().
  • grep behaving like plain text search: this is expected for exact/regex/single-token patterns.
  • Wrong results after changing embedding model/dimensions: run reindex().
  • Persistent index issues: remove the project DB under ~/.cache/opencode/semantic-search/<project-hash>/embeddings.db.

Publishing (maintainers)

Bump version in package.json, then:

bun run typecheck
npm publish --access public

prepublishOnly runs typecheck automatically. The npm package name is opencode-semantic-search.

Docs

  • docs/ARCHITECTURE.md architecture, data flow, index lifecycle, smart grep routing
  • docs/CONFIG.md full configuration reference + install script behavior
  • docs/DEBUGGING.md logging/diagnostics, troubleshooting, and verification playbook
  • SETUP.md extended setup walkthrough and notes