prompt

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package prompt builds LLM prompts from git history.

The default review system prompt is embedded from templates/review_system.tmpl (byte-identical to the historical hardcoded string). Custom user templates (text/template) can override it via BuildReviewWithTemplate (Item 3). The template requires the model to end with a fenced `risk` JSON block (§7.1), parsed back in internal/llm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildReview

func BuildReview(r Review) (system, user string)

BuildReview renders the system and user messages for a review. The user message carries the commit metadata (subjects, authors, bodies, file lists) followed by the full unified diff in a fenced block. It uses the embedded default system prompt (equivalent to BuildReviewWithTemplate(r, "")).

func BuildReviewWithTemplate added in v0.2.1

func BuildReviewWithTemplate(r Review, systemTemplateFile string) (system, user string, err error)

BuildReviewWithTemplate renders the system prompt from a custom template file. If systemTemplateFile is empty, the embedded default is used (identical to BuildReview). Otherwise the file is parsed as a text/template and executed with the Review as data (fields Range, Commits, Diff). The user message is built identically in both cases.

Types

type Review

type Review struct {
	Range   string
	Commits []gitlog.Commit
	Diff    string
}

Review is the input for building a review prompt.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL