Module: GemHadar::PromptTemplate

Included in:
GemHadar
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

Instance Method Details

#default_git_release_promptString

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.

Returns:

  • (String)

    the prompt template for GitHub release changelog generation



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_promptString

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.

Returns:

  • (String)

    the system prompt for GitHub release changelog generation



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_promptString

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’.

Returns:

  • (String)

    the prompt template for semantic version bump suggestion generation



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_promptString

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’.

Returns:

  • (String)

    the system prompt for semantic version bump suggestion generation



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