Skip to content

Implement {{message}} template variable #91

@404-Page-Found

Description

@404-Page-Found

Task summary

The README documents {{message}} as a template variable available for custom prompt templates, but it's marked as "(reserved)" and never actually implemented. Wire it through the template substitution system so users can reference the previous commit message context in their custom prompts.

Why this is a good first issue

Self-contained feature that touches the existing template substitution pipeline. Teaches how TemplateVars, prompt resolution, and config flow work. The variable is already documented, so this closes a gap between docs and implementation.

Suggested files or areas

  • src/types.ts — Add message field to TemplateVars interface
  • src/llm/prompt.ts — Add {{message}} to getAvailableTemplateVars(), handle substitution
  • src/llm/client.ts — In generateSuggestions(), resolve the previous commit message and pass it through vars
  • src/git/diff.ts — Add a helper to get the latest commit message (e.g., git log -1 --format=%s)

Acceptance criteria

  • {{message}} is listed in getAvailableTemplateVars() output (shown in --help)
  • When a custom systemPromptTemplate or userPromptTemplate contains {{message}}, it is replaced with the previous commit's subject line
  • If there is no previous commit (empty repo), {{message}} resolves to an empty string
  • No breaking changes to existing template usage
  • npm run build passes with no errors

Extra context

  • TemplateVars is defined in src/llm/prompt.ts with fields: diff, profile, branch
  • substituteTemplateVars() already handles {{diff}}, {{profile}}, {{branch}} — follow the same pattern
  • resolveSystemPrompt() and resolveUserPrompt() accept TemplateVars
  • See src/git/diff.ts for existing git helpers — getBranchName() is a good reference for adding getLastCommitMessage()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions