If you've ever stared at a GitHub PR wondering how to summarize your recent commits, this project is for you. In this post, I'll walk you through how I built pr-desc-ai — an AI-powered tool that takes your Git commit messages and turns them into high-quality, human-friendly pull request descriptions.
The best part? It's built with a modern stack: TypeScript, Cloudflare Workers, OpenAI, and even comes with a VSCode extension. It's also structured as a monorepo managed by Turborepo.
pr-desc-ai helps you:
pr-desc-ai/
├── git-parser/ # Node.js CLI tool
├── inference-worker/ # Cloudflare Worker as backend API
└── vscode-extension/ # Optional VSCode integration
mkdir pr-desc-ai && cd pr-desc-ai
pnpm init -y
pnpm add -D turbo
Then add a turbo.json
in the root:
{
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "build/**"]
},
"dev": {
"cache": false
},
"lint": {
"outputs": []
},
"test": {
"outputs": []
}
}
}
Update your package.json
to enable workspaces:
{
"name": "pr-desc-ai",
"private": true,
"workspaces": ["git-parser", "inference-worker", "vscode-extension"],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev"
}
}
In /git-parser
, write a script that runs this:
git log origin/main..HEAD --pretty=format:"%s"
Then send the commits to the backend using fetch
or axios
.
Key tools:
execa
to run git commandsclipboardy
to copy resultcommander
for CLI flagsIn /inference-worker
:
npm create cloudflare@latest
# Choose 'hello world' template
Then:
Hono.js
for routing (optional)/generate
POST endpoint{ commits: string[] }
const prompt = `Write a PR description for these commits:\n\n${commits.join('\n')}`
Deploy with:
wrangler publish
Don't forget:
wrangler secret put OPENAI_API_KEY
Use yo code
to bootstrap:
npm install -g yo generator-code
yo code
In src/extension.ts
:
Make it configurable:
{
"prGen.apiEndpoint": "https://your-cloudflare-endpoint",
"prGen.apiKey": "your-api-key"
}
Use Cloudflare Workers and Pages (optional) to host your API and docs.
This was a fun and practical weekend project that helped me:
If you're curious about building AI-native developer tools, this kind of project is a fantastic place to start.
Happy shipping!
Repo: github.com/akbarsahata/pr-desc-ai
This page content is most likely AI generated. Use it with caution.