fix(cli): fall back to a published release when adding hosts

VI
8d ago
+209-11

What & why

Addresses the hosts add failure in #9559. When desktop ships before its matching standalone CLI archive, onboarding a remote host fails with 404.

hosts add now opts into the installer's --fallback-latest behavior: a missing pinned archive produces a warning and one attempt at cli-latest. Published pins keep their original download; other HTTP failures remain errors. Manual installer pins and update --version keep their strict behavior. Missing versioned releases still need publication by the maintainers.

The install command is extracted into the existing SSH setup helpers and the CLI reference describes the fallback.

How I tested it

  • The regression fails with the original installer (exit 1 after a pinned 404) and succeeds after the fix (requests pinned archive, then latest; installs the fixture binary reporting 2.0.5).
  • Real sh, curl, and tar run the generated remote-install command against a loopback HTTP server. Six installer cases cover missing/published pins, an explicit manual pin, HTTP 500, missing latest, and avoiding a repeated latest request. No live SSH machine or cloud registration was used. Before/after output and reproducible probe.
  • SSH setup tests: 15 pass, 0 fail. Full CLI suite: 525 pass, 0 fail; marketing: 213 pass, 0 fail; desktop: 9,680 pass, 0 fail.
  • bun run lint:fix, clean bun run lint, all 42 typecheck tasks, docs typecheck, bun run check:i18n, and sh -n pass. No translation catalog changes.
  • Full bun run test --continue=always with TERM=xterm-256color: 27/30 tasks pass. Shared's macOS date-format assertion (#9658), two unchanged agent-setup shell-wrapper tests, and three untouched host-service tests fail. The three host-service cases pass in a scoped recheck. No CI or unrelated test changes are included.

Implementation, diff inspection, and automated checks were performed with Codex. No human review or manual testing is claimed.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs
  • I have signed the CLA (confirmed on previous PRs)

Summary by cubic

Fixes hosts add failing with a 404 when the desktop build ships before its matching standalone CLI archive.

hosts add now falls back to the published cli-latest release when the pinned release's archive returns 404, with a warning. Published pins keep their original download; other HTTP failures and manual installer pins remain strict.

  • Extracts the remote install command into a shared helper.
  • Adds the --fallback-latest flag to the installer and documents the fallback in the CLI reference.
  • Covers the fallback paths with installer tests.

Summary by CodeRabbit

  • New Features
    • hosts add now installs the latest published CLI if the requested release is unavailable.
  • Documentation
    • Updated the CLI reference to describe the fallback behavior.