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-scoped-tests

v0.1.0

Published

Run only the pytest tests your change touches, and return only what matters — a pi extension.

Readme

pi-scoped-tests

A pi extension that runs only the pytest tests your change touches, and returns only what matters.

A full pytest run on a large repo is slow and floods the model context with passing-test noise. This extension derives the affected tests from your git changes plus the files edited this session, runs just those, and reports a one-line completion on green or a compact failure digest on red.

Install

pi install npm:pi-scoped-tests

Try it without installing:

pi -e npm:pi-scoped-tests

What it adds

| Capability | Description | |---|---| | run_tests tool | Selects tests from git changes + session edits, runs them, returns terse output. | | bash guard | Blocks whole-suite pytest invocations and redirects to run_tests. | | Output filter | Rewrites targeted pytest output to failures + completion line only. | | /prune-tests command | Report-only suite hygiene: stale, always-skipped, duplicate, and mergeable tests. | | Prompt policy | Teaches the agent to prefer scoped runs over full-suite runs. |

Tool: run_tests

| Parameter | Meaning | |---|---| | files | Changed files to consider. Default: git working-tree changes plus files edited this session. | | tests | Explicit test files or node ids. Overrides automatic selection. | | base | Git ref to also diff against, e.g. main or HEAD~3. | | all | Run every test file. Only when the user explicitly asks; discouraged. | | args | Extra pytest flags, e.g. ["-x", "--tb=long"]. |

On green it returns the completion line. On failure it returns a digest. When nothing is selected it says why, and notes that adding a test is only worth it if the change introduces behaviour worth locking in.

When it activates

The extension is a no-op outside a pytest project. It activates when the repo root has a tests/ or test/ directory, or top-level test_*.py files. Repos often keep experiment scripts named test_v25_* that run models — only files under a configured test directory count as suite members.

Configure

Drop a .pi/targeted-tests.json in the repo root:

{
  "testDirs": ["tests", "integration_tests"],
  "runner": [".venv/bin/python", "-m", "pytest"],
  "python": ".venv/bin/python",
  "allowFullEnv": "PI_ALLOW_FULL_TESTS",
  "scanExclude": ["node_modules", ".venv", "build"],
  "enabled": true
}

All fields are optional. Set enabled: false to disable the extension for a repo.

Set PI_ALLOW_FULL_TESTS=1 to permit full-suite invocations for one session.

Development

npm install
npm run typecheck
pi -e .

Pi loads TypeScript extensions directly via jiti — no build step.

Security

Pi extensions run inside the pi process with your operating-system permissions and can inspect prompts, tool calls, files, and session history. Review the source before installing any third-party package.

License

MIT