Skip to content

Add nodespace-cli formula for the headless CLI install path - #2

Merged
mstomar125 merged 2 commits into
NodeSpaceAI:mainfrom
mstomar125:nodespace-cli-formula-2146
Aug 19, 2026
Merged

mstomar125 merged 2 commits into
NodeSpaceAI:mainfrom
mstomar125:nodespace-cli-formula-2146

Conversation

@mstomar125

Copy link
Copy Markdown
Collaborator

Summary

Part of NodeSpaceAI/nodespace-core#2146. There was no Homebrew route to a headless CLI at all — the existing nodespace cask installs the full GUI app, and the only CLI-only path was cargo install nodespace-cli, which needs a Rust toolchain.

Adds Formula/nodespace-cli.rb, distinct from the nodespace cask: installs prebuilt nodespace (CLI) and nodespaced (daemon) binaries from nodespace-core's GitHub Releases, with a brew services-manageable daemon (brew services start nodespace-cli). README updated to document both install paths side by side.

Note on access: this account (mstomar125) has read-only (pull) access to NodeSpaceAI/homebrew-nodespace — I can open this PR from my own fork, but cannot merge it myself (GitHub also blocks formal self-approval on one's own PR regardless). A maintainer with write access needs to review and merge.

Notable findings from testing (see commit message for full detail)

  • v0.2.0 has no macOS Intel build. The formula raises a clear odie() message on that platform rather than failing obscurely.
  • The release's own SHA256SUMS lists checksums for assets that don't exist. nodespace-x86_64-apple-darwin / nodespaced-x86_64-apple-darwin have entries in SHA256SUMS but are not actual uploaded release assets (verified via gh release view v0.2.0 --json assets, not just the checksums file). Every digest in this formula was computed locally from bytes actually downloaded from the release — never copied from SHA256SUMS. Filed as a separate nodespace-core follow-up (release asset/checksum inconsistency).
  • A real bug caught by actually installing it: #{version} inside the nested resource "nodespaced" do block resolves against the Resource's own (empty) version, not the Formula's — self changes inside that block. This 404'd on a URL with an empty version segment (.../download/v/nodespaced-...) until fixed by capturing the Formula's version into a local variable (release_version = version) before entering the resource block.
  • Two brew audit --strict findings were deliberately kept rather than "fixed": an explicit version stanza (audit calls it "redundant with version scanned from URL", but it's needed so a future version bump is a single-line diff, matching the same reasoning nodespace-core/scripts/update-homebrew-cask.ts documents for the sibling cask), and license :cannot_represent (nodespace-core's real license, FSL-1.1-Apache-2.0, has no SPDX identifier — this is Homebrew's documented escape hatch for exactly that case).

Testing (all in an isolated Homebrew prefix — a throwaway clone of Homebrew/brew, never this machine's real Homebrew)

  • brew style --formula — clean, no offenses
  • brew audit --formula --strict — clean aside from the two documented trade-offs above
  • brew install nodespaceai/homebrew-nodespace/nodespace-cli — real install, real download, real digest verification, succeeded (28.0MB, 7 files)
  • nodespace --version / nodespaced --version — both report 0.2.0 correctly
  • brew test nodespaceai/homebrew-nodespace/nodespace-cli — passes
  • brew services info — service block resolves correctly
  • brew uninstall nodespace-cli — clean removal

Acceptance criteria (from #2146, this repo's slice)

  • nodespace-cli formula exists in the tap and installs a headless CLI

🤖 Generated with Claude Code

Mayank Tomar and others added 2 commits August 19, 2026 10:39
There was no Homebrew route to a headless CLI at all -- the existing
`nodespace` cask installs the full GUI app, and the only CLI-only path was
`cargo install nodespace-cli`, which needs a Rust toolchain. This adds a
formula (distinct from the cask) that installs prebuilt `nodespace` and
`nodespaced` binaries from nodespace-core's GitHub Releases, with a
`brew services`-manageable daemon. See
NodeSpaceAI/nodespace-core#2146.

v0.2.0 has no macOS Intel build; the formula raises a clear odie() message
on that platform/arch combination rather than failing obscurely. Every
digest is computed locally from bytes actually downloaded from the
release, never copied from the release's own SHA256SUMS file -- which, it
turns out, lists checksums for nodespace-x86_64-apple-darwin /
nodespaced-x86_64-apple-darwin that are not actually present as release
assets (verified against `gh release view v0.2.0 --json assets`; filed
separately as a nodespace-core follow-up).

Verified in an isolated Homebrew prefix (a throwaway `brew` clone, not this
machine's real Homebrew): `brew style`/`brew audit --strict` clean aside
from two documented, intentional trade-offs (an explicit `version` stanza
kept for future single-line version bumps despite being "redundant" per
audit, and `license :cannot_represent` since nodespace-core's actual
license, FSL-1.1-Apache-2.0, has no SPDX identifier). A real `brew install`
caught and fixed a genuine bug: `#{version}` inside the nested `resource
"nodespaced" do` block resolved against the Resource's own empty version,
not the Formula's, 404'ing on a URL with an empty version segment --
fixed by capturing the Formula's version into a local variable before the
resource block. `brew test`, `brew services info`, and `brew uninstall`
all verified working.

Co-Authored-By: Claude <[email protected]>
… claim

Three real bugs found via actually running this in an isolated Homebrew
prefix, not just reading the source:

- brew style --fix's automatic stanza reordering (on_macos/on_linux moved
  ahead of conflicts_with, per FormulaAudit/ComponentsOrder) moved them
  above the release_version local variable's assignment too, which turns
  every #{release_version} interpolation into an undefined-local-variable
  error the instant the block runs -- Ruby resolves a bare identifier as a
  local-variable reference vs. a method call at parse time, based on
  whether an assignment has already been seen earlier in the source, not
  at block-execution time. Fixed by hand-ordering release_version before
  both platform blocks while still satisfying ComponentsOrder.
- `keep_alive false` in the service block is a no-op, not "don't restart"
  -- Homebrew's keep_alive? is only true when explicitly set truthy, so
  false and omitted are identical. nodespaced would never be relaunched by
  launchd/systemd after a crash despite the caveats explicitly selling
  `brew services start` as the reason to prefer it over running the
  binary directly. Now `keep_alive true`.
- The formula claimed `conflicts_with cask: "nodespace"` made the cask and
  this formula mutually exclusive. Verified directly (a synthetic same-tap
  cask with a real `binary` stanza, then installing this formula against
  it) that this declaration has NO enforcement effect, and that the
  cask-side mirror (`conflicts_with formula: "..."`) doesn't exist in
  current Homebrew at all (`Unknown key: :formula. Valid keys are: :cask`).
  Real observed behavior: both install successfully; `brew link` skips the
  colliding bin/nodespace symlink with a clear warning (not a hard
  failure, not a silent overwrite) and, because Homebrew links a keg's
  files as a unit, also skips bin/nodespaced even though its name doesn't
  collide with anything. `brew services start`/running nodespaced directly
  both still work via the opt/ symlink regardless. Removed the
  non-functional conflicts_with line and rewrote the caveats/README to
  describe the real, tested behavior instead of a false guarantee.

Also: nil-guards on the Dir[...].first glob lookups (a missing/renamed
release asset now gets a clear odie() message instead of a bare Ruby
TypeError), a chmod 0755 safety net after each bin.install (verified the
downloaded binaries already land executable in practice, but this makes
it not depend on that continuing to be true), and the test block now also
asserts the nodespaced resource installed and runs, not just nodespace.

Co-Authored-By: Claude <[email protected]>
@mstomar125

Copy link
Copy Markdown
Collaborator Author

Self-review update (round 2)

Pushed fixes for real, verified bugs found by adversarial review + follow-up isolated-prefix testing:

  1. Fixed: brew style --fix's auto-reordering broke the formula (moved on_macos/on_linux above the release_version local var they depend on — Ruby resolves identifiers as local-var-vs-method-call at parse time). Reordered by hand, verified brew audit/brew install both succeed.
  2. Fixed: keep_alive false in the service block was a no-op (Homebrew's keep_alive? treats false/omitted identically) — nodespaced would never auto-restart after a crash despite the caveats selling exactly that. Now keep_alive true.
  3. Fixed, most significant: conflicts_with cask: "nodespace" does nothing — verified directly with a synthetic same-tap cask providing a real binary stanza, then installing this formula against it: it still installs successfully, no refusal. Also confirmed the cask-side mirror (conflicts_with formula: "...") doesn't exist in current Homebrew (Unknown key: :formula. Valid keys are: :cask). Real observed behavior: brew link skips the colliding bin/nodespace symlink with a clear warning (not a silent overwrite, not a hard failure) and skips bin/nodespaced too since Homebrew links a keg's files as a unit — but brew services start/running nodespaced directly both still work via the opt/ symlink regardless of link state. Removed the non-functional declaration and rewrote the caveats/README to describe this real, tested behavior instead of a false "mutually exclusive" guarantee.
  4. Also: nil-guards on the Dir[...].first glob lookups, an explicit chmod 0755 safety net (verified binaries already land executable in practice — release.yml chmods before upload — but this doesn't depend on that continuing to hold), and the test do block now also asserts nodespaced installed/runs, not just nodespace.

Re-verified end to end in the isolated Homebrew prefix after every fix: brew style/brew audit --strict clean (one documented trade-off remains: the explicit version stanza), real install, real --version output from both binaries, brew test, brew services info, clean uninstall. Also confirmed no leftover state on the host machine after each test round (checked /Applications and the Caskroom directly).

Still can't merge this myself (read-only access to this repo, and GitHub blocks self-approval regardless) — needs a maintainer with write access.

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