Skip to main content

Module cli

Module cli 

Source
Expand description

CLI grammar: launch syntax, wrapper options and reserved command words (spec §5; SP1 design §4) and the repository commands (SP3 design §7).

Modules§

completions 🔒
The shell completion model. The model exists only for clap_complete::generate: it never parses an argument line, and it mirrors the grammar table on CommandWord (scope, flags, positionals), so the generated scripts cannot drift from the hand dispatcher.

Structs§

Cli 🔒
Select and launch profiles for multiple coding agents.

Enums§

AgentScope 🔒
Where a command word may appear: with an agent, without one, or both.
Command 🔒
Every reserved word — the eight of spec §5.3 plus resolve, current, repositories, doctor and completions — is dispatched before Clap (SP3 design §7.2), so Clap sees only the agent form.
CommandWord 🔒
The repository commands (SP3 design §7.1).
Invocation 🔒
The outcome of the argument checks (SP1 design §4.2, SP3 design §7.2).
LaunchDiscovery 🔒
Whether a launch runs discovery (SP3 design §7.6).
Positional 🔒
The positional words a command takes after its command word.
Token 🔒
One token before the first --, after --repo binding (SP3 design §7.2 step 1).

Constants§

COMMANDS_HELP 🔒
LAUNCH_USAGE 🔒
REPO_EQUALS 🔒

Functions§

bare_words 🔒
base_dir 🔒
The directory a --repo value is joined to. An absolute --repo needs no current directory, so a command given one still works from a working directory that no longer exists (design §6.2, §10 “--repo is the explicit override”).
bind 🔒
Step 1: --repo=<v> carries its value; a bare --repo consumes the next token whatever it is.
confirm 🔒
Asks the user a yes/no question: prints question to stderr without a newline, flushes, and reads one line. Only y or yes, trimmed and ignoring ASCII case, counts; EOF or anything else is no.
current_dir 🔒
cut 🔒
Splits at the first --: the tokens before it, and the opaque arguments when there is one.
execute 🔒
has_help 🔒
has_version 🔒
launch_discovery 🔒
no_profile 🔒
option_name 🔒
Only the part before = is echoed: the value may be a secret meant for the agent (spec §36).
options 🔒
parse_profile 🔒
repo_value 🔒
The value of a --repo=<v> token, which may be non-UTF-8.
report 🔒
run
Runs the CLI and returns the process exit code. This is the only place an exit code is decided.
run_agents 🔒
agents (SP5a design §3): every registry entry with its executable evidence. Read-only — the load in run_command refuses an invalid configuration but nothing is created here (V3 §17) — and it always exits 0: a missing or unusable executable is listed as a fact, not an error, while any discovery error that is not one of those facts propagates.
run_command 🔒
SP3 design §7.4 steps 2-5.
run_create 🔒
<agent> create <profile> (SP5a design §3): materializes the adapter’s paths exactly once. Both outcomes exit 0; the configuration was already refused if invalid by run_command’s load, and is otherwise unused.
run_delete 🔒
<agent> delete <profile> [--yes] (SP5a design §3). An advisory referenced-profile check first, then --yes or an interactive confirmation, then the locked lifecycle::delete. A missing profile exits 0 rather than erroring, because that is the state the user asked for — the same line and code as a profile that vanishes between the check and the lock. The configuration was already refused if invalid by run_command’s load, and is read again under the lock inside lifecycle::delete.
run_doctor 🔒
SP5c design §3-§4: every check runs and prints; the exit code is 5 when any record failed. A working directory that cannot be read is not an error here: discovering . then yields the repository record.
run_launch 🔒
run_profiles 🔒
profiles and bare list and <agent> list (SP5a design §3): the read-only listings. Nothing is created — run_command has already loaded the configuration (V3 §17) but no root, no config.toml and no lock is written here — and every outcome exits 0: an empty listing is the answer, not an error, and unrecognized on-disk entries are a stderr note rather than a failure.
run_repositories 🔒
repositories (SP5b design §4): every stored mapping with its classification. Read-only, takes no lock, and always exits 0: an entry that cannot be examined is reported, not raised.
run_unlink 🔒
unlink chooses its keys without discovery when --repo is given (SP3 design §6.2).
split 🔒
agent-profile <agent> …: SP1 design §4.2 rules 3-4 as replaced by SP3 design §7.2.
split_top_level 🔒
agent-profile <command> … for the reserved words dispatched before Clap (SP3 design §7.2).
usage 🔒
validate_command 🔒
Step 5: bare holds the bare words after the command word.
with_unknown_configured 🔒
Fills unknown_configured on UnknownAgent and AgentNotInstalled. With no configuration at hand, one best-effort load is attempted; its failure leaves the list empty (design §4.2 check 3).
write_lines 🔒
write_out 🔒