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

@georgebashi/pi-codemode

v0.1.0

Published

Code Mode extension for Pi — execute tools via TypeScript code, with type-checking, shell via zx, and MCP integration

Readme

pi-codemode

What if your coding agent could write real code to call its own tools — with type-checking, parallelism, and shell access — in a single round-trip?

npm version License: MIT

Why

  • Fewer round-trips — "read file A, grep for X, read matches, extract Y" takes 5+ individual tool calls. In code mode, it's one call.
  • Type-safe — TypeScript type-checking catches wrong parameter types, missing fields, and non-existent tools before any code runs.
  • Tiny context usage — installing lots of MCP tools normally costs thousands of tokens. Code mode keeps it constant: one tool definition + compact type defs. MCP details are discovered on-demand.
  • Any npm package as a tool — Add simple-git, octokit, yaml, csv-parse, or any npm package to the sandbox. Auto-installed, auto-typed, available as globals.
  • Shell built in — zx template literals with automatic argument escaping and output truncation.

Inspired by Cloudflare's Code Mode pattern.

Install

pi install npm:@georgebashi/pi-codemode

Run once without installing:

pi -e npm:@georgebashi/pi-codemode

Note: pi-codemode bundles pi-mcp-adapter for MCP integration. If you have pi-mcp-adapter installed separately, uninstall it first (pi uninstall pi-mcp-adapter). Your MCP config files will be picked up by this extension and provided to the TypeScript sandbox.

Quick Start

Once loaded, code mode replaces Pi's individual tools with a single execute_tools tool. The LLM writes TypeScript that calls tools as functions:

// Read 3 files at once
const [pkg, readme, config] = await Promise.all([
  tools.read({ path: "package.json" }),
  tools.read({ path: "README.md" }),
  tools.read({ path: "tsconfig.json" }),
]);
return Object.keys(JSON.parse(pkg).dependencies || {});
// Shell commands with automatic escaping
const result = await $\`grep -rn "TODO" --include='*.ts' src\`;
print(result.stdout);
// Discover and call MCP tools
const details = await tools.describe_tools({ namespace: "slack", tool: "post_message" });
await tools.slack.post_message({ channel: "#general", text: "Hello!" });

Adding Packages

Any npm package can be injected into the sandbox as a global. Packages are auto-installed into a dedicated directory — your project's node_modules is never touched. TypeScript types are resolved automatically.

Project-local.pi/codemode.json:

{
  "packages": {
    "simple-git": { "version": "^3.33.0", "as": "git" },
    "yaml": { "version": "^2.8.0", "as": "YAML" },
    "@octokit/graphql": { "version": "^8.0.0", "as": "graphql" },
    "csv-parse": { "version": "^5.0.0", "as": "csvParse" }
  }
}

Global (all projects) — ~/.pi/agent/codemode.json, same format.

Then the LLM can use them directly:

// Git operations
const status = await git.status();
const log = await git.log({ maxCount: 5 });

// YAML parsing
const config = YAML.parse(await tools.read({ path: "config.yml" }));

// GitHub GraphQL API — request exactly the fields you need
const { repository } = await graphql(`{
  repository(owner: "org", name: "repo") {
    pullRequests(last: 10, states: OPEN) {
      nodes { title, author { login }, createdAt }
    }
  }
}`, { headers: { authorization: `bearer ${process.env.GITHUB_TOKEN}` } });
return repository.pullRequests.nodes;

Commands

| Command | Description | |---------|-------------| | /codemode | Toggle code mode on/off | | --no-codemode | Disable code mode entirely (CLI flag) |

License

MIT