Skip to content

RemoteRabbit/pr-description.nvim

Repository files navigation

pr-description.nvim

CI GitHub release License: Unlicense Neovim Lua GitHub stars

Generate well-formatted PR/MR descriptions from your git commits.

Analyzes commits using conventional commit patterns, categorizes them, links issues and Jira tickets, and produces markdown output for GitHub PRs or GitLab MRs.

Features

  • 📝 Conventional commit categorization (features, fixes, docs, etc.)
  • 🔗 Auto-links GitHub/GitLab issues and Jira tickets
  • 📊 File change statistics grouped by directory
  • 🔍 Auto-detects GitHub vs GitLab from remote URL
  • 📋 Copy to clipboard with bang commands

Installation

{
  "remoterabbit/pr-description.nvim",
  cmd = { "PRDescription", "MRDescription" },
  opts = {},
}

Configuration

require("pr-description").setup({
  -- Auto-detect GitHub vs GitLab from remote URL (default: true)
  auto_detect_platform = true,

  -- Auto-fold a file change group when it has many files (default: true)
  autofold = true,

  -- Number of files in a group before it auto-folds (default: 10)
  autofold_threshold = 10,

  -- Prompt when more than `large_pr_threshold` commits (default: true)
  confirm_large_pr = true,

  -- Include icons in final PR/MR pr-description (default: true)
  enable_icons = true,

  -- Include a credit link to pr-description.nvim in the footer (default: true)
  enable_plugin_credit = true,

  -- Include stats footer in final PR/MR pr-description (default: true)
  enable_stats_footer = true,

  -- Fetch origin before generating to ensure accurate comparison (default: true)
  fetch_before_generate = true,

  -- Wrap each file change group in a collapsible <details> block (default: false)
  foldable_file_changes = false,

  -- Base URL for Jira ticket links (e.g., "https://company.atlassian.net/browse")
  jira_base_url = nil,

  -- Number of commits before prompting (default: 10)
  large_pr_threshold = 10,

  -- Override section headers (key = category, value = markdown header)
  sections = nil,

  -- Strip conventional commit prefix/scope from output (default: true)
  strip_commit_prefix = true,
})

Usage

Command Description
:PRDescription Generate GitHub PR description in a scratch buffer
:PRDescription! Generate and copy to clipboard
:MRDescription Generate GitLab MR description in a scratch buffer
:MRDescription! Generate and copy to clipboard

Lua API

local pr = require("pr-description")
local description, err = pr.generate_description({ is_gitlab = false, to_clipboard = true })

Headless / CLI

nvim --headless -c "lua print(require('pr-description').generate_description())" -c "qa"

Commit Types

The plugin recognizes conventional commit prefixes and groups them into sections:

Type Section When to use
feat ✨ Features A new feature or user-facing capability
fix 🐛 Bug Fixes A bug fix
perf ⚡ Performance A change that improves performance
docs 📚 Documentation Documentation-only changes
refactor 🔨 Refactoring Code changes that neither fix a bug nor add a feature
test 🧪 Tests Adding or updating tests
style 💄 Style Formatting, whitespace, or code style changes (no logic)
chore 🔧 Maintenance Dependency updates, tooling, or other upkeep
ci / build / ops 🏗️ Operations CI/CD, build system, or infrastructure changes
revert ⏪ Reverts Reverting a previous commit
wip 📦 Other Changes Work in progress (appears under "Other Changes")

Commits with a ! suffix (e.g., feat!: remove API) or a BREAKING CHANGE footer are grouped under ⚠️ Breaking Changes regardless of type. Commits that don't match any prefix appear under 📦 Other Changes.

Contributing

See CONTRIBUTING.md for development setup, testing, and guidelines.

Helpful Links

License

Unlicense — public domain

About

Create consistent PR/MR descriptions based on your conventional commits.

Topics

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Contributors