fix(install): also install the short `relay` launcher
Merged
KH
2d ago+273+273+012345678901234567890123456789-9-9-0123456789
Problem
The npm package exposes both agent-relay and relay bins, and the docs, quickstart and relay init's own output tell users to run relay init, relay agent register, etc. But install.sh (the recommended installer) only wrote $BIN_DIR/agent-relay, so after curl ... install.sh | bash, relay is "command not found".
Change
install.shwrites$BIN_DIR/relaywith the same body as theagent-relaylauncher (same env lines; standalone and node/source variants), via a newwrite_launchershelper.- Both launchers now carry a marker line:
# agent-relay launcher (written by the Agent Relay installer). (There was no marker before; install.sh only knew its launcher by path.) - Same transaction: an existing installer-written
relayis backed up before the standalone install and restored byundo_clion any rollback (rejected/unavailable broker, INT/TERM/HUP), or removed if it did not exist before. A failed install leaves both launchers untouched; a successful one updates both. - Foreign
relay: if$BIN_DIR/relayexists without the marker, it is never backed up, replaced or removed (including on rollback), and the installer warns once:... was not installed by Agent Relay; leaving it alone. Use \agent-relay` instead of `relay`.It never fails the install. npm's ownrelaysymlink (.../node_modules/agent-relay/...) is left alone with an info line instead of the warning. If ourrelaycannot be backed up, onlyrelay` is skipped (install proceeds). verify_installationwarns if anotherrelaycomes earlier on the original PATH; the usage footer lists both launchers.agent-relay uninstall(core-maintenance.ts) now also removes~/.local/bin/relay, but only when it carries the marker. install.sh itself has no uninstall path.- Standalone CLI invoked through
relay: the launcherexecs the binary by path, so argv[0]/program name is unchanged (help showsUsage: agent-relay ..., same as npm'srelaybin).
Tests
scripts/test-install-atomic.sh: both launchers created and identical,relay --versionruns the new CLI; upgrade replaces our olderrelay; rejected broker restores both launchers byte-identical (and removes both on a fresh install); foreignrelaypreserved byte-identical with a single warning on success and on rollback, install still exits 0; npmrelaysymlink left alone without the warning;relaybackup failure skips onlyrelay; every signal-window case (TERM/INT/HUP during broker download, smoke test, between copies, read-back hash) now also asserts therelaylauncher is byte-identical; source launcher also writesrelay. 252 pass; the only failure is the pre-existingsha256_of falls back to shasum only(noshasumon the test machine; fails on main too).core.test.ts: uninstall removes ourrelaylauncher, keeps a foreign one.install-script.test.ts: both launcher variants carry the marker; install.sh'sLAUNCHER_MARKERmatches the constantuninstallchecks.- shellcheck: no new findings beyond one more SC2329 note of the existing kind (indirectly invoked test override).
- E2E in
node:22docker with this branch's install.sh against the current release (v14.0.0):relay --version→14.0.0,agent-relay --version→14.0.0,relay --helpworks; re-run updates both; with a foreignrelayin~/.local/bin, it is kept and the warning is printed.
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Agent Relay sessions