Documentation
¶
Index ¶
- type Context
- type Engine
- func (e *Engine) Agent() string
- func (e *Engine) Execute(absFilePath string, content string, data any) (string, error)
- func (e *Engine) ExecuteFile(absFilePath string, data any) (string, error)
- func (e *Engine) FileFunc() any
- func (e *Engine) IncludeFunc(processTemplate bool) any
- func (e *Engine) MCPFunc() any
- func (e *Engine) ReferenceFunc(processTemplate bool) any
- func (e *Engine) RegisterHelperFunctions(t *template.Template) *template.Template
- type FileResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Agent string
}
Context holds the context information for template processing, including information about which agent is being used for output.
type Engine ¶
type Engine struct { // FileResolver resolves file paths FileResolver FileResolver // References stores reference content to be appended at the end References map[string]string // OriginalPaths maps absolute paths to their original relative paths OriginalPaths map[string]string // AgentType determines the output format AgentType string // AgentRegistry provides access to registered agents AgentRegistry *agent.Registry // contains filtered or unexported fields }
Engine represents the template engine wrapper
func NewEngine ¶
func NewEngine(fileResolver FileResolver, agentType, absTemplateBaseDir string, agentRegistry *agent.Registry) *Engine
NewEngine creates a new template engine
func (*Engine) Execute ¶
Execute processes a template with the given data while managing CurrentFilePath
func (*Engine) ExecuteFile ¶
ExecuteFile processes a template file with the given data
func (*Engine) IncludeFunc ¶
IncludeFunc generates an include helper function with optional template processing that accepts multiple paths and combines their content with double newlines as separators
func (*Engine) ReferenceFunc ¶
ReferenceFunc generates a reference helper function with optional template processing that accepts multiple paths and combines their reference markers with commas as separators
type FileResolver ¶
type FileResolver interface { // Read reads a file at the given path Read(path string) ([]byte, error) // Exists checks if a file exists Exists(path string) bool // ResolvePath resolves a relative path to absolute ResolvePath(path string) string Glob(patterns []string) ([]string, error) }
FileResolver resolves and reads files