Skip to content

feat(release): distribute the CLI via Homebrew tap#111

Merged
amondnet merged 2 commits into
mainfrom
amondnet/homebrew
Jun 17, 2026
Merged

feat(release): distribute the CLI via Homebrew tap#111
amondnet merged 2 commits into
mainfrom
amondnet/homebrew

Conversation

@amondnet

@amondnet amondnet commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds automated Homebrew distribution for @pleaseai/ask, mirroring the pleaseai/asana setup. Users can now install the CLI as a standalone binary (no Node.js required):

brew install pleaseai/tap/ask

What changed

.github/workflows/release.yml — three new jobs gated on cli_release_created, running downstream of the existing release-please job:

  • build-binaries — single ubuntu runner, bun build --compile cross-compiles 4 targets (darwin/linux × x64/arm64) + .sha256 sums
  • upload-release-assets — attaches binaries to the ask-v* GitHub release
  • update-homebrew-formula — regenerates ask.rb in pleaseai/homebrew-tap via a GitHub App token (commit + push)

packages/cli/src/index.ts — compile-safe version resolution. The compiled binary has no package.json on disk, so version now prefers a compile-time literal (__ASK_VERSION__, injected via bun --define) and falls back to reading package.json for the npm/tsc build.

Note: --define 'process.env.X' does not work here because index.ts imports process from node:process (bun only substitutes the global process). A bare identifier define is used instead.

README.md — new "Install the CLI" section (brew + npm); the old dev-build section is relabeled "Development".

⚠️ Prerequisites (org-side setup)

  • APP_ID / PRIVATE_KEY secrets must exist on pleaseai/ask, and the GitHub App must be installed on both ask and homebrew-tap with contents: write (reusing the asana App is simplest).
  • ask.rb is created on the first release run — no need to pre-create it.

Verification

  • ✅ Compiled binary ask --version → correct version (gotcha fixed); npm/tsc fallback also correct
  • eslint clean
  • ✅ workflow YAML parses; generated ask.rb (heredoc dedent) produces valid Ruby structure matching asana's proven formula
  • Test failures in the sandbox are network-dependent (git clone / ls-remote) and unrelated to this change

🤖 Generated with Claude Code


Summary by cubic

Distribute the @pleaseai/ask CLI via a Homebrew tap so users can install a standalone binary with brew install pleaseai/tap/ask (no Node.js required). The release workflow builds cross-platform binaries and updates the pleaseai/homebrew-tap formula; requires GitHub App secrets APP_ID/PRIVATE_KEY on ask and homebrew-tap.

  • New Features

    • Release workflow builds bun --compile binaries for macOS/Linux (x64/arm64), uploads them with .sha256 sums, and regenerates ask.rb in pleaseai/homebrew-tap.
    • CLI version uses a compile-time __ASK_VERSION__ (injected by bun --define), with a package.json fallback for the npm/tsc build.
    • README adds an “Install the CLI” section (Homebrew and npm).
  • Bug Fixes

    • Ensure the first ask.rb creation is committed by requiring the file to be tracked before treating the update as a no-op.

Written for commit 1b8f1ed. Summary will update on new commits.

Add automated Homebrew distribution for @pleaseai/ask, mirroring the
pleaseai/asana setup. On every CLI release, release.yml now:

- builds standalone bun --compile binaries for darwin/linux x64/arm64
- attaches them (and their .sha256 sums) to the ask-v* GitHub release
- regenerates ask.rb in pleaseai/homebrew-tap via a GitHub App token

The compiled binary has no package.json on disk, so version resolution
in src/index.ts now prefers a compile-time literal (__ASK_VERSION__,
injected with bun's --define) and falls back to reading package.json for
the npm/tsc build.

Docs: add an "Install the CLI" section (brew + npm) to the README.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. autorelease: tagged status:in-progress Currently being worked on type/feature New feature type:ci CI/CD configuration changes type:feature New feature or request labels Jun 17, 2026
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codacy-production

codacy-production Bot commented Jun 17, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploying ask with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b8f1ed
Status: ✅  Deploy successful!
Preview URL: https://a00bd60a.ask-6im.pages.dev
Branch Preview URL: https://amondnet-homebrew.ask-6im.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploying ask-registry with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b8f1ed
Status: ✅  Deploy successful!
Preview URL: https://b3e7e69d.ask-registry.pages.dev
Branch Preview URL: https://amondnet-homebrew.ask-registry.pages.dev

View logs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Architecture diagram
sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant GHA as GitHub Actions
    participant Bun as Bun Build
    participant Dist as dist-bin
    participant Release as GitHub Release
    participant Tap as homebrew-tap Repo
    participant User as End User

    Note over Dev,User: NEW: Homebrew Distribution Flow

    Dev->>GH: Push to main branch
    GH->>GHA: Trigger release.yml workflow
    GHA->>GHA: Run release-please job
    alt cli_release_created == 'true'
        GHA->>GHA: Start build-binaries job
        GHA->>Bun: Checkout code + setup bun
        GHA->>Bun: Install dependencies
        GHA->>Bun: Build schema workspace
        Bun->>Bun: Cross-compile 4 targets (darwin/linux × x64/arm64)
        Note over Bun: Injects __ASK_VERSION__ via --define
        Bun->>Dist: Write ask-{target} binaries
        Dist->>Dist: Generate .sha256 checksums
        Dist->>GHA: Upload ask-binaries artifact
    else
        GHA->>GHA: Skip CLI release jobs
    end

    Note over GHA,Release: Upload binaries to GitHub Release

    GHA->>GHA: Start upload-release-assets job
    GHA->>Release: Download ask-binaries artifact
    Release->>Release: gh release upload binaries + sha256 files

    Note over Release,Tap: Update Homebrew formula

    GHA->>GHA: Start update-homebrew-formula job
    GHA->>GH: Request GitHub App token (APP_ID + PRIVATE_KEY)
    GH-->>GHA: Return app token
    GHA->>Tap: Checkout pleaseai/homebrew-tap repo (with app token)
    GHA->>Release: Download .sha256 files from release assets
    Release-->>GHA: Checksum files
    GHA->>Tap: Generate ask.rb with version + sha256 sums
    Tap->>Tap: Commit + push ask.rb to homebrew-tap

    Note over User,Tap: End-user install

    User->>User: Run "brew install pleaseai/tap/ask"
    User->>Tap: Homebrew fetches formula from tap
    User->>Release: Download compiled binary for platform
    User->>User: Binary runs without Node.js

    Note over Bun,User: Version Resolution (compile-time vs runtime)

    alt Compiled binary (Homebrew)
        Bun->>Bun: __ASK_VERSION__ defined as string literal
        User->>User: resolveVersion() returns __ASK_VERSION__
    else npm/tsc build
        Bun->>Bun: __ASK_VERSION__ undefined
        User->>User: resolveVersion() reads package.json
        alt package.json missing
            User->>User: Falls back to '0.0.0'
        end
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread .github/workflows/release.yml Outdated
git diff --quiet ignores untracked files, so the very first ask.rb
creation in homebrew-tap would be detected as 'no changes' and never
committed. Also require the file to be tracked before skipping.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Requires human review: Adds new CI release jobs building cross-platform binaries and updating Homebrew tap, plus compile-time version resolution logic. These are infrastructure/deployment changes that modify release workflows and core version handling, which require human review to ensure correctness and security.

Re-trigger cubic

@amondnet amondnet merged commit 0bac76b into main Jun 17, 2026
7 checks passed
@amondnet amondnet deleted the amondnet/homebrew branch June 17, 2026 16:01
@github-actions github-actions Bot mentioned this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autorelease: tagged size:M This PR changes 30-99 lines, ignoring generated files. status:in-progress Currently being worked on type:ci CI/CD configuration changes type:feature New feature or request type/feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant