prompt

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const LazyContextPadding = 10

LazyContextPadding is the number of lines to show around the editable region.

View Source
const LazyContextThreshold = 100

LazyContextThreshold is the minimum file size (in lines) to use lazy context loading.

Variables

This section is empty.

Functions

func AskSystemPrompt

func AskSystemPrompt(instructions string) string

AskSystemPrompt returns the system prompt for ask command. Returns empty string if no instructions configured (preserves current behavior).

func AskUserPrompt added in v0.0.4

func AskUserPrompt(question string, files []input.FileContent, stdin string) string

AskUserPrompt formats a question with optional file context

func HelpPrompt

func HelpPrompt(command, shell string) string

HelpPrompt returns the prompt for generating detailed command help

func ShouldUseLazyContext added in v0.0.11

func ShouldUseLazyContext(files []input.FileContent, specs []EditSpec) bool

ShouldUseLazyContext determines if lazy context loading should be used. Returns true if any guarded file exceeds the threshold.

func ShouldUseUnifiedDiff added in v0.0.10

func ShouldUseUnifiedDiff(model, diffFormat string) bool

ShouldUseUnifiedDiff determines if unified diff format should be used. diffFormat can be "auto", "udiff", or "replace".

func StreamEditSystemPrompt added in v0.0.10

func StreamEditSystemPrompt(instructions string, specs []EditSpec, model, diffFormat string) string

StreamEditSystemPrompt builds a system prompt for streaming edit format. diffFormat: "auto", "udiff", or "replace"

func StreamEditSystemPromptLazy added in v0.0.11

func StreamEditSystemPromptLazy(instructions string, specs []EditSpec, model, diffFormat string) string

StreamEditSystemPromptLazy builds a system prompt for lazy context loading mode. This is similar to StreamEditSystemPrompt but adds info about the read_context tool.

func StreamEditUserPrompt added in v0.0.10

func StreamEditUserPrompt(request string, files []input.FileContent, specs []EditSpec, useUnifiedDiff bool) string

StreamEditUserPrompt builds the user prompt with file context. useUnifiedDiff determines which format instruction to include.

func StreamEditUserPromptLazy added in v0.0.11

func StreamEditUserPromptLazy(request string, files []input.FileContent, specs []EditSpec, useUnifiedDiff bool) string

StreamEditUserPromptLazy builds a user prompt with lazy context loading. For large guarded files, only the editable region + padding is included. The LLM can use read_context tool to fetch more if needed.

func SuggestSchema

func SuggestSchema(numSuggestions int) map[string]interface{}

SuggestSchema returns the JSON schema for structured output

func SuggestSystemPrompt

func SuggestSystemPrompt(shell, instructions string, numSuggestions int, enableSearch bool) string

SuggestSystemPrompt returns the system prompt for command suggestions

func SuggestUserPrompt

func SuggestUserPrompt(userInput string, files []input.FileContent, stdin string) string

SuggestUserPrompt formats the user's request with optional file context

Types

type EditSpec added in v0.0.10

type EditSpec struct {
	Path      string
	StartLine int // 1-indexed, 0 means from beginning
	EndLine   int // 1-indexed, 0 means to end
	HasGuard  bool
}

EditSpec describes a file with optional line range guard.

Jump to

Keyboard shortcuts

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