Documentation
¶
Overview ¶
Package capability is the single answer to "is this feature part of this binary". A capability exists if and only if its package is linked, and it is linked if and only if a blank import in cmd/*/imports*.go pulls it in — so build tags and blank imports stay the edition switch, and everything else (CLI help, scanner availability, skill gating, tool-group assembly) is derived from the descriptors registered here instead of from parallel global tables.
The package deliberately imports nothing from aiscan so that core/config, skills, pkg/commands and pkg/tools can all depend on it.
Index ¶
- func CLIAvailable(name string) bool
- func Enabled(id ID) bool
- func GatedSkills() []string
- func Groups() []string
- func IDsSorted() []string
- func Register(d Descriptor)
- func SkillEnabled(name string) bool
- func Summaries() []string
- func Usage(name string) (string, bool)
- func UsageLines() []string
- type Conflict
- type Descriptor
- type ID
- type Kind
- type Options
- type Plan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLIAvailable ¶
CLIAvailable reports whether name is a top-level CLI command in this binary.
func GatedSkills ¶
func GatedSkills() []string
GatedSkills lists the skill names that depend on a capability being linked.
func Groups ¶
func Groups() []string
Groups lists every distinct factory group, in registration order.
func IDsSorted ¶
func IDsSorted() []string
IDsSorted is the stable identity of an edition, for golden tests.
func Register ¶
func Register(d Descriptor)
Register declares a capability. Called from init(); first registration wins.
func SkillEnabled ¶
SkillEnabled reports whether a skill should be visible in this binary.
func Summaries ¶
func Summaries() []string
Summaries returns the summary words of every linked CLI capability, in registration order. Callers prepend the binary's own modes (agent, web, …).
func Usage ¶
Usage renders a CLI capability's help text, or false when the capability is not linked or declares no usage.
func UsageLines ¶
func UsageLines() []string
UsageLines returns the pre-aligned usage rows of every linked CLI capability, in registration order.
Types ¶
type Conflict ¶
Conflict records a duplicate registration. First registration wins; the duplicate is reported once at startup rather than silently shadowing.
type Descriptor ¶
type Descriptor struct {
ID ID
Kind Kind
// Group is the command-factory group; empty means the ID is the group.
Group string
// CLIName is the top-level command name; empty means not CLI-facing.
CLIName string
// Summary is the word shown in the CLI command summary line.
Summary string
// UsageLine is the pre-aligned row shown in the scanner usage block.
UsageLine string
// Usage renders the command's full help lazily, so registering a
// capability never costs the work of building its usage text.
Usage func() string
// Skills lists skill names this capability unlocks.
Skills []string
// Optional marks a group selectable through --tools.
Optional bool
// Default enables an Optional group when --tools is empty.
Default bool
// Requires names the dependencies the factory needs, for the skip log.
Requires []string
}
Descriptor is what a capability package declares about itself in init().
func Get ¶
func Get(id ID) (Descriptor, bool)
type Options ¶
type Options struct {
// Groups limits the plan to these assembly groups. Nil means every linked
// group. Entry points use this to describe their runtime surface without
// keeping private factory lists.
Groups []string
// OptionalTools is --tools / config tools. Empty selects the defaults.
OptionalTools []string
// Extra force-enables capabilities that become available at runtime, such
// as ioa once a client has connected.
Extra []ID
}
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
func Select ¶
Select resolves the registered descriptors against the caller's options. A capability that is not Optional is always part of the plan: it is linked, so it is meant to be there.