fix(install): say why an added agent failed on a Mac with no other agent

After "Skip for now" there is no other agent, so a failed add hit
install_offered_cli's gate first, and the app showed its first-install text
("re-run the installer") instead of naming the agent and its command. That
is the main path of adding an agent.

run_offered_cli now runs a trusted command and looks again; the gate stays in
install_offered_cli for the install, and `agent` judges its own run. The one
line that executes a trusted command is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-06 13:46:31 +01:00
1 parent dd07126dd8
commit 1157aa9ecd
5 files changed
+32 -10

No files matched your search

+15 -7
View File
@@ -860,9 +860,9 @@ cli_offerable() {
return 0
}
# install_offered_cli <index>: run the trusted command of one entry and prove
# it left a CLI behind. A chosen install that leaves nothing is fatal.
install_offered_cli() {
# run_offered_cli <index>: run the trusted command of one entry and look again
# at what is installed. What that means is the caller's to judge.
run_offered_cli() {
local idx="$1"
info "Installing ${CLI_LABELS[$idx]}..."
# </dev/null: under `curl | bash` a child that reads stdin would
@@ -876,6 +876,13 @@ install_offered_cli() {
else
warn "${CLI_LABELS[$idx]} installation failed."
fi
return 0
}
# install_offered_cli <index>: the same during an install, where a chosen CLI
# that leaves no CLI at all behind is fatal.
install_offered_cli() {
run_offered_cli "$1"
if [[ "$CLI_FOUND_COUNT" -eq 0 ]]; then
die "The selected AI CLI failed to install. Install one manually and re-run the installer."
fi
@@ -884,9 +891,10 @@ install_offered_cli() {
# Install one AI CLI and nothing else (`install.sh agent <id>`): how the desktop
# app adds an agent once Codeman is here, also over a running server, which this
# never touches. install_offered_cli alone cannot end this run: it is fatal only
# when NO CLI is left, and here another one usually is, so a failed install would
# report success. A CLI that is here already is a success, and installs nothing.
# never touches. It judges the run itself, because install_offered_cli cannot: its
# gate is fatal only when NO CLI is left, and here another one usually is, so a
# failed install would report success, and its message is about re-running the
# installer. A CLI that is here already is a success, and installs nothing.
agent_subcommand() {
if [[ -z "$AI_CLI_CHOICE" || "$AI_CLI_CHOICE" == "none" ]]; then
die "Name the AI CLI to install: install.sh agent <id> (one of: $(cli_catalog_ids))."
@@ -912,7 +920,7 @@ agent_subcommand() {
die "${CLI_LABELS[$idx]} installs with npm, and this run cannot find it. Run this in a terminal instead: ${CLI_INSTALL_CMD_TRUSTED[$idx]}"
fi
install_offered_cli "$idx"
run_offered_cli "$idx"
if [[ -z "${CLI_FOUND_PATH[$idx]}" ]]; then
die "${CLI_LABELS[$idx]} did not install. You can run its installer yourself: ${CLI_INSTALL_CMD_TRUSTED[$idx]}"
fi