hey
HEY integration for Claude Code. Read email, manage todos, track time.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 11 Nov 2026.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/basecamp/hey-cli with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/basecamp/hey-cli'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/basecamp--hey-cli)HTML
<a href="/listings/basecamp--hey-cli"><img src="/api/listings/basecamp--hey-cli/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
These steps run a script from the network that findsafeskills does not scan.
**mise**
mise use -g github:basecamp/hey-cli
**Omarchy**
omarchy-mise-install github:basecamp/hey-cli hey
**macOS / Linux / WSL2**
curl -fsSL https://hey.com/install-cli | bash
**Windows (PowerShell)**
irm https://hey.com/install-cli.ps1 | iex
Homebrew, Scoop, Nix, packages and source builds: [docs/install.md](docs/install.md).
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
.claude-plugin/plugin.json · Manifest · 12 lines
- {
- "name": "hey",
- "version": "1.13.1",
- "description": "HEY integration for Claude Code. Read email, manage todos, track time.",
- "author": {
- "name": "37signals",
- "email": "support@37signals.com"
- },
- "homepage": "https://github.com/basecamp/hey-cli",
- "repository": "https://github.com/basecamp/hey-cli",
- "license": "MIT"
- }
README.md · README · 119 lines · 2 findings marked
- # HEY! It's the command-line interface!
- ```
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡿⠏⠻⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣶⣤⠀⠀⠀⣿⠃⠀⠀⠘⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⠉⠹⣷⣄⠀⣿⡀⠀⠀⠀⠈⢿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣶⣶⣶⣶⣶⠀⠀⠀⠀⠀⠀⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⡀⠀⠀⠀⠀⢠⣶⣶⣶⣶⣶⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⣿⡆⠀⠘⣿⣦⣿⡇⠀⠀⠀⠀⠘⣿⡆⠀⠀⢀⣀⣀⣀⡀⠀⠸⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⣾⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⣾⡿⣷⣄⢻⣧⠀⠀⠈⢿⣿⣷⡆⠀⠀⠀⠀⢸⣿⣠⣶⠿⠛⠛⠛⣿⣆⠀⢹⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⡏⠉⠉⠉⠉⠉⠉⠙⠻⣿⣿⣿⣿⣆⠀⠀⣸⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠘⢿⣾⣿⡆⠀⠀⠈⢿⣿⣧⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⠀⠀⢸⣿⠀⠀⣿⣿⣿⣿⣄⣀⣀⣀⣀⣠⣿⣿⣿⣿⣿⣧⣀⣀⣀⣀⡀⠀⠀⠀⢹⣿⣿⣿⣿⡄⢰⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⢸⣷⠀⠀⠻⣿⣿⡄⠀⠀⠈⢿⣿⡆⠀⠀⠀⢸⣿⣿⠀⠀⠀⠀⠀⢸⣿⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⢻⣿⣿⣿⣷⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣇⠀⠀⠘⢿⣷⡀⠀⠀⠘⠻⣿⡀⠀⠀⣿⡏⣿⡇⠀⠀⠀⠀⢸⣿⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⣾⡿⢿⣾⣿⣆⠀⠀⠈⢻⣷⡀⠀⠀⠀⠉⠀⠀⢀⣿⠃⢹⣧⠀⠀⠀⠀⣿⡇⠀⢸⣿⣿⣿⣿⠁⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⢹⣧⠀⠙⢿⣿⣆⠀⠀⠀⠹⠷⠀⠀⠀⠀⠀⠀⢸⣿⠀⢸⣿⠀⠀⠀⢸⣿⠀⠀⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣽⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⢿⣧⠀⠀⠙⢿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⢸⣿⠀⠀⢀⣿⠇⠀⢸⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠈⢻⣷⡀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣧⣾⡏⠀⠀⣼⡟⠀⠀⠸⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⢻⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⢿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⣷⣦⣄⣀⡀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠛⠛⠻⠟⠛⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
- ```
- A CLI and TUI for HEY: your email and calendar, in the terminal and in your coding agent's hands.
- ## Install
- **mise**
- ```bash
- mise use -g github:basecamp/hey-cli
- ```
- **Omarchy**
- ```bash
- omarchy-mise-install github:basecamp/hey-cli hey
- ```
- **macOS / Linux / WSL2**
- ```bash
- curl -fsSL https://hey.com/install-cli | bash
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 41 on GitHub
- ```
- **Windows (PowerShell)**
- ```powershell
- irm https://hey.com/install-cli.ps1 | iex
- Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
- Line 47 on GitHub
- ```
- Homebrew, Scoop, Nix, packages and source builds: [docs/install.md](docs/install.md).
- ## Getting started
- ```bash
- hey # sign in with your browser and connect your coding agents
- hey tui # open the app
- ```
- The app has Mail, Contacts, Calendar and Journal, with HEY's own keyboard shortcuts.
- Press `?` to see them. It follows HEY live: a thread you archive on your phone leaves the
- screen a moment later.
- ## Using the CLI
- ```bash
- hey box view imbox # threads in a box
- hey thread read 12345 # a whole thread, as Markdown
- hey reply 12345 -m "Friday works for me."
- hey compose --to alice@example.com --subject "Lunch?" -m "Thursday at noon?"
- hey search --from jane@example.com --date last_30_days
- hey screener list # first-time senders waiting on you
- hey event add "Design review" --starts-on 2026-09-02 --start-time 14:00
- hey watch --box imbox --events new # a line of JSON for every new email, as it lands
- ```
- Every command explains itself with `--help`. At a terminal the output is made for reading.
- Piped, a command that returns data writes JSON, and `--jq` filters it without a separate
- `jq`:
- ```bash
- hey box view imbox --jq '.data.postings[] | {topic_id, subject}'
- hey label view 789 --ids-only # one ID per line, for xargs
- ```
- ## Coding agents
- The setup wizard connects the agents it finds. To do it yourself:
- ```bash
- hey setup claude # skill + the hey@37signals plugin for Claude Code
- hey setup codex # skill for Codex
- hey auth login --mcp && claude mcp add hey -- hey mcp # HEY as MCP tools, on hey mcp's own sign-in
- ```
- `hey mcp` saves drafts, and sends one only when you confirm that email in your MCP client.
- ## Docs
- - [docs/install.md](docs/install.md): installing, upgrading, completions, Windows
- - [docs/tui.md](docs/tui.md): the app and its keys
- - [docs/cli.md](docs/cli.md): every command, the output formats, and `hey watch`
- - [docs/agents.md](docs/agents.md): the skill, the plugin and the MCP server
- - [docs/omarchy.md](docs/omarchy.md): the Omarchy integration
- Something wrong? `hey doctor` checks the install, sign-in and agent setup.
- ## Development
- ```bash
- make build # build ./bin/hey
- make test # run tests
- make lint # run golangci-lint
- ```
- [CONTRIBUTING.md](CONTRIBUTING.md) has the rest. [STYLE.md](STYLE.md) is the Go style.
- ## License
- MIT. See [LICENSE.md](LICENSE.md).
scripts/install.ps1 · Bundled script · 463 lines · 2 findings marked
- # The documented install path is `irm ... | iex`, and Invoke-Expression
- Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
- Line 1 on GitHub
- # evaluates this file in the caller's scope. The invoked script block below
- # gives the installer its own scope, so $ErrorActionPreference and the helper
- # functions do not leak into (or clobber) the interactive session. The body
- # stays unindented: the here-strings' closing "@ must sit at column zero.
- & {
- $ErrorActionPreference = 'Stop'
- try {
- [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
- } catch {
- # Ignore when the runtime manages TLS defaults.
- }
- # Environment options:
- # HEY_VERSION Specific version to install (default: latest)
- # HEY_BIN_DIR Where to install the binary
- # HEY_SKIP_SETUP Set to 1 to skip the interactive setup wizard (still runs
- # `hey setup agents` to install the agent skill and connect
- # coding agents without prompting)
- # HEY_SETUP_AGENT Which coding agent(s) `setup agents` connects:
- # claude | codex | all | none (default: auto-detect)
- #
- # This file must stay pure ASCII: the release pipeline stages and
- # Authenticode-signs a CRLF copy of it, and Windows PowerShell 5.1 decodes a
- # BOM-less file as Windows-1252 while jsign assumes UTF-8, so any byte above
- # 0x7F makes the two digests disagree (HashMismatch).
- $Repo = 'basecamp/hey-cli'
- $Version = $env:HEY_VERSION
- $BinDir = $env:HEY_BIN_DIR
- $SkipSetup = $env:HEY_SKIP_SETUP
- function Step([string]$Message) {
- Write-Host " -> $Message"
- }
- function Info([string]$Message) {
- Write-Host " + $Message" -ForegroundColor Green
- }
- function Fail([string]$Message) {
- throw $Message
- }
- function Get-PlatformArch {
- $arch = $env:PROCESSOR_ARCHITECTURE
- if ($env:PROCESSOR_ARCHITEW6432) {
- $arch = $env:PROCESSOR_ARCHITEW6432
- }
- switch -Regex ($arch) {
- '^(AMD64|x86_64)$' { return 'amd64' }
- '^ARM64$' { return 'arm64' }
- default { Fail "Unsupported Windows architecture: $arch" }
- }
- }
- function Get-LatestVersion {
- Step 'Resolving latest release version...'
- # Follow the releases/latest redirect first to avoid GitHub API rate limits.
- # -MaximumRedirection 0 turns the expected 302 into a terminating error, so
- # we read Location off the caught response. Headers.Location is Uri on
- # PowerShell Core and string on Windows PowerShell 5.1, so coerce to string.
- $location = $null
- try {
- $response = Invoke-WebRequest -MaximumRedirection 0 -UseBasicParsing `
- -Headers @{ 'User-Agent' = 'hey-cli-installer' } `
- -Uri "https://github.com/$Repo/releases/latest" -ErrorAction Stop
- $location = $response.Headers.Location
- } catch {
- if ($_.Exception.Response) {
- $location = $_.Exception.Response.Headers.Location
- if (-not $location) {
- $location = $_.Exception.Response.Headers['Location']
- }
- }
- }
- if ($location) {
- $tag = ([string]$location).TrimEnd('/').Split('/')[-1]
- $candidate = $tag.TrimStart('v')
- if ($candidate -match '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$') {
- return $candidate
- }
- }
- # Fall back to the GitHub API if the redirect path didn't yield a semver tag.
- $release = Invoke-RestMethod -ErrorAction Stop `
- -Headers @{ 'User-Agent' = 'hey-cli-installer' } `
- -Uri "https://api.github.com/repos/$Repo/releases/latest"
- if (-not $release.tag_name) {
- Fail 'Could not determine latest release version from GitHub.'
- }
- return $release.tag_name.TrimStart('v')
- }
- function Download-File([string]$Url, [string]$Destination) {
- # -UseBasicParsing avoids initializing IE's MSHTML parser on Windows
- # PowerShell 5.1 -- required on Server Core and locked-down installs.
- # No-op on PowerShell 6+, where basic parsing is the only mode.
- Invoke-WebRequest -UseBasicParsing -ErrorAction Stop `
- -Headers @{ 'User-Agent' = 'hey-cli-installer' } `
- -Uri $Url -OutFile $Destination
- }
- function Verify-Checksum([string]$ChecksumsPath, [string]$ArchivePath, [string]$ArchiveName) {
- $expected = $null
- foreach ($line in Get-Content $ChecksumsPath) {
- if ($line -match '^(?<hash>[0-9a-fA-F]{64})\s+\*?(?<name>.+)$') {
- if ($Matches.name -eq $ArchiveName) {
- $expected = $Matches.hash.ToLowerInvariant()
- break
- }
- }
- }
- if (-not $expected) {
- Fail "Could not find checksum entry for $ArchiveName"
- }
- $actual = (Get-FileHash -Algorithm SHA256 -Path $ArchivePath).Hash.ToLowerInvariant()
- if ($actual -ne $expected) {
- Fail "Checksum verification failed for $ArchiveName"
- }
- Info 'Checksum verified'
- }
- # Get-CosignBundleSupport decides how to verify the release's Sigstore bundle,
- # which is the new (protobuf, v0.3+json) format:
- # v3+ -> new-format parsing is the default; no extra flag ('')
- # v2.6 - v2.x -> needs '--new-bundle-format=true' (v2.x defaults it to false)
- # < v2.6 / unparseable -> $null: cannot verify (v2.4 chokes on the bundle's
- # tlog key type, v2.2 lacks the flag); caller warns and skips
- function Get-CosignBundleSupport {
- try { $versionOutput = & cosign version 2>$null } catch { return $null }
- foreach ($line in @($versionOutput)) {
- if ("$line" -match 'GitVersion:\s*v?(\d+)\.(\d+)\.') {
- $major = [int]$Matches[1]
- $minor = [int]$Matches[2]
- if ($major -ge 3) { return '' }
- if ($major -eq 2 -and $minor -ge 6) { return '--new-bundle-format=true' }
- return $null
- }
- }
- return $null
- }
- function Verify-CosignSignature([string]$Version, [string]$BaseUrl, [string]$TmpDir) {
- if (-not (Get-Command cosign -ErrorAction SilentlyContinue)) {
- return
- }
- $bundleFlag = Get-CosignBundleSupport
- if ($null -eq $bundleFlag) {
- Step "Skipping signature verification: this cosign can't verify the release bundle format (need cosign >= 2.6)"
- return
- }
- Step 'Verifying cosign signature...'
- $bundlePath = Join-Path $TmpDir 'checksums.txt.bundle'
- $checksumsPath = Join-Path $TmpDir 'checksums.txt'
- Download-File -Url "$BaseUrl/checksums.txt.bundle" -Destination $bundlePath
- $cosignArgs = @('verify-blob', '--bundle', $bundlePath)
- if ($bundleFlag) {
- $cosignArgs += $bundleFlag
- }
- $cosignArgs += @(
- '--certificate-identity', "https://github.com/basecamp/hey-cli/.github/workflows/release.yml@refs/tags/v$Version",
- '--certificate-oidc-issuer', 'https://token.actions.githubusercontent.com',
- $checksumsPath
- )
- # Native exits don't trigger ErrorActionPreference=Stop on Windows PowerShell 5.1,
- # so check $LASTEXITCODE explicitly -- otherwise a verify failure would false-green.
- & cosign @cosignArgs
- if ($LASTEXITCODE -ne 0) {
- Fail 'Cosign signature verification failed'
- }
- Info 'Signature verified'
- }
- # Get-FirstRunFailureMessage diagnoses why running the freshly installed
- # hey.exe failed. It best-effort probes the binary's Authenticode status and
- # the Smart App Control state (Smart App Control blocks unsigned executables
- # at process creation). Every branch leads with the original failure:
- # diagnosis augments, never masks, the underlying error. PowerShell
- # 5.1-compatible.
- function Get-FirstRunFailureMessage([string]$Binary, [string]$Reason) {
- $sigStatus = $null
- try {
- $sigStatus = (Get-AuthenticodeSignature -FilePath $Binary -ErrorAction Stop).Status
- } catch { }
- # Smart App Control state: 0 = off, 1 = on, 2 = evaluation mode. Only 1
- # enforces; evaluation mode observes without blocking, so it must not
- # claim the failure.
- $sacState = $null
- try {
- $policy = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy' -ErrorAction Stop
- $sacState = $policy.VerifiedAndReputablePolicyState
- } catch { }
- $lead = "Installed hey.exe to $Binary, but running it failed: $Reason"
- if ("$sigStatus" -eq 'NotSigned' -and $sacState -eq 1) {
- return @"
- $lead
- This build of hey.exe is not code-signed, and Smart App Control is enabled. Smart App Control blocks unsigned executables no matter where they were downloaded from, and it has no per-app exceptions. Two options:
- 1. (Preferred) Install the Linux build inside WSL2 - Smart App Control does not apply there and your Windows security setup is untouched:
- wsl --install
- then, inside the WSL terminal:
- curl -fsSL https://hey.com/install-cli | bash
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 223 on GitHub
- 2. Turn Smart App Control off (Windows Security > App & browser control > Smart App Control settings) and leave it off while using this unsigned build. Because there are no per-app exceptions, turning it back on re-blocks hey.exe on its next run - only re-enable after upgrading to a signed release. Windows 11 with the March/April 2026 updates can re-enable Smart App Control from Windows Security without a reset; on older builds re-enabling requires resetting Windows, so prefer the WSL2 option there.
- "@
- }
- if ("$sigStatus" -eq 'NotSigned') {
- return @"
- $lead
- This build of hey.exe is not code-signed, and Windows Security or SmartScreen may have blocked or quarantined it. Check Windows Security > Protection history for a block or quarantine event, restore or allow hey.exe, then re-run the installer.
- "@
- }
- return @"
- $lead
- If Windows Security or antivirus interfered, check Windows Security > Protection history, restore or allow hey.exe, then re-run the installer.
- "@
- }
- function Get-PathEntries {
- param([string]$PathValue)
- if (-not $PathValue) {
- return @()
- }
- return $PathValue -split ';' | Where-Object { $_ }
- }
- function Normalize-PathEntry([string]$PathValue) {
- if (-not $PathValue) {
- return ''
- }
- return $PathValue.Trim().TrimEnd('\')
- }
- function Get-DefaultBinDir {
- $currentPathEntries = Get-PathEntries $env:Path
- $userPathEntries = Get-PathEntries ([Environment]::GetEnvironmentVariable('Path', 'User'))
- $allEntries = @($currentPathEntries + $userPathEntries) | ForEach-Object { Normalize-PathEntry $_ }
- $homeBin = Normalize-PathEntry (Join-Path $HOME 'bin')
- $homeLocalBin = Normalize-PathEntry (Join-Path $HOME '.local\bin')
- if ($allEntries -contains $homeBin) {
- return $homeBin
- }
- if ($allEntries -contains $homeLocalBin) {
- return $homeLocalBin
- }
- return $homeBin
- }
- function Ensure-UserPath([string]$Dir) {
- $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
- $segments = Get-PathEntries $userPath
- $normalizedSegments = $segments | ForEach-Object { Normalize-PathEntry $_ }
- $normalizedDir = Normalize-PathEntry $Dir
- if ($normalizedSegments -contains $normalizedDir) {
- return
- }
- $newPath = if ($userPath) { "$Dir;$userPath" } else { $Dir }
- [Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
- $env:Path = "$Dir;$env:Path"
- Info "Added $Dir to your user PATH"
- }
- function Test-InteractiveSession {
- if ($Host.Name -ne 'ConsoleHost' -and $Host.Name -ne 'Visual Studio Code Host') {
- return $false
- }
- try {
- return -not [Console]::IsInputRedirected -and -not [Console]::IsOutputRedirected
- } catch {
- return $false
- }
- }
- # Invoke-PostInstallSetup connects coding agents without prompting, but only
- # when the installed binary has the ownership-aware `setup agents` (it honors
- # HEY_SETUP_AGENT itself). Releases that predate `setup agents` also predate
- # the ownership gate on `skill install`, so the installer never invokes an
- # old binary's legacy setup or skill commands - the printed next steps are
- # the fallback. Best-effort: a failure here must not fail the install.
- function Invoke-PostInstallSetup([string]$Binary) {
- # The call never touches credentials, but a locked headless keychain can
- # block the keyring probe forever. Set the escape hatch for the duration
- # only, restoring the caller's value (or absence) on the way out.
- $savedNoKeyring = $env:HEY_NO_KEYRING
- $env:HEY_NO_KEYRING = '1'
- try {
- try { $help = & $Binary setup --help 2>$null } catch { $help = '' }
- if ($help -match '(?m)^\s+agents\s') {
- try {
- $summary = & $Binary setup agents --jq '.summary' 2>$null
- if ($summary) {
- Info "$summary"
- }
- } catch { }
- }
- } finally {
- if ($null -eq $savedNoKeyring) {
- Remove-Item Env:HEY_NO_KEYRING -ErrorAction SilentlyContinue
- } else {
- $env:HEY_NO_KEYRING = $savedNoKeyring
- }
- }
- }
- function Main {
- $arch = Get-PlatformArch
- if (-not $BinDir) {
- $BinDir = Get-DefaultBinDir
- }
- $resolvedVersion = if ($Version) { $Version } else { Get-LatestVersion }
- if ($resolvedVersion -notmatch '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$') {
- Fail "Invalid version '$resolvedVersion'. Expected semver format like 1.2.3 or 1.2.3-rc.1."
- }
- $archiveName = "hey_${resolvedVersion}_windows_${arch}.zip"
- $baseUrl = "https://github.com/$Repo/releases/download/v$resolvedVersion"
- Step "Downloading hey v$resolvedVersion for windows_$arch..."
- $tmpDir = Join-Path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
- New-Item -ItemType Directory -Path $tmpDir | Out-Null
- try {
- $archivePath = Join-Path $tmpDir $archiveName
- $checksumsPath = Join-Path $tmpDir 'checksums.txt'
- $extractDir = Join-Path $tmpDir 'extract'
- Download-File -Url "$baseUrl/$archiveName" -Destination $archivePath
- Step 'Verifying checksums...'
- Download-File -Url "$baseUrl/checksums.txt" -Destination $checksumsPath
- Verify-Checksum -ChecksumsPath $checksumsPath -ArchivePath $archivePath -ArchiveName $archiveName
- Verify-CosignSignature -Version $resolvedVersion -BaseUrl $baseUrl -TmpDir $tmpDir
- Step 'Extracting...'
- Expand-Archive -Path $archivePath -DestinationPath $extractDir -Force
- $binaryPath = Join-Path $extractDir 'hey.exe'
- if (-not (Test-Path $binaryPath)) {
- Fail 'hey.exe not found in archive. If Windows Security or antivirus removed it during extraction, check Windows Security > Protection history, restore it, and re-run the installer.'
- }
- $installedBinary = Join-Path $BinDir 'hey.exe'
- New-Item -ItemType Directory -Force -Path $BinDir | Out-Null
- # Windows holds an exclusive lock on running PE files; -Force doesn't help.
- # Generic catch -- typed catches miss ActionPreferenceStopException wrapping.
- try {
- Copy-Item -Force $binaryPath $installedBinary -ErrorAction Stop
- } catch {
- Fail "Failed to install hey.exe. If it is in use, close any running 'hey' processes and re-run the installer. If Windows Security quarantined it, check Windows Security > Protection history and restore it. (Original error: $($_.Exception.Message))"
- }
- Ensure-UserPath -Dir $BinDir
- Info "Installed hey to $installedBinary"
- # Smart App Control kills CreateProcess for unsigned executables, so the
- # first run is where a block surfaces. Generic catch per the Copy-Item
- # precedent above. A launch that succeeds but exits nonzero does not
- # throw in Windows PowerShell 5.1, so check $LASTEXITCODE as well.
- try {
- $installedVersion = & $installedBinary --version
- } catch {
- Fail (Get-FirstRunFailureMessage -Binary $installedBinary -Reason $_.Exception.Message)
- }
- if ($LASTEXITCODE -ne 0) {
- Fail (Get-FirstRunFailureMessage -Binary $installedBinary -Reason "hey --version exited with code $LASTEXITCODE")
- }
- Info "$installedVersion installed"
- $isInteractive = Test-InteractiveSession
- Write-Host ''
- if ($SkipSetup -eq '1') {
- Step 'Skipping setup wizard (HEY_SKIP_SETUP=1)'
- # Still install the agent skill and connect coding agents (best-effort).
- Invoke-PostInstallSetup $installedBinary
- Write-Host ''
- Write-Host ' Next steps:'
- Write-Host ' hey auth login Authenticate with HEY'
- Write-Host ' hey setup Run the setup wizard'
- Write-Host ' hey --help See what you can do'
- Write-Host ''
- } elseif ($isInteractive) {
- # Setup is optional: a declined OAuth, a timeout or a busy callback port
- # must not turn an already-successful install into a failure. Windows
- # PowerShell 5.1 does not throw on native nonzero exits, but strict
- # configurations can, so guard the call and check $LASTEXITCODE.
- try { & $installedBinary setup } catch { }
- if ($LASTEXITCODE -ne 0) {
- Write-Host ''
- Write-Host " Setup didn't finish - hey is installed; run it again any time:"
- Write-Host ''
- Write-Host ' Next steps:'
- Write-Host ' hey auth login Authenticate with HEY'
- Write-Host ' hey setup Run the setup wizard'
- Write-Host ' hey --help See what you can do'
- Write-Host ''
- }
- } else {
- Info 'Skipping interactive setup because PowerShell is running non-interactively.'
- # Install the agent skill and connect coding agents (best-effort).
- Invoke-PostInstallSetup $installedBinary
- Write-Host ''
- Write-Host ' Next steps:'
- Write-Host ' hey auth login Authenticate with HEY'
- Write-Host ' hey setup Run the setup wizard'
- Write-Host ' hey --help See what you can do'
- Write-Host ''
- }
- Write-Host ' Installed executable:'
- Write-Host " $installedBinary"
- Write-Host ''
- Write-Host ' New terminals pick up the PATH change; in this session, use the installed executable path directly.'
- Write-Host ''
- }
- finally {
- if (Test-Path $tmpDir) {
- Remove-Item -Recurse -Force $tmpDir
- }
- }
- }
- Main
- }
scripts/install.sh · Bundled script · 537 lines · 2 findings marked
- #!/usr/bin/env bash
- # install.sh - Install the hey CLI
- #
- # Usage:
- # curl -fsSL https://hey.com/install-cli | bash
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 5 on GitHub
- #
- # Options (via environment):
- # HEY_BIN_DIR Where to install the binary
- # (default: ~/bin if on PATH, else ~/.local/bin if on PATH;
- # otherwise ~/bin on Windows, ~/.local/bin elsewhere)
- # HEY_VERSION Specific version to install (default: latest)
- # HEY_SKIP_SETUP Set to 1 to skip the interactive setup wizard after install
- # (still runs `hey setup agents` to install the agent skill
- # and connect coding agents without prompting)
- # HEY_SETUP_AGENT
- # Which coding agent(s) `setup agents` connects:
- # claude | codex | all | none (default: auto-detect a single
- # agent; several detected connects none and lists them)
- #
- # Verification: the SHA-256 checksum is always verified against the release's
- # checksums.txt. When cosign is installed, checksums.txt is additionally
- # verified against its keyless Sigstore bundle (checksums.txt.bundle), pinned
- # to this repository's release workflow identity.
- set -euo pipefail
- REPO="basecamp/hey-cli"
- BIN_DIR="${HEY_BIN_DIR:-}"
- VERSION="${HEY_VERSION:-}"
- CURL_SCHANNEL_FALLBACK_FLAG=""
- CURL_LAST_ERROR=""
- CURL_FALLBACK_NOTED=0
- # Color helpers — respect NO_COLOR (https://no-color.org)
- if [[ -z "${NO_COLOR:-}" ]] && [[ -t 1 ]]; then
- bold() { printf '\033[1m%s\033[0m' "$1"; }
- green() { printf '\033[32m%s\033[0m' "$1"; }
- red() { printf '\033[31m%s\033[0m' "$1"; }
- dim() { printf '\033[2m%s\033[0m' "$1"; }
- else
- bold() { printf '%s' "$1"; }
- green() { printf '%s' "$1"; }
- red() { printf '%s' "$1"; }
- dim() { printf '%s' "$1"; }
- fi
- info() { echo " $(green "✓") $1"; }
- step() { echo " $(bold "→") $1"; }
- error() { echo " $(red "✗ ERROR:") $1" >&2; exit 1; }
- find_sha256_cmd() {
- if command -v sha256sum &>/dev/null; then
- echo "sha256sum"
- elif command -v shasum &>/dev/null; then
- echo "shasum -a 256"
- elif command -v sha256 &>/dev/null; then
- # FreeBSD/OpenBSD base system; -q prints the bare digest.
- echo "sha256 -q"
- else
- error "No SHA256 tool found (need sha256sum, shasum or sha256)"
- fi
- }
- path_contains_dir() {
- local dir="$1"
- [[ ":$PATH:" == *":$dir:"* ]]
- }
- default_bin_dir() {
- local platform="$1"
- if path_contains_dir "$HOME/bin"; then
- echo "$HOME/bin"
- return 0
- fi
- if path_contains_dir "$HOME/.local/bin"; then
- echo "$HOME/.local/bin"
- return 0
- fi
- if [[ "$platform" == windows_* ]]; then
- echo "$HOME/bin"
- else
- echo "$HOME/.local/bin"
- fi
- }
- # detect_platform prints "<os>_<arch>" in the exact shape the release archives
- # use. macOS is per-arch (darwin_amd64, darwin_arm64): no universal
- # "darwin_all" archive is built, and requesting one 404s.
- detect_platform() {
- local os arch
- os=$(uname -s | tr '[:upper:]' '[:lower:]')
- case "$os" in
- darwin) os="darwin" ;;
- linux) os="linux" ;;
- freebsd) os="freebsd" ;;
- openbsd) os="openbsd" ;;
- mingw*|msys*|cygwin*) os="windows" ;;
- *) error "Unsupported OS: $os" ;;
- esac
- arch=$(uname -m)
- case "$arch" in
- x86_64|amd64) arch="amd64" ;;
- aarch64|arm64) arch="arm64" ;;
- *) error "Unsupported architecture: $arch" ;;
- esac
- echo "${os}_${arch}"
- }
- detect_curl_fallback() {
- local version_output help_output
- version_output=$(curl --version 2>/dev/null || true)
- if [[ "$version_output" != *[Ss]channel* ]]; then
- return 0
- fi
- help_output=$(curl --help all 2>/dev/null || true)
- if [[ "$help_output" == *"--ssl-revoke-best-effort"* ]]; then
- CURL_SCHANNEL_FALLBACK_FLAG="--ssl-revoke-best-effort"
- elif [[ "$help_output" == *"--ssl-no-revoke"* ]]; then
- CURL_SCHANNEL_FALLBACK_FLAG="--ssl-no-revoke"
- fi
- }
- curl_run() {
- # --show-error guarantees curl writes errors to stderr even if a future caller
- # passes -s without -S. The Schannel revocation detection below depends on
- # finding CRYPT_E_NO_REVOCATION_CHECK in stderr; without --show-error a -s
- # caller would silently lose the fallback.
- local err_file status err
- err_file=$(mktemp "${TMPDIR:-/tmp}/hey-curl.XXXXXX")
- if curl --show-error "$@" 2>"$err_file"; then
- rm -f "$err_file"
- CURL_LAST_ERROR=""
- return 0
- else
- status=$?
- fi
- err=$(<"$err_file")
- rm -f "$err_file"
- if [[ $status -ne 0 ]] && [[ -n "$CURL_SCHANNEL_FALLBACK_FLAG" ]] && [[ "$err" == *"CRYPT_E_NO_REVOCATION_CHECK"* ]]; then
- if [[ $CURL_FALLBACK_NOTED -eq 0 ]]; then
- echo " $(bold "→") Windows certificate revocation checks are unavailable; retrying curl with ${CURL_SCHANNEL_FALLBACK_FLAG}" >&2
- CURL_FALLBACK_NOTED=1
- fi
- err_file=$(mktemp "${TMPDIR:-/tmp}/hey-curl.XXXXXX")
- if curl --show-error "$CURL_SCHANNEL_FALLBACK_FLAG" "$@" 2>"$err_file"; then
- rm -f "$err_file"
- CURL_LAST_ERROR=""
- return 0
- else
- status=$?
- fi
- err=$(<"$err_file")
- rm -f "$err_file"
- fi
- CURL_LAST_ERROR="$err"
- return "$status"
- }
- get_latest_version() {
- local url version api_json
- # Follow the releases/latest redirect to get the version from the final URL.
- # Avoids the GitHub API (no rate limiting) and grep/sed (better Windows compat).
- if url=$(curl_run -fsSL -o /dev/null -w '%{url_effective}' "https://github.com/${REPO}/releases/latest"); then
- version="${url##*/}"
- version="${version#v}"
- if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
- echo "$version"
- return 0
- fi
- fi
- # Fallback to the GitHub API if redirect parsing fails. Whitespace-tolerant
- # regex so a future GitHub format change (pretty-print, extra spaces) doesn't
- # silently break the fallback. Pure bash so no GNU-awk dependency.
- if api_json=$(curl_run -fsSL -H 'Accept: application/vnd.github+json' -H 'User-Agent: hey-cli-installer' "https://api.github.com/repos/${REPO}/releases/latest"); then
- if [[ $api_json =~ \"tag_name\"[[:space:]]*:[[:space:]]*\"v?([^\"]+)\" ]]; then
- version="${BASH_REMATCH[1]}"
- if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
- echo "$version"
- return 0
- fi
- fi
- fi
- error "Could not determine latest version. ${CURL_LAST_ERROR:+curl said: ${CURL_LAST_ERROR}. }If native Windows curl fails, try Scoop or PowerShell. If using Git Bash, try /usr/bin/curl instead."
- }
- # cosign_version prints the installed cosign's version (e.g. "v2.6.0"), empty
- # when it can't be determined. The trailing `|| true` is load-bearing: under
- # `set -euo pipefail` a broken cosign (nonzero `cosign version`) would
- # otherwise abort the whole installer from inside the caller's command
- # substitution — an unusable cosign must degrade to warn-and-skip, not abort.
- cosign_version() {
- cosign version 2>/dev/null | awk -F': *' '/^GitVersion/ {print $2; exit}' || true
- }
- # cosign_bundle_support decides how to verify the release's Sigstore bundle,
- # which is the new (protobuf, v0.3+json) format. Prints the extra verify-blob
- # flag to use ("" for none) and returns 0 when verification can proceed:
- # v3+ → new-format parsing is the default; no flag
- # v2.6 – v2.x → needs --new-bundle-format=true (v2.x defaults it to false)
- # < v2.6 → cannot verify (v2.4 chokes on the bundle's tlog key type,
- # v2.2 lacks the flag entirely); caller warns and skips
- cosign_bundle_support() {
- local version="$1" major minor
- if [[ "$version" =~ ^v?([0-9]+)\.([0-9]+)\. ]]; then
- major="${BASH_REMATCH[1]}"
- minor="${BASH_REMATCH[2]}"
- else
- return 1
- fi
- if (( major >= 3 )); then
- echo ""
- elif (( major == 2 && minor >= 6 )); then
- echo "--new-bundle-format=true"
- else
- return 1
- fi
- }
- verify_checksums() {
- local version="$1"
- local tmp_dir="$2"
- local archive_name="$3"
- local base_url="https://github.com/${REPO}/releases/download/v${version}"
- step "Verifying checksums..."
- if ! curl_run -fsSL "${base_url}/checksums.txt" -o "${tmp_dir}/checksums.txt"; then
- error "Failed to download checksums.txt${CURL_LAST_ERROR:+ (${CURL_LAST_ERROR})}"
- fi
- # Verify SHA256 checksum of the downloaded archive
- local expected actual
- expected=$(awk -v f="$archive_name" '$2 == f || $2 == ("*" f) {print $1; exit}' "${tmp_dir}/checksums.txt")
- actual=$(cd "$tmp_dir" && $(find_sha256_cmd) "$archive_name" | awk '{print $1}')
- [[ -n "$expected" && "$expected" == "$actual" ]] \
- || error "Checksum verification failed for $archive_name"
- info "Checksum verified"
- # If cosign is available and understands the bundle format, verify the signature
- if command -v cosign &>/dev/null; then
- local cosign_ver bundle_flag
- cosign_ver=$(cosign_version)
- if bundle_flag=$(cosign_bundle_support "$cosign_ver"); then
- step "Verifying cosign signature..."
- if ! curl_run -fsSL "${base_url}/checksums.txt.bundle" -o "${tmp_dir}/checksums.txt.bundle"; then
- error "Failed to download checksums.txt.bundle${CURL_LAST_ERROR:+ (${CURL_LAST_ERROR})}"
- fi
- local -a cosign_args=(verify-blob --bundle "${tmp_dir}/checksums.txt.bundle")
- if [[ -n "$bundle_flag" ]]; then
- cosign_args+=("$bundle_flag")
- fi
- cosign_args+=( \
- --certificate-identity "https://github.com/basecamp/hey-cli/.github/workflows/release.yml@refs/tags/v${version}" \
- --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
- "${tmp_dir}/checksums.txt")
- cosign "${cosign_args[@]}" \
- || error "Cosign signature verification failed"
- info "Signature verified"
- else
- step "Skipping signature verification: cosign ${cosign_ver:-unknown} can't verify this release's bundle format (need cosign >= 2.6)"
- fi
- fi
- }
- download_binary() {
- local version="$1"
- local platform="$2"
- local tmp_dir="$3"
- local url archive_name ext
- # Determine archive extension
- if [[ "$platform" == windows_* ]]; then
- ext="zip"
- else
- ext="tar.gz"
- fi
- archive_name="hey_${version}_${platform}.${ext}"
- url="https://github.com/${REPO}/releases/download/v${version}/${archive_name}"
- step "Downloading hey v${version} for ${platform}..."
- if ! curl_run -fsSL "$url" -o "${tmp_dir}/${archive_name}"; then
- error "Failed to download from $url${CURL_LAST_ERROR:+ (${CURL_LAST_ERROR})}"
- fi
- # Verify integrity before extraction
- verify_checksums "$version" "$tmp_dir" "$archive_name"
- # Extract binary
- step "Extracting..."
- if [[ "$ext" == "zip" ]]; then
- unzip -q "${tmp_dir}/${archive_name}" -d "$tmp_dir"
- else
- tar -xzf "${tmp_dir}/${archive_name}" -C "$tmp_dir"
- fi
- # Find and install binary
- local binary_name="hey"
- if [[ "$platform" == windows_* ]]; then
- binary_name="hey.exe"
- fi
- if [[ ! -f "${tmp_dir}/${binary_name}" ]]; then
- error "Binary not found in archive"
- fi
- mkdir -p "$BIN_DIR"
- mv "${tmp_dir}/${binary_name}" "$BIN_DIR/"
- chmod +x "$BIN_DIR/$binary_name"
- info "Installed hey to $BIN_DIR/$binary_name"
- }
- setup_path() {
- # Check if BIN_DIR is in PATH
- if [[ ":$PATH:" == *":$BIN_DIR:"* ]]; then
- return 0
- fi
- step "Adding $BIN_DIR to PATH"
- local shell_rc=""
- local path_line="export PATH=\"$BIN_DIR:\$PATH\""
- case "${SHELL:-}" in
- */zsh) shell_rc="$HOME/.zshrc" ;;
- # macOS terminals start bash as a login shell, which reads ~/.bash_profile
- # and not ~/.bashrc. Linux login shells (consoles, SSH) reach ~/.bashrc
- # through the distros' stock profile files.
- */bash) if [[ "$(uname -s)" == "Darwin" ]]; then
- shell_rc="$HOME/.bash_profile"
- else
- shell_rc="$HOME/.bashrc"
- fi ;;
- # fish sources neither ~/.profile nor Bourne syntax; fish_add_path
- # (fish >= 3.2) persists the entry and is idempotent across runs.
- */fish) shell_rc="${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish"
- path_line="fish_add_path \"$BIN_DIR\"" ;;
- *) shell_rc="$HOME/.profile" ;;
- esac
- if [[ -f "$shell_rc" ]] && grep -qF "$BIN_DIR" "$shell_rc" 2>/dev/null; then
- info "PATH already configured in $shell_rc"
- else
- mkdir -p "$(dirname "$shell_rc")"
- {
- echo ""
- echo "# Added by hey installer"
- echo "$path_line"
- } >> "$shell_rc"
- info "Added to $shell_rc"
- info "Run: source $shell_rc"
- fi
- }
- verify_install() {
- local platform="$1"
- local binary_name="hey"
- if [[ "$platform" == windows_* ]]; then
- binary_name="hey.exe"
- fi
- local installed_version err_file
- err_file=$(mktemp)
- if installed_version=$("$BIN_DIR/$binary_name" --version 2>"$err_file"); then
- rm -f "$err_file"
- info "$(green "${installed_version} installed")"
- return 0
- fi
- local run_error
- run_error=$(cat "$err_file")
- rm -f "$err_file"
- local detail="Installation failed - hey not working"
- if [[ -n "$run_error" ]]; then
- detail="$detail: $run_error"
- fi
- if [[ "$platform" == windows_* ]]; then
- detail="$detail
- Windows may have blocked the executable: Smart App Control only runs code-signed binaries.
- Either install inside WSL2 (curl -fsSL https://hey.com/install-cli | bash) or see
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 405 on GitHub
- https://github.com/basecamp/hey-cli#windows-smart-app-control-and-smartscreen"
- fi
- error "$detail"
- }
- show_banner() {
- echo ""
- echo " $(bold "HEY CLI")"
- echo ""
- }
- main() {
- show_banner
- # Check for curl
- if ! command -v curl &>/dev/null; then
- error "curl is required but not installed"
- fi
- local platform version tmp_dir
- platform=$(detect_platform)
- detect_curl_fallback
- if [[ -z "$BIN_DIR" ]]; then
- BIN_DIR=$(default_bin_dir "$platform")
- fi
- if [[ -n "$VERSION" ]]; then
- version="$VERSION"
- if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
- error "Invalid version '${version}'. Expected semver format (e.g. 1.2.3 or 1.2.3-rc.1)."
- fi
- else
- version=$(get_latest_version)
- fi
- tmp_dir=$(mktemp -d)
- # Expand now on purpose: tmp_dir is local to main and gone by the time the
- # EXIT trap fires.
- # shellcheck disable=SC2064
- trap "rm -rf '${tmp_dir}'" EXIT
- local binary_name="hey"
- if [[ "$platform" == windows_* ]]; then
- binary_name="hey.exe"
- fi
- download_binary "$version" "$platform" "$tmp_dir"
- setup_path
- verify_install "$platform"
- echo ""
- # Hand off to the setup wizard only when stdin and stdout are a terminal and
- # it was not explicitly skipped. Non-interactive environments (CI, piped
- # input, coding agents like Claude Code or Codex) get the agent skill
- # installed and a best-effort agent connection via `setup agents`, plus
- # next-step instructions — the wizard prompts, and a prompt without a
- # terminal would hang.
- if [[ "${HEY_SKIP_SETUP:-}" == "1" ]]; then
- step "Skipping setup wizard (HEY_SKIP_SETUP=1)"
- post_install_setup "$binary_name"
- print_next_steps
- elif [[ -t 0 ]] && [[ -t 1 ]]; then
- # Setup is optional: a declined OAuth, a timeout or a busy callback port
- # must not turn an already-successful install into a failure under set -e.
- if ! "$BIN_DIR/$binary_name" setup; then
- echo ""
- echo " Setup didn't finish — hey is installed; run it again any time:"
- print_next_steps
- fi
- else
- info "Skipping interactive setup (no terminal detected)."
- post_install_setup "$binary_name"
- print_next_steps
- fi
- }
- print_next_steps() {
- echo ""
- echo " Next steps:"
- echo " $(bold "hey auth login") Authenticate with HEY"
- echo " $(bold "hey setup") Run the setup wizard"
- echo " $(bold "hey --help") See what you can do"
- echo ""
- }
- # binary_supports_setup_agents reports whether the installed binary exposes the
- # `setup agents` subcommand. The hosted install.sh from main can outrun the
- # latest release, so we probe rather than assume.
- binary_supports_setup_agents() {
- "$1" setup --help 2>/dev/null | grep -qE '^[[:space:]]+agents[[:space:]]'
- }
- # post_install_setup connects coding agents without prompting, but only when
- # the installed binary has the ownership-aware `setup agents` (it honors
- # HEY_SETUP_AGENT itself: claude|codex|all|none, unset = auto-detect one).
- # The jq selector keeps the machine-readable command's envelope out of the
- # human-facing installer while preserving its concise outcome.
- #
- # Releases that predate `setup agents` also predate the ownership gate on
- # `skill install` — their legacy implementation overwrites whatever occupies
- # the skill paths — so the installer never invokes an old binary's setup or
- # skill commands. The printed next steps are the fallback: setup belongs to
- # the user, on a binary that refuses to destroy their files.
- #
- # The real invocation carries HEY_NO_KEYRING=1, per-command rather than
- # exported: it never touches credentials, and a locked headless keychain
- # (CI, ssh) could otherwise block the keyring probe forever. The
- # `setup --help` capability probe stays bare — help short-circuits first.
- post_install_setup() {
- local binary_name="$1"
- local bin="$BIN_DIR/$binary_name"
- local summary
- if binary_supports_setup_agents "$bin"; then
- if summary=$(HEY_NO_KEYRING=1 "$bin" setup agents --jq '.summary' 2>/dev/null); then
- if [[ -n "$summary" ]]; then
- info "$summary"
- fi
- fi
- fi
- }
- # Guard so sourcing the script (e.g. from tests) doesn't run the installer.
- # The if-form is required: `[[ … ]] && main` returns 1 when sourced, which
- # trips `set -e` in the sourcing shell. The `:-$0` fallback is also
- # required: bash executing from stdin (curl | bash) or -c leaves BASH_SOURCE
- # unset, and the bare expansion aborts under `set -u`.
- if [[ "${BASH_SOURCE[0]:-$0}" == "$0" ]]; then
- main "$@"
- fi
scripts/stage-installer-ps1.sh · Bundled script · 58 lines · 1 finding marked
- #!/usr/bin/env sh
- # Usage: scripts/stage-installer-ps1.sh SOURCE DEST
- #
- # Stage a copy of the PowerShell installer for Authenticode signing, in the
- # only shape where jsign's digest and PowerShell's agree.
- #
- # jsign computes the script digest as UTF-16LE of the file content with the
- # signature block stripped, and applies NO line-ending normalization
- # (SignableScript.computeDigest). PowerShell's script SIP normalizes to CRLF
- # before hashing. Sign an LF file and the two digests differ, so
- # Get-AuthenticodeSignature reports HashMismatch and the installer is refused
- # under AllSigned/RemoteSigned. That is what basecamp-cli
- # shipped in v0.8.0-rc.2, and hey-cli inherits the same pipeline.
- #
- # Two invariants make the digests agree:
- #
- # CRLF removes the normalization disagreement above.
- #
- # pure ASCII removes an encoding disagreement that CRLF alone would not
- # fix. The file has no BOM; jsign assumes UTF-8, but Windows
- # PowerShell 5.1 assumes ANSI (Windows-1252) for BOM-less files.
- # Any byte above 0x7F therefore decodes to different characters
- # on each side and the digests diverge again. Within ASCII the
- # two encodings are identical byte-for-byte, so the question
- # never arises. Adding a BOM would be the other way out, but it
- # trades a known-good invariant for jsign's
- # isByteOrderMarkSigned() matching Microsoft's undocumented
- # treatment of the BOM in the hash — untestable without a
- # signing round-trip.
- #
- # The source file is left alone: raw-main install.ps1 stays LF and unsigned,
- # which is the `irm | iex` path and needs neither.
- Note: Runs a downloaded PowerShell script (iex / Invoke-Expression)
- Line 32 on GitHub
- set -eu
- SRC="${1:?usage: stage-installer-ps1.sh SOURCE DEST}"
- DEST="${2:?usage: stage-installer-ps1.sh SOURCE DEST}"
- [ -f "$SRC" ] || { echo "stage-installer-ps1: source not found: $SRC" >&2; exit 1; }
- # Reject non-ASCII before signing rather than after. Under LC_ALL=C every byte
- # above 0x7F is non-printable, so this matches exactly the bytes that would
- # make jsign and PowerShell 5.1 disagree.
- if LC_ALL=C grep -n '[^[:print:][:space:]]' "$SRC" >/dev/null 2>&1; then
- echo "stage-installer-ps1: $SRC contains non-ASCII bytes, which would produce" >&2
- echo " a signature PowerShell 5.1 rejects as HashMismatch (it decodes BOM-less" >&2
- echo " files as Windows-1252 while jsign assumes UTF-8). Offending lines:" >&2
- LC_ALL=C grep -n '[^[:print:][:space:]]' "$SRC" >&2
- exit 1
- fi
- mkdir -p "$(dirname "$DEST")"
- # LF -> CRLF, idempotent: strip any existing CR first so a CRLF source does
- # not become CR CR LF.
- awk '{ sub(/\r$/, ""); printf "%s\r\n", $0 }' "$SRC" > "$DEST"
- echo "stage-installer-ps1: staged $DEST (pure ASCII, CRLF)"
Version history
v1.13.111/11/2026
v1.12.011/9/2026
v1.11.011/7/2026
v1.10.110/25/2026
v1.10.010/23/2026
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.