Documentation
¶
Overview ¶
Package stability declares and resolves dtctl's command stability contract: what we promise about a command's, flag's or output field's shape over time.
Stability is a third axis, independent of the safety level ("what may this command do?") and the command profile ("which commands exist here?"). All three are filters in series, and every one of them can only *narrow* the surface:
- registration development opt-in before the tree exists
- profile mask topical allowlist startup, shapes the tree
- stability floor contract filter startup, shapes the tree
- deprecated surface removal preview startup, shapes the tree
- safety level permission check runtime, per operation
Levels are declared on the command as Cobra annotations rather than in a central table, so they travel with the command and cannot drift from it — unlike commands.MutatingVerbs and commands.ResourceAliases, both of which needed dedicated drift tests to stay honest.
See dtctl-contrib dev/STABILITY_TIERS_DESIGN.md.
Index ¶
- Constants
- func Badge(level Level) string
- func DeclarationRequired(cmd *cobra.Command, root *cobra.Command) bool
- func Declared(cmd *cobra.Command) bool
- func Deprecate(cmd *cobra.Command, d Deprecation)
- func Enabled(feature string, enabledKeys map[string]bool) bool
- func Feature(cmd *cobra.Command) string
- func Guarantee(level Level) string
- func Lint(root *cobra.Command) []error
- func Manifest(root *cobra.Command) string
- func Mark(cmd *cobra.Command, level Level, since string)
- func MarkDevelopment(cmd *cobra.Command, feature string)
- func MarkFlag(cmd *cobra.Command, name string, level Level, since string)
- func MarkFlagStable(cmd *cobra.Command, name string)
- func MarkStable(cmd *cobra.Command)
- func Path(cmd, root *cobra.Command) string
- func Register(parent, cmd *cobra.Command, feature string, enabledKeys map[string]bool) bool
- func Since(cmd *cobra.Command) string
- func SinceFlag(cmd *cobra.Command, name string) string
- func SinceFlagValue(f *pflag.Flag) string
- func Walk(cmd *cobra.Command, fn func(*cobra.Command))
- type Deprecation
- type Exception
- type Level
- type Policy
- func (p Policy) AllowsCommand(path string, lvl Level) bool
- func (p Policy) AllowsFlag(path, flag string, effective, own Level) bool
- func (p Policy) EffectiveFloor() Level
- func (p Policy) ExceptionStrings() []string
- func (p Policy) RequiredFor(command, flag string) Level
- func (p Policy) Restricts() bool
- type Registry
- func (r *Registry) Declare(feature, path string)
- func (r *Registry) EnabledPaths(enabledKeys map[string]bool) []string
- func (r *Registry) FeatureForCommand(path string) (string, bool)
- func (r *Registry) Features() []string
- func (r *Registry) Path(feature string) (string, bool)
- func (r *Registry) Paths(feature string) []string
Constants ¶
const ( Development = session.StabilityDevelopment Experimental = session.StabilityExperimental Stable = session.StabilityStable // Undeclared is the absence of a declaration -- the node states nothing // about its own contract. It is not a tier and never renders as one. // // For a *flag* it means inheritance: the flag stands or falls with its // command. For a *command* it is an error the build rejects, and at // runtime it resolves to Fallback rather than to a promise nobody made. Undeclared = session.StabilityLevel("") // Fallback is what an undeclared command resolves to. See // session.FallbackStabilityLevel for why it is not stable. Fallback = session.FallbackStabilityLevel // DefaultFloor is the stability floor when a context sets none. It is // deliberately NOT Stable: the floor admits experimental surface so humans // and interactive agents keep getting new commands (badged), while the // platform service and CI pin stable. DefaultFloor = session.DefaultMinStability )
The three tiers, in ascending order of promise.
const ( // AnnotationLevel holds the declared Level for a command or flag. AnnotationLevel = "dtctl.io/stability" // AnnotationSince holds the dtctl version at which the command or flag // entered its current level. It drives tier expiry: a feature that has sat // below stable for too many releases must be promoted or removed. AnnotationSince = "dtctl.io/stability-since" // AnnotationFeature holds the development-registry feature key for a // development-tier command, so the block message can name the opt-in. AnnotationFeature = "dtctl.io/development-feature" // AnnotationDeprecatedSince, AnnotationDeprecatedRemoveIn and // AnnotationDeprecatedReplacement carry deprecation metadata. Deprecation // is deliberately *not* a fourth tier: a deprecated command is still // stable in shape, it is merely scheduled for removal, so folding it into // the enum would make it look like a demotion. AnnotationDeprecatedSince = "dtctl.io/deprecated-since" AnnotationDeprecatedRemoveIn = "dtctl.io/deprecated-remove-in" AnnotationDeprecatedReplacement = "dtctl.io/deprecated-replacement" )
Annotation keys. Namespaced so they cannot collide with Cobra's own annotations (e.g. cobra.BashCompOneRequiredFlag) or with a future consumer's.
const ManifestHeader = `# dtctl stability manifest
<!-- GENERATED FILE — do not edit. Regenerate with: make stability-manifest -->
Every command and flag dtctl exposes, with the contract it carries. This file is
generated from the live command tree and checked in, so a change to the
contract shows up as a reviewable diff and a failing build rather than as a
silent break.
| Tier | Promise |
|---|---|
| ` + "`stable`" + ` | Invocation and output contract are additive-only. Removal or an incompatible change requires a deprecation cycle. |
| ` + "`experimental`" + ` | May change or be removed in any release. Not covered by dtctl's stability guarantees. |
| ` + "`development`" + ` | Unfinished, no guarantees — of any kind, including the backend's. Not registered unless opted in via ` + "`dtctl config set development.<feature> on`" + `. |
A tier describes the whole path, not just dtctl's side of it. A ` + "`development`" + `
command commonly targets an unreleased or feature-flagged API, so it may return
404, 403 or 500 on an environment where the feature is simply not deployed —
and dtctl does **not** translate that into "not available here". Read a failure
from a development command as "this does not work yet", not as a bug report.
Stable is never implied. Every command declares its tier where it is built and
the build fails on one that does not; a command that somehow reaches runtime
undeclared resolves to ` + "`experimental`" + `, never to ` + "`stable`" + `.
The strongest promise dtctl makes is not one a command can acquire by nobody
having thought about it.
Deprecation is not a tier: a deprecated command is still stable in shape and is
merely scheduled for removal. It is recorded on the same line.
A flag line ending in ` + "`(declared)`" + ` carries a tier declaration of its own; any
other flag inherits its command's. The flags that predate this rule may keep
inheriting, but a flag that newly becomes ` + "`stable`" + ` under a command that was
already ` + "`stable`" + ` has to be declared — ` + "`stability.MarkFlagStable`" + `, or
` + "`stability.MarkFlag`" + ` with a weaker tier — and ` + "`make stability-compat`" + `
refuses one that is not. Otherwise a flag would be stable by omission, the one
tier nobody chose deliberately.
The ` + "`(global)`" + ` group at the top is not a command. It is the root command's
persistent flags — the ones every command accepts. They are listed because a
flag that appears nowhere in this file is stable by omission, which is the one
tier nobody chose deliberately. The floor applies to them on whichever command
you type, and their tier is necessarily tree-wide: cobra gives every subcommand
the same flag the root declared, so a global flag cannot be stable on one
command and experimental on another.
## Choosing what this environment accepts
The **stability floor** is the weakest contract a command or flag may offer and
still be usable. It defaults to ` + "`experimental`" + `, so interactive use keeps
getting new (badged) surface. Automation should pin ` + "`stable`" + `:
` + "```bash" + `
# Per context, persisted in the config file
dtctl config set-context prod-agent --min-stability stable
# Per process — this is what an embedding service sets, and it is deliberately
# not a command-line flag: the embedder controls argv, so a flag would hand the
# opt-in to exactly the party the floor exists to constrain.
DTCTL_MIN_STABILITY=stable dtctl get workflows
` + "```" + `
A single below-floor command or flag can be admitted without lowering the floor
for everything. Each entry is one audited risk acceptance. Naming a command
also admits the flags that are below the floor only because that command is;
a flag with a weaker contract of its own needs its own entry, because there
the flag — not the command — is the risk being accepted:
` + "```bash" + `
dtctl config set-context prod-agent --min-stability stable \
--stability-exception 'inventory' \
--stability-exception 'query --decode-snapshots'
` + "```" + `
Development-tier features are enabled individually and never by a floor:
` + "```bash" + `
dtctl config list-development # what this build carries
dtctl config set development.serve on # persistent
DTCTL_DEVELOPMENT=serve dtctl serve http # one process
` + "```" + `
## Finding out early what a removal will break
` + "`DTCTL_NO_DEPRECATED=1`" + ` makes dtctl behave as if every deprecated command
and flag had already been removed (commands and flags only:
output fields carry no deprecation record, see "What ` + "`stable`" + ` promises before
1.0"). A deprecation warning in a log is
easy to miss; a failing pipeline is not. Run a CI job with it set and it fails
now, while that is a fixable build, rather than on the day the removal release
lands:
` + "```bash" + `
# Set it once for a whole pipeline, not per command: the point is to find out
# which of a hundred invocations still depends on dated surface.
export DTCTL_NO_DEPRECATED=1
./scripts/nightly-report.sh
# error: this context accepts no deprecated surface: flag --params of command
# "exec workflow", deprecated: ... use --input instead.
` + "```" + `
Orthogonal to the floor, and not a tier: a deprecated command is still stable
in shape and satisfies any floor, it merely has a removal date. No floor and no
exception will bring it back — only a migration will.
The mode is off unless asked for and can be made durable per context
(` + "`no-deprecated: true`" + `). The environment variable overrides the context
in *both* directions, so the one run that is still mid-migration can set
` + "`DTCTL_NO_DEPRECATED=0`" + ` without editing a config it shares with every
other run. Embedded callers use ` + "`engine.Request.NoDeprecated`" + `; the
variable is scrubbed from a session-backed run, like the floor is.
### Embedded and service callers
When dtctl is embedded (` + "`pkg/engine`" + `, ` + "`cmd.Session`" + `) the floor is a
per-request field, and it defaults to ` + "`stable`" + ` rather than
` + "`experimental`" + `. A request is unattended automation: nobody reads the
` + "`[Experimental]`" + ` badge on its behalf. Widen it deliberately, and prefer
naming the individual commands the host has tested over granting the whole tier:
` + "```go" + `
engine.Request{
Command: "inventory --agent",
MinStability: "", // stable, the safe default
StabilityExceptions: []string{"inventory"}, // just this one, audited
}
` + "```" + `
Environment variables do not reach a session-backed run: ` + "`DTCTL_MIN_STABILITY`" + `
and ` + "`DTCTL_DEVELOPMENT`" + ` are scrubbed, because which commands exist is the
request's decision and not the host process's. See
` + "`docs/dev/SERVICE_ENGINE_DESIGN.md`" + `.
## What ` + "`stable`" + ` promises before 1.0
dtctl is pre-1.0, and ` + "`release-please-config.json`" + ` sets
` + "`bump-minor-pre-major`" + `: a breaking change ships as a minor bump, and semver's
own 0.x clause says anything may change at any time. Read literally, that would
make every badge in this file worthless on the day it shipped. So the promise is
carved out of the version policy rather than derived from it.
**The tier carries the contract, not the version number.** A ` + "`stable`" + `
command's invocation and output are additive-only from the release that declared
it, whatever the version number does next. dtctl does not get to break a
` + "`stable`" + ` command in 0.40.0 on the grounds that 0.x permits it.
**A removal needs a deprecation cycle, and the deprecation record is the
signal.** A minor bump cannot be read as "safe" here, so the warning cannot come
from the version number. It comes from the surface instead:
- The removal is announced by deprecating the command or flag, naming the
version that deprecated it and the version it will disappear in.
- That removal version is at least **two minor releases** after the deprecating
one, so there is always a release you can run that both warns and still works.
- ` + "`DTCTL_NO_DEPRECATED=1`" + ` turns the warning into a failing build on demand,
and this file records every deprecation. Together they are what replaces
"watch the major version".
` + "`stability.Lint`" + ` enforces the window, so a deprecation that skips it fails the
build rather than a review.
**Surface that a known breaking change already targets is not ` + "`stable`" + `.**
This is what keeps the promise honest without a major version available: when an
accepted breaking-change document renames or removes a flag, the flag is
declared ` + "`experimental`" + ` *now*, ahead of the break, rather than carrying a
` + "`stable`" + ` badge dtctl already knows it cannot keep. Most of the
` + "`experimental`" + ` entries below are there for that reason and no other.
**Agent-mode output is shaped for agents, not frozen.** The additive-only
promise covers what a caller *types* (commands, flags, arguments, exit codes)
and the output outside agent mode. In agent mode (` + "`--agent`" + `, ` + "`-A`" + `, or
auto-detected) the reader is a model that reads every response afresh and adapts
to it, so what the envelope carries may change in any minor release, on
` + "`stable`" + ` commands too: which fields and how many items a default returns, how
rows are encoded, how numbers are rounded. Such a change is not a breaking
change: the release notes do not flag it as one, it needs no deprecation cycle
and no breaking-change document, and it does not demote the command. Three things still hold:
- The envelope's skeleton stays additive-only. ` + "`ok`" + `, ` + "`error.code`" + `,
` + "`result.kind`" + ` and the ` + "`context`" + ` keys keep their names, types and meanings,
because host code parses those, not the model.
- A change describes itself. When a default drops, clips, rounds, pages or
re-encodes data, the envelope says so (` + "`context.format`" + `, ` + "`context.has_more`" + `,
or a ` + "`context.suggestions`" + ` entry naming the flag that restores the full data).
- An explicit flag keeps its meaning. A program that needs a fixed shape passes
the flags for it (for example ` + "`-o json`" + `) rather than relying on agent-mode
defaults, and that invocation is covered by the promise above.
**Output outside agent mode is promised per command, not per field.** A
` + "`stable`" + ` command's output (JSON and YAML fields, table columns) is additive-only
as a whole, and what enforces that is the golden tests, which snapshot each
printer's output per resource and fail on any change. Content that comes from
the environment rather than from dtctl is outside that promise: the response
body ` + "`exec api`" + ` passes through, and the records a query returns, change when
the platform's APIs and data do. For those commands the promise covers the
invocation and how dtctl frames what it prints, not the payload. There is no
finer grain: an output field cannot declare a tier of its own, so there is no
experimental or deprecated field on a ` + "`stable`" + ` command, this file lists no
fields, and ` + "`DTCTL_NO_DEPRECATED`" + ` covers commands and flags but not fields.
A new field that should not carry the promise ships behind an experimental flag
or on an experimental command, because that is the finest grain a tier can be
declared at.
**` + "`experimental`" + ` and ` + "`development`" + ` are not covered.** They may
change in any release, patch releases included. That is the whole distinction.
**1.0 adds to this policy, it does not replace it.** Semver then applies on its
own terms: a removal from the stable surface needs a major bump *as well as* the
deprecation cycle. Nothing stated here is relaxed by reaching 1.0.
`
ManifestHeader is the preamble of the generated manifest. It states the promise the manifest encodes, because the file is the artifact reviewers and downstream consumers read.
Variables ¶
This section is empty.
Functions ¶
func Badge ¶
Badge returns the help-text badge for a level, or "" for stable. Badges never stack: Badge is only ever called with the single winning marker, whose precedence is deprecated > development > experimental > upstream preview.
func DeclarationRequired ¶
DeclarationRequired reports whether a command must declare a tier of its own for the build to pass.
Two exemptions, both because the command is already outside the promised surface rather than silently inside it:
- An ancestor declared a level below stable. That is one explicit demotion covering a subtree -- `account` marked development speaks for every `account *` -- not an omission, and making each child repeat it would turn a single reviewed decision into eight.
Hidden commands are *not* exempt. Hiding a command removes it from help, not from the tree: `dtctl exec dql` still runs, so something still has to decide whether a stable floor accepts it. Leaving that to the fallback would demote three working commands as a side effect of a docs decision.
func Deprecate ¶
func Deprecate(cmd *cobra.Command, d Deprecation)
Deprecate records a scheduled removal. It does not change the command's level: the only exit from stable is deprecation, and a deprecated command keeps working exactly as documented until it is removed.
func Enabled ¶
Enabled reports whether a feature is switched on, given the set of enabled keys resolved from config and the environment. The DevelopmentAll sentinel enables every registered feature at once.
func Feature ¶
Feature returns the development-registry feature key bound to a command, or "" when it is not development-tier.
func Guarantee ¶
Guarantee is the one-line statement of what a level promises. It is emitted alongside every badge rather than left to be inferred from the tier's name: AIP-181 defines "experimental" as the *weakest* level, so a reader may otherwise read the middle tier as weaker than we intend.
func Lint ¶
Lint reports declarations that are internally inconsistent. These are author errors rather than user errors, so the manifest test fails on them.
func Manifest ¶
Manifest renders the checked-in stability manifest for a command tree.
Only non-default declarations and deprecations are listed in the per-tier detail sections; the stable surface is enumerated in full so that *removing* a stable command or flag is also a diff. That asymmetry is the point: the file exists to make breaking a promise visible.
func Mark ¶
Mark declares a command's stability level. `since` is the dtctl version at which it entered that level and is required for any level below stable, so tier expiry has something to measure.
Stable is recorded like any other level. It used to be a no-op here, on the reasoning that stable was the default and writing it down only added noise. That had it backwards: it made the strongest promise dtctl offers the one tier nobody had to choose, so a command shipped it by omission. Every command now declares, and Lint fails the build for one that does not.
func MarkDevelopment ¶
MarkDevelopment declares a command as development-tier and binds it to a registry feature key. The key is what a caller enables (`dtctl config set development.<feature> on`), and it is what the block message names.
Marking alone does not hide anything: a development command must additionally not be registered on the tree unless its feature is enabled. Register does both — prefer it.
func MarkFlag ¶
MarkFlag declares a flag's stability level. A flag may make a *weaker* promise than its command — an experimental flag on a stable command is how a new idea ships without inventing a new command — but never a stronger one; Lint reports the inverted case.
Stable is recorded like any other level, for the reason Mark records it for a command: a flag that declares nothing inherits its command's tier, and on a stable command that is a stable promise nobody chose. The flags that predate this rule may keep inheriting, but a flag that newly becomes stable under an already-stable command must say so (MarkFlagStable) or be marked weaker; `make stability-compat` refuses one that does neither. The manifest tags every flag carrying its own declaration with "(declared)", which is what that check reads.
func MarkFlagStable ¶
MarkFlagStable declares a flag stable: part of its command's additive-only invocation contract from here on. Like MarkStable it takes no since-version, because stable is the terminus and tier expiry has nothing left to measure.
A flag added to a command that is already stable needs this (or a weaker MarkFlag); see MarkFlag for why only new flags are held to it.
func MarkStable ¶
MarkStable declares a command stable: its invocation and output contract are additive-only from here on.
It takes no since-version. Since drives tier expiry -- how long a feature has sat below stable before it must be promoted or dropped -- and stable is the terminus, so there is nothing left to measure. It would also be a fiction for the surface that predates this declaration, which has been stable for many releases and not since the one that wrote the annotation down.
func Path ¶
Path returns a command's path relative to root, space-joined ("get workflows"). This is the vocabulary the profile allowlist, the commands catalog and the stability exception list all share.
func Register ¶
Register declares a development feature, marks the command as development-tier, and adds it to the parent only when the feature is enabled. It is the one call a development-tier command should need:
stability.Register(rootCmd, accountCmd, "account", enabledKeys)
Skipping registration — rather than hiding — is what makes the tier unreachable by accident: an invocation yields the ordinary unknown-command error, and the command is absent from help, completion and the catalog. Returns true when the command was registered.
func SinceFlagValue ¶
SinceFlagValue returns the version at which a flag entered its current level, read from the flag itself. It is to SinceFlag what OfFlagValue is to OfFlag: the form that serves a caller already holding the flag, including a command's own persistent flag, which cmd.Flags() does not see until cobra merges persistent flags.
Types ¶
type Deprecation ¶
type Deprecation struct {
// Since is the dtctl version that deprecated the command.
Since string
// RemoveIn is the version it is scheduled to disappear in.
RemoveIn string
// Replacement is the command to use instead, if there is one.
Replacement string
}
Deprecation describes a stable command's scheduled removal.
func DeprecationOf ¶
func DeprecationOf(cmd *cobra.Command) (Deprecation, bool)
DeprecationOf returns a command's deprecation metadata, and false when it is not deprecated.
func (Deprecation) Note ¶
func (d Deprecation) Note() string
Note renders a deprecation as a single human-readable clause, shared by the help badge, the manifest and the commands catalog so the three never drift.
type Exception ¶
type Exception struct {
// Command is the space-joined command path ("get workflows").
Command string
// Flag is the single flag name (without dashes) the exception admits, or
// "" when the exception admits the command itself.
Flag string
}
Exception is one audited opt-in below the floor.
func ParseExceptions ¶
ParseExceptions parses config entries into Exceptions. An entry is a command path optionally followed by a single `--flag` token. A malformed entry is an error rather than a silent skip: a typo in an exception would otherwise silently tighten the surface and produce a confusing block much later.
type Level ¶
type Level = session.StabilityLevel
Level is the ordered stability axis. Re-exported from sdk/session so callers need not import both packages for the common case.
func Effective ¶
Effective returns a command's stability as callers actually experience it: the weakest level along the path from root down to the command. A stable subcommand under an experimental verb is stable in name only.
func EffectiveFlag ¶
EffectiveFlag returns a flag's stability as callers experience it: the weakest of the flag's own level and its command's effective level.
func Of ¶
Of returns a command's own declared level, ignoring its ancestors. Absence of an annotation is Undeclared -- the command states nothing, which is not the same as stating stable. See Effective for what that resolves to.
func OfFlag ¶
OfFlag returns a flag's own declared level, ignoring its command. Absence of an annotation is Undeclared, which for a flag means it inherits its command's level.
func OfFlagValue ¶
OfFlagValue returns a flag's own declared level from the flag itself, for callers that already hold it.
OfFlag cannot serve a global flag: before cobra merges persistent flags, cmd.Flags() on a subcommand does not see them, so the lookup returns Undeclared -- indistinguishable from a global flag that simply inherits. Walking ancestors by hand and reading the flag directly is the only way to ask about a global flag without triggering that merge.
func ValidLevels ¶
func ValidLevels() []Level
ValidLevels returns the tiers in ascending order of promise.
type Policy ¶
type Policy struct {
// Floor is the weakest contract a command or flag may offer and still be
// usable. The empty value means the default floor.
Floor Level
// Exceptions are targets admitted below the floor. Each is a command path,
// optionally suffixed with one flag: "inventory",
// "query --decode-snapshots". A command entry also admits the flags that
// are below the floor only because that command is — see AllowsFlag.
Exceptions []Exception
// Development are the command paths whose development-tier opt-in has
// already been given, subtree-inclusive. They are implicit exceptions, not
// user-written ones.
//
// Without them the development tier could not work at all: the default
// floor is experimental, so a feature the operator deliberately switched on
// would be registered and then immediately blocked. The opt-in is
// per-feature, out-of-band and strictly more explicit than a floor, so the
// floor governs the tiers that ship *registered* — stable and experimental
// — and leaves development to its own switch. Subtree-inclusive, because
// the switch gates a whole feature rather than one command.
Development []string
}
Policy is a deployment's stability constraint: an ordered floor plus a narrow list of per-command and per-flag exceptions to it.
The exceptions exist because a single floor is too coarse for the motivating case. A team that wants one experimental command should not have to drop the floor, which would grant the *entire* experimental surface — including experimental flags added to already-allowed stable commands in a later release. And a tight command profile cannot substitute: profile matching is prefix-based and subtree-inclusive, so it is default-deny at a point in time but default-allow over time within an allowed subtree. Right for topics, wrong for a contract.
func (Policy) AllowsCommand ¶
AllowsCommand reports whether a command at `path` with effective level `lvl` is usable under this policy.
func (Policy) AllowsFlag ¶
AllowsFlag reports whether a flag on the command at `path` is usable under this policy. `effective` is the flag's level as callers experience it (including what it inherits from its command); `own` is the level the flag declares for itself.
func (Policy) EffectiveFloor ¶
EffectiveFloor returns the floor, substituting DefaultFloor when unset.
func (Policy) ExceptionStrings ¶
ExceptionStrings renders the exceptions for the catalog, so an agent that reads `min_stability: stable` and finds an experimental command in the tree has a consistent picture of its own constraints.
func (Policy) RequiredFor ¶
RequiredFor returns the floor that applies to one target: the policy floor, unless the target sits under an enabled development feature, or an exception names this exact command (for a command target) or this exact command+flag (for a flag target) — in which case the floor drops to development for that target only.
The exception is a *parameterization of the floor stage*, not an override of another axis — so the invariant that no later stage widens what an earlier one narrowed still holds. In particular an exception cannot resurrect an unregistered development command: registration happens first.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the set of development-tier features known to this binary, whether or not they are enabled. It exists so that a *disabled* feature can still be named — Cobra cannot attach an error to a command that was never added to the tree, so the unknown-command path consults this instead.
It holds strings only: a feature key and the command paths it gates. A feature is one opt-in however many commands it spans (`actions` gates both `get actions` and `describe action`). No command tree, no config access. Enablement is decided by the caller and passed in, which keeps the package free of config imports and trivially testable.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns the process-wide development-feature registry.
func (*Registry) Declare ¶
Declare records that `feature` gates the command at `path` (space-joined, relative to root — e.g. "account" or "serve"). Declaring is independent of registering the command: a feature must be declared even when it is disabled, because that is the only way a disabled command can be named in a block message. Declaring a second path adds it to the feature; declaring a path again is a no-op.
func (*Registry) EnabledPaths ¶
EnabledPaths returns every command path of every enabled feature, sorted. The stability floor uses them as implicit exceptions, so a feature the operator switched on is not blocked a moment later by the default floor.
func (*Registry) FeatureForCommand ¶
FeatureForCommand returns the feature key gating the given command path (or any of its ancestors), and false when the path is not gated. Ancestor matching is what makes `dtctl account login` resolve to the `account` feature.