@carllee1983/dbcli 1.53.0 → 1.54.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/.cursor/rules/dbcli.mdc +1 -1
- package/.cursor/skills/dbcli/reference.md +22 -6
- package/.github/skills/dbcli/SKILL.md +1 -1
- package/.github/skills/dbcli/reference.md +22 -6
- package/CHANGELOG.md +21 -0
- package/assets/SKILL.md +1 -1
- package/assets/SKILL.zh-TW.md +1 -1
- package/assets/reference.md +22 -6
- package/dist/cli-runtime.mjs +35103 -85552
- package/dist/cli.mjs +3 -2
- package/dist/core.d.ts +357 -274
- package/dist/core.mjs +9125 -21887
- package/package.json +3 -2
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +1 -1
- package/plugins/dbcli-agent/skills/dbcli/reference.md +22 -6
- package/skills/dbcli/SKILL.md +1 -1
- package/skills/dbcli/reference.md +22 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carllee1983/dbcli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.54.0",
|
|
4
4
|
"description": "Database CLI for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"scripts": {
|
|
66
66
|
"dev": "bun run src/cli.ts",
|
|
67
67
|
"build": "bun run scripts/build.ts",
|
|
68
|
+
"build:determinism": "bun run scripts/check-build-determinism.ts",
|
|
68
69
|
"prepublishOnly": "bun run build",
|
|
69
70
|
"release:check": "bash scripts/release-check.sh",
|
|
70
71
|
"plugin:sync": "bun run scripts/sync-plugin-assets.ts --write",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"lint:fix": "eslint src tests scripts --ext .ts --fix --max-warnings=0"
|
|
88
89
|
},
|
|
89
90
|
"dependencies": {
|
|
91
|
+
"@inquirer/prompts": "^8.4.3",
|
|
90
92
|
"cli-table3": "^0.6.5",
|
|
91
93
|
"commander": "13.0.0",
|
|
92
94
|
"lru-cache": "^11.4.0",
|
|
@@ -107,7 +109,6 @@
|
|
|
107
109
|
"@cucumber/messages": "^34.2.1",
|
|
108
110
|
"@eslint/js": "^9.39.4",
|
|
109
111
|
"@happy-dom/global-registrator": "^20.10.6",
|
|
110
|
-
"@inquirer/prompts": "^8.4.3",
|
|
111
112
|
"@testing-library/react": "^16.3.2",
|
|
112
113
|
"@types/bun": "latest",
|
|
113
114
|
"@types/pg": "^8.20.0",
|
|
@@ -605,4 +605,4 @@ schema. Raw `query` / `export` invocations render a sortable table only.
|
|
|
605
605
|
- Blacklisted tables and columns are redacted from query output.
|
|
606
606
|
- `schema` reports `estimatedRowCount` and `sizeCategory` (small / medium / large / huge). For large/huge tables add `WHERE` or `LIMIT` — bands in [reference.md](reference.md#schema).
|
|
607
607
|
- `doctor` on `mongodb+srv://` reports whether SRV resolves natively or through the DoH fallback — useful when the runtime restricts DNS.
|
|
608
|
-
- **Global flags:** `--version`, `--config <path>`, `--global`, `--use <name>`, `--timeout <ms>`, `-v` / `--verbose` / `-vv`, `-q` / `--quiet`, `--no-color` (also honours `NO_COLOR`). Root-level flags must precede the command unless the command explicitly declares a command-level option.
|
|
608
|
+
- **Global flags:** `--version`, `--config <path>`, `--global`, `--use <name>`, `--timeout <ms>`, `--statement-timeout <ms>`, `-v` / `--verbose` / `-vv`, `-q` / `--quiet`, `--no-color` (also honours `NO_COLOR`). Root-level flags must precede the command unless the command explicitly declares a command-level option.
|
|
@@ -83,13 +83,16 @@ command-level option is only valid after the command that declares it.
|
|
|
83
83
|
| `--global` | Select the user-global registry at `~/.config/dbcli/config.json` instead of the current project's `.dbcli` config. Place it before the command path. |
|
|
84
84
|
| `--use <connection>` | Select a named connection for this invocation; place it before the command path unless that command explicitly lists a command-level `--use`. |
|
|
85
85
|
| `--timeout <ms>` | Connection timeout in milliseconds (integer, 100–600000), overriding the connection config's `timeout` field for this invocation. Applies to every engine adapter. Without either the flag or the config field, adapters fall back to their built-in 5000ms default. |
|
|
86
|
+
| `--statement-timeout <ms>` | How long a single statement may run, in milliseconds (integer, 0–3600000; `0` removes the limit), overriding the connection config's `statementTimeout` field. Independent of the connection timeout — raising it does not slow down detection of an unreachable host. Falls back to `--timeout` when unset, and to the server's own setting when neither is given. |
|
|
86
87
|
|
|
87
88
|
`--timeout` is applied only when the adapter is constructed for this invocation — it is
|
|
88
89
|
never written back to `config.json`. Set the connection's `timeout` field instead for a
|
|
89
|
-
value that persists across runs.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
value that persists across runs. `--timeout` caps statement time as well as connection time, so a
|
|
91
|
+
low value cuts off a long-running query with an error that reads like a connection
|
|
92
|
+
problem; the 100ms floor exists specifically to keep that failure mode from being too
|
|
93
|
+
easy to trigger. Use `--statement-timeout` when only the statement limit should change.
|
|
94
|
+
With neither flag, dbcli sets no statement limit at all — the server's setting decides,
|
|
95
|
+
so a query that runs longer than the connection timeout is no longer cut off.
|
|
93
96
|
Elasticsearch applies its timeout per request rather than once for the whole connection.
|
|
94
97
|
The `timeout` field itself always takes a literal number — unlike other connection
|
|
95
98
|
fields, it does not accept an `{"$env": "..."}` reference.
|
|
@@ -220,8 +223,8 @@ dbcli list --include-system # Elasticsearch: include `.system` indices
|
|
|
220
223
|
**Permission:** query-only+
|
|
221
224
|
|
|
222
225
|
> **MongoDB:** Lists collections with estimated document count.
|
|
223
|
-
> **Redis:**
|
|
224
|
-
> **Elasticsearch:** Returns indices with `documentCount` from `/
|
|
226
|
+
> **Redis:** Samples the first 1 000 keys scanned via `SCAN MATCH * COUNT 1000`, applying the blacklist during the scan. When the keyspace is larger, table output adds a `Sampled the first 1000 keys scanned` line and JSON output carries `sampled: true` with `sampleLimit`. The header reads `Keys in db <n> (redis):` where `<n>` is the logical DB index.
|
|
227
|
+
> **Elasticsearch:** Returns indices with `documentCount` from one `/_cat/indices?h=index,docs.count&expand_wildcards=all` request (open and closed indices alike). The count is primaries-only, so a replicated index no longer reports its replica copies as extra documents. Aliases are tagged separately. System indices (names starting with `.`) are hidden unless `--include-system` is passed.
|
|
225
228
|
|
|
226
229
|
### schema
|
|
227
230
|
|
|
@@ -243,6 +246,13 @@ dbcli schema --use prod # Scan prod DB; saves to .dbcli/schemas/prod
|
|
|
243
246
|
**Options:** `--format <table|json>`, `--refresh`, `--reset`, `--force`, `--use <connection>`, `--sample-size <n>` (mongo only), `--sample-method <random|natural>` (mongo only)
|
|
244
247
|
**Permission:** query-only+
|
|
245
248
|
|
|
249
|
+
> **Row counts on a full scan:** scanning every table records
|
|
250
|
+
> `rowCountIsEstimate: true` and reports the engine's row *estimate* (`information_schema.TABLES.TABLE_ROWS` on MySQL/MariaDB,
|
|
251
|
+
> `pg_class.reltuples` on PostgreSQL) rather than running `COUNT(*)` per table —
|
|
252
|
+
> a hundred full-table counts is what made scanning a large database unusable.
|
|
253
|
+
> `dbcli schema <table>` on a single table still reports the exact count. Tables
|
|
254
|
+
> are scanned with bounded parallelism (4 at a time).
|
|
255
|
+
|
|
246
256
|
**Schema storage (v1.4+):** Schema is persisted as layered files under `.dbcli/schemas/`. With v2 multi-connection config each connection gets its own subdirectory (`.dbcli/schemas/<connection>/`). Run `dbcli schema --use <connection>` once per connection before querying it — otherwise `schema <table>` may return data from the wrong connection's cache.
|
|
247
257
|
|
|
248
258
|
> **PostgreSQL:** Introspection uses the exact `public` catalog identity throughout. Full catalog/schema/table joins prevent a reused constraint name from contaminating another table; enum lookup includes its namespace; composite primary-key order comes from the exact table OID and index ordinality; and row estimates are scoped to the exact `public` relation. Row-count SQL qualifies and quotes both `"public"` and the exact table identifier, escaping embedded quotes so mixed-case or punctuation-bearing names remain distinct and safe.
|
|
@@ -286,6 +296,12 @@ dbcli query "SELECT * FROM orders" --format html > orders.html # pipe to stdou
|
|
|
286
296
|
**Options:** `--format <table|json|csv|html>`, `--ui` (open the dashboard in the system browser; implies `--format html`), `--limit <number>`, `--no-limit`, `--collection <name>` (MongoDB / Elasticsearch), `--index <name>` (Elasticsearch alias for `--collection`), `--fields <list>`, `--truncate <number>` / `--no-truncate`, `-f, --query-file <path>`, `--use <name[,name]>`, `--slow-ms <number>`, `--recovery`
|
|
287
297
|
**Permission:** query-only+ (Redis: per-command; Elasticsearch: per HTTP method/path)
|
|
288
298
|
|
|
299
|
+
> **Server-side scripts are rejected on every path.** MongoDB `$where`,
|
|
300
|
+
> `$function`, and `$accumulator`, and Elasticsearch `script` / `script_fields`,
|
|
301
|
+
> execute code on the database server. The adapters reject them anywhere in a
|
|
302
|
+
> filter, pipeline, or DSL body — before the request is sent — so `query`, `q`,
|
|
303
|
+
> saved snippets, and DML planning all behave the same way.
|
|
304
|
+
|
|
289
305
|
#### Passive slow-query hint (`--slow-ms`)
|
|
290
306
|
|
|
291
307
|
`query` and `q` read the execution time they already measured for a finished
|
package/skills/dbcli/SKILL.md
CHANGED
|
@@ -605,4 +605,4 @@ schema. Raw `query` / `export` invocations render a sortable table only.
|
|
|
605
605
|
- Blacklisted tables and columns are redacted from query output.
|
|
606
606
|
- `schema` reports `estimatedRowCount` and `sizeCategory` (small / medium / large / huge). For large/huge tables add `WHERE` or `LIMIT` — bands in [reference.md](reference.md#schema).
|
|
607
607
|
- `doctor` on `mongodb+srv://` reports whether SRV resolves natively or through the DoH fallback — useful when the runtime restricts DNS.
|
|
608
|
-
- **Global flags:** `--version`, `--config <path>`, `--global`, `--use <name>`, `--timeout <ms>`, `-v` / `--verbose` / `-vv`, `-q` / `--quiet`, `--no-color` (also honours `NO_COLOR`). Root-level flags must precede the command unless the command explicitly declares a command-level option.
|
|
608
|
+
- **Global flags:** `--version`, `--config <path>`, `--global`, `--use <name>`, `--timeout <ms>`, `--statement-timeout <ms>`, `-v` / `--verbose` / `-vv`, `-q` / `--quiet`, `--no-color` (also honours `NO_COLOR`). Root-level flags must precede the command unless the command explicitly declares a command-level option.
|
|
@@ -83,13 +83,16 @@ command-level option is only valid after the command that declares it.
|
|
|
83
83
|
| `--global` | Select the user-global registry at `~/.config/dbcli/config.json` instead of the current project's `.dbcli` config. Place it before the command path. |
|
|
84
84
|
| `--use <connection>` | Select a named connection for this invocation; place it before the command path unless that command explicitly lists a command-level `--use`. |
|
|
85
85
|
| `--timeout <ms>` | Connection timeout in milliseconds (integer, 100–600000), overriding the connection config's `timeout` field for this invocation. Applies to every engine adapter. Without either the flag or the config field, adapters fall back to their built-in 5000ms default. |
|
|
86
|
+
| `--statement-timeout <ms>` | How long a single statement may run, in milliseconds (integer, 0–3600000; `0` removes the limit), overriding the connection config's `statementTimeout` field. Independent of the connection timeout — raising it does not slow down detection of an unreachable host. Falls back to `--timeout` when unset, and to the server's own setting when neither is given. |
|
|
86
87
|
|
|
87
88
|
`--timeout` is applied only when the adapter is constructed for this invocation — it is
|
|
88
89
|
never written back to `config.json`. Set the connection's `timeout` field instead for a
|
|
89
|
-
value that persists across runs.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
value that persists across runs. `--timeout` caps statement time as well as connection time, so a
|
|
91
|
+
low value cuts off a long-running query with an error that reads like a connection
|
|
92
|
+
problem; the 100ms floor exists specifically to keep that failure mode from being too
|
|
93
|
+
easy to trigger. Use `--statement-timeout` when only the statement limit should change.
|
|
94
|
+
With neither flag, dbcli sets no statement limit at all — the server's setting decides,
|
|
95
|
+
so a query that runs longer than the connection timeout is no longer cut off.
|
|
93
96
|
Elasticsearch applies its timeout per request rather than once for the whole connection.
|
|
94
97
|
The `timeout` field itself always takes a literal number — unlike other connection
|
|
95
98
|
fields, it does not accept an `{"$env": "..."}` reference.
|
|
@@ -220,8 +223,8 @@ dbcli list --include-system # Elasticsearch: include `.system` indices
|
|
|
220
223
|
**Permission:** query-only+
|
|
221
224
|
|
|
222
225
|
> **MongoDB:** Lists collections with estimated document count.
|
|
223
|
-
> **Redis:**
|
|
224
|
-
> **Elasticsearch:** Returns indices with `documentCount` from `/
|
|
226
|
+
> **Redis:** Samples the first 1 000 keys scanned via `SCAN MATCH * COUNT 1000`, applying the blacklist during the scan. When the keyspace is larger, table output adds a `Sampled the first 1000 keys scanned` line and JSON output carries `sampled: true` with `sampleLimit`. The header reads `Keys in db <n> (redis):` where `<n>` is the logical DB index.
|
|
227
|
+
> **Elasticsearch:** Returns indices with `documentCount` from one `/_cat/indices?h=index,docs.count&expand_wildcards=all` request (open and closed indices alike). The count is primaries-only, so a replicated index no longer reports its replica copies as extra documents. Aliases are tagged separately. System indices (names starting with `.`) are hidden unless `--include-system` is passed.
|
|
225
228
|
|
|
226
229
|
### schema
|
|
227
230
|
|
|
@@ -243,6 +246,13 @@ dbcli schema --use prod # Scan prod DB; saves to .dbcli/schemas/prod
|
|
|
243
246
|
**Options:** `--format <table|json>`, `--refresh`, `--reset`, `--force`, `--use <connection>`, `--sample-size <n>` (mongo only), `--sample-method <random|natural>` (mongo only)
|
|
244
247
|
**Permission:** query-only+
|
|
245
248
|
|
|
249
|
+
> **Row counts on a full scan:** scanning every table records
|
|
250
|
+
> `rowCountIsEstimate: true` and reports the engine's row *estimate* (`information_schema.TABLES.TABLE_ROWS` on MySQL/MariaDB,
|
|
251
|
+
> `pg_class.reltuples` on PostgreSQL) rather than running `COUNT(*)` per table —
|
|
252
|
+
> a hundred full-table counts is what made scanning a large database unusable.
|
|
253
|
+
> `dbcli schema <table>` on a single table still reports the exact count. Tables
|
|
254
|
+
> are scanned with bounded parallelism (4 at a time).
|
|
255
|
+
|
|
246
256
|
**Schema storage (v1.4+):** Schema is persisted as layered files under `.dbcli/schemas/`. With v2 multi-connection config each connection gets its own subdirectory (`.dbcli/schemas/<connection>/`). Run `dbcli schema --use <connection>` once per connection before querying it — otherwise `schema <table>` may return data from the wrong connection's cache.
|
|
247
257
|
|
|
248
258
|
> **PostgreSQL:** Introspection uses the exact `public` catalog identity throughout. Full catalog/schema/table joins prevent a reused constraint name from contaminating another table; enum lookup includes its namespace; composite primary-key order comes from the exact table OID and index ordinality; and row estimates are scoped to the exact `public` relation. Row-count SQL qualifies and quotes both `"public"` and the exact table identifier, escaping embedded quotes so mixed-case or punctuation-bearing names remain distinct and safe.
|
|
@@ -286,6 +296,12 @@ dbcli query "SELECT * FROM orders" --format html > orders.html # pipe to stdou
|
|
|
286
296
|
**Options:** `--format <table|json|csv|html>`, `--ui` (open the dashboard in the system browser; implies `--format html`), `--limit <number>`, `--no-limit`, `--collection <name>` (MongoDB / Elasticsearch), `--index <name>` (Elasticsearch alias for `--collection`), `--fields <list>`, `--truncate <number>` / `--no-truncate`, `-f, --query-file <path>`, `--use <name[,name]>`, `--slow-ms <number>`, `--recovery`
|
|
287
297
|
**Permission:** query-only+ (Redis: per-command; Elasticsearch: per HTTP method/path)
|
|
288
298
|
|
|
299
|
+
> **Server-side scripts are rejected on every path.** MongoDB `$where`,
|
|
300
|
+
> `$function`, and `$accumulator`, and Elasticsearch `script` / `script_fields`,
|
|
301
|
+
> execute code on the database server. The adapters reject them anywhere in a
|
|
302
|
+
> filter, pipeline, or DSL body — before the request is sent — so `query`, `q`,
|
|
303
|
+
> saved snippets, and DML planning all behave the same way.
|
|
304
|
+
|
|
289
305
|
#### Passive slow-query hint (`--slow-ms`)
|
|
290
306
|
|
|
291
307
|
`query` and `q` read the execution time they already measured for a finished
|