feature-flags

Featured

Creating and using feature flags in sidecar for gating experimental functionality. Covers flag registration, checking flags in code, config file and CLI overrides, and priority resolution. Use when adding feature flags, toggling features, or gating new functionality behind flags.

AI & Automation 1,069 stars 81 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 96/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Feature Flags Feature flags gate experimental functionality behind user-configurable settings, enabling safe rollout (default off), user opt-in, and easy rollback. ## Checking Feature State ```go import "github.com/marcus/sidecar/internal/features" if features.IsEnabled("tmux_interactive_input") { // Feature-gated code } ``` ## Adding a New Feature Flag 1. Define the feature in `internal/features/features.go`: ```go var MyNewFeature = Feature{ Name: "my_new_feature", Default: false, Description: "Description of what this enables", } ``` 2. Add to the `allFeatures` slice: ```go var allFeatures = []Feature{ TmuxInteractiveInput, MyNewFeature, // Add here } ``` 3. Use the feature check in your code: ```go if features.IsEnabled("my_new_feature") { // New functionality } ``` That is all a flag needs to be reachable. Configuration → System → **Feature Flags** derives its list from `features.ListAll()`, so registering a feature puts a working switch on the page with the registry's own `Name` as the label and `Description` as the help text. There is no second list to remember. ## Giving a flag better copy (optional) `previewCopy` in `internal/configui/page_flags.go` overrides the registry's wording per flag. Only fill in what you want to change: ```go features.MyNewFeature.Name: { label: "Human-readable name", help: "One sentence on what turning this on does.", restart: true, // only if a consumer reads it once ...

Details

Author
marcus
Repository
marcus/sidecar
Created
8 months ago
Last Updated
2 days ago
Language
Go
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category