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

@biratkk/pi-trust-policy

v0.1.6

Published

Bash command allowlist system for pi — grouped trust policies with glob matching, recursive parsing, and an interactive TUI manager

Readme

pi-trust-policy

Bash command allowlist system for pi. Group trusted commands into policies, toggle them on/off, and get prompted for anything not covered.

Install

pi install git:github.com/biratkk/pi-trust-policy

Or for a quick test:

pi -e git:github.com/biratkk/pi-trust-policy

Getting Started

After installing, open pi and run:

/trust-policy

That's it. Type to search, Enter to cycle activation states.

Usage

1. Write a policy YAML file

Create ~/.pi/agent/trust-policy/my-dev-tools.yaml:

name: my-dev-tools
description: Development commands for my project

includes:
  - unix-read

commands:
  - glob: "npm run *"
    description: "Run package scripts"
    pipe: true
  - glob: "docker build {*,*/**}"
    description: "Build Docker images"
    redirect: append

2. Activate it

Run /trust-policy in pi to open the TUI manager. Type to fuzzy-search, Enter/Space to cycle through activation states:

| State | Meaning | |-------|--------| | inactive | Not active anywhere | | local | Active in project .pi/trust-policy/ only | | global | Active in ~/.pi/agent/trust-policy/ (all projects) | | global & local | Active in both scopes |

Or manually create ~/.pi/agent/trust-policy/policy.json:

{
  "active": ["unix-read"]
}

3. Work normally

Trusted commands run without interruption. Untrusted commands prompt you with options to allow once, deny, or persist to a group.

Commands

| Command | Description | |---------|-------------| | /trust-policy | Open TUI manager — toggle policies active/inactive |

Policy Format

name: my-policy
description: What this policy covers

includes:                    # optional: inherit from other groups
  - grep-read
  - cat-read

commands:
  - glob: "docker build *"
    description: "Build images"  # optional
    pipe: false                  # allow in pipelines (default: false)
    embedded: false              # allow in $() substitutions (default: false)
    redirect: none               # none | append | overwrite | both (default: none)

Redirect Modes

| Value | Allows | |-------|--------| | none | No redirects — command must run without > or >> | | append | >> only | | overwrite | > only | | both | Both > and >> |

Starters

Built-in starter policies are organized by risk level and can be activated from the TUI:

| Policy | Category | Includes | |--------|----------|----------| | unix-read | Safe | grep, cat, ls, head, tail, wc, find, cut, sort | | unix-write | Modifying | sed, awk, tee, cp, curl -o, sort -o | | unix-dangerous | Destructive | rm, shred, truncate, mv |

Each aggregate policy composes per-tool policies (e.g., unix-read includes grep-read, cat-read, etc.). Per-tool policies live in subdirectories under ~/.pi/agent/trust-policy/policies/ and can also be activated individually for granular control.

On first session start, starters are migrated to ~/.pi/agent/trust-policy/policies/. You own the copies and can freely edit them.

How It Works

  1. At session start, migrates bundled starter policies to ~/.pi/agent/trust-policy/policies/ (only new files, preserves edits)
  2. Loads policy.json from global (~/.pi/agent/trust-policy/) and local (.pi/trust-policy/) directories
  3. Resolves all active groups and their includes recursively (with cycle detection)
  4. Intercepts every bash tool call and validates against the merged allowlist
  5. Recursively parses compound commands (pipelines, &&/||/;, $(), bash -c) using unbash
  6. Validates redirect operators (>, >>) against each entry's redirect permission
  7. Commands with env vars, eval, or unparseable elements always prompt

Security Model

  • Pure allowlist — only explicitly permitted commands run without confirmation
  • Fail-safe defaultspipe: false, embedded: false, redirect: none
  • Redirect enforcement> and >> require explicit redirect permission on the matching entry
  • Env vars always promptVAR=val cmd and export trigger confirmation
  • Recursive validation — every segment of a compound command is checked independently

File Structure

~/.pi/agent/trust-policy/              # global
├── policy.json                        # {"active": ["unix-read", "unix-write"]}
├── policies/                          # migrated starters (source of truth)
│   ├── unix-read.yaml                 # aggregate: includes per-tool policies
│   ├── unix-write.yaml
│   ├── unix-dangerous.yaml
│   ├── grep/
│   │   └── grep-read.yaml             # per-tool policy
│   ├── sed/
│   │   └── sed-write.yaml
│   └── rm/
│       └── rm-destructive.yaml
└── my-custom-policy.yaml              # user-created policies

<project>/.pi/trust-policy/            # local (project-scoped)
├── policy.json
└── project-scripts.yaml

Both scopes merge additively. Local policies apply only within that project tree.

License

MIT