Loading...
Generates standardized Conventional Commits and PR descriptions from git diffs.
{{git_diff}}Generate a Pull Request description based on the provided git diff.
Git Diff Context:
{{git_diff}}
Format:
- PR Title (Conventional Commit format)
- Overview of Changes
- Type of Change (Feature, Bugfix, Refactor)
- Testing StepsYou enforce Conventional Commits guidelines and clear developer communication.
Copy ready-to-use boilerplate code for Git Commit & Pull Request Description Writer using the target SDK.
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
async function runPrompt(variables: Record<string, string>) {
let promptText = `Generate a Pull Request description based on the provided git diff.
Git Diff Context:
{{git_diff}}
Format:
- PR Title (Conventional Commit format)
- Overview of Changes
- Type of Change (Feature, Bugfix, Refactor)
- Testing Steps`;
Object.entries(variables).forEach(([key, val]) => {
promptText = promptText.replace(new RegExp(`{{\\s*${key}\\s*}}`, 'g'), val);
});
const response = await ai.models.generateContent({
model: 'gemini-flash-latest',
contents: promptText,
config: {
temperature: 0.7,
systemInstruction: `You enforce Conventional Commits guidelines and clear developer communication.`,
},
});
return response.text;
}