Documentation
¶
Index ¶
- Constants
- func CheckConfig(cfg *Config) error
- func CreateConfigFile(opts CreateConfigOptions) error
- func GlobalConfigPath() (string, error)
- func SaveGlobalConfig(cfg *GlobalConfig) error
- type Config
- type CreateConfigOptions
- type Env
- type GlobalConfig
- type Hooks
- type TemplateOrigin
- type ValidationError
Constants ¶
const File = ".tagconfig.json"
Variables ¶
This section is empty.
Functions ¶
func CheckConfig ¶
CheckConfig validates that a config exists and returns an error if not.
func CreateConfigFile ¶
func CreateConfigFile(opts CreateConfigOptions) error
CreateConfigFile writes a new .tagconfig.json with the given options.
func GlobalConfigPath ¶
GlobalConfigPath returns the full path to the global config file.
func SaveGlobalConfig ¶
func SaveGlobalConfig(cfg *GlobalConfig) error
SaveGlobalConfig writes the user-level config to $XDG_CONFIG_HOME/tag/config.json. It creates parent directories as needed.
Types ¶
type Config ¶
type Config struct {
Template *TemplateOrigin `json:"template,omitempty"`
Variables map[string]any `json:"variables,omitempty"`
Env Env `json:"env"`
Hooks Hooks `json:"hooks"`
}
func LoadConfigFile ¶
LoadConfigFile loads the configuration from the config file in the given directory. Returns nil config if the file doesn't exist, or an error if parsing fails.
func (*Config) HasTemplateOrigin ¶
HasTemplateOrigin reports whether the config references a template from the library.
type CreateConfigOptions ¶
CreateConfigOptions holds the parameters for creating a config file, decoupled from the CLI framework.
type GlobalConfig ¶
type GlobalConfig struct {
Editor string `json:"editor,omitempty"`
}
GlobalConfig holds user-level TAG settings persisted across projects.
func LoadGlobalConfig ¶
func LoadGlobalConfig() (*GlobalConfig, error)
LoadGlobalConfig loads the user-level config from $XDG_CONFIG_HOME/tag/config.json. Returns a zero-value GlobalConfig if the file does not exist.
type TemplateOrigin ¶
type TemplateOrigin struct {
Source string `json:"source"` // Original ref (e.g., "gh:acme/nextjs-starter")
Name string `json:"name"` // Library name (e.g., "nextjs-starter")
Version string `json:"version,omitempty"` // From tag.template.json at scaffold time
}
TemplateOrigin records which template was used to scaffold a project.
type ValidationError ¶
ValidationError represents a configuration validation failure.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string