Documentation
¶
Overview ¶
Package clitree exposes the built-in CLI command-tree builders as core.TreeBuilders so a downstream module (a separate overlay binary) can compose them via core.NewRootCmd without editing the built-in tree.
The actual builders live in internal/cli/api and internal/cli/ctlcmd (they need the internal *cmdcore.App / path resolution). internal/ is not importable across modules, so this exported package is the bridge: it imports those packages (allowed — same module) and re-exports the two builders. The dependency edge stays one-way (clitree → internal/cli/{api,ctlcmd} → pkg/core); nothing internal imports clitree.
Index ¶
Constants ¶
const CLIReferenceSchema = "jentic.cli-reference/v1"
CLIReferenceSchema identifies the JSON shape (bump on a breaking change).
Variables ¶
var MustBeFenced = []string{
"run",
"reset",
"setup",
"bootstrap",
"context create",
"context use",
"context rename",
"context delete",
"context list",
"env add",
"env delete",
"identity add",
"identity claim",
"identity delete",
}
MustBeFenced is THE canonical fence set: the command paths that MUST carry the `fenced` annotation so an autonomous agent cannot run them (impl/3.2 §2a). Every other doc (plan Phase 3 item 5, 07 §2, impl/1.3 §3, rules/01 §4, rules/03 §4) defers to this list; if a doc and this list disagree, this list wins. The rule: a command is fenced iff it (a) mutates host-level management state (contexts, environments, identities, local-agent lifecycle), or (b) reveals/switches to contexts other than the active one.
Phase 2 ships the enforcing machinery against the commands that EXIST today — context/env/identity management surface. Deliberate carve-outs, NOT fenced: the read-only verbs (`context view`, `env list`, `identity list`), `identity register` (DCR of the agent's own identity — required by the agent workflow), `migrate` (BC-1 directs agents to run it), and `theme` (a local color preference, not a management/context switch). NOTE: `context list` IS fenced (impl/3.2 §2a): unlike `context view` (active context only) it enumerates the operator's OTHER identities/contexts on a shared machine, a disclosure an agent should not perform. `setup` IS fenced (AGT-5): it blocks on a human approval poll (an effective hang for an unattended agent), creates a server-side registration the agent cannot approve, and writes skill files into operator runtimes — agents use `register`, which stays available.
Paths are space-separated ("context use" -> ["context","use"]) for root.Find.
Functions ¶
func API ¶
func API() core.TreeBuilder
API returns the built-in `jentic` (API-spec) command-tree builder. Compose it with your own container:
deps := &core.AppContainer{ExtraCommands: myFactories}
root := core.NewRootCmd(deps, clitree.API())
os.Exit(core.Run(root))
func Ctl ¶
func Ctl() core.TreeBuilder
Ctl returns the built-in `jenticctl` (installer / lifecycle) command-tree builder.
Types ¶
type BinaryDoc ¶ added in v0.32.0
type BinaryDoc struct {
Name string `json:"name"`
Tagline string `json:"tagline,omitempty"`
Short string `json:"short"`
Long string `json:"long,omitempty"`
Commands []CommandDoc `json:"commands"`
}
BinaryDoc is one CLI binary and its top-level command tree.
type CLIReference ¶ added in v0.32.0
CLIReference is the full payload the docs SPA consumes.
func BuildCLIReference ¶ added in v0.32.0
func BuildCLIReference() CLIReference
BuildCLIReference assembles the reference for both binaries from their cobra definitions. It builds the roots with a throwaway App (no filesystem or network access happens at construction time — commands only act when run).
type CommandDoc ¶ added in v0.32.0
type CommandDoc struct {
// Name is the leaf name (e.g. "add-key").
Name string `json:"name"`
// Path is the full invocation, e.g. "jentic profile add-key".
Path string `json:"path"`
// Use is cobra's usage line (carries the positional-arg shape).
Use string `json:"use"`
Short string `json:"short"`
Long string `json:"long,omitempty"`
Example string `json:"example,omitempty"`
Aliases []string `json:"aliases,omitempty"`
GroupTitle string `json:"group_title,omitempty"`
Flags []FlagDoc `json:"flags,omitempty"`
Subcommands []CommandDoc `json:"subcommands,omitempty"`
}
CommandDoc is one command (or subcommand) in the tree.