fix(install): expose `altimate-code` from the standalone installers
HK
2h ago+923+923+012345678901234567890123456789-28-28-01234567890123456789
Issue for this PR
Closes #1563
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
install(curl one-liner): adds~/.altimate/bin/altimate-codeas a relative symlink toaltimate. This happens after a download, after a--binaryinstall, and on the "already installed" exit, so re-running the one-liner (oraltimate upgrade) also fixes existing installs. On that exit, the alias is only refreshed when the matching binary is the one in~/.altimate/bin, so it never runs a different version than the one just checked. Before, the script deleted anyaltimate-codeit found there.ln -sfnoverwrites a pre-v0.7.1altimate-codebinary, so that name can't run a stale build. It also replaces a link to a directory instead of writing into it.- A real directory at that path is left alone, with a warning.
- A
--binarywith an unrelated basename gets no alias.
install.ps1: writes two shims next toaltimate.exe, both after install and on the "already installed" exit (with the same local-match rule; the install dir is compared as normalized paths in PowerShell and by identity with-efin bash, so a symlinked HOME or a trailing slash in PATH still matches). Shims follow the binary across upgrades (which rename the running exe aside) and need no symlink privilege.altimate-code.cmd("%~dp0altimate.exe" %*,exit /b %ERRORLEVEL%) for cmd.exe and PowerShell.- An extensionless
shshim for Git Bash/MSYS shells, which don't use PATHEXT. npm also writes a.ps1shim; it's left out because an execution policy that blocks scripts would break the name. Like every.cmdshim, the.cmdpasses arguments throughcmd.exe(%VAR%expands, unquoted& | ^are interpreted), so the README tells scripts to callaltimate. - An existing file or link at a shim path is replaced, never written through. Order: the
.cmdfirst; then a strayaltimate-code.exe, which PATHEXT would otherwise put in front of the.cmd, is removed once the.cmdexists; then the sh shim. A failed.cmdwrite leaves the old.exeand the sh shim as they were. - A leftover
altimate-code.exe.oldis cleaned up. - Alias failures only warn; they never abort the install.
altimate uninstall: for curl installs, the summary (including--dry-run) and the manual-removal hint list the other installer files that exist in~/.altimate/bin: every alias form (including leftoveraltimate-code.exe.old/altimate.exe.old), plusaltimate.exewhen you're running from a copiedaltimate-code.exe. Directories are never listed, and nothing outside that directory is either, so an unrelatedaltimate-codein~/.local/binis never named. On Windows the commands areRemove-Item -LiteralPath '…' -Force(PowerShell), elsewhererm '…'; paths are single-quoted literals, so$, backticks or quotes in them are never expanded.- Docs: README and the troubleshooting page no longer say the standalone install exposes only
altimate.
How did you verify your code works?
- The real one-liner, end to end on macOS arm64.
cat install | bash(whatcurl … | bashruns) with a throwaway HOME and a system-only PATH, downloading the real v0.12.7 release with its checksum verified:- Fresh install: creates
~/.altimate/bin/altimate-code -> altimate, andaltimate-code --versionprints0.12.7. - Default flags: the installer adds
~/.altimate/binto.zshrc, and a freshzsh -ifindsaltimate-code. - Pre-fix install, re-run: the alias is added on the "Version 0.12.7 already installed" path, with no re-download.
- Stale legacy
altimate-codebinary, re-run: it is replaced by the alias. - Repeated re-run: still exactly one link.
- Control: the same test against
main's installer leaves onlyaltimate, andaltimate-codeiscommand not found.
- Fresh install: creates
packages/opencode/test/install/install-alias.test.tsruns the real bash installer against a throwaway HOME. It covers:--binary;- an offline download, with a curl stub serving a local release archive;
- the already-installed exit;
- a stale
altimate-codebinary; - re-runs;
- a link to a directory, and a real directory, at the alias path;
altimate.exe→altimate-code.exe;- an unrelated
--binaryname.
packages/opencode/test/cli/uninstall-hint.test.tscovers the uninstall hint list for Unix, Windows, a copied alias, and directories outside~/.altimate/bin.test/windows/install.Tests.ps1extractsInstall-Aliasfrom the script's syntax tree and covers:- the content of both shims;
- the
.cmdshim running for real, withcmd.exestanding in foraltimate.exe, checking arguments and exit code; - a hard link, and a junction or directory link, at the shim path;
- keeping
altimate-code.exe, and the Git Bash shim, when the.cmdcan't be written; .oldcleanup.
- Locally with pwsh 7.6 + Pester 6.2: 17 pass, 2 skipped. The skipped ones (
cmd.exeexecution, a Windows directory symlink) only run on Windows; CI's Pester job runs them onwindows-latest. - The extensionless shim ran under a real
shfrom a path containing a space."a b","%PATH%","^&!","$HOME"and""were all forwarded unchanged, and exit code 7 propagated. - Each new regression test was checked by removing the code it guards and confirming the test fails.
bun test test/install test/cli/uninstall-hint.test.ts test/skill/release-v0.7.1-binary-adversarial.test.ts test/skill/release-v0.7.2-adversarial.test.ts test/branding test/upstream: 1131 pass. Typecheck and prettier pass.
Follow-ups (not changed here)
check_versionand "already installed": it treats anyaltimate/altimate-codeon PATH at the requested version as "already installed" and exits, even when that binary is outside~/.altimate/bin(e.g. an npm or Homebrew install). That predates this PR. Here the alias is only refreshed when the match is the local binary.- Windows PowerShell 5.1:
altimate upgradeand the documented one-liner run under 5.1, but CI's Pester job runs onlypwsh7. A secondshell: powershellrun would cover it. - 8.3 short-name PATH entries aren't expanded by the local-match check. Such an install skips the alias on the "already installed" exit; it never aliases the wrong binary.
- Plugin docs: the "curl, Homebrew and PowerShell installers install only
altimate" wording in altimate-claude-plugin#8 and altimate-codex-plugin#5 should be updated once this merges.
Cost side effects
None.
Screenshots / recordings
N/A, not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
🤖 Generated with Claude Code
Summary by CodeRabbit
-
New Features
- Standalone installations now provide an
altimate-codealias alongsidealtimate. - Windows installations support command-line and MSYS shell aliases, with safer handling of existing files.
- Uninstall guidance now identifies and removes installer-created companion files.
- Standalone installations now provide an
-
Bug Fixes
- Reinstalling or updating now refreshes aliases to point to the correct executable.
- Existing installations avoid creating aliases for unrelated binaries or conflicting directories.
-
Documentation
- Updated installation and troubleshooting guidance explains alias availability, Windows behavior, and compatibility with older releases.