@carllee1983/dbcli 10.0.0 → 12.0.0
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor/rules/dbcli.mdc +5 -4
- package/.cursor/skills/dbcli/reference.md +8 -5
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +5 -4
- package/.github/skills/dbcli/reference.md +8 -5
- package/CHANGELOG.md +107 -0
- package/assets/SKILL.md +5 -4
- package/assets/reference.md +8 -5
- package/assets/tasks/README.md +1 -1
- package/assets/tasks/analyze-table-perf.md +1 -1
- package/assets/tasks/audit-permissions.md +1 -1
- package/assets/tasks/connection-health.md +1 -2
- package/assets/tasks/design-review.md +1 -1
- package/assets/tasks/diagnose-slow-query.md +1 -1
- package/assets/tasks/migration-review.md +5 -3
- package/assets/tasks/mongo-safe-backfill.md +1 -1
- package/assets/tasks/mongo-schema-drift-review.md +1 -1
- package/assets/tasks/orm-drift-review.md +1 -1
- package/assets/tasks/pr-database-review.md +1 -1
- package/assets/tasks/safe-backfill-verify.md +1 -1
- package/assets/tasks/safe-backfill.md +13 -7
- package/assets/tasks/schema-drift-review.md +1 -1
- package/assets/tasks/slow-endpoint-investigation.md +1 -1
- package/dist/cli-runtime.mjs +15760 -20099
- package/dist/cli.mjs +2 -1
- package/dist/core.d.ts +25 -1
- package/dist/core.mjs +123 -0
- package/gemini-extension.json +1 -1
- package/package.json +2 -1
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +5 -4
- package/plugins/dbcli-agent/skills/dbcli/reference.md +8 -5
- package/skills/dbcli/SKILL.md +5 -4
- package/skills/dbcli/reference.md +8 -5
package/.cursor/rules/dbcli.mdc
CHANGED
|
@@ -372,7 +372,7 @@ dbcli init # parses .env in cwd
|
|
|
372
372
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb
|
|
373
373
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 \
|
|
374
374
|
--user admin --password '<secret>' --auth-source admin --name mydb
|
|
375
|
-
# MongoDB — full URI (
|
|
375
|
+
# MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
|
|
376
376
|
dbcli init --conn-name local --system mongodb \
|
|
377
377
|
--uri "mongodb+srv://user:pw@cluster.example.mongodb.net/mydb?authSource=admin"
|
|
378
378
|
|
|
@@ -494,9 +494,10 @@ refs have no value to connect with yet.
|
|
|
494
494
|
natively or via the DoH fallback; useful when the runtime restricts DNS.
|
|
495
495
|
- **MongoDB `authSource` / `replicaSet` / `tls` / `srv`** — `init` asks for
|
|
496
496
|
these interactively (`authSource` only when a user is set; `replicaSet` /
|
|
497
|
-
`tls` behind an "advanced options?" prompt);
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
`tls` behind an "advanced options?" prompt); non-interactive flags are
|
|
498
|
+
`--auth-source <db>`, `--replica-set <name>`, `--srv` (no `port` written) and
|
|
499
|
+
`--tls` / `--no-tls` (neither given writes no `tls`); a flag you pass skips
|
|
500
|
+
its prompt. If a config has both `uri` and
|
|
500
501
|
per-field values, `uri` wins silently — `dbcli doctor` flags this and also
|
|
501
502
|
warns when `srv: true` is combined with a non-default `port`.
|
|
502
503
|
- **MySQL/Postgres password with `@` `:` `/`** — when using `DATABASE_URL`,
|
|
@@ -127,7 +127,7 @@ dbcli init --conn-name local --no-interactive --force # Non-interactive; cred
|
|
|
127
127
|
# MongoDB — field-by-field (primary path, same shape as SQL)
|
|
128
128
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --user admin --password secret --auth-source admin --name mydb
|
|
129
129
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb # No auth
|
|
130
|
-
# MongoDB — full URI (
|
|
130
|
+
# MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
|
|
131
131
|
dbcli init --conn-name local --system mongodb --uri "mongodb://user:pass@host:27017/mydb?authSource=admin"
|
|
132
132
|
|
|
133
133
|
# Redis (database = logical DB index)
|
|
@@ -161,7 +161,7 @@ New initialization always creates named v2 configuration, including plain `init`
|
|
|
161
161
|
|
|
162
162
|
**Environment-reference options:** `--env-host <var>`, `--env-port <var>`, `--env-user <var>`, `--env-password <var>`, `--env-database <var>`
|
|
163
163
|
|
|
164
|
-
**MongoDB-specific options:** `--uri <uri>` (full connection URI
|
|
164
|
+
**MongoDB-specific options:** `--uri <uri>` (full connection URI, decomposed into field config on write: `authSource`/`replicaSet`/`tls`(`ssl`) become dedicated fields, `mongodb+srv` becomes `srv: true`, the path database becomes `database`, other parameters go to `options`; multi-host strings, strings carrying `authMechanismProperties`/`tlsCertificateKeyFilePassword`/`proxyPassword`, strings repeating a query key, and strings whose `authMechanism` is not SCRAM-SHA-1/SCRAM-SHA-256 are stored as-is in `uri` with a plaintext-credentials warning; cannot be combined with `--host`/`--port`/`--user`/`--password`/`--auth-source`/`--replica-set`/`--srv`/`--tls`/`--no-tls` or `--use-env-refs`; `--name` may be combined), `--auth-source <db>` (auth database, default: `admin` when user/password set). `--replica-set <name>` (writes `replicaSet`), `--srv` (writes `srv: true` and no `port`; builds `mongodb+srv://` and resolves hosts via DNS SRV), `--tls` / `--no-tls` (writes `tls: true` / `tls: false`; neither flag writes no `tls` key, so the driver default applies). Interactive `init` skips the prompt for any of these given as a flag; otherwise it asks `srv` right after `host` (before `port`) and `replicaSet` / `tls` under an "advanced options?" prompt. The flags also apply with `--use-env-refs`.
|
|
165
165
|
|
|
166
166
|
**Elasticsearch-specific options:** `--cloud-id <id>` (Elastic Cloud), `--api-key <key>` (ApiKey auth). Other ES fields (`nodes[]`, `protocol`, `caPath`, `rejectUnauthorized`) can be edited directly in `.dbcli`.
|
|
167
167
|
|
|
@@ -1868,8 +1868,11 @@ at execution time, and no human has agreed to anything. `admin` in a config file
|
|
|
1868
1868
|
is a permission level, not a DBA sign-off.
|
|
1869
1869
|
|
|
1870
1870
|
`schema.read` is available under `DBCLI_AGENT_MODE=1`, and `dbcli schema` runs
|
|
1871
|
-
there: storing the schema cache is not a configuration change.
|
|
1872
|
-
|
|
1871
|
+
there: storing the schema cache is not a configuration change. `blacklist.read`
|
|
1872
|
+
(`blacklist list`) is available there too, so read-only Task Packs that inspect
|
|
1873
|
+
the blacklist can plan; `blacklist.manage`, which adds and removes rules, is
|
|
1874
|
+
refused. Agent mode still refuses every change to connection identity,
|
|
1875
|
+
permission and credentials.
|
|
1873
1876
|
|
|
1874
1877
|
**Permission:** query-only+ (no connection is made)
|
|
1875
1878
|
|
|
@@ -3644,7 +3647,7 @@ Parser behaviour (`src/core/saved-queries/parser.ts::normaliseVisual`):
|
|
|
3644
3647
|
|
|
3645
3648
|
MongoDB connections use a JSON-based query model instead of SQL. Treat MongoDB support as a narrower document-database path, not as a full SQL feature equivalent.
|
|
3646
3649
|
|
|
3647
|
-
`init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow and the non-interactive path via `--uri` (with the required `--conn-name`). Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
|
|
3650
|
+
`init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow (stored as-is) and the non-interactive path via `--uri` (with the required `--conn-name`), where the string is decomposed into the field config on write. Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
|
|
3648
3651
|
|
|
3649
3652
|
The 5000ms default server-selection timeout is often too tight for a connection over a VPN or to Atlas. Set a `timeout` field (ms) in the connection config, or override it per invocation with root-level `--timeout`, e.g. `dbcli --timeout 20000 --use <conn> list`.
|
|
3650
3653
|
|
|
@@ -372,7 +372,7 @@ dbcli init # parses .env in cwd
|
|
|
372
372
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb
|
|
373
373
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 \
|
|
374
374
|
--user admin --password '<secret>' --auth-source admin --name mydb
|
|
375
|
-
# MongoDB — full URI (
|
|
375
|
+
# MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
|
|
376
376
|
dbcli init --conn-name local --system mongodb \
|
|
377
377
|
--uri "mongodb+srv://user:pw@cluster.example.mongodb.net/mydb?authSource=admin"
|
|
378
378
|
|
|
@@ -494,9 +494,10 @@ refs have no value to connect with yet.
|
|
|
494
494
|
natively or via the DoH fallback; useful when the runtime restricts DNS.
|
|
495
495
|
- **MongoDB `authSource` / `replicaSet` / `tls` / `srv`** — `init` asks for
|
|
496
496
|
these interactively (`authSource` only when a user is set; `replicaSet` /
|
|
497
|
-
`tls` behind an "advanced options?" prompt);
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
`tls` behind an "advanced options?" prompt); non-interactive flags are
|
|
498
|
+
`--auth-source <db>`, `--replica-set <name>`, `--srv` (no `port` written) and
|
|
499
|
+
`--tls` / `--no-tls` (neither given writes no `tls`); a flag you pass skips
|
|
500
|
+
its prompt. If a config has both `uri` and
|
|
500
501
|
per-field values, `uri` wins silently — `dbcli doctor` flags this and also
|
|
501
502
|
warns when `srv: true` is combined with a non-default `port`.
|
|
502
503
|
- **MySQL/Postgres password with `@` `:` `/`** — when using `DATABASE_URL`,
|
|
@@ -127,7 +127,7 @@ dbcli init --conn-name local --no-interactive --force # Non-interactive; cred
|
|
|
127
127
|
# MongoDB — field-by-field (primary path, same shape as SQL)
|
|
128
128
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --user admin --password secret --auth-source admin --name mydb
|
|
129
129
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb # No auth
|
|
130
|
-
# MongoDB — full URI (
|
|
130
|
+
# MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
|
|
131
131
|
dbcli init --conn-name local --system mongodb --uri "mongodb://user:pass@host:27017/mydb?authSource=admin"
|
|
132
132
|
|
|
133
133
|
# Redis (database = logical DB index)
|
|
@@ -161,7 +161,7 @@ New initialization always creates named v2 configuration, including plain `init`
|
|
|
161
161
|
|
|
162
162
|
**Environment-reference options:** `--env-host <var>`, `--env-port <var>`, `--env-user <var>`, `--env-password <var>`, `--env-database <var>`
|
|
163
163
|
|
|
164
|
-
**MongoDB-specific options:** `--uri <uri>` (full connection URI
|
|
164
|
+
**MongoDB-specific options:** `--uri <uri>` (full connection URI, decomposed into field config on write: `authSource`/`replicaSet`/`tls`(`ssl`) become dedicated fields, `mongodb+srv` becomes `srv: true`, the path database becomes `database`, other parameters go to `options`; multi-host strings, strings carrying `authMechanismProperties`/`tlsCertificateKeyFilePassword`/`proxyPassword`, strings repeating a query key, and strings whose `authMechanism` is not SCRAM-SHA-1/SCRAM-SHA-256 are stored as-is in `uri` with a plaintext-credentials warning; cannot be combined with `--host`/`--port`/`--user`/`--password`/`--auth-source`/`--replica-set`/`--srv`/`--tls`/`--no-tls` or `--use-env-refs`; `--name` may be combined), `--auth-source <db>` (auth database, default: `admin` when user/password set). `--replica-set <name>` (writes `replicaSet`), `--srv` (writes `srv: true` and no `port`; builds `mongodb+srv://` and resolves hosts via DNS SRV), `--tls` / `--no-tls` (writes `tls: true` / `tls: false`; neither flag writes no `tls` key, so the driver default applies). Interactive `init` skips the prompt for any of these given as a flag; otherwise it asks `srv` right after `host` (before `port`) and `replicaSet` / `tls` under an "advanced options?" prompt. The flags also apply with `--use-env-refs`.
|
|
165
165
|
|
|
166
166
|
**Elasticsearch-specific options:** `--cloud-id <id>` (Elastic Cloud), `--api-key <key>` (ApiKey auth). Other ES fields (`nodes[]`, `protocol`, `caPath`, `rejectUnauthorized`) can be edited directly in `.dbcli`.
|
|
167
167
|
|
|
@@ -1868,8 +1868,11 @@ at execution time, and no human has agreed to anything. `admin` in a config file
|
|
|
1868
1868
|
is a permission level, not a DBA sign-off.
|
|
1869
1869
|
|
|
1870
1870
|
`schema.read` is available under `DBCLI_AGENT_MODE=1`, and `dbcli schema` runs
|
|
1871
|
-
there: storing the schema cache is not a configuration change.
|
|
1872
|
-
|
|
1871
|
+
there: storing the schema cache is not a configuration change. `blacklist.read`
|
|
1872
|
+
(`blacklist list`) is available there too, so read-only Task Packs that inspect
|
|
1873
|
+
the blacklist can plan; `blacklist.manage`, which adds and removes rules, is
|
|
1874
|
+
refused. Agent mode still refuses every change to connection identity,
|
|
1875
|
+
permission and credentials.
|
|
1873
1876
|
|
|
1874
1877
|
**Permission:** query-only+ (no connection is made)
|
|
1875
1878
|
|
|
@@ -3644,7 +3647,7 @@ Parser behaviour (`src/core/saved-queries/parser.ts::normaliseVisual`):
|
|
|
3644
3647
|
|
|
3645
3648
|
MongoDB connections use a JSON-based query model instead of SQL. Treat MongoDB support as a narrower document-database path, not as a full SQL feature equivalent.
|
|
3646
3649
|
|
|
3647
|
-
`init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow and the non-interactive path via `--uri` (with the required `--conn-name`). Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
|
|
3650
|
+
`init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow (stored as-is) and the non-interactive path via `--uri` (with the required `--conn-name`), where the string is decomposed into the field config on write. Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
|
|
3648
3651
|
|
|
3649
3652
|
The 5000ms default server-selection timeout is often too tight for a connection over a VPN or to Atlas. Set a `timeout` field (ms) in the connection config, or override it per invocation with root-level `--timeout`, e.g. `dbcli --timeout 20000 --use <conn> list`.
|
|
3650
3653
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,113 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [12.0.0] - 2026-10-18
|
|
11
|
+
|
|
12
|
+
版本為 **12.0.0**。SQL 單一物件 `schema` 現在將含點號的輸入解析為完整名稱,
|
|
13
|
+
會改變既有命令的查詢對象,因此採用 major 版本。升級前請檢查含點號的名稱、依賴完整
|
|
14
|
+
schema metadata 的腳本、SHOW GRANTS 輸出用途,以及原生授權錯誤的處理分支。
|
|
15
|
+
本版不需要連線設定、schema 快取或 recovery envelope 的資料遷移。
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **assert --expect 的 evidence receipt**:只投影檢查 pass bits,沿用既有 schema,
|
|
20
|
+
排除原始 SQL 與結果值;成功與失敗斷言都可產生 receipt。`--no-fail` 只影響斷言退出碼,
|
|
21
|
+
失敗 receipt 不會變成功,receipt 寫入失敗仍 exit 1。
|
|
22
|
+
- **MongoDB Unix socket URI 與錯誤去敏**:`init --uri` 與互動貼上的 Unix socket
|
|
23
|
+
連線字串保留原始 `uri`、認證與 options,不再拆成 TCP host/port;既有明文儲存警告
|
|
24
|
+
仍會顯示。URI fallback 連線測試失敗時,同時遮蔽原始 URI、編碼及解碼後的密碼。
|
|
25
|
+
- **內建 task pack 的操作指引**:`safe-backfill` 改用真實支援的
|
|
26
|
+
`update ... --dry-run`,raw SQL 的預覽使用 `plan`;移除不存在的 `query --dry-run`
|
|
27
|
+
與 `--execute` 指引,實際寫入仍需既有確認與權限。`migration-review` 說明執行 DDL
|
|
28
|
+
需要 `admin`,唯讀規劃不升權,也不執行 DDL。
|
|
29
|
+
- **CLI 啟動 bundle**:建置使用 syntax minification 降低 runtime bundle 大小,
|
|
30
|
+
維持啟動效能預算;保留 whitespace,避免 Bun 對動態 import 的錯誤改寫。
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **單一物件 schema 支援完整名稱**:PostgreSQL 可用 `schema.table`,MySQL/MariaDB
|
|
35
|
+
可用 `database.table` 檢視表與系統視圖;支援原生識別字引用、內嵌點號與跳脫引號。
|
|
36
|
+
完整名稱不可搭配 `--refresh`/`--reset`,不改連線設定或 schema 快取,也不擴大掃描範圍。
|
|
37
|
+
- **`blacklist.read` capability 與 agent-mode task planning**:唯讀的 `blacklist list`
|
|
38
|
+
有獨立 capability,內建需要檢視 blacklist 的 task pack 改用它;`connection-health`
|
|
39
|
+
不要求 blacklist capability。引擎與權限符合時,`DBCLI_AGENT_MODE=1` 可產生這些
|
|
40
|
+
plan-only 計畫;`blacklist.manage` 仍是設定異動,在 agent mode 下不可用。
|
|
41
|
+
規劃不執行任何步驟,也不授予執行權限。
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- **文件釐清 RDS CALL 證據交接**:query-only 仍拒絕 CALL,未新增 RDS 程序支援。
|
|
46
|
+
區分 CLI 政策拒絕與 DBA 的 indeterminate(證據不足)結論,提供既有授權內的人工
|
|
47
|
+
交接模板,並區分 binlog 保留小時與自動快照保留天數;不以升權或 AWS 自動化作為補救。
|
|
48
|
+
- **SHOW GRANTS 認證內容去敏**:MySQL/MariaDB 的正常與 native-read-only 執行,
|
|
49
|
+
一律在 adapter 回傳前把可安全辨識的認證參數換成 `[REDACTED]`,保留帳號、角色、
|
|
50
|
+
授權範圍與權限;未知、不完整或歧義格式及異常型態則整格改為
|
|
51
|
+
`[OMITTED: grant text could not be safely redacted]`,保留列數、欄名與結果結構。
|
|
52
|
+
query、互動 shell 與 SQL 查詢 export 的適用輸出格式均受保護,不依賴 blacklist,
|
|
53
|
+
所有權限與 agent 模式均無 bypass。省略格不代表完整授權資訊,去敏結果不可作為可重播 SQL。
|
|
54
|
+
僅涵蓋 SHOW GRANTS;SHOW CREATE USER、直接系統表查詢與任意 SQL 不在掃描範圍,
|
|
55
|
+
saved query 仍拒絕 SHOW GRANTS。
|
|
56
|
+
- **原生授權錯誤代碼**:MySQL/MariaDB 1044、1142、1143、1227 與 PostgreSQL
|
|
57
|
+
`42501` 現在分類為 `DB_PERMISSION_DENIED`,與登入驗證失敗 `AUTH_FAILED` 及本機政策
|
|
58
|
+
`PERMISSION_DENIED` 區分。Recovery 維持 schema v1 與 `error.code: "PERMISSION_DENIED"`,
|
|
59
|
+
以 `error.details.connectionCode: "DB_PERMISSION_DENIED"` 識別原生拒絕;只提供人工指引,
|
|
60
|
+
`recovery: []` 並省略 `verify`,`recover --apply` 不執行修復。既有 envelope 無需遷移,
|
|
61
|
+
呼叫端須依新 discriminator 區分拒絕來源。
|
|
62
|
+
- **Schema 輸出與 metadata 保護**:完整名稱 JSON 保留局部 `name` 並另帶 `schema`,
|
|
63
|
+
文字輸出可區分兩個 component;`tableType` 正確呈現 table/view(materialized view 為 view)。
|
|
64
|
+
完整名稱不執行關係資料 `COUNT(*)`,未知筆數與大小分類為 null,不再以假零值或 small 表示。
|
|
65
|
+
舊、新 SQL 單一物件名稱都套用 blacklist;隱藏受保護欄位及涉及它的整項主鍵、索引與外鍵,
|
|
66
|
+
無法安全表達完整欄位相依性的 expression/partial index 也會整項省略;省略時 JSON 輸出
|
|
67
|
+
`metadataOmitted: true`,文字輸出顯示省略通知,回傳 metadata 不保證完整。
|
|
68
|
+
必要 metadata 讀取失敗會回報失敗,不以空集合冒充成功;省略不代表該 metadata 不存在。
|
|
69
|
+
MySQL/MariaDB 的 `indexes[].unique` 正規化為宣告的 boolean 型別,不再輸出 driver 的
|
|
70
|
+
數字 0/1;複合外鍵欄位順序與目標 namespace 依 catalog 正確呈現。
|
|
71
|
+
- **破壞性變更:含點號名稱的解析**:原本 `dbcli schema audit.orders` 查詢預設
|
|
72
|
+
namespace 中字面名稱為 `audit.orders` 的物件,現在會查詢 namespace `audit` 中的
|
|
73
|
+
`orders`。PostgreSQL 原本的局部含點號名稱須改成
|
|
74
|
+
`dbcli schema 'public."audit.orders"' --format json`;MySQL/MariaDB 以 backtick
|
|
75
|
+
分別引用 database 與局部名稱,例如
|
|
76
|
+
``dbcli schema '`reporting`.`audit.orders`' --format json``,仍須符合該引擎允許的名稱規則。
|
|
77
|
+
未限定且不含點號的名稱維持 PostgreSQL `public`/MySQL、MariaDB 預設 database 與既有
|
|
78
|
+
精確名稱語意。完整名稱不存在時不會退回預設 namespace 的同名物件;其他命令的名稱解析不變。
|
|
79
|
+
|
|
80
|
+
## [11.0.0] - 2026-10-14
|
|
81
|
+
|
|
82
|
+
版本為 **11.0.0**。`dbcli init --uri` 寫出的設定形狀改變,且 `--uri` 與欄位 flag 並用會報錯,
|
|
83
|
+
會影響既有腳本,所以採用 major 版本。已存在、含 `uri` 的設定不會被遷移,連線行為不變。
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
|
|
87
|
+
- **破壞性變更:`dbcli init --uri` 寫出的設定形狀改變。** 以 `--uri` 傳入的 MongoDB
|
|
88
|
+
連線字串現在寫入前先拆解成欄位設定(`host`、`user`、`password`、`database`、
|
|
89
|
+
`authSource`、`replicaSet`、`tls`、`srv`,其餘參數進 `options`),不再原樣存成 `uri`(互動 init 貼上的連線字串也一樣:拆解後列出結果並直接進連線測試,選單第二項改稱「貼上連線字串(Atlas / Compass 複製的)」);互動終端下 `--uri` 字串沒帶資料庫名稱時,`Database name` 改為必填、不再預設 `testdb`;
|
|
90
|
+
讀取 `uri` 欄位的腳本須改讀欄位。**既有設定檔裡已存成 `uri` 的連線不會被遷移,照常連線**;
|
|
91
|
+
只有之後重新以 `--uri` 執行 init 才會套用新的拆解行為。多組 host、帶 `authMechanismProperties`、
|
|
92
|
+
`tlsCertificateKeyFilePassword`、`proxyPassword`、同一 query 鍵重複出現,或 `authMechanism`
|
|
93
|
+
不是 `SCRAM-SHA-1`/`SCRAM-SHA-256` 的字串無法拆解,仍存成只含 `system`、
|
|
94
|
+
`uri`、`database` 的連線並警告帳密明文存放(除此之外一律拆解成欄位)。字串裡的 `ssl` 寫成 `tls`;
|
|
95
|
+
非 SRV、有帳號、路徑帶資料庫且未寫 `authSource` 的字串,拆解後寫入 `authSource: <路徑資料庫>`,
|
|
96
|
+
與 driver 對原字串的認證對象一致。`--uri` 與 `--host`/`--port`/`--user`/
|
|
97
|
+
`--password`/`--auth-source`/`--replica-set`/`--srv`/`--tls`/`--no-tls` 並用,
|
|
98
|
+
以及與 `--use-env-refs` 並用,現在都會報錯(後者原本只警告)。
|
|
99
|
+
- **`srv: true` 欄位設定的 `authSource` 改為 SRV TXT 優先。** 既有、有 `user` 但未設定
|
|
100
|
+
`authSource` 的 `srv: true` 連線,若 SRV TXT record 提供 `authSource`,現在會採用該值,
|
|
101
|
+
不再固定使用 `admin`;TXT 沒有提供時仍補 `admin`。明確設定的 `authSource` 欄位仍優先,
|
|
102
|
+
非 SRV 的欄位設定維持預設 `admin`。
|
|
103
|
+
|
|
104
|
+
### Added
|
|
105
|
+
|
|
106
|
+
- **MongoDB 欄位設定新增 `options`**:字串對字串的物件,內容附加到連線 URI 的 query
|
|
107
|
+
(例如 `{"retryWrites": "false", "appName": "dbcli"}`)。只接受純字串,不支援 env-ref;
|
|
108
|
+
鍵若與 `authSource`/`replicaSet`/`tls`/`ssl` 同名(不分大小寫)會驗證失敗並指出該鍵,
|
|
109
|
+
請改設專屬欄位。設定了 `uri` 時 `options` 被忽略。
|
|
110
|
+
- **`dbcli init` 新增 MongoDB flag**:`--replica-set <name>`、`--srv`、`--tls` / `--no-tls`。
|
|
111
|
+
`--srv` 寫入 `srv: true` 且不寫 `port`,並在同時給 `--port`/`--env-port` 時警告該 port 被忽略;
|
|
112
|
+
`--tls` 與 `--no-tls` 皆未給時不寫 `tls`,沿用 driver 預設。互動精靈不會再問已用 flag
|
|
113
|
+
給的值;搭配 `--use-env-refs` 時這些 flag 同樣生效。
|
|
114
|
+
- **`dbcli doctor` 在 `uri` 與 `options` 並存時警告**:`uri` 優先,`options` 會被忽略
|
|
115
|
+
(原本只檢查 `host`/`user`,現在 `options` 也納入)。
|
|
116
|
+
|
|
10
117
|
## [10.0.0] - 2026-10-13
|
|
11
118
|
|
|
12
119
|
這次發布整合 npm 9.1.2 之後合併的變更:明確命名連線、可不設預設連線、Bun 1.4.0
|
package/assets/SKILL.md
CHANGED
|
@@ -372,7 +372,7 @@ dbcli init # parses .env in cwd
|
|
|
372
372
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb
|
|
373
373
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 \
|
|
374
374
|
--user admin --password '<secret>' --auth-source admin --name mydb
|
|
375
|
-
# MongoDB — full URI (
|
|
375
|
+
# MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
|
|
376
376
|
dbcli init --conn-name local --system mongodb \
|
|
377
377
|
--uri "mongodb+srv://user:pw@cluster.example.mongodb.net/mydb?authSource=admin"
|
|
378
378
|
|
|
@@ -494,9 +494,10 @@ refs have no value to connect with yet.
|
|
|
494
494
|
natively or via the DoH fallback; useful when the runtime restricts DNS.
|
|
495
495
|
- **MongoDB `authSource` / `replicaSet` / `tls` / `srv`** — `init` asks for
|
|
496
496
|
these interactively (`authSource` only when a user is set; `replicaSet` /
|
|
497
|
-
`tls` behind an "advanced options?" prompt);
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
`tls` behind an "advanced options?" prompt); non-interactive flags are
|
|
498
|
+
`--auth-source <db>`, `--replica-set <name>`, `--srv` (no `port` written) and
|
|
499
|
+
`--tls` / `--no-tls` (neither given writes no `tls`); a flag you pass skips
|
|
500
|
+
its prompt. If a config has both `uri` and
|
|
500
501
|
per-field values, `uri` wins silently — `dbcli doctor` flags this and also
|
|
501
502
|
warns when `srv: true` is combined with a non-default `port`.
|
|
502
503
|
- **MySQL/Postgres password with `@` `:` `/`** — when using `DATABASE_URL`,
|
package/assets/reference.md
CHANGED
|
@@ -127,7 +127,7 @@ dbcli init --conn-name local --no-interactive --force # Non-interactive; cred
|
|
|
127
127
|
# MongoDB — field-by-field (primary path, same shape as SQL)
|
|
128
128
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --user admin --password secret --auth-source admin --name mydb
|
|
129
129
|
dbcli init --conn-name local --system mongodb --host localhost --port 27017 --name mydb # No auth
|
|
130
|
-
# MongoDB — full URI (
|
|
130
|
+
# MongoDB — full URI (decomposed into fields on write; multi-host / secret-option strings stay as `uri` with a warning)
|
|
131
131
|
dbcli init --conn-name local --system mongodb --uri "mongodb://user:pass@host:27017/mydb?authSource=admin"
|
|
132
132
|
|
|
133
133
|
# Redis (database = logical DB index)
|
|
@@ -161,7 +161,7 @@ New initialization always creates named v2 configuration, including plain `init`
|
|
|
161
161
|
|
|
162
162
|
**Environment-reference options:** `--env-host <var>`, `--env-port <var>`, `--env-user <var>`, `--env-password <var>`, `--env-database <var>`
|
|
163
163
|
|
|
164
|
-
**MongoDB-specific options:** `--uri <uri>` (full connection URI
|
|
164
|
+
**MongoDB-specific options:** `--uri <uri>` (full connection URI, decomposed into field config on write: `authSource`/`replicaSet`/`tls`(`ssl`) become dedicated fields, `mongodb+srv` becomes `srv: true`, the path database becomes `database`, other parameters go to `options`; multi-host strings, strings carrying `authMechanismProperties`/`tlsCertificateKeyFilePassword`/`proxyPassword`, strings repeating a query key, and strings whose `authMechanism` is not SCRAM-SHA-1/SCRAM-SHA-256 are stored as-is in `uri` with a plaintext-credentials warning; cannot be combined with `--host`/`--port`/`--user`/`--password`/`--auth-source`/`--replica-set`/`--srv`/`--tls`/`--no-tls` or `--use-env-refs`; `--name` may be combined), `--auth-source <db>` (auth database, default: `admin` when user/password set). `--replica-set <name>` (writes `replicaSet`), `--srv` (writes `srv: true` and no `port`; builds `mongodb+srv://` and resolves hosts via DNS SRV), `--tls` / `--no-tls` (writes `tls: true` / `tls: false`; neither flag writes no `tls` key, so the driver default applies). Interactive `init` skips the prompt for any of these given as a flag; otherwise it asks `srv` right after `host` (before `port`) and `replicaSet` / `tls` under an "advanced options?" prompt. The flags also apply with `--use-env-refs`.
|
|
165
165
|
|
|
166
166
|
**Elasticsearch-specific options:** `--cloud-id <id>` (Elastic Cloud), `--api-key <key>` (ApiKey auth). Other ES fields (`nodes[]`, `protocol`, `caPath`, `rejectUnauthorized`) can be edited directly in `.dbcli`.
|
|
167
167
|
|
|
@@ -1868,8 +1868,11 @@ at execution time, and no human has agreed to anything. `admin` in a config file
|
|
|
1868
1868
|
is a permission level, not a DBA sign-off.
|
|
1869
1869
|
|
|
1870
1870
|
`schema.read` is available under `DBCLI_AGENT_MODE=1`, and `dbcli schema` runs
|
|
1871
|
-
there: storing the schema cache is not a configuration change.
|
|
1872
|
-
|
|
1871
|
+
there: storing the schema cache is not a configuration change. `blacklist.read`
|
|
1872
|
+
(`blacklist list`) is available there too, so read-only Task Packs that inspect
|
|
1873
|
+
the blacklist can plan; `blacklist.manage`, which adds and removes rules, is
|
|
1874
|
+
refused. Agent mode still refuses every change to connection identity,
|
|
1875
|
+
permission and credentials.
|
|
1873
1876
|
|
|
1874
1877
|
**Permission:** query-only+ (no connection is made)
|
|
1875
1878
|
|
|
@@ -3644,7 +3647,7 @@ Parser behaviour (`src/core/saved-queries/parser.ts::normaliseVisual`):
|
|
|
3644
3647
|
|
|
3645
3648
|
MongoDB connections use a JSON-based query model instead of SQL. Treat MongoDB support as a narrower document-database path, not as a full SQL feature equivalent.
|
|
3646
3649
|
|
|
3647
|
-
`init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow and the non-interactive path via `--uri` (with the required `--conn-name`). Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
|
|
3650
|
+
`init --system mongodb` defaults to a field-by-field wizard (`host`, `srv`, `port`, `user`, `password` + `authSource`, then optional `replicaSet` / `tls`); a full `uri` is an explicit advanced choice in the interactive flow (stored as-is) and the non-interactive path via `--uri` (with the required `--conn-name`), where the string is decomposed into the field config on write. Optional fields `authSource`, `replicaSet`, `tls`, and `srv` express what previously required embedding options in the `uri` query string. Atlas-style `mongodb+srv://` URIs are supported both as a full `uri` and via the per-field `srv: true` option. `list` and `query` run against the database configured for the connection, and `query` always requires `--collection <name>`.
|
|
3648
3651
|
|
|
3649
3652
|
The 5000ms default server-selection timeout is often too tight for a connection over a VPN or to Atlas. Set a `timeout` field (ms) in the connection config, or override it per invocation with root-level `--timeout`, e.g. `dbcli --timeout 20000 --use <conn> list`.
|
|
3650
3653
|
|
package/assets/tasks/README.md
CHANGED
|
@@ -33,4 +33,4 @@ The markdown body below the frontmatter is `Agent Notes` and is shown in
|
|
|
33
33
|
|
|
34
34
|
Use `postgresql` for PostgreSQL. The legacy `postgres` engine spelling is read
|
|
35
35
|
as `postgresql`; legacy requirement names `blacklist-list` and `schema-check`
|
|
36
|
-
are rejected with their replacements, `blacklist.
|
|
36
|
+
are rejected with their replacements, `blacklist.read` and `schema.read`.
|
|
@@ -15,7 +15,7 @@ params:
|
|
|
15
15
|
safety:
|
|
16
16
|
mode: plan-only
|
|
17
17
|
requires:
|
|
18
|
-
- blacklist.
|
|
18
|
+
- blacklist.read
|
|
19
19
|
- schema.read
|
|
20
20
|
steps:
|
|
21
21
|
- type: command
|
|
@@ -37,5 +37,7 @@ Use this task before applying a schema migration. It only PLANS — it never run
|
|
|
37
37
|
Save the pre-change `schema {{table}} --format json` output as the baseline. After the
|
|
38
38
|
migration is applied (out of band, via your migration tool), re-run
|
|
39
39
|
`schema {{table}} --format json` and diff the two to confirm the change matches intent.
|
|
40
|
-
Always prepare and record an explicit rollback statement before applying.
|
|
41
|
-
|
|
40
|
+
Always prepare and record an explicit rollback statement before applying.
|
|
41
|
+
Read-only planning and review need no elevated permission beyond this task's existing
|
|
42
|
+
requirements. Running DDL out of band requires `admin` permission — this task neither
|
|
43
|
+
grants that permission nor runs DDL.
|
|
@@ -15,7 +15,7 @@ params:
|
|
|
15
15
|
safety:
|
|
16
16
|
mode: plan-only
|
|
17
17
|
requires:
|
|
18
|
-
- blacklist.
|
|
18
|
+
- blacklist.read
|
|
19
19
|
- schema.read
|
|
20
20
|
steps:
|
|
21
21
|
- type: command
|
|
@@ -34,9 +34,15 @@ steps:
|
|
|
34
34
|
# Agent Notes
|
|
35
35
|
|
|
36
36
|
Use this task when a user wants to backfill or correct existing rows. This task only
|
|
37
|
-
PLANS — it never writes. After reviewing the plan, run the real backfill manually
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
PLANS — it never writes. After reviewing the plan, run the real backfill manually:
|
|
38
|
+
|
|
39
|
+
1. Confirm a narrow `WHERE` clause and capture its scope with a read-only
|
|
40
|
+
`SELECT count(*)` before writing.
|
|
41
|
+
2. Preview the structured write with
|
|
42
|
+
`dbcli update <table> --where "<predicate>" --set '<json>' --dry-run`.
|
|
43
|
+
Keep raw SQL writes in `dbcli plan "<sql>"`; `query` does not dry-run arbitrary writes.
|
|
44
|
+
3. Once the preview looks correct, re-run the write command without `--dry-run`
|
|
45
|
+
and with the required confirmation/force flag for your environment. The existing
|
|
46
|
+
write gate still applies; execution requires read-write (or higher) permission.
|
|
47
|
+
4. Read the rows back afterwards to confirm the backfill achieved its goal. If the
|
|
48
|
+
result does not match, stop and investigate before attempting another write.
|