LLM‑Powered Sidekick for Painless PR Descriptions
Описание и применение
Автоматизированный скрипт на Python использует diff и сообщения коммитов для генерации контекстных описаний PR с помощью GPT‑3.5‑Turbo‑0125, экономя время разработчика.
Задача
Writing meaningful pull request descriptions after pushing code is tedious and often results in vague, context‑poor summaries.
Результат
The script produces structured, context‑rich PR descriptions that save developers time and improve clarity.
Рабочий процесс
- 1. Capture git diff via
git diff main...HEADusing a Python subprocess. - 2. Retrieve commit messages with
git log main...HEAD --pretty=format:%s%n%b. - 3. Combine commit messages and diff into a prompt for an LLM (gpt‑3.5‑turbo‑0125).
- 4. Ask the LLM to generate a title, summary, problem, solution, and changes sections.
- 5. Output the formatted description to clipboard or console.
- 6. Optionally integrate into editor or pre‑commit hook.
Доказательства
I was using Python 3.10 for this little script, just because that's what my pyenv default was set to.
For the LLM, I picked gpt-3.5-turbo-0125 for its speed and cost-effectiveness for initial experiments.
I added a section for Commit Messages and Git Diff and tweaked the prompt instruction: Analyze the following commit messages and git diff. Based on this information, generate a detailed and context-aware pull request description.
- Дата записи: 2026-11-02T16:28:57.164Z