generator

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package generator provides output file generation for ai_rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeContentHashPooled

func ComputeContentHashPooled(content string) string

ComputeContentHashPooled computes SHA256 hash using a pooled hasher.

Types

type Generator

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

Generator handles the generation of output files from configuration.

func New

func New() *Generator

New creates a new generator with the default template renderer.

func NewWithBaseDir

func NewWithBaseDir(baseDir string) *Generator

NewWithBaseDir creates a new generator with a specific base directory.

func NewWithConfigFile added in v1.1.3

func NewWithConfigFile(configFile string) *Generator

NewWithConfigFile creates a new generator with a specific config file.

func NewWithRenderer

func NewWithRenderer(renderer *templates.Renderer) *Generator

NewWithRenderer creates a generator with a custom renderer.

func (*Generator) GenerateAll

func (g *Generator) GenerateAll(cfg *config.Config) error

GenerateAll generates all output files defined in the configuration.

func (*Generator) GenerateAllConcurrent

func (g *Generator) GenerateAllConcurrent(cfg *config.Config) error

GenerateAllConcurrent generates all output files concurrently.

func (*Generator) GenerateOutput

func (g *Generator) GenerateOutput(cfg *config.Config, outputFile string) error

GenerateOutput generates a single output file.

func (*Generator) GetSupportedTemplates

func (g *Generator) GetSupportedTemplates() []string

GetSupportedTemplates returns all available template names.

func (*Generator) PreviewAll

func (g *Generator) PreviewAll(cfg *config.Config) (map[string]string, error)

PreviewAll generates all output content without writing files. Returns a map of file paths to their generated content.

func (*Generator) PreviewOutput

func (g *Generator) PreviewOutput(cfg *config.Config, outputFile string) (string, error)

PreviewOutput generates output content without writing to file.

func (*Generator) RegisterTemplate

func (g *Generator) RegisterTemplate(name, templateStr string) error

RegisterTemplate adds a custom template to the generator's renderer.

func (*Generator) ValidateTemplate

func (*Generator) ValidateTemplate(templateStr string) error

ValidateTemplate checks if a template string is valid.

Jump to

Keyboard shortcuts

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