Skip to content

feat(brew): add Homebrew installation support#164

Merged
ymkiux merged 3 commits into
mainfrom
feat/brew-install
May 27, 2026
Merged

feat(brew): add Homebrew installation support#164
ymkiux merged 3 commits into
mainfrom
feat/brew-install

Conversation

@ymkiux
Copy link
Copy Markdown
Collaborator

@ymkiux ymkiux commented May 15, 2026

Summary

Add Homebrew tap (SakuraByteCore/homebrew-codexmate) and auto-update workflow so macOS/Linux users can install via brew install codexmate.

  • Created tap repo SakuraByteCore/homebrew-codexmate with Formula/codexmate.rb
  • Added .github/workflows/brew-update.yml — auto-updates formula (version + SHA256) on each GitHub Release
  • Updated README.md / README.zh.md with brew install instructions and badge

Usage (after next release with standalone tarball)

brew tap SakuraByteCore/codexmate
brew install codexmate

Setup required

  1. Create a fine-grained PAT with Contents: read and write permission on repo SakuraByteCore/homebrew-codexmate
  2. Add it as repository secret HOMEBREW_TAP_TOKEN in SakuraByteCore/codexmate → Settings → Secrets and variables → Actions

Tests

  • Tap repo created and accessible: SakuraByteCore/homebrew-codexmate
  • Formula structure follows Homebrew conventions (desc, homepage, url, sha256, license, depends_on, install, test)
  • Workflow YAML syntax valid (GitHub Actions schema)
  • Download URL pattern matches release workflow output (codexmate-{ver}-standalone.tar.gz)
  • cli.js shebang (#!/usr/bin/env node) compatible with Homebrew's depends_on "node"
  • README badge and anchor links updated in both EN/ZH docs
  • End-to-end: brew tap + brew install — requires next release with standalone tarball + HOMEBREW_TAP_TOKEN secret configured

Summary by CodeRabbit

  • New Features

    • Homebrew installation support for macOS and Linux.
  • Documentation

    • English and Chinese READMEs updated with Homebrew install instructions and Node.js note; architecture diagram spacing adjusted.
    • Minor markup/whitespace tweak in a UI modal (no visible behavior change).
  • Tests

    • Minor unit test whitespace adjustment for docs consistency.
  • Chores

    • Added automation to keep Homebrew formula up to date on releases.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 61c892e8-21a4-4fd4-aff7-8e8bf110ef5a

📥 Commits

Reviewing files that changed from the base of the PR and between e022d17 and f29aa0b.

📒 Files selected for processing (5)
  • .github/workflows/brew-update.yml
  • README.md
  • README.zh.md
  • tests/unit/readme-docs-consistency.test.mjs
  • web-ui/partials/index/modals-basic.html
✅ Files skipped from review due to trivial changes (2)
  • tests/unit/readme-docs-consistency.test.mjs
  • web-ui/partials/index/modals-basic.html
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/brew-update.yml
📜 Recent review details
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~37-~37: Using many exclamation marks might seem excessive (in this case: 10 exclamation marks for a text that’s 3638 characters long)
Context: ... to help build the local agent ecosystem! ## What is Codex Mate? Have you ever ...

(EN_EXCESSIVE_EXCLAMATION)

README.zh.md

[style] ~36-~36: Using many exclamation marks might seem excessive (in this case: 9 exclamation marks for a text that’s 2539 characters long)
Context: ...优先**:所有配置和会话均存储在您的主目录中。无需遥测,无需云端账户。 > [!IMPORTANT] > 本项目目前处于早期开发阶段。我们正在寻找开发者共同构建...

(EN_EXCESSIVE_EXCLAMATION)

🪛 markdownlint-cli2 (0.22.1)
README.md

[warning] 35-35: Blank line inside blockquote

(MD028, no-blanks-blockquote)


[warning] 148-148: Images should have alternate text (alt text)

(MD045, no-alt-text)

README.zh.md

[warning] 35-35: Blank line inside blockquote

(MD028, no-blanks-blockquote)


[warning] 148-148: Images should have alternate text (alt text)

(MD045, no-alt-text)

🔇 Additional comments (6)
README.md (3)

18-18: LGTM!


74-81: LGTM!


108-139: LGTM!

README.zh.md (3)

74-81: LGTM!


108-139: LGTM!


18-18: ⚡ Quick win

Badge anchor likely correct, but needs a GitHub-render check for Chinese heading IDs

  • README.zh.md: line 18 links to #homebrew-安装macos--linux
  • README.zh.md: line 74 heading is ### Homebrew 安装(macOS / Linux)
  • The link text matches the expected “heading-id” transformation, but the sandbox check can’t guarantee GitHub’s rendered heading-id for Chinese/punctuation—click the badge on GitHub to confirm it jumps to the heading.

📝 Walkthrough

Walkthrough

Adds a release-triggered GitHub Actions workflow that updates the Homebrew tap formula (url and sha256) and documents Homebrew installation in English and Chinese READMEs; includes a small README-consistency test whitespace change and a modal HTML whitespace tweak.

Changes

Homebrew Distribution Support

Layer / File(s) Summary
Homebrew tap update automation workflow
.github/workflows/brew-update.yml
On GitHub release publication, the workflow extracts the version tag, downloads the codexmate-<version>-standalone.tar.gz asset, computes its SHA256 checksum, clones the Homebrew tap repo, updates Formula/codexmate.rb url and sha256 lines, writes version/sha/url and the updated formula to the step summary, and commits/pushes to main only if there are staged changes.
Installation documentation and minor whitespace
README.md, README.zh.md, tests/unit/readme-docs-consistency.test.mjs, web-ui/partials/index/modals-basic.html
Updates the "Install" badge anchor and adds "Install via Homebrew (macOS / Linux)" subsections with brew tap / brew install codexmate commands and Node.js prerequisite notes in both English and Chinese READMEs; adjusts Mermaid diagram spacing; minor whitespace tweak in a README consistency unit test and a modal partial.

Sequence Diagram

sequenceDiagram
  participant Release as GitHub Release
  participant Actions as GitHub Actions Runner
  participant GHCLI as gh CLI
  participant TapRepo as Homebrew Tap Repo (git)

  Release->>Actions: release: published event (tag)
  Actions->>GHCLI: gh release view / download asset (codexmate-<ver>-standalone.tar.gz)
  Actions->>Actions: compute SHA256
  Actions->>TapRepo: git clone / checkout main using HOMEBREW_TAP_TOKEN
  Actions->>TapRepo: sed update `Formula/codexmate.rb` (url, sha256)
  Actions->>TapRepo: git add/commit/push (if changes)
  Actions->>Actions: write version/sha/url and formula to $GITHUB_STEP_SUMMARY
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • awsl233777

Poem

🐰 I hopped at release with eager paws,
A tarball fetched beneath my claws,
SHA checked true, the formula sang,
Docs gained a tap and a tiny twang,
Brewed installs bloom — a rabbit's cheer for deploys!

🚥 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 'feat(brew): add Homebrew installation support' directly and clearly summarizes the main change—adding Homebrew installation support to the project, which is the primary objective of this PR.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/brew-install

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/brew-update.yml (2)

8-9: ⚡ Quick win

Remove unnecessary contents: write permission.

This workflow writes only to the external tap repository (via HOMEBREW_TAP_TOKEN), not to the current repository. The contents: write permission is unnecessary and violates the principle of least privilege.

🔒 Proposed fix to remove unnecessary permission
-permissions:
-  contents: write

Or if you need to be explicit:

 permissions:
-  contents: write
+  contents: read
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/brew-update.yml around lines 8 - 9, Remove the unnecessary
repository write permission by deleting the "contents: write" entry from the
permissions block in the GitHub Actions workflow; this workflow only pushes to
an external tap using HOMEBREW_TAP_TOKEN, so keep the permissions minimal
(remove or replace the "permissions:" block with a more restrictive set if
needed) and ensure no code or steps rely on repository contents write access.

63-72: 💤 Low value

Consider clearer control flow for the no-changes case.

The current git diff --cached --quiet && echo "No changes to commit" && exit 0 works correctly, but an explicit if statement would make the intent clearer and improve readability.

♻️ Optional refactor for clarity
       - name: Commit and push
         env:
           VERSION: ${{ steps.ver.outputs.version }}
         run: |
           git config user.name "github-actions[bot]"
           git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
           git add Formula/codexmate.rb
-          git diff --cached --quiet && echo "No changes to commit" && exit 0
-          git commit -m "bump codexmate to v${VERSION}"
-          git push origin main
+          
+          if git diff --cached --quiet; then
+            echo "No changes to commit"
+            exit 0
+          fi
+          
+          git commit -m "bump codexmate to v${VERSION}"
+          git push origin main
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/brew-update.yml around lines 63 - 72, In the "Commit and
push" step replace the chained conditional with an explicit if block: run `if
git diff --cached --quiet; then echo "No changes to commit"; exit 0; fi` before
running `git commit -m "bump codexmate to v${VERSION}"` and `git push origin
main` so the flow is clearer and the no-changes case is handled explicitly;
update the commands in that step accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/brew-update.yml:
- Around line 23-29: The workflow step "Download standalone tarball" currently
runs gh release download with the pattern "codexmate-${{
steps.ver.outputs.version }}-standalone.tar.gz" and can fail cryptically if the
asset is missing or misnamed; update the step to first validate the asset exists
(e.g., use gh release view or gh api to list assets for
github.event.release.tag_name and check for the exact filename using
steps.ver.outputs.version) and if not found implement a short retry loop with
backoff (or fail with a clear message listing available asset names) before
calling gh release download; ensure the updated logic still uses GH_TOKEN and
preserves the download behavior when the asset is present.
- Around line 44-62: The sed replacements for url and sha256 in the "Update
formula" step can silently fail due to varying indentation; after running sed on
the formula variable, verify the update succeeded by checking the file contains
the expected url and SHA256 (e.g., grep or grep -q for the constructed url
variable and the SHA256 value) and exit non‑zero with a clear message if either
check fails; update the step to perform those verification checks using the
existing VERSION, SHA256, url, and formula variables so the workflow fails fast
instead of committing an unchanged Formula.

---

Nitpick comments:
In @.github/workflows/brew-update.yml:
- Around line 8-9: Remove the unnecessary repository write permission by
deleting the "contents: write" entry from the permissions block in the GitHub
Actions workflow; this workflow only pushes to an external tap using
HOMEBREW_TAP_TOKEN, so keep the permissions minimal (remove or replace the
"permissions:" block with a more restrictive set if needed) and ensure no code
or steps rely on repository contents write access.
- Around line 63-72: In the "Commit and push" step replace the chained
conditional with an explicit if block: run `if git diff --cached --quiet; then
echo "No changes to commit"; exit 0; fi` before running `git commit -m "bump
codexmate to v${VERSION}"` and `git push origin main` so the flow is clearer and
the no-changes case is handled explicitly; update the commands in that step
accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f59def5d-3ff7-4e34-8f48-08f01e11230b

📥 Commits

Reviewing files that changed from the base of the PR and between d3614cc and e022d17.

📒 Files selected for processing (3)
  • .github/workflows/brew-update.yml
  • README.md
  • README.zh.md
📜 Review details
🔇 Additional comments (6)
.github/workflows/brew-update.yml (2)

31-35: LGTM!


37-42: LGTM!

README.md (2)

195-203: LGTM!


12-12: Anchor link is correct.

The heading "Install via Homebrew (macOS / Linux)" at line 195 generates the GitHub anchor #install-via-homebrew-macos--linux, which matches the badge link target. The link will work as expected.

README.zh.md (2)

198-206: LGTM!


12-12: No action needed—the anchor link is correctly formatted.

The badge link #homebrew-安装macos--linux correctly corresponds to the heading "Homebrew 安装(macOS / Linux)" per GitHub's anchor generation rules. GitHub preserves Chinese characters, removes parentheses and special characters like /, converts spaces to hyphens, and lowercases all text. The generated anchor matches the link precisely.

Comment thread .github/workflows/brew-update.yml Outdated
Comment thread .github/workflows/brew-update.yml
@ymkiux ymkiux force-pushed the main branch 3 times, most recently from bead873 to 9ffba03 Compare May 24, 2026 06:00
@awsl233777
Copy link
Copy Markdown
Collaborator

Updated this PR to unblock merge and address the review feedback.

Changes made:

  • Merged current main into feat/brew-install and resolved README / README.zh.md conflicts while preserving the Homebrew install docs and install badge.
  • Reduced brew-update workflow repository permission from contents: write to contents: read.
  • Added release asset validation with retry and clear diagnostics before downloading the standalone tarball.
  • Added formula URL / SHA256 post-update verification so the workflow fails fast if sed does not update the expected fields.
  • Replaced the chained no-change commit guard with an explicit if git diff --cached --quiet block.
  • Removed trailing whitespace caught during merge validation.

Local validation:

  • git diff --cached --check passed before commit.
  • npm run test:unit passed: 530 tests.
  • npm run lint passed: 299 files.

@coderabbitai re-review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

@awsl233777 Thanks for the thorough update! I'll kick off a fresh review now to check all the addressed items, including the permission reduction, retry logic, post-update verification, and the improved commit guard.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator

@awsl233777 awsl233777 left a comment

Choose a reason for hiding this comment

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

Approved after resolving the main-branch conflicts, scoping the PR back to the Homebrew files, addressing the brew workflow review feedback, and verifying CI/local checks.

@ymkiux ymkiux merged commit 7c5ddef into main May 27, 2026
7 checks passed
@ymkiux ymkiux deleted the feat/brew-install branch May 27, 2026 02:38
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.

2 participants