scaffold

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package scaffold provides project scaffolding and template generation functionality.

Package scaffold provides project scaffolding and template generation functionality.

Package scaffold provides project scaffolding and template generation functionality.

Index

Constants

View Source
const (
	DefaultOpenAIModel = "gpt-4o"

	ProviderAnthropic = "anthropic"
	ProviderOllama    = "ollama"
	ProviderOpenAI    = "openai"
	ProviderAzure     = "azure"
)

Variables

This section is empty.

Functions

func RenderTemplate

func RenderTemplate(templatePath string, data TemplateData) (string, error)

RenderTemplate renders a template file with the provided data

Types

type ExternalGenerator added in v0.2.0

type ExternalGenerator struct {
	Cached *registry.CachedTemplate
}

ExternalGenerator generates a project from a cached external template

func NewExternalGenerator added in v0.2.0

func NewExternalGenerator(cached *registry.CachedTemplate) *ExternalGenerator

func (*ExternalGenerator) Generate added in v0.2.0

func (g *ExternalGenerator) Generate(ctx context.Context, opts GenerateOptions) error

func (*ExternalGenerator) GetMetadata added in v0.2.0

func (g *ExternalGenerator) GetMetadata() TemplateMetadata

type GenerateOptions

type GenerateOptions struct {
	ProjectName string
	ProjectPath string
	Template    string
	Interactive bool
	Force       bool
	Description string
	LLMProvider string
	AgentType   string
}

GenerateOptions contains options for project generation

type QuickstartGenerator

type QuickstartGenerator struct{}

QuickstartGenerator implements TemplateGenerator for quickstart template

func NewQuickstartGenerator

func NewQuickstartGenerator() *QuickstartGenerator

func (*QuickstartGenerator) Generate

func (g *QuickstartGenerator) Generate(ctx context.Context, opts GenerateOptions) error

func (*QuickstartGenerator) GetMetadata

func (g *QuickstartGenerator) GetMetadata() TemplateMetadata

type Service

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

Service handles project scaffolding and generation

func NewService

func NewService(logger *zerolog.Logger) *Service

NewService creates a new scaffold service

func (*Service) GenerateProject

func (s *Service) GenerateProject(ctx context.Context, opts GenerateOptions) error

GenerateProject generates a new project with the given options

type TemplateData

type TemplateData struct {
	ProjectName  string
	WorkflowName string
	LLMModel     string
	LLMProvider  string
	Description  string
	AgentType    string
	APIKeyEnv    string
}

TemplateData holds data for template rendering

type TemplateGenerator

type TemplateGenerator interface {
	// Generate creates the project structure and files for the template
	Generate(ctx context.Context, opts GenerateOptions) error

	// GetMetadata returns metadata about the template
	GetMetadata() TemplateMetadata
}

TemplateGenerator defines the interface for template generators

func GetTemplateGenerator

func GetTemplateGenerator(templateType TemplateType) (TemplateGenerator, error)

GetTemplateGenerator returns the appropriate template generator for the given template type

type TemplateMetadata

type TemplateMetadata struct {
	Name        string
	Description string
	Complexity  string
	FileCount   int
	Features    []string
}

TemplateMetadata contains information about a template

func GetAllTemplates

func GetAllTemplates() []TemplateMetadata

GetAllTemplates returns all available templates

type TemplateRegistry

type TemplateRegistry struct{}

TemplateRegistry provides information about all available templates

func NewTemplateRegistry

func NewTemplateRegistry() *TemplateRegistry

NewTemplateRegistry creates a new template registry

func (*TemplateRegistry) GetTemplate

func (r *TemplateRegistry) GetTemplate(templateType TemplateType) (TemplateMetadata, error)

GetTemplate returns metadata for a specific template

func (*TemplateRegistry) ListTemplates

func (r *TemplateRegistry) ListTemplates() []TemplateMetadata

ListTemplates returns all available templates

type TemplateType

type TemplateType string

TemplateType represents the type of template to generate

const (
	TemplateQuickstart TemplateType = "quickstart"
	TemplateWorkflow   TemplateType = "workflow"
)

Template type constants

func ValidateTemplate

func ValidateTemplate(templateStr string) (TemplateType, error)

ValidateTemplate validates and returns a TemplateType from a string

type WorkflowGenerator

type WorkflowGenerator struct{}

WorkflowGenerator generates a streaming workflow template

func NewWorkflowGenerator

func NewWorkflowGenerator() *WorkflowGenerator

func (*WorkflowGenerator) Generate

func (g *WorkflowGenerator) Generate(ctx context.Context, opts GenerateOptions) error

func (*WorkflowGenerator) GetMetadata

func (g *WorkflowGenerator) GetMetadata() TemplateMetadata

Jump to

Keyboard shortcuts

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