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

pi-edit-hooks

v0.2.0

Published

Code quality hooks for the pi coding agent — runs syntax checks on edit and format/lint/typecheck at turn end

Readme

pi-edit-hooks

Code quality hooks for the pi coding agent.

Runs syntax checks inline as the agent edits files (onEdit) and runs format/lint/typecheck at the end of each turn (onStop).

Install

pi install npm:pi-edit-hooks

Configuration

Create .pi/edit-hooks.json in your project, or globally at ~/.pi/agent/edit-hooks.json.

Hooks

| Hook | Trigger | Behavior | Variables | |------|---------|----------|-----------| | onEdit | After each write/edit tool call | Appends output to tool result (informational, never blocks). Shows resolved config file and command executed. | {file} | | onStop | After agent turn ends | Sends a follow-up message with each command and its output. Errors trigger a new agent turn; clean output is informational only. | {files}, {file} |

Variables

  • {file} — absolute path of the edited file
  • {files} — space-separated absolute paths of all files edited in the current turn, grouped by project (see below)
  • {projectRoot} — directory containing the .pi/ folder

Commands without a placeholder run as-is (useful for project-wide tools like npx tsc --noEmit).

Monorepo File Grouping

In monorepos, {files} is not a flat list of every edited file. Instead, pi-edit-hooks groups files by their nearest workspace manifest (pyproject.toml, package.json, go.mod, etc.) and runs the onStop command once per group, with {files} containing only the files that belong to that manifest's project and {projectRoot} pointing to its directory.

This means tools like ruff, tsc, and go vet are always invoked from the correct project root with the correct subset of files — no cross-project contamination and no need to wrangle paths manually.

Array Commands

A command value can be a string or an array of strings. When an array is given, each command runs in sequence — all steps always run regardless of exit codes:

"*.py": [
  "uv run ruff format {files}",
  "uv run ruff check --fix {files}",
  "uv run ty check {files}"
]

Path-Keyed Config

Apply different settings per subdirectory:

{
  ".": {
    "onEdit": { "*.py": "python3 -m ast {file}" },
    "onStop": { "*.py": "uv run ruff check {files}" }
  },
  "legacy/": false,
  "packages/frontend/": {
    "onStop": { "*.{ts,tsx}": "npx biome check {files}" }
  }
}

false disables all hooks for that subtree.

Claude Code CLI

The package also ships a pi-edit-hooks binary compatible with Claude Code's stop-hook protocol:

{
  "hooks": {
    "Stop": [{ "hooks": [{ "type": "command", "command": "pi-edit-hooks check" }] }],
    "PostToolUse": [{ "hooks": [{ "type": "command", "command": "pi-edit-hooks accumulate" }] }]
  }
}

Example Configurations

Minimal project setup:

{
  "onEdit": {
    "*.py": "python3 -c 'import ast,sys;ast.parse(open(sys.argv[1]).read())' {file}",
    "*.{js,mjs,cjs}": "node --check {file}",
    "*.{ts,tsx}": "esbuild {file} > /dev/null"
  },
  "onStop": {
    "*.py": [
      "uv run ruff format {files}",
      "uv run ruff check --fix {files}",
      "uv run ty check {files}"
    ],
    "*.{ts,tsx}": "npx tsc --noEmit"
  }
}

Monorepo with per-subtree overrides:

{
  ".": {
    "onEdit": { "*.py": "python3 -c 'import ast,sys;ast.parse(open(sys.argv[1]).read())' {file}" },
    "onStop": {
      "*.py": [
        "uv run ruff format {files}",
        "uv run ruff check --fix {files}",
        "uv run basedpyright {files}"
      ]
    }
  },
  "legacy/": false,
  "packages/frontend/": {
    "onStop": { "*.{ts,tsx}": "npx biome check {files}" }
  }
}