llm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CommitMsgPrompt = `` /* 990-byte string literal not displayed */

CommitMsgPrompt instructs the model to generate a commit message.

View Source
const SuggestPRPrompt = `` /* 832-byte string literal not displayed */

SuggestPRPrompt instructs the model to author a pull request.

View Source
const SystemPrompt = `` /* 1247-byte string literal not displayed */

SystemPrompt instructs the model to analyze a development session.

Variables

This section is empty.

Functions

func BuildCommitMsgPrompt

func BuildCommitMsgPrompt(transcript []TranscriptEntry, diff string) string

BuildCommitMsgPrompt assembles transcript context plus a bounded change summary and diff excerpt for commit message generation.

func BuildSuggestPRPrompt

func BuildSuggestPRPrompt(diff, commitSubjects, prTemplate string) string

BuildSuggestPRPrompt assembles the prompt for PR generation. It reuses the summary+excerpt strategy from commit-msg prompts.

func BuildUserPrompt

func BuildUserPrompt(commitHash, subject string, stats ExplainContext, transcript []TranscriptEntry, diff string) string

BuildUserPrompt assembles transcript, diff, and stats into the prompt.

func FormatCondensedTranscript

func FormatCondensedTranscript(entries []TranscriptEntry) string

FormatCondensedTranscript formats transcript entries into a human-readable format for LLM consumption.

func StripHTMLComments

func StripHTMLComments(s string) string

Types

type ExplainContext

type ExplainContext struct {
	FilesChanged int     `json:"files_changed"`
	LinesAdded   int     `json:"lines_added"`
	LinesDeleted int     `json:"lines_deleted"`
	AIPercentage float64 `json:"ai_percentage"`
	AILines      int     `json:"ai_lines"`
	HumanLines   int     `json:"human_lines"`
	SessionCount int     `json:"session_count"`
	RootSessions int     `json:"root_sessions"`
	Subagents    int     `json:"subagents"`
	TopFiles     []struct {
		Path       string  `json:"path"`
		Added      int     `json:"added"`
		Deleted    int     `json:"deleted"`
		TotalLines int     `json:"total_lines"`
		AILines    int     `json:"ai_lines"`
		HumanLines int     `json:"human_lines"`
		AIPercent  float64 `json:"ai_percentage"`
	} `json:"top_files"`
}

ExplainContext is the subset of explain stats needed for the prompt.

type GenerateResult

type GenerateResult struct {
	Narrative *NarrativeResult
	Provider  string
	Model     string
}

GenerateResult holds the narrative plus metadata about how it was generated.

func Generate

func Generate(ctx context.Context, prompt string) (*GenerateResult, error)

Generate sends a redacted prompt to an available AI CLI and returns a parsed narrative. Providers are tried in order until one succeeds.

type GenerateTextResult

type GenerateTextResult struct {
	Text     string
	Provider string
	Model    string
}

GenerateTextResult holds a raw text response plus metadata.

func GenerateText

func GenerateText(ctx context.Context, prompt string) (*GenerateTextResult, error)

GenerateText sends a redacted prompt to an available AI CLI and returns raw text. Providers are tried in order until one succeeds.

type NarrativeResult

type NarrativeResult struct {
	Title     string   `json:"title"`
	Intent    string   `json:"intent"`
	Outcome   string   `json:"outcome"`
	Learnings []string `json:"learnings"`
	Friction  []string `json:"friction"`
	OpenItems []string `json:"open_items"`
	Keywords  []string `json:"keywords"`
}

NarrativeResult holds the structured LLM response.

type SuggestPROutput

type SuggestPROutput struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

SuggestPROutput is the structured JSON the LLM must return.

func ParseSuggestPROutput

func ParseSuggestPROutput(raw string) (*SuggestPROutput, error)

ParseSuggestPROutput extracts the structured title/body from the LLM response.

type TranscriptEntry

type TranscriptEntry struct {
	Role     string
	Summary  string
	ToolName string
	FilePath string
}

TranscriptEntry is a lightweight event for the condensed transcript.

Jump to

Keyboard shortcuts

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