app

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute runs the Bubble Tea menu and dispatches to the matching command.

func InitCommand

func InitCommand(configPath, sourceRoot string)

InitCommand scans the source root, suggests ignore patterns, and writes a starter config.

func MatchIgnore

func MatchIgnore(path string, isDir bool, ignoreFolders, ignoreFiles []string, scaffoldIgnorePatterns []string) bool

MatchIgnore checks if a file/folder should be ignored based on config ignore patterns and .scaffoldignore.

func MatchInclude

func MatchInclude(path string, includePatterns []string) bool

MatchInclude returns true when a path matches an explicit include glob.

func RunCommand

func RunCommand(configPath, sourceRoot, outPath string, copyConfig bool)

RunCommand scaffolds a project directly from source to output without an intermediate build step.

func RunUI

func RunUI() (string, string, error)

RunUI runs the Bubble Tea UI and returns the selected command and argument (if any)

Types

type CandidateVariable

type CandidateVariable struct {
	Name        string
	Occurrences int
	Example     string
}

CandidateVariable represents a discovered variable in the source project for mapping to template variables.

type Config

type Config struct {
	SourceRoot    string              `json:"sourceRoot"`
	TemplateRoot  string              `json:"templateRoot"`
	Token         map[string]string   `json:"token"`
	IgnoreFolders []string            `json:"ignoreFolders"`
	IgnoreFiles   []string            `json:"ignoreFiles"`
	StaticFiles   []string            `json:"staticFiles"`
	Variables     map[string]Variable `json:"variables"`
	Replacements  []Replacement       `json:"replacements"`
	RenameRules   []RenameRule        `json:"renameRules"`
	Hooks         map[string][]Hook   `json:"hooks"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) ApplyVariableReplacements

func (cfg *Config) ApplyVariableReplacements(input string, overrides map[string]string) string

ApplyVariableReplacements replaces all variable tokens in a string

func (*Config) GetVariableValue

func (cfg *Config) GetVariableValue(name string, overrides map[string]string) (string, bool)

GetVariableValue returns the value for a variable, using override or default if not set

func (*Config) Save

func (cfg *Config) Save(path string) error

type Hook

type Hook struct {
	Command string `json:"command"`
	Cwd     string `json:"cwd"`
}

type RenameRule

type RenameRule struct {
	From string `json:"from"`
	To   string `json:"to"`
}

type Replacement

type Replacement struct {
	Find        string `json:"find"`
	ReplaceWith string `json:"replaceWith"`
}

type Variable

type Variable struct {
	Type        string `json:"type"`
	Required    bool   `json:"required"`
	Default     string `json:"default,omitempty"`
	Description string `json:"description"`
	From        string `json:"from,omitempty"`
	Transform   string `json:"transform,omitempty"`
}

Jump to

Keyboard shortcuts

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