templates

package
v0.23.9 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectLanguageFromADL added in v0.7.0

func DetectLanguageFromADL(adl *schema.ADL) string

DetectLanguageFromADL detects the programming language from ADL

func GetGeneratedFileHeader added in v0.7.0

func GetGeneratedFileHeader(fileType string, cliVersion string, generatedAt time.Time) string

GetGeneratedFileHeader returns the appropriate header for generated files

Types

type Context

type Context struct {
	ADL             *schema.ADL
	Metadata        schema.GeneratedMetadata
	Language        string
	GenerateCI      bool
	GenerateCD      bool
	EnableAI        bool
	GenerateCommand string
	// contains filtered or unexported fields
}

Context provides data for template execution

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine handles template execution

func New

func New(templateName string) *Engine

New creates a new template engine

func NewWithRegistry added in v0.7.0

func NewWithRegistry(templateName string, registry *Registry) *Engine

NewWithRegistry creates a new template engine with a registry

func (*Engine) Execute

func (e *Engine) Execute(templateContent string, ctx Context) (string, error)

Execute executes a template with the given context

func (*Engine) ExecuteTemplate added in v0.7.0

func (e *Engine) ExecuteTemplate(templateKey string, ctx Context) (string, error)

ExecuteTemplate executes a template from the registry with the given context

func (*Engine) ExecuteToolTemplate added in v0.7.3

func (e *Engine) ExecuteToolTemplate(templateKey string, skillData any) (string, error)

ExecuteToolTemplate executes a skill template with skill-specific data

func (*Engine) ExecuteToolTemplateWithContext added in v0.19.0

func (e *Engine) ExecuteToolTemplateWithContext(templateKey string, skillData any, ctx Context) (string, error)

ExecuteToolTemplateWithContext executes a skill template with ADL context for custom acronyms

func (*Engine) ExecuteWithHeader

func (e *Engine) ExecuteWithHeader(templateContent string, ctx Context, fileName string) (string, error)

ExecuteWithHeader executes a template with the given context and adds a header if needed

func (*Engine) GetFiles

func (e *Engine) GetFiles(adl *schema.ADL) map[string]string

GetFiles returns the template files for the current template with ADL context

func (*Engine) GetTemplate

func (e *Engine) GetTemplate() string

GetTemplate returns the template name

type Registry added in v0.7.0

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages template loading and lookup

func NewRegistry added in v0.7.0

func NewRegistry(language string) (*Registry, error)

NewRegistry creates a new template registry for the specified language

func NewRegistryWithOptions added in v0.16.0

func NewRegistryWithOptions(opts RegistryOptions) (*Registry, error)

NewRegistryWithOptions creates a new template registry with options

func (*Registry) GetFiles added in v0.7.0

func (r *Registry) GetFiles(adl *schema.ADL) map[string]string

GetFiles returns all files that should be generated for the current language

func (*Registry) GetTemplate added in v0.7.0

func (r *Registry) GetTemplate(key string) (string, error)

GetTemplate retrieves a template by key

func (*Registry) ListTemplates added in v0.7.0

func (r *Registry) ListTemplates() []string

ListTemplates returns a list of all loaded template keys

type RegistryOptions added in v0.16.0

type RegistryOptions struct {
	Language string
	EnableAI bool
}

RegistryOptions holds options for creating a new registry

Jump to

Keyboard shortcuts

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