@carllee1983/dbcli 1.51.2 → 1.52.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 +34 -27
- package/.cursor/skills/dbcli/reference.md +290 -16
- package/.github/skills/dbcli/SKILL.md +31 -24
- package/.github/skills/dbcli/reference.md +290 -16
- package/CHANGELOG.md +37 -0
- package/README.md +1 -0
- package/README.zh-TW.md +1 -0
- package/assets/SKILL.md +31 -24
- package/assets/SKILL.zh-TW.md +44 -29
- package/assets/reference.md +290 -16
- package/assets/tasks/design-review.md +42 -0
- package/dist/cli-runtime.mjs +109629 -0
- package/dist/cli.mjs +140 -108817
- package/dist/core.d.ts +8 -0
- package/package.json +4 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +31 -24
- package/plugins/dbcli-agent/skills/dbcli/reference.md +290 -16
- package/skills/dbcli/SKILL.md +31 -24
- package/skills/dbcli/reference.md +290 -16
package/dist/core.d.ts
CHANGED
|
@@ -517,6 +517,12 @@ interface AppliedLimitMetadata {
|
|
|
517
517
|
limitApplied: number;
|
|
518
518
|
}
|
|
519
519
|
type SqlStatementType = "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "UNKNOWN";
|
|
520
|
+
interface PerformanceAdvisory {
|
|
521
|
+
code: "SLOW_QUERY";
|
|
522
|
+
executionTimeMs: number;
|
|
523
|
+
thresholdMs: number;
|
|
524
|
+
recommendation: string;
|
|
525
|
+
}
|
|
520
526
|
interface QueryMetadata {
|
|
521
527
|
/** SQL statement type (SELECT, INSERT, UPDATE, DELETE) */
|
|
522
528
|
statement: SqlStatementType;
|
|
@@ -526,6 +532,8 @@ interface QueryMetadata {
|
|
|
526
532
|
executionTimeMs?: number;
|
|
527
533
|
/** Security notification when columns were omitted due to blacklist */
|
|
528
534
|
securityNotification?: string;
|
|
535
|
+
/** Passive suggestion derived from already-measured execution time. */
|
|
536
|
+
performanceAdvisory?: PerformanceAdvisory;
|
|
529
537
|
}
|
|
530
538
|
/**
|
|
531
539
|
* Generic query result wrapper with rows and metadata
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carllee1983/dbcli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.52.1",
|
|
4
4
|
"description": "Database CLI for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"test": "bun test --timeout 30000",
|
|
73
73
|
"test:unit": "bun test tests/unit tests/core",
|
|
74
74
|
"test:integration": "bun test tests/integration",
|
|
75
|
+
"test:gherkin": "bun test tests/gherkin",
|
|
75
76
|
"test:docker": "docker compose -f docker-compose.test.yml up -d --wait && bun test tests/integration/adapters; docker compose -f docker-compose.test.yml down",
|
|
76
77
|
"docs:check": "bun run scripts/check-user-docs.ts",
|
|
77
78
|
"contract:check": "bun run scripts/check-cli-contract.ts",
|
|
@@ -102,6 +103,8 @@
|
|
|
102
103
|
"zod": "^3.25.76"
|
|
103
104
|
},
|
|
104
105
|
"devDependencies": {
|
|
106
|
+
"@cucumber/gherkin": "^42.0.1",
|
|
107
|
+
"@cucumber/messages": "^34.2.1",
|
|
105
108
|
"@eslint/js": "^9.39.4",
|
|
106
109
|
"@happy-dom/global-registrator": "^20.10.6",
|
|
107
110
|
"@inquirer/prompts": "^8.4.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dbcli
|
|
3
|
-
description: Database CLI for AI agents with permission-
|
|
3
|
+
description: Database CLI for AI agents with permission-gated access to MySQL, PostgreSQL, MariaDB, MongoDB, Redis, and Elasticsearch. Trigger when: wiring up a connection (`.dbcli` / `.env`, v1 single vs v2 multi-connection, auth mode); running SQL / MongoDB JSON / Redis commands / Elasticsearch DSL; inspecting table, collection, key, or index structure; writing rows or exporting results; building a report, dashboard, or HTML UI; authoring or reviewing a schema design; protecting sensitive data with the blacklist; or recovering after a failed command. For exhaustive flags and examples, read the sibling `reference.md`.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dbcli
|
|
@@ -71,7 +71,7 @@ afterwards add only the `@diag/*` it does not cover (`missing-indexes`, `locks`,
|
|
|
71
71
|
`export` / `schema` / `inspect` / `lint` / `diff --against-orm`. The command emits a `RecoveryEnvelope` to stdout and saves
|
|
72
72
|
it to `.dbcli/last-recovery.json`; then `dbcli recover` inspects it and `dbcli recover --apply`
|
|
73
73
|
runs the saved plan under risk gating. Multi-turn `--next`, connection branching, and the
|
|
74
|
-
post-apply verify probe are documented in reference.md
|
|
74
|
+
post-apply verify probe are documented in [reference.md](reference.md#recovery-cookbook-agent-walkthroughs).
|
|
75
75
|
|
|
76
76
|
When reporting a check's outcome use the vocabulary `verified` (evidence matched) /
|
|
77
77
|
`not_verified` (check ran and contradicted) / `indeterminate` (ran but ambiguous) /
|
|
@@ -157,6 +157,8 @@ in **How to use dbcli** still applies.
|
|
|
157
157
|
| DB report / dashboard request | `blacklist list` → `queries search <keywords>` / `queries suggest <intent>` → `queries show @<name>` → `q @<name> --ui` or `--format html` |
|
|
158
158
|
| Application data bug | `audit tail --for-agent --n 10` → `blacklist list` → `schema <object>` → narrow query |
|
|
159
159
|
| ORM or migration work | `schema --format json` → `diff --against-orm <orm-schema>` → review error-level drift → proposals via `migrate` (dry-run) → `migration-review` task pack → `diff --against <snapshot>` after applying. |
|
|
160
|
+
| Schema design, no database yet | `design init --output ./dbcli.design.json` → edit → `design validate` → `design render --format mermaid`. With existing ORM models, reconcile via `design diff --against-orm <path>` first. |
|
|
161
|
+
| Design drift on a live database | `blacklist list` → `schema --format json` → `design diff --against-cache` → `design propose --against-cache`, then hand the plan to a human before any migration. |
|
|
160
162
|
| PR database review | Review changed persistence paths, then propose concrete `schema` / `plan` / `dry-run` / `report` / `guide` commands per material claim. |
|
|
161
163
|
| Slow endpoint or query | `report --section perf` → task pack `analyze-table-perf` → `lint "<query>"` → `guide missing-index-for "<query>"`; use `proxy analyze` when logs exist. |
|
|
162
164
|
| Safe data backfill | `blacklist list` → `schema <object>` → count/scope query → `update … --dry-run` → read-back or snippet `--verify`. |
|
|
@@ -193,12 +195,14 @@ Guardrails:
|
|
|
193
195
|
- Separate database facts from application-code inference. Report which dbcli output shaped the conclusion.
|
|
194
196
|
- For writes and backfills, include scope count, dry-run preview, execution command, and read-back.
|
|
195
197
|
- Do not create indexes directly from a performance suggestion; turn them into reviewed migrations.
|
|
198
|
+
- Do not execute the `commands` in a `design propose` plan, and do not create or rewrite
|
|
199
|
+
`dbcli.design.json` unless a human asked for it.
|
|
196
200
|
- Do not print credentials, copied connection strings, or blacklisted values.
|
|
197
201
|
- Durable evidence: `assert … --write-verification-artifact --verification-subject <kind:name>`;
|
|
198
202
|
inspect with `verification summary` / `list` / `show <id>`. The `verify safe-backfill` /
|
|
199
203
|
`migration` / `rollback --kind <ddl|dml>` / `constraint --check <fk|not-null|unique|custom>`
|
|
200
204
|
family runs preflight + `--after-write` checks and **never executes the write**. Full flags
|
|
201
|
-
and the per-command blocks are in reference.md.
|
|
205
|
+
and the per-command blocks are in [reference.md](reference.md#commands).
|
|
202
206
|
|
|
203
207
|
## Audit log
|
|
204
208
|
|
|
@@ -215,7 +219,7 @@ The `inspect` / `guide` / `recover` agent JSON embeds `audit_recent` (last 5 ent
|
|
|
215
219
|
fresh session has immediate history. An envelope's `audit_ref` and an audit entry's
|
|
216
220
|
`recovery_ref` point at each other, so you can pivot either way. Audit is on by default
|
|
217
221
|
(`audit.enabled = false` to opt out); entries are metadata-only (never SQL bodies, `--param`
|
|
218
|
-
values, or result cells) and rotate at ~10 MB / 1000 entries. Full flags: reference.md
|
|
222
|
+
values, or result cells) and rotate at ~10 MB / 1000 entries. Full flags: [reference.md](reference.md#audit).
|
|
219
223
|
|
|
220
224
|
## Quick start
|
|
221
225
|
|
|
@@ -371,7 +375,7 @@ refs have no value to connect with yet.
|
|
|
371
375
|
- **Re-running `init`** — refuses to overwrite without `--force`; never use
|
|
372
376
|
`--force` to "fix" a config full of `{ "$env": "..." }` refs.
|
|
373
377
|
|
|
374
|
-
Full flags and edge cases: see [reference.md](reference.md)
|
|
378
|
+
Full flags and edge cases: see [reference.md](reference.md#init).
|
|
375
379
|
|
|
376
380
|
## Command overview
|
|
377
381
|
|
|
@@ -381,33 +385,34 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
381
385
|
| `use` | n/a | Show/switch default named connection (v2 only). |
|
|
382
386
|
| `list` | query-only+ | Tables (SQL), collections (MongoDB), keys (Redis), or indices (Elasticsearch). |
|
|
383
387
|
| `schema` | query-only+ | SQL: per-table or full scan into `.dbcli/schemas/`. MongoDB: sampled. ES: flattened mapping. Redis: per-key only (type/TTL/size). Supports `--recovery`. |
|
|
384
|
-
| `query` | query-only+ | SQL, Mongo JSON (`--collection`), Redis command, or ES DSL/Lucene (`--collection`). `--format table\|json\|csv\|html`, `--ui` to open the interactive dashboard in a browser. `--fields` (projection), `--truncate` (cell width), `-f/--query-file` (read query from file or stdin), `--use a,b` (read-only fan-out). Supports `--recovery`. See **Query workflow flags**. |
|
|
385
|
-
| `explain` | query-only+ |
|
|
388
|
+
| `query` | query-only+ | SQL, Mongo JSON (`--collection`), Redis command, or ES DSL/Lucene (`--collection`). `--format table\|json\|csv\|html`, `--ui` to open the interactive dashboard in a browser. `--fields` (projection), `--truncate` (cell width), `-f/--query-file` (read query from file or stdin), `--use a,b` (read-only fan-out). Supports `--recovery`. `--slow-ms <n>` sets the passive slow-query hint threshold (default 1000, `0` off): at or above it, table output gains a `Performance hint` footer and JSON gains `metadata.performanceAdvisory`; it runs no extra diagnostics and is suppressed under `--recovery`. Distinct from the `proxy` flag of the same name. See **Query workflow flags**. |
|
|
389
|
+
| `explain` | query-only+ | Read-only query plan with annotations. SQL only. Single query, `@saved-query`, `@file.sql`, or `--bulk @glob/*`. `--analyze` (EXPLAIN ANALYZE / MariaDB ANALYZE SELECT), `--format markdown\|json\|table`. |
|
|
386
390
|
| `lint` | n/a | Static SQL anti-pattern advisor (no DB connection). 9 rules incl. schema-aware implicit-cast / NOT IN-nullable checks via the layered `.dbcli/schemas/` cache; global `--use <conn>` selects a named cache. Findings carry rewrite drafts + guarded `explain` verify commands (`--analyze` only for proven read-only SQL) — report-only, never executes. `--format text\|json\|markdown`, `--min-severity`, `--no-schema`, `--bulk`. Supports `--recovery`. |
|
|
387
391
|
| `plan` | n/a | Static SQL risk analyzer (`--format text\|json`); classifies a statement without connecting to the database. |
|
|
388
|
-
| `q` | query-only+ | Run a saved snippet by `@name` with `--param k=v`. Supports `--verify` to run assertions. |
|
|
392
|
+
| `q` | query-only+ | Run a saved snippet by `@name` with `--param k=v`. Supports `--verify` to run assertions and `--slow-ms <n>` (same passive slow-query hint as `query`). |
|
|
389
393
|
| `queries` | n/a | Manage saved snippets: `list` / `show` / `search` / `suggest` / `new` / `edit` / `check` / `delete` / `rename` / `copy` / `import` / `export`. |
|
|
390
394
|
| `insert` / `update` | read-write+ | SQL or MongoDB only. JSON `--data` / `--set`; `--where` required on `update`; `--dry-run` first. Redis writes go through `query`. Supports `--recovery`. |
|
|
391
395
|
| `delete` | data-admin+ | SQL or MongoDB; Redis has a basic implementation (see Redis section). `--where` required; `--dry-run` first. Supports `--recovery`. |
|
|
392
|
-
| `export` | query-only+ | SQL, MongoDB, or
|
|
396
|
+
| `export` | query-only+ | SQL, MongoDB, or Elasticsearch (DSL `--index` or whole-index scroll). Query → `--format json\|jsonl\|csv\|html` file or stdout. `html` emits a standalone interactive dashboard. **Fails closed rather than truncating silently**: if the auto-limit would drop rows, the export errors out and you must pass `--no-limit` or `--limit N`. Supports `--recovery`. |
|
|
393
397
|
| `blacklist` | n/a | `list` / `table` / `column` subcommands redact sensitive data from query results. |
|
|
394
398
|
| `check` | query-only+ | SQL only (best on MySQL/MariaDB). |
|
|
395
|
-
| `diff` | query-only+ | SQL only. Save/compare schema snapshots.
|
|
396
|
-
| `
|
|
397
|
-
| `
|
|
399
|
+
| `diff` | query-only+ | SQL only. Save/compare schema snapshots. `--against-orm <path>` compares a Prisma schema / DDL file / normalized JSON against the local schema cache (no DB connection): categorized drift (`missing_in_db` = error, `missing_in_orm` = warn, `mismatch` per tolerance table, `unmanaged`) with dry-run `migrate` proposals; exit 1 on error-level drift. `--orm-format prisma\|ddl\|json\|drizzle\|typeorm\|sequelize`, `--ignore <globs>`, `--format json\|table\|markdown`. Drizzle: point at `drizzle/meta/<NNNN>_snapshot.json` (run `drizzle-kit generate` first; `.ts` sources are rejected with a hint). TypeORM/Sequelize: feed tool-generated DDL (`schema:log` / a schema-only dump); source files are rejected with the exact generation command to run. |
|
|
400
|
+
| `design` | n/a | Offline SQL design assistant over a version-controlled `dbcli.design.json`: never connects, never runs DDL, never calls a provider. `init --output <path>` is the only writer and refuses to overwrite; `validate` is fail-closed, so `render` / `diff` / `propose` refuse to run while `error` findings remain. `diff` / `propose` need exactly one of `--against-cache` or `--against-orm <paths>`. **`propose` is review-only — it plans, it never writes.** Naming rules, finding codes, and the artifact shape are in [reference.md](reference.md#design). |
|
|
401
|
+
| `snapshot` | query-only+ | SQL only. Capture a result fingerprint (`rowCount` + per-column null/distinct/min/max/sum + order-independent checksum). `--out` (default `.dbcli/snapshots/snap-<ts>.json`), `--rows`, `--stdout`, `--format`, `--no-limit`. Baseline for `assert --against`. |
|
|
402
|
+
| `assert` | query-only+ | SQL only. Verify an invariant; exit 1 on failure unless `--no-fail`. `--expect "rows>0\|value==X\|col:c not null\|unique\|between a and b\|>= n"`, `--vs <query> --compare rows\|value` (reconcile), `--against <snapshot> --tolerance <pct>`. |
|
|
398
403
|
| `verification` | n/a | Inspect and manage local verification artifacts. `list` / `show <id-or-path>` / `summary` are read-only; `prune` is dry-run by default and deletes only with `--execute --force`. Reads `<cwd>/.dbcli/verification/`; no DB connection, no audit writes. |
|
|
399
404
|
| `backfill artifact` | n/a | Build a bounded, reviewable source-to-SQL backfill artifact from JSON. Includes source/target identity, blacklist/schema preflight, read-back verification, and rollback hints; dry-run only and never executes writes. |
|
|
400
|
-
| `proxy` | n/a |
|
|
405
|
+
| `proxy` | n/a | MySQL/MariaDB/PostgreSQL only. Local-dev observability proxy — relays app traffic to the real DB and appends query/latency/byte/error events to `.dbcli/proxy/events.jsonl`. Observe-only. `proxy analyze` aggregates that log offline (summary, byFingerprint, slowest, errors, hotTables, N+1; `--format markdown` produces the QueryLens report) and errors out if no events exist. Act on it: run each finding's `suggestedCommands`, read its `hints`, then propose the fix — never guess a table name, confirm with `schema`. Protect the log itself with `--redact literals`. [Flags](reference.md#proxy). |
|
|
401
406
|
| `status` | query-only+ | Safe JSON/text summary (no credentials). |
|
|
402
|
-
| `inspect` | query-only+ | Read-only context snapshot (connection, permission, blacklist, objects, snippets, context-aware `suggestedCommands`, and
|
|
407
|
+
| `inspect` | query-only+ | Read-only context snapshot (connection, permission, blacklist, objects, snippets, context-aware `suggestedCommands`, and human-readable `hints`). `--for-agent` / `--brief` / `--no-connect` / `--require-schema-cache`. Supports `--recovery`. |
|
|
403
408
|
| `report` | query-only+ | Diagnostic report built from `@diag/*` snippets. `--section <health\|capacity\|perf>` (comma-separated to combine), `--brief`, `--for-agent`, `--no-connect`. |
|
|
404
|
-
| `guide` | query-only+ | Deterministic next-command plan for a fixed goal (`slow-query`, `capacity`, `health`, `index-usage`, `permissions`, `schema-overview`). `--list` to enumerate.
|
|
409
|
+
| `guide` | query-only+ | Deterministic next-command plan for a fixed goal (`slow-query`, `capacity`, `health`, `index-usage`, `permissions`, `schema-overview`). `--list` to enumerate. `guide missing-index-for <query>` suggests composite indexes for a single SELECT (`--format yaml\|json\|markdown`, `--min-confidence`). |
|
|
405
410
|
| `recovery` | n/a | Look up the structured `RecoveryEnvelope` for a known error code (`--code <CODE>` or `--list`). Standalone synthesizer; does not require a real failure. |
|
|
406
411
|
| `recover` | n/a | Inspect (default) or `--apply` the auto-saved recovery plan in `.dbcli/last-recovery.json`. `--allow-write=readonly-cmd\|write-cmd`, `--no-verify`, `--from <file>`, `--next --after-step <n> --result <json\|@file>` for multi-turn step-at-a-time. |
|
|
407
412
|
| `doctor` | n/a | Environment/runtime identity, config, connection, SRV diagnostics (Mongo), schema cache age. `--format json --remediation` emits candidate-only blacklist/schema/bounded-sample plans (SQL: `dbcli plan` → human-confirmed bounded `dbcli query`; MongoDB/Elasticsearch: `dbcli schema` preflight → human-confirmed bounded query); it never applies them. |
|
|
408
413
|
| `completion` | n/a | bash / zsh / fish scripts. |
|
|
409
414
|
| `upgrade` | n/a | Self-update from npm; 24h-cached version hints on every command. |
|
|
410
|
-
| `shell` | (same as query+) | Interactive REPL. SQL engines, MongoDB, and Redis (single-line; `.no-limit on/off`).
|
|
415
|
+
| `shell` | (same as query+) | Interactive REPL. SQL engines, MongoDB, and Redis (single-line; `.no-limit on/off`). Elasticsearch opens a Kibana Dev Tools-style REPL (`<METHOD> /<path>` + optional JSON body, blank line submits). |
|
|
411
416
|
| `skill` | n/a | Generate / install AI skill docs (`--install <claude\|gemini\|antigravity\|copilot\|cursor\|codex\|windsurf>`); `skill tasks list/show/plan` for Agent Task Packs; `skill context` for an LLM prompt-context payload (for injecting into another LLM, not needed for normal operation). |
|
|
412
417
|
| `semantic` | n/a | Validate, search, inspect drift, migrate to v2, or print the optional project-root `dbcli.semantic.json`. Give its reviewed context to an external agent, but keep provider credentials, prompts, and agent context outside dbcli. `semantic draft validate --input <file|-> [--format text\|json]` validates only the explicit untrusted `QueryDraft` offline against local semantic/schema/saved-query metadata; it returns safe hashes/references/violation codes, never executes or echoes candidate SQL. Review the original draft, then invoke `explain` or `query` separately if intended. |
|
|
413
418
|
| `migrate` | admin | SQL only. **DDL; dry-run by default** — needs `--execute`. |
|
|
@@ -475,12 +480,12 @@ truncation from a round number. This applies to `query` and to `q` snippets
|
|
|
475
480
|
explicit operators (`$set`/`$inc`/`$push`/…) pass through. Nested blacklist accepts dotted
|
|
476
481
|
paths (`profile.email`) and trailing wildcards (`profile.tokens.*`). Saved snippets end in
|
|
477
482
|
`.mongodb.sql` (frontmatter `engine: mongodb`, `operation: find|aggregate`). Full
|
|
478
|
-
write-planner tiers and syntax: reference.md
|
|
483
|
+
write-planner tiers and syntax: [reference.md](reference.md#mongodb-support).
|
|
479
484
|
|
|
480
485
|
## Redis
|
|
481
486
|
|
|
482
487
|
- `query` runs a single **whitelisted** Redis command (e.g. `GET`, `SET`, `HSET`, `DEL`).
|
|
483
|
-
The full whitelist and the per-command permission tier are defined in reference.md.
|
|
488
|
+
The full whitelist and the per-command permission tier are defined in [reference.md](reference.md#redis-support).
|
|
484
489
|
- **Supported:** `init`, `list` (keys via SCAN), `schema <key>` (type / TTL / size / sample),
|
|
485
490
|
`query`, `q` (saved snippets — **read-only commands only**), `delete` (basic implementation:
|
|
486
491
|
`DEL` / `HDEL` / `LREM` / `SREM` / `ZREM`, needs `data-admin`; `query "DEL <key>"` also
|
|
@@ -493,7 +498,7 @@ truncation from a round number. This applies to `query` and to `q` snippets
|
|
|
493
498
|
blacklist (matching reads/writes are rejected). To preview a delete, use `delete <key> --dry-run`.
|
|
494
499
|
- `database` is the logical DB index (default `0`). `dbcli blacklist table add 'secrets:*'`
|
|
495
500
|
registers a key glob; an optional `redis.mask` block masks values on read. Size guards
|
|
496
|
-
(SCAN/HGETALL truncation, `--no-limit` to bypass) and masking details: reference.md
|
|
501
|
+
(SCAN/HGETALL truncation, `--no-limit` to bypass) and masking details: [reference.md](reference.md#redis-support).
|
|
497
502
|
|
|
498
503
|
## Elasticsearch
|
|
499
504
|
|
|
@@ -505,12 +510,14 @@ dbcli query '{"query":{"match":{"status":"active"}}}' --collection orders
|
|
|
505
510
|
|
|
506
511
|
- `query` takes a DSL (JSON body) or Lucene query string; `--collection <index>` is required.
|
|
507
512
|
- **Supported:** `init`, `list` (indices with doc count), `schema [index]` (flattened mapping),
|
|
508
|
-
`query`, `
|
|
513
|
+
`query`, `q` (snippets use the `.elasticsearch.sql` extension), `export`,
|
|
514
|
+
`shell`, `status`, `use`, `doctor`. **Not supported:**
|
|
509
515
|
`insert`, `update`, `delete`, `check`, `diff`, `migrate`.
|
|
510
516
|
- `export` takes a search DSL with `--index <index>`, or an index name as the query to scroll
|
|
511
|
-
the whole index via `match_all`. Query-only caps at 1000 hits; `--no-limit`
|
|
517
|
+
the whole index via `match_all`. Query-only caps at 1000 hits; `--no-limit` streams the whole
|
|
518
|
+
index via the scroll API. (The 10 000 bound belongs to `query`, not `export`.)
|
|
512
519
|
- Schema flattens nested fields (`a.b.c`) and surfaces `.fields` multi-fields. `shell` opens a
|
|
513
|
-
Kibana Dev Tools-style REPL. Full syntax and examples: reference.md
|
|
520
|
+
Kibana Dev Tools-style REPL. Full syntax and examples: [reference.md](reference.md#elasticsearch-support).
|
|
514
521
|
|
|
515
522
|
## Saved queries
|
|
516
523
|
|
|
@@ -575,7 +582,7 @@ dbcli export "SELECT * FROM orders" --format html --output orders.html
|
|
|
575
582
|
When a saved snippet exists, prefer `q @<name> --ui` / `q @<name> --format html` because snippet
|
|
576
583
|
metadata can drive titles, KPI cards, and charts. Blacklist redaction is applied **before**
|
|
577
584
|
rendering. To get KPIs and charts instead of a plain table, add a `visual:` block (`title`,
|
|
578
|
-
`kpis[]`, `charts[]`) to the snippet frontmatter — see reference.md for the full `visual:`
|
|
585
|
+
`kpis[]`, `charts[]`) to the snippet frontmatter — see [reference.md](reference.md#interactive-html-dashboard) for the full `visual:`
|
|
579
586
|
schema. Raw `query` / `export` invocations render a sortable table only.
|
|
580
587
|
|
|
581
588
|
## Common workflows
|
|
@@ -592,6 +599,6 @@ schema. Raw `query` / `export` invocations render a sortable table only.
|
|
|
592
599
|
|
|
593
600
|
- Query-only mode auto-appends `LIMIT 1000`; add `--no-limit` for `information_schema` or statements that break with `LIMIT`.
|
|
594
601
|
- Blacklisted tables and columns are redacted from query output.
|
|
595
|
-
- `schema` reports `estimatedRowCount` and `sizeCategory` (small / medium / large / huge). For large/huge tables add `WHERE` or `LIMIT` — bands in reference.md.
|
|
602
|
+
- `schema` reports `estimatedRowCount` and `sizeCategory` (small / medium / large / huge). For large/huge tables add `WHERE` or `LIMIT` — bands in [reference.md](reference.md#schema).
|
|
596
603
|
- `doctor` on `mongodb+srv://` reports whether SRV resolves natively or through the DoH fallback — useful when the runtime restricts DNS.
|
|
597
604
|
- **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.
|