Skip to main content

Module agent_selection

Module agent_selection 

Source
Expand description

Which AI tools setup, onboard and the post-update refresh may touch.

Precedence: an explicit --agents list, then the saved setup.agents, then — for the post-update refresh only — the tools that already carry a lean-ctx entry. A setup with neither keeps the historical default and offers every detected tool. An update therefore never connects a tool that was installed after the last setup.

Structs§

DetectedAgent
One selectable tool. Several registry targets can share an agent key (Augment CLI + VS Code, Cline + Cline CLI, Qoder paths); they are one choice.

Enums§

AgentScope

Functions§

connected_agent_keys
Agent keys an earlier setup connected (a lean-ctx entry is present).
detected_agents
Installed tools, one entry per agent key, in registry order.
known_agent_keys
Agent keys --agents and setup.agents accept.
parse_agent_list
Parse a --agents value: comma-separated agent keys, or none to connect no tool at all. Unknown names are an error, never silently dropped.
parse_selection_answer
Interpret the answer to the selection prompt. Empty keeps default; otherwise all, none, or numbers / agent keys separated by commas or spaces select exactly those tools.
prompt_agent_selection
Ask which detected tools lean-ctx should connect. Reads stdin; callers must only use it on an interactive terminal.
prompt_default
Default for the prompt: the recorded choice, else the connected tools, else (first setup) every detected tool.
remember_connected_agent
init --agent <key> connects a tool on purpose: add it to a recorded selection so later updates keep it current. Without a recorded selection nothing is written — updates already follow the connected tools.
resolve_scope
Resolve the scope for one run. connected is only evaluated for the post-update refresh without a recorded choice.
save_selection
Record the choice so later updates refresh exactly these tools.
scope_for_run
Scope for a setup run: --agents, then setup.agents, then (refresh only) the already-connected tools, else every detected tool.
take_agents_flag
Pull --agents <list> / --agents=<list> out of CLI args. Returns the remaining args and the raw list; Err when the flag has no value.