@carllee1983/dbcli 1.42.0 → 1.43.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 +29 -5
- package/.cursor/skills/dbcli/reference.md +79 -4
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +29 -5
- package/.github/skills/dbcli/reference.md +79 -4
- package/CHANGELOG.md +32 -0
- package/README.dev.md +1 -1
- package/README.md +72 -10
- package/README.zh-TW.md +70 -10
- package/assets/SKILL.md +29 -5
- package/assets/SKILL.zh-TW.md +27 -4
- package/assets/reference.md +79 -4
- package/assets/ui-template.html +19 -19
- package/dist/agent-core.d.ts +32 -0
- package/dist/agent-core.mjs +92 -0
- package/dist/cli.mjs +1539 -686
- package/dist/core.d.ts +23 -0
- package/dist/core.mjs +323 -76
- package/dist/ui-style.css +1 -1
- package/gemini-extension.json +1 -1
- package/package.json +9 -3
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +29 -5
- package/plugins/dbcli-agent/skills/dbcli/reference.md +79 -4
- package/skills/dbcli/SKILL.md +29 -5
- package/skills/dbcli/reference.md +79 -4
package/.cursor/rules/dbcli.mdc
CHANGED
|
@@ -239,8 +239,10 @@ dbcli init --system elasticsearch \
|
|
|
239
239
|
dbcli init --conn-name staging --env-file .env.staging --permission query-only
|
|
240
240
|
dbcli init --conn-name prod --env-file .env.production --use-env-refs --skip-test
|
|
241
241
|
dbcli use --list # show all, * marks default
|
|
242
|
-
dbcli use prod # switch default
|
|
242
|
+
dbcli use prod # switch default (persists — avoid for one-off queries)
|
|
243
243
|
dbcli query --use staging "SELECT 1" # one-shot override on any subcommand
|
|
244
|
+
DBCLI_CONNECTION=staging dbcli query "SELECT 1" # one-shot via env; parallel-safe
|
|
245
|
+
dbcli --use staging,prod query "SELECT count(*) FROM users" # read-only fan-out
|
|
244
246
|
dbcli init --rename staging:stg # rename
|
|
245
247
|
dbcli init --remove stg # remove
|
|
246
248
|
```
|
|
@@ -296,7 +298,7 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
296
298
|
| `use` | n/a | Show/switch default named connection (v2 only). |
|
|
297
299
|
| `list` | query-only+ | Tables (SQL), collections (MongoDB), keys (Redis), or indices (Elasticsearch). |
|
|
298
300
|
| `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`. |
|
|
299
|
-
| `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. Supports `--recovery`. |
|
|
301
|
+
| `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**. |
|
|
300
302
|
| `explain` | query-only+ | **(v1.23)** 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`. |
|
|
301
303
|
| `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`. |
|
|
302
304
|
| `plan` | n/a | Static SQL risk analyzer (`--format text\|json`); classifies a statement without connecting to the database. |
|
|
@@ -304,7 +306,7 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
304
306
|
| `queries` | n/a | Manage saved snippets: `list` / `show` / `search` / `suggest` / `new` / `edit` / `check` / `delete` / `rename` / `copy` / `import` / `export`. |
|
|
305
307
|
| `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`. |
|
|
306
308
|
| `delete` | data-admin+ | SQL or MongoDB; Redis has a basic implementation (see Redis section). `--where` required; `--dry-run` first. Supports `--recovery`. |
|
|
307
|
-
| `export` | query-only+ | SQL, MongoDB, or **(v1.22)** Elasticsearch (DSL `--index` or whole-index scroll). Query → `--format json\|jsonl\|csv\|html` file or stdout. `html` emits a standalone interactive dashboard. Supports `--recovery`. |
|
|
309
|
+
| `export` | query-only+ | SQL, MongoDB, or **(v1.22)** 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`. |
|
|
308
310
|
| `blacklist` | n/a | `list` / `table` / `column` subcommands redact sensitive data from query results. |
|
|
309
311
|
| `check` | query-only+ | SQL only (best on MySQL/MariaDB). |
|
|
310
312
|
| `diff` | query-only+ | SQL only. Save/compare schema snapshots. **(P1b)** `--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. |
|
|
@@ -325,8 +327,9 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
325
327
|
| `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). |
|
|
326
328
|
| `migrate` | admin | SQL only. **DDL; dry-run by default** — needs `--execute`. |
|
|
327
329
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
+
Use root-level `dbcli --use <name> <command>` for any command; `query`, `schema`, `list`,
|
|
331
|
+
`export`, and `check` also accept command-level `--use`. Both target a v2 connection without
|
|
332
|
+
changing the default. `--recovery` is honoured by `query`, `q`, `insert`, `update`,
|
|
330
333
|
`delete`, `export`, `schema`, `inspect`, `lint`, and `diff --against-orm` (see **On failure** above).
|
|
331
334
|
|
|
332
335
|
**Write & query flag semantics** (SQL/Mongo `insert`/`update`):
|
|
@@ -344,6 +347,27 @@ without changing the default. `--recovery` is honoured by `query`, `q`, `insert`
|
|
|
344
347
|
- `--recovery` is recommended for automated agent pipelines (enables `dbcli recover --apply`
|
|
345
348
|
after a failure); optional for one-off manual writes.
|
|
346
349
|
|
|
350
|
+
## Query workflow flags
|
|
351
|
+
|
|
352
|
+
These exist so you do not have to pipe output through `head` / `jq` / `python3`
|
|
353
|
+
to make it usable. Reach for them instead of post-processing.
|
|
354
|
+
|
|
355
|
+
| Need | Flag | Notes |
|
|
356
|
+
|------|------|-------|
|
|
357
|
+
| Only some columns | `--fields sn,bet,created_at` | SQL and MongoDB. Mongo pushes a real `projection` / `$project` to the driver; `_id` is dropped unless you ask for it. A field the result lacks comes back as `null`, so verify spellings with `schema` before reading meaning into an all-null column. |
|
|
358
|
+
| Everything except a huge column | `--fields=-raw_response` | Exclusion form. Include and exclude cannot be mixed. |
|
|
359
|
+
| One field is a giant JSON blob | `--truncate 120` | Table output truncates cells at 120 chars **by default** and marks them `…(+3412 chars)`. `--no-truncate` disables it. Explicit truncation flags are rejected on JSON, CSV, HTML, and `--ui` output. |
|
|
360
|
+
| Query has quotes / newlines / `$regex` | `-f pipeline.json` or `-f -` | Reads the query from a file or stdin; use a heredoc for Mongo pipelines. Passing both a file and positional query text is an error, never a silent pick. `-f -` needs piped input — it refuses an interactive terminal rather than hanging. |
|
|
361
|
+
| Same query across connections | `--use hub-prod,site-a` | Read-only fan-out. Per-connection results, one failure does not cancel the others. Exit `0` all-ok, `2` mixed, `1` all-failed. Rejects writes, `--recovery`, `--ui`, CSV/HTML. |
|
|
362
|
+
| Pick a connection for one call | `DBCLI_CONNECTION=hub-prod dbcli query …` | Env var, or `--use` on the subcommand. Priority: `--use` > `DBCLI_CONNECTION` > saved default. Neither writes the default back to disk, so parallel shells never fight. Requires a v2 config — a single-connection (v1) project rejects both rather than silently running its only connection. **Do not** use `dbcli use <name>` just to switch for one query. |
|
|
363
|
+
|
|
364
|
+
**Truncation is reported, never implied.** When the query-only auto-limit trims a
|
|
365
|
+
result, the table footer reads `Rows: 1000 (truncated; limit 1000)`, `--format json`
|
|
366
|
+
carries `metadata.truncated` / `metadata.limit_applied`, and CSV appends a `#`
|
|
367
|
+
comment. `Rows: 1000` with no marker means exactly 1000 rows exist — do not infer
|
|
368
|
+
truncation from a round number. This applies to `query` and to `q` snippets
|
|
369
|
+
(whose own 1000-row guard reports the same way). `export` refuses to truncate at all. Redis replies trimmed by the size guard report the same way, and each size-guard warning is printed on stderr.
|
|
370
|
+
|
|
347
371
|
## Permission levels
|
|
348
372
|
|
|
349
373
|
| Level | Allowed |
|
|
@@ -112,7 +112,7 @@ dbcli schema --use prod # Scan prod DB; saves to .dbcli/schemas/prod
|
|
|
112
112
|
|
|
113
113
|
### query
|
|
114
114
|
|
|
115
|
-
Execute SQL
|
|
115
|
+
Execute a SQL statement, MongoDB filter/pipeline, allow-listed Redis command, or Elasticsearch DSL/Lucene query.
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
118
|
# SQL databases
|
|
@@ -143,13 +143,84 @@ dbcli query "SELECT day, dau FROM dau_daily" --ui # open in brows
|
|
|
143
143
|
dbcli query "SELECT * FROM orders" --format html > orders.html # pipe to stdout
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
**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`), `--recovery`
|
|
146
|
+
**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]>`, `--recovery`
|
|
147
147
|
**Permission:** query-only+ (Redis: per-command; Elasticsearch: per HTTP method/path)
|
|
148
148
|
|
|
149
|
+
#### Field projection (`--fields`)
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
dbcli query "SELECT * FROM bet_log" --fields sn,currency,bet
|
|
153
|
+
dbcli query "SELECT * FROM bet_log" --fields=-raw_response,-created_at # exclusion
|
|
154
|
+
dbcli query '{"station_code":"cmg9998"}' --collection raw_bet_log --fields sn,bet
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Include and exclude forms cannot be mixed. Dotted paths (`user.email`) are supported.
|
|
158
|
+
On MongoDB the selection becomes a driver-level `projection` (find) or a trailing
|
|
159
|
+
`$project` stage (aggregate), so the omitted fields never leave the server; `_id` is
|
|
160
|
+
excluded unless listed explicitly. On SQL the rows are projected after fetch — write
|
|
161
|
+
an explicit column list in the `SELECT` when you also want to cut transfer cost.
|
|
162
|
+
Blacklisted columns stay blacklisted: naming one in `--fields` yields no value and the
|
|
163
|
+
result still carries the blacklist `securityNotification`. A requested field that does
|
|
164
|
+
not exist in the result comes back as `null`.
|
|
165
|
+
|
|
166
|
+
#### Cell truncation (`--truncate`)
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
dbcli query "SELECT sn, raw_response FROM bet_log" # table: 120-char default
|
|
170
|
+
dbcli query "SELECT sn, raw_response FROM bet_log" --truncate 40
|
|
171
|
+
dbcli query "SELECT sn, raw_response FROM bet_log" --no-truncate
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Table output truncates each serialized cell at 120 Unicode code points by default and
|
|
175
|
+
appends `…(+N chars)`; counting by code point keeps multi-byte characters and emoji
|
|
176
|
+
intact. `--truncate <n>` sets the width, `--no-truncate` disables it. Explicit truncation
|
|
177
|
+
flags are rejected with JSON, CSV, HTML, and `--ui` output.
|
|
178
|
+
|
|
179
|
+
#### Query from a file or stdin (`-f`)
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
dbcli query -f report.sql
|
|
183
|
+
dbcli query --collection raw_bet_log -f - <<'EOF'
|
|
184
|
+
[{"$match": {"sn": {"$regex": "^SN0000"}}}, {"$group": {"_id": "$currency", "n": {"$sum": 1}}}]
|
|
185
|
+
EOF
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Avoids shell quoting entirely — the usual reason a Mongo pipeline containing `$regex`
|
|
189
|
+
or nested date objects fails. Supplying both `--query-file` and positional query text
|
|
190
|
+
is an error rather than a silent choice, and an empty file or empty stdin is refused.
|
|
191
|
+
`-f -` requires piped input: on an interactive terminal dbcli refuses immediately
|
|
192
|
+
instead of waiting silently for input that is never coming.
|
|
193
|
+
|
|
194
|
+
#### One-shot connection selection and read-only fan-out
|
|
195
|
+
|
|
196
|
+
Selection precedence is explicit `--use`, then `DBCLI_CONNECTION`, then the saved default.
|
|
197
|
+
`query`, `schema`, `list`, `export`, and `check` accept command-level `--use`; for other
|
|
198
|
+
commands use root-level `dbcli --use <name> <command>`. One-shot selectors never update the
|
|
199
|
+
saved default and require a v2 config. A legacy v1 single-connection config rejects them
|
|
200
|
+
instead of silently running its only connection.
|
|
201
|
+
|
|
202
|
+
An explicit comma-separated `--use primary,staging` fans one query out to several named
|
|
203
|
+
connections. `DBCLI_CONNECTION` always names one literal connection and never enables
|
|
204
|
+
fan-out. SQL permits `SELECT`, `SHOW`, `DESCRIBE`, and `EXPLAIN`; MongoDB permits filters and
|
|
205
|
+
read-only pipelines without top-level `$out` / `$merge`; Elasticsearch permits searches.
|
|
206
|
+
Redis, writes, `--recovery`, `--ui`, CSV, and HTML are rejected before execution. Each
|
|
207
|
+
connection keeps its own blacklist, limit metadata, audit entry, and error. Aggregate exit
|
|
208
|
+
codes are `0` when all succeed, `2` for mixed outcomes, and `1` when all fail or preflight
|
|
209
|
+
rejects the request.
|
|
210
|
+
|
|
211
|
+
#### Truncation is stated, not implied
|
|
212
|
+
|
|
213
|
+
When the query-only auto-limit trims the result, the table footer reads
|
|
214
|
+
`Rows: 1000 (truncated; limit 1000)`, `--format json` carries
|
|
215
|
+
`metadata.truncated` and `metadata.limit_applied`, and CSV appends a `#` comment line.
|
|
216
|
+
dbcli fetches one row past the cap to decide this, so a result of exactly 1000 rows is
|
|
217
|
+
reported as `truncated: false` — never infer truncation from a round row count.
|
|
218
|
+
|
|
149
219
|
> **MongoDB notes:**
|
|
150
220
|
> - SQL syntax is rejected — use JSON object (filter) or JSON array (pipeline)
|
|
151
221
|
> - `--collection <name>` is required
|
|
152
|
-
> -
|
|
222
|
+
> - Query-only auto-limit applies to filters and to pipelines without their own
|
|
223
|
+
> `$limit`; the applied cap and truncation are reported in the result metadata
|
|
153
224
|
|
|
154
225
|
> **Redis notes:**
|
|
155
226
|
> - The first token must be an allow-listed command (`GET`/`SET`/`HGET`/`HSET`/`DEL`/...). Unknown commands are refused.
|
|
@@ -661,9 +732,13 @@ dbcli export orders --no-limit --format jsonl # scroll the whole ind
|
|
|
661
732
|
**Options:** `--format <json|jsonl|csv|html>` (required), `--output <path>`, `--force`, `--recovery`, `--collection <name>` (MongoDB collection) / `--index <name>` (Elasticsearch index; alias for `--collection`), `--limit <number>` (overrides auto-limit), `--no-limit` (Elasticsearch full-index scroll)
|
|
662
733
|
**Permission:** query-only+ — SQL, MongoDB, and **(v1.22)** Elasticsearch.
|
|
663
734
|
|
|
735
|
+
If the query-only auto-limit would omit rows, export fails closed with exit code `1` and
|
|
736
|
+
writes no partial file. Re-run with `--no-limit` to export everything, or `--limit N` to
|
|
737
|
+
accept a bounded export explicitly. This applies to SQL, MongoDB, and Elasticsearch.
|
|
738
|
+
|
|
664
739
|
The `html` format emits the same self-contained dashboard as `query --ui` (see [Interactive HTML dashboard](#interactive-html-dashboard)). Because `export` runs raw SQL (no snippet metadata), the HTML report is always rendered as a sortable / filterable table — no KPIs or charts. Use `dbcli q @<name> --format html` (or `--ui`) for the charted view.
|
|
665
740
|
|
|
666
|
-
> **Elasticsearch export (v1.22):** pass a search DSL with `--index <index>` to export the hits, or pass an index name as the query to scroll the whole index via `match_all`. Default cap is 1000 rows; `--no-limit` streams the full index via scroll in batches. Index-level blacklist is checked before export and an audit record is written.
|
|
741
|
+
> **Elasticsearch export (v1.22):** pass a search DSL with `--index <index>` to export the hits, or pass an index name as the query to scroll the whole index via `match_all`. Default cap is 1000 rows; reaching it fails closed unless the caller explicitly uses `--limit N`, while `--no-limit` streams the full index via scroll in batches. Index-level blacklist is checked before export and an audit record is written.
|
|
667
742
|
|
|
668
743
|
### blacklist
|
|
669
744
|
|
|
@@ -239,8 +239,10 @@ dbcli init --system elasticsearch \
|
|
|
239
239
|
dbcli init --conn-name staging --env-file .env.staging --permission query-only
|
|
240
240
|
dbcli init --conn-name prod --env-file .env.production --use-env-refs --skip-test
|
|
241
241
|
dbcli use --list # show all, * marks default
|
|
242
|
-
dbcli use prod # switch default
|
|
242
|
+
dbcli use prod # switch default (persists — avoid for one-off queries)
|
|
243
243
|
dbcli query --use staging "SELECT 1" # one-shot override on any subcommand
|
|
244
|
+
DBCLI_CONNECTION=staging dbcli query "SELECT 1" # one-shot via env; parallel-safe
|
|
245
|
+
dbcli --use staging,prod query "SELECT count(*) FROM users" # read-only fan-out
|
|
244
246
|
dbcli init --rename staging:stg # rename
|
|
245
247
|
dbcli init --remove stg # remove
|
|
246
248
|
```
|
|
@@ -296,7 +298,7 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
296
298
|
| `use` | n/a | Show/switch default named connection (v2 only). |
|
|
297
299
|
| `list` | query-only+ | Tables (SQL), collections (MongoDB), keys (Redis), or indices (Elasticsearch). |
|
|
298
300
|
| `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`. |
|
|
299
|
-
| `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. Supports `--recovery`. |
|
|
301
|
+
| `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**. |
|
|
300
302
|
| `explain` | query-only+ | **(v1.23)** 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`. |
|
|
301
303
|
| `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`. |
|
|
302
304
|
| `plan` | n/a | Static SQL risk analyzer (`--format text\|json`); classifies a statement without connecting to the database. |
|
|
@@ -304,7 +306,7 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
304
306
|
| `queries` | n/a | Manage saved snippets: `list` / `show` / `search` / `suggest` / `new` / `edit` / `check` / `delete` / `rename` / `copy` / `import` / `export`. |
|
|
305
307
|
| `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`. |
|
|
306
308
|
| `delete` | data-admin+ | SQL or MongoDB; Redis has a basic implementation (see Redis section). `--where` required; `--dry-run` first. Supports `--recovery`. |
|
|
307
|
-
| `export` | query-only+ | SQL, MongoDB, or **(v1.22)** Elasticsearch (DSL `--index` or whole-index scroll). Query → `--format json\|jsonl\|csv\|html` file or stdout. `html` emits a standalone interactive dashboard. Supports `--recovery`. |
|
|
309
|
+
| `export` | query-only+ | SQL, MongoDB, or **(v1.22)** 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`. |
|
|
308
310
|
| `blacklist` | n/a | `list` / `table` / `column` subcommands redact sensitive data from query results. |
|
|
309
311
|
| `check` | query-only+ | SQL only (best on MySQL/MariaDB). |
|
|
310
312
|
| `diff` | query-only+ | SQL only. Save/compare schema snapshots. **(P1b)** `--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. |
|
|
@@ -325,8 +327,9 @@ Full flags and edge cases: see [reference.md](reference.md) `init` section.
|
|
|
325
327
|
| `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). |
|
|
326
328
|
| `migrate` | admin | SQL only. **DDL; dry-run by default** — needs `--execute`. |
|
|
327
329
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
+
Use root-level `dbcli --use <name> <command>` for any command; `query`, `schema`, `list`,
|
|
331
|
+
`export`, and `check` also accept command-level `--use`. Both target a v2 connection without
|
|
332
|
+
changing the default. `--recovery` is honoured by `query`, `q`, `insert`, `update`,
|
|
330
333
|
`delete`, `export`, `schema`, `inspect`, `lint`, and `diff --against-orm` (see **On failure** above).
|
|
331
334
|
|
|
332
335
|
**Write & query flag semantics** (SQL/Mongo `insert`/`update`):
|
|
@@ -344,6 +347,27 @@ without changing the default. `--recovery` is honoured by `query`, `q`, `insert`
|
|
|
344
347
|
- `--recovery` is recommended for automated agent pipelines (enables `dbcli recover --apply`
|
|
345
348
|
after a failure); optional for one-off manual writes.
|
|
346
349
|
|
|
350
|
+
## Query workflow flags
|
|
351
|
+
|
|
352
|
+
These exist so you do not have to pipe output through `head` / `jq` / `python3`
|
|
353
|
+
to make it usable. Reach for them instead of post-processing.
|
|
354
|
+
|
|
355
|
+
| Need | Flag | Notes |
|
|
356
|
+
|------|------|-------|
|
|
357
|
+
| Only some columns | `--fields sn,bet,created_at` | SQL and MongoDB. Mongo pushes a real `projection` / `$project` to the driver; `_id` is dropped unless you ask for it. A field the result lacks comes back as `null`, so verify spellings with `schema` before reading meaning into an all-null column. |
|
|
358
|
+
| Everything except a huge column | `--fields=-raw_response` | Exclusion form. Include and exclude cannot be mixed. |
|
|
359
|
+
| One field is a giant JSON blob | `--truncate 120` | Table output truncates cells at 120 chars **by default** and marks them `…(+3412 chars)`. `--no-truncate` disables it. Explicit truncation flags are rejected on JSON, CSV, HTML, and `--ui` output. |
|
|
360
|
+
| Query has quotes / newlines / `$regex` | `-f pipeline.json` or `-f -` | Reads the query from a file or stdin; use a heredoc for Mongo pipelines. Passing both a file and positional query text is an error, never a silent pick. `-f -` needs piped input — it refuses an interactive terminal rather than hanging. |
|
|
361
|
+
| Same query across connections | `--use hub-prod,site-a` | Read-only fan-out. Per-connection results, one failure does not cancel the others. Exit `0` all-ok, `2` mixed, `1` all-failed. Rejects writes, `--recovery`, `--ui`, CSV/HTML. |
|
|
362
|
+
| Pick a connection for one call | `DBCLI_CONNECTION=hub-prod dbcli query …` | Env var, or `--use` on the subcommand. Priority: `--use` > `DBCLI_CONNECTION` > saved default. Neither writes the default back to disk, so parallel shells never fight. Requires a v2 config — a single-connection (v1) project rejects both rather than silently running its only connection. **Do not** use `dbcli use <name>` just to switch for one query. |
|
|
363
|
+
|
|
364
|
+
**Truncation is reported, never implied.** When the query-only auto-limit trims a
|
|
365
|
+
result, the table footer reads `Rows: 1000 (truncated; limit 1000)`, `--format json`
|
|
366
|
+
carries `metadata.truncated` / `metadata.limit_applied`, and CSV appends a `#`
|
|
367
|
+
comment. `Rows: 1000` with no marker means exactly 1000 rows exist — do not infer
|
|
368
|
+
truncation from a round number. This applies to `query` and to `q` snippets
|
|
369
|
+
(whose own 1000-row guard reports the same way). `export` refuses to truncate at all. Redis replies trimmed by the size guard report the same way, and each size-guard warning is printed on stderr.
|
|
370
|
+
|
|
347
371
|
## Permission levels
|
|
348
372
|
|
|
349
373
|
| Level | Allowed |
|
|
@@ -112,7 +112,7 @@ dbcli schema --use prod # Scan prod DB; saves to .dbcli/schemas/prod
|
|
|
112
112
|
|
|
113
113
|
### query
|
|
114
114
|
|
|
115
|
-
Execute SQL
|
|
115
|
+
Execute a SQL statement, MongoDB filter/pipeline, allow-listed Redis command, or Elasticsearch DSL/Lucene query.
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
118
|
# SQL databases
|
|
@@ -143,13 +143,84 @@ dbcli query "SELECT day, dau FROM dau_daily" --ui # open in brows
|
|
|
143
143
|
dbcli query "SELECT * FROM orders" --format html > orders.html # pipe to stdout
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
**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`), `--recovery`
|
|
146
|
+
**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]>`, `--recovery`
|
|
147
147
|
**Permission:** query-only+ (Redis: per-command; Elasticsearch: per HTTP method/path)
|
|
148
148
|
|
|
149
|
+
#### Field projection (`--fields`)
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
dbcli query "SELECT * FROM bet_log" --fields sn,currency,bet
|
|
153
|
+
dbcli query "SELECT * FROM bet_log" --fields=-raw_response,-created_at # exclusion
|
|
154
|
+
dbcli query '{"station_code":"cmg9998"}' --collection raw_bet_log --fields sn,bet
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Include and exclude forms cannot be mixed. Dotted paths (`user.email`) are supported.
|
|
158
|
+
On MongoDB the selection becomes a driver-level `projection` (find) or a trailing
|
|
159
|
+
`$project` stage (aggregate), so the omitted fields never leave the server; `_id` is
|
|
160
|
+
excluded unless listed explicitly. On SQL the rows are projected after fetch — write
|
|
161
|
+
an explicit column list in the `SELECT` when you also want to cut transfer cost.
|
|
162
|
+
Blacklisted columns stay blacklisted: naming one in `--fields` yields no value and the
|
|
163
|
+
result still carries the blacklist `securityNotification`. A requested field that does
|
|
164
|
+
not exist in the result comes back as `null`.
|
|
165
|
+
|
|
166
|
+
#### Cell truncation (`--truncate`)
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
dbcli query "SELECT sn, raw_response FROM bet_log" # table: 120-char default
|
|
170
|
+
dbcli query "SELECT sn, raw_response FROM bet_log" --truncate 40
|
|
171
|
+
dbcli query "SELECT sn, raw_response FROM bet_log" --no-truncate
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Table output truncates each serialized cell at 120 Unicode code points by default and
|
|
175
|
+
appends `…(+N chars)`; counting by code point keeps multi-byte characters and emoji
|
|
176
|
+
intact. `--truncate <n>` sets the width, `--no-truncate` disables it. Explicit truncation
|
|
177
|
+
flags are rejected with JSON, CSV, HTML, and `--ui` output.
|
|
178
|
+
|
|
179
|
+
#### Query from a file or stdin (`-f`)
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
dbcli query -f report.sql
|
|
183
|
+
dbcli query --collection raw_bet_log -f - <<'EOF'
|
|
184
|
+
[{"$match": {"sn": {"$regex": "^SN0000"}}}, {"$group": {"_id": "$currency", "n": {"$sum": 1}}}]
|
|
185
|
+
EOF
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Avoids shell quoting entirely — the usual reason a Mongo pipeline containing `$regex`
|
|
189
|
+
or nested date objects fails. Supplying both `--query-file` and positional query text
|
|
190
|
+
is an error rather than a silent choice, and an empty file or empty stdin is refused.
|
|
191
|
+
`-f -` requires piped input: on an interactive terminal dbcli refuses immediately
|
|
192
|
+
instead of waiting silently for input that is never coming.
|
|
193
|
+
|
|
194
|
+
#### One-shot connection selection and read-only fan-out
|
|
195
|
+
|
|
196
|
+
Selection precedence is explicit `--use`, then `DBCLI_CONNECTION`, then the saved default.
|
|
197
|
+
`query`, `schema`, `list`, `export`, and `check` accept command-level `--use`; for other
|
|
198
|
+
commands use root-level `dbcli --use <name> <command>`. One-shot selectors never update the
|
|
199
|
+
saved default and require a v2 config. A legacy v1 single-connection config rejects them
|
|
200
|
+
instead of silently running its only connection.
|
|
201
|
+
|
|
202
|
+
An explicit comma-separated `--use primary,staging` fans one query out to several named
|
|
203
|
+
connections. `DBCLI_CONNECTION` always names one literal connection and never enables
|
|
204
|
+
fan-out. SQL permits `SELECT`, `SHOW`, `DESCRIBE`, and `EXPLAIN`; MongoDB permits filters and
|
|
205
|
+
read-only pipelines without top-level `$out` / `$merge`; Elasticsearch permits searches.
|
|
206
|
+
Redis, writes, `--recovery`, `--ui`, CSV, and HTML are rejected before execution. Each
|
|
207
|
+
connection keeps its own blacklist, limit metadata, audit entry, and error. Aggregate exit
|
|
208
|
+
codes are `0` when all succeed, `2` for mixed outcomes, and `1` when all fail or preflight
|
|
209
|
+
rejects the request.
|
|
210
|
+
|
|
211
|
+
#### Truncation is stated, not implied
|
|
212
|
+
|
|
213
|
+
When the query-only auto-limit trims the result, the table footer reads
|
|
214
|
+
`Rows: 1000 (truncated; limit 1000)`, `--format json` carries
|
|
215
|
+
`metadata.truncated` and `metadata.limit_applied`, and CSV appends a `#` comment line.
|
|
216
|
+
dbcli fetches one row past the cap to decide this, so a result of exactly 1000 rows is
|
|
217
|
+
reported as `truncated: false` — never infer truncation from a round row count.
|
|
218
|
+
|
|
149
219
|
> **MongoDB notes:**
|
|
150
220
|
> - SQL syntax is rejected — use JSON object (filter) or JSON array (pipeline)
|
|
151
221
|
> - `--collection <name>` is required
|
|
152
|
-
> -
|
|
222
|
+
> - Query-only auto-limit applies to filters and to pipelines without their own
|
|
223
|
+
> `$limit`; the applied cap and truncation are reported in the result metadata
|
|
153
224
|
|
|
154
225
|
> **Redis notes:**
|
|
155
226
|
> - The first token must be an allow-listed command (`GET`/`SET`/`HGET`/`HSET`/`DEL`/...). Unknown commands are refused.
|
|
@@ -661,9 +732,13 @@ dbcli export orders --no-limit --format jsonl # scroll the whole ind
|
|
|
661
732
|
**Options:** `--format <json|jsonl|csv|html>` (required), `--output <path>`, `--force`, `--recovery`, `--collection <name>` (MongoDB collection) / `--index <name>` (Elasticsearch index; alias for `--collection`), `--limit <number>` (overrides auto-limit), `--no-limit` (Elasticsearch full-index scroll)
|
|
662
733
|
**Permission:** query-only+ — SQL, MongoDB, and **(v1.22)** Elasticsearch.
|
|
663
734
|
|
|
735
|
+
If the query-only auto-limit would omit rows, export fails closed with exit code `1` and
|
|
736
|
+
writes no partial file. Re-run with `--no-limit` to export everything, or `--limit N` to
|
|
737
|
+
accept a bounded export explicitly. This applies to SQL, MongoDB, and Elasticsearch.
|
|
738
|
+
|
|
664
739
|
The `html` format emits the same self-contained dashboard as `query --ui` (see [Interactive HTML dashboard](#interactive-html-dashboard)). Because `export` runs raw SQL (no snippet metadata), the HTML report is always rendered as a sortable / filterable table — no KPIs or charts. Use `dbcli q @<name> --format html` (or `--ui`) for the charted view.
|
|
665
740
|
|
|
666
|
-
> **Elasticsearch export (v1.22):** pass a search DSL with `--index <index>` to export the hits, or pass an index name as the query to scroll the whole index via `match_all`. Default cap is 1000 rows; `--no-limit` streams the full index via scroll in batches. Index-level blacklist is checked before export and an audit record is written.
|
|
741
|
+
> **Elasticsearch export (v1.22):** pass a search DSL with `--index <index>` to export the hits, or pass an index name as the query to scroll the whole index via `match_all`. Default cap is 1000 rows; reaching it fails closed unless the caller explicitly uses `--limit N`, while `--no-limit` streams the full index via scroll in batches. Index-level blacklist is checked before export and an audit record is written.
|
|
667
742
|
|
|
668
743
|
### blacklist
|
|
669
744
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,38 @@ 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.43.0] - 2026-08-02 - Agent Core、查詢完整性與跨平台修復
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **穩定的 `./agent-core` 子路徑匯出。** 以五個 runtime functions(env 載入、env reference、連線選取、名稱解析、lookahead 截斷)與三個型別形成 agent CLI 共用的 semver interface;`./core` 仍是 dbcli 專用介面。建置同時產出 ESM 與型別宣告,CI purity gate 禁止資料庫、adapter 或 CLI framework 相依滲入。
|
|
13
|
+
- **欄位投影 `--fields`。** SQL 與 MongoDB 通用;`--fields a,b` 取用、`--fields=-raw_response` 排除,兩種形式不可混用。MongoDB 會把 `projection`(find)或 `$project`(aggregate)下推給 driver,未明確指定時不回傳 `_id`。黑名單欄位不會因為被 `--fields` 點名而洩漏。
|
|
14
|
+
- **欄位值截斷 `--truncate`。** table 輸出預設在 120 個 Unicode code point 截斷並標記 `…(+N chars)`,以 code point 計數所以不會切壞中文與 emoji;`--no-truncate` 可關閉。`--format json` / `csv` 會拒絕此旗標而非靜默忽略。
|
|
15
|
+
- **從檔案或 stdin 讀查詢 `-f, --query-file`。** `-f -` 讀 stdin,可用 heredoc 傳含 `$regex`、巢狀日期物件的 MongoDB pipeline,完全避開 shell 引號問題。同時給檔案與位置參數會明確報錯。
|
|
16
|
+
- **單次連線指定。** 新增 `DBCLI_CONNECTION` 環境變數,`query` / `list` / `schema` / `export` / `check` 也接受子指令層級的 `--use`。優先序為 `--use` > `DBCLI_CONNECTION` > 儲存的預設值,兩者都不會改寫 `.dbcli/config.json`,因此平行執行不會互相污染。
|
|
17
|
+
- **唯讀多連線扇出 `--use a,b`。** 同一查詢對多個連線執行,JSON 回傳 `results` 陣列並逐一標示 `ok` / `error`,table 則分段標註連線名。單一連線失敗不會取消其他連線。彙總 exit code:全成功 `0`、部分失敗 `2`、全失敗或執行前拒絕 `1`。寫入語句、`--recovery`、`--ui` 與 CSV/HTML 輸出在扇出下一律拒絕。
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **HTML dashboard 明示不完整與遮蔽結果。** `query`、`q` 與 HTML export 會把既有的截斷與 security metadata 傳入 dashboard;在 KPI、圖表與 raw table 之前顯示醒目提示,避免使用不完整資料得出結論。
|
|
22
|
+
- **截斷改為出現在結果本身。** dbcli 擁有的 row cap 會多取一列前瞻,因此能區分「剛好 N 筆」與「被砍到 N 筆」:table footer 顯示 `Rows: N (truncated; limit N)`、`--format json` 帶 `metadata.truncated` 與 `metadata.limit_applied`、CSV 附加 `# truncated; limit N` 註解行。`dbcli q` 的 snippet size guard 同樣依此回報,不再讓整數列數被誤讀為全集。
|
|
23
|
+
- **`dbcli export` 撞到 auto-limit 改為 fail closed。** 匯出檔沒有地方記錄資料被丟掉(jsonl 是一行一筆、MongoDB `--format json` 是裸陣列),stderr 警告又會在重導向後消失,因此改為 exit `1` 且不寫檔,要求以 `--no-limit` 或 `--limit N` 明確表態。Elasticsearch 匯出的 1000 筆上限同此處理。
|
|
24
|
+
- **CLI 錯誤輸出收斂。** 連線類錯誤在所有指令路徑都會被頂層 handler 攔截並格式化,stderr 首行即為人類可讀訊息,不再由 Bun 印出打包後的 code frame 與未解碼的中文跳脫序列。stack 改掛在 `-v` / `-vv` 之下,預設不輸出。
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **MySQL 8 schema introspection 相容預設 `ONLY_FULL_GROUP_BY`。** 外鍵查詢現在完整分組 referenced table,不再讓 `dbcli schema <table>` 在原廠預設設定下失敗。
|
|
29
|
+
- **已分類的連線錯誤不再被巢狀 adapter catch 重包。** `mapError` 直接保留既有 `ConnectionError` 的 identity、code、message 與 hints,消除 `Connection failed: Connection failed:` 重複前綴與分類退化。
|
|
30
|
+
- **stdout 管線與 Windows CI 修復。** redirected stdout 以完整同步寫入避免 64KB 截斷;測試 filesystem 與換行處理改為跨平台實作,Windows matrix 恢復全綠。
|
|
31
|
+
- **發布依賴安全更新。** 將 PostCSS 鎖定至 `8.5.25`、`brace-expansion` 鎖定至 `5.0.9`,清除 release gate 回報的 3 個 high-severity advisories;並統一 Prettier 格式,讓完整 9 階段發布檢查恢復全綠。
|
|
32
|
+
- **`--no-limit` 過去被靜默忽略。** Commander 會把 `--no-limit` 折進 `limit` 屬性(設為 `false`)而不會產生 `noLimit`,但 `query` / `q` / `export` 都讀 `options.noLimit`,導致這個旗標自始無效——`query` 仍套用 1000 筆上限,`q` 仍包 size guard。CLI 邊界現在會把 Commander 的否定形式轉回指令實際讀取的形狀。
|
|
33
|
+
- **`dbcli export` 的 SQL 路徑忽略 `--limit` 與 `--no-limit`。** 該分支未把選項傳給 QueryExecutor,任何 `--limit N` 都不生效。
|
|
34
|
+
- **`-v` / `-vv` 的 stack 開關過去對 `q` / `insert` / `update` / `delete` 無效。** 這四個指令自行輸出在地化訊息、繞過共用的錯誤呈現層,因此 verbose 對它們不會多印任何東西。改為共用同一個呈現函式:措辭維持不變,但 verbose 下會補上 stack。
|
|
35
|
+
- **Redis 的 size-guard warning 在 `query` 被丟棄。** adapter 早已算出 `REDIS_SIZE_TRUNCATE` / `REDIS_SIZE_REWRITE` / `REDIS_BLACKLIST_FILTERED`,但 `query` 分支完全沒讀 `result.warnings`——文件卻聲稱結果會帶 `warnings[]`。現在每則 warning 都會印到 stderr,且被裁切的回覆會回報 `truncated` / `limit_applied`,與其他引擎一致。
|
|
36
|
+
- **`--query-file -` 在互動式終端會無提示空等。** 改為立即拒絕並說明需要 piped input,與 repo 中其他 stdin 消費端(`insert`、`shell`、`audit`)既有的 TTY 檢查一致。
|
|
37
|
+
- **單一連線 (v1) 設定會靜默忽略 `--use` / `DBCLI_CONNECTION`。** v1 沒有具名連線可選,過去卻照樣執行那唯一的連線,讓使用者以為切換成功——正是 issue #7 要避免的情境。現在會明確報錯並指出升級為 v2 的方式。
|
|
38
|
+
- **skill assets 與 reference 補齊。** `assets/SKILL.md`、`SKILL.zh-TW.md` 與 `reference.md` 新增查詢工作流程旗標章節;`reference.md` 原本記載「MongoDB 不套用 auto-limit」與實際行為不符,已更正為套用於 filter 與未自帶 `$limit` 的 pipeline。
|
|
39
|
+
|
|
8
40
|
## [1.42.0] - 2026-07-20 - Drizzle Snapshot 與 ORM DDL 工作流擴充
|
|
9
41
|
|
|
10
42
|
### Added
|
package/README.dev.md
CHANGED
|
@@ -42,7 +42,7 @@ Before running `npm publish`:
|
|
|
42
42
|
```bash
|
|
43
43
|
npm pack --dry-run
|
|
44
44
|
```
|
|
45
|
-
Expect **`dist/`** (
|
|
45
|
+
Expect **`dist/`** (including `cli.mjs`, `core.mjs` / `core.d.ts`, and `agent-core.mjs` / `agent-core.d.ts`), **`assets/`** (e.g. `SKILL.md`, `reference.md` for `dbcli skill`), **`README.md`**, **`CHANGELOG.md`**, **`LICENSE`**, and **`package.json`**. There must be **no** `src/`, `tests/`, or `node_modules/`. The listing may also include other root `README*.md` files (npm can still pack them even when `files` is set); dev-only readmes are listed in **`.npmignore`** — re-check with dry-run if you add or remove docs.
|
|
46
46
|
|
|
47
47
|
5. **Check package size:**
|
|
48
48
|
```bash
|