@carllee1983/dbcli 1.38.1 → 1.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/dbcli.mdc +15 -4
- package/.github/skills/dbcli/SKILL.md +15 -4
- package/CHANGELOG.md +16 -0
- package/assets/SKILL.md +15 -4
- package/assets/SKILL.zh-TW.md +11 -2
- package/assets/ui-template.html +8 -8
- package/dist/cli.mjs +59 -49
- package/dist/core.mjs +13 -2
- package/dist/ui-style.css +1 -1
- package/package.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +15 -4
- package/skills/dbcli/SKILL.md +15 -4
package/.cursor/rules/dbcli.mdc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dbcli
|
|
3
|
-
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
3
|
+
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, generate DB reports or interactive HTML dashboards, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, generating a report/dashboard/HTML UI from raw SQL or saved snippets, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dbcli
|
|
@@ -30,6 +30,7 @@ the CLI package has not been installed globally.
|
|
|
30
30
|
| --- | --- |
|
|
31
31
|
| A named workflow fits ("diagnose slow query", "audit permissions") | `skill tasks list` → `skill tasks plan <pack>` — **prefer this; do not invent steps** |
|
|
32
32
|
| A fixed diagnostic goal | `guide <goal>` (`slow-query` / `capacity` / `health` / `index-usage` / `permissions` / `schema-overview`; `guide --list`) |
|
|
33
|
+
| A DB report / dashboard / HTML UI | `blacklist list` → `queries search <keywords>` or `queries suggest <intent>` → `queries show @<name>` → browser: `q @<name> --param k=v --ui`; file: `q @<name> --format html > report.html` or `export "<SQL>" --format html --output report.html` |
|
|
33
34
|
| Setting up a connection | see **Connection setup** |
|
|
34
35
|
| Anything else | run commands manually; consult the **Developer workflows** cheat-sheet |
|
|
35
36
|
|
|
@@ -89,6 +90,7 @@ in **How to use dbcli** still applies.
|
|
|
89
90
|
| Situation | Minimum safe path |
|
|
90
91
|
| --- | --- |
|
|
91
92
|
| DB-backed feature | `blacklist list` → `schema <object>` → `queries suggest <intent>` |
|
|
93
|
+
| DB report / dashboard request | `blacklist list` → `queries search <keywords>` / `queries suggest <intent>` → `queries show @<name>` → `q @<name> --ui` or `--format html` |
|
|
92
94
|
| Application data bug | `audit tail --for-agent --n 10` → `blacklist list` → `schema <object>` → narrow query |
|
|
93
95
|
| ORM or migration work | `schema --format json` → `diff --snapshot <name>` → `migrate add-index`/`add-column` (preview SQL) → `diff --against <snapshot>` |
|
|
94
96
|
| PR database review | Review changed persistence paths, then propose concrete `schema` / `plan` / `dry-run` / `report` / `guide` commands per material claim. |
|
|
@@ -103,6 +105,11 @@ dbcli inspect --for-agent --format json
|
|
|
103
105
|
dbcli blacklist list --format json
|
|
104
106
|
dbcli schema <object> --format json
|
|
105
107
|
dbcli queries suggest <intent> --format json
|
|
108
|
+
dbcli queries search <report keywords> --format json
|
|
109
|
+
dbcli queries show @<name> --format json
|
|
110
|
+
dbcli q @<name> --param k=v --ui
|
|
111
|
+
dbcli q @<name> --param k=v --format html > report.html
|
|
112
|
+
dbcli export "<SQL>" --format html --output report.html
|
|
106
113
|
dbcli audit tail --for-agent --n 10
|
|
107
114
|
dbcli diff --snapshot <name>
|
|
108
115
|
dbcli report --section perf --format json
|
|
@@ -425,14 +432,18 @@ Run with `dbcli q @diag/<topic>` (engine variant auto-picked by the active conne
|
|
|
425
432
|
|
|
426
433
|
```bash
|
|
427
434
|
dbcli query "SELECT day, dau FROM dau_daily" --ui # open in browser
|
|
435
|
+
dbcli q @analytics/revenue --param days=30 --ui # snippet metadata + charts/KPIs
|
|
436
|
+
dbcli q @analytics/revenue --param days=30 --format html > report.html
|
|
428
437
|
dbcli query "SELECT * FROM orders" --format html > out.html # pipe HTML to stdout
|
|
429
438
|
dbcli export "SELECT * FROM orders" --format html --output orders.html
|
|
430
439
|
```
|
|
431
440
|
|
|
432
441
|
`--ui` implies `--format html` and opens the file; `--format html` alone prints to stdout.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
442
|
+
When a saved snippet exists, prefer `q @<name> --ui` / `q @<name> --format html` because snippet
|
|
443
|
+
metadata can drive titles, KPI cards, and charts. Blacklist redaction is applied **before**
|
|
444
|
+
rendering. To get KPIs and charts instead of a plain table, add a `visual:` block (`title`,
|
|
445
|
+
`kpis[]`, `charts[]`) to the snippet frontmatter — see reference.md for the full `visual:`
|
|
446
|
+
schema. Raw `query` / `export` invocations render a sortable table only.
|
|
436
447
|
|
|
437
448
|
## Common workflows
|
|
438
449
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dbcli
|
|
3
|
-
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
3
|
+
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, generate DB reports or interactive HTML dashboards, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, generating a report/dashboard/HTML UI from raw SQL or saved snippets, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dbcli
|
|
@@ -30,6 +30,7 @@ the CLI package has not been installed globally.
|
|
|
30
30
|
| --- | --- |
|
|
31
31
|
| A named workflow fits ("diagnose slow query", "audit permissions") | `skill tasks list` → `skill tasks plan <pack>` — **prefer this; do not invent steps** |
|
|
32
32
|
| A fixed diagnostic goal | `guide <goal>` (`slow-query` / `capacity` / `health` / `index-usage` / `permissions` / `schema-overview`; `guide --list`) |
|
|
33
|
+
| A DB report / dashboard / HTML UI | `blacklist list` → `queries search <keywords>` or `queries suggest <intent>` → `queries show @<name>` → browser: `q @<name> --param k=v --ui`; file: `q @<name> --format html > report.html` or `export "<SQL>" --format html --output report.html` |
|
|
33
34
|
| Setting up a connection | see **Connection setup** |
|
|
34
35
|
| Anything else | run commands manually; consult the **Developer workflows** cheat-sheet |
|
|
35
36
|
|
|
@@ -89,6 +90,7 @@ in **How to use dbcli** still applies.
|
|
|
89
90
|
| Situation | Minimum safe path |
|
|
90
91
|
| --- | --- |
|
|
91
92
|
| DB-backed feature | `blacklist list` → `schema <object>` → `queries suggest <intent>` |
|
|
93
|
+
| DB report / dashboard request | `blacklist list` → `queries search <keywords>` / `queries suggest <intent>` → `queries show @<name>` → `q @<name> --ui` or `--format html` |
|
|
92
94
|
| Application data bug | `audit tail --for-agent --n 10` → `blacklist list` → `schema <object>` → narrow query |
|
|
93
95
|
| ORM or migration work | `schema --format json` → `diff --snapshot <name>` → `migrate add-index`/`add-column` (preview SQL) → `diff --against <snapshot>` |
|
|
94
96
|
| PR database review | Review changed persistence paths, then propose concrete `schema` / `plan` / `dry-run` / `report` / `guide` commands per material claim. |
|
|
@@ -103,6 +105,11 @@ dbcli inspect --for-agent --format json
|
|
|
103
105
|
dbcli blacklist list --format json
|
|
104
106
|
dbcli schema <object> --format json
|
|
105
107
|
dbcli queries suggest <intent> --format json
|
|
108
|
+
dbcli queries search <report keywords> --format json
|
|
109
|
+
dbcli queries show @<name> --format json
|
|
110
|
+
dbcli q @<name> --param k=v --ui
|
|
111
|
+
dbcli q @<name> --param k=v --format html > report.html
|
|
112
|
+
dbcli export "<SQL>" --format html --output report.html
|
|
106
113
|
dbcli audit tail --for-agent --n 10
|
|
107
114
|
dbcli diff --snapshot <name>
|
|
108
115
|
dbcli report --section perf --format json
|
|
@@ -425,14 +432,18 @@ Run with `dbcli q @diag/<topic>` (engine variant auto-picked by the active conne
|
|
|
425
432
|
|
|
426
433
|
```bash
|
|
427
434
|
dbcli query "SELECT day, dau FROM dau_daily" --ui # open in browser
|
|
435
|
+
dbcli q @analytics/revenue --param days=30 --ui # snippet metadata + charts/KPIs
|
|
436
|
+
dbcli q @analytics/revenue --param days=30 --format html > report.html
|
|
428
437
|
dbcli query "SELECT * FROM orders" --format html > out.html # pipe HTML to stdout
|
|
429
438
|
dbcli export "SELECT * FROM orders" --format html --output orders.html
|
|
430
439
|
```
|
|
431
440
|
|
|
432
441
|
`--ui` implies `--format html` and opens the file; `--format html` alone prints to stdout.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
442
|
+
When a saved snippet exists, prefer `q @<name> --ui` / `q @<name> --format html` because snippet
|
|
443
|
+
metadata can drive titles, KPI cards, and charts. Blacklist redaction is applied **before**
|
|
444
|
+
rendering. To get KPIs and charts instead of a plain table, add a `visual:` block (`title`,
|
|
445
|
+
`kpis[]`, `charts[]`) to the snippet frontmatter — see reference.md for the full `visual:`
|
|
446
|
+
schema. Raw `query` / `export` invocations render a sortable table only.
|
|
436
447
|
|
|
437
448
|
## Common workflows
|
|
438
449
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to dbcli are documented here.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.39.1] - 2026-06-30 - Skill report dashboard routing
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Skill 路由補上 DB report / dashboard / HTML UI 意圖。** `assets/SKILL.md` / `assets/SKILL.zh-TW.md` 的 metadata、任務路由表、開發者速查與 HTML dashboard 範例現在明確導向 `queries search|suggest` → `queries show` → `q @<name> --ui` / `--format html`,並保留 raw SQL `export --format html` 的檔案輸出路徑。已透過 `plugin:sync` 同步到所有受管理平台副本。純文件 / skill 變更,無 CLI 行為更動。
|
|
13
|
+
|
|
14
|
+
## [1.39.0] - 2026-06-24 - Dashboard chart type 解析時邊界驗證
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **`--ui` dashboard chart type 改為解析時驗證。** Saved query 的 `visual.charts[].type` 現以單一合法集合 `line` / `bar` / `area` / `pie` 驗證;指定未支援的類型(含打錯字)會在解析時拋出 `SavedQueryError`(`PARSE_ERROR`),訊息列出合法清單。先前的行為是把任何未知類型**靜默畫成圓餅圖**。型別宣告中從未被渲染的 `scatter` 一併移除。
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **未知 chart type 不再靜默偽裝成圓餅圖。** dashboard 渲染端對非可渲染類型顯示明確的「Unsupported chart type」佔位,而非 fallthrough 成 `PieChart`。
|
|
23
|
+
|
|
8
24
|
## [1.38.1] - 2026-06-23 - Redis delete 能力對齊 & SKILL.md 任務路由重構
|
|
9
25
|
|
|
10
26
|
### Fixed
|
package/assets/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dbcli
|
|
3
|
-
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
3
|
+
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, generate DB reports or interactive HTML dashboards, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, generating a report/dashboard/HTML UI from raw SQL or saved snippets, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dbcli
|
|
@@ -30,6 +30,7 @@ the CLI package has not been installed globally.
|
|
|
30
30
|
| --- | --- |
|
|
31
31
|
| A named workflow fits ("diagnose slow query", "audit permissions") | `skill tasks list` → `skill tasks plan <pack>` — **prefer this; do not invent steps** |
|
|
32
32
|
| A fixed diagnostic goal | `guide <goal>` (`slow-query` / `capacity` / `health` / `index-usage` / `permissions` / `schema-overview`; `guide --list`) |
|
|
33
|
+
| A DB report / dashboard / HTML UI | `blacklist list` → `queries search <keywords>` or `queries suggest <intent>` → `queries show @<name>` → browser: `q @<name> --param k=v --ui`; file: `q @<name> --format html > report.html` or `export "<SQL>" --format html --output report.html` |
|
|
33
34
|
| Setting up a connection | see **Connection setup** |
|
|
34
35
|
| Anything else | run commands manually; consult the **Developer workflows** cheat-sheet |
|
|
35
36
|
|
|
@@ -89,6 +90,7 @@ in **How to use dbcli** still applies.
|
|
|
89
90
|
| Situation | Minimum safe path |
|
|
90
91
|
| --- | --- |
|
|
91
92
|
| DB-backed feature | `blacklist list` → `schema <object>` → `queries suggest <intent>` |
|
|
93
|
+
| DB report / dashboard request | `blacklist list` → `queries search <keywords>` / `queries suggest <intent>` → `queries show @<name>` → `q @<name> --ui` or `--format html` |
|
|
92
94
|
| Application data bug | `audit tail --for-agent --n 10` → `blacklist list` → `schema <object>` → narrow query |
|
|
93
95
|
| ORM or migration work | `schema --format json` → `diff --snapshot <name>` → `migrate add-index`/`add-column` (preview SQL) → `diff --against <snapshot>` |
|
|
94
96
|
| PR database review | Review changed persistence paths, then propose concrete `schema` / `plan` / `dry-run` / `report` / `guide` commands per material claim. |
|
|
@@ -103,6 +105,11 @@ dbcli inspect --for-agent --format json
|
|
|
103
105
|
dbcli blacklist list --format json
|
|
104
106
|
dbcli schema <object> --format json
|
|
105
107
|
dbcli queries suggest <intent> --format json
|
|
108
|
+
dbcli queries search <report keywords> --format json
|
|
109
|
+
dbcli queries show @<name> --format json
|
|
110
|
+
dbcli q @<name> --param k=v --ui
|
|
111
|
+
dbcli q @<name> --param k=v --format html > report.html
|
|
112
|
+
dbcli export "<SQL>" --format html --output report.html
|
|
106
113
|
dbcli audit tail --for-agent --n 10
|
|
107
114
|
dbcli diff --snapshot <name>
|
|
108
115
|
dbcli report --section perf --format json
|
|
@@ -425,14 +432,18 @@ Run with `dbcli q @diag/<topic>` (engine variant auto-picked by the active conne
|
|
|
425
432
|
|
|
426
433
|
```bash
|
|
427
434
|
dbcli query "SELECT day, dau FROM dau_daily" --ui # open in browser
|
|
435
|
+
dbcli q @analytics/revenue --param days=30 --ui # snippet metadata + charts/KPIs
|
|
436
|
+
dbcli q @analytics/revenue --param days=30 --format html > report.html
|
|
428
437
|
dbcli query "SELECT * FROM orders" --format html > out.html # pipe HTML to stdout
|
|
429
438
|
dbcli export "SELECT * FROM orders" --format html --output orders.html
|
|
430
439
|
```
|
|
431
440
|
|
|
432
441
|
`--ui` implies `--format html` and opens the file; `--format html` alone prints to stdout.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
442
|
+
When a saved snippet exists, prefer `q @<name> --ui` / `q @<name> --format html` because snippet
|
|
443
|
+
metadata can drive titles, KPI cards, and charts. Blacklist redaction is applied **before**
|
|
444
|
+
rendering. To get KPIs and charts instead of a plain table, add a `visual:` block (`title`,
|
|
445
|
+
`kpis[]`, `charts[]`) to the snippet frontmatter — see reference.md for the full `visual:`
|
|
446
|
+
schema. Raw `query` / `export` invocations render a sortable table only.
|
|
436
447
|
|
|
437
448
|
## Common workflows
|
|
438
449
|
|
package/assets/SKILL.zh-TW.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dbcli
|
|
3
|
-
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
3
|
+
description: Database CLI for AI agents with permission-based access control. Use to set up new connections, query, inspect schemas, insert/update/delete, export results, generate DB reports or interactive HTML dashboards, and blacklist sensitive columns/tables. Supports MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch with multiple named connections per project and custom env files. Trigger when configuring a database connection (`.dbcli` / `.env`), choosing between v1 single and v2 multi-connection layouts, picking auth modes (URI, env refs, Cloud ID, API key), running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL, generating a report/dashboard/HTML UI from raw SQL or saved snippets, exploring table/collection/key/index structures, switching database environments, protecting sensitive data from AI access, or performing automated recovery and guided remediation after command failures. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dbcli
|
|
@@ -25,6 +25,7 @@ description: Database CLI for AI agents with permission-based access control. Us
|
|
|
25
25
|
| --- | --- |
|
|
26
26
|
| 有名稱的工作流程符合(「診斷慢查詢」、「審計權限」) | `skill tasks list` → `skill tasks plan <pack>` — **優先選用;不要自己組合步驟** |
|
|
27
27
|
| 固定診斷目標 | `guide <goal>`(`slow-query` / `capacity` / `health` / `index-usage` / `permissions` / `schema-overview`;`guide --list`) |
|
|
28
|
+
| DB report / dashboard / HTML UI | `blacklist list` → `queries search <keywords>` 或 `queries suggest <intent>` → `queries show @<name>` → 瀏覽器:`q @<name> --param k=v --ui`;檔案:`q @<name> --format html > report.html` 或 `export "<SQL>" --format html --output report.html` |
|
|
28
29
|
| 設定連線 | 見 **連線設定** |
|
|
29
30
|
| 其他情況 | 手動執行指令;參考 **開發者工作流** 速查表 |
|
|
30
31
|
|
|
@@ -65,6 +66,7 @@ dbcli skill tasks plan <task> --param key=value --format json # generate pla
|
|
|
65
66
|
| 情境 | 最小安全路徑 |
|
|
66
67
|
| --- | --- |
|
|
67
68
|
| DB-backed 功能 | `blacklist list` → `schema <object>` → `queries suggest <intent>` |
|
|
69
|
+
| DB report / dashboard request | `blacklist list` → `queries search <keywords>` / `queries suggest <intent>` → `queries show @<name>` → `q @<name> --ui` 或 `--format html` |
|
|
68
70
|
| 應用程式資料錯誤 | `audit tail --for-agent --n 10` → `blacklist list` → `schema <object>` → 最小查詢 |
|
|
69
71
|
| ORM 或 migration | `schema --format json` → `diff --snapshot <name>` → `migrate add-index`/`add-column`(預覽 SQL)→ `diff --against <snapshot>` |
|
|
70
72
|
| PR 資料庫風險審查 | 審查變更的 persistence path,並針對每個重要主張提出具體 `schema`、`plan`、`dry-run`、`report` 或 `guide` 指令。 |
|
|
@@ -77,6 +79,11 @@ dbcli inspect --for-agent --format json
|
|
|
77
79
|
dbcli blacklist list --format json
|
|
78
80
|
dbcli schema <object> --format json
|
|
79
81
|
dbcli queries suggest <intent> --format json
|
|
82
|
+
dbcli queries search <report keywords> --format json
|
|
83
|
+
dbcli queries show @<name> --format json
|
|
84
|
+
dbcli q @<name> --param k=v --ui
|
|
85
|
+
dbcli q @<name> --param k=v --format html > report.html
|
|
86
|
+
dbcli export "<SQL>" --format html --output report.html
|
|
80
87
|
dbcli audit tail --for-agent --n 10
|
|
81
88
|
dbcli diff --snapshot <name>
|
|
82
89
|
dbcli report --section perf --format json
|
|
@@ -329,11 +336,13 @@ Snippet 從三層解析,**local > shared > builtin**(本地優先):`buil
|
|
|
329
336
|
|
|
330
337
|
```bash
|
|
331
338
|
dbcli query "SELECT day, dau FROM dau_daily" --ui # open in browser
|
|
339
|
+
dbcli q @analytics/revenue --param days=30 --ui # snippet metadata + charts/KPIs
|
|
340
|
+
dbcli q @analytics/revenue --param days=30 --format html > report.html
|
|
332
341
|
dbcli query "SELECT * FROM orders" --format html > out.html # pipe HTML to stdout
|
|
333
342
|
dbcli export "SELECT * FROM orders" --format html --output orders.html
|
|
334
343
|
```
|
|
335
344
|
|
|
336
|
-
`--ui` 隱含 `--format html` 並開啟檔案;`--format html` 單獨使用則寫到 stdout
|
|
345
|
+
`--ui` 隱含 `--format html` 並開啟檔案;`--format html` 單獨使用則寫到 stdout。若已存在 saved snippet,優先用 `q @<name> --ui` / `q @<name> --format html`,因為 snippet metadata 可驅動標題、KPI cards 與圖表。Blacklist 遮蔽在渲染**之前**套用。若要取得 KPI 與圖表而非純 table,請在 snippet frontmatter 加上 `visual:` 區塊(`title`、`kpis[]`、`charts[]`)— 完整 `visual:` schema 見 reference.md。原始 `query` / `export` 呼叫只能渲染 sortable table。
|
|
337
346
|
|
|
338
347
|
## 常見工作流程
|
|
339
348
|
|