Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat: add Homebrew formula for dbx-cli

t8y259d2dd7c8727
diff --git a/.github/workflows/mcp-release.yml b/.github/workflows/mcp-release.yml
index 1a255d213c..50184fadca 100644
--- a/.github/workflows/mcp-release.yml
+++ b/.github/workflows/mcp-release.yml
@@ -230,3 +230,103 @@ jobs:
exit 0
fi
pnpm --filter "${PACKAGE_FILTER}" publish --access public --provenance --no-git-checks
+
+ publish-homebrew-formula:
+ name: Publish Homebrew formula
+ runs-on: ubuntu-latest
+ needs: publish-leaf-packages
+ steps:
+ - name: Download CLI npm tarball and compute SHA256
+ id: cli-hash
+ env:
+ VERSION: ${{ needs.prepare.outputs.version }}
+ run: |
+ VERSION="${VERSION}"
+ NPM_TARBALL="cli-${VERSION}.tgz"
+ NPM_URL="https://registry.npmjs.org/@dbx-app/cli/-/${NPM_TARBALL}"
+
+ # Poll npm until the package is available (CDN propagation delay)
+ for i in $(seq 1 12); do
+ if curl -fsSLI "${NPM_URL}" >/dev/null 2>&1; then
+ echo "Package found on attempt ${i}"
+ break
+ fi
+ echo "Waiting for npm CDN (attempt ${i}/12)..."
+ sleep 10
+ done
+
+ curl -fsSL -o "${NPM_TARBALL}" "${NPM_URL}"
+ CLI_SHA256=$(sha256sum "${NPM_TARBALL}" | cut -d ' ' -f 1)
+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
+ echo "sha256=${CLI_SHA256}" >> "$GITHUB_OUTPUT"
+ echo " cli version: ${VERSION}"
+ echo " sha256: ${CLI_SHA256}"
+
+ - name: Push formula to homebrew-tap
+ env:
+ TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
+ CLI_VERSION: ${{ steps.cli-hash.outputs.version }}
+ CLI_SHA256: ${{ steps.cli-hash.outputs.sha256 }}
+ run: |
+ git clone --depth 1 \
+ "https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/t8y2/homebrew-tap.git" \
+ homebrew-tap
+ cd homebrew-tap
+ mkdir -p Formula
+
+ cat > Formula/dbx-cli.rb <<'RUBY_EOF'
+ class DbxCli < Formula
+ desc "Command-line interface for DBX database connections, schema, and safe queries"
+ homepage "https://github.com/t8y2/dbx"
+ url "https://registry.npmjs.org/@dbx-app/cli/-/cli-__CLI_VERSION__.tgz"
+ sha256 "__CLI_SHA256__"
+ license "Apache-2.0"
+
+ depends_on "node"
+
+ on_linux do
+ depends_on "pkgconf" => :build
+ depends_on "libsecret"
+ end
+
+ def install
+ system "npm", "install", *std_npm_args
+ bin.install_symlink libexec.glob("bin/*")
+
+ # Rebuild better-sqlite3 and keytar native bindings for the current platform.
+ # prebuild-install is blocked by the Homebrew sandbox during npm install,
+ # so we must rebuild them explicitly via node-gyp.
+ node_modules = libexec/"lib/node_modules/@dbx-app/cli/node_modules"
+
+ cd node_modules/"better-sqlite3" do
+ system "npm", "run", "build-release"
+ end
+
+ cd node_modules/"keytar" do
+ rm_r "prebuilds" if File.directory?("prebuilds")
+ system "npm", "run", "build"
+ end
+ end
+
+ test do
+ assert_path_exists bin/"dbx"
+ system bin/"dbx", "doctor"
+ end
+ end
+ RUBY_EOF
+
+ sed -i 's/^ //' Formula/dbx-cli.rb
+ sed -i "s/__CLI_VERSION__/${CLI_VERSION}/g" Formula/dbx-cli.rb
+ sed -i "s/__CLI_SHA256__/${CLI_SHA256}/g" Formula/dbx-cli.rb
+
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git add Formula/dbx-cli.rb
+
+ if git diff --cached --quiet; then
+ echo "CLI Homebrew formula is already up to date."
+ else
+ git commit -m "dbx-cli ${CLI_VERSION}"
+ git push
+ echo "::notice::CLI Homebrew formula updated to ${CLI_VERSION}"
+ fi
diff --git a/README.md b/README.md
index 11b4b4fc29..75995dc782 100644
--- a/README.md
+++ b/README.md
@@ -159,6 +159,8 @@ DBX also provides a dedicated CLI package for terminal, script, and Codex workfl
```bash
npm install -g @dbx-app/cli
+# or via Homebrew
+brew tap t8y2/dbx && brew install dbx-cli
dbx connections list --json
dbx query local "select 1" --json
```
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 2018a9a4ac..90ef1195ab 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -159,6 +159,8 @@ DBX 也提供独立 CLI 包,适合终端、脚本和 Codex 工作流:
```bash
npm install -g @dbx-app/cli
+# 或通过 Homebrew
+brew tap t8y2/dbx && brew install dbx-cli
dbx connections list --json
dbx query local "select 1" --json
```
diff --git a/deploy/homebrew/dbx-cli.rb b/deploy/homebrew/dbx-cli.rb
new file mode 100644
index 0000000000..ed8b2af78c
--- /dev/null
+++ b/deploy/homebrew/dbx-cli.rb
@@ -0,0 +1,38 @@
+class DbxCli < Formula
+ desc "Command-line interface for DBX database connections, schema, and safe queries"
+ homepage "https://github.com/t8y2/dbx"
+ url "https://registry.npmjs.org/@dbx-app/cli/-/cli-0.4.7.tgz"
+ sha256 "d507138dc5bd9611ad1e668a14e5a099754e8a1a3994742f2d03dbc22da911d8"
+ license "Apache-2.0"
+
+ depends_on "node"
+
+ on_linux do
+ depends_on "pkgconf" => :build
+ depends_on "libsecret"
+ end
+
+ def install
+ system "npm", "install", *std_npm_args
+ bin.install_symlink libexec.glob("bin/*")
+
+ # Rebuild better-sqlite3 and keytar native bindings for the current platform.
+ # prebuild-install is blocked by the Homebrew sandbox during npm install,
+ # so we must rebuild them explicitly via node-gyp.
+ node_modules = libexec/"lib/node_modules/@dbx-app/cli/node_modules"
+
+ cd node_modules/"better-sqlite3" do
+ system "npm", "run", "build-release"
+ end
+
+ cd node_modules/"keytar" do
+ rm_r "prebuilds" if File.directory?("prebuilds")
+ system "npm", "run", "build"
+ end
+ end
+
+ test do
+ assert_path_exists bin/"dbx"
+ system bin/"dbx", "doctor"
+ end
+end
diff --git a/docs/content/docs/cli.cn.mdx b/docs/content/docs/cli.cn.mdx
index 19ab141e4d..a26901a6ea 100644
--- a/docs/content/docs/cli.cn.mdx
+++ b/docs/content/docs/cli.cn.mdx
@@ -11,6 +11,13 @@ description: 在终端、脚本、CI 和 Codex 中使用 DBX 连接。
npm install -g @dbx-app/cli
```
+### Homebrew
+
+```bash
+brew tap t8y2/dbx
+brew install dbx-cli
+```
+
需要 Node.js 22.13.0 或更高版本。
查看版本:
diff --git a/docs/content/docs/cli.mdx b/docs/content/docs/cli.mdx
index a5c891e4d3..990b027990 100644
--- a/docs/content/docs/cli.mdx
+++ b/docs/content/docs/cli.mdx
@@ -7,10 +7,19 @@ description: Use DBX connections from terminals, scripts, CI, and Codex.
## Install
+### npm
+
```bash
npm install -g @dbx-app/cli
```
+### Homebrew
+
+```bash
+brew tap t8y2/dbx
+brew install dbx-cli
+```
+
Requires Node.js 22.13.0 or newer.
Check the installed version:
diff --git a/packages/cli/README.md b/packages/cli/README.md
index 9eadf14e09..158a066f42 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -4,10 +4,19 @@ Command line interface for DBX database connections, schema inspection, safe que
## Install
+### npm
+
```bash
npm install -g @dbx-app/cli
```
+### Homebrew
+
+```bash
+brew tap t8y2/dbx
+brew install dbx-cli
+```
+
Requires Node.js 22.13.0 or newer.
## Usage