Documentation
¶
Overview ¶
Package capability derives a feature set from the active context's configuration: which transports are usable (chain RPC, Console API) and therefore which command groups can work. The CLI uses it to gate the command surface so users are never offered commands their configuration cannot execute — e.g. a context with only a Console API key and no RPC endpoint cannot run chain queries.
Two presentation modes are supported while UX feedback is collected (config: defaults.command-gating):
- "dim" (default): unavailable commands stay listed, marked "[unavailable: ...]" in help, and fail fast with an explanation.
- "hide": unavailable commands are removed from help listings entirely (still fail fast with the explanation if invoked directly).
- "off": no gating; commands fail wherever the missing transport is first touched (the pre-gating behavior).
Index ¶
Constants ¶
const AnnotationKey = "akt.requires"
AnnotationKey is the cobra annotation carrying a command's requirement. The value is a requirement expression: capabilities separated by "|" are alternatives (any one suffices), e.g. "chain-tx|console" for workflow commands that run on either rail.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability string
Capability names a single thing a context configuration can do.
const ( // ChainQuery requires a network RPC endpoint. ChainQuery Capability = "chain-query" // ChainTx requires a network RPC endpoint (transactions additionally // need a funded key at execution time; key presence is deliberately // not probed here because opening OS keyrings can prompt). ChainTx Capability = "chain-tx" // Console requires a resolvable Console API key. Console Capability = "console" // Provider requires chain access (gateway discovery + wallet auth). Provider Capability = "provider" )
type Set ¶
Set is the feature set resolved from a context.
func Resolve ¶
Resolve derives the feature set from a resolved context. A nil context (no active context) yields the empty set.
func (Set) Explain ¶
Explain describes an unsatisfied requirement and how to fix it. The returned string is suitable both for help-line dimming and for the error returned when the command is invoked anyway.
func (Set) Has ¶
func (s Set) Has(c Capability) bool
Has reports whether the set satisfies a single capability.