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

prsense

v2.2.0

Published

The Repository Memory Infrastructure

Readme

npm version License: MIT Node.js Tests

Website  ·  Dashboard  ·  Documentation

PRSense is an active context engine that vector-indexes your repositories. It acts as an enforcer to stop duplicate Pull Requests, instantly surface historical decisions, and prevent architectural drift across your engineering teams.


What's New in v2.2.0 — Phase 2: Refactor Engine

PRSense has evolved into a Self-Evolving Codebase Engine. Not only does it detect problems, it now fixes them.

  • Agentic Refactoring: Pass two duplicate files to prsense refactor and the AI generates a single, clean, unified utility.
  • Auto-PR Agent: The engine branches your repository, commits the refactored code, and opens a fully-described Pull Request using the GitHub CLI — all automatically.
  • Dynamic Versioning: The CLI version now always matches package.json automatically.

Phase 1 (v2.1.0) — Code Intelligence Engine

  • AST Parsing Engine (src/ast/): Native TypeScript Compiler API integration — accurate parsing without flaky native binaries.
  • Cyclomatic Complexity Tracking: PRSense calculates code complexity scores for all functions.
  • Code Health Score (src/health/): A 0-100 metric based on duplicate blocks and cyclomatic complexity.
  • Style Learner (src/style/): Uses an LLM to actively analyze the codebase and generate a CodebaseStyleProfile (naming conventions, error handling, etc.) enforced on future PRs.

CLI Quick Start

1. Install

# Install globally from npm
npm install -g prsense

Git Bash users: If you get prsense: command not found after installing, the npm global bin folder isn't in your Git Bash PATH. Fix it permanently by running:

echo 'export PATH="$PATH:$APPDATA/npm"' >> ~/.bashrc && source ~/.bashrc

Then try prsense again.

2. Set up your API key (optional but recommended)

# DeepSeek (affordable & powerful — recommended)
export DEEPSEEK_API_KEY="sk-..."

# OR OpenAI
export OPENAI_API_KEY="sk-..."

# No key? PRSense uses local ONNX embeddings automatically — no cost, no internet needed.

3. Use the CLI

# Check your current branch for duplicate PRs
prsense check

# Auto-generate an AI PR description from your diff
prsense describe

# Semantic search across all indexed PRs
prsense search "fix auth bug"

# [NEW v2.2.0] Generate a unified refactor from two duplicate files
prsense refactor src/utils/helperA.ts src/utils/helperB.ts

# [NEW v2.2.0] Generate refactor AND automatically open a Pull Request
prsense refactor src/utils/helperA.ts src/utils/helperB.ts --auto-pr

# Preview refactor output without touching any files
prsense refactor src/utils/helperA.ts src/utils/helperB.ts --dry-run

# Interactive setup wizard (first-time configuration)
prsense setup

# View all available commands
prsense help

All CLI Commands

| Command | Description | |---|---| | prsense check | Auto-detect duplicates against current git branch | | prsense check <file.json> | Check a specific PR file for duplicates | | prsense search "query" | Semantic search over all indexed PRs | | prsense describe | Generate an AI-powered PR description from your git diff | | prsense refactor <f1> <f2> | [New] Generate unified refactored code from two duplicate files | | prsense refactor ... --auto-pr | [New] Generate refactor + automatically open a GitHub PR | | prsense refactor ... --dry-run | [New] Show generated refactor without touching files | | prsense stats | Show memory statistics (PRs indexed, duplicates found) | | prsense setup | Run the interactive first-time setup wizard | | prsense quick | Interactive check with manual input | | prsense help | Show all available commands |


Running Tests

PRSense uses Vitest for all unit tests. The test suite covers the full engine pipeline duplicate detection, AST parsing, health metrics, style learning, and the new Phase 2 refactor engine. All 202 tests are currently passing!

# Run the full test suite once
npm test

# Run tests in watch mode (reruns on file changes)
npm run test:watch

# Run tests with a full code coverage report
npm run test:coverage

# Open the Vitest interactive UI
npm run test:ui

Test files are co-located with their source files:

| Test File | What it covers | |---|---| | src/prsense.test.ts | Core duplicate detection engine | | src/prsense.enterprise.test.ts | Enterprise-grade edge cases | | src/ast/parser.test.ts | AST parsing & cyclomatic complexity | | src/health/metrics.test.ts | Code health scoring (0-100) | | src/style/learner.test.ts | LLM-based style profile learning | | src/refactor/engine.test.ts | [New] Refactor Engine unit tests | | src/refactor/auto-pr.test.ts | [New] Auto-PR agent unit tests | | src/impactScore.test.ts | PR impact scoring | | src/triage.test.ts | PR triage logic | | src/rules.test.ts | Custom rule engine |


📚 Documentation

Full documentation is at prsense.dev/docs:


Roadmap

| Version | Phase | Status | |---|---|---| | v2.0.0 | Multi-Provider (GitHub, GitLab, Bitbucket) | ✅ Shipped | | v2.1.0 | Code Intelligence Engine (AST, Health, Style) | ✅ Shipped | | v2.2.0 | Refactor Engine + Auto-PR Agent | ✅ Shipped | | v3.0.0 | Full Autonomy (Learning Loop, Scheduled Scans) | Planned |


License

MIT © PRSense Labs