@dbx-app/cli

中文文档
0.4.142发布于 2026/11/11Apache-2.0ES Module零依赖构建来源已验证近 30 天下载 5192

Command line interface for DBX database connections, schema, and safe queries

原始使用文档
文档目录13 节
  1. Install
  2. npm
  3. Homebrew
  4. Native downloads
  5. Official Agent Skill
  6. Usage
  7. Commands
  8. Output
  9. Query Controls
  10. Default Connection
  11. Desktop App Requirements
  12. Error Codes
  13. Codex

DBX CLI

Command line interface for DBX database connections, schema inspection, safe queries, and prompt-ready schema context.

Install

npm

npm install -g @dbx-app/cli

Homebrew

brew tap t8y2/tap
brew install dbx-cli

The npm package installs the native CLI for the current platform automatically. Node.js 18.18.0 or newer is only needed for the npm launcher; direct native distributions do not require Node.js.

Native downloads

The packages-v* GitHub Release also provides standalone native CLI archives:

PlatformArchive
macOS Apple Silicondbx-cli-darwin-arm64.tar.gz
macOS Inteldbx-cli-darwin-x64.tar.gz
Linux glibc ARM64dbx-cli-linux-arm64-gnu.tar.gz
Linux glibc x64dbx-cli-linux-x64-gnu.tar.gz
Windows ARM64dbx-cli-win32-arm64.zip
Windows x64dbx-cli-win32-x64.zip

Verify the downloaded archive with CLI-SHA256SUMS, extract it, and run the native binary directly:

tar -xzf dbx-cli-linux-x64-gnu.tar.gz
chmod +x dbx
./dbx --version
./dbx connections list --json

Standalone binaries do not require Node.js. They read the same DBX connection storage as the desktop application; set DBX_DATA_DIR when using a custom or portable data directory.

Official Agent Skill

The CLI binary includes the official DBX Skill for shell-capable AI agents. Enable it once after installing or upgrading the CLI:

dbx agent setup
dbx agent status

The default location is ~/.agents/skills/dbx. setup runs entirely offline and can be repeated to install a newer bundled version. It refuses to overwrite an unmanaged or locally modified DBX Skill unless --force is supplied. Use --skills-dir <path> when the agent reads a different skills root.

Usage

dbx doctor
dbx capabilities
dbx agent setup
dbx agent status --json
dbx connections list --json
dbx connections list --format csv
dbx schema list local --json
dbx schema describe local users --json
dbx query local "select count(*) as total from users" --json
dbx query local "select id, name from users" --format csv
dbx query local "select * from users" --limit 50 --timeout 10s --json
dbx query local --file ./query.sql --json
dbx context local --tables users,orders
dbx open local users

Commands

CommandDescription
dbx doctorShow local DBX config and desktop bridge diagnostics
dbx capabilitiesShow direct-query and desktop-bridge database support
dbx agent setupInstall or update the bundled official DBX Skill
dbx agent statusInspect the installed DBX Skill
dbx connections listList DBX connections without printing secrets
dbx schema list <connection>List tables and views
dbx schema describe <connection> <table>Show table columns
dbx query <connection> <sql>Execute one SQL statement
dbx query <connection> --file ./query.sqlExecute SQL from a file
dbx context <connection>Print compact schema context for prompts
dbx open <connection> <table>Open a table in DBX Desktop

Output

Use --json or --format json for stable machine-readable output. Use --format csv for query, connection, and schema data that should be piped into other command line tools.

Errors are written to stderr and return a non-zero exit code.

Query Controls

dbx query is read-only by default.

Use --limit <n> to control returned query rows and --timeout <duration> to control query timeout. Durations accept ms, s, or m, such as 500ms, 10s, or 1m.

Use --allow-writes for non-dangerous write statements. Dangerous SQL such as DROP, TRUNCATE, and ALTER requires both --allow-writes and --allow-dangerous-sql.

For SQL that starts with a dash, pass -- before the SQL:

dbx query local --json -- "-- comment
select 1"

Default Connection

Set DBX_CONNECTION to omit the connection name for query and context commands:

DBX_CONNECTION=local dbx query "select 1" --json
DBX_CONNECTION=local dbx context --tables users,orders

Desktop App Requirements

Some CLI commands can run without DBX Desktop:

  • connections list
  • schema list
  • schema describe
  • query
  • context

Direct execution supports PostgreSQL/Redshift, MySQL-compatible databases (MySQL, Doris, StarRocks), and SQLite. Other database types use the DBX Desktop bridge or DBX Agent/JDBC infrastructure.

Use dbx doctor to check whether the DBX connection database, connection table, native SQLite loader, and desktop bridge are available. Use dbx capabilities to list direct-query and bridge-required database types.

If the optional platform package was not installed, reinstall without --no-optional:

npm uninstall -g @dbx-app/cli
npm install -g @dbx-app/cli

The native CLI does not require better-sqlite3 and is not coupled to the Node.js ABI.

Error Codes

CLI JSON errors use stable codes:

CodeMeaning
UNKNOWN_OPTIONAn unsupported flag was provided
INVALID_OPTIONA flag is missing a value or has an invalid value
INVALID_ARGUMENTPositional arguments are missing or conflicting
CONNECTION_STORE_ERRORDBX connection storage exists but could not be read
CONNECTION_NOT_FOUNDNo DBX connection matched the requested name
SQL_BLOCKEDSQL safety rules blocked execution
DBX_NOT_RUNNINGDBX Desktop bridge is unavailable
HOME_NOT_FOUNDThe default user skills directory cannot be resolved
SKILL_MODIFIEDAn unmanaged or locally edited DBX Skill was found
SKILL_PATH_UNSAFEA managed Skill path is a symbolic link
SKILL_READ_FAILEDAn installed Skill file could not be read
SKILL_WRITE_FAILEDThe bundled Skill could not be installed
ERRORUnexpected runtime failure

Codex

Codex can call the CLI directly from shell tools:

dbx schema describe local users --json
dbx context local --tables users,orders | codex exec "Write a retention query"

版本与发布记录

@dbx-app/cli 共发布 134 个版本,首次发布于 2026/05/18;过去 12 个月发布了 134 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.142latest2026/11/11今天
0.4.1412026/11/083 天前
0.4.1402026/11/065 天前
0.4.1392026/11/056 天前
0.4.1382026/11/038 天前
0.4.1372026/11/029 天前

关于 @dbx-app/cli 的常见问题

@dbx-app/cli 是什么?

Command line interface for DBX database connections, schema, and safe queries

如何安装 @dbx-app/cli?

在项目目录运行 npm install @dbx-app/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 dbx,可以用 npx dbx 直接运行。

@dbx-app/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dbx-app__cli 是否存在。

@dbx-app/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@dbx-app/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.18.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dbx-app/cli 可以商用吗?

@dbx-app/cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dbx-app/cli 的下载量有多少?

根据 npm 官方下载统计,@dbx-app/cli 在 2026/10/12 – 2026/11/10 这 30 天内被下载 5,192 次,日均约 173 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dbx-app/cli 还在维护吗?

最新版本 0.4.142 发布于 2026/11/11(今天);至今共发布 134 个版本,其中过去 12 个月发布了 134 个;首次发布于 2026/05/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。