prompt

package
v1.0.43 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectEditor

func DetectEditor() string

DetectEditor returns the user's preferred editor from the environment. It checks $EDITOR and $VISUAL first, then falls back to common editors.

func EditPrompt

func EditPrompt(content string) (string, error)

EditPrompt writes prompt content to a temp file, opens it in the user's editor, and returns the (possibly modified) content after the editor exits.

func EstimateTokens

func EstimateTokens(text string) int

EstimateTokens estimates the number of tokens in text using the ~3.5 chars/token heuristic. Accuracy is within ~20% for typical English text.

func PrintTokenWarnings

func PrintTokenWarnings(tokens int)

PrintTokenWarnings prints warnings when the prompt is too short or too long.

func RenderTemplate

func RenderTemplate(templateName, templateContent string, data any) (string, error)

RenderTemplate renders a Go text/template with the given data. The templateName is used for error messages, templateContent is the raw template string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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