capability

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLIAvailable

func CLIAvailable(name string) bool

CLIAvailable reports whether name is a top-level CLI command in this binary.

func Enabled

func Enabled(id ID) bool

Enabled reports whether the capability is linked into 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

func SkillEnabled(name string) bool

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

func Usage(name string) (string, bool)

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

type Conflict struct {
	ID    ID
	Group string
}

Conflict records a duplicate registration. First registration wins; the duplicate is reported once at startup rather than silently shadowing.

func Conflicts

func Conflicts() []Conflict

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 All

func All() []Descriptor

All returns the descriptors in registration order.

func Get

func Get(id ID) (Descriptor, bool)

type ID

type ID string

type Kind

type Kind uint8
const (
	KindTool    Kind = iota // agent tool group
	KindScanner             // CLI-facing scanner command
	KindService             // ioa / proxy / web
)

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

func Select(o Options) Plan

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.

func (Plan) Groups

func (p Plan) Groups() []string

Groups lists the factory groups to build, in registration order.

func (Plan) Has

func (p Plan) Has(id ID) bool

func (Plan) HasGroup

func (p Plan) HasGroup(group string) bool

Jump to

Keyboard shortcuts

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