wizard

package
v0.0.0-...-35d8596 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

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

View Source
const (
	FormatJS   = "js"
	FormatJSON = "json"
)
View Source
const (

	// DefaultVersion is the placeholder assigned to generated AppConfigs.
	DefaultVersion = "-"
)

Variables

This section is empty.

Functions

func DefaultApp

func DefaultApp() process.AppConfig

DefaultApp returns one AppConfig populated with interactive defaults.

func DeriveName

func DeriveName(script string) string

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

type Ecosystem struct {
	Apps      []process.AppConfig
	Workflows []workflow.Config
}

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

func (e Ecosystem) TaskKeys() []string

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

func (e Ecosystem) WorkflowKeys() []string

WorkflowKeys returns the "<category>:<name>" identity of every workflow in the document, in declaration order.

type WizardContext

type WizardContext struct {
	In     io.Reader
	Out    io.Writer
	ErrOut io.Writer
	YesAll bool
}

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

type WriteOptions struct {
	Output  string
	Format  string
	Force   bool
	NoMerge bool
}

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.

Jump to

Keyboard shortcuts

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