Download prebuilt binaries in the Herdr plugin build - #91
Conversation
The plugin build step now downloads the checksum-verified release archive matching the checkout version instead of compiling from source, so plugin users no longer need a source toolchain or dependency installs; a full obtain cycle takes seconds. Compiling remains available as the build-source verb for development. The frozen manifest argv is unchanged.
downloadPrebuilt now catches fetch and extraction exceptions and returns a friendly error with exit code 1 instead of an unhandled rejection, which in the panel also left the terminal in raw mode. The panel additionally skips rendering when its session was cleaned up while a download was in flight.
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness and diagnosability issues in the new download path (SHA parsing too strict and tar extraction failures can produce empty/unclear errors) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Herdr plugin shim (scripts/studio-plugin.ts) so build installs a checksum-verified, prebuilt Herdr Studio binary from the matching GitHub release instead of compiling from source, while keeping a build-source verb for development workflows.
Changes:
- Added release asset mapping + SHA256 parsing and implemented a download/verify/extract/install path for
build. - Made binary acquisition/service invocations async and added a re-entrancy guard in the interactive
panel. - Added unit tests for asset mapping and SHA256 parsing; updated plugin and deployment documentation to reflect the new no-toolchain behavior.
File summaries
| File | Description |
|---|---|
| scripts/studio-plugin.ts | Implements downloading and installing prebuilt release binaries; adds new build-source verb and async service flow. |
| scripts/studio-plugin.test.ts | Adds unit tests for platform→asset mapping and SHA256 parsing. |
| herdr-plugin.toml | Updates plugin documentation/comments to describe downloading prebuilt binaries and build-source. |
| docs/DEPLOYMENT.md | Updates deployment docs to reflect that plugin installs use prebuilt binaries (Bun still required for the shim). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
spawnSync sets error and a null status when tar cannot be spawned, so check extract.error first and name the requirement, and include the exit status in non-zero extraction failures.
There was a problem hiding this comment.
🟡 Changes recommended
The download/extraction flow should be tightened to extract only the expected tar member, and the new “maps every supported platform” unit test currently doesn’t actually cover all supported platform mappings.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/studio-plugin.test.ts:26
- This test claims to cover "every supported platform", but it currently doesn’t assert the
darwin-x64andlinux-arm64entries fromPLATFORM_ASSETS. Either add those assertions or rename the test so it matches what’s actually covered.
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
| const extract = spawnSync("tar", ["-xJf", archivePath, "-C", tmp], { | ||
| encoding: "utf8", | ||
| }); |
Summary
buildverb now downloads the checksum-verified prebuilt release archive (herdr-gui-<platform>.tar.xz) matching the checkout'spackage.jsonversion instead of runningbun install+ compile — plugin users no longer need any source toolchain; the frozen manifest argv is unchangedbuild-sourceverb for developmentensureBinary/servicebecame async to await downloads; the panel guards against re-entrant service keys while a download is in flightVerification
bun run format/lint/typecheck/test— 875 tests passbun scripts/studio-plugin.ts builddownloaded v0.5.0 darwin-arm64, verified the checksum, and installed a working binary in ~5s (vs ~1min compile)panelandurlpaths regression-checked against the downloaded binaryKnown boundary
buildrequires the matching release to exist and fails with a clear error otherwise