Repository navigation
feat(install): one-line PowerShell install (install.ps1) - #253
Conversation
irm https://raw.githubusercontent.com/redrob-labs/redrob-code/main/install.ps1 | iex installs redrob.exe into %USERPROFILE%\.redrob\bin, verified against the release's SHA256SUMS.txt. redrob upgrade on a Windows curl install now re-runs Console's install.ps1 through PowerShell instead of piping install.sh into a bash that Windows does not have.
Console's /code/install.ps1 calls Invoke-WebRequest without -UseBasicParsing, so under Windows PowerShell 5.1 with -NonInteractive it cannot read SHA256SUMS.txt and refuses every upgrade.
|
Self-review: The riskiest part is the iex contract. install.ps1 has no param block and never calls exit, and test/installation/install-ps1.test.ts guards both, because a stray exit closes the user's PowerShell window. The script is ASCII only, with the Korean line stored as base64 UTF-8, so Windows PowerShell 5.1 reads it the same in any code page. I checked that on a cp949 PC with -File. PATH edits go only to HKCU\Environment and keep REG_EXPAND_SZ. I restored the PC's PATH byte for byte after testing. The upgrade change only affects win32 'curl' installs, which could never upgrade before because they piped install.sh into a bash that is missing. Linux and macOS still use Console's install.sh unchanged. One follow-up belongs outside this repo: Console's /code/install.ps1 needs -UseBasicParsing on its Invoke-WebRequest calls, otherwise it cannot verify checksums under PS 5.1 -NonInteractive. |
What's done
install.ps1at the repo root:irm https://raw.githubusercontent.com/redrob-labs/redrob-code/main/install.ps1 | iex, or& ([scriptblock]::Create((irm <url>))) -Version x.y.z. It followsinstall: picksredrob-windows-x64.zip,-x64-baseline.zip(no AVX2) or-arm64.zip, takes the latest version fromreleases/latest/download/VERSIONor-Version/REDROB_VERSION, checks the zip against the release'sSHA256SUMS.txt, and installsredrob.exe+redrob-code.exeinto%USERPROFILE%\.redrob\bin. That is where Redrob Desktop (enginesetup.rs) andisCurlInstalllook. It puts the folder first on the user PATH (HKCU only, kept as REG_EXPAND_SZ) and in the current session, and prints the next step (redrob, then/connect) in English and Korean. Options:-InstallDir/REDROB_INSTALL_DIR,-NoModifyPath/REDROB_NO_MODIFY_PATH=1,-Binary/REDROB_CODE_BIN,-Connect/REDROB_CONNECT. It also reads install.sh'sREDROB_CODE_*names.redrob upgradeon a Windowscurlinstall (~\.redrob\bin) now downloadsinstall.ps1and runs it withpowershell.exe -File(the file starts with a UTF-8 BOM). Before this, it piped Console's install.sh intobash/sh. Windows usually has neither, and install.sh refuses to run on Windows anyway. A runningredrob.exeis renamed to.oldand the new one is copied in.unknown-method message suggests theirm ... | iexline on Windows.test/installation/install-ps1.test.tschecks that the script has no param block and noexit, is ASCII only, uses the right install dir, env names, asset names and checksum file, and writes HKCU only. Whenpwshis installed it also checks that the script parses.installation.test.tschecks the Windows upgrade path.What's not done
/code/install.ps1(redrob-console). It fails under Windows PowerShell 5.1 with-NonInteractive:Invoke-WebRequestwithout-UseBasicParsingcannot read SHA256SUMS.txt, so it says "No checksums published" and installs nothing (reproduced on a Windows 11 PC). That is why upgrade uses this repo's script.pwshexists.installscript still does not verify checksums (unchanged).What to review
install.ps1: the whole script is one& { ... } @argsblock, soiexleaves no variables behind. Errorsthrowinstead of callingexit, which would close the user's window.packages/redrob/src/installation/index.ts:upgradeScriptUrl/reinstallCommandand the win32 branch ofupgradeCurl.Intentions
Windows users get the same one-line install as macOS/Linux users, without bash or admin rights, into the folder Desktop and
redrob upgradealready use.Verification
bun typecheckpassed.bun test test/installation: 31 pass, 1 skip (pwsh parse), 0 fail. Fullpackages/redrobsuite: 3573 pass, 2 fail. Both failures (event-manifest,transform-wire-body) also fail on origin/develop 7aabeeb.irm <branch raw url> | iexinstalled 0.18.16 andredrob --versionprinted 0.18.16. The folder went first on the user PATH, andredrobresolved to it in the same session. Running it again printed "already installed".-Version 0.18.15 -InstallDir ... -NoModifyPathprinted 0.18.15.-Version 9.9.9threw a clear error, the session stayed open and nothing was installed.powershell -Filewith the env vars installed and printed the Korean line correctly, so the ASCII + base64 approach works.-NonInteractive -File,REDROB_CODE_VERSION/REDROB_CODE_INSTALL_DIR) upgraded 0.18.15 to 0.18.16 while thatredrob.exe servewas running.