feat(cli): add install scripts for macOS, Linux, and Windows#587
feat(cli): add install scripts for macOS, Linux, and Windows#587shadowfax92 merged 3 commits intomainfrom
Conversation
Bash script (install.sh) for macOS/Linux and PowerShell script (install.ps1) for Windows. Both download the correct platform binary from GitHub Releases with checksum verification, version resolution, and PATH setup.
|
@greptileai review |
|
@claude review |
|
Claude finished @shadowfax92's task in 1m 25s —— View job Code Review
Overall the scripts are well-structured with good platform detection and argument handling. Here are the findings:
|
| Issue | Severity | File |
|---|---|---|
| No checksum verification in PS1 | High | install.ps1 |
| Checksum silently skipped when tools missing | Medium | install.sh |
Partial grep match on filename |
Medium | install.sh |
| API pagination (30 vs 100 per page) | Medium | install.ps1 |
| Fixed temp dir (concurrency issue) | Low | install.ps1 |
| GoReleaser archive structure assumption | Low | install.sh |
No GITHUB_TOKEN support |
Low | both |
| Auto PATH modification vs hint | Low | install.ps1 |
The bash script is in good shape with minor fixes needed. The PowerShell script needs checksum verification added before this is production-ready.
Greptile SummaryThis PR adds cross-platform install scripts ( Confidence Score: 4/5Safe to merge; previous critical gaps (missing Windows checksum, silent skip paths) are resolved — remaining items are a minor dead-code cleanup and a defensive awk tweak. Prior review concerns are fully addressed, the logic is sound end-to-end, and there are no security regressions. The two remaining findings are a P2 style issue (unreachable exit 1 lines) and a low-probability silent-skip edge case in checksum matching, neither of which affects correctness in the tested happy path. Both files are low risk; install.sh deserves a quick look at the awk checksum field matching if checksums.txt generation changes in the future. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Script as install.sh / install.ps1
participant GH_API as GitHub Releases API
participant GH_DL as GitHub Download CDN
User->>Script: run (optional --version / -Version)
alt Version not specified
Script->>GH_API: GET /releases?per_page=100
GH_API-->>Script: release list (JSON)
Script->>Script: filter browseros-cli-v*, exclude -rc, take first
end
Script->>Script: detect OS + arch (uname / RuntimeInformation)
Script->>GH_DL: GET /{tag}/{binary}_{ver}_{os}_{arch}.tar.gz|zip
GH_DL-->>Script: archive bytes → TmpDir
Script->>GH_DL: GET /{tag}/checksums.txt
alt checksums.txt available
GH_DL-->>Script: checksums.txt
Script->>Script: awk/foreach exact-field match on filename
alt hash found
Script->>Script: sha256sum/Get-FileHash → compare
alt mismatch
Script-->>User: Error: checksum mismatch → exit
end
Script-->>User: Checksum verified
else hash not found
Script-->>User: Warning: checksum not found, skipping
end
else fetch failed
Script-->>User: Warning: could not fetch checksums.txt, skipping
end
Script->>Script: extract archive → find binary
Script->>Script: mv binary → INSTALL_DIR / Move-Item
Script->>Script: chmod +x (bash) / update user PATH (both)
Script-->>User: Installed! Run browseros-cli --help
Prompt To Fix All With AIThis is a comment left during a code review.
Path: packages/browseros-agent/apps/cli/scripts/install.ps1
Line: 38-41
Comment:
**Unreachable `exit 1` statements — dead code**
Because `$ErrorActionPreference = "Stop"` is set at the top of the script, every `Write-Error` call immediately throws a terminating exception. The `exit 1` lines that follow can never be reached. The `finally` block still runs correctly (exception propagation triggers it), so cleanup is fine — but the four `exit 1` calls are dead code and can be removed.
Affected locations:
- Line 40 — after `Write-Error "Could not determine latest version..."`
- Line 63 — after `Write-Error "32-bit Windows is not supported."`
- Line 105 — after `Write-Error "Checksum mismatch..."`
- Line 118 — after `Write-Error "Binary not found in archive."`
```suggestion
if (-not $tag) {
Write-Error "Could not determine latest version. Try: -Version 0.1.0"
}
```
The same pattern applies to lines 62-64, 104-106, and 117-119.
**Rule Used:** Remove unused/dead code rather than leaving it in ... ([source](https://app.greptile.com/review/custom-context?memory=9b045db4-2630-428c-95b7-ccf048d34547))
**Learnt From**
[browseros-ai/BrowserOS-agent#126](https://github.com/browseros-ai/BrowserOS-agent/pull/126)
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: packages/browseros-agent/apps/cli/scripts/install.sh
Line: 95
Comment:
**`awk` checksum lookup assumes bare filename in `checksums.txt`**
`awk '$2 == filename'` performs an exact match against the second whitespace-delimited field. The `sha256sum` and `shasum` tools prepend `./` to filenames when they are fed a path (e.g., `sha256sum ./file.tar.gz` → `abc123 ./file.tar.gz`). If whoever generated `checksums.txt` for the release ran `sha256sum` on a relative path, the second field would be `./browseros-cli_0.1.0_linux_amd64.tar.gz` and the match would silently fail — falling through to the "Warning: checksum not found" branch instead of verifying.
The PR description notes the live format was manually verified for `v0.1.0`, so this is benign today, but it's fragile across releases. Consider also matching on a trailing-component basis:
```bash
expected=$(awk -v filename="$FILENAME" '
$2 == filename || $2 == "./" filename { print $1; exit }
' "${TMPDIR_DL}/checksums.txt")
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (2): Last reviewed commit: "fix(cli): address installer review feedb..." | Re-trigger Greptile |
- Add checksum verification to install.ps1 using Get-FileHash - Add warnings on all checksum skip paths in install.sh - Use grep -F (fixed-string) instead of regex for filename matching - Add ?per_page=100 to GitHub API call in install.ps1 - Use random temp directory name in install.ps1 to avoid collisions
|
@greptileai review |
|
@claude review |
|
Claude finished @shadowfax92's task in 1m 57s —— View job Code Review
The previous review feedback has been well addressed. Here's the current state: What Was Fixed ✅
Remaining Items
SummaryThe high and medium severity issues from the prior review are resolved. The remaining items are all low priority. The scripts are in good shape for an initial release — the |
Summary
browseros-clion macOS, Linux, and Windowschecksums.txtbefore install when checksum data is availableRework
Addressed the PR review feedback by tightening checksum handling and archive extraction behavior instead of widening scope. Windows installs now verify the downloaded zip, bash warns on every skipped verification path, and both scripts tolerate nested archive layouts.
Test plan
bash packages/browseros-agent/apps/cli/scripts/install.sh --version 0.1.0 --dir "$TMPDIR/bin"browseros-cli --helpafter install from the script output pathchecksums.txtformat forbrowseros-cli-v0.1.0.\install.ps1 -Version "0.1.0"on Windows