build(dbx-cli): 将 CLI 二进制改名为 dbx-cli

- 更新 dbx-cli crate 的 bin 目标名,避免与桌面 dbx 目标冲突

- 同步计划文档中的 cargo run 命令引用

- 保留 runtime_client.rs 现有格式化改动
This commit is contained in:
Illuminated2020 2026-05-10 16:45:04 +08:00
parent 01110945a1
commit dd113ed714
3 changed files with 16 additions and 15 deletions

View File

@ -4,7 +4,7 @@ version = "0.5.2"
edition = "2021"
[[bin]]
name = "dbx"
name = "dbx-cli"
path = "src/main.rs"
[dependencies]

View File

@ -9,7 +9,8 @@ pub struct RuntimeDiscovery {
}
pub fn app_data_dir() -> PathBuf {
let home = std::env::var(if cfg!(windows) { "APPDATA" } else { "HOME" }).unwrap_or_else(|_| ".".to_string());
let home = std::env::var(if cfg!(windows) { "APPDATA" } else { "HOME" })
.unwrap_or_else(|_| ".".to_string());
if cfg!(target_os = "macos") {
PathBuf::from(home).join("Library/Application Support/com.dbx.app")

View File

@ -76,7 +76,7 @@ version = "0.5.2"
edition = "2021"
[[bin]]
name = "dbx"
name = "dbx-cli"
path = "src/main.rs"
[dependencies]
@ -114,7 +114,7 @@ Run:
cargo metadata --format-version 1 --no-deps
```
Expected: output contains `"name":"dbx-cli"` and `"name":"dbx"`.
Expected: output contains `"name":"dbx-cli"` for the package and `"name":"dbx-cli"` for the binary target.
---
@ -874,8 +874,8 @@ async fn conn_show(name: &str, _args: &[String]) -> CliEnvelope<serde_json::Valu
Run:
```bash
cargo run -p dbx-cli -- conn list --format json
cargo run -p dbx-cli -- conn show __missing__ --redacted --format json
cargo run -p dbx-cli --bin dbx-cli -- conn list --format json
cargo run -p dbx-cli --bin dbx-cli -- conn show __missing__ --redacted --format json
```
Expected: first command returns an envelope; second returns `CONNECTION_NOT_FOUND` without panicking.
@ -974,7 +974,7 @@ async fn safe_query(args: &[String]) -> CliEnvelope<serde_json::Value> {
Run:
```bash
cargo run -p dbx-cli -- safe-query --conn __missing__ --sql "DROP TABLE users" --format json
cargo run -p dbx-cli --bin dbx-cli -- safe-query --conn __missing__ --sql "DROP TABLE users" --format json
```
Expected: returns `CONNECTION_NOT_FOUND`. With a real DBX connection, `DROP TABLE users` returns `DDL_BLOCKED`.
@ -1470,9 +1470,9 @@ pnpm tauri dev
In a second terminal, run:
```bash
cargo run -p dbx-cli -- context --format json
cargo run -p dbx-cli -- selection --format json
cargo run -p dbx-cli -- result current --limit 50 --format json
cargo run -p dbx-cli --bin dbx-cli -- context --format json
cargo run -p dbx-cli --bin dbx-cli -- selection --format json
cargo run -p dbx-cli --bin dbx-cli -- result current --limit 50 --format json
```
Expected: all three commands return `source: "gui-runtime"` when desktop is running.
@ -1520,11 +1520,11 @@ Expected: no output.
Run:
```bash
cargo run -p dbx-cli -- context --format json
cargo run -p dbx-cli -- conn list --format json
cargo run -p dbx-cli -- conn show __missing__ --redacted --format json
cargo run -p dbx-cli -- selection --format json
cargo run -p dbx-cli -- result current --limit 50 --format json
cargo run -p dbx-cli --bin dbx-cli -- context --format json
cargo run -p dbx-cli --bin dbx-cli -- conn list --format json
cargo run -p dbx-cli --bin dbx-cli -- conn show __missing__ --redacted --format json
cargo run -p dbx-cli --bin dbx-cli -- selection --format json
cargo run -p dbx-cli --bin dbx-cli -- result current --limit 50 --format json
```
Expected: all commands return valid JSON envelopes. GUI-only commands return `GUI_RUNTIME_REQUIRED` if DBX desktop is not running.