Skip to content

feat(dist): support packaging pre-built binaries via --bin-dir#117

Merged
hyperb1iss merged 1 commit into
mainfrom
feat/dist-bin-dir
Jul 8, 2026
Merged

feat(dist): support packaging pre-built binaries via --bin-dir#117
hyperb1iss merged 1 commit into
mainfrom
feat/dist-bin-dir

Conversation

@hyperb1iss

@hyperb1iss hyperb1iss commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What

Adds a --bin-dir <dir> option to scripts/dist.sh that packages pre-built release binaries instead of building them in-script. When set, dist.sh skips its cargo build block entirely and installs hypercolor-daemon, hypercolor, hypercolor-app, and hypercolor-tray from the supplied directory. Everything else — web assets, completions generation, manifest, tarball layout — behaves exactly as before.

Why

Downstream packagers (superproject builds, distro packaging, CI pipelines that build binaries in separate cached jobs) need to assemble a distribution from binaries they built themselves. Today dist.sh always rebuilds, which forces a second full compile of the daemon just to get the staging/tarball logic. This seam separates "build the binaries" from "assemble the bundle" without changing the default path at all.

How it works

  • --bin-dir is validated immediately after argument parsing: it must be an absolute path (dist.sh cds to the repo root at startup, so relative paths would silently resolve against the wrong directory), the directory must exist, and all four binaries must be present and executable. Missing binaries are listed by name in the error.
  • When set, RELEASE_DIR points at the supplied directory and the cargo build step is skipped — including the cargo-cache-build.sh wrapper, so no toolchain state is touched.
  • Shell completions still run the installed CLI from the assembled bin/, so a supplied CLI needs to answer completions bash|zsh|fish (both real binaries do).
  • Usage comment and --help document the flag.

Validation

  • bash -n and shellcheck clean (no new findings vs main).
  • Full staging run with stub binaries: ./scripts/dist.sh --ci --skip-docs --web-assets <dir> --bin-dir <dir> --version 9.9.9 --target linux-amd64 produces a tarball that passes verify-release-artifact.sh end to end, including the live bin/hypercolor --version probe.
  • Validation failure paths exercised: relative path, missing directory, partial binary set — each dies with a clear message.

Heads-up found while testing

dist.sh on current main is broken independently of this change: packaging/icons/hypercolor.svg was removed in e1bd5c1 (new trinity logo TBD) but dist.sh still cps it and verify-release-artifact.sh hard-requires it in the bundle. Any dist run dies at icon staging until an SVG lands there. The stub run above had to supply a placeholder SVG to complete.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for packaging releases from a pre-built binary directory.
    • Introduced a new option to point the packaging process at an existing directory of executables.
  • Bug Fixes

    • Added validation to ensure the provided directory exists, is absolute, and contains the required runnable files.
    • Improved packaging flow to use the specified binaries directly and skip rebuilding them when available.

Downstream packagers and superprojects sometimes build the four release
binaries themselves (different workspace, different toolchain, or a
cross-build farm) and only need dist.sh for staging, completions, and
tarball assembly. A new --bin-dir <dir> option installs hypercolor-daemon,
hypercolor, hypercolor-app, and hypercolor-tray from that directory and
skips the cargo release build entirely.

The directory is validated up front, before any expensive work: it must
be an absolute path (the script cds to the repo root, so relative paths
would silently resolve against the wrong tree), it must exist, and all
four binaries must be present and executable, with the missing ones
named in the failure message. Everything downstream is unchanged:
RELEASE_DIR simply points at the supplied directory, completions are
still generated by running the installed CLI, and web assets, --ci, and
manifest.json behave exactly as before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a486c07-7b35-4566-853d-f33447b427af

📥 Commits

Reviewing files that changed from the base of the PR and between 0a06c4f and 0d9693b.

📒 Files selected for processing (1)
  • scripts/dist.sh

📝 Walkthrough

Walkthrough

The dist.sh script is extended with a new --bin-dir option that lets packaging use pre-built release binaries instead of building them via Cargo. It adds argument parsing, help text, validation of the binary directory and required executables, and conditional logic to skip the build step.

Changes

--bin-dir Option for Pre-built Binaries

Layer / File(s) Summary
CLI flag, docs, and help text
scripts/dist.sh
Adds usage comment, BIN_DIR variable, --bin-dir argument parsing, and updated --help output.
Validation and conditional build/packaging
scripts/dist.sh
Validates BIN_DIR is an absolute existing directory with required executable binaries, overrides RELEASE_DIR when set, and skips the Cargo build step in favor of using pre-built binaries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A bunny hops with binaries in paw,
No need to build, just check and draw!
--bin-dir whispers, "skip the wait,"
Hop straight to packaging, don't hesitate 🐇📦
Thump thump — dist.sh's new escape!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: dist packaging now supports pre-built binaries via --bin-dir.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hyperb1iss hyperb1iss merged commit 4677d61 into main Jul 8, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant