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

@onigetoc/mdsearch

v0.1.4

Published

Blazing-fast full-text search CLI for Markdown knowledge bases with automatic indexing, fuzzy search, contextual snippets, and LLM-ready output.

Readme

mdsearch - Fast full-text search for Markdown knowledge bases

Local full-text search CLI for Markdown knowledge bases, Obsidian vaults, and note collections. Powered by MiniSearch, with automatic indexing, fuzzy search, contextual snippets with line numbers, and LLM-ready output.

LLM-ready workflows

mdsearch helps AI tools and LLM workflows retrieve relevant context from Markdown knowledge bases. Search results are available in structured formats designed for AI agents, automation, and context retrieval.

For maximum token efficiency and streamlined context retrieval, we recommend using the dedicated mdsearch skill which provides automated, ready-to-use workflows for your LLM agents:

https://github.com/onigetoc/mdsearch-skill

Installation

Global installation (recommended)

npm install -g @onigetoc/mdsearch

After global install, use mdsearch directly (no npx):

mdsearch "<query>"              # search current directory
mdsearch "<query>" <folder>     # search a specific folder

Run without installation (npx)

npx @onigetoc/mdsearch "<query>" [<folder>]

Folder defaults to the current directory if omitted. The index is auto-built on first run (cache in .mdsearch/).

Examples

# SIMPLE
mdsearch "karpathy llm wiki"                               # current dir, fuzzy=0.2 (default)
mdsearch "karpathy llm wiki" notes-test                    # specific folder
mdsearch "term" --no-fuzzy                                 # exact only
mdsearch "term" --fuzzy 0.4                                # wider fuzzy

# BOOST
mdsearch "term"                                            # boost: title=3, headings=2, text=1
mdsearch "term" --boost-title 5 --boost-headings 3 --boost-text 1

# CONTEXT / LIMIT
mdsearch "term" --limit 5
mdsearch "term" --context 0                                # no snippet
mdsearch "term" --context 4

# OUTPUT FORMAT
mdsearch "term"                                            # human-readable
mdsearch "term" --json                                     # JSON with normalized scores + line
mdsearch "term" --context 4 --llm-context                  # compact for LLM prompts

# PREFIX, PHRASE & AND
mdsearch "minis" --prefix
mdsearch "karpathy llm" --phrase                           # exact phrase (sequence of terms)
mdsearch "karpathy llm" --and                              # require all terms (default: OR)

# CACHE / INDEX
mdindex ~/my-notes                                         # pre-build index
mdindex ~/my-notes --cache-dir .mycache
mdsearch "term" --reindex                                  # force rebuild
mdsearch "term" ~/my-notes --cache-dir .mycache

# VERSION / HELP / LIST
mdsearch --version
mdsearch --help
mdsearch --list                                            # list indexed files (auto-build if missing)
mdsearch --list --reindex                                  # force re-index before listing

Local dev test only

node src/search-md.mjs "<query>"          # test without installing

Options

| Flag | Type | Default | Description | |------|------|---------|-------------| | --no-fuzzy | boolean | false | Disable fuzzy matching (exact search only) | | --prefix | boolean | false | Enable prefix search (match term prefixes) | | --phrase | boolean | false | Exact phrase search (sequence of terms in order) | | --and | boolean | false | Require all terms (default is OR — any term matches) | | --boost-title | number | 3 | Weight multiplier for matches in document title | | --boost-headings | number | 2 | Weight multiplier for matches in headings | | --boost-text | number | 1 | Weight multiplier for matches in body text | | --limit | number | 10 | Maximum number of results to return | | --context | number | 2 | Lines of context before/after match (0 = snippet disabled) | | --json | boolean | false | Output results as JSON | | --llm-context | boolean | false | Compact LLM-friendly output format | | --reindex | boolean | false | Force rebuild the search index | | --cache-dir | string | .mdsearch | Custom cache directory name | | --list | boolean | false | List all indexed files | | --version | boolean | false | Show version number | | --help | boolean | false | Show help message |

Cache structure

.mdsearch/ contains:

  • index.json - serialized MiniSearch index
  • meta.json - folder signature (file count + max mtime), id → absolute path mapping

If the signature changes (file added/removed/modified), search-md.mjs detects it and re-indexes automatically.

Output formats

All formats include line numbers and normalized scores (0.00 - 1.00).

| Mode | Example | |------|---------| | Terminal | line 42: → matching content with highlighted match line | | JSON | { "path": "...", "line": 42, "score": 0.92, "snippet": "..." } | | LLM context | Confidence: 0.92 for each result, clean body without markers |