wizard

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentGemini      = "gemini"
	AgentClaude      = "claude"
	AgentCodex       = "codex"
	AgentVSCode      = "vscode"
	AgentAntigravity = "antigravity"
)

AgentID constants matching config keys

View Source
const (
	ApprovalAll      = "all"
	ApprovalMCP      = "mcp"
	ApprovalCommands = "commands"
	ApprovalNone     = "none"
)

ApprovalMode constants

Variables

View Source
var ApprovalModeOptions = []ApprovalModeOption{
	{Value: ApprovalAll, Description: "Auto-approve shell commands and MCP tool calls (where supported)."},
	{Value: ApprovalMCP, Description: "Auto-approve MCP tool calls only; commands still prompt."},
	{Value: ApprovalCommands, Description: "Auto-approve shell commands only; MCP tools still prompt."},
	{Value: ApprovalNone, Description: "Prompt for everything."},
}

ApprovalModeOptions lists available approval modes and their descriptions.

View Source
var ApprovalModes = approvalModeValues()

ApprovalModes lists the canonical approval mode values.

View Source
var ClaudeModels = []string{
	"default",
	"sonnet",
	"sonnet[1m]",
	"haiku",
	"opus",
}

ClaudeModels lists supported Claude model values for the wizard.

View Source
var CodexModels = []string{
	"gpt-5.2-codex",
	"gpt-5.1-codex-mini",
	"gpt-5.1-codex-max",
	"gpt-5.1-codex",
	"gpt-5-codex",
	"gpt-5-codex-mini",
	"gpt-5.2",
	"gpt-5.1",
	"gpt-5",
}

CodexModels lists supported Codex model values for the wizard.

View Source
var CodexReasoningEfforts = []string{
	"minimal",
	"low",
	"medium",
	"high",
	"xhigh",
}

CodexReasoningEfforts lists supported reasoning effort values for Codex.

View Source
var GeminiModels = []string{

	"auto",
	"auto-gemini-2.5",
	"auto-gemini-3",

	"gemini-2.5-pro",
	"gemini-2.5-flash",
	"gemini-2.5-flash-lite",

	"gemini-3-pro-preview",
	"gemini-3-flash-preview",
}

GeminiModels lists supported Gemini model values for the wizard.

SupportedAgents is the list of agents the wizard can configure.

Functions

func IsTomlStateInMultiline

func IsTomlStateInMultiline(state tomlStringState) bool

IsTomlStateInMultiline returns true if the state indicates we're inside a multiline string.

func PatchConfig

func PatchConfig(content string, choices *Choices) (string, error)

PatchConfig applies wizard choices to TOML config content. content is the current config; choices holds selections; returns updated content or error.

func Run

func Run(root string, ui UI, runSync syncer, pinVersion string) error

Run starts the interactive wizard. pinVersion is written to .agent-layer/al.version when install is needed.

func ScanTomlLineForComment

func ScanTomlLineForComment(line string, state tomlStringState) (commentPos int, nextState tomlStringState)

ScanTomlLineForComment scans a TOML line and returns the position of any inline comment (or -1 if none) along with the next parser state for multiline string tracking. state is the current parser state from the previous line; line is the TOML line to scan.

Types

type ApprovalModeOption

type ApprovalModeOption struct {
	Value       string
	Description string
}

ApprovalModeOption describes a selectable approval mode. Value is the canonical config value; Description explains behavior.

type Choices

type Choices struct {
	// Approvals
	ApprovalMode        string
	ApprovalModeTouched bool

	// Agents
	EnabledAgents        map[string]bool
	EnabledAgentsTouched bool

	// Models
	GeminiModel        string
	GeminiModelTouched bool

	ClaudeModel        string
	ClaudeModelTouched bool

	CodexModel        string
	CodexModelTouched bool

	CodexReasoning        string
	CodexReasoningTouched bool

	// MCP
	EnabledMCPServers        map[string]bool
	EnabledMCPServersTouched bool
	DisabledMCPServers       map[string]bool
	MissingDefaultMCPServers []string
	RestoreMissingMCPServers bool
	DefaultMCPServers        []DefaultMCPServer

	// Secrets (Env vars)
	Secrets map[string]string

	// Warnings
	WarningsEnabled                bool
	WarningsEnabledTouched         bool
	InstructionTokenThreshold      int
	MCPServerThreshold             int
	MCPToolsTotalThreshold         int
	MCPServerToolsThreshold        int
	MCPSchemaTokensTotalThreshold  int
	MCPSchemaTokensServerThreshold int
}

Choices tracks user selections in the wizard.

func NewChoices

func NewChoices() *Choices

NewChoices returns a Choices struct initialized with defaults.

type DefaultMCPServer

type DefaultMCPServer struct {
	ID          string
	RequiredEnv []string
}

DefaultMCPServer describes a default MCP server and its required env vars.

type HuhUI

type HuhUI struct {
	// contains filtered or unexported fields
}

HuhUI implements UI using charmbracelet/huh.

func NewHuhUI

func NewHuhUI() *HuhUI

NewHuhUI creates a new HuhUI using the default terminal check.

func (*HuhUI) Confirm

func (ui *HuhUI) Confirm(title string, value *bool) error

Confirm renders a yes/no prompt.

func (*HuhUI) Input

func (ui *HuhUI) Input(title string, value *string) error

Input renders a plain text input prompt.

func (*HuhUI) MultiSelect

func (ui *HuhUI) MultiSelect(title string, options []string, selected *[]string) error

MultiSelect renders a multi-choice prompt.

func (*HuhUI) Note

func (ui *HuhUI) Note(title string, body string) error

Note renders an informational note screen.

func (*HuhUI) SecretInput

func (ui *HuhUI) SecretInput(title string, value *string) error

SecretInput renders a masked input prompt for secrets.

func (*HuhUI) Select

func (ui *HuhUI) Select(title string, options []string, current *string) error

Select renders a single-choice prompt.

type UI

type UI interface {
	Select(title string, options []string, current *string) error
	MultiSelect(title string, options []string, selected *[]string) error
	Confirm(title string, value *bool) error
	Input(title string, value *string) error
	SecretInput(title string, value *string) error
	Note(title string, body string) error
}

UI defines the interaction methods.

type WarningDefaults

type WarningDefaults struct {
	InstructionTokenThreshold      int
	MCPServerThreshold             int
	MCPToolsTotalThreshold         int
	MCPServerToolsThreshold        int
	MCPSchemaTokensTotalThreshold  int
	MCPSchemaTokensServerThreshold int
}

WarningDefaults holds wizard defaults sourced from the template config.

Jump to

Keyboard shortcuts

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