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

@carter-mcalister/pi-protected-files

v0.2.0

Published

Project-configurable protected file gates for Pi edits

Downloads

56

Readme

@carter-mcalister/pi-protected-files

Project-configurable protected file gates for Pi.

This extension reads a config file from the current project and intercepts Pi tool calls before they run. Matching write and edit calls are either blocked or require explicit user approval.

Install

pi install npm:@carter-mcalister/pi-protected-files

For local development in this monorepo, the root package.json also registers the extension with Pi.

Config

Create .agents/protected-files.jsonc (or .pi/protected-files.jsonc) in your project:

{
  // Defaults to "block" when omitted.
  "mode": "block",
  "files": [
    ".env",
    "package-lock.json",
    "pnpm-lock.yaml",
    "schema.ts",
    "secrets/**",
    {
      "path": "config.ts",
      "mode": "confirm"
    }
  ]
}

Pi checks these files in order:

  1. .agents/protected-files.jsonc
  2. .agents/protected-files.json
  3. .pi/protected-files.jsonc
  4. .pi/protected-files.json
  5. pi-protected-files.jsonc
  6. pi-protected-files.json

Modes

  • block: matching edits are denied before the tool runs.
  • confirm: Pi prompts before allowing the edit. If Pi is running without a UI, the edit is blocked.

The top-level mode is the default for all files. Individual entries can override it with their own mode.

Commands

  • /disable-protections: disables all protected file guards for the rest of the current Pi session. Restart or reload the session to enable protections again.

Matching Rules

  • Plain filenames, such as .env, match that basename anywhere in the project.
  • Non-glob paths, such as src/schema.ts, are treated as filenames; only schema.ts is used.
  • Filename globs, such as *.lock, match basenames anywhere in the project.
  • Path globs with /, such as secrets/**, match project-relative paths and any nested parent folder named secrets.

What Is Protected

The extension protects:

  • Pi write tool calls.
  • Pi edit tool calls.
  • Nested write and edit calls inside multi_tool_use.parallel.
  • Common mutating bash commands that explicitly mention a protected path, such as redirection, tee, sed -i, mv, cp, rm, truncate, and touch.

Shell command protection is best-effort because arbitrary commands can modify files without naming them in the command text. For critical files, prefer block mode and avoid broad shell commands that may indirectly rewrite protected files.

Why This Approach

Pi extensions can intercept tool_call events before execution and return { "block": true }. That is the safest extension-level hook for this feature because it stops edits before the filesystem tool runs while still allowing a UI confirmation flow when desired.