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.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/gem_hadar/prompt_template.rb', line 124 def default_changelog_prompt <<~EOT Generate a changelog entry for the following Git commit history: %{log_diff} - Summarize the changes in the following git log messages as bullet points. - Don't mention the version of the change set - Skip bullet points about version bumps. - List significant changes as bullet points using markdown when applicable. - Mark all names and values for variables, methods, functions, and constants, you see in the messages as markdown code surrounded by backtick characters. - Mark all version numbers you see in the messages as markdown bold surrounded by two asterisk characters. - Don't refer to single commits by sha1 hash. - Don't add information about changes you are not sure about. - Don't output any additional chatty remarks, notes, introductions, communications, etc. 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.
109 110 111 112 113 114 |
# File 'lib/gem_hadar/prompt_template.rb', line 109 def default_changelog_system_prompt <<~EOT You are a Ruby programmer generating a change log entry in markdown syntax, summarizing the code changes for a new version in a professional way. 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 |
# File 'lib/gem_hadar/prompt_template.rb', line 35 def default_git_release_prompt <<~EOT Output the content of a changelog for the new release of %{name} %{version} **Strictly** follow these guidelines: - Use bullet points in markdown format (`-`) to list significant changes. - Exclude trivial updates such as: * Version number increments * Dependency version bumps (unless they resolve critical issues) * Minor code style adjustments * Internal documentation tweaks - Include only verified and substantial changes that impact functionality, performance, or user experience. - If unsure about a change's significance, omit it from the output. - Avoid adding any comments or notes; keep the output purely factual. These are the log messages including patches for the new release: %{log_diff} 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’.
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/gem_hadar/prompt_template.rb', line 88 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’.
68 69 70 71 72 73 74 75 76 |
# File 'lib/gem_hadar/prompt_template.rb', line 68 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 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 |