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

prfect

v1.0.5

Published

Prfect is a powerful tool that analyzes your git commits and generates professional pull request descriptions using local AI models via Ollama. No more struggling with blank PR templates or forgetting what you changed!

Downloads

23

Readme

🚀 Prfect

Perfect PR descriptions, generated with AI

Prfect is a powerful tool that analyzes your git commits and generates professional pull request descriptions using local AI models via Ollama. No more struggling with blank PR templates or forgetting what you changed!

npm version License: MIT

✨ Features

  • 🧠 AI-Powered: Uses Ollama with DeepSeek or other local models
  • 🔍 Smart Git Analysis: Analyzes commits, file changes, and code diffs
  • 🌲 Branch Intelligence: Auto-detects main/master/develop branches
  • 📝 Professional Output: Generates structured, readable PR descriptions
  • 📋 Custom Templates: Supports GitHub PR templates and custom formats
  • 🎯 Context Support: Add custom context and background information to AI prompts
  • 🎨 Beautiful CLI: Colored output with progress indicators
  • 💾 Export Options: Save to markdown files
  • 🌐 Flexible: Works with any git branching strategy

🎯 Quick Start

Prerequisites

  1. Install Ollama:
curl -fsSL https://ollama.ai/install.sh | sh
ollama serve
ollama pull qwen3:latest
  1. Ensure you're in a git repository

Installation & Usage

Choose your preferred version:

🟢 Node.js/TypeScript

# Install globally
npm install -g prfect

# Or run directly with npx
npx prfect

# Basic usage
prfect

# With options
prfect --source feature/auth --target main --save

🎯 Context Support

Enhance your PR descriptions by providing additional context that may not be visible in the code changes. Perfect for adding ticket numbers, business context, or background information.

Usage

# Basic context
prfect "This was a big refactor that addressed Linear ticket BE-123"

# Context with background info
prfect "Fixes critical bug from user reports. Addresses performance issues in checkout flow"

# Context with follow-up information
prfect "Implements OAuth integration per security requirements. Follow up for MFA coming in BE-124"

# Context in CI mode
prfect "Emergency hotfix for production issue" --ci --source hotfix/payment-bug --target main

What Context Helps With

  • 📋 Ticket References: Link to Linear, Jira, or other project management tools
  • 💼 Business Context: Explain the business reason or user impact
  • 🔗 Dependencies: Note related work or follow-up tasks
  • ⚠️ Urgency: Indicate if this is a hotfix or time-sensitive change
  • 📊 Performance: Provide benchmarks or performance context
  • 🔒 Security: Add security considerations or compliance notes

Context Integration

The context is automatically incorporated into:

  • Default prompts: Added as "ADDITIONAL CONTEXT" section
  • Custom templates: Seamlessly integrated into template-based generation
  • CI mode: Included in automated PR generation
  • All AI models: Works with any Ollama-compatible model

📝 Custom PR Templates

Prfect supports custom PR templates to match your team's workflow and requirements. It automatically detects and uses GitHub standard templates or allows you to specify custom ones.

Template Detection Priority

  1. Explicit path: --template-path custom/template.md
  2. GitHub standard: .github/pull_request_template.md
  3. Alternative naming: .github/PULL_REQUEST_TEMPLATE.md
  4. Docs location: docs/pull_request_template.md
  5. Default built-in: Fallback template

Usage

# Use custom template
prfect --template-path .github/custom_template.md

# Auto-detect GitHub template (default behavior)
prfect

# Specify source and target with template
prfect --source feature/auth --target main --template-path team_template.md

# CI mode with custom template
prfect --ci --template-path templates/ci_template.md

Template Structure

Templates should include common sections that Prfect will intelligently fill:

## Summary
[Brief description of changes]

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## Key Changes
- 
- 
- 

## How has this been tested?
- [ ] Unit tests pass
- [ ] Manual testing completed
- [ ] Edge cases considered

## Breaking Changes
[Only include if there are breaking changes]

## Additional Notes
[Any additional information for reviewers]

Template Features

  • 🏢 Mono-repo Support: Searches up directory tree for templates
  • ✅ Validation: Checks template structure and content quality
  • 🔗 GitHub Integration: Works seamlessly with GitHub's PR template system
  • 🔄 Fallback Handling: Uses default template if custom one not found
  • 🎯 Smart Parsing: AI understands your template structure and fills it appropriately

Example: Team-Specific Template

Create .github/pull_request_template.md:

## Summary
[What does this PR accomplish?]

## Business Impact
[How does this benefit users/business?]

## Technical Details
[Implementation approach and key technical decisions]

## Security Considerations
- [ ] No sensitive data exposed
- [ ] Authentication/authorization reviewed
- [ ] Input validation implemented

## Performance Impact
- [ ] No performance degradation
- [ ] Load testing completed (if applicable)

## Testing Strategy
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manual testing completed
- [ ] Accessibility tested (if UI changes)

## Deployment Notes
[Any special deployment considerations]

## Documentation
- [ ] README updated (if needed)
- [ ] API docs updated (if needed)
- [ ] Internal docs updated (if needed)

Prfect will automatically detect and use this template for all PRs in your repository!

📋 Usage Examples

Command Line

# Generate PR for current branch → auto-detected main
prfect

# Specify source branch
prfect --source feature/authentication

# Specify both branches
prfect --source feature/auth --target main

# Use different AI model
prfect --model llama2

# Save to file automatically
prfect --save

# Custom Ollama host
prfect --ollama-host http://192.168.1.100:11434

# Generate without emojis
prfect --no-emojis

# Show AI thinking process (useful for debugging)
prfect --show-thinking

# Use custom PR template
prfect --template-path .github/custom_template.md

# Add context information to the AI prompt
prfect "This was a big refactor that addressed Linear ticket BE-123. Follow up for BE-124 coming soon but non blocking"

# Context with other options
prfect "Fixes critical bug from user reports" --source feature/bugfix --target main --model qwen3:latest

Programmatic Usage (Node.js/TypeScript)

import { PRGenerator } from "prfect";

const generator = new PRGenerator();

const prMessage = await generator.run({
  source: "feature/new-feature",
  target: "main",
  model: "qwen3:latest",
  save: true,
  interactive: false,
  noEmojis: true,
  showThinking: false,
  templatePath: ".github/custom_template.md",
  context: "This addresses Linear ticket BE-123",
});

console.log(prMessage);

Integration with Package.json

{
  "scripts": {
    "pr": "prfect",
    "pr:save": "prfect --save --no-interactive",
    "pr:clean": "prfect --no-emojis --save",
    "pr:debug": "prfect --show-thinking",
    "pr:custom": "prfect --template-path .github/custom_template.md"
  }
}

📊 Sample Output

Prfect generates professional PR descriptions like this:

# Implement User Authentication System

## Summary

This PR adds a comprehensive user authentication system with JWT tokens,
password hashing, and role-based access control to improve application security.

## Key Changes

- Added JWT authentication middleware with token validation
- Implemented bcrypt password hashing for secure credential storage
- Created user registration and login API endpoints
- Added role-based permission system with admin/user roles
- Updated database schema with users and roles tables
- Added authentication guards for protected routes

## Breaking Changes

- All API endpoints now require authentication headers
- User session handling has changed from cookies to JWT tokens
- Database migration required for new user tables

## Testing Considerations

- Unit tests added for authentication functions
- Integration tests for login/register workflows
- Manual testing required for UI authentication flows
- Load testing recommended for JWT token validation

🛠️ Configuration

Environment Variables

export OLLAMA_HOST=http://localhost:11434
export PRFECT_MODEL=qwen3:latest
export PRFECT_DEFAULT_TARGET=main

Git Hooks Integration

Add to .git/hooks/pre-push:

#!/bin/sh
if [ "$2" = "origin" ]; then
    prfect --save --no-interactive
fi

🚀 Installation Options

Node.js/TypeScript (Full-Featured)

# Global installation
npm install -g prfect

# Local development
git clone <repository>
cd prfect
npm install
npm run build
npm start

Features:

  • ✅ TypeScript support with full type safety
  • ✅ Beautiful CLI with colors and progress
  • ✅ Programmatic API for integration
  • ✅ Professional error handling
  • ✅ Interactive and non-interactive modes
  • ✅ Comprehensive logging

🎛️ Available AI Models

Prfect works with any Ollama-compatible model:

  • qwen3:latest (Default)
  • qwen3:0.6b (Good for CI)
  • gemma3:latest
  • deepseek-coder:latest
  • llama3:latest
  • codellama:latest
  • mistral
  • mixtral

For a complete list visit Ollama's model hub and install them with the Ollama CLI.

Install models with:

ollama pull <model-name>

🔧 Advanced Configuration

Custom Prompts

The Node.js package supports custom prompt templates:

const generator = new PRGenerator();
generator.setPromptTemplate(`
Custom prompt for ${sourceBranch} → ${targetBranch}
Analysis: ${commitInfo}
Generate: [your requirements]
`);

CI/CD Integration

GitHub Actions

name: Generate PR Description
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  generate-description:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Ollama
        run: |
          curl -fsSL https://ollama.ai/install.sh | sh
          ollama serve &
          ollama pull qwen3:latest
      - name: Generate PR Description
        run: npx prfect --no-interactive --save

GitLab CI

generate-pr:
  stage: prepare
  script:
    - curl -fsSL https://ollama.ai/install.sh | sh
    - ollama serve &
    - ollama pull qwen3:latest
    - npx prfect --no-interactive

🏗️ Development Setup

Node.js/TypeScript Development

# Clone repository
git clone <repository>
cd prfect

# Install dependencies
npm install

# Development mode
npm run dev

# Build
npm run build

# Run tests
npm test

# Lint and format
npm run lint
npm run format

Project Structure

prfect/
├── src/
│   └── index.ts              # Main TypeScript application
├── scripts/
│   ├── prfect.sh            # Bash version
│   └── prfect.py            # Python version
├── dist/                     # Compiled JavaScript
├── package.json             # Node.js configuration
├── tsconfig.json            # TypeScript configuration
└── README.md               # This file

🐛 Troubleshooting

Common Issues

"Not in a git repository"

# Ensure you're in a git repository
git status

"Ollama is not accessible"

# Check if Ollama is running
curl http://localhost:11434/api/tags

# Start Ollama if not running
ollama serve

"Model not found"

# List available models
ollama list

# Install default model
ollama pull qwen3:latest

"Could not detect default branch"

# Specify target branch explicitly
prfect --target main

"No commits found"

# Check if there are commits between branches
git log --oneline main..feature-branch

Debug Mode

For detailed logging:

# Node.js version
DEBUG=prfect* prfect

📝 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

📞 Support

For support, please open a new issue on the GitHub Issues page.