llm

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 15 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 BuildSuggestImplementationPrompt added in v0.2.0

func BuildSuggestImplementationPrompt(
	state string,
	startedIn string,
	repos string,
	sessionCount int,
	tokensIn, tokensOut string,
	commits string,
	fileChanges string,
) string

BuildSuggestImplementationPrompt assembles the prompt for a single implementation.

func BuildSuggestMergeCandidatesPrompt added in v0.2.0

func BuildSuggestMergeCandidatesPrompt(implementationSummaries string) string

BuildSuggestMergeCandidatesPrompt assembles the prompt for batch title/merge suggestions.

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 MergeSuggestion added in v0.2.0

type MergeSuggestion struct {
	ImplementationA string `json:"implementation_a"`
	ImplementationB string `json:"implementation_b"`
	Reason          string `json:"reason"`
}

MergeSuggestion proposes merging two implementations.

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 SuggestImplementationOutput added in v0.2.0

type SuggestImplementationOutput struct {
	Title   string `json:"title"`
	Summary string `json:"summary"`
}

SuggestImplementationOutput is the structured JSON the LLM must return for a single implementation.

func ParseSuggestImplementationOutput added in v0.2.0

func ParseSuggestImplementationOutput(raw string) (*SuggestImplementationOutput, error)

ParseSuggestImplementationOutput extracts the structured response for a single implementation.

type SuggestMergeCandidateOutput added in v0.2.0

type SuggestMergeCandidateOutput struct {
	Titles []TitleSuggestion `json:"titles,omitempty"`
	Merges []MergeSuggestion `json:"merges,omitempty"`
}

SuggestMergeCandidateOutput is the structured JSON for merge suggestions across multiple implementations.

func ParseSuggestMergeCandidatesOutput added in v0.2.0

func ParseSuggestMergeCandidatesOutput(raw string) (*SuggestMergeCandidateOutput, error)

ParseSuggestMergeCandidatesOutput extracts the batch title/merge 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 TitleSuggestion added in v0.2.0

type TitleSuggestion struct {
	ImplementationID string `json:"implementation_id"`
	Title            string `json:"title"`
}

TitleSuggestion proposes a title for an untitled implementation.

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