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

pr-sanity

v0.1.1

Published

Architecture drift detection for .NET codebases

Downloads

15

Readme

pr-sanity

npm version license

Architecture drift detection for .NET. Finds where your codebase disagrees with itself.

| | | | --- | --- | | Is | Internal consistency, module-level drift, PR risk gates | | Isn't | Style rules, code coverage, "you must use Clean Architecture" |

npx pr-sanity health --demo
npm install -g pr-sanity
pr-sanity health --path /path/to/your/dotnet/repo

Install from npm.

Architecture Drift Report · eShopOnWeb

2025-03-12 09:41:18

4 tensions detected across 4 modules

Top Drift Sources

─────────────────

ApplicationCore● result pattern  ● persistence bypass    2 tensions
Web            ● result pattern  ● CQRS bypass    2 tensions
Controllers    ◐ validation    1 tension
Pages          ◐ validation    1 tension

─────────────────

Tensions Detail

─────────────────

● MediatR bypass in Application layer                                 [CRITICAL]

Application layer bypasses MediatR dispatch

4 bypass files vs 18 handlers (18% bypass rate)

Modules: Web
Affected files:
  src/Web/Services/BasketViewModelService.cs
  src/Web/Controllers/OrderController.cs

● Repository pattern bypass in Application layer                      [CRITICAL]

Application layer files access DbContext directly

9 of 24 Application-layer files (38%) access DbContext directly

Modules: ApplicationCore
Affected files:
  src/ApplicationCore/Services/BasketService.cs
  src/ApplicationCore/Services/OrderService.cs
  src/Infrastructure/Data/CatalogContext.cs

● Result pattern inconsistency                                        [CRITICAL]

3 competing approaches detected

· Ardalis.Result   62%  (dominant)
· OneOf            24%  ← non-dominant
· raw bool         14%  ← non-dominant

Modules: ApplicationCore, Web
Affected files:
  src/ApplicationCore/Services/BasketService.cs
  src/Web/Controllers/OrderController.cs
  src/Web/Pages/Basket/Checkout.cshtml.cs

◐ Validation strategy inconsistency                                   [WARNING]

2 competing approaches detected

· DataAnnotations  88%  (dominant)
· manual           12%  ← non-dominant

Modules: Controllers, Pages
Affected files:
  src/Web/Controllers/ManageController.cs
  src/Web/Pages/Basket/Index.cshtml.cs

─────────────────

Passing

─────────────────

✓ Transaction boundary consistency
✓ Dependency inversion compliance
✓ Layer boundary enforcement

─────────────────

Health Score: 59/100

─────────────────
Run pr-sanity drift to see how long these tensions have been present.

This is a demo using eShopOnWeb snapshot data.
Run against your repo: pr-sanity health --path /path/to/your/repo

Quick start

  1. npx pr-sanity health --demo to see a sample report (no .NET repo needed)
  2. pr-sanity health --path . to scan your repo
  3. pr-sanity health --save-baseline then pr-sanity drift to track drift over time

What it detects

pr-sanity scans your .NET codebase for architectural tensions: places where the codebase is inconsistent with itself. Not style violations. Not missing tests. It surfaces competing Result patterns, validation approaches that differ across modules, Application-layer services that bypass repositories, and CQRS adoption gaps. Findings are clustered by module so you know where to focus.

Tested on

These are real runs, not synthetic fixtures. The scores are locked in our regression suite.

Commands

health produces a module-clustered tension report and score. Use --save-baseline then drift to track what's new or getting worse. check gates PRs on diff-level risks (missing tests, migrations, authorize, public API changes).

Requires Node.js 18+ and Git on PATH.

check

pr-sanity check --base origin/main -H HEAD
pr-sanity check --base origin/main -H HEAD --format json --max-risk 66

On Windows, npm reserves --head; use -H instead.

health

pr-sanity health --demo
pr-sanity health --path .
pr-sanity health --save-baseline   # persist scan for drift tracking
pr-sanity health --ci --comment    # CI JSON + GitHub PR comment

drift

pr-sanity drift --last 8

See configuration for .pr-sanity.yml options.

GitHub Action

- uses: actions/checkout@v4
  with: { fetch-depth: 0 }
- run: git fetch origin ${{ github.base_ref }}
- uses: cordova7/[email protected]
  with:
    base: origin/${{ github.base_ref }}
    max-risk: '66'
    run-health: 'true'

Posts a PR comment, uploads a health HTML report, and fails on high risk or critical tensions.

Full GitHub Action docs

FAQ

Q: Does it work on non-Clean-Architecture repos?

A: Yes. The detectors look for internal consistency, not adherence to any specific pattern.

Q: What if my team intentionally uses two Result patterns?

A: Add a blessed pattern in .pr-sanity.yml and the detector will treat it as the standard. See configuration.

Q: Will it slow down my CI?

A: The health command runs in under 10 seconds on repos up to 5,000 files. The check command (diff-only) runs in under 2s.

License

MIT. See contributing for development setup.