Skip to content

Prompts

Prompt templates for PR generation.

PR_SYSTEM_PROMPT module-attribute

PR_SYSTEM_PROMPT = "\nYou are an AI assistant knowledgeable in Git best practices.\nYou are tasked with generating PR titles and descriptions based on a list of commits.\nFollow the user's requirements carefully and to the letter.\n"

PR_TITLE_PROMPT module-attribute

PR_TITLE_PROMPT = 'Based on the following commits, generate a clear, concise PR title that captures the\nessence of the changes.\nFollow these guidelines:\n- Focus on the most important change\n- If there are multiple related changes, summarize them\n- Keep it under 80 characters\n- Start with a capital letter\n- Don\'t use a period at the end\n- Use present tense (e.g., "Add feature" not "Added feature")\n- Be descriptive and specific (e.g., "Fix memory leak in data processing" not just "Fix bug")\n- Include the type of change if clear (Feature, Fix, Refactor, etc.)\n\nCommits:\n{commit_list}\n\nPR Title:\n---\n\nIMPORTANT:\n- Do not include any other text in your response except the PR title.\n- Do not wrap the PR title in quotes.\n- Do not add any explanations or other text to your response.\n- Do not generate Capitalized PR titles.\n- Do not generate PR titles in CamelCase.\n'

PR_DESCRIPTION_PROMPT module-attribute

PR_DESCRIPTION_PROMPT = "\nBased on the following commits, generate a comprehensive PR description following this template:\n\n## What type of PR is this? (check all applicable)\n\n- [ ] Refactor\n- [ ] Feature\n- [ ] Bug Fix\n- [ ] Optimization\n- [ ] Documentation Update\n\n## Description\n[Fill this section with a detailed description of the changes]\n\n## Related Tickets & Documents\n- Related Issue #\n- Closes #\n\n## Added/updated tests?\n- [ ] Yes\n- [ ] No, and this is why: [explanation]\n- [ ] I need help with writing tests\n\nConsider the following guidelines:\n- Check the appropriate PR type boxes based on the commit messages\n- Provide a clear, detailed description of the changes\n- Include any relevant issue numbers that this PR relates to or closes\n- Indicate if tests were added, and if not, explain why\n- Use bullet points for clarity\n\nCommits:\n{commit_list}\n\nPR Description:\n---\n\nIMPORTANT:\n- Do not include any other text in your response except the PR description.\n- Do not wrap the PR description in quotes.\n- Do not add any explanations or other text to your response.\n"

format_commits_for_prompt

format_commits_for_prompt(commits: list[str]) -> str

Format commit messages as a bulleted list.

Parameters:

Name Type Description Default
commits list[str]

List of commit messages

required

Returns:

Type Description
str

Formatted commit list as a string

Source code in src/codemap/git/pr_generator/prompts.py
81
82
83
84
85
86
87
88
89
90
91
92
def format_commits_for_prompt(commits: list[str]) -> str:
	"""
	Format commit messages as a bulleted list.

	Args:
	    commits: List of commit messages

	Returns:
	    Formatted commit list as a string

	"""
	return "\n".join([f"- {commit}" for commit in commits])