Skip to content
Back to search

basecamp-cli

Basecamp integration for Claude Code. Create todos, track work, link code to projects.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 14 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/basecamp-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/basecamp-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
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/basecamp--basecamp-cli/badge.svg)](/listings/basecamp--basecamp-cli)

HTML

<a href="/listings/basecamp--basecamp-cli"><img src="/api/listings/basecamp--basecamp-cli/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

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.

**macOS / Linux / WSL2**

curl -fsSL https://basecamp.com/install-cli | bash

**Windows (PowerShell)**

irm https://raw.githubusercontent.com/basecamp/basecamp-cli/main/scripts/install.ps1 | iex

On Windows 11 with Smart App Control, see [Troubleshooting](#windows-smart-app-control-and-smartscreen) if the install is blocked.

On an interactive terminal, the installer opens Basecamp setup: approve OAuth in your browser and the CLI uses the account granted by OAuth, otherwise preserves an existing account or selects the first available. It saves that account globally, clears the global project default, and connects every detected coding agent. Directory-specific and environment project settings continue to apply. Use `basecamp setup --customize` to choose those settings instead.

<details> <summary>Other installation methods</summary>

**Brew / macOS**

brew install --cask basecamp/tap/basecamp-cli

**Arch Linux / Omarchy (AUR):**

yay -S basecamp-cli

**Linux (deb/rpm/apk):**

# Download from https://github.com/basecamp/basecamp-cli/releases/latest
sudo apt install ./basecamp-cli_*_linux_amd64.deb            # Debian/Ubuntu
sudo dnf install ./basecamp-cli_*_linux_amd64.rpm            # Fedora/RHEL
sudo apk add --allow-untrusted ./basecamp-cli_*_linux_amd64.apk  # Alpine

Arm64: substitute `arm64` for `amd64` in the filename. Verify the SHA-256 checksum from `checksums.txt` before installing unsigned Alpine packages.

**Scoop (Windows):**

scoop bucket add basecamp https://github.com/basecamp/homebrew-tap
scoop install basecamp-cli

**Shell script (macOS / Linux / WSL2 / Git Bash):**

curl -fsSL https://raw.githubusercontent.com/basecamp/basecamp-cli/main/scripts/install.sh | bash

**Nix:**

nix profile install github:basecamp/basecamp-cli

**Go install:**

go install github.com/basecamp/basecamp-cli/cmd/basecamp@latest

**mise:**

mise use --global github:basecamp/basecamp-cli@latest

**GitHub Release:** download from [Releases](https://github.com/basecamp/basecamp-cli/releases).

</details>

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
  1. {
  2. "name": "basecamp-cli",
  3. "version": "0.30.0",
  4. "description": "Basecamp integration for Claude Code. Create todos, track work, link code to projects.",
  5. "author": {
  6. "name": "37signals",
  7. "email": "support@37signals.com"
  8. },
  9. "homepage": "https://github.com/basecamp/basecamp-cli",
  10. "repository": "https://github.com/basecamp/basecamp-cli",
  11. "license": "MIT"
  12. }
README.md · README · 594 lines · 4 findings marked
  1. # <img src="assets/bc5-snowglobe.png" height="28" alt="Basecamp"> Basecamp CLI
  2. `basecamp` is the official command-line interface for Basecamp. Manage projects, todos, messages, and more from your terminal or through AI agents.
  3. - Works standalone or with any AI agent (Claude, Codex, Grok, Copilot, Gemini)
  4. - JSON output with breadcrumbs for easy navigation
  5. - OAuth authentication with automatic token refresh
  6. - Includes agent skills plus native Claude Code and Codex plugins; Grok Build reads the shared skill directly
  7. ## Quick Start
  8. **macOS / Linux / WSL2**
  9. ```bash
  10. curl -fsSL https://basecamp.com/install-cli | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 15 on GitHub
  11. ```
  12. **Windows (PowerShell)**
  13. ```powershell
  14. irm https://raw.githubusercontent.com/basecamp/basecamp-cli/main/scripts/install.ps1 | iex
  15. ```
  16. On Windows 11 with Smart App Control, see [Troubleshooting](#windows-smart-app-control-and-smartscreen) if the install is blocked.
  17. On an interactive terminal, the installer opens Basecamp setup: approve OAuth in your browser and the CLI uses the account granted by OAuth, otherwise preserves an existing account or selects the first available. It saves that account globally, clears the global project default, and connects every detected coding agent. Directory-specific and environment project settings continue to apply. Use `basecamp setup --customize` to choose those settings instead.
  18. <details>
  19. <summary>Other installation methods</summary>
  20. **Brew / macOS**
  21. ```
  22. brew install --cask basecamp/tap/basecamp-cli
  23. ```
  24. **Arch Linux / Omarchy (AUR):**
  25. ```bash
  26. yay -S basecamp-cli
  27. ```
  28. **Linux (deb/rpm/apk):**
  29. ```bash
  30. # Download from https://github.com/basecamp/basecamp-cli/releases/latest
  31. sudo apt install ./basecamp-cli_*_linux_amd64.deb # Debian/Ubuntu
  32. sudo dnf install ./basecamp-cli_*_linux_amd64.rpm # Fedora/RHEL
  33. sudo apk add --allow-untrusted ./basecamp-cli_*_linux_amd64.apk # Alpine
  34. ```
  35. Arm64: substitute `arm64` for `amd64` in the filename. Verify the SHA-256 checksum from `checksums.txt` before installing unsigned Alpine packages.
  36. **Scoop (Windows):**
  37. ```bash
  38. scoop bucket add basecamp https://github.com/basecamp/homebrew-tap
  39. scoop install basecamp-cli
  40. ```
  41. **Shell script (macOS / Linux / WSL2 / Git Bash):**
  42. ```bash
  43. curl -fsSL https://raw.githubusercontent.com/basecamp/basecamp-cli/main/scripts/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 59 on GitHub
  44. ```
  45. **Nix:**
  46. ```bash
  47. nix profile install github:basecamp/basecamp-cli
  48. ```
  49. **Go install:**
  50. ```bash
  51. go install github.com/basecamp/basecamp-cli/cmd/basecamp@latest
  52. ```
  53. **mise:**
  54. ```bash
  55. mise use --global github:basecamp/basecamp-cli@latest
  56. ```
  57. **GitHub Release:** download from [Releases](https://github.com/basecamp/basecamp-cli/releases).
  58. </details>
  59. ## Upgrading
  60. ```bash
  61. basecamp upgrade
  62. ```
  63. What happens depends on how the CLI was installed:
  64. - **Installer script / tarball** (a binary under your home directory, e.g. `~/bin` or `~/.local/bin`): upgrades in place. The CLI downloads the release for your platform, verifies its Sigstore signature (the keyless `checksums.txt.bundle` published by the release pipeline, identity-pinned to the release workflow and tag) and SHA-256 checksum, swaps the executable transactionally, and confirms the installed binary reports the new version. On failure the previous binary is restored; in the worst case — restoration itself fails mid-swap — the error names the preserved backup file next to the binary so you can put it back by hand.
  65. - **Homebrew / Scoop**: delegates to `brew upgrade --cask` / `scoop update`, then verifies the manager-installed binary actually reports the new version.
  66. - **System packages** (apt/dnf/apk, AUR, Nix), **mise**, and **`go install` builds**: never touched. `basecamp upgrade` exits nonzero with upgrade guidance for that install method (the exact command where it can be known, e.g. mise or `go install`; otherwise which package manager to use).
  67. `basecamp upgrade` exits 0 only when there is no update, or the update was applied *and confirmed*. Every other outcome is a structured failure (`"ok": false` in JSON) with one of these codes:
  68. | Code | Meaning |
  69. |---|---|
  70. | `upgrade_required` | An update exists but the CLI won't apply it for this install method — the hint carries the right next step |
  71. | `upgrade_incomplete` | The package manager exited 0 but the binary still reports the old version |
  72. | `upgrade_unverified` | The upgrade may have worked, but the installed version could not be confirmed |
  73. | `upgrade_failed` | The update check, download, signature/checksum verification, or executable swap failed — the previous binary remains installed (or the error names the preserved backup if restoration also failed) |
  74. The install scripts verify release signatures when `cosign` is available: cosign v3 verifies the published bundle format as-is, v2.6+ is driven with `--new-bundle-format=true`, and older versions skip signature verification with a warning (SHA-256 checksums are always verified).
  75. ## First-time setup
  76. The first interactive `basecamp` run applies the recommended setup automatically after browser approval:
  77. - Account granted by OAuth, otherwise the existing configured account or first available account, saved globally
  78. - No global default project; directory-specific and environment project settings continue to apply
  79. - Every detected Claude Code, Codex or Grok integration
  80. Run the same setup directly with `basecamp setup`. To choose the account, default project, config scope, and agent integrations, run:
  81. ```bash
  82. basecamp setup --customize
  83. ```
  84. ## Usage
  85. ```bash
  86. basecamp projects list # List projects
  87. basecamp todos list --in 12345 # Todos in a project
  88. basecamp todos create "Fix bug" --in 12345 # Create todo
  89. basecamp todos complete 67890 # Complete todo
  90. basecamp cards done 67890 --in 12345 # Complete card (move to Done)
  91. basecamp search "authentication" # Search across projects
  92. basecamp files list --in 12345 # List docs & files
  93. basecamp cards list --in 12345 # List cards (Kanban)
  94. basecamp chat post "Hello" --in 12345 # Post to chat
  95. basecamp pings post Jane "Lunch?" # Ping someone directly
  96. basecamp comments create 67890 "@Jane.Smith, done!" # Comment with @mention
  97. ```
  98. ### Output Formats
  99. ```bash
  100. basecamp projects # Styled output in terminal, JSON when piped
  101. basecamp projects --json # JSON with envelope and breadcrumbs
  102. basecamp projects --quiet # Raw JSON data only
  103. ```
  104. ### JSON Envelope
  105. Every command supports `--json` for structured output:
  106. ```json
  107. {
  108. "ok": true,
  109. "data": [...],
  110. "summary": "5 projects",
  111. "breadcrumbs": [{"action": "show", "cmd": "basecamp projects show <id>"}]
  112. }
  113. ```
  114. Breadcrumbs suggest next commands, making it easy for humans and agents to navigate.
  115. Errors use the same envelope with `ok: false`, a stable `code`, and `retryable`,
  116. which says whether a retry can change the outcome:
  117. ```json
  118. {
  119. "ok": false,
  120. "error": "Gateway error (503)",
  121. "code": "api_error",
  122. "retryable": true,
  123. "hint": "..."
  124. }
  125. ```
  126. Key order within the envelope is not part of the contract — the interactive
  127. (TTY) path re-encodes through a map and alphabetizes keys — so match on key
  128. names, never on position.
  129. `retryable` is present on every error envelope — `true` when the CLI classified
  130. the failure transient (network, timeout, rate limit, circuit open, and most
  131. 5xx/gateway responses — not all: 507 and some 500s are verdicts), `false` for a
  132. verdict (usage, not found, auth, forbidden, validation, account limit) and for
  133. any error nothing classified — and never on a success envelope. Key on it rather
  134. than on the code or message when deciding whether to retry; `false` means no
  135. known reason a retry would help, not a guarantee the failure is permanent.
  136. ## Authentication
  137. OAuth 2.1 with automatic token refresh. First login opens your browser.
  138. When the server advertises the OAuth device flow, login uses it
  139. automatically: you approve a short code in the browser instead of a
  140. redirect. Login falls back to Launchpad's authorization-code flow only when
  141. no modern OAuth issuer is advertised for the server; once a modern issuer is
  142. selected, login failures surface loudly rather than silently falling back.
  143. ```bash
  144. basecamp auth login # Authenticate with Basecamp (full access)
  145. basecamp auth login --scope read # Read-only access (ignored by Launchpad)
  146. basecamp auth login --scope full # Full read+write access (default; ignored by Launchpad)
  147. basecamp auth token # Print token for scripts
  148. ```
  149. `--expect-identity <id>` makes any login assert who it authenticated as: the
  150. new credential is checked before it is stored, and on a mismatch nothing is
  151. written (a profile's previous credential is untouched) and the command exits
  152. non-zero. `basecamp profile create <name> --expect-identity <id>` does the same
  153. for a profile that does not exist yet. `--login-hint <email>` names the account to sign in as on the
  154. device-flow approval page (sent as `login_hint`; it steers the sign-in page and
  155. never authenticates on its own; ignored by Launchpad).
  156. ### Personal access tokens
  157. A [personal access token](https://app.basecamp.com/my/access_tokens) can be
  158. imported instead of running OAuth — the shape for bots, CI, and any machine
  159. that should never sign in interactively. The token is read from stdin (never
  160. an argument), verified against the server — who it authenticates as, and that
  161. it can reach the profile's account — and only then stored under a named
  162. profile, with whatever expiry the server reports for it:
  163. ```bash
  164. op read "op://Vault/Item/credential" | basecamp auth login --with-token -P bot --account 999
  165. op read "op://Vault/Item/credential" | basecamp auth login --with-token -P bot --account 999 --expect-identity 12345 --json
  166. ```
  167. `--account` is required when the profile does not exist yet. `--json` returns
  168. an envelope with the profile, account, identity and person, `oauth_type`,
  169. `scope`, and `expires_at` (the expiry the server reports for the token, or
  170. `null` when it reports none). A token has no refresh token, so near a reported
  171. expiry the CLI refuses it and asks for a fresh import.
  172. ### Agents
  173. A Basecamp agent is a principal with no person behind it, so it has no browser
  174. to sign in with and is granted no refresh token. It authenticates with the
  175. OAuth `client_credentials` grant instead: its client id and secret mint a
  176. short-lived self-token, and the CLI mints another whenever that one nears
  177. expiry. The client secret is read from stdin (never an argument) and stored
  178. with the token it mints — in the OS keyring where one is available — because
  179. the client, not a refresh token, is what survives an expiry:
  180. ```bash
  181. op read "op://Vault/Item/credential" | basecamp auth login --with-client-credentials --client-id <id> -P agent --account 999
  182. ```
  183. The login mints once, which is what proves the client id and secret: a refused
  184. mint stores nothing. `--account` is required when the profile does not exist
  185. yet. `basecamp auth logout` forgets the credential; there is no useful
  186. revocation, since the same client would mint another. To end its access,
  187. disconnect its connection in Basecamp (on My > Agent for your own agent, in
  188. Adminland for a shared one), which kills that connection's secret and every
  189. token minted from it. Where My > Agent lists several connections, disconnect
  190. the one this profile used: Disconnect all ends every one of them.
  191. ### Connecting an agent to this computer
  192. You don't paste an agent's secret anywhere: you approve the connection in your
  193. browser and the CLI keeps the credential. It needs CLI 0.13.0 or later; check
  194. with `basecamp --version` and run `basecamp upgrade` first if it's older.
  195. In a terminal, one command does it all:
  196. ```bash
  197. basecamp connect setup
  198. ```
  199. It connects this computer to your agent (one approval in the browser), records
  200. who may give it work (for your personal agent, you) and which projects it
  201. serves, and ends by telling you how to start the connector. If the agent is
  202. already connected on this computer under a profile, name it
  203. (`basecamp connect setup -P <profile>`), or setup may connect it again under
  204. another. The same steps, scriptable:
  205. ```bash
  206. basecamp auth agent connect -P my-agent # one approval
  207. basecamp connect setup -P my-agent --serve 12345 # who may give it work, which projects
  208. basecamp connect -P my-agent # the watcher
  209. ```
  210. Campfires normally require an @mention. For a small Campfire where every
  211. trusted message should reach the agent, opt it in and restart the connector:
  212. ```bash
  213. basecamp chat list --project 12345 -P my-agent --json
  214. basecamp connect setup -P my-agent --listen-campfire 12345:67890
  215. ```
  216. Use the Campfire id from the listing. Existing trust rules still apply, and
  217. other agents still need mentions. To restore mentions, run setup with
  218. `--no-listen-campfire 12345:67890` and restart.
  219. An approval may add a connection or replace an existing one: read the approval
  220. page before proceeding. Personal and team agents can have several connections
  221. where Basecamp enables adding them for that kind of agent. Otherwise a new
  222. approval replaces the existing connection. This applies to both the CLI and
  223. Basecamp's HTTP handshake. Do not reconnect just to upgrade the CLI.
  224. Each profile has its own projects, ledger, cursor, hold and local lock. When
  225. two connections serve the same project, a request both admit can be answered
  226. twice, so serve each project from one. Use a distinct `--device-name` for each
  227. profile on the same computer.
  228. Only one computer should answer an agent's Pings. A Ping is in no project, so
  229. every connector for the agent sees all of them, and each one that heard them
  230. would answer. A connector started with `--pings` hears Pings, and anything
  231. else outside a project; one started with `--no-pings` hears only its projects.
  232. Without either, the agent's first connection hears them, a connection added
  233. after it doesn't, and a bot user's login does, as it always has. A run given
  234. `--project` hears none and saves nothing. The first start without `--project`
  235. saves the choice for the profile, as either flag saves its own, and restarts
  236. keep it until you pass the other flag:
  237. ```bash
  238. basecamp connect -P desktop --pings # this computer answers Pings
  239. basecamp connect -P laptop --no-pings # this one leaves them to the desktop
  240. ```
  241. A connector that hears Pings warns when another one on the same computer hears
  242. the same agent's. It can't see other computers, so starting just one there is
  243. yours to arrange. `basecamp connect status` and `basecamp connect doctor` say
  244. whether a profile's connector answers them, and why. Where Basecamp lists several connections, you
  245. can rename them and disconnect one without using Disconnect all. Reconnecting
  246. a profile on an add-capable server leaves its old connection live until you
  247. disconnect it; older credential files can remain live too. Do not delete them
  248. as part of setup. See the [upgrade and downgrade runbook](docs/agent-connections-rollout.md)
  249. for legacy state adoption and mixed-version precautions.
  250. In Claude Code, the `/basecamp-connect` skill runs the watcher and hands each
  251. request to a subagent. It ships in this CLI's plugin from 0.12.0 on, and an
  252. older plugin doesn't have it. Update the plugin, restart Claude Code, and only
  253. then remove any older copy of the skill:
  254. ```bash
  255. claude plugin update basecamp-cli@37signals # installed as basecamp-cli
  256. basecamp setup claude # installed under the old name, basecamp@37signals
  257. ```
  258. ### Containers, CI and scheduled jobs
  259. An OAuth login refreshes by rotation: each refresh replaces its refresh token,
  260. and Basecamp signs the whole login out when a replaced token is used again.
  261. That is how it notices a stolen one. So one login can be **shared** by many
  262. processes, but never **copied**: two containers that each hold a copy of
  263. `credentials.json` sign each other out as soon as both have refreshed more
  264. than a minute apart, which a retry window forgives but a schedule won't.
  265. For containers, CI and cron, pick one:
  266. - **A token that never rotates.** Set `BASECAMP_TOKEN` to a
  267. [personal access token](#personal-access-tokens), where your account offers
  268. them, injected as a secret. Nothing refreshes, so every replica can hold the
  269. same one, and revoking it ends access everywhere.
  270. - **One shared login, on one host.** Mount one config directory into every
  271. replica as a read-write volume, with `BASECAMP_NO_KEYRING=1`. The CLI locks
  272. the login while it refreshes, so replicas take turns instead of signing
  273. each other out. The lock is an `flock` in that directory, which holds
  274. between containers on one host. Across hosts, use one of the other two:
  275. the CLI can't tell a shared filesystem whose `flock` is local to each host,
  276. and there copies would sign each other out with no warning.
  277. - **One login per install.** Run `basecamp auth login --device-code` in each
  278. install, and keep its config directory to itself.
  279. Never bake `credentials.json` into an image or copy it between machines. The
  280. CLI says so once, the first time a login refreshes inside a container (again
  281. later only if it cannot write its marker in the config directory).
  282. If refreshes keep failing, Basecamp blocks sign-ins from that address for a
  283. while. The CLI then waits out the block instead of retrying on every run
  284. (`basecamp auth status` shows the wait), and forgets a revoked login after
  285. its first refusal; sign in again once whatever was using the old copy has
  286. stopped.
  287. ### Multiple Identities
  288. Use named profiles when the same machine or agent gateway needs more than one Basecamp identity. Each profile has its own stored OAuth credentials and can be selected per command:
  289. ```bash
  290. basecamp profile create design-agent
  291. basecamp profile create ops-agent
  292. basecamp --profile design-agent todo "Fix bug" --in 12345 --list 67890
  293. ```
  294. Set a default with `basecamp profile set-default <name>`, or set `BASECAMP_PROFILE=<name>` for a process. Actions are posted as the authenticated user for the selected profile.
  295. ### Custom OAuth Credentials
  296. To use your own OAuth app (e.g., a custom Launchpad integration):
  297. | Variable | Purpose |
  298. |----------|---------|
  299. | `BASECAMP_OAUTH_CLIENT_ID` | OAuth client ID |
  300. | `BASECAMP_OAUTH_CLIENT_SECRET` | OAuth client secret |
  301. | `BASECAMP_OAUTH_REDIRECT_URI` | Redirect URI (must be `http://` loopback with explicit port) |
  302. Both `BASECAMP_OAUTH_CLIENT_ID` and `BASECAMP_OAUTH_CLIENT_SECRET` must be set together.
  303. `BASECAMP_OAUTH_ISSUER=https://app.basecamp.com` pins the OAuth authorization
  304. server and skips discovery, so `basecamp auth login` reaches a server that is
  305. serving piloted clients but not yet advertising itself (discovery still 404s).
  306. It is a temporary escape hatch for that dark pilot, not a configuration
  307. surface, and will be removed once the server advertises its metadata.
  308. ## AI Agent Integration
  309. `basecamp` works with any AI agent that can run shell commands.
  310. Both plugins require the `basecamp` CLI installed and on your PATH.
  311. The plugin hooks additionally need a CLI new enough to carry the `agent-hook`
  312. command. If hook errors appear after installing or refreshing the plugin, the
  313. CLI is older than the hooks: run `basecamp upgrade`, then start a new session.
  314. Check with `basecamp agent-hook --help` — an "unknown command" reply means the
  315. CLI needs upgrading.
  316. **Claude Code:** `basecamp setup claude` — installs the plugin with skills, hooks, and agent workflow support.
  317. **Codex:** `basecamp setup codex` — registers the 37signals marketplace and installs the native plugin with Basecamp skills, diagnostics, and opt-in commit-reference hooks. In Codex, review and trust the plugin hooks with `/hooks`, then start a new thread to load the skills and hooks. The plugin does not inject Basecamp context at session start (beyond a pointer to `basecamp instructions` when instructions are set, plus their gist when it can be read without the network); Codex selects the skill when a request is relevant or explicitly references Basecamp.
  318. Manual Codex installation uses the same marketplace:
  319. ```bash
  320. codex plugin marketplace add basecamp/claude-plugins
  321. codex plugin add basecamp-cli@37signals
  322. ```
  323. To pick up a newer plugin version later, refresh the marketplace with
  324. `codex plugin marketplace upgrade 37signals` (or re-run `basecamp setup codex`).
  325. **Plugin name:** in the 37signals marketplace this plugin is `basecamp-cli`
  326. (`basecamp-cli@37signals`). It was published as `basecamp`, a name set aside
  327. for the hosted Basecamp connector plugin, which works through Basecamp's own
  328. MCP server rather than this CLI. During a deprecation window the marketplace
  329. keeps `basecamp` as an alias of `basecamp-cli`, so an existing
  330. `basecamp@37signals` install keeps working and updating; once per agent it
  331. says the plugin has been renamed. Switch with `basecamp setup claude` or
  332. `basecamp setup codex` (or `basecamp setup agents`). For Claude Code, setup
  333. replaces `basecamp@37signals` with `basecamp-cli` at the scopes it was
  334. installed in. Codex installs have no scopes, so setup adds `basecamp-cli` and
  335. then removes the old ID. To switch by hand:
  336. ```bash
  337. claude plugin marketplace update 37signals
  338. claude plugin install basecamp-cli@37signals
  339. claude plugin uninstall basecamp@37signals
  340. codex plugin marketplace upgrade 37signals
  341. codex plugin add basecamp-cli@37signals
  342. codex plugin remove basecamp@37signals
  343. ```
  344. Skills from the plugin are namespaced by its name, so `basecamp:basecamp`
  345. becomes `basecamp-cli:basecamp`. The CLI itself is still `basecamp`.
  346. **Grok Build:** `basecamp setup grok` — installs the shared skill and confirms it is healthy. There is no Grok plugin: Grok reads user skills from `~/.grok/skills/` and from the cross-agent `~/.agents/skills/`, so the shared `~/.agents/skills/basecamp` skill is the whole integration. Grok is detected by `$GROK_HOME` (default `~/.grok`) or a `grok` binary on `PATH`, in `~/.local/bin`, or in `$GROK_HOME/bin` where its installers put it. Start a new Grok session after setup to load the skill.
  347. **Other agents:** Point your agent at [`skills/basecamp/SKILL.md`](skills/basecamp/SKILL.md) for Basecamp workflow coverage.
  348. **Agent discovery:** Every command supports `--help --agent` for structured JSON output (flags, gotchas, subcommands). Use `basecamp commands --json` for the full catalog.
  349. See [install.md](install.md) for step-by-step setup instructions.
  350. ### MCP Server
  351. `basecamp mcp` runs an MCP (Model Context Protocol) server on stdin/stdout,
  352. serving Basecamp as tools backed by your signed-in account — no separate
  353. binary or extra credentials. Register it with any MCP client as a stdio
  354. server:
  355. ```bash
  356. claude mcp add basecamp -- basecamp mcp
  357. ```
  358. Sixteen domain tools (`basecamp_projects`, `basecamp_todos`, `basecamp_cards`,
  359. `basecamp_messages`, `basecamp_campfires`, `basecamp_boosts`,
  360. `basecamp_schedules`, `basecamp_files`, `basecamp_people`,
  361. `basecamp_automation`, `basecamp_reports`, `basecamp_everything`,
  362. `basecamp_clientside`, `basecamp_forwards`, `basecamp_account`,
  363. `basecamp_recordings`) cover the Basecamp API, scoped to the configured
  364. account. Each tool takes `{"action": "...", "params": {...}}` and serves
  365. per-action schemas through its `describe` action.
  366. Composite helpers ride on that surface, shared with basecamp-mcp-server
  367. through basecamp-sdk so both servers answer the same way.
  368. `basecamp_recordings summarize` resolves the pointer an account event feed
  369. row carries — bucket id, recording id, and the event or recording type —
  370. into one compact projection, discovering a chat line's Campfire on the way.
  371. It is not backed by any single Basecamp endpoint, and the catalogue says so:
  372. it carries no method and no path, where every model operation carries both,
  373. and its summary opens with "Synthetic:". `basecamp_messages create_comment`
  374. is an ordinary endpoint with a synthetic parameter: `mentions`, a list of
  375. person ids expanded client-side into the attachment markup Basecamp reads as
  376. a mention. `basecamp_recordings move` and `copy` file a recording into
  377. another container, in its project or another one, as the web's Move… and
  378. Copy… dialogs do: they wait for Basecamp to finish and return the new
  379. recording, and a failure says whether trying again is safe.
  380. ```bash
  381. basecamp mcp --read-only # serve only read-only actions
  382. basecamp mcp --domains projects,todos # narrow the served surface (fails closed on unknown keys)
  383. ```
  384. ## Configuration
  385. ```
  386. ~/.config/basecamp/ # Your Basecamp identity
  387. ├── credentials.json # OAuth tokens (fallback when keyring unavailable)
  388. └── config.json # Global preferences
  389. ~/.config/basecamp/theme/ # Tool display (optional)
  390. └── colors.toml # TUI color scheme
  391. ~/.cache/basecamp/ # Ephemeral tool data
  392. ├── completion.json # Tab completion cache
  393. └── resilience/ # Circuit breaker state
  394. .basecamp/ # Per-repo (committed to git)
  395. └── config.json # Project, account defaults
  396. ```
  397. A leftover `~/.config/basecamp/client.json` (from the removed development
  398. client-registration flow) is obsolete and safe to delete.
  399. ### Trusting repository configuration
  400. Repository and local configs may set ordinary defaults such as `project_id`
  401. and `todolist_id` without approval. Settings that control connections, including
  402. `base_url`, `profiles`, and `default_profile`, require explicit trust:
  403. ```bash
  404. basecamp config trust /path/to/.basecamp/config.json
  405. ```
  406. Review the file and its server addresses before trusting it. Trust applies to
  407. its current security-sensitive settings, not just its path. If those settings
  408. change, the CLI ignores them and warns until you review and trust the file
  409. again. Formatting changes and changes to ordinary top-level defaults retain
  410. trust.
  411. **Upgrading from path-only trust:** previously trusted configs must be reviewed
  412. and trusted again before their security-sensitive settings apply. Global
  413. configuration and saved credentials are unchanged. Until reapproval, trust-gated
  414. connection, cache, and LLM settings are ignored, including `base_url`, `profiles`,
  415. `default_profile`, `cache_dir`, `cache_enabled`, and LLM provider, endpoint, model,
  416. and budget settings. Ordinary top-level defaults such as `account_id`,
  417. `project_id`, and `todolist_id` still apply. Check the effective server address,
  418. account, and project with `basecamp config show` before making changes.
  419. ## Troubleshooting
  420. ```bash
  421. basecamp doctor # Check CLI health and diagnose issues
  422. basecamp doctor --verbose # Verbose output with details
  423. basecamp doctor --json # Structured checks, including Claude, Codex and Grok
  424. ```
  425. ### Windows: Smart App Control and SmartScreen
  426. Releases up to v0.8.0-rc.1 ship an unsigned `basecamp.exe`. To check whether
  427. your installed binary is signed:
  428. ```powershell
  429. Get-AuthenticodeSignature (Get-Command basecamp).Source
  430. ```
  431. **Smart App Control** (Windows 11) blocks unsigned executables no matter where
  432. they were downloaded from, and it has no per-app exceptions — this applies to
  433. the PowerShell installer, Scoop installs, and manual downloads alike. If it
  434. blocks an unsigned `basecamp.exe`, two options:
  435. 1. **Use WSL2 (preferred).** Install the Linux build inside WSL2 — Smart App
  436. Control doesn't apply there and your Windows security setup is untouched:
  437. `wsl --install`, then inside the WSL terminal:
  438. `curl -fsSL https://basecamp.com/install-cli | bash`
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 567 on GitHub
  439. 2. **Turn Smart App Control off** (Windows Security → App & browser control →
  440. Smart App Control settings) **and leave it off while using the unsigned
  441. build.** Because there are no per-app exceptions, turning it back on
  442. re-blocks `basecamp.exe` on its next run — only re-enable after upgrading
  443. to a signed build. Windows 11 with the March/April 2026 updates can
  444. re-enable Smart App Control from Windows Security without a reset; on older
  445. builds re-enabling requires resetting Windows, so prefer WSL2 there.
  446. **SmartScreen** (without Smart App Control) may warn on first run of an
  447. unrecognized executable — choose "More info" → "Run anyway" if you downloaded
  448. the release from this repository.
  449. ## Development
  450. ```bash
  451. make build # Build binary
  452. make test # Run Go tests
  453. make test-e2e # Run e2e tests
  454. make lint # Run linter
  455. make check # All checks (fmt-check, vet, lint, test, test-e2e)
  456. ```
  457. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup.
  458. ## License
  459. [MIT](MIT-LICENSE)
scripts/install.ps1 · Bundled script · 479 lines · 2 findings marked
  1. $ErrorActionPreference = 'Stop'
  2. try {
  3. [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
  4. } catch {
  5. # Ignore when the runtime manages TLS defaults.
  6. }
  7. # Environment options:
  8. # BASECAMP_VERSION Specific version to install (default: latest)
  9. # BASECAMP_BIN_DIR Where to install the binary
  10. # BASECAMP_SKIP_SETUP Set to 1 to skip first-time setup (still runs
  11. # `basecamp setup agents`)
  12. # BASECAMP_NONINTERACTIVE
  13. # Set to 1 or true to use non-interactive setup
  14. # BASECAMP_SETUP_AGENT Which coding agent(s) `setup agents` connects:
  15. # claude | codex | grok | all | none. Unset = auto-detect.
  16. # Piped install sets it for the interpreter, not the fetch:
  17. # $env:BASECAMP_SETUP_AGENT='codex'; irm https://raw.githubusercontent.com/basecamp/basecamp-cli/main/scripts/install.ps1 | iex
  18. $Repo = 'basecamp/basecamp-cli'
  19. $Version = $env:BASECAMP_VERSION
  20. $SkipSetup = $env:BASECAMP_SKIP_SETUP
  21. $BinDir = $env:BASECAMP_BIN_DIR
  22. function Step([string]$Message) {
  23. Write-Host " -> $Message"
  24. }
  25. function Info([string]$Message) {
  26. Write-Host " + $Message" -ForegroundColor Green
  27. }
  28. function Warn([string]$Message) {
  29. Write-Warning $Message
  30. }
  31. function Test-TruthyEnvironmentValue([string]$Value) {
  32. return $Value -match '^(?i:1|true)$'
  33. }
  34. function Fail([string]$Message) {
  35. throw $Message
  36. }
  37. function Get-PlatformArch {
  38. $arch = $env:PROCESSOR_ARCHITECTURE
  39. if ($env:PROCESSOR_ARCHITEW6432) {
  40. $arch = $env:PROCESSOR_ARCHITEW6432
  41. }
  42. switch -Regex ($arch) {
  43. '^(AMD64|x86_64)$' { return 'amd64' }
  44. '^ARM64$' { return 'arm64' }
  45. default { Fail "Unsupported Windows architecture: $arch" }
  46. }
  47. }
  48. function Get-LatestVersion {
  49. Step 'Resolving latest release version...'
  50. # Follow the releases/latest redirect first to avoid GitHub API rate limits.
  51. # -MaximumRedirection 0 turns the expected 302 into a terminating error, so
  52. # we read Location off the caught response. Headers.Location is Uri on
  53. # PowerShell Core and string on Windows PowerShell 5.1, so coerce to string.
  54. $location = $null
  55. try {
  56. $response = Invoke-WebRequest -MaximumRedirection 0 -UseBasicParsing `
  57. -Headers @{ 'User-Agent' = 'basecamp-cli-installer' } `
  58. -Uri "https://github.com/$Repo/releases/latest" -ErrorAction Stop
  59. $location = $response.Headers.Location
  60. } catch {
  61. if ($_.Exception.Response) {
  62. $location = $_.Exception.Response.Headers.Location
  63. if (-not $location) {
  64. $location = $_.Exception.Response.Headers['Location']
  65. }
  66. }
  67. }
  68. if ($location) {
  69. $tag = ([string]$location).TrimEnd('/').Split('/')[-1]
  70. $candidate = $tag.TrimStart('v')
  71. if ($candidate -match '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$') {
  72. return $candidate
  73. }
  74. }
  75. # Fall back to the GitHub API if the redirect path didn't yield a semver tag.
  76. $release = Invoke-RestMethod -ErrorAction Stop `
  77. -Headers @{ 'User-Agent' = 'basecamp-cli-installer' } `
  78. -Uri "https://api.github.com/repos/$Repo/releases/latest"
  79. if (-not $release.tag_name) {
  80. Fail 'Could not determine latest release version from GitHub.'
  81. }
  82. return $release.tag_name.TrimStart('v')
  83. }
  84. function Download-File([string]$Url, [string]$Destination) {
  85. # -UseBasicParsing avoids initializing IE's MSHTML parser on Windows
  86. # PowerShell 5.1 -- required on Server Core and locked-down installs.
  87. # No-op on PowerShell 6+, where basic parsing is the only mode.
  88. Invoke-WebRequest -UseBasicParsing -ErrorAction Stop `
  89. -Headers @{ 'User-Agent' = 'basecamp-cli-installer' } `
  90. -Uri $Url -OutFile $Destination
  91. }
  92. function Verify-Checksum([string]$ChecksumsPath, [string]$ArchivePath, [string]$ArchiveName) {
  93. $expected = $null
  94. foreach ($line in Get-Content $ChecksumsPath) {
  95. if ($line -match '^(?<hash>[0-9a-fA-F]{64})\s+\*?(?<name>.+)$') {
  96. if ($Matches.name -eq $ArchiveName) {
  97. $expected = $Matches.hash.ToLowerInvariant()
  98. break
  99. }
  100. }
  101. }
  102. if (-not $expected) {
  103. Fail "Could not find checksum entry for $ArchiveName"
  104. }
  105. $actual = (Get-FileHash -Algorithm SHA256 -Path $ArchivePath).Hash.ToLowerInvariant()
  106. if ($actual -ne $expected) {
  107. Fail "Checksum verification failed for $ArchiveName"
  108. }
  109. Info 'Checksum verified'
  110. }
  111. # Get-CosignBundleSupport decides how to verify the release's Sigstore bundle,
  112. # which is the new (protobuf, v0.3+json) format:
  113. # v3+ -> new-format parsing is the default; no extra flag ('')
  114. # v2.6 - v2.x -> needs '--new-bundle-format=true' (v2.x defaults it to false)
  115. # < v2.6 / unparseable -> $null: cannot verify (v2.4 chokes on the bundle's
  116. # tlog key type, v2.2 lacks the flag); caller warns and skips
  117. function Get-CosignBundleSupport {
  118. try { $versionOutput = & cosign version 2>$null } catch { return $null }
  119. foreach ($line in @($versionOutput)) {
  120. if ("$line" -match 'GitVersion:\s*v?(\d+)\.(\d+)\.') {
  121. $major = [int]$Matches[1]
  122. $minor = [int]$Matches[2]
  123. if ($major -ge 3) { return '' }
  124. if ($major -eq 2 -and $minor -ge 6) { return '--new-bundle-format=true' }
  125. return $null
  126. }
  127. }
  128. return $null
  129. }
  130. function Verify-CosignSignature([string]$Version, [string]$BaseUrl, [string]$TmpDir) {
  131. if (-not (Get-Command cosign -ErrorAction SilentlyContinue)) {
  132. return
  133. }
  134. $bundleFlag = Get-CosignBundleSupport
  135. if ($null -eq $bundleFlag) {
  136. Step "Skipping signature verification: this cosign can't verify the release bundle format (need cosign >= 2.6)"
  137. return
  138. }
  139. Step 'Verifying cosign signature...'
  140. $bundlePath = Join-Path $TmpDir 'checksums.txt.bundle'
  141. $checksumsPath = Join-Path $TmpDir 'checksums.txt'
  142. Download-File -Url "$BaseUrl/checksums.txt.bundle" -Destination $bundlePath
  143. $cosignArgs = @('verify-blob', '--bundle', $bundlePath)
  144. if ($bundleFlag) {
  145. $cosignArgs += $bundleFlag
  146. }
  147. $cosignArgs += @(
  148. '--certificate-identity', "https://github.com/basecamp/basecamp-cli/.github/workflows/release.yml@refs/tags/v$Version",
  149. '--certificate-oidc-issuer', 'https://token.actions.githubusercontent.com',
  150. $checksumsPath
  151. )
  152. # Native exits don't trigger ErrorActionPreference=Stop on Windows PowerShell 5.1,
  153. # so check $LASTEXITCODE explicitly -- otherwise a verify failure would false-green.
  154. & cosign @cosignArgs
  155. if ($LASTEXITCODE -ne 0) {
  156. Fail 'Cosign signature verification failed'
  157. }
  158. Info 'Signature verified'
  159. }
  160. # Get-FirstRunFailureMessage diagnoses why running the freshly installed
  161. # basecamp.exe failed. It best-effort probes the binary's Authenticode status
  162. # and the Smart App Control state (releases up to v0.8.0-rc.1 ship an unsigned
  163. # basecamp.exe, which Smart App Control blocks at process creation). Every
  164. # branch leads with the original failure: diagnosis augments, never masks,
  165. # the underlying error. PowerShell 5.1-compatible.
  166. function Get-FirstRunFailureMessage([string]$Binary, [string]$Reason) {
  167. $sigStatus = $null
  168. try {
  169. $sigStatus = (Get-AuthenticodeSignature -FilePath $Binary -ErrorAction Stop).Status
  170. } catch { }
  171. # Smart App Control state: 0 = off, 1 = on, 2 = evaluation mode.
  172. $sacState = $null
  173. try {
  174. $policy = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy' -ErrorAction Stop
  175. $sacState = $policy.VerifiedAndReputablePolicyState
  176. } catch { }
  177. $lead = "Installed basecamp.exe to $Binary, but running it failed: $Reason"
  178. if ("$sigStatus" -eq 'NotSigned' -and ($sacState -eq 1 -or $sacState -eq 2)) {
  179. return @"
  180. $lead
  181. This build of basecamp.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:
  182. 1. (Preferred) Install the Linux build inside WSL2 - Smart App Control does not apply there and your Windows security setup is untouched:
  183. wsl --install
  184. then, inside the WSL terminal:
  185. curl -fsSL https://basecamp.com/install-cli | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 220 on GitHub
  186. 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 basecamp.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.
  187. "@
  188. }
  189. if ("$sigStatus" -eq 'NotSigned') {
  190. return @"
  191. $lead
  192. This build of basecamp.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 basecamp.exe, then re-run the installer.
  193. "@
  194. }
  195. return @"
  196. $lead
  197. If Windows Security or antivirus interfered, check Windows Security > Protection history, restore or allow basecamp.exe, then re-run the installer.
  198. "@
  199. }
  200. function Get-PathEntries {
  201. param([string]$PathValue)
  202. if (-not $PathValue) {
  203. return @()
  204. }
  205. return $PathValue -split ';' | Where-Object { $_ }
  206. }
  207. function Normalize-PathEntry([string]$PathValue) {
  208. if (-not $PathValue) {
  209. return ''
  210. }
  211. return $PathValue.Trim().TrimEnd('\\')
  212. }
  213. function Get-DefaultBinDir {
  214. $currentPathEntries = Get-PathEntries $env:Path
  215. $userPathEntries = Get-PathEntries ([Environment]::GetEnvironmentVariable('Path', 'User'))
  216. $allEntries = @($currentPathEntries + $userPathEntries) | ForEach-Object { Normalize-PathEntry $_ }
  217. $homeBin = Normalize-PathEntry (Join-Path $HOME 'bin')
  218. $homeLocalBin = Normalize-PathEntry (Join-Path $HOME '.local\bin')
  219. if ($allEntries -contains $homeBin) {
  220. return $homeBin
  221. }
  222. if ($allEntries -contains $homeLocalBin) {
  223. return $homeLocalBin
  224. }
  225. return $homeBin
  226. }
  227. function Ensure-UserPath([string]$Dir) {
  228. $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
  229. $segments = Get-PathEntries $userPath
  230. $normalizedSegments = $segments | ForEach-Object { Normalize-PathEntry $_ }
  231. $normalizedDir = Normalize-PathEntry $Dir
  232. if ($normalizedSegments -contains $normalizedDir) {
  233. return
  234. }
  235. $newPath = if ($userPath) { "$Dir;$userPath" } else { $Dir }
  236. [Environment]::SetEnvironmentVariable('Path', $newPath, 'User')
  237. $env:Path = "$Dir;$env:Path"
  238. Info "Added $Dir to your user PATH"
  239. }
  240. function Test-InteractiveSession {
  241. if ($Host.Name -ne 'ConsoleHost' -and $Host.Name -ne 'Visual Studio Code Host') {
  242. return $false
  243. }
  244. try {
  245. return -not [Console]::IsInputRedirected -and
  246. -not [Console]::IsOutputRedirected -and
  247. -not [Console]::IsErrorRedirected
  248. } catch {
  249. return $false
  250. }
  251. }
  252. # Invoke-FirstTimeSetup runs optional onboarding without changing the successful
  253. # installation result. The native process inherits the console streams so setup
  254. # can render and pass its terminal-safety gate.
  255. function Invoke-FirstTimeSetup([string]$Binary) {
  256. try {
  257. & $Binary setup
  258. if ($LASTEXITCODE -eq 0) {
  259. return
  260. }
  261. } catch {
  262. # The retry guidance below covers process-launch and command failures alike.
  263. }
  264. Warn 'First-time setup did not finish. Run it again with: basecamp setup'
  265. }
  266. # Invoke-PostInstallSetup installs the baseline skill and connects coding agents
  267. # without prompting, honoring BASECAMP_SETUP_AGENT (claude|codex|grok|all|none;
  268. # unset = auto-detect). It is strictly best-effort: agent setup must never fail
  269. # an otherwise-successful install, so every native call is wrapped so a nonzero
  270. # exit (amplified by $ErrorActionPreference='Stop' +
  271. # $PSNativeCommandUseErrorActionPreference) cannot terminate the installer.
  272. #
  273. # Cross-version: newer binaries expose the intent-neutral `setup agents`. Older
  274. # release binaries (the hosted install.ps1 from main can outrun the latest
  275. # release) fall back WITHOUT reintroducing the Claude-first bug -- only an
  276. # *explicitly* selected agent is connected. `all` runs every per-agent setup the
  277. # binary supports; unset/auto/ambiguous installs the shared skill only. Each
  278. # native call is individually guarded so a nonzero exit never aborts the install.
  279. function Invoke-PostInstallSetup([string]$Binary) {
  280. # None of these calls touch credentials, but release binaries up to v0.7.2
  281. # probe the OS keyring on startup for every command, and a locked headless
  282. # keychain blocks that probe forever. Set the escape hatch for the duration
  283. # of setup only, restoring the caller's value (or absence) on the way out.
  284. $savedNoKeyring = $env:BASECAMP_NO_KEYRING
  285. $env:BASECAMP_NO_KEYRING = '1'
  286. try {
  287. try { $help = & $Binary setup --help 2>$null } catch { $help = '' }
  288. if ($help -match '(?m)^\s+agents\s') {
  289. try { & $Binary setup agents } catch { }
  290. return
  291. }
  292. $selector = $env:BASECAMP_SETUP_AGENT
  293. if ($selector -in @('claude', 'codex', 'grok')) {
  294. # Capability-check first: an old `setup` parent accepts an unadvertised agent
  295. # id as a stray arg and launches the INTERACTIVE wizard. Degrade to the skill.
  296. if ($help -match "(?m)^\s+$selector\s") {
  297. try { & $Binary setup $selector } catch { }
  298. } else {
  299. try { & $Binary skill install } catch { }
  300. }
  301. } elseif ($selector -eq 'all') {
  302. $ranAgent = $false
  303. foreach ($agent in @('claude', 'codex', 'grok')) {
  304. if ($help -match "(?m)^\s+$agent\s") {
  305. # Mark attempted (not succeeded) -- matches install.sh's `ran_agent=1`,
  306. # which is set regardless of the setup call's exit status.
  307. $ranAgent = $true
  308. try { & $Binary setup $agent } catch { }
  309. }
  310. }
  311. if (-not $ranAgent) { try { & $Binary skill install } catch { } }
  312. } else {
  313. try { & $Binary skill install } catch { }
  314. }
  315. } finally {
  316. $env:BASECAMP_NO_KEYRING = $savedNoKeyring
  317. }
  318. }
  319. function Main {
  320. $arch = Get-PlatformArch
  321. if (-not $BinDir) {
  322. $script:BinDir = Get-DefaultBinDir
  323. }
  324. $resolvedVersion = if ($Version) { $Version } else { Get-LatestVersion }
  325. if ($resolvedVersion -notmatch '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$') {
  326. Fail "Invalid version '$resolvedVersion'. Expected semver format like 1.2.3 or 1.2.3-rc.1."
  327. }
  328. $archiveName = "basecamp_${resolvedVersion}_windows_${arch}.zip"
  329. $baseUrl = "https://github.com/$Repo/releases/download/v$resolvedVersion"
  330. Step "Downloading basecamp v$resolvedVersion for windows_$arch..."
  331. $tmpDir = Join-Path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
  332. New-Item -ItemType Directory -Path $tmpDir | Out-Null
  333. try {
  334. $archivePath = Join-Path $tmpDir $archiveName
  335. $checksumsPath = Join-Path $tmpDir 'checksums.txt'
  336. $extractDir = Join-Path $tmpDir 'extract'
  337. Download-File -Url "$baseUrl/$archiveName" -Destination $archivePath
  338. Step 'Verifying checksums...'
  339. Download-File -Url "$baseUrl/checksums.txt" -Destination $checksumsPath
  340. Verify-Checksum -ChecksumsPath $checksumsPath -ArchivePath $archivePath -ArchiveName $archiveName
  341. Verify-CosignSignature -Version $resolvedVersion -BaseUrl $baseUrl -TmpDir $tmpDir
  342. Step 'Extracting...'
  343. Expand-Archive -Path $archivePath -DestinationPath $extractDir -Force
  344. $binaryPath = Join-Path $extractDir 'basecamp.exe'
  345. if (-not (Test-Path $binaryPath)) {
  346. Fail 'basecamp.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.'
  347. }
  348. $installedBinary = Join-Path $BinDir 'basecamp.exe'
  349. New-Item -ItemType Directory -Force -Path $BinDir | Out-Null
  350. # Windows holds an exclusive lock on running PE files; -Force doesn't help.
  351. # Generic catch -- typed catches miss ActionPreferenceStopException wrapping.
  352. try {
  353. Copy-Item -Force $binaryPath $installedBinary -ErrorAction Stop
  354. } catch {
  355. Fail "Failed to install basecamp.exe. If it is in use, close any running 'basecamp' processes and re-run the installer. If Windows Security quarantined it, check Windows Security > Protection history and restore it. (Original error: $($_.Exception.Message))"
  356. }
  357. Ensure-UserPath -Dir $BinDir
  358. Info "Installed basecamp to $installedBinary"
  359. # Smart App Control kills CreateProcess for unsigned executables, so the
  360. # first run is where a block surfaces. Generic catch per the Copy-Item
  361. # precedent above.
  362. try {
  363. $installedVersion = & $installedBinary --version
  364. } catch {
  365. Fail (Get-FirstRunFailureMessage -Binary $installedBinary -Reason $_.Exception.Message)
  366. }
  367. Info "$installedVersion installed"
  368. $isInteractive = Test-InteractiveSession
  369. Write-Host ''
  370. if ($SkipSetup -eq '1') {
  371. Step 'Skipping first-time setup (BASECAMP_SKIP_SETUP=1)'
  372. # Still install the baseline skill and connect coding agents (best-effort).
  373. Invoke-PostInstallSetup $installedBinary
  374. Write-Host ''
  375. Write-Host ' Next steps:'
  376. Write-Host ' basecamp auth login Authenticate with Basecamp'
  377. Write-Host ' basecamp setup Run first-time setup'
  378. Write-Host ''
  379. } elseif ($isInteractive -and -not (Test-TruthyEnvironmentValue $env:BASECAMP_NONINTERACTIVE)) {
  380. Invoke-FirstTimeSetup $installedBinary
  381. } else {
  382. if (Test-TruthyEnvironmentValue $env:BASECAMP_NONINTERACTIVE) {
  383. Info 'Skipping first-time setup because BASECAMP_NONINTERACTIVE is enabled.'
  384. } else {
  385. Info 'Skipping first-time setup because PowerShell is running non-interactively.'
  386. }
  387. # Install the baseline skill and connect coding agents (best-effort).
  388. Invoke-PostInstallSetup $installedBinary
  389. Write-Host ''
  390. Write-Host ' Installed executable:'
  391. Write-Host " $installedBinary"
  392. Write-Host ''
  393. Write-Host ' In this session, use the installed executable path directly for follow-up actions like starting login.'
  394. Write-Host ''
  395. }
  396. }
  397. finally {
  398. if (Test-Path $tmpDir) {
  399. Remove-Item -Recurse -Force $tmpDir
  400. }
  401. }
  402. }
  403. Main
scripts/install.sh · Bundled script · 647 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. # install.sh - Install basecamp CLI
  3. #
  4. # Usage:
  5. # curl -fsSL https://raw.githubusercontent.com/basecamp/basecamp-cli/main/scripts/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 5 on GitHub
  6. #
  7. # Options (via environment):
  8. # BASECAMP_BIN_DIR Where to install binary
  9. # (default: ~/bin if on PATH, else ~/.local/bin if on PATH;
  10. # otherwise ~/bin on Windows, ~/.local/bin elsewhere)
  11. # BASECAMP_VERSION Specific version to install (default: latest)
  12. # BASECAMP_SKIP_SETUP Set to 1 to skip first-time setup after install
  13. # (still runs `basecamp setup agents` to install the skill
  14. # and connect coding agents)
  15. # BASECAMP_NONINTERACTIVE
  16. # Set to 1 or true to use non-interactive setup
  17. # (still runs `basecamp setup agents` to install the skill
  18. # and connect coding agents)
  19. # BASECAMP_SETUP_AGENT
  20. # Which coding agent(s) `setup agents` connects:
  21. # claude | codex | grok | all | none. Unset = auto-detect (connect
  22. # a single detected agent; if several, install the skill
  23. # only and surface the per-agent commands).
  24. # Piped install sets it for the interpreter, not the fetch:
  25. # curl -fsSL https://basecamp.com/install-cli | BASECAMP_SETUP_AGENT=codex bash
  26. set -euo pipefail
  27. REPO="basecamp/basecamp-cli"
  28. BIN_DIR="${BASECAMP_BIN_DIR:-}"
  29. VERSION="${BASECAMP_VERSION:-}"
  30. CURL_SCHANNEL_FALLBACK_FLAG=""
  31. CURL_LAST_ERROR=""
  32. CURL_FALLBACK_NOTED=0
  33. # Color helpers — respect NO_COLOR (https://no-color.org)
  34. if [[ -z "${NO_COLOR:-}" ]] && [[ -t 1 ]]; then
  35. bold() { printf '\033[1m%s\033[0m' "$1"; }
  36. green() { printf '\033[32m%s\033[0m' "$1"; }
  37. red() { printf '\033[31m%s\033[0m' "$1"; }
  38. dim() { printf '\033[2m%s\033[0m' "$1"; }
  39. else
  40. bold() { printf '%s' "$1"; }
  41. green() { printf '%s' "$1"; }
  42. red() { printf '%s' "$1"; }
  43. dim() { printf '%s' "$1"; }
  44. fi
  45. info() { echo " $(green "✓") $1"; }
  46. step() { echo " $(bold "→") $1"; }
  47. warn() { echo " $(bold "!") $1" >&2; }
  48. error() { echo " $(red "✗ ERROR:") $1" >&2; exit 1; }
  49. env_value_is_true() {
  50. case "$1" in
  51. 1|[Tt][Rr][Uu][Ee]) return 0 ;;
  52. *) return 1 ;;
  53. esac
  54. }
  55. can_run_first_time_setup() {
  56. ! env_value_is_true "${BASECAMP_NONINTERACTIVE:-}" &&
  57. [[ -t 1 ]] && [[ -t 2 ]] && { : </dev/tty; } 2>/dev/null
  58. }
  59. run_first_time_setup() {
  60. local binary="$1"
  61. if "$binary" setup; then
  62. return 0
  63. fi
  64. warn "First-time setup did not finish. Run it again with: basecamp setup"
  65. }
  66. find_sha256_cmd() {
  67. if command -v sha256sum &>/dev/null; then
  68. echo "sha256sum"
  69. elif command -v shasum &>/dev/null; then
  70. echo "shasum -a 256"
  71. else
  72. error "No SHA256 tool found (need sha256sum or shasum)"
  73. fi
  74. }
  75. # NOTE: Keep the installer helper functions below in sync with scripts/ensure-basecamp.sh.
  76. # These scripts stay self-contained on purpose so they can run without sourcing extra files.
  77. path_contains_dir() {
  78. local dir="$1"
  79. [[ ":$PATH:" == *":$dir:"* ]]
  80. }
  81. default_bin_dir() {
  82. local platform="$1"
  83. if path_contains_dir "$HOME/bin"; then
  84. echo "$HOME/bin"
  85. return 0
  86. fi
  87. if path_contains_dir "$HOME/.local/bin"; then
  88. echo "$HOME/.local/bin"
  89. return 0
  90. fi
  91. if [[ "$platform" == windows_* ]]; then
  92. echo "$HOME/bin"
  93. else
  94. echo "$HOME/.local/bin"
  95. fi
  96. }
  97. detect_platform() {
  98. local os arch
  99. os=$(uname -s | tr '[:upper:]' '[:lower:]')
  100. case "$os" in
  101. darwin) os="darwin" ;;
  102. linux) os="linux" ;;
  103. freebsd) os="freebsd" ;;
  104. openbsd) os="openbsd" ;;
  105. mingw*|msys*|cygwin*) os="windows" ;;
  106. *) error "Unsupported OS: $os" ;;
  107. esac
  108. arch=$(uname -m)
  109. case "$arch" in
  110. x86_64|amd64) arch="amd64" ;;
  111. aarch64|arm64) arch="arm64" ;;
  112. *) error "Unsupported architecture: $arch" ;;
  113. esac
  114. echo "${os}_${arch}"
  115. }
  116. detect_curl_fallback() {
  117. local version_output help_output
  118. version_output=$(curl --version 2>/dev/null || true)
  119. if [[ "$version_output" != *[Ss]channel* ]]; then
  120. return 0
  121. fi
  122. help_output=$(curl --help all 2>/dev/null || true)
  123. if [[ "$help_output" == *"--ssl-revoke-best-effort"* ]]; then
  124. CURL_SCHANNEL_FALLBACK_FLAG="--ssl-revoke-best-effort"
  125. elif [[ "$help_output" == *"--ssl-no-revoke"* ]]; then
  126. CURL_SCHANNEL_FALLBACK_FLAG="--ssl-no-revoke"
  127. fi
  128. }
  129. curl_run() {
  130. # --show-error guarantees curl writes errors to stderr even if a future caller
  131. # passes -s without -S. The Schannel revocation detection below depends on
  132. # finding CRYPT_E_NO_REVOCATION_CHECK in stderr; without --show-error a -s
  133. # caller would silently lose the fallback.
  134. local err_file status err
  135. err_file=$(mktemp "${TMPDIR:-/tmp}/basecamp-curl.XXXXXX")
  136. if curl --show-error "$@" 2>"$err_file"; then
  137. rm -f "$err_file"
  138. CURL_LAST_ERROR=""
  139. return 0
  140. else
  141. status=$?
  142. fi
  143. err=$(<"$err_file")
  144. rm -f "$err_file"
  145. if [[ $status -ne 0 ]] && [[ -n "$CURL_SCHANNEL_FALLBACK_FLAG" ]] && [[ "$err" == *"CRYPT_E_NO_REVOCATION_CHECK"* ]]; then
  146. if [[ $CURL_FALLBACK_NOTED -eq 0 ]]; then
  147. echo " $(bold "→") Windows certificate revocation checks are unavailable; retrying curl with ${CURL_SCHANNEL_FALLBACK_FLAG}" >&2
  148. CURL_FALLBACK_NOTED=1
  149. fi
  150. err_file=$(mktemp "${TMPDIR:-/tmp}/basecamp-curl.XXXXXX")
  151. if curl --show-error "$CURL_SCHANNEL_FALLBACK_FLAG" "$@" 2>"$err_file"; then
  152. rm -f "$err_file"
  153. CURL_LAST_ERROR=""
  154. return 0
  155. else
  156. status=$?
  157. fi
  158. err=$(<"$err_file")
  159. rm -f "$err_file"
  160. fi
  161. CURL_LAST_ERROR="$err"
  162. return "$status"
  163. }
  164. get_latest_version() {
  165. local url version api_json
  166. # Follow the releases/latest redirect to get the version from the final URL.
  167. # Avoids the GitHub API (no rate limiting) and grep/sed (better Windows compat).
  168. if url=$(curl_run -fsSL -o /dev/null -w '%{url_effective}' "https://github.com/${REPO}/releases/latest"); then
  169. version="${url##*/}"
  170. version="${version#v}"
  171. if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
  172. echo "$version"
  173. return 0
  174. fi
  175. fi
  176. # Fallback to the GitHub API if redirect parsing fails. Whitespace-tolerant
  177. # regex so a future GitHub format change (pretty-print, extra spaces) doesn't
  178. # silently break the fallback. Pure bash so no GNU-awk dependency.
  179. if api_json=$(curl_run -fsSL -H 'Accept: application/vnd.github+json' -H 'User-Agent: basecamp-cli-installer' "https://api.github.com/repos/${REPO}/releases/latest"); then
  180. if [[ $api_json =~ \"tag_name\"[[:space:]]*:[[:space:]]*\"v?([^\"]+)\" ]]; then
  181. version="${BASH_REMATCH[1]}"
  182. if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
  183. echo "$version"
  184. return 0
  185. fi
  186. fi
  187. fi
  188. 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."
  189. }
  190. # cosign_version prints the installed cosign's version (e.g. "v2.6.0"), empty
  191. # when it can't be determined. The trailing `|| true` is load-bearing: under
  192. # `set -euo pipefail` a broken cosign (nonzero `cosign version`) would
  193. # otherwise abort the whole installer from inside the caller's command
  194. # substitution — an unusable cosign must degrade to warn-and-skip, not abort.
  195. cosign_version() {
  196. cosign version 2>/dev/null | awk -F': *' '/^GitVersion/ {print $2; exit}' || true
  197. }
  198. # cosign_bundle_support decides how to verify the release's Sigstore bundle,
  199. # which is the new (protobuf, v0.3+json) format. Prints the extra verify-blob
  200. # flag to use ("" for none) and returns 0 when verification can proceed:
  201. # v3+ → new-format parsing is the default; no flag
  202. # v2.6 – v2.x → needs --new-bundle-format=true (v2.x defaults it to false)
  203. # < v2.6 → cannot verify (v2.4 chokes on the bundle's tlog key type,
  204. # v2.2 lacks the flag entirely); caller warns and skips
  205. cosign_bundle_support() {
  206. local version="$1" major minor
  207. if [[ "$version" =~ ^v?([0-9]+)\.([0-9]+)\. ]]; then
  208. major="${BASH_REMATCH[1]}"
  209. minor="${BASH_REMATCH[2]}"
  210. else
  211. return 1
  212. fi
  213. if (( major >= 3 )); then
  214. echo ""
  215. elif (( major == 2 && minor >= 6 )); then
  216. echo "--new-bundle-format=true"
  217. else
  218. return 1
  219. fi
  220. }
  221. verify_checksums() {
  222. local version="$1"
  223. local tmp_dir="$2"
  224. local archive_name="$3"
  225. local base_url="https://github.com/${REPO}/releases/download/v${version}"
  226. step "Verifying checksums..."
  227. if ! curl_run -fsSL "${base_url}/checksums.txt" -o "${tmp_dir}/checksums.txt"; then
  228. error "Failed to download checksums.txt${CURL_LAST_ERROR:+ (${CURL_LAST_ERROR})}"
  229. fi
  230. # Verify SHA256 checksum of the downloaded archive
  231. local expected actual
  232. expected=$(awk -v f="$archive_name" '$2 == f || $2 == ("*" f) {print $1; exit}' "${tmp_dir}/checksums.txt")
  233. actual=$(cd "$tmp_dir" && $(find_sha256_cmd) "$archive_name" | awk '{print $1}')
  234. [[ -n "$expected" && "$expected" == "$actual" ]] \
  235. || error "Checksum verification failed for $archive_name"
  236. info "Checksum verified"
  237. # If cosign is available and understands the bundle format, verify the signature
  238. if command -v cosign &>/dev/null; then
  239. local cosign_ver bundle_flag
  240. cosign_ver=$(cosign_version)
  241. if bundle_flag=$(cosign_bundle_support "$cosign_ver"); then
  242. step "Verifying cosign signature..."
  243. if ! curl_run -fsSL "${base_url}/checksums.txt.bundle" -o "${tmp_dir}/checksums.txt.bundle"; then
  244. error "Failed to download checksums.txt.bundle${CURL_LAST_ERROR:+ (${CURL_LAST_ERROR})}"
  245. fi
  246. local -a cosign_args=(verify-blob --bundle "${tmp_dir}/checksums.txt.bundle")
  247. if [[ -n "$bundle_flag" ]]; then
  248. cosign_args+=("$bundle_flag")
  249. fi
  250. cosign_args+=( \
  251. --certificate-identity "https://github.com/basecamp/basecamp-cli/.github/workflows/release.yml@refs/tags/v${version}" \
  252. --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
  253. "${tmp_dir}/checksums.txt")
  254. cosign "${cosign_args[@]}" \
  255. || error "Cosign signature verification failed"
  256. info "Signature verified"
  257. else
  258. step "Skipping signature verification: cosign ${cosign_ver:-unknown} can't verify this release's bundle format (need cosign >= 2.6)"
  259. fi
  260. fi
  261. }
  262. download_binary() {
  263. local version="$1"
  264. local platform="$2"
  265. local tmp_dir="$3"
  266. local url archive_name ext
  267. # Determine archive extension
  268. if [[ "$platform" == windows_* ]]; then
  269. ext="zip"
  270. else
  271. ext="tar.gz"
  272. fi
  273. archive_name="basecamp_${version}_${platform}.${ext}"
  274. url="https://github.com/${REPO}/releases/download/v${version}/${archive_name}"
  275. step "Downloading basecamp v${version} for ${platform}..."
  276. if ! curl_run -fsSL "$url" -o "${tmp_dir}/${archive_name}"; then
  277. error "Failed to download from $url${CURL_LAST_ERROR:+ (${CURL_LAST_ERROR})}"
  278. fi
  279. # Verify integrity before extraction
  280. verify_checksums "$version" "$tmp_dir" "$archive_name"
  281. # Extract binary
  282. step "Extracting..."
  283. if [[ "$ext" == "zip" ]]; then
  284. unzip -q "${tmp_dir}/${archive_name}" -d "$tmp_dir"
  285. else
  286. tar -xzf "${tmp_dir}/${archive_name}" -C "$tmp_dir"
  287. fi
  288. # Find and install binary
  289. local binary_name="basecamp"
  290. if [[ "$platform" == windows_* ]]; then
  291. binary_name="basecamp.exe"
  292. fi
  293. if [[ ! -f "${tmp_dir}/${binary_name}" ]]; then
  294. error "Binary not found in archive"
  295. fi
  296. mkdir -p "$BIN_DIR"
  297. mv "${tmp_dir}/${binary_name}" "$BIN_DIR/"
  298. chmod +x "$BIN_DIR/$binary_name"
  299. info "Installed basecamp to $BIN_DIR/$binary_name"
  300. }
  301. setup_path() {
  302. # Check if BIN_DIR is in PATH
  303. if [[ ":$PATH:" == *":$BIN_DIR:"* ]]; then
  304. return 0
  305. fi
  306. step "Adding $BIN_DIR to PATH"
  307. local shell_rc=""
  308. case "${SHELL:-}" in
  309. */zsh) shell_rc="$HOME/.zshrc" ;;
  310. */bash) shell_rc="$HOME/.bashrc" ;;
  311. *) shell_rc="$HOME/.profile" ;;
  312. esac
  313. local path_line="export PATH=\"$BIN_DIR:\$PATH\""
  314. if [[ -f "$shell_rc" ]] && grep -qF "$BIN_DIR" "$shell_rc" 2>/dev/null; then
  315. info "PATH already configured in $shell_rc"
  316. else
  317. echo "" >> "$shell_rc"
  318. echo "# Added by basecamp installer" >> "$shell_rc"
  319. echo "$path_line" >> "$shell_rc"
  320. info "Added to $shell_rc"
  321. info "Run: source $shell_rc"
  322. fi
  323. }
  324. verify_install() {
  325. local platform="$1"
  326. local binary_name="basecamp"
  327. if [[ "$platform" == windows_* ]]; then
  328. binary_name="basecamp.exe"
  329. fi
  330. local installed_version err_file
  331. err_file=$(mktemp)
  332. if installed_version=$("$BIN_DIR/$binary_name" --version 2>"$err_file"); then
  333. rm -f "$err_file"
  334. info "$(green "${installed_version} installed")"
  335. return 0
  336. fi
  337. local run_error
  338. run_error=$(cat "$err_file")
  339. rm -f "$err_file"
  340. local detail="Installation failed - basecamp not working"
  341. if [[ -n "$run_error" ]]; then
  342. detail="$detail: $run_error"
  343. fi
  344. if [[ "$platform" == windows_* ]]; then
  345. detail="$detail
  346. Windows may have blocked the unsigned executable: Smart App Control only runs code-signed binaries.
  347. Either install inside WSL2 (curl -fsSL https://basecamp.com/install-cli | bash) or see
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 411 on GitHub
  348. https://github.com/basecamp/basecamp-cli#windows-smart-app-control-and-smartscreen"
  349. fi
  350. error "$detail"
  351. }
  352. setup_theme() {
  353. local basecamp_theme_dir="$HOME/.config/basecamp/theme"
  354. local omarchy_theme_dir="$HOME/.config/omarchy/current/theme"
  355. # Skip if basecamp theme already configured
  356. if [[ -e "$basecamp_theme_dir" ]]; then
  357. return 0
  358. fi
  359. # Link to Omarchy theme if available
  360. if [[ -d "$omarchy_theme_dir" ]]; then
  361. step "Linking basecamp theme to system theme"
  362. mkdir -p "$HOME/.config/basecamp"
  363. ln -s "$omarchy_theme_dir" "$basecamp_theme_dir" || info "Note: Could not link theme (continuing anyway)"
  364. fi
  365. }
  366. show_banner() {
  367. # Skip braille art if terminal is too narrow (logo 32 + gap 3 + text 8 = 43)
  368. local cols
  369. cols=$(tput cols 2>/dev/null || echo 80)
  370. if [[ "$cols" -ge 44 ]]; then
  371. local y="" b="" r=""
  372. if [[ -z "${NO_COLOR:-}" ]] && [[ -t 1 ]]; then
  373. y=$'\033[38;2;232;162;23m' # brand yellow #e8a217
  374. b=$'\033[1m' # bold
  375. r=$'\033[0m' # reset
  376. fi
  377. local logo=(
  378. "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣶⣶⣶⣶⣶⣶⣦⣤⣀"
  379. "⠀⠀⠀⠀⠀⠀⠀⢀⣴⣾⣿⣿⣿⠿⠿⠛⠛⠛⠻⠿⣿⣿⣿⣦⣀"
  380. "⠀⠀⠀⠀⠀⢀⣴⣿⣿⡿⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⣿⣿⣦⡀"
  381. "⠀⠀⠀⠀⣴⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣄"
  382. "⠀⠀⢀⣼⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⡀⠀⠀⠀⠀⢻⣿⣿⣆"
  383. "⠀⢀⣾⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⠃⠀⠀⠀⠀⠀⢻⣿⣿⡄"
  384. "⠀⣼⣿⣿⠃⠀⠀⣠⣶⣿⣷⣦⣄⠀⠀⢀⣼⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿⡀"
  385. "⢸⣿⣿⠇⠀⢠⣾⣿⡿⠛⠻⣿⣿⣷⣤⣾⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣇"
  386. "⠈⠉⠉⠀⢠⣿⣿⡟⠁⠀⠀⠈⠻⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿"
  387. "⠀⠀⠀⢠⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡇"
  388. "⠀⠀⠀⢻⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⠇"
  389. "⠀⠀⠀⠀⠙⠿⣿⣿⣷⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣶⣿⣿⡿⠋"
  390. "⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⡿⠟⠉"
  391. "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠛⠿⠿⠿⠿⠿⠿⠟⠛⠛⠉⠉"
  392. )
  393. local text_line=6
  394. echo ""
  395. if [[ -t 1 ]] && [[ -z "${NO_COLOR:-}" ]]; then
  396. # Animated reveal on TTY (skip cursor movement when NO_COLOR is set)
  397. for line in "${logo[@]}"; do
  398. echo "${y}${line}${r}"
  399. sleep 0.03
  400. done
  401. # Type "Basecamp" to the right of the logo via cursor repositioning
  402. sleep 0.1
  403. local text="Basecamp"
  404. local lines_up=$(( ${#logo[@]} - text_line ))
  405. printf "\033[${lines_up}A\033[36G"
  406. for (( i=0; i<${#text}; i++ )); do
  407. printf "${b}${text:$i:1}${r}"
  408. sleep 0.03
  409. done
  410. printf "\033[${lines_up}B\r"
  411. else
  412. # Static output when piped — no sleeps, no cursor movement
  413. for i in "${!logo[@]}"; do
  414. if [[ "$i" -eq "$text_line" ]]; then
  415. echo "${logo[$i]} Basecamp"
  416. else
  417. echo "${logo[$i]}"
  418. fi
  419. done
  420. fi
  421. echo ""
  422. else
  423. echo ""
  424. echo "Basecamp CLI"
  425. echo ""
  426. fi
  427. }
  428. main() {
  429. show_banner
  430. # Check for curl
  431. if ! command -v curl &>/dev/null; then
  432. error "curl is required but not installed"
  433. fi
  434. local platform version tmp_dir
  435. platform=$(detect_platform)
  436. detect_curl_fallback
  437. if [[ -z "$BIN_DIR" ]]; then
  438. BIN_DIR=$(default_bin_dir "$platform")
  439. fi
  440. if [[ -n "$VERSION" ]]; then
  441. version="$VERSION"
  442. if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
  443. error "Invalid version '${version}'. Expected semver format (e.g. 1.2.3 or 1.2.3-rc.1)."
  444. fi
  445. else
  446. version=$(get_latest_version)
  447. fi
  448. tmp_dir=$(mktemp -d)
  449. trap "rm -rf '${tmp_dir}'" EXIT
  450. local binary_name="basecamp"
  451. if [[ "$platform" == windows_* ]]; then
  452. binary_name="basecamp.exe"
  453. fi
  454. download_binary "$version" "$platform" "$tmp_dir"
  455. setup_path
  456. setup_theme
  457. verify_install "$platform"
  458. echo ""
  459. # Run first-time setup when a controlling terminal can handle OAuth approval.
  460. # Non-interactive environments (CI, redirected output, coding agents like Claude
  461. # Code or Codex) get the baseline skill installed, a best-effort agent connection
  462. # via `setup agents`, and next-step instructions instead.
  463. if [[ "${BASECAMP_SKIP_SETUP:-}" == "1" ]]; then
  464. step "Skipping first-time setup (BASECAMP_SKIP_SETUP=1)"
  465. post_install_setup "$binary_name"
  466. echo ""
  467. echo " Next steps:"
  468. echo " $(bold "basecamp auth login") Authenticate with Basecamp"
  469. echo " $(bold "basecamp setup") Run first-time setup"
  470. echo ""
  471. elif can_run_first_time_setup; then
  472. # The canonical `curl ... | bash` install owns stdin while Bash reads the
  473. # script. Give setup the controlling terminal so OAuth can complete.
  474. run_first_time_setup "$BIN_DIR/$binary_name" </dev/tty
  475. else
  476. if env_value_is_true "${BASECAMP_NONINTERACTIVE:-}"; then
  477. info "Skipping first-time setup (BASECAMP_NONINTERACTIVE enabled)."
  478. else
  479. info "Skipping first-time setup (no usable terminal detected)."
  480. fi
  481. post_install_setup "$binary_name"
  482. echo ""
  483. echo " Next steps:"
  484. echo " $(bold "basecamp auth login") Authenticate with Basecamp"
  485. echo " $(bold "basecamp setup") Run first-time setup"
  486. echo ""
  487. fi
  488. }
  489. # binary_supports_setup_agents reports whether the installed binary exposes the
  490. # `setup agents` subcommand (added after v0.7.2). The hosted install.sh from main
  491. # can outrun the latest release, so we probe rather than assume.
  492. binary_supports_setup_agents() {
  493. "$1" setup --help 2>/dev/null | grep -qE '^[[:space:]]+agents[[:space:]]'
  494. }
  495. # binary_supports_setup_agent reports whether the binary exposes a per-agent
  496. # `setup <id>` subcommand for the given agent id (claude, codex or grok).
  497. binary_supports_setup_agent() {
  498. "$1" setup --help 2>/dev/null | grep -qE "^[[:space:]]+$2[[:space:]]"
  499. }
  500. # post_install_setup installs the baseline skill and connects coding agents
  501. # without prompting. It honors BASECAMP_SETUP_AGENT (claude|codex|grok|all|none;
  502. # unset = auto-detect). Never runs the interactive wizard.
  503. #
  504. # Cross-version: newer binaries get the intent-neutral `setup agents`. Older
  505. # release binaries (no `setup agents`) fall back WITHOUT reintroducing the
  506. # Claude-first bug — only an *explicitly* selected agent is connected. `all`
  507. # runs every per-agent setup the binary supports; an unset, auto, or ambiguous
  508. # selector installs the shared skill only (`skill install`).
  509. #
  510. # Every real invocation carries BASECAMP_NO_KEYRING=1, per-command rather than
  511. # exported: these calls never touch credentials, but release binaries up to
  512. # v0.7.2 probe the OS keyring on startup for every command, and on a locked
  513. # headless keychain (CI, ssh) that probe blocks forever. The `setup --help`
  514. # capability probes stay bare — help short-circuits before the probe.
  515. post_install_setup() {
  516. local binary_name="$1"
  517. local bin="$BIN_DIR/$binary_name"
  518. if binary_supports_setup_agents "$bin"; then
  519. BASECAMP_NO_KEYRING=1 "$bin" setup agents || true
  520. return 0
  521. fi
  522. case "${BASECAMP_SETUP_AGENT:-}" in
  523. claude|codex|grok)
  524. # Capability-check first: an old `setup` parent accepts an unadvertised
  525. # agent id as a stray positional arg and launches the INTERACTIVE wizard,
  526. # violating the non-interactive contract. Degrade to the shared skill.
  527. if binary_supports_setup_agent "$bin" "${BASECAMP_SETUP_AGENT}"; then
  528. BASECAMP_NO_KEYRING=1 "$bin" setup "${BASECAMP_SETUP_AGENT}" || true
  529. else
  530. BASECAMP_NO_KEYRING=1 "$bin" skill install || true
  531. fi
  532. ;;
  533. all)
  534. # Explicit "every agent": dispatch each per-agent setup the binary knows,
  535. # falling back to the shared skill if it supports none of them.
  536. local ran_agent=0 agent
  537. for agent in claude codex grok; do
  538. if binary_supports_setup_agent "$bin" "$agent"; then
  539. BASECAMP_NO_KEYRING=1 "$bin" setup "$agent" || true
  540. ran_agent=1
  541. fi
  542. done
  543. [[ "$ran_agent" -eq 1 ]] || BASECAMP_NO_KEYRING=1 "$bin" skill install || true
  544. ;;
  545. *)
  546. # Intent-neutral on old binaries: install the shared skill, never pick an
  547. # agent. The user connects one via the printed "Next steps".
  548. BASECAMP_NO_KEYRING=1 "$bin" skill install || true
  549. ;;
  550. esac
  551. }
  552. # Guard so sourcing the script (e.g. from tests) doesn't run the installer.
  553. # The if-form is required: `[[ … ]] && main` returns 1 when sourced, which
  554. # trips `set -e` in the sourcing shell. The `:-$0` fallback is also
  555. # required: bash executing from stdin (curl | bash) or -c leaves BASH_SOURCE
  556. # unset, and the bare expansion aborts under `set -u` (#568).
  557. if [[ "${BASH_SOURCE[0]:-$0}" == "$0" ]]; then
  558. main "$@"
  559. fi
scripts/stage-installer-ps1.sh · Bundled script · 57 lines · 1 finding marked
  1. #!/usr/bin/env sh
  2. # Usage: scripts/stage-installer-ps1.sh SOURCE DEST
  3. #
  4. # Stage a copy of the PowerShell installer for Authenticode signing, in the
  5. # only shape where jsign's digest and PowerShell's agree.
  6. #
  7. # jsign computes the script digest as UTF-16LE of the file content with the
  8. # signature block stripped, and applies NO line-ending normalization
  9. # (SignableScript.computeDigest). PowerShell's script SIP normalizes to CRLF
  10. # before hashing. Sign an LF file and the two digests differ, so
  11. # Get-AuthenticodeSignature reports HashMismatch and the installer is refused
  12. # under AllSigned/RemoteSigned. That is what shipped in v0.8.0-rc.2.
  13. #
  14. # Two invariants make the digests agree:
  15. #
  16. # CRLF removes the normalization disagreement above.
  17. #
  18. # pure ASCII removes an encoding disagreement that CRLF alone would not
  19. # fix. The file has no BOM; jsign assumes UTF-8, but Windows
  20. # PowerShell 5.1 assumes ANSI (Windows-1252) for BOM-less files.
  21. # Any byte above 0x7F therefore decodes to different characters
  22. # on each side and the digests diverge again. Within ASCII the
  23. # two encodings are identical byte-for-byte, so the question
  24. # never arises. Adding a BOM would be the other way out, but it
  25. # trades a known-good invariant for jsign's
  26. # isByteOrderMarkSigned() matching Microsoft's undocumented
  27. # treatment of the BOM in the hash — untestable without a
  28. # signing round-trip.
  29. #
  30. # The source file is left alone: raw-main install.ps1 stays LF and unsigned,
  31. # which is the `irm | iex` path and needs neither.
  32. set -eu
  33. SRC="${1:?usage: stage-installer-ps1.sh SOURCE DEST}"
  34. DEST="${2:?usage: stage-installer-ps1.sh SOURCE DEST}"
  35. [ -f "$SRC" ] || { echo "stage-installer-ps1: source not found: $SRC" >&2; exit 1; }
  36. # Reject non-ASCII before signing rather than after. Under LC_ALL=C every byte
  37. # above 0x7F is non-printable, so this matches exactly the bytes that would
  38. # make jsign and PowerShell 5.1 disagree.
  39. if LC_ALL=C grep -n '[^[:print:][:space:]]' "$SRC" >/dev/null 2>&1; then
  40. echo "stage-installer-ps1: $SRC contains non-ASCII bytes, which would produce" >&2
  41. echo " a signature PowerShell 5.1 rejects as HashMismatch (it decodes BOM-less" >&2
  42. echo " files as Windows-1252 while jsign assumes UTF-8). Offending lines:" >&2
  43. LC_ALL=C grep -n '[^[:print:][:space:]]' "$SRC" >&2
  44. exit 1
  45. fi
  46. mkdir -p "$(dirname "$DEST")"
  47. # LF -> CRLF, idempotent: strip any existing CR first so a CRLF source does
  48. # not become CR CR LF.
  49. awk '{ sub(/\r$/, ""); printf "%s\r\n", $0 }' "$SRC" > "$DEST"
  50. echo "stage-installer-ps1: staged $DEST (pure ASCII, CRLF)"

Version history

  • v0.30.011/14/2026

  • v0.29.011/13/2026

  • v0.27.011/11/2026

  • v0.25.011/9/2026

  • v0.24.311/8/2026

  • v0.24.011/7/2026

  • v0.22.111/2/2026

  • v0.22.010/31/2026

  • v0.21.010/29/2026

  • v0.20.010/28/2026

  • v0.19.010/27/2026

  • v0.18.110/25/2026

  • v0.17.010/23/2026

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.