@carllee1983/dbcli 1.57.0 → 1.58.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 +7 -2
- package/.cursor/skills/dbcli/reference.md +12 -3
- package/.github/skills/dbcli/SKILL.md +7 -2
- package/.github/skills/dbcli/reference.md +12 -3
- package/CHANGELOG.md +40 -0
- package/assets/SKILL.md +7 -2
- package/assets/SKILL.zh-TW.md +4 -1
- package/assets/reference.md +12 -3
- package/dist/cli-runtime.mjs +817 -575
- package/dist/cli.mjs +4 -2
- package/dist/core.d.ts +79 -24
- package/dist/core.mjs +315 -343
- package/package.json +4 -2
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +7 -2
- package/plugins/dbcli-agent/skills/dbcli/reference.md +12 -3
- package/skills/dbcli/SKILL.md +7 -2
- package/skills/dbcli/reference.md +12 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carllee1983/dbcli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.0",
|
|
4
4
|
"description": "Database CLI for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -74,12 +74,14 @@
|
|
|
74
74
|
"test:unit": "bun test tests/unit tests/core",
|
|
75
75
|
"test:integration": "bun test tests/integration",
|
|
76
76
|
"test:gherkin": "bun test tests/gherkin",
|
|
77
|
-
"test:docker": "docker compose -f docker-compose.test.yml up -d --wait && bun test tests/integration
|
|
77
|
+
"test:docker": "docker compose -f docker-compose.test.yml up -d --wait && bun test tests/integration; docker compose -f docker-compose.test.yml down",
|
|
78
|
+
"services:check": "bun run scripts/check-test-services.ts",
|
|
78
79
|
"docs:check": "bun run scripts/check-user-docs.ts",
|
|
79
80
|
"contract:check": "bun run scripts/check-cli-contract.ts",
|
|
80
81
|
"skill:check": "bun run scripts/check-skill-parity.ts",
|
|
81
82
|
"platform:check": "bun run scripts/check-platform-parity.ts",
|
|
82
83
|
"agent-core:check": "bun run scripts/check-agent-core-purity.ts",
|
|
84
|
+
"core-stdout:check": "bun run scripts/check-core-no-stdout.ts",
|
|
83
85
|
"typecheck": "tsc --noEmit --pretty false",
|
|
84
86
|
"test:perf": "bun test ./tests/perf/*.bench.ts",
|
|
85
87
|
"lint": "eslint src tests scripts --ext .ts --max-warnings=0",
|
|
@@ -449,8 +449,13 @@ changing the default. `--recovery` is honoured by `query`, `q`, `insert`, `updat
|
|
|
449
449
|
(no `>=`, `!=`, `LIKE`, `OR`). MongoDB `--where` takes a full JSON filter
|
|
450
450
|
(`'{"status":"pending"}'`), falling back to `col=val` when it is not valid JSON.
|
|
451
451
|
- `--dry-run` prints the parameterized SQL (with `$1` / `?` placeholders, not real values)
|
|
452
|
-
and `rows_affected: 0
|
|
453
|
-
intended `--where` / `--set`.
|
|
452
|
+
and `status:"dry_run"` with `rows_affected: 0` — never `success`, which now means the
|
|
453
|
+
write really ran. Proceed once the SQL shape matches the intended `--where` / `--set`.
|
|
454
|
+
Declining at the confirmation prompt reports `status:"cancelled"`, also not `success`.
|
|
455
|
+
MongoDB prints a shell-style preview.
|
|
456
|
+
- `--force` skips the confirmation prompt. Every `insert` / `update` / `delete` asks
|
|
457
|
+
first — SQL, MongoDB and Redis alike — and a non-interactive run cannot answer, so an
|
|
458
|
+
unattended write without `--force` ends as `status:"cancelled"` having changed nothing.
|
|
454
459
|
- `--recovery` is recommended for automated agent pipelines (enables `dbcli recover --apply`
|
|
455
460
|
after a failure); optional for one-off manual writes.
|
|
456
461
|
|
|
@@ -337,6 +337,13 @@ dbcli query "SELECT * FROM orders" --format html > orders.html # pipe to stdou
|
|
|
337
337
|
**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`
|
|
338
338
|
**Permission:** query-only+ (Redis: per-command; Elasticsearch: per HTTP method/path)
|
|
339
339
|
|
|
340
|
+
> **Elasticsearch tiers by scope.** A read (`GET` / `HEAD`, plus `POST _search` and
|
|
341
|
+
> `POST _count`) is query-only. Indexing or updating a document is read-write.
|
|
342
|
+
> `DELETE /<index>/_doc/<id>` — one document — is data-admin. Everything that removes or
|
|
343
|
+
> reshapes a container is **admin**: `DELETE /<index>`, a wildcard or `_all` delete,
|
|
344
|
+
> templates and aliases, and `PUT` against `_mapping` or `_settings`. A request whose
|
|
345
|
+
> scope cannot be established is treated as admin rather than guessed downward.
|
|
346
|
+
|
|
340
347
|
> **Server-side scripts are rejected on every path.** MongoDB `$where`,
|
|
341
348
|
> `$function`, and `$accumulator`, and Elasticsearch `script` / `script_fields`,
|
|
342
349
|
> execute code on the database server. The adapters reject them anywhere in a
|
|
@@ -925,7 +932,7 @@ dbcli insert users --data '{"name":"Alice"}' --force
|
|
|
925
932
|
dbcli insert users --data '{"name":"Alice"}' --plan --format json # risk analysis only; no DB connection
|
|
926
933
|
```
|
|
927
934
|
|
|
928
|
-
**Options:** `--data <json>`, `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output), `--recovery`
|
|
935
|
+
**Options:** `--data <json>`, `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output; `json` also keeps the result envelope instead of prose in a terminal), `--recovery`
|
|
929
936
|
**Permission:** read-write+
|
|
930
937
|
|
|
931
938
|
### update
|
|
@@ -938,7 +945,7 @@ dbcli update users --where "id=1" --set '{"name":"Bob"}' --dry-run
|
|
|
938
945
|
dbcli update users --where "id=1" --set '{"name":"Bob"}' --plan --format json # risk analysis only; no DB connection
|
|
939
946
|
```
|
|
940
947
|
|
|
941
|
-
**Options:** `--where <condition>` (required), `--set <json>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output), `--recovery`
|
|
948
|
+
**Options:** `--where <condition>` (required), `--set <json>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output; `json` also keeps the result envelope instead of prose in a terminal), `--recovery`
|
|
942
949
|
**Permission:** read-write+
|
|
943
950
|
|
|
944
951
|
> **`--where` grammar (SQL `update` / `delete`)** — equality only: `col=val` or
|
|
@@ -959,7 +966,7 @@ dbcli delete users --where "id=1" --force
|
|
|
959
966
|
dbcli delete users --where "id=1" --plan --format json # risk analysis only; no DB connection
|
|
960
967
|
```
|
|
961
968
|
|
|
962
|
-
**Options:** `--where <condition>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output), `--recovery`
|
|
969
|
+
**Options:** `--where <condition>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output; `json` also keeps the result envelope instead of prose in a terminal), `--recovery`
|
|
963
970
|
**Permission:** data-admin+
|
|
964
971
|
|
|
965
972
|
### export
|
|
@@ -2540,6 +2547,8 @@ dbcli migrate add-enum status active inactive suspended
|
|
|
2540
2547
|
dbcli migrate alter-enum status --add-value archived
|
|
2541
2548
|
dbcli migrate drop-enum status --execute --force
|
|
2542
2549
|
```
|
|
2550
|
+
A destructive `migrate` action (`drop`, `drop-column`, `drop-index`, `drop-enum`) asks for confirmation on stderr before it runs, and reports `status: "cancelled"` if you decline — not `success`, which it used to claim with the cancellation buried in `warnings`. `--force` skips the question; a non-interactive run that omits it cannot answer and therefore cancels.
|
|
2551
|
+
|
|
2543
2552
|
|
|
2544
2553
|
**Column spec format:** `name:type[:modifier[:modifier...]]`
|
|
2545
2554
|
- Modifiers: `pk`, `not-null`, `unique`, `auto-increment`, `default=<value>`, `references=<table>.<column>`
|
package/skills/dbcli/SKILL.md
CHANGED
|
@@ -449,8 +449,13 @@ changing the default. `--recovery` is honoured by `query`, `q`, `insert`, `updat
|
|
|
449
449
|
(no `>=`, `!=`, `LIKE`, `OR`). MongoDB `--where` takes a full JSON filter
|
|
450
450
|
(`'{"status":"pending"}'`), falling back to `col=val` when it is not valid JSON.
|
|
451
451
|
- `--dry-run` prints the parameterized SQL (with `$1` / `?` placeholders, not real values)
|
|
452
|
-
and `rows_affected: 0
|
|
453
|
-
intended `--where` / `--set`.
|
|
452
|
+
and `status:"dry_run"` with `rows_affected: 0` — never `success`, which now means the
|
|
453
|
+
write really ran. Proceed once the SQL shape matches the intended `--where` / `--set`.
|
|
454
|
+
Declining at the confirmation prompt reports `status:"cancelled"`, also not `success`.
|
|
455
|
+
MongoDB prints a shell-style preview.
|
|
456
|
+
- `--force` skips the confirmation prompt. Every `insert` / `update` / `delete` asks
|
|
457
|
+
first — SQL, MongoDB and Redis alike — and a non-interactive run cannot answer, so an
|
|
458
|
+
unattended write without `--force` ends as `status:"cancelled"` having changed nothing.
|
|
454
459
|
- `--recovery` is recommended for automated agent pipelines (enables `dbcli recover --apply`
|
|
455
460
|
after a failure); optional for one-off manual writes.
|
|
456
461
|
|
|
@@ -337,6 +337,13 @@ dbcli query "SELECT * FROM orders" --format html > orders.html # pipe to stdou
|
|
|
337
337
|
**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`
|
|
338
338
|
**Permission:** query-only+ (Redis: per-command; Elasticsearch: per HTTP method/path)
|
|
339
339
|
|
|
340
|
+
> **Elasticsearch tiers by scope.** A read (`GET` / `HEAD`, plus `POST _search` and
|
|
341
|
+
> `POST _count`) is query-only. Indexing or updating a document is read-write.
|
|
342
|
+
> `DELETE /<index>/_doc/<id>` — one document — is data-admin. Everything that removes or
|
|
343
|
+
> reshapes a container is **admin**: `DELETE /<index>`, a wildcard or `_all` delete,
|
|
344
|
+
> templates and aliases, and `PUT` against `_mapping` or `_settings`. A request whose
|
|
345
|
+
> scope cannot be established is treated as admin rather than guessed downward.
|
|
346
|
+
|
|
340
347
|
> **Server-side scripts are rejected on every path.** MongoDB `$where`,
|
|
341
348
|
> `$function`, and `$accumulator`, and Elasticsearch `script` / `script_fields`,
|
|
342
349
|
> execute code on the database server. The adapters reject them anywhere in a
|
|
@@ -925,7 +932,7 @@ dbcli insert users --data '{"name":"Alice"}' --force
|
|
|
925
932
|
dbcli insert users --data '{"name":"Alice"}' --plan --format json # risk analysis only; no DB connection
|
|
926
933
|
```
|
|
927
934
|
|
|
928
|
-
**Options:** `--data <json>`, `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output), `--recovery`
|
|
935
|
+
**Options:** `--data <json>`, `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output; `json` also keeps the result envelope instead of prose in a terminal), `--recovery`
|
|
929
936
|
**Permission:** read-write+
|
|
930
937
|
|
|
931
938
|
### update
|
|
@@ -938,7 +945,7 @@ dbcli update users --where "id=1" --set '{"name":"Bob"}' --dry-run
|
|
|
938
945
|
dbcli update users --where "id=1" --set '{"name":"Bob"}' --plan --format json # risk analysis only; no DB connection
|
|
939
946
|
```
|
|
940
947
|
|
|
941
|
-
**Options:** `--where <condition>` (required), `--set <json>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output), `--recovery`
|
|
948
|
+
**Options:** `--where <condition>` (required), `--set <json>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output; `json` also keeps the result envelope instead of prose in a terminal), `--recovery`
|
|
942
949
|
**Permission:** read-write+
|
|
943
950
|
|
|
944
951
|
> **`--where` grammar (SQL `update` / `delete`)** — equality only: `col=val` or
|
|
@@ -959,7 +966,7 @@ dbcli delete users --where "id=1" --force
|
|
|
959
966
|
dbcli delete users --where "id=1" --plan --format json # risk analysis only; no DB connection
|
|
960
967
|
```
|
|
961
968
|
|
|
962
|
-
**Options:** `--where <condition>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output), `--recovery`
|
|
969
|
+
**Options:** `--where <condition>` (required), `--dry-run`, `--force`, `--plan` (analyze risk without connecting or executing), `--format <text|json>` (`--plan` output; `json` also keeps the result envelope instead of prose in a terminal), `--recovery`
|
|
963
970
|
**Permission:** data-admin+
|
|
964
971
|
|
|
965
972
|
### export
|
|
@@ -2540,6 +2547,8 @@ dbcli migrate add-enum status active inactive suspended
|
|
|
2540
2547
|
dbcli migrate alter-enum status --add-value archived
|
|
2541
2548
|
dbcli migrate drop-enum status --execute --force
|
|
2542
2549
|
```
|
|
2550
|
+
A destructive `migrate` action (`drop`, `drop-column`, `drop-index`, `drop-enum`) asks for confirmation on stderr before it runs, and reports `status: "cancelled"` if you decline — not `success`, which it used to claim with the cancellation buried in `warnings`. `--force` skips the question; a non-interactive run that omits it cannot answer and therefore cancels.
|
|
2551
|
+
|
|
2543
2552
|
|
|
2544
2553
|
**Column spec format:** `name:type[:modifier[:modifier...]]`
|
|
2545
2554
|
- Modifiers: `pk`, `not-null`, `unique`, `auto-increment`, `default=<value>`, `references=<table>.<column>`
|