Skip to content
AI News HubLIVE
Source content · Analysis pending2 min read

PR-desc – generate PR descriptions from a Git diff, no AI required

Summary

Notifications You must be signed in to change notification settings Fork 0 Star 0 BranchesTags Open more actions menu Folders and files NameName Last commit message Last commit date Latest commit History 3 Commits 3 Com…

SourceHacker News AIAuthor: uzair702
PR-desc – generate PR descriptions from a Git diff, no AI required
Report an error

The correction channel is not available yet. You can copy the article reference below for later.

Correction instructions
Read article

Notifications You must be signed in to change notification settings Fork 0 Star 0 BranchesTags Open more actions menu Folders and files NameName Last commit message Last commit date Latest commit History 3 Commits 3 Commits .claude/memory .claude/memory bin bin examples examples .gitignore .gitignore CLAUDE.md CLAUDE.md LICENSE LICENSE README.md README.md package.json package.json Repository files navigation Turn a git diff into a ready-to-paste PR description — no more copying your diff into ChatGPT/Claude and asking "can you write a PR description for this?" every single time you open a pull request. npx pr-desc --branch main Before / after Without pr-desc With pr-desc git diff main npx pr-desc --branch main copy the whole diff (nothing to copy) paste into an AI chat (nothing to paste) type "write me a PR description for this" (nothing to ask) wait for a response, then reformat it markdown, ready to paste into GitHub, instantly Why Every PR needs a summary, a list of what changed, and a checklist — and most people generate that by hand-pasting their diff into an AI chat window. pr-desc does that step locally and deterministically: it reads a diff, groups the changes (source / tests / config / docs), counts additions and deletions per file, and produces clean markdown you can paste straight into GitHub or GitLab. It works fully offline, with zero runtime dependencies. An optional --ai flag will polish the wording with Claude if you want it — never required for basic use. Install npx pr-desc --branch main # no install, just run it or install it globally: npm install -g pr-desc pr-desc --branch main Usage Command What it does pr-desc Diff of staged changes (git diff --cached) pr-desc --branch Diff against another branch pr-desc --all Diff of all uncommitted changes (staged + unstaged) pr-desc Read a diff from a file cat some.diff | pr-desc - Read a diff from stdin pr-desc --ai Polish the output with Claude (needs ANTHROPIC_API_KEY) pr-desc --help Show help AI polish (optional) Set ANTHROPIC_API_KEY in your environment and pass --ai to have Claude rewrite the generated description for clarity. If the key isn't set, --ai silently falls back to the plain, locally generated description — never required for basic usage. Example node bin/cli.js examples/sample.diff Produces: ## Summary This PR updates 3 source file(s), adds 1 new file(s), removes 1 file(s), touches 1 test file(s), updates 1 doc file(s) (+25/-6 lines across 5 file(s)). ## Changes Source - src/auth/login.js (+8/-0) - src/auth/rateLimiter.js (new) (+8/-0) - src/auth/legacyLogin.js (deleted) (+0/-6) Tests - tests/auth/login.test.js (+7/-0) Docs - README.md (+2/-0) ## Checklist - [ ] Tests added/updated - [ ] Docs updated - [ ] Manually verified the change How it works pr-desc is a single file (bin/cli.js) with no runtime dependencies. It splits the unified diff per file, detects new/deleted/renamed files, counts additions and deletions, and categorizes each file as source, test, config, or docs by path pattern — all with plain string parsing, no external diff library. Contributing Issues and PRs welcome — especially around the file-categorization heuristic (more languages/path patterns). Run npm test before submitting, which runs the CLI against examples/sample.diff and checks it doesn't crash. License MIT MIT license Activity Stars 0 stars Watchers 0 watching Forks 0 forks Report repository

Key points and analysis

Article intelligence

EngineersIntermediate

Key points

  • AI generation is temporarily unavailable; this entry was preserved with deterministic fallback metadata.
  • Notifications You must be signed in to change notification settings Fork 0 Star 0 BranchesTags Open more actions menu Folders and files NameName Last commit message Last commit da…

Highlights and analysis are generated automatically and may contain errors. Check the original source.