Skip to content

ArthurHeymans/gptel-forge-prs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gptel-forge-prs: LLM functionality for pull request using forge

Uses the fantastic gptel to extend forge with LLM-powered pull request description generation.

Inspired by gptel-magit, which provides similar functionality for generating commit messages in magit.

Installation

use-package

(use-package gptel-forge-prs
  :after forge
  :config
  (gptel-forge-prs-install))

Doom Emacs

In packages.el:

(package! gptel-forge-prs
  :recipe (:host github :repo "ArthurHeymans/gptel-forge-prs"))

In config.el:

(use-package! gptel-forge-prs
  :after forge
  :config
  (gptel-forge-prs-install))

Usage

PR descriptions

When creating a pull request with forge-create-pullreq, you have two options:

  1. Press M-g to generate a PR description from the diff between source and target branches.
  2. Press M-r to first enter a rationale (explaining why the changes were made), then generate a description with that context.

PR Templates

When you create a pull request, forge automatically inserts any PR template from your repository (e.g., .github/PULL_REQUEST_TEMPLATE.md) into the buffer. gptel-forge-prs detects this existing content and passes it to the LLM as a structure to follow.

The LLM will:

  • Keep all section headers from the template unchanged
  • Fill in each section with relevant information based on the code diff
  • Write ‘N/A’ for sections that don’t apply to the changes

This means you get properly structured PR descriptions that follow your repository’s conventions automatically.

To disable this behavior and generate descriptions without following the buffer template, set gptel-forge-prs-use-buffer-template to nil.

Customisation

Prompts, model, backend, and PR template behavior can be customised. See customize-group gptel-forge-prs.

gptel-forge-prs-pr-prompt
The system prompt for generating PR descriptions. Two presets are available: gptel-forge-prs-prompt-default and gptel-forge-prs-prompt-conventional (for conventional commit style).
gptel-forge-prs-model
Override the gptel model (defaults to gptel-model).
gptel-forge-prs-backend
Override the gptel backend (defaults to gptel-backend).
gptel-forge-prs-use-buffer-template
Whether to use existing buffer content as a template structure (default: t).

About

Use gptel to create PR messages from forge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published