Module: GemHadar::PromptTemplate
- Included in:
- GemHadar, ChangelogGenerator
- Defined in:
- lib/gem_hadar/prompt_template.rb
Overview
A module that provides default prompt templates for interacting with AI models when generating GitHub release changelogs and semantic version bump suggestions.
This module contains methods that return system prompts and template strings used by the GemHadar framework to instruct AI models on how to format responses for release notes and versioning decisions. These prompts are designed to produce structured, relevant output that aligns with development workflow requirements.
Instance Method Summary collapse
-
#default_changelog_prompt ⇒ Object
The default_changelog_prompt method returns the prompt template used for generating changelog entries.
-
#default_changelog_system_prompt ⇒ String
The default_changelog_system_prompt method returns the system prompt used for generating changelog entries.
-
#default_git_release_prompt ⇒ String
The default_git_release_prompt method returns the prompt used for generating GitHub release changelogs.
-
#default_git_release_system_prompt ⇒ String
The default_git_release_system_prompt method returns the system prompt used for generating GitHub release changelogs.
-
#default_version_bump_prompt ⇒ String
The default_version_bump_prompt method returns the prompt template used for generating semantic version bump suggestions.
-
#default_version_bump_system_prompt ⇒ String
The default_version_bump_system_prompt method returns the system prompt used for generating semantic version bump suggestions.
Instance Method Details
#default_changelog_prompt ⇒ Object
The default_changelog_prompt method returns the prompt template used for generating changelog entries.
This prompt instructs the AI model to create a structured changelog entry based on Git commit history. It provides detailed guidelines for formatting the output, including how to summarize changes, mark code elements with appropriate markdown syntax, and exclude trivial updates like version bumps while focusing on significant functional changes.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/gem_hadar/prompt_template.rb', line 163 def default_changelog_prompt <<~EOT Generate a changelog entry from the following Git log (commit messages and unified diffs): %{log_diff} **Input:** - Commit messages describe the author's intent. - Patches show the actual code changes and are the source of truth. - If a commit message is vague or misleading, trust the patch. **Rules:** 1. Categorize each change into one of the sections below. 2. **Omit any section that has zero entries. Do NOT output an empty header with no bullet points beneath it.** 3. Do NOT mention the version number of the change set. 4. Skip entries that are purely version bumps. 5. Wrap variable, method, function, and constant names found in messages or patches in backticks. 6. Wrap version numbers found in messages in **bold**. 7. Do NOT reference individual commits by SHA-1 hash. 8. Do NOT add information you are not certain about. 9. Do NOT include chatty remarks, introductions, or closing notes. **Output format:** - Use the section headers below. Omit empty sections entirely. ### Breaking API changes, removed features, or compatibility changes that require user action. - … ### Features New user-facing APIs, options, or capabilities. - … ### Fixes - … ### Improvements - … ### Build & CI CI pipeline, Dockerfile, dependency, gemspec metadata, test infrastructure, and tooling changes. - … ### Testing - … ### Documentation - … EOT end |
#default_changelog_system_prompt ⇒ String
The default_changelog_system_prompt method returns the system prompt used for generating changelog entries.
This prompt instructs the AI model to act as a Ruby programmer who creates markdown-formatted changelog entries for new releases. The generated content helps users understand what has changed in the software while maintaining a professional tone and format.
147 148 149 150 151 152 153 |
# File 'lib/gem_hadar/prompt_template.rb', line 147 def default_changelog_system_prompt <<~EOT You are a Ruby programmer generating a changelog entry in markdown. Summarize code changes for a new version in a professional, factual tone. You are not a chatbot. EOT end |
#default_git_release_prompt ⇒ String
The default_git_release_prompt method returns the prompt used for generating GitHub release changelogs.
This prompt instructs the AI model to create a markdown-formatted changelog entry for a new release. It specifies guidelines for what constitutes significant changes, emphasizing the exclusion of trivial updates and the inclusion of only verified and impactful modifications.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/gem_hadar/prompt_template.rb', line 35 def default_git_release_prompt <<~EOT Generate the release body for a new release from the following Git log (commit messages and unified diffs): %{log_diff} **Input:** - Commit messages describe the author's intent. - Patches show the actual code changes and are the source of truth. - If a commit message is vague or misleading, trust the patch. **Rules:** 1. Categorize each change into one of the sections below. 2. **Omit any section that has zero entries. Do NOT output an empty header with no bullet points beneath it.** 3. Never mention the version number of the release. 4. Include only significant changes that impact functionality, performance, or user experience. 5. Exclude trivial updates: - Version number increments - Dependency version bumps (unless they resolve critical issues) - Minor code style adjustments - Internal documentation tweaks 6. Wrap variable, method, function, and constant names in backticks. 7. Wrap version numbers in **bold**. 8. Do NOT reference individual commits by SHA-1 hash. 9. Do NOT add chatty remarks, notes, introductions, or closing lines. 10. If unsure about a change's significance, omit it. **Output format:** - Use the section headers below. Omit empty sections entirely. ### Breaking API changes, removed features, or compatibility changes that require user action. - … ### Features New user-facing APIs, options, or capabilities. - … ### Fixes - … ### Improvements - … ### Build & CI CI pipeline, Dockerfile, dependency, gemspec metadata, test infrastructure, and tooling changes. - … ### Testing - … ### Documentation - … EOT end |
#default_git_release_system_prompt ⇒ String
The default_git_release_system_prompt method returns the system prompt used for generating GitHub release changelogs.
This prompt instructs the AI model to act as a Ruby programmer who creates markdown-formatted changelog entries for new releases. The generated content helps users understand what has changed in the software.
18 19 20 21 22 23 24 |
# File 'lib/gem_hadar/prompt_template.rb', line 18 def default_git_release_system_prompt <<~EOT You are a Ruby programmer generating changelog messages in markdown format for new releases, so users can see what has changed. Remember you are not a chatbot of any kind. EOT end |
#default_version_bump_prompt ⇒ String
The default_version_bump_prompt method returns the prompt template used for generating semantic version bump suggestions.
This prompt instructs the AI model to analyze provided changes and determine whether a major, minor, or build version bump is appropriate according to Semantic Versioning principles. It requires the model to first provide a brief explanation of its reasoning, followed by a single line containing only one word: 'major', 'minor', or 'build'.
126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/gem_hadar/prompt_template.rb', line 126 def default_version_bump_prompt <<~EOT Given the current version %{version} and the following changes: %{log_diff} Please explain your reasoning for suggesting a version bump and then end with a single line containing only one word: 'major', 'minor', or 'build'. EOT end |
#default_version_bump_system_prompt ⇒ String
The default_version_bump_system_prompt method returns the system prompt used for generating semantic version bump suggestions.
This prompt instructs the AI model to act as an expert in semantic versioning, analyzing provided changes and determining whether a major, minor, or build version bump is appropriate. It requires the model to provide a brief explanation of its reasoning followed by a single line containing only one word: 'major', 'minor', or 'build'.
106 107 108 109 110 111 112 113 114 |
# File 'lib/gem_hadar/prompt_template.rb', line 106 def default_version_bump_system_prompt <<~EOT You are an expert at semantic versioning. Analyze the provided changes and suggest whether to bump major, minor, or build (=patch) version according to Semantic Versioning. Provide a brief explanation of your reasoning, followed by a single line containing only one word: 'major', 'minor', or 'build'. EOT end |