Documentation
¶
Overview ¶
Package wizard owns ecosystem configuration authoring: prompts, the generated app and workflow declarations, merge policy, and JS/JSON rendering.
Its unit of work is Ecosystem — one file's `apps:` and `workflows:` blocks together — because a task stage references an app, so neither block can be collected, merged, or validated on its own.
Cobra and terminal detection stay in package cmd (cmd/wizard.go). This package accepts all input and output through WizardContext.
Index ¶
- Constants
- func DefaultApp() process.AppConfig
- func DeriveName(script string) string
- func Namespaces() []string
- func RunInstall(ctx WizardContext, app process.AppConfig, opts WriteOptions) error
- func RunInteractive(ctx WizardContext, opts WriteOptions) error
- func WriteEcosystemFile(ctx WizardContext, doc Ecosystem, opts WriteOptions) error
- type Ecosystem
- type WizardContext
- type WriteOptions
Constants ¶
const ( FormatJS = "js" FormatJSON = "json" )
const (
// DefaultVersion is the placeholder assigned to generated AppConfigs.
DefaultVersion = "-"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultApp ¶
DefaultApp returns one AppConfig populated with interactive defaults.
func DeriveName ¶
DeriveName produces a process name from a script path.
func Namespaces ¶
func Namespaces() []string
Namespaces returns the wizard's supported namespace choices in prompt order.
func RunInstall ¶
func RunInstall(ctx WizardContext, app process.AppConfig, opts WriteOptions) error
RunInstall writes one pre-built app without interactive confirmation.
func RunInteractive ¶
func RunInteractive(ctx WizardContext, opts WriteOptions) error
RunInteractive collects apps and workflows, or accepts defaults, then writes the ecosystem file using the selected merge and format behavior.
The --yes path deliberately synthesizes no workflow: a default app is a runnable placeholder, but a workflow with an invented stage would be a command nobody asked to run.
func WriteEcosystemFile ¶
func WriteEcosystemFile(ctx WizardContext, doc Ecosystem, opts WriteOptions) error
WriteEcosystemFile merges or replaces an ecosystem file, previews the result, confirms interactive writes, and persists the selected format.
Types ¶
type Ecosystem ¶
Ecosystem is the whole document the wizard authors: the `apps:` block and the `workflows:` block of one ecosystem file.
It exists so the wizard's collect -> merge -> render -> write pipeline carries one value instead of a widening parameter list. Every stage of that pipeline sees both blocks, because they are not independent: a `task:` stage names an app, so validating or merging one half without the other would let the wizard write a file it knows is broken.
func (Ecosystem) TaskKeys ¶
TaskKeys returns the "<namespace>:<name>" identity of every app in the document, in declaration order. That is the exact form a `task:` stage resolves against in the daemon registry, which is why the stage picker offers these strings rather than bare names.
func (Ecosystem) WorkflowKeys ¶
WorkflowKeys returns the "<category>:<name>" identity of every workflow in the document, in declaration order.
type WizardContext ¶
WizardContext carries the I/O streams the wizard reads from and writes to. Every exported entry point in this package takes one as the first argument so the caller controls where prompts and previews go — the package never touches os.Stdin / os.Stdout directly.
YesAll is exposed here rather than inside Options because it is a property of the input medium (e.g. piped non-interactive shell), not of any single command's flags.
type WriteOptions ¶
WriteOptions is the shared output contract for interactive, install, and direct ecosystem writes.
func DefaultWriteOptions ¶
func DefaultWriteOptions() WriteOptions
DefaultWriteOptions returns the default JS write behavior.