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

codechurn

v1.0.0

Published

Track AI vs human code quality — enhanced AI churn detection, hotspot scoring, and configuration system

Readme

codechurn

Track AI vs human code quality — enhanced AI churn detection, hotspot scoring, and configuration system.

You're using Copilot, Claude, Cursor. But is the AI-generated code actually surviving? Or does it get rewritten in the next PR? codechurn answers that by analyzing your git history and attributing code to AI or human authors, then tracking what happens to it over time.

Why?

  • 66% of devs are frustrated with "almost right" AI code (Stack Overflow 2025)
  • AI code has 1.7x more issues and 2.74x more security vulnerabilities (Exceeds AI research)
  • No open-source tool tracks AI code quality over time — until now
  • Enhanced version now with configurable AI detection, improved hotspot scoring, and CI-friendly outputs

What it does

  1. Enhanced Attribution — reads git history with configurable AI detection:
    • Co-authored-by headers (Co-authored-by: Copilot)
    • Commit message keywords (claude, copilot, cursor, aider)
    • Author name patterns
    • Customizable detection patterns and thresholds
  2. Improved Hotspot Scoring — ranks files using weighted algorithm:
    • Churn rate (40%) — how much AI code gets rewritten
    • Survival rate (30%) — how long AI code persists
    • Volume weight (30%) — amount of AI code in file
  3. Churn tracking — for each file, tracks lines added/removed by AI vs human
  4. Survival analysis — what percentage of AI-written lines are still there?
  5. Model breakdown — compare Claude vs Copilot vs Cursor code quality
  6. Configuration system — customizable thresholds, patterns, and output formats

Install

npm install -g codechurn

Usage

Enhanced analysis with configuration

codechurn analyze
codechurn analyze --since "3 months ago"
codechurn analyze --since "2024-01-01" --json
codechurn analyze --path ../my-project --top 10 --md

# Custom thresholds and scoring
codechurn analyze --high-churn-threshold 0.6 --low-survival-threshold 0.8 --min-lines 100

# Config file support
codechurn analyze --config ./codechurn.config.json

Quick scan (summary only)

codechurn scan
codechurn scan --since "1 month ago"

Enhanced Hotspots with improved scoring

codechurn hotspots
codechurn hotspots --top 5 --json

# Filter by minimum hotspot score
codechurn hotspots --min-score 0.5

# See detailed scoring breakdown
codechurn hotspots --json | jq '.[] | {file, hotspotScore, aiChurnRate, aiSurvivalRate}'

Model comparison

codechurn models
codechurn models --json

Output

codechurn report — my-project (main)
period: 3 months ago → now

overview
  commits analyzed: 247
  AI commits:       89 (36.0%)
  Human commits:    158 (64.0%)

survival rates
  AI lines:    1243 — 52.3% survived (0.477 churn)
  Human lines: 3891 — 78.1% survived (0.219 churn)

revert rates
  AI:    8.9% of AI commits were reverts
  Human: 3.2% of human commits were reverts

avg code lifetime
  AI:    5 days
  Human: 30 days

⚠ 3 hotspots (improved scoring)
  src/auth.ts      score: 0.742 (high churn + low survival)
  src/api/handlers.ts score: 0.621 (high churn + volume)
  src/utils/helpers.ts score: 0.589 (moderate churn + low survival)

CI/CD Integration

# Fail if AI churn rate exceeds threshold
codechurn analyze --since "1 month ago" --json | \
  jq -e '.summary.aiSurvivalRate > 0.5'

Enhanced Configuration

Threshold customization

codechurn analyze --high-churn-threshold 0.6 --low-survival-threshold 0.8 --min-lines 100

How attribution works

codechurn looks for these signals in commits:

| Signal | Example | |--------|---------| | Co-authored-by | Co-authored-by: Copilot <[email protected]> | | Keywords in message | "used claude to generate", "copilot suggested" | | Author name | Author contains "copilot", "cursor", "aider" |

Hotspot scoring algorithm

Hotspots are ranked using a weighted formula:

score = churn × 0.4 + (1 - survival) × 0.3 + volume × 0.3

Where:

  • churn = lines_removed / lines_added (0-1)
  • survival = lines_still_present / lines_added (0-1)
  • volume = min(ai_lines / min_lines, 1) (0-1)

As a library

import { ChurnAnalyzer, Reporter } from 'codechurn';

const analyzer = new ChurnAnalyzer('/path/to/repo');
const report = analyzer.analyze({ since: '3 months ago' });

console.log(report.summary.aiSurvivalRate); // 0.52
console.log(report.summary.humanSurvivalRate); // 0.78

License

MIT