presetwizard

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package presetwizard is the interactive TUI for `maestro preset`.

The wizard runs in two phases around the database TUI: RunSelect prompts for the preset + service name; the caller then runs the dbwizard for that service; RunConfigure picks up with the preset-specific parameter prompts declared in the manifest and a review screen that echoes the DB choice the caller captured between the two phases. This shape lets the preset flow reuse the dbwizard verbatim, with no nesting of bubbletea programs.

Configure renders one multi-select page per [[parameter]] block in the loaded manifest. The wizard is data-driven — adding a new preset means editing its preset.toml, not the wizard code.

Index

Constants

This section is empty.

Variables

View Source
var ErrBack = errors.New("presetwizard: back to caller")

ErrBack is returned by RunConfigure when the user pressed esc at the phase's first step — there's no previous step inside this program (the dbwizard ran before this), so the orchestrator should re-open whichever TUI ran before, typically with prior answers pre-filled.

Functions

This section is empty.

Types

type ConfigureResult

type ConfigureResult struct {
	Selections preset.Selections
	Cancelled  bool
}

ConfigureResult is what phase 2 returns to the caller — the preset-specific parameter answers keyed by parameter key, ready to pass to preset.Walk / preset.Apply.

func RunConfigure

func RunConfigure(p PresetMeta, serviceName, dbSummary string, params []preset.Parameter, priorSelections preset.Selections) (ConfigureResult, error)

RunConfigure runs phase 2: capture each parameter declared in the manifest as a multi-select page, then show a review screen including the DB choice the caller captured between phases. Esc at the first step surfaces ErrBack so the orchestrator can re-run the previous TUI rather than dropping the user. priorSelections is the previous run's answers (typically the previous ConfigureResult's Selections) so back/forward navigation preserves toggled choices.

type PresetMeta

type PresetMeta struct {
	Name        string
	Title       string
	Description string
	Available   bool
}

PresetMeta is the picker's row data — what the wizard needs to render and select. The orchestrator builds this list from the embedded preset.FS() before launching RunSelect.

type SelectOptions

type SelectOptions struct {
	Presets       []PresetMeta
	InitialPreset PresetMeta
	InitialName   string
	ResumeAtName  bool
}

SelectOptions seeds the select phase. Presets is the discovered list the picker renders; InitialPreset + InitialName + ResumeAtName pre-fill the wizard when the orchestrator re-enters after a downstream back.

type SelectResult

type SelectResult struct {
	Preset      PresetMeta
	ServiceName string
	Cancelled   bool
}

SelectResult is what phase 1 returns to the caller — enough to feed the dbwizard and to seed phase 2.

func RunSelect

func RunSelect(opts SelectOptions) (SelectResult, error)

RunSelect runs phase 1: pick a preset and name the service. The result feeds the dbwizard call the caller is expected to make next. opts lets the caller re-enter the wizard after a downstream "back" with the prior answers pre-filled.

Jump to

Keyboard shortcuts

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