Documentation
¶
Index ¶
- type Docs
- type Examples
- type FileSpec
- type GenerationResult
- type Generator
- type Hook
- type HookSet
- type Loader
- func (l *Loader) ListBuiltIn() ([]TemplateInfo, error)
- func (l *Loader) Load(name string) (*Template, error)
- func (l *Loader) LoadBuiltIn(name string) (*Template, error)
- func (l *Loader) LoadFromFile(path string) (*Template, error)
- func (l *Loader) ReadTemplateFile(templateName, filePath string) ([]byte, error)
- type Requirements
- type Template
- type TemplateConfig
- type TemplateInfo
- type TemplateMetadata
- type TemplateSource
- type TemplateSpec
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docs ¶
type Docs struct {
GettingStarted string `yaml:"getting_started,omitempty" json:"getting_started,omitempty"`
APIReference string `yaml:"api_reference,omitempty" json:"api_reference,omitempty"`
Examples string `yaml:"examples,omitempty" json:"examples,omitempty"`
}
Docs contains documentation links
type Examples ¶
type Examples struct {
Scenarios []string `yaml:"scenarios,omitempty" json:"scenarios,omitempty"`
Providers []string `yaml:"providers,omitempty" json:"providers,omitempty"`
UseCases []string `yaml:"use_cases,omitempty" json:"use_cases,omitempty"`
}
Examples contains example data for quick testing
type FileSpec ¶
type FileSpec struct {
Path string `yaml:"path" json:"path"`
Template string `yaml:"template,omitempty" json:"template,omitempty"`
Content string `yaml:"content,omitempty" json:"content,omitempty"`
Condition string `yaml:"condition,omitempty" json:"condition,omitempty"`
ForEach string `yaml:"foreach,omitempty" json:"foreach,omitempty"`
Variables map[string]string `yaml:"variables,omitempty" json:"variables,omitempty"`
Executable bool `yaml:"executable,omitempty" json:"executable,omitempty"`
}
FileSpec defines a file to be generated from the template
type GenerationResult ¶
type GenerationResult struct {
Success bool
ProjectPath string
FilesCreated []string
Errors []error
Warnings []string
Duration time.Duration
}
GenerationResult contains the result of template generation
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator handles template generation and file creation
func NewGenerator ¶
NewGenerator creates a new template generator
func (*Generator) Generate ¶
func (g *Generator) Generate(config *TemplateConfig) (*GenerationResult, error)
Generate generates a project from the template
type Hook ¶
type Hook struct {
Message string `yaml:"message,omitempty" json:"message,omitempty"`
Command string `yaml:"command" json:"command"`
Condition string `yaml:"condition,omitempty" json:"condition,omitempty"`
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
}
Hook defines a command to run during generation
type HookSet ¶
type HookSet struct {
PreCreate []Hook `yaml:"pre_create,omitempty" json:"pre_create,omitempty"`
PostCreate []Hook `yaml:"post_create,omitempty" json:"post_create,omitempty"`
}
HookSet defines pre and post generation hooks
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles loading templates from various sources
func (*Loader) ListBuiltIn ¶
func (l *Loader) ListBuiltIn() ([]TemplateInfo, error)
ListBuiltIn returns a list of all built-in templates
func (*Loader) LoadBuiltIn ¶
LoadBuiltIn loads a built-in template
func (*Loader) LoadFromFile ¶
LoadFromFile loads a template from a file path
type Requirements ¶
type Requirements struct {
CLIVersion string `yaml:"cli_version,omitempty" json:"cli_version,omitempty"`
Tools []string `yaml:"tools,omitempty" json:"tools,omitempty"`
}
Requirements defines template requirements
type Template ¶
type Template struct {
APIVersion string `yaml:"apiVersion" json:"apiVersion"`
Kind string `yaml:"kind" json:"kind"`
Metadata TemplateMetadata `yaml:"metadata" json:"metadata"`
Spec TemplateSpec `yaml:"spec" json:"spec"`
}
Template represents a project template configuration
type TemplateConfig ¶
type TemplateConfig struct {
ProjectName string
OutputDir string
Variables map[string]interface{}
Template *Template
}
TemplateConfig holds the configuration for template generation
type TemplateInfo ¶
type TemplateInfo struct {
Name string
Version string
Description string
Author string
Tags []string
Source TemplateSource
Verified bool
Downloads int
Path string
}
TemplateInfo contains metadata about a template
type TemplateMetadata ¶
type TemplateMetadata struct {
Name string `yaml:"name" json:"name"`
Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"`
}
TemplateMetadata contains template identification and metadata
type TemplateSource ¶
type TemplateSource int
TemplateSource represents where a template comes from
const ( SourceBuiltIn TemplateSource = iota SourceRemote SourceLocal )
type TemplateSpec ¶
type TemplateSpec struct {
Variables []Variable `yaml:"variables,omitempty" json:"variables,omitempty"`
Files []FileSpec `yaml:"files" json:"files"`
Hooks *HookSet `yaml:"hooks,omitempty" json:"hooks,omitempty"`
Examples *Examples `yaml:"examples,omitempty" json:"examples,omitempty"`
Docs *Docs `yaml:"docs,omitempty" json:"docs,omitempty"`
Requires *Requirements `yaml:"requires,omitempty" json:"requires,omitempty"`
}
TemplateSpec defines the template specification
type Variable ¶
type Variable struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"` // string, number, boolean, array, select
Default interface{} `yaml:"default,omitempty" json:"default,omitempty"`
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
Validation string `yaml:"validation,omitempty" json:"validation,omitempty"` // regex pattern
Options []string `yaml:"options,omitempty" json:"options,omitempty"` // for select/array types
Prompt string `yaml:"prompt,omitempty" json:"prompt,omitempty"` // interactive prompt text
}
Variable defines a template variable that can be customized