Documentation
¶
Index ¶
- func FileOutputPath(file tmpl.File, spec config.FileSpec) string
- func FileSpecByPath(scaffoldConfig *config.ScaffoldConfig) map[string]config.FileSpec
- func ResolveDelimiters(delimiters []string, scaffoldConfig *config.ScaffoldConfig) []string
- type InitUI
- func (ui *InitUI) ConfirmUpdateInstead(targetPath string) (bool, error)
- func (ui *InitUI) DisplayScaffoldTemplateTable(templatesMap map[string]interface{})
- func (ui *InitUI) DisplayTemplateTable(header []string, rows [][]string)
- func (ui *InitUI) Execute(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithBaseRef(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithDelimiters(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithInteractiveFlow(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRef(embedsConfig *tmpl.Configuration, targetPath string, ...) error
- func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRefResult(embedsConfig *tmpl.Configuration, targetPath string, ...) (string, error)
- func (ui *InitUI) ExecuteWithInteractiveFlowResult(embedsConfig *tmpl.Configuration, targetPath string, ...) (string, error)
- func (ui *InitUI) GetTerminalWidth() int
- func (ui *InitUI) PromptForTargetDirectory(templateInfo interface{}, mergedValues map[string]interface{}) (string, error)
- func (ui *InitUI) PromptForTemplate(templateType string, templates interface{}) (string, error)
- func (ui *InitUI) ResolveTargetPath(embedsConfig *tmpl.Configuration, targetPath string, update, useDefaults bool, ...) (string, map[string]interface{}, bool, error)
- func (ui *InitUI) RunSetupForm(scaffoldConfig *config.ScaffoldConfig, targetPath string, useDefaults bool, ...) (map[string]interface{}, map[string]string, error)
- func (ui *InitUI) SetConflictStrategy(strategy merge.ConflictStrategy)
- func (ui *InitUI) SetDryRun(dryRun bool)
- func (ui *InitUI) SetMergeDriver(driver merge.Driver)
- func (ui *InitUI) SetSkipHooks(skip func(string) bool)
- func (ui *InitUI) SetThreshold(thresholdPercent int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileOutputPath ¶ added in v1.227.0
FileOutputPath resolves the output path template for one discovered file: spec.Target when set, otherwise the file's own discovered Path. See docs/prd/atmos-scaffold.md, "Dynamic File Generation (matrix)". Exported (alongside FileSpecByPath/ResolveDelimiters) so callers that need to plan output paths without running generation -- e.g. cmd/scaffold's dry-run preview -- resolve Target the same way real generation does instead of duplicating this one-line rule.
func FileSpecByPath ¶ added in v1.227.0
func FileSpecByPath(scaffoldConfig *config.ScaffoldConfig) map[string]config.FileSpec
FileSpecByPath indexes a scaffold config's spec.files overlay by declared path, for O(1) lookup during the file-generation loop. Files not listed in the overlay generate unconditionally with no Target/Matrix override -- FileSpec's zero-value When already evaluates to true (see condition.Condition.Evaluate). Exported so the `--dry-run` preview (cmd/scaffold) can gate its file list with the exact same spec.When evaluation real generation uses, instead of a second, divergent copy.
func ResolveDelimiters ¶ added in v1.227.0
func ResolveDelimiters(delimiters []string, scaffoldConfig *config.ScaffoldConfig) []string
ResolveDelimiters determines the delimiters to use. A scaffold config's own declared delimiters always win: callers (Execute/ExecuteWithBaseRef) pass a generic "{{"/"}}" default through regardless of what the scaffold actually declares, so treating that default as an explicit override would silently ignore scaffold.yaml's spec.delimiters (e.g. "[[" / "]]") -- this is exactly what engine.extractDelimiters already does for per-file rendering via ProcessFile, which ResolveDelimiters must match so the README summary renders with the same delimiters as every other generated file.
Types ¶
type InitUI ¶
type InitUI struct {
// contains filtered or unexported fields
}
InitUI handles the user interface for the init command.
func (*InitUI) ConfirmUpdateInstead ¶
ConfirmUpdateInstead prompts whether to update an existing, non-empty target directory via a 3-way merge instead of failing outright. Callers should only invoke this after confirming a real TTY is available for prompting.
func (*InitUI) DisplayScaffoldTemplateTable ¶
DisplayScaffoldTemplateTable displays scaffold templates in a table format.
func (*InitUI) DisplayTemplateTable ¶
DisplayTemplateTable displays template data in a formatted table.
func (*InitUI) Execute ¶
func (ui *InitUI) Execute(embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, cmdTemplateValues map[string]interface{}) error
Execute runs the initialization process with UI.
func (*InitUI) ExecuteWithBaseRef ¶
func (ui *InitUI) ExecuteWithBaseRef(embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}) error
ExecuteWithBaseRef runs the initialization process with UI and specified base ref.
func (*InitUI) ExecuteWithDelimiters ¶
func (ui *InitUI) ExecuteWithDelimiters(embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}, delimiters []string) error
ExecuteWithDelimiters runs the initialization process with UI and custom delimiters.
func (*InitUI) ExecuteWithInteractiveFlow ¶
func (ui *InitUI) ExecuteWithInteractiveFlow( embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, cmdTemplateValues map[string]interface{}, ) error
ExecuteWithInteractiveFlow provides a unified flow for both init and scaffold commands. This ensures both commands have identical behavior - the only difference is the source of templates.
func (*InitUI) ExecuteWithInteractiveFlowAndBaseRef ¶
func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRef( embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}, ) error
ExecuteWithInteractiveFlowAndBaseRef provides a unified flow with base ref support.
func (*InitUI) ExecuteWithInteractiveFlowAndBaseRefResult ¶
func (ui *InitUI) ExecuteWithInteractiveFlowAndBaseRefResult( embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, baseRef string, cmdTemplateValues map[string]interface{}, ) (string, error)
ExecuteWithInteractiveFlowAndBaseRefResult provides the interactive flow with base ref support and returns the final target path.
func (*InitUI) ExecuteWithInteractiveFlowResult ¶
func (ui *InitUI) ExecuteWithInteractiveFlowResult( embedsConfig *tmpl.Configuration, targetPath string, force, update, useDefaults bool, cmdTemplateValues map[string]interface{}, ) (string, error)
ExecuteWithInteractiveFlowResult provides the same flow as ExecuteWithInteractiveFlow and returns the final target path selected by the user.
func (*InitUI) GetTerminalWidth ¶
GetTerminalWidth returns the current terminal width with a fallback.
func (*InitUI) PromptForTargetDirectory ¶
func (ui *InitUI) PromptForTargetDirectory(templateInfo interface{}, mergedValues map[string]interface{}) (string, error)
PromptForTargetDirectory prompts the user for the target directory with evaluated template values This works for both init and scaffold commands.
func (*InitUI) PromptForTemplate ¶
PromptForTemplate prompts the user to select a template from available options. This works for both init (embeds) and scaffold (local/remote) templates.
func (*InitUI) ResolveTargetPath ¶ added in v1.227.0
func (ui *InitUI) ResolveTargetPath( embedsConfig *tmpl.Configuration, targetPath string, update, useDefaults bool, cmdTemplateValues map[string]interface{}, ) (string, map[string]interface{}, bool, error)
ResolveTargetPath determines the target path to generate into, prompting interactively (and reconciling any values pre-collected during that prompt) when the caller did not already provide one. It is exported so callers that need the final target directory *before* calling one of the ExecuteWithInteractiveFlow* variants (for example to resolve a --update base ref against the real target rather than the empty path available before the interactive prompt runs) can resolve it themselves first -- passing the result back in as targetPath short-circuits the prompt on the subsequent Execute* call, since resolveTargetPath is a no-op once targetPath is non-empty.
func (*InitUI) RunSetupForm ¶
func (ui *InitUI) RunSetupForm(scaffoldConfig *config.ScaffoldConfig, targetPath string, useDefaults bool, cmdTemplateValues map[string]interface{}) (map[string]interface{}, map[string]string, error)
RunSetupForm runs the interactive setup form to collect configuration values This method can be used by both init and scaffold commands.
func (*InitUI) SetConflictStrategy ¶
func (ui *InitUI) SetConflictStrategy(strategy merge.ConflictStrategy)
SetConflictStrategy sets how a real ours/theirs divergence is resolved during a 3-way merge (manual/ours/theirs). The zero value (merge.ConflictStrategyManual) is today's existing behavior.
func (*InitUI) SetDryRun ¶
SetDryRun toggles dry-run mode: rendering and 3-way merge still run (so real conflicts are reported), but no files are written to disk.
func (*InitUI) SetMergeDriver ¶ added in v1.226.0
SetMergeDriver sets which merger handles every file during a 3-way merge.
func (*InitUI) SetSkipHooks ¶
SetSkipHooks configures the --skip-hooks predicate (see hooks.NewSkipPredicate) consulted before running any scaffold hook. A nil predicate (the zero value) runs every hook, matching today's behavior for templates that don't set one.
func (*InitUI) SetThreshold ¶
SetThreshold sets the threshold for merge operations.