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

@shiit/forage

v0.1.0

Published

Ranked, tiered, fuzzy tool discovery for code-mode sandboxes. Zero dependencies. Pure functions.

Readme

@shiit/forage — the discovery layer

forage is NEVER a tool in a tools array. It is the discovery layer BEHIND an execute door — exposed to the model's code as in-sandbox bindings (like codemode.search/codemode.describe). A model with only top-level tools has no use for it.

Ranked, tiered, fuzzy tool discovery for any tool catalog. Zero dependencies. Pure functions. Search and describe any connector surface — MCP, OpenAPI, or your own custom tools.

Quick start

npm install @shiit/forage
import { createCatalog, searchConnectors, describeTarget } from "@shiit/forage";

const catalog = createCatalog({
  descriptions: [
    {
      name: "files",
      instructions: "Read, write, list, and delete workspace files",
      descriptors: {
        read: {
          description: "Read a file at the given path",
          inputSchema: {
            type: "object",
            properties: { path: { type: "string" } },
            required: ["path"],
          },
          outputSchema: { type: "string" },
        },
        write: {
          description: "Write content to a file",
          inputSchema: {
            type: "object",
            properties: {
              path: { type: "string" },
              content: { type: "string" },
            },
            required: ["path", "content"],
          },
        },
      },
    },
  ],
});

const results = catalog.search("read file");
const docs = catalog.describe("files.read");

Sandbox injection

import { createCatalog, bindings } from "@shiit/forage";

const catalog = createCatalog({ descriptions });
const codemode = bindings(catalog);
// Now inject { codemode } as sandbox bindings.
// The model calls:
//   await codemode.search("files")
//   await codemode.describe("files.read")

API

createCatalog(options) → Catalog

Build a searchable catalog from an array of ConnectorDescription objects.

catalog.search(query, opts?) → SearchOutput

Tiered fuzzy search. Results ranked by: exact match > startsWith > phrase > token > prefix/substring > raw includes.

catalog.describe(target) → DescribeOutput

Get full TypeScript type declarations for a tool or connector by path.

Pure functions

  • searchConnectors(query, descriptions, snippets?) — stateless search
  • describeTarget(target, descriptions) — stateless describe
  • generateTypesFromJsonSchema(descriptors) — JSON Schema → TypeScript
  • sanitizeToolName(name) — string → valid JS identifier

bindings(catalog) → { search, describe }

Wraps a catalog as two async functions shaped for sandbox injection.

Types

  • ConnectorDescription — the data shape describing one connector namespace
  • ConnectorTool — the per-tool runtime definition (includes execute)
  • JsonSchemaToolDescriptor — the per-tool searchable subset
  • SearchOutput, SearchResult, DescribeOutput
  • ForageError, EmptyCatalogError, UnknownTargetError, EmptyQueryError

Zero dependencies

The core package has zero runtime dependencies. The @types/json-schema dev dependency is erased at compile time. CI enforces this.

License

MIT — includes attribution notice for derived code from @cloudflare/codemode.