features

package
v0.74.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package features provides a feature flag system for gating experimental functionality, with priority resolution from CLI overrides, config file values, and compiled-in defaults.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TmuxInteractiveInput enables write support for tmux panes.
	TmuxInteractiveInput = Feature{
		Name:        "tmux_interactive_input",
		Default:     true,
		Description: "Enable write support for tmux panes",
	}

	// TmuxInlineEdit enables inline file editing via tmux in the files plugin.
	TmuxInlineEdit = Feature{
		Name:        "tmux_inline_edit",
		Default:     true,
		Description: "Enable inline file editing via tmux in the files plugin",
	}

	// NotesPlugin enables the notes plugin for capturing quick notes.
	NotesPlugin = Feature{
		Name:        "notes_plugin",
		Default:     false,
		Description: "Enable the notes plugin for capturing quick notes",
	}
)

Known feature flags - add new features here.

View Source
var ErrNotInitialized = errors.New("feature manager not initialized")

ErrNotInitialized is returned when the feature manager is not initialized.

Functions

func Init

func Init(cfg *config.Config)

Init initializes the feature flag manager with the given config. Should be called once at startup after config is loaded.

func IsEnabled

func IsEnabled(name string) bool

IsEnabled checks if a feature is enabled. Priority: CLI override > config > default.

func IsKnownFeature

func IsKnownFeature(name string) bool

IsKnownFeature returns true if the feature name is registered.

func List

func List() map[string]bool

List returns all known features with their current enabled state.

func SetEnabled

func SetEnabled(name string, enabled bool) error

SetEnabled updates a feature flag in the config and saves it. Returns an error if the config cannot be saved or if the manager is not initialized.

func SetOverride

func SetOverride(name string, enabled bool)

SetOverride sets a CLI override for a feature flag. Overrides take precedence over config values.

Types

type Feature

type Feature struct {
	Name        string
	Default     bool
	Description string
}

Feature represents a known feature flag with its default value.

func ListAll

func ListAll() []Feature

ListAll returns all known features with metadata. Returns a copy to prevent mutation of internal state.

type Manager

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

Manager handles feature flag state.

Jump to

Keyboard shortcuts

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