Installation, Checksums, and Builds
Supported platforms
Section titled “Supported platforms”| Platform | Architecture | npm prebuilt asset | Zig cross-compile target |
|---|---|---|---|
| macOS | Apple Silicon (arm64) |
claude-p-darwin-arm64.gz |
aarch64-macos |
| macOS | Intel (x64) |
claude-p-darwin-x64.gz |
x86_64-macos |
| Linux | x64 |
claude-p-linux-x64.gz |
x86_64-linux-musl |
| Linux | arm64 |
claude-p-linux-arm64.gz |
aarch64-linux-musl |
Windows is not supported (no POSIX forkpty). package.json enforces "os": ["darwin", "linux"], "cpu": ["x64", "arm64"], and "engines": { "node": ">=18" }.
npm shim and SHA-256 verification
Section titled “npm shim and SHA-256 verification”When you install via npm or npx, scripts/install.js (npm postinstall) downloads claude-p-<platform>-<arch>.gz from https://github.com/smithersai/claude-p/releases/download/v<version>/ and verifies it before writing anything.
Trust root
Section titled “Trust root”| Install source | Digest source | Outcome |
|---|---|---|
| npm tarball | checksums.json bundled in the tarball by scripts/publish.mjs and covered by npm provenance. It is the only trust root; SHA256SUMS is not consulted. |
Exact digest match installs. The manifest must record both assets["claude-p-<platform>-<arch>.gz"] and binSha256["<platform>-<arch>"]; a missing entry fails before any reuse check or download. A version mismatch or digest mismatch is also a ChecksumError. |
Source checkout (no checksums.json) |
The release’s SHA256SUMS. Required for v0.1.3 and later; CLAUDE_P_REQUIRE_CHECKSUM=1 requires it for older versions too. |
Exact digest match installs. HTTP 404 for a required SHA256SUMS, a missing entry, or a mismatch is a ChecksumError. It never degrades to an unverified binary. |
Reusing an existing binary
Section titled “Reusing an existing binary”An existing prebuilt/<platform>-<arch>/claude-p is reused only when checksums.json records a binSha256 digest for the platform and the file matches it exactly. The installer checks that the file is a regular, executable file within the 64 MiB cap before hashing it. On any mismatch it unlinks the rejected file before downloading, so a later offline exit 0 never leaves an unverified executable for bin/claude-p.js to run. It then downloads, verifies the compressed and decompressed digests, and atomically renames the new binary into place. A source checkout (no checksums.json) never reuses a binary and leaves an existing one in place until a verified download replaces it.
Download and staging hardening
Section titled “Download and staging hardening”httpsonly, fromgithub.comand*.githubusercontent.com, at most 5 redirects.- One overall 30 s deadline covers DNS, connect, every redirect, and the body, alongside the socket inactivity timeout.
- Caps: 32 MiB compressed, 64 MiB decompressed.
- The package root,
prebuilt/, andprebuilt/<platform>-<arch>/must not be symlinks. The binary is written through an exclusively created, randomly named staging file with mode0755, then renamed into place. A symlink at the destination is refused.
Exit codes and environment
Section titled “Exit codes and environment”| Condition | npm install result |
|---|---|
| Verified binary installed or reused | Exits 0. |
ChecksumError (integrity failure) |
Exits 1. Always fatal. |
Unsafe install path, local filesystem error (ENOSPC, EACCES, EPERM, EISDIR, EROFS), or an oversize or off-host download |
Exits 1. Never softened. |
| Connectivity failure (DNS, refused or reset connection, HTTP error, timeout, deadline) | Prints a warning naming CLAUDE_P_SKIP_DOWNLOAD=1, CLAUDE_P_STRICT_INSTALL=1, and NODE_USE_ENV_PROXY=1, then exits 0. No binary is installed. |
Connectivity failure with CLAUDE_P_STRICT_INSTALL=1 |
Exits 1. |
CLAUDE_P_SKIP_DOWNLOAD=1 |
Skips the download; exits 0. |
| Unsupported platform | Skips; exits 0. |
Proxy-only networks
Section titled “Proxy-only networks”The installer uses Node’s built-in https module, which ignores HTTPS_PROXY by default. Behind a proxy, set NODE_USE_ENV_PROXY=1 (Node >= 22.21 or >= 24) alongside HTTPS_PROXY so Node routes the download through it:
NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://proxy.example:3128 npm install claude-pOn older Node, or when GitHub Releases is unreachable, set CLAUDE_P_SKIP_DOWNLOAD=1 and place a binary you verified yourself at prebuilt/<platform>-<arch>/claude-p, or build from source.
At runtime, bin/claude-p.js spawns prebuilt/<platform>-<arch>/claude-p with stdio: "inherit" and forwards SIGINT, SIGTERM, and SIGHUP.
Release publishing
Section titled “Release publishing”scripts/publish.mjs builds the four targets and writes SHA256SUMS and checksums.json into release-assets/. Before it creates or attaches anything to a tag, it checks that the local tag’s peeled commit equals HEAD, and that the remote tag, if it exists, peels to the same commit. On reruns against an existing release it verifies every existing asset by digest against SHA256SUMS and checksums.json before reporting success, and uploads only missing assets. It stages the npm package in a private temporary directory with the generated checksums.json, checks that the packed tarball holds checksums.json with all four platforms at the package.json version, and runs npm publish from there. It never writes checksums.json into the repository root.
Build from source (Zig 0.15.2)
Section titled “Build from source (Zig 0.15.2)”build.zig.zon pins minimum_zig_version = "0.15.2" (required by zmux).
# Release binary → ./zig-out/bin/claude-pzig build -Doptimize=ReleaseSafe
# Cross-compile for any supported target (e.g. Linux musl from macOS)zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux-musl -p outRunning the test suites
Section titled “Running the test suites”Test counts change with every release; print the current ones with --summary all.
# Unit tests across src/*.zig (zero external dependencies)zig build test --summary allzig build test -Dtest-filter="daemon"
# End-to-end tests against the real `claude` binary on $PATH (no mocks)CLAUDE_P_E2E=1 zig build test-integration --summary allCLAUDE_P_E2E=1 zig build test-integration -Dtest-filter="resume"
# CI hygiene checks (version lockstep across package.json, build.zig.zon, src/root.zig)node scripts/publish.mjs --check-versionsnode --check scripts/install.js && node --check scripts/publish.mjsnode --test .smithers/tests/install-checksum.test.mjs tests/prop/js_supplychain_prop.mjs