feat: distribute bark via npm and Homebrew#3
Open
Abhinav-Chdhary wants to merge 1 commit into
Open
Conversation
Add one-line installs that don't require a Go toolchain or C compiler: - npm: `npm install -g @debkanchan/bark`. Uses the platform-packages + optionalDependencies pattern (esbuild/biome-style). A tiny Node launcher (npm/bark) execs the per-platform binary shipped in @debkanchan/bark-<os>-<arch>, selected automatically via npm "os"/"cpu" fields. - Homebrew: `brew install debkanchan/tap/bark`, via a generated formula pushed to the tap repo on release. Release automation (.github/workflows/release.yml) gains two jobs gated on the existing release: `npm` (stamps versions + stages binaries via npm/build.mjs, publishes platform packages then the main package) and `homebrew` (generates Formula/bark.rb via scripts/gen-homebrew-formula.mjs and commits it to the tap). Both no-op cleanly until their secrets (NPM_TOKEN / HOMEBREW_TAP_TOKEN) are set. README install section now leads with brew/npm; `go install` is documented as requiring a C compiler (CGO). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two compiler-free, one-line install paths for
bark, so users don't need a Go toolchain or a C compiler:Today the only install paths are
go install(which silently requires a C compiler, because the tree-sitter bindings need CGO) and manual binary downloads. This PR layers npm + Homebrew distribution on top of the existing release binaries — no changes to the Go source or the build matrix.What's included
npm (
@debkanchan/bark)Uses the platform-packages +
optionalDependenciespattern (same as esbuild / biome / swc):npm/bark/bin/bark) that resolves andspawnSyncs the correct binary — no shell, args passed as an array.@debkanchan/bark-<os>-<arch>(linux x64/arm64, darwin x64/arm64, win32 x64), each gated by npm'sos/cpufields so only the matching one installs.npm/build.mjsstamps versions and stages the release binaries into each package at publish time.Homebrew (
debkanchan/tap/bark)scripts/gen-homebrew-formula.mjsgeneratesFormula/bark.rbfrom the release archives + their.sha256sidecars (validates the checksum format) and the release job commits it to a tap repo.Release automation (
.github/workflows/release.yml)releasejob:npm(publishes the 5 platform packages, then the main package) andhomebrew(generates the formula and pushes it to the tap).Docs
go installis kept but documented as requiring a C compiler (CGO).Verified locally (before opening this PR)
brew installvia a local tap → download + checksum verification + install +brew testpass +brew auditclean.npm installandnpm install -g→ only the host-matching platform package installs (os/cpugating works), launcher runs, exit codes and--format jsonpass through.Two bugs were caught and fixed during that testing:
testcaptured only stdout, butbark --helpwrites usage to stderr (→--help 2>&1); anddef installinside the platform blocks violated Homebrew's RuboCop (→ single top-levelinstallusingDir["bark-*"]).npm publish npm/<pkg>is interpreted by npm as a GitHubuser/reposhorthand rather than a folder (→./npm/<pkg>).Maintainer setup required before a tagged release will publish
NPM_TOKENrepo secret with publish access to the@debkanchanscope (and confirm the scope/name).debkanchan/homebrew-taprepo + aHOMEBREW_TAP_TOKENsecret (PAT with write access to it).Until those exist, the new jobs skip silently and releases behave exactly as before.
🤖 Generated with Claude Code