From dd113ed7146c4a839853bbb0101d0529b0f16669 Mon Sep 17 00:00:00 2001 From: Illuminated2020 <2357303264@qq.com> Date: Sun, 10 May 2026 16:45:04 +0800 Subject: [PATCH] =?UTF-8?q?build(dbx-cli):=20=E5=B0=86=20CLI=20=E4=BA=8C?= =?UTF-8?q?=E8=BF=9B=E5=88=B6=E6=94=B9=E5=90=8D=E4=B8=BA=20dbx-cli?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新 dbx-cli crate 的 bin 目标名,避免与桌面 dbx 目标冲突 - 同步计划文档中的 cargo run 命令引用 - 保留 runtime_client.rs 现有格式化改动 --- crates/dbx-cli/Cargo.toml | 2 +- crates/dbx-cli/src/runtime_client.rs | 3 ++- .../plans/2026-05-10-dbx-cli-runtime.md | 26 +++++++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/crates/dbx-cli/Cargo.toml b/crates/dbx-cli/Cargo.toml index c816811ec..d272aaa4b 100644 --- a/crates/dbx-cli/Cargo.toml +++ b/crates/dbx-cli/Cargo.toml @@ -4,7 +4,7 @@ version = "0.5.2" edition = "2021" [[bin]] -name = "dbx" +name = "dbx-cli" path = "src/main.rs" [dependencies] diff --git a/crates/dbx-cli/src/runtime_client.rs b/crates/dbx-cli/src/runtime_client.rs index a3db99811..940fd5399 100644 --- a/crates/dbx-cli/src/runtime_client.rs +++ b/crates/dbx-cli/src/runtime_client.rs @@ -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") diff --git a/docs/superpowers/plans/2026-05-10-dbx-cli-runtime.md b/docs/superpowers/plans/2026-05-10-dbx-cli-runtime.md index 961f99829..e3cd3baf7 100644 --- a/docs/superpowers/plans/2026-05-10-dbx-cli-runtime.md +++ b/docs/superpowers/plans/2026-05-10-dbx-cli-runtime.md @@ -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 CliEnvelope { 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.