capability

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package capability defines the modular capability system. Each capability represents a feature (swagger, redis, otel, etc.) that declares its requirements, supported project types, and generation logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	Name         string
	Description  string
	MinGo        string // minimum Go version required (empty = no constraint)
	ProjectTypes []string
	Plan         func(ctx Context) (*plan.Plan, error)
}

Capability represents a modular feature that Ginger can add to a project.

func (*Capability) CheckGoVersion

func (c *Capability) CheckGoVersion(currentGo string) error

CheckGoVersion returns an error if the current Go version is below the capability's minimum requirement.

func (*Capability) SupportsProjectType

func (c *Capability) SupportsProjectType(pt string) bool

SupportsProjectType returns true if the capability supports the given project type.

type Context

type Context struct {
	Project *project.Project
	Force   bool
}

Context holds the data available to a capability's Plan function.

type Registry

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

Registry holds all registered capabilities.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry returns the capabilities shipped with the CLI. Planning is delegated to the integration and generator packages to avoid package cycles.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty registry.

func (*Registry) Available

func (r *Registry) Available(projectType, goVersion string) []*Capability

Available returns capabilities that are available for the given project type and Go version.

func (*Registry) Blocked

func (r *Registry) Blocked(projectType, goVersion string) []struct {
	Name   string
	Reason string
}

Blocked returns capabilities that are blocked for the given project type or Go version.

func (*Registry) Get

func (r *Registry) Get(name string) (*Capability, bool)

Get returns a capability by name.

func (*Registry) List

func (r *Registry) List() []string

List returns all registered capability names, sorted.

func (*Registry) Register

func (r *Registry) Register(c *Capability)

Register adds a capability to the registry.

Jump to

Keyboard shortcuts

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