Documentation
¶
Index ¶
Constants ¶
const ( UpdateCmd = FeatureCmd("update") InitCmd = FeatureCmd("init") McpCmd = FeatureCmd("mcp") DocsCmd = FeatureCmd("docs") AiCmd = FeatureCmd("ai") )
Variables ¶
var DefaultFeatures = []FeatureState{ Enable(UpdateCmd), Enable(InitCmd), Enable(McpCmd), Enable(DocsCmd), }
DefaultFeatures is the list of features enabled by default.
Functions ¶
This section is empty.
Types ¶
type Assets ¶
type Assets interface {
fs.FS
fs.ReadDirFS
fs.GlobFS
fs.StatFS
Slice() []fs.FS
Names() []string
Get(name string) fs.FS
Register(name string, fs fs.FS)
For(names ...string) Assets
Merge(others ...Assets) Assets
Exists(name string) (fs.FS, error)
Mount(f fs.FS, prefix string)
}
Assets is an interface that wraps a map of fs.FS pointers and implements the standard fs interfaces.
type Feature ¶
type Feature struct {
Cmd FeatureCmd `json:"cmd" yaml:"cmd"`
Enabled bool `json:"enabled" yaml:"enabled"`
}
Feature represents the state of a feature (Enabled/Disabled).
func SetFeatures ¶
func SetFeatures(mutators ...FeatureState) []Feature
SetFeatures applies a series of mutators to the standard default set.
type FeatureCmd ¶
type FeatureCmd string
type FeatureState ¶
FeatureState is a functional option that mutates the list of features.
func Disable ¶
func Disable(cmd FeatureCmd) FeatureState
Disable returns a FeatureState that disables the given command.
func Enable ¶
func Enable(cmd FeatureCmd) FeatureState
Enable returns a FeatureState that enables the given command.
type Props ¶
type Props struct {
Tool Tool
Logger *log.Logger
Config config.Containable
Assets Assets
FS afero.Fs
Version version.Version
ErrorHandler errorhandling.ErrorHandler
}
type ReleaseSource ¶
type Tool ¶
type Tool struct {
Name string `json:"name" yaml:"name"`
Summary string `json:"summary" yaml:"summary"`
Description string `json:"description" yaml:"description"`
Features []Feature `json:"features" yaml:"features"`
Help errorhandling.HelpConfig `json:"-" yaml:"-"`
// ReleaseSource is the source of truth for the tool's releases (GitHub or GitLab)
ReleaseSource ReleaseSource `json:"release_source" yaml:"release_source"`
// Deprecated: Use Features instead
Disable []FeatureCmd `json:"disable" yaml:"disable"`
// Deprecated: Use Features instead
Enable []FeatureCmd `json:"enable" yaml:"enable"`
}
func (Tool) GetReleaseSource ¶
GetReleaseSource returns the release source type, owner, and repo.
func (Tool) IsDisabled ¶
func (t Tool) IsDisabled(cmd FeatureCmd) bool
IsDisabled checks if a feature is disabled.
func (Tool) IsEnabled ¶
func (t Tool) IsEnabled(cmd FeatureCmd) bool
IsEnabled checks if a feature is enabled. It prioritizes the new Features slice, falling back to Disable/Enable slices for backward compatibility, and finally falling back to the built-in defaults.