Documentation
¶
Index ¶
- Variables
- func MockInput() *schema.Input
- func Preview(state *WizardState) string
- func Run(cfgPath, settingsPath string) error
- type Step
- type WizardState
- func (s *WizardState) HasCache() bool
- func (s *WizardState) HasContext() bool
- func (s *WizardState) HasGit() bool
- func (s *WizardState) HasLines() bool
- func (s *WizardState) HasTokens() bool
- func (s *WizardState) InferLayout() [][]string
- func (s *WizardState) InvalidateLayout()
- func (s *WizardState) ToConfig() *config.Config
- func (s *WizardState) ToTOML() (string, error)
Constants ¶
This section is empty.
Variables ¶
var Steps = []Step{ {Run: runThemeStep}, {Run: runFeaturesStep}, {ShouldRun: (*WizardState).HasContext, Run: runContextStep}, {ShouldRun: (*WizardState).HasTokens, Run: runTokensStep}, {ShouldRun: (*WizardState).HasCache, Run: runCacheStep}, {ShouldRun: (*WizardState).HasGit, Run: runGitStep}, {ShouldRun: (*WizardState).HasLines, Run: runLinesStep}, {Run: runEmojisStep}, }
Steps defines the wizard steps in order. Add, remove, or reorder entries to change the wizard flow.
Functions ¶
func MockInput ¶
MockInput returns a realistic sample input for wizard preview rendering. All data is static — no subprocess calls or I/O are performed.
func Preview ¶
func Preview(state *WizardState) string
Preview renders the status line using mock data and the given wizard state.
Types ¶
type Step ¶
type Step struct {
// ShouldRun returns whether this step applies given current state.
// If nil, the step always runs.
ShouldRun func(*WizardState) bool
// Run executes the step, mutating state. Returns error on failure.
Run func(*WizardState) error
}
Step represents a single wizard step.
type WizardState ¶
type WizardState struct {
// Theme is the color theme name (e.g. "default", "catppuccin", "nord").
Theme string
// Features is the set of high-level data categories the user wants to see.
// Valid values: "model", "context", "tokens", "cache", "cost", "duration",
// "git_branch", "git_status", "lines_changed", "directory".
Features []string
// ContextStyle controls how the context window is displayed.
// "pct" → context_pct; "block"/"solid"/"ascii" → context_bar.
// Only used when "context" is in Features.
ContextStyle string
// CacheStyle controls how cache stats are displayed.
// "hit" → cache_hit (efficiency %); "counts" → cache (raw token counts).
// Only used when "cache" is in Features.
CacheStyle string
// LinesStyle controls how lines changed are displayed.
// "summary" → lines_summary (±total); "detail" → lines_changed (+N -M).
// Only used when "lines_changed" is in Features.
LinesStyle string
// GitStyle controls how git information is displayed.
// "branch" → git_branch (branch name only); "status" → git_status (branch + file counts).
// Only used when "git" is in Features.
GitStyle string
// TokenStyle controls how token usage is displayed.
// "turn" → tokens; "turn_cache" → tokens_cache; "session" → tokens_session; "full" → tokens_full.
// Only used when "tokens" is in Features.
TokenStyle string
// Emojis is "all" or "none".
Emojis string
// BarWidth is the character width of progress bars (default 10).
BarWidth int
// contains filtered or unexported fields
}
WizardState holds all choices collected across wizard steps.
func DefaultState ¶
func DefaultState() *WizardState
DefaultState returns a WizardState that matches config.Default().
func (*WizardState) HasCache ¶
func (s *WizardState) HasCache() bool
HasCache reports whether the user selected the cache feature.
func (*WizardState) HasContext ¶
func (s *WizardState) HasContext() bool
HasContext reports whether the user selected the context window feature.
func (*WizardState) HasGit ¶
func (s *WizardState) HasGit() bool
HasGit reports whether the user selected the git feature.
func (*WizardState) HasLines ¶
func (s *WizardState) HasLines() bool
HasLines reports whether the user selected the lines_changed feature.
func (*WizardState) HasTokens ¶
func (s *WizardState) HasTokens() bool
HasTokens reports whether the user selected the tokens feature.
func (*WizardState) InferLayout ¶
func (s *WizardState) InferLayout() [][]string
InferLayout places all selected components on a single line, then progressively splits the widest line in half until every line fits within the terminal width (or each line has a single component).
func (*WizardState) InvalidateLayout ¶
func (s *WizardState) InvalidateLayout()
InvalidateLayout clears the cached layout so the next InferLayout call recomputes it. Call this when features, styles, or context change.
func (*WizardState) ToConfig ¶
func (s *WizardState) ToConfig() *config.Config
ToConfig converts the wizard state to a *config.Config.
func (*WizardState) ToTOML ¶
func (s *WizardState) ToTOML() (string, error)
ToTOML encodes the wizard state as a TOML string for writing to the config file.