Skip to content

feat: distribute bark via npm and Homebrew#3

Open
Abhinav-Chdhary wants to merge 1 commit into
debkanchan:mainfrom
Abhinav-Chdhary:feat/npm-homebrew-install
Open

feat: distribute bark via npm and Homebrew#3
Abhinav-Chdhary wants to merge 1 commit into
debkanchan:mainfrom
Abhinav-Chdhary:feat/npm-homebrew-install

Conversation

@Abhinav-Chdhary

Copy link
Copy Markdown
Contributor

Summary

Adds two compiler-free, one-line install paths for bark, so users don't need a Go toolchain or a C compiler:

brew install debkanchan/tap/bark      # macOS / Linux
npm install -g @debkanchan/bark       # any platform with Node.js

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 + optionalDependencies pattern (same as esbuild / biome / swc):

  • A tiny Node launcher (npm/bark/bin/bark) that resolves and spawnSyncs the correct binary — no shell, args passed as an array.
  • Five per-platform packages @debkanchan/bark-<os>-<arch> (linux x64/arm64, darwin x64/arm64, win32 x64), each gated by npm's os/cpu fields so only the matching one installs.
  • npm/build.mjs stamps versions and stages the release binaries into each package at publish time.

Homebrew (debkanchan/tap/bark)

  • scripts/gen-homebrew-formula.mjs generates Formula/bark.rb from the release archives + their .sha256 sidecars (validates the checksum format) and the release job commits it to a tap repo.

Release automation (.github/workflows/release.yml)

  • Two new jobs gated on the existing release job: npm (publishes the 5 platform packages, then the main package) and homebrew (generates the formula and pushes it to the tap).
  • Both no-op cleanly (green-skip) until their secrets are configured, so they never break a release before setup.

Docs

  • README install section now leads with brew/npm; go install is kept but documented as requiring a C compiler (CGO).

Verified locally (before opening this PR)

  • Homebrew: generated the formula against the real v0.1.1 release artifacts and ran the actual brew install via a local tap → download + checksum verification + install + brew test pass + brew audit clean.
  • npm: published all 6 packages to a local registry (verdaccio) and installed both npm install and npm install -g → only the host-matching platform package installs (os/cpu gating works), launcher runs, exit codes and --format json pass through.

Two bugs were caught and fixed during that testing:

  1. The Homebrew formula's test captured only stdout, but bark --help writes usage to stderr (→ --help 2>&1); and def install inside the platform blocks violated Homebrew's RuboCop (→ single top-level install using Dir["bark-*"]).
  2. npm publish npm/<pkg> is interpreted by npm as a GitHub user/repo shorthand rather than a folder (→ ./npm/<pkg>).

Maintainer setup required before a tagged release will publish

  • npm: an NPM_TOKEN repo secret with publish access to the @debkanchan scope (and confirm the scope/name).
  • Homebrew: a debkanchan/homebrew-tap repo + a HOMEBREW_TAP_TOKEN secret (PAT with write access to it).

Until those exist, the new jobs skip silently and releases behave exactly as before.

🤖 Generated with Claude Code

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>
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