@carllee1983/dbcli 11.0.0 → 12.1.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 +46 -0
- package/.cursor/skills/dbcli/reference.md +59 -3
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +46 -0
- package/.github/skills/dbcli/reference.md +59 -3
- package/CHANGELOG.md +88 -0
- package/README.md +16 -13
- package/assets/SKILL.md +46 -0
- package/assets/reference.md +59 -3
- package/assets/tasks/README.md +1 -1
- package/assets/tasks/analyze-table-perf.md +1 -1
- package/assets/tasks/audit-permissions.md +1 -1
- package/assets/tasks/connection-health.md +1 -2
- package/assets/tasks/design-review.md +1 -1
- package/assets/tasks/diagnose-slow-query.md +1 -1
- package/assets/tasks/migration-review.md +5 -3
- package/assets/tasks/mongo-safe-backfill.md +1 -1
- package/assets/tasks/mongo-schema-drift-review.md +1 -1
- package/assets/tasks/orm-drift-review.md +1 -1
- package/assets/tasks/pr-database-review.md +1 -1
- package/assets/tasks/safe-backfill-verify.md +1 -1
- package/assets/tasks/safe-backfill.md +13 -7
- package/assets/tasks/schema-drift-review.md +1 -1
- package/assets/tasks/slow-endpoint-investigation.md +1 -1
- package/dist/cli-runtime.mjs +15485 -23622
- package/dist/cli.mjs +2 -1
- package/dist/core.d.ts +629 -554
- package/dist/core.mjs +6243 -6080
- package/gemini-extension.json +1 -1
- package/package.json +2 -1
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +46 -0
- package/plugins/dbcli-agent/skills/dbcli/reference.md +59 -3
- package/skills/dbcli/SKILL.md +46 -0
- package/skills/dbcli/reference.md +59 -3
package/assets/reference.md
CHANGED
|
@@ -157,7 +157,7 @@ Without a TTY, with `--no-interactive`, or when `--use-env-refs` plus all five `
|
|
|
157
157
|
|
|
158
158
|
New initialization always creates named v2 configuration, including plain `init` and explicit `--config` paths; it no longer creates an unnamed v1 configuration. Existing v1 configurations remain readable and their established named v2 import is retained. The first explicitly named connection is still the default in a new registry; adding a connection preserves an existing registry's default or no-default state. An explicitly chosen duplicate name still requires interactive overwrite confirmation or `--force`; a noninteractive duplicate without `--force`, or a declined confirmation, leaves files untouched. `--remove` and `--rename` do not ask for a new connection name.
|
|
159
159
|
|
|
160
|
-
**Key options:** `--system`, `--permission`, `--use-env-refs`, `--skip-test`, `--no-interactive`, `--force`, `--conn-name <name>`, `--env-file <path>`, `--remove <name>`, `--rename <old:new>`
|
|
160
|
+
**Key options:** `--sql-tls verify-full`, `--sql-tls-ca <path>`, `--system`, `--permission`, `--use-env-refs`, `--skip-test`, `--no-interactive`, `--force`, `--conn-name <name>`, `--env-file <path>`, `--remove <name>`, `--rename <old:new>`
|
|
161
161
|
|
|
162
162
|
**Environment-reference options:** `--env-host <var>`, `--env-port <var>`, `--env-user <var>`, `--env-password <var>`, `--env-database <var>`
|
|
163
163
|
|
|
@@ -193,6 +193,57 @@ Use root-level `--global` with `init`, `use`, `status`, `query`, or any other co
|
|
|
193
193
|
|
|
194
194
|
> **AI agent note on `--use-env-refs`:** If an existing `.dbcli` config contains `{"$env": "DB_HOST"}` style references, the connection values are read from environment variables at runtime. Do NOT re-run `init` to replace these references with actual values — the env-ref format is intentional for CI/CD and multi-environment setups.
|
|
195
195
|
|
|
196
|
+
#### Verified TLS for PostgreSQL, MySQL and MariaDB
|
|
197
|
+
|
|
198
|
+
Use both SQL TLS flags when creating a named PostgreSQL, MySQL or MariaDB profile. This example prompts for the password and tests the connection before saving:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
dbcli init --conn-name verified-pg --system postgresql \
|
|
202
|
+
--host db.example.com --port 5432 --user reader --name appdb \
|
|
203
|
+
--permission query-only --sql-tls verify-full --sql-tls-ca ./certs/root-ca.pem
|
|
204
|
+
dbcli --use verified-pg blacklist list
|
|
205
|
+
dbcli --use verified-pg schema public.events --format json
|
|
206
|
+
dbcli --use verified-pg query "SELECT id FROM public.events LIMIT 10" --format json
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
MySQL and MariaDB use the same flags, with separate named profiles and CA paths. Select the corresponding profile, then check blacklist and schema before an authorized query:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
dbcli init --conn-name verified-mysql --system mysql \
|
|
213
|
+
--host mysql.example.com --port 3306 --user reader --name appdb \
|
|
214
|
+
--permission query-only --sql-tls verify-full --sql-tls-ca ./certs/mysql-ca.pem
|
|
215
|
+
dbcli init --conn-name verified-mariadb --system mariadb \
|
|
216
|
+
--host mariadb.example.com --port 3306 --user reader --name appdb \
|
|
217
|
+
--permission query-only --sql-tls verify-full --sql-tls-ca ./certs/mariadb-ca.pem
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Replace the host, database and table with your authorized target; confirm real columns through schema before querying. The saved connection includes this dedicated SQL object (shown as a connection fragment):
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"sqlTls": {
|
|
225
|
+
"mode": "verify-full",
|
|
226
|
+
"caPath": "/absolute/path/to/certs/root-ca.pem"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
`--sql-tls verify-full` and `--sql-tls-ca <path>` are required together. Empty values, other modes and unsupported engines fail explicitly. PostgreSQL, MySQL and MariaDB support this SQL TLS contract; all other engines reject an explicit request. MongoDB's `tls` and Elasticsearch's TLS settings remain separate. Existing profiles without `sqlTls` keep their previous behavior; no global TLS policy is added. V1 directory and v2 profile reads, normal `init` import from a V1 directory to v2, and the public `migrateV1ToV2` helper preserve the TLS object. A legacy V1 single-file TLS profile remains readable and usable in human mode, but automatic `init` import explicitly refuses it before connecting or writing and leaves the original untouched. For that case, create a verified named profile in a separate configuration directory, verify it, then select it; preserve `sqlTls` throughout migration.
|
|
232
|
+
|
|
233
|
+
`init` resolves a relative CA path against its current working directory before saving. Saved `caPath` must be a nonempty absolute literal path to a PEM CA bundle; it accepts no environment-variable reference. Existing environment references in host/user and other supported fields remain usable. Explicit TLS uses only the selected profile’s CA and identity settings; ambient TLS settings cannot weaken verification or supply another profile’s trust. Each new connection reads the CA bundle again; an unreadable, empty or invalid bundle stops before connecting. `--skip-test` skips only the initialization test, not verification on subsequent use.
|
|
234
|
+
|
|
235
|
+
`verify-full` requires encryption, a trusted certificate chain, valid certificate dates and certificate identity matching the configured DNS name or IP address. Unix sockets are refused for explicit SQL TLS. Untrusted, expired or mismatched certificates and servers without TLS fail before the user query; there is no plaintext retry or verification downgrade. Correct the CA, target hostname or certificate validity before retrying. A cipher alone does not prove identity verification.
|
|
236
|
+
|
|
237
|
+
For TLS error recovery, keep TLS configured and repair the CA, hostname or certificate first. Then deliberately select the configuration with `--config <path>` (or `--global`) and, for v2, the named profile with `--use <name>` (`DBCLI_CONNECTION` is also accepted). The selected profile must still have `sqlTls.mode: verify-full`; missing, ambiguous or plaintext selections block live recovery steps instead of falling back to a default plaintext connection. Saved recovery envelopes redact the original selectors: your current selection is deliberate targeting, not proof of the original target. Recovery apply and verification use the current CLI binary, avoiding an older `dbcli` on PATH. For the MySQL example above:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
bun run src/cli.ts --config .dbcli --use verified-mysql recover --apply --format json
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Permitted reads through an already configured profile remain usable in agent mode; `init` and other configuration mutations remain refused under `DBCLI_AGENT_MODE=1`. TLS does not bypass explicit production selection, native database authorization, permission, blacklist, write-gate or audit controls.
|
|
244
|
+
|
|
245
|
+
For binary rollback, stop workflows that require verified TLS or keep a supporting version. Older binaries may strip `sqlTls`; retaining the profile after downgrading does not preserve the guarantee. Removing TLS settings or retrying in plaintext cannot restore compliance. Local isolated PostgreSQL, MySQL and MariaDB fixture results are not evidence of real RDS acceptance; RDS remains unverified.
|
|
246
|
+
|
|
196
247
|
### use
|
|
197
248
|
|
|
198
249
|
Set, clear, or display the default database connection (v2 multi-connection config).
|
|
@@ -1731,6 +1782,8 @@ Every actionable block carries machine-readable next steps so an agent can move
|
|
|
1731
1782
|
|
|
1732
1783
|
### capabilities
|
|
1733
1784
|
|
|
1785
|
+
`connection.tls` reports PostgreSQL, MySQL and MariaDB support from the engine capability matrix and maps to the existing connection command surfaces; it adds no TLS subcommand. Check with `dbcli --use verified-pg capabilities check --require connection.tls --format json`. `available` means tool support only: it does not prove that this profile configures TLS, the CA is readable, the handshake succeeds, or the operation is authorized. Catalog/check remain offline, read no CA bundle, perform no handshake and change no configuration. Other engines do not report this capability as available; older binaries without the ID return `unknown`. Configuration mutation still requires its own authorization.
|
|
1786
|
+
|
|
1734
1787
|
Discovery. Lists the static dbcli capability catalog — what this tool can do,
|
|
1735
1788
|
described in a versioned shape an external Skill can parse before it starts
|
|
1736
1789
|
working. It never opens a database connection and never writes anything.
|
|
@@ -1868,8 +1921,11 @@ at execution time, and no human has agreed to anything. `admin` in a config file
|
|
|
1868
1921
|
is a permission level, not a DBA sign-off.
|
|
1869
1922
|
|
|
1870
1923
|
`schema.read` is available under `DBCLI_AGENT_MODE=1`, and `dbcli schema` runs
|
|
1871
|
-
there: storing the schema cache is not a configuration change.
|
|
1872
|
-
|
|
1924
|
+
there: storing the schema cache is not a configuration change. `blacklist.read`
|
|
1925
|
+
(`blacklist list`) is available there too, so read-only Task Packs that inspect
|
|
1926
|
+
the blacklist can plan; `blacklist.manage`, which adds and removes rules, is
|
|
1927
|
+
refused. Agent mode still refuses every change to connection identity,
|
|
1928
|
+
permission and credentials.
|
|
1873
1929
|
|
|
1874
1930
|
**Permission:** query-only+ (no connection is made)
|
|
1875
1931
|
|
package/assets/tasks/README.md
CHANGED
|
@@ -33,4 +33,4 @@ The markdown body below the frontmatter is `Agent Notes` and is shown in
|
|
|
33
33
|
|
|
34
34
|
Use `postgresql` for PostgreSQL. The legacy `postgres` engine spelling is read
|
|
35
35
|
as `postgresql`; legacy requirement names `blacklist-list` and `schema-check`
|
|
36
|
-
are rejected with their replacements, `blacklist.
|
|
36
|
+
are rejected with their replacements, `blacklist.read` and `schema.read`.
|
|
@@ -15,7 +15,7 @@ params:
|
|
|
15
15
|
safety:
|
|
16
16
|
mode: plan-only
|
|
17
17
|
requires:
|
|
18
|
-
- blacklist.
|
|
18
|
+
- blacklist.read
|
|
19
19
|
- schema.read
|
|
20
20
|
steps:
|
|
21
21
|
- type: command
|
|
@@ -37,5 +37,7 @@ Use this task before applying a schema migration. It only PLANS — it never run
|
|
|
37
37
|
Save the pre-change `schema {{table}} --format json` output as the baseline. After the
|
|
38
38
|
migration is applied (out of band, via your migration tool), re-run
|
|
39
39
|
`schema {{table}} --format json` and diff the two to confirm the change matches intent.
|
|
40
|
-
Always prepare and record an explicit rollback statement before applying.
|
|
41
|
-
|
|
40
|
+
Always prepare and record an explicit rollback statement before applying.
|
|
41
|
+
Read-only planning and review need no elevated permission beyond this task's existing
|
|
42
|
+
requirements. Running DDL out of band requires `admin` permission — this task neither
|
|
43
|
+
grants that permission nor runs DDL.
|
|
@@ -15,7 +15,7 @@ params:
|
|
|
15
15
|
safety:
|
|
16
16
|
mode: plan-only
|
|
17
17
|
requires:
|
|
18
|
-
- blacklist.
|
|
18
|
+
- blacklist.read
|
|
19
19
|
- schema.read
|
|
20
20
|
steps:
|
|
21
21
|
- type: command
|
|
@@ -34,9 +34,15 @@ steps:
|
|
|
34
34
|
# Agent Notes
|
|
35
35
|
|
|
36
36
|
Use this task when a user wants to backfill or correct existing rows. This task only
|
|
37
|
-
PLANS — it never writes. After reviewing the plan, run the real backfill manually
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
PLANS — it never writes. After reviewing the plan, run the real backfill manually:
|
|
38
|
+
|
|
39
|
+
1. Confirm a narrow `WHERE` clause and capture its scope with a read-only
|
|
40
|
+
`SELECT count(*)` before writing.
|
|
41
|
+
2. Preview the structured write with
|
|
42
|
+
`dbcli update <table> --where "<predicate>" --set '<json>' --dry-run`.
|
|
43
|
+
Keep raw SQL writes in `dbcli plan "<sql>"`; `query` does not dry-run arbitrary writes.
|
|
44
|
+
3. Once the preview looks correct, re-run the write command without `--dry-run`
|
|
45
|
+
and with the required confirmation/force flag for your environment. The existing
|
|
46
|
+
write gate still applies; execution requires read-write (or higher) permission.
|
|
47
|
+
4. Read the rows back afterwards to confirm the backfill achieved its goal. If the
|
|
48
|
+
result does not match, stop and investigate before attempting another write.
|