Documentation
¶
Overview ¶
Package prompt provides prompt template loading and management.
Core types:
- Loader: Loads prompt templates from files or embedded resources
- Template: A loaded prompt template with variable substitution
Example usage:
loader := prompt.NewLoader(prompt.Config{
TemplateDir: ".devflow/prompts",
EmbedFS: embeddedPrompts,
})
tmpl, err := loader.Load("generate-spec")
result := tmpl.Execute(map[string]string{
"ticket": "TK-421",
"title": "Add authentication",
})
Index ¶
- type Builder
- type Loader
- func (l *Loader) AddFunc(name string, fn any)
- func (l *Loader) AddSearchDir(dir string)
- func (l *Loader) ClearCache()
- func (l *Loader) Exists(name string) bool
- func (l *Loader) List() ([]string, error)
- func (l *Loader) Load(name string) (string, error)
- func (l *Loader) LoadWithVars(name string, vars map[string]any) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder helps construct prompts programmatically.
func (*Builder) AddSection ¶
AddSection adds a markdown section with header.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads and renders prompt templates.
func NewLoader ¶
NewLoader creates a prompt loader for the given project directory. It searches for prompts in the following order: 1. .devflow/prompts/ in project 2. prompts/ in project 3. Embedded prompts in devflow binary
func (*Loader) AddSearchDir ¶
AddSearchDir adds a directory to search for prompts.
Click to show internal directories.
Click to hide internal directories.