wizard

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package wizard implements the interactive TUI setup wizard for ExitBox.

Index

Constants

This section is empty.

Variables

View Source
var AllAgents = []AgentOption{
	{Name: "claude", DisplayName: "Claude Code", Description: "Anthropic's AI coding assistant"},
	{Name: "codex", DisplayName: "OpenAI Codex", Description: "OpenAI's coding CLI"},
	{Name: "opencode", DisplayName: "OpenCode", Description: "Open-source AI code assistant"},
}

AllAgents defines the selectable agents.

View Source
var AllExternalTools = []ExternalTool{
	{
		Name:        "GitHub CLI",
		Description: "gh — GitHub from the command line",
		Packages:    []string{"github-cli"},
		Configs: []ExternalToolConfig{
			{HostPath: ".config/gh", Description: "GitHub CLI auth"},
		},
	},
}

AllExternalTools defines the available external tools.

View Source
var AllLanguages = []Language{
	{Name: "Go", Profile: "go"},
	{Name: "Python", Profile: "python"},
	{Name: "Node/JS", Profile: "node"},
	{Name: "Rust", Profile: "rust"},
	{Name: "Java", Profile: "java"},
	{Name: "Ruby", Profile: "ruby"},
	{Name: "PHP", Profile: "php"},
	{Name: "C/C++", Profile: "c"},
	{Name: "Flutter/Dart", Profile: "flutter"},
}

AllLanguages defines the available language choices.

View Source
var AllToolCategories = []ToolCategory{
	{Name: "Build Tools", Packages: []string{"cmake", "samurai", "autoconf", "automake", "libtool"}},
	{Name: "Shell Utils", Packages: []string{"rsync", "openssh-client", "mandoc", "gnupg", "file"}},
	{Name: "Networking", Packages: []string{"iptables", "ipset", "iproute2", "bind-tools"}},
	{Name: "Database", Packages: []string{"postgresql16-client", "mariadb-client", "sqlite", "redis"}},
	{Name: "Kubernetes", Packages: []string{"kubectl", "helm", "k9s", "kustomize"}, Binaries: []Binary{
		{Name: "kind", URLPattern: "https://kind.sigs.k8s.io/dl/latest/kind-linux-{arch}"},
		{Name: "kubeseal", URLPattern: "https://github.com/bitnami-labs/sealed-secrets/releases/latest/download/kubeseal-linux-{arch}"},
	}},
	{Name: "DevOps", Packages: []string{"docker-cli", "docker-cli-compose", "opentofu"}},
	{Name: "Web", Packages: []string{"nginx", "apache2-utils", "httpie"}},
	{Name: "Security", Packages: []string{"nmap", "tcpdump", "netcat-openbsd"}},
}

AllToolCategories defines the available tool category choices.

View Source
var Roles = []Role{
	{
		Name:           "Frontend",
		Description:    "Web frontend development",
		Profiles:       []string{"node", "web", "build-tools"},
		Languages:      []string{"Node/JS"},
		ToolCategories: []string{"Build Tools", "Web"},
	},
	{
		Name:           "Backend",
		Description:    "Server-side development",
		Profiles:       []string{"python", "database", "build-tools"},
		Languages:      []string{"Python", "Go"},
		ToolCategories: []string{"Build Tools", "Database"},
	},
	{
		Name:           "Fullstack",
		Description:    "Full-stack web development",
		Profiles:       []string{"node", "python", "database", "web", "build-tools"},
		Languages:      []string{"Node/JS", "Python"},
		ToolCategories: []string{"Build Tools", "Database", "Web"},
	},
	{
		Name:           "DevOps",
		Description:    "Infrastructure and operations",
		Profiles:       []string{"devops", "node", "networking", "shell", "build-tools"},
		Languages:      []string{"Go", "Python", "Node/JS"},
		ToolCategories: []string{"Build Tools", "Networking", "DevOps", "Shell Utils"},
	},
	{
		Name:           "Kubernetes",
		Description:    "Kubernetes development and operations",
		Profiles:       []string{"kubernetes", "devops", "networking", "shell", "build-tools"},
		Languages:      []string{"Go", "Python"},
		ToolCategories: []string{"Build Tools", "Networking", "Kubernetes", "DevOps", "Shell Utils"},
	},
	{
		Name:           "Data Science",
		Description:    "Data analysis and machine learning",
		Profiles:       []string{"python", "datascience", "database"},
		Languages:      []string{"Python"},
		ToolCategories: []string{"Database"},
	},
	{
		Name:           "Mobile",
		Description:    "Mobile application development",
		Profiles:       []string{"flutter", "node"},
		Languages:      []string{"Flutter/Dart", "Node/JS"},
		ToolCategories: []string{"Build Tools"},
	},
	{
		Name:           "Embedded",
		Description:    "Embedded systems and IoT",
		Profiles:       []string{"c", "embedded", "build-tools"},
		Languages:      []string{"C/C++", "Rust"},
		ToolCategories: []string{"Build Tools"},
	},
	{
		Name:           "Security",
		Description:    "Security research and tooling",
		Profiles:       []string{"security", "networking", "shell"},
		Languages:      []string{"Python", "Go"},
		ToolCategories: []string{"Networking", "Security", "Shell Utils"},
	},
}

Roles defines the available developer roles.

Functions

func ComputeExternalToolPackages added in v0.1.9

func ComputeExternalToolPackages(names []string) []string

ComputeExternalToolPackages computes Alpine packages from selected external tools.

func ComputePackages

func ComputePackages(categories []string) []string

ComputePackages computes Alpine packages from selected tool categories.

func ComputeProfiles

func ComputeProfiles(roleNames []string, languages []string) []string

ComputeProfiles computes the profile list from roles + language selections.

func DetectExternalToolConfigs added in v0.1.9

func DetectExternalToolConfigs() map[string][]string

DetectExternalToolConfigs checks $HOME for known external tool config directories and returns a map of tool name → detected host paths.

Types

type AgentOption

type AgentOption struct {
	Name        string
	DisplayName string
	Description string
}

AgentOption represents a selectable agent.

type Binary

type Binary struct {
	Name       string // Binary name (installed to /usr/local/bin)
	URLPattern string // Download URL with {arch} placeholder (amd64/arm64)
}

Binary represents a tool installed via direct download rather than apk.

func ComputeBinaries

func ComputeBinaries(categories []string) []Binary

ComputeBinaries computes extra binary downloads from selected tool categories.

type ExternalTool added in v0.1.9

type ExternalTool struct {
	Name        string
	Description string
	Packages    []string             // Alpine APK packages
	Configs     []ExternalToolConfig // Host configs to detect (for UI hints)
}

ExternalTool represents an installable external tool with host config detection.

type ExternalToolConfig added in v0.1.9

type ExternalToolConfig struct {
	HostPath    string // relative to $HOME, e.g. ".config/gh"
	Description string // shown when detected
}

ExternalToolConfig describes a host config directory that hints at tool usage.

type Language

type Language struct {
	Name    string // Display name
	Profile string // Maps to an exitbox profile name
}

Language represents a selectable programming language.

type Model

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

Model is the root bubbletea model for the wizard.

func NewModel

func NewModel() Model

NewModel creates a new wizard model with defaults.

func NewModelFromConfig added in v0.1.1

func NewModelFromConfig(cfg *config.Config) Model

NewModelFromConfig creates a wizard model pre-populated from existing config.

func NewWorkspaceModelFromConfig added in v0.1.1

func NewWorkspaceModelFromConfig(cfg *config.Config, workspaceName string) Model

NewWorkspaceModelFromConfig creates a blank wizard model for creating one workspace. It intentionally does not inherit role/language/settings selections.

func (Model) Cancelled

func (m Model) Cancelled() bool

Cancelled returns true if the user cancelled the wizard.

func (Model) Confirmed

func (m Model) Confirmed() bool

Confirmed returns true if the user confirmed their selections.

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Result

func (m Model) Result() State

Result returns the final wizard state.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Role

type Role struct {
	Name           string
	Description    string
	Profiles       []string // Default profiles to activate
	Languages      []string // Pre-checked language names in language step
	ToolCategories []string // Pre-checked tool category names in tools step
}

Role represents a developer role with preset defaults.

func GetRole

func GetRole(name string) *Role

GetRole returns the role by name, or nil.

type SetupResult added in v0.1.3

type SetupResult struct {
	WorkspaceName string   // the workspace that was created/edited
	CopyFrom      string   // workspace to copy credentials from ("__host__" = import from host, "" = skip)
	IsDefault     bool     // true if this workspace is the default
	Agents        []string // enabled agent names (e.g. ["claude", "codex"])
	VaultEnabled  bool     // enable encrypted vault for secrets
	VaultReadOnly bool     // vault is read-only (agents cannot store new secrets)
	VaultPassword string   // vault encryption password (non-empty when VaultEnabled)
}

SetupResult holds post-wizard actions for the caller to execute.

func Run

func Run(existingCfg *config.Config) (*SetupResult, error)

Run executes the setup wizard TUI and writes config files on completion. If existingCfg is non-nil, the wizard is pre-populated from it.

type State

type State struct {
	Roles               []string
	Languages           []string
	ToolCategories      []string
	CustomPackages      []string // user-selected extra Alpine packages
	WorkspaceName       string
	MakeDefault         bool
	DefaultWorkspace    string // set when d is toggled on workspace select screen
	Agents              []string
	AutoUpdate          bool
	StatusBar           bool
	EnableFirewall      bool
	AutoResume          bool
	PassEnv             bool
	ReadOnly            bool
	OriginalDevelopment []string          // non-nil when editing an existing workspace
	DomainCategories    []domainCategory  // editable allowlist categories
	CopyFrom            string            // workspace to copy credentials from (empty = none)
	VaultEnabled        bool              // enable encrypted vault for secrets
	VaultReadOnly       bool              // vault is read-only (agents cannot store new secrets)
	VaultPassword       string            // vault encryption password (set during wizard init)
	Keybindings         map[string]string // configurable keybindings (e.g. "workspace_menu" -> "C-M-p")
	ExternalTools       []string          // selected external tools (e.g. "GitHub CLI")
	FullGitSupport      bool              // full git support (SSH agent + .gitconfig)
	RTK                 bool              // experimental: token-optimized CLI wrappers
}

State holds accumulated user selections across wizard steps.

type Step

type Step int

Step identifies the current wizard step.

type ToolCategory

type ToolCategory struct {
	Name     string   // Display name
	Packages []string // Alpine packages in this category
	Binaries []Binary // Extra binaries to download (not available via apk)
}

ToolCategory represents a selectable tool category.

type WorkspaceCreationResult added in v0.1.3

type WorkspaceCreationResult struct {
	Workspace     *config.Workspace
	MakeDefault   bool
	CopyFrom      string // workspace to copy credentials from (empty = none)
	VaultEnabled  bool   // enable encrypted vault for secrets
	VaultReadOnly bool   // vault is read-only (agents cannot store new secrets)
	VaultPassword string // vault encryption password (non-empty when VaultEnabled)
}

WorkspaceCreationResult holds the result of the workspace creation wizard.

func RunWorkspaceCreation added in v0.1.1

func RunWorkspaceCreation(existingCfg *config.Config, workspaceName string) (*WorkspaceCreationResult, error)

RunWorkspaceCreation runs the wizard from step 1 and returns a configured workspace.

Jump to

Keyboard shortcuts

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