templates

package
v0.0.171 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidRuntimeTemplateName added in v0.0.39

func IsValidRuntimeTemplateName(ctx context.Context, dir string, runtime string, name string) bool

Types

type AppendFileStep

type AppendFileStep struct {
	Filename string
	Content  string
}

func (*AppendFileStep) Run

func (s *AppendFileStep) Run(ctx TemplateContext) error

type Bundle

type Bundle struct {
	Enabled bool     `yaml:"enabled"`
	Ignore  []string `yaml:"ignore"`
}

type CloneRepoAction added in v0.0.86

type CloneRepoAction struct {
	Repo   string
	Branch string
	Todir  string
}

func (*CloneRepoAction) Run added in v0.0.86

type CommandStep

type CommandStep struct {
	Command string   `yaml:"command"`
	Args    []string `yaml:"args"`
}

func (*CommandStep) Run

func (s *CommandStep) Run(ctx TemplateContext) error

type CopyDirAction

type CopyDirAction struct {
	From   string
	To     string
	Filter string
}

func (*CopyDirAction) Run

func (s *CopyDirAction) Run(ctx TemplateContext) error

type CopyFileAction

type CopyFileAction struct {
	From string
	To   string
}

func (*CopyFileAction) Run

func (s *CopyFileAction) Run(ctx TemplateContext) error

type CreateFileAction

type CreateFileAction struct {
	Filename string
	Content  string
	Template string
	From     string
}

func (*CreateFileAction) Run

type DeleteFileActionStep

type DeleteFileActionStep struct {
	Files []string `yaml:"files"`
}

func (*DeleteFileActionStep) Run

type Deployment

type Deployment struct {
	Resources Resources `yaml:"resources"`
	Command   string    `yaml:"command"`
	Args      []string  `yaml:"args"`
}

type Development added in v0.0.32

type Development struct {
	Port    int      `yaml:"port"`
	Watch   Watch    `yaml:"watch"`
	Command string   `yaml:"command"`
	Args    []string `yaml:"args"`
}

type ErrRequirementsNotMet added in v0.0.59

type ErrRequirementsNotMet struct {
	Message string
}

func (*ErrRequirementsNotMet) Error added in v0.0.59

func (e *ErrRequirementsNotMet) Error() string

type LanguageTemplates added in v0.0.39

type LanguageTemplates []ProjectTemplate

func LoadLanguageTemplates added in v0.0.39

func LoadLanguageTemplates(ctx context.Context, dir string, runtime string) (LanguageTemplates, error)

type ModifyPackageJsonStep

type ModifyPackageJsonStep struct {
	Script      []nameValue
	Main        string
	Type        string
	Name        string
	Version     string
	Description string
	Keywords    []string
}

func (*ModifyPackageJsonStep) Run

type ModifyTsConfigStep

type ModifyTsConfigStep struct {
	Types           []string
	CompilerOptions []nameValue
}

func (*ModifyTsConfigStep) Run

type NewAgentSteps

type NewAgentSteps struct {
	Steps []any `yaml:"steps"`
}

type NewProjectSteps

type NewProjectSteps struct {
	Steps []any `yaml:"steps"`
}

type ProjectTemplate added in v0.0.39

type ProjectTemplate struct {
	Name          string   `yaml:"name"`
	Description   string   `yaml:"description"`
	Dependencies  []string `yaml:"dependencies"`
	Steps         []any    `yaml:"steps"`
	SkipAgentStep bool     `yaml:"skip_agent_step"`
}

type Requirement

type Requirement struct {
	Command    string   `yaml:"command"`
	Args       []string `yaml:"args"`
	Version    string   `yaml:"version"`
	Brew       string   `yaml:"brew"`
	URL        string   `yaml:"url"`
	Selfupdate *struct {
		Command string   `yaml:"command"`
		Args    []string `yaml:"args"`
	} `yaml:"selfupdate"`
}

func (*Requirement) Matches

func (r *Requirement) Matches(ctx TemplateContext) bool

func (*Requirement) TryInstall

func (r *Requirement) TryInstall(ctx TemplateContext) error

type Resources

type Resources struct {
	Memory string `yaml:"memory"`
	CPU    string `yaml:"cpu"`
	Disk   string `yaml:"disk"`
}

type Step

type Step interface {
	Run(ctx TemplateContext) error
}

type Template

type Template struct {
	Name         string        `yaml:"name"`
	Description  string        `yaml:"description"`
	Identifier   string        `yaml:"identifier"`
	Language     string        `yaml:"language"`
	Requirements []Requirement `yaml:"requirements"`
}

func LoadTemplateForRuntime added in v0.0.113

func LoadTemplateForRuntime(ctx context.Context, dir string, runtime string) (*Template, error)

func (*Template) AddGitHubAction added in v0.0.74

func (t *Template) AddGitHubAction(ctx TemplateContext) error

func (*Template) Install

func (t *Template) Install(ctx TemplateContext) error

Install installs the requirements for the template

func (*Template) Matches

func (t *Template) Matches(ctx TemplateContext) bool

Matches returns true if the template matches the requirements

func (*Template) NewProject

func (t *Template) NewProject(ctx TemplateContext) (*TemplateRules, []project.AgentConfig, error)

type TemplateContext

type TemplateContext struct {
	Context          context.Context
	Logger           logger.Logger
	Name             string
	Description      string
	AgentName        string
	AgentDescription string
	TemplateDir      string
	ProjectDir       string
	Template         *Template
	TemplateName     string
	AgentuityCommand string
}

func (*TemplateContext) Interpolate

func (t *TemplateContext) Interpolate(val any) any

type TemplateRules

type TemplateRules struct {
	Identifier      string          `yaml:"identifier"`
	Runtime         string          `yaml:"runtime"`
	Language        string          `yaml:"language"`
	Framework       string          `yaml:"framework"`
	SrcDir          string          `yaml:"src_dir"`
	Filename        string          `yaml:"filename"`
	Bundle          Bundle          `yaml:"bundle"`
	Development     Development     `yaml:"development"`
	Deployment      Deployment      `yaml:"deployment"`
	NewProjectSteps NewProjectSteps `yaml:"new_project"`
	NewAgentSteps   NewAgentSteps   `yaml:"new_agent"`
}

func LoadTemplateRuleForIdentifier

func LoadTemplateRuleForIdentifier(templateDir, identifier string) (*TemplateRules, error)

func (*TemplateRules) NewAgent

func (t *TemplateRules) NewAgent(ctx TemplateContext) error

func (*TemplateRules) NewProject

func (t *TemplateRules) NewProject(ctx TemplateContext) error

type Templates

type Templates []Template

func LoadTemplates

func LoadTemplates(ctx context.Context, dir string, custom bool) (Templates, error)

LoadTemplates returns all the templates available

func LoadTemplatesFromGithub added in v0.0.75

func LoadTemplatesFromGithub(ctx context.Context, dir string) (Templates, error)

LoadTemplatesFromGithub loads the templates from github and returns the templates If the etag is provided, it will be used to check if the templates have changed If the templates have not changed, it will return the templates from the local directory If the templates have changed, it will download the new templates and return them

type Watch added in v0.0.32

type Watch struct {
	Enabled bool     `yaml:"enabled"`
	Files   []string `yaml:"files"`
}

Jump to

Keyboard shortcuts

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