@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/.cursor/rules/dbcli.mdc
CHANGED
|
@@ -152,6 +152,14 @@ dbcli capabilities check --require schema.read,query.read # gate your wo
|
|
|
152
152
|
dbcli capabilities check --require data.delete --format json # machine-readable
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
`connection.tls` derives support from the engine matrix and maps to existing
|
|
156
|
+
connection command surfaces, supporting PostgreSQL, MySQL and MariaDB. It adds
|
|
157
|
+
no TLS subcommand. Check with
|
|
158
|
+
`dbcli capabilities check --require connection.tls --format json`.
|
|
159
|
+
`available` establishes tool support only, not TLS configuration, readable CA,
|
|
160
|
+
a successful handshake or authorization. Catalog/check stay offline, read no CA
|
|
161
|
+
and change no configuration. Older binaries without this ID return `unknown`.
|
|
162
|
+
|
|
155
163
|
For a copyable Bun/TypeScript consumer with strict parsing, schema pins, exit handling,
|
|
156
164
|
Operation Envelope handling, Task Pack `safety.requires`, and correlation/evidence guidance,
|
|
157
165
|
start with `assets/integration-kit/README.md`.
|
|
@@ -326,6 +334,44 @@ or `doctor` / `status` reports a missing or invalid config, follow this flow.
|
|
|
326
334
|
> If a `.dbcli` already contains `{"$env": "..."}` references, **do not** rerun
|
|
327
335
|
> `init` to "fill them in" — the env-ref form is intentional for CI/multi-env.
|
|
328
336
|
|
|
337
|
+
### PostgreSQL, MySQL and MariaDB verified TLS
|
|
338
|
+
|
|
339
|
+
When verified TLS is required, use the named `init` entry with both
|
|
340
|
+
`--sql-tls verify-full --sql-tls-ca <path>`. PostgreSQL, MySQL and MariaDB support this SQL
|
|
341
|
+
contract; explicit requests on other engines fail. The saved
|
|
342
|
+
`sqlTls: { mode: 'verify-full', caPath: '/absolute/path/root-ca.pem' }` uses an
|
|
343
|
+
absolute literal PEM path; `init` resolves relative paths from cwd. CA environment
|
|
344
|
+
references are unsupported. Existing host/user environment references and profiles
|
|
345
|
+
without `sqlTls` keep their behavior. V1 directory/v2 reads, normal `init` import
|
|
346
|
+
from a V1 directory and `migrateV1ToV2` preserve TLS. Legacy V1 single-file TLS
|
|
347
|
+
profiles remain readable/usable in human mode; automatic `init` import refuses
|
|
348
|
+
before connecting or writing, preserving the original. Migrate that case by
|
|
349
|
+
creating a verified named profile in a separate config directory, verifying it,
|
|
350
|
+
then selecting it; preserve `sqlTls` throughout.
|
|
351
|
+
|
|
352
|
+
Ambient TLS settings cannot weaken verification or supply another profile’s trust.
|
|
353
|
+
Each connection reloads its own CA and verifies encryption, trust, validity and the
|
|
354
|
+
configured DNS/IP identity; explicit SQL TLS refuses Unix sockets. Failures stop
|
|
355
|
+
before the user query. Repair the CA, hostname or certificate; keep verification
|
|
356
|
+
and TLS required. On binary rollback, stop TLS-required workflows or retain a
|
|
357
|
+
supporting version: older binaries may strip `sqlTls`. Local fixture evidence does
|
|
358
|
+
not establish real RDS acceptance. Configured permitted reads work in agent mode;
|
|
359
|
+
`init` and other configuration changes remain refused.
|
|
360
|
+
|
|
361
|
+
For TLS error recovery, repair certificates while retaining TLS, then explicitly
|
|
362
|
+
select `--config <path>` or `--global`; v2 also requires `--use <name>` or
|
|
363
|
+
`DBCLI_CONNECTION`. The selected profile must retain `sqlTls.mode: verify-full`.
|
|
364
|
+
Missing, ambiguous or plaintext selections block live steps. Saved envelopes
|
|
365
|
+
redact original selectors, so current targeting does not establish original
|
|
366
|
+
provenance. Apply and verification use the current CLI binary. Example:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
bun run src/cli.ts --config .dbcli --use verified-mysql recover --apply --format json
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
For the complete configuration, example and failure contract, read
|
|
373
|
+
[SQL verified TLS](../skills/dbcli/reference.md#verified-tls-for-postgresql-mysql-and-mariadb).
|
|
374
|
+
|
|
329
375
|
### Decision tree (ask before writing)
|
|
330
376
|
|
|
331
377
|
1. **What is the connection name?** Every new connection uses named v2, even
|
|
@@ -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
|
|
|
@@ -152,6 +152,14 @@ dbcli capabilities check --require schema.read,query.read # gate your wo
|
|
|
152
152
|
dbcli capabilities check --require data.delete --format json # machine-readable
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
`connection.tls` derives support from the engine matrix and maps to existing
|
|
156
|
+
connection command surfaces, supporting PostgreSQL, MySQL and MariaDB. It adds
|
|
157
|
+
no TLS subcommand. Check with
|
|
158
|
+
`dbcli capabilities check --require connection.tls --format json`.
|
|
159
|
+
`available` establishes tool support only, not TLS configuration, readable CA,
|
|
160
|
+
a successful handshake or authorization. Catalog/check stay offline, read no CA
|
|
161
|
+
and change no configuration. Older binaries without this ID return `unknown`.
|
|
162
|
+
|
|
155
163
|
For a copyable Bun/TypeScript consumer with strict parsing, schema pins, exit handling,
|
|
156
164
|
Operation Envelope handling, Task Pack `safety.requires`, and correlation/evidence guidance,
|
|
157
165
|
start with `assets/integration-kit/README.md`.
|
|
@@ -326,6 +334,44 @@ or `doctor` / `status` reports a missing or invalid config, follow this flow.
|
|
|
326
334
|
> If a `.dbcli` already contains `{"$env": "..."}` references, **do not** rerun
|
|
327
335
|
> `init` to "fill them in" — the env-ref form is intentional for CI/multi-env.
|
|
328
336
|
|
|
337
|
+
### PostgreSQL, MySQL and MariaDB verified TLS
|
|
338
|
+
|
|
339
|
+
When verified TLS is required, use the named `init` entry with both
|
|
340
|
+
`--sql-tls verify-full --sql-tls-ca <path>`. PostgreSQL, MySQL and MariaDB support this SQL
|
|
341
|
+
contract; explicit requests on other engines fail. The saved
|
|
342
|
+
`sqlTls: { mode: 'verify-full', caPath: '/absolute/path/root-ca.pem' }` uses an
|
|
343
|
+
absolute literal PEM path; `init` resolves relative paths from cwd. CA environment
|
|
344
|
+
references are unsupported. Existing host/user environment references and profiles
|
|
345
|
+
without `sqlTls` keep their behavior. V1 directory/v2 reads, normal `init` import
|
|
346
|
+
from a V1 directory and `migrateV1ToV2` preserve TLS. Legacy V1 single-file TLS
|
|
347
|
+
profiles remain readable/usable in human mode; automatic `init` import refuses
|
|
348
|
+
before connecting or writing, preserving the original. Migrate that case by
|
|
349
|
+
creating a verified named profile in a separate config directory, verifying it,
|
|
350
|
+
then selecting it; preserve `sqlTls` throughout.
|
|
351
|
+
|
|
352
|
+
Ambient TLS settings cannot weaken verification or supply another profile’s trust.
|
|
353
|
+
Each connection reloads its own CA and verifies encryption, trust, validity and the
|
|
354
|
+
configured DNS/IP identity; explicit SQL TLS refuses Unix sockets. Failures stop
|
|
355
|
+
before the user query. Repair the CA, hostname or certificate; keep verification
|
|
356
|
+
and TLS required. On binary rollback, stop TLS-required workflows or retain a
|
|
357
|
+
supporting version: older binaries may strip `sqlTls`. Local fixture evidence does
|
|
358
|
+
not establish real RDS acceptance. Configured permitted reads work in agent mode;
|
|
359
|
+
`init` and other configuration changes remain refused.
|
|
360
|
+
|
|
361
|
+
For TLS error recovery, repair certificates while retaining TLS, then explicitly
|
|
362
|
+
select `--config <path>` or `--global`; v2 also requires `--use <name>` or
|
|
363
|
+
`DBCLI_CONNECTION`. The selected profile must retain `sqlTls.mode: verify-full`.
|
|
364
|
+
Missing, ambiguous or plaintext selections block live steps. Saved envelopes
|
|
365
|
+
redact original selectors, so current targeting does not establish original
|
|
366
|
+
provenance. Apply and verification use the current CLI binary. Example:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
bun run src/cli.ts --config .dbcli --use verified-mysql recover --apply --format json
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
For the complete configuration, example and failure contract, read
|
|
373
|
+
[SQL verified TLS](reference.md#verified-tls-for-postgresql-mysql-and-mariadb).
|
|
374
|
+
|
|
329
375
|
### Decision tree (ask before writing)
|
|
330
376
|
|
|
331
377
|
1. **What is the connection name?** Every new connection uses named v2, even
|
|
@@ -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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,94 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [12.1.0] - 2026-10-23
|
|
11
|
+
|
|
12
|
+
版本為 **12.1.0**。新增 PostgreSQL、MySQL 與 MariaDB 的驗證式 TLS 設定(verified TLS profiles),
|
|
13
|
+
支援以 `--sql-tls verify-full --sql-tls-ca <path>` 指定 CA 憑證路徑,並於連線時嚴格驗證信任鏈、有效期與目標主機身分(DNS/IP SAN)。
|
|
14
|
+
本版本維持向下相容,未啟用 TLS 的既有連線 profile 行為不變。
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **PostgreSQL / MySQL / MariaDB 驗證式 TLS 連線支援**:具名連線設定增加 `sqlTls: { mode: 'verify-full', caPath: string }` 規格;
|
|
19
|
+
`init` 命令新增成對參數 `--sql-tls verify-full --sql-tls-ca <path>`。連線建立時重新讀取 CA bundle 並驗證伺服器憑證主機身分與信任鏈;
|
|
20
|
+
任何驗證失敗立即中止,不降級、不重試明文、不關閉身分驗證。
|
|
21
|
+
- **離線 capabilities 發現更新**:`connection.tls` capability matrix 宣告支援 PostgreSQL、MySQL 與 MariaDB,
|
|
22
|
+
支援透過離線 inspect/check 查詢能力。
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **工作流程精簡**:正式退役 ForgePilot 流程,採用 Warrant 授權導向工作流程;精簡 release 驗證門檻與證據交接規範。
|
|
27
|
+
|
|
28
|
+
## [12.0.0] - 2026-10-18
|
|
29
|
+
|
|
30
|
+
版本為 **12.0.0**。SQL 單一物件 `schema` 現在將含點號的輸入解析為完整名稱,
|
|
31
|
+
會改變既有命令的查詢對象,因此採用 major 版本。升級前請檢查含點號的名稱、依賴完整
|
|
32
|
+
schema metadata 的腳本、SHOW GRANTS 輸出用途,以及原生授權錯誤的處理分支。
|
|
33
|
+
本版不需要連線設定、schema 快取或 recovery envelope 的資料遷移。
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- **assert --expect 的 evidence receipt**:只投影檢查 pass bits,沿用既有 schema,
|
|
38
|
+
排除原始 SQL 與結果值;成功與失敗斷言都可產生 receipt。`--no-fail` 只影響斷言退出碼,
|
|
39
|
+
失敗 receipt 不會變成功,receipt 寫入失敗仍 exit 1。
|
|
40
|
+
- **MongoDB Unix socket URI 與錯誤去敏**:`init --uri` 與互動貼上的 Unix socket
|
|
41
|
+
連線字串保留原始 `uri`、認證與 options,不再拆成 TCP host/port;既有明文儲存警告
|
|
42
|
+
仍會顯示。URI fallback 連線測試失敗時,同時遮蔽原始 URI、編碼及解碼後的密碼。
|
|
43
|
+
- **內建 task pack 的操作指引**:`safe-backfill` 改用真實支援的
|
|
44
|
+
`update ... --dry-run`,raw SQL 的預覽使用 `plan`;移除不存在的 `query --dry-run`
|
|
45
|
+
與 `--execute` 指引,實際寫入仍需既有確認與權限。`migration-review` 說明執行 DDL
|
|
46
|
+
需要 `admin`,唯讀規劃不升權,也不執行 DDL。
|
|
47
|
+
- **CLI 啟動 bundle**:建置使用 syntax minification 降低 runtime bundle 大小,
|
|
48
|
+
維持啟動效能預算;保留 whitespace,避免 Bun 對動態 import 的錯誤改寫。
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- **單一物件 schema 支援完整名稱**:PostgreSQL 可用 `schema.table`,MySQL/MariaDB
|
|
53
|
+
可用 `database.table` 檢視表與系統視圖;支援原生識別字引用、內嵌點號與跳脫引號。
|
|
54
|
+
完整名稱不可搭配 `--refresh`/`--reset`,不改連線設定或 schema 快取,也不擴大掃描範圍。
|
|
55
|
+
- **`blacklist.read` capability 與 agent-mode task planning**:唯讀的 `blacklist list`
|
|
56
|
+
有獨立 capability,內建需要檢視 blacklist 的 task pack 改用它;`connection-health`
|
|
57
|
+
不要求 blacklist capability。引擎與權限符合時,`DBCLI_AGENT_MODE=1` 可產生這些
|
|
58
|
+
plan-only 計畫;`blacklist.manage` 仍是設定異動,在 agent mode 下不可用。
|
|
59
|
+
規劃不執行任何步驟,也不授予執行權限。
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- **文件釐清 RDS CALL 證據交接**:query-only 仍拒絕 CALL,未新增 RDS 程序支援。
|
|
64
|
+
區分 CLI 政策拒絕與 DBA 的 indeterminate(證據不足)結論,提供既有授權內的人工
|
|
65
|
+
交接模板,並區分 binlog 保留小時與自動快照保留天數;不以升權或 AWS 自動化作為補救。
|
|
66
|
+
- **SHOW GRANTS 認證內容去敏**:MySQL/MariaDB 的正常與 native-read-only 執行,
|
|
67
|
+
一律在 adapter 回傳前把可安全辨識的認證參數換成 `[REDACTED]`,保留帳號、角色、
|
|
68
|
+
授權範圍與權限;未知、不完整或歧義格式及異常型態則整格改為
|
|
69
|
+
`[OMITTED: grant text could not be safely redacted]`,保留列數、欄名與結果結構。
|
|
70
|
+
query、互動 shell 與 SQL 查詢 export 的適用輸出格式均受保護,不依賴 blacklist,
|
|
71
|
+
所有權限與 agent 模式均無 bypass。省略格不代表完整授權資訊,去敏結果不可作為可重播 SQL。
|
|
72
|
+
僅涵蓋 SHOW GRANTS;SHOW CREATE USER、直接系統表查詢與任意 SQL 不在掃描範圍,
|
|
73
|
+
saved query 仍拒絕 SHOW GRANTS。
|
|
74
|
+
- **原生授權錯誤代碼**:MySQL/MariaDB 1044、1142、1143、1227 與 PostgreSQL
|
|
75
|
+
`42501` 現在分類為 `DB_PERMISSION_DENIED`,與登入驗證失敗 `AUTH_FAILED` 及本機政策
|
|
76
|
+
`PERMISSION_DENIED` 區分。Recovery 維持 schema v1 與 `error.code: "PERMISSION_DENIED"`,
|
|
77
|
+
以 `error.details.connectionCode: "DB_PERMISSION_DENIED"` 識別原生拒絕;只提供人工指引,
|
|
78
|
+
`recovery: []` 並省略 `verify`,`recover --apply` 不執行修復。既有 envelope 無需遷移,
|
|
79
|
+
呼叫端須依新 discriminator 區分拒絕來源。
|
|
80
|
+
- **Schema 輸出與 metadata 保護**:完整名稱 JSON 保留局部 `name` 並另帶 `schema`,
|
|
81
|
+
文字輸出可區分兩個 component;`tableType` 正確呈現 table/view(materialized view 為 view)。
|
|
82
|
+
完整名稱不執行關係資料 `COUNT(*)`,未知筆數與大小分類為 null,不再以假零值或 small 表示。
|
|
83
|
+
舊、新 SQL 單一物件名稱都套用 blacklist;隱藏受保護欄位及涉及它的整項主鍵、索引與外鍵,
|
|
84
|
+
無法安全表達完整欄位相依性的 expression/partial index 也會整項省略;省略時 JSON 輸出
|
|
85
|
+
`metadataOmitted: true`,文字輸出顯示省略通知,回傳 metadata 不保證完整。
|
|
86
|
+
必要 metadata 讀取失敗會回報失敗,不以空集合冒充成功;省略不代表該 metadata 不存在。
|
|
87
|
+
MySQL/MariaDB 的 `indexes[].unique` 正規化為宣告的 boolean 型別,不再輸出 driver 的
|
|
88
|
+
數字 0/1;複合外鍵欄位順序與目標 namespace 依 catalog 正確呈現。
|
|
89
|
+
- **破壞性變更:含點號名稱的解析**:原本 `dbcli schema audit.orders` 查詢預設
|
|
90
|
+
namespace 中字面名稱為 `audit.orders` 的物件,現在會查詢 namespace `audit` 中的
|
|
91
|
+
`orders`。PostgreSQL 原本的局部含點號名稱須改成
|
|
92
|
+
`dbcli schema 'public."audit.orders"' --format json`;MySQL/MariaDB 以 backtick
|
|
93
|
+
分別引用 database 與局部名稱,例如
|
|
94
|
+
``dbcli schema '`reporting`.`audit.orders`' --format json``,仍須符合該引擎允許的名稱規則。
|
|
95
|
+
未限定且不含點號的名稱維持 PostgreSQL `public`/MySQL、MariaDB 預設 database 與既有
|
|
96
|
+
精確名稱語意。完整名稱不存在時不會退回預設 namespace 的同名物件;其他命令的名稱解析不變。
|
|
97
|
+
|
|
10
98
|
## [11.0.0] - 2026-10-14
|
|
11
99
|
|
|
12
100
|
版本為 **11.0.0**。`dbcli init --uri` 寫出的設定形狀改變,且 `--uri` 與欄位 flag 並用會報錯,
|
package/README.md
CHANGED
|
@@ -1756,10 +1756,9 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for full setup, testing, and release pr
|
|
|
1756
1756
|
|
|
1757
1757
|
## Governance
|
|
1758
1758
|
|
|
1759
|
-
For people changing this repository.
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
normally.
|
|
1759
|
+
For people changing this repository. Warrant governs approved intent;
|
|
1760
|
+
`make verify` and human review establish whether that intent is satisfied.
|
|
1761
|
+
Work is selected directly by a human and needs no external scheduler.
|
|
1763
1762
|
|
|
1764
1763
|
### How work is specified: Warrant
|
|
1765
1764
|
|
|
@@ -1767,26 +1766,30 @@ Each unit of work is a Story: one file, `specs/stories/<slug>.md`, with exactly
|
|
|
1767
1766
|
three sections — Goal, Out of Scope, and Acceptance Criteria. A Story is
|
|
1768
1767
|
approved only when a human commits it to the default branch or explicitly
|
|
1769
1768
|
assigns it in the current session; an agent never approves its own. The
|
|
1770
|
-
contract agents follow is the
|
|
1769
|
+
contract agents follow is the intent, verification and review section of `AGENTS.md`, and
|
|
1771
1770
|
`specs/stories/README.md` describes the format. The `DBCLI-*` directories under
|
|
1772
1771
|
`specs/stories/` are legacy records from an earlier protocol, not pending work.
|
|
1773
1772
|
|
|
1774
1773
|
Warrant defines what a Story must contain and what counts as evidence: every
|
|
1775
1774
|
acceptance criterion needs a reproducible observation, and the requirements,
|
|
1776
|
-
criteria, and scope stay as the human approved them.
|
|
1777
|
-
`make verify` decide when it is done.
|
|
1775
|
+
criteria, and scope stay as the human approved them.
|
|
1778
1776
|
|
|
1779
|
-
### When work is done:
|
|
1777
|
+
### When work is done: `make verify` and human review
|
|
1780
1778
|
|
|
1781
1779
|
`make verify` is the automated completion authority. Passing it makes work
|
|
1782
1780
|
*eligible* for human review; it does not approve or merge anything. Do not
|
|
1783
1781
|
bypass verification or delete failing tests to obtain a pass.
|
|
1784
1782
|
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1783
|
+
Verification and review must refer to the same candidate. A clean committed PR
|
|
1784
|
+
may use CI evidence for its actual checkout revision. An uncommitted candidate
|
|
1785
|
+
uses a local handoff with reconstructable source content, verification output,
|
|
1786
|
+
criterion observations and human review. Follow the
|
|
1787
|
+
[evidence paths](docs/development/agent-workflow.md#choose-one-evidence-record);
|
|
1788
|
+
a passing run for different source content does not verify the current work.
|
|
1789
|
+
|
|
1790
|
+
ForgePilot is no longer used by this project. Its ignored `.forgepilot/` data
|
|
1791
|
+
and historical records remain available; global tools and skills are unaffected.
|
|
1792
|
+
The decision is recorded in [ADR-0051](docs/adr/ADR-0051-retire-forgepilot-from-the-repository-workflow.md).
|
|
1790
1793
|
|
|
1791
1794
|
### Where decisions live: `docs/adr/`
|
|
1792
1795
|
|
package/assets/SKILL.md
CHANGED
|
@@ -152,6 +152,14 @@ dbcli capabilities check --require schema.read,query.read # gate your wo
|
|
|
152
152
|
dbcli capabilities check --require data.delete --format json # machine-readable
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
+
`connection.tls` derives support from the engine matrix and maps to existing
|
|
156
|
+
connection command surfaces, supporting PostgreSQL, MySQL and MariaDB. It adds
|
|
157
|
+
no TLS subcommand. Check with
|
|
158
|
+
`dbcli capabilities check --require connection.tls --format json`.
|
|
159
|
+
`available` establishes tool support only, not TLS configuration, readable CA,
|
|
160
|
+
a successful handshake or authorization. Catalog/check stay offline, read no CA
|
|
161
|
+
and change no configuration. Older binaries without this ID return `unknown`.
|
|
162
|
+
|
|
155
163
|
For a copyable Bun/TypeScript consumer with strict parsing, schema pins, exit handling,
|
|
156
164
|
Operation Envelope handling, Task Pack `safety.requires`, and correlation/evidence guidance,
|
|
157
165
|
start with `assets/integration-kit/README.md`.
|
|
@@ -326,6 +334,44 @@ or `doctor` / `status` reports a missing or invalid config, follow this flow.
|
|
|
326
334
|
> If a `.dbcli` already contains `{"$env": "..."}` references, **do not** rerun
|
|
327
335
|
> `init` to "fill them in" — the env-ref form is intentional for CI/multi-env.
|
|
328
336
|
|
|
337
|
+
### PostgreSQL, MySQL and MariaDB verified TLS
|
|
338
|
+
|
|
339
|
+
When verified TLS is required, use the named `init` entry with both
|
|
340
|
+
`--sql-tls verify-full --sql-tls-ca <path>`. PostgreSQL, MySQL and MariaDB support this SQL
|
|
341
|
+
contract; explicit requests on other engines fail. The saved
|
|
342
|
+
`sqlTls: { mode: 'verify-full', caPath: '/absolute/path/root-ca.pem' }` uses an
|
|
343
|
+
absolute literal PEM path; `init` resolves relative paths from cwd. CA environment
|
|
344
|
+
references are unsupported. Existing host/user environment references and profiles
|
|
345
|
+
without `sqlTls` keep their behavior. V1 directory/v2 reads, normal `init` import
|
|
346
|
+
from a V1 directory and `migrateV1ToV2` preserve TLS. Legacy V1 single-file TLS
|
|
347
|
+
profiles remain readable/usable in human mode; automatic `init` import refuses
|
|
348
|
+
before connecting or writing, preserving the original. Migrate that case by
|
|
349
|
+
creating a verified named profile in a separate config directory, verifying it,
|
|
350
|
+
then selecting it; preserve `sqlTls` throughout.
|
|
351
|
+
|
|
352
|
+
Ambient TLS settings cannot weaken verification or supply another profile’s trust.
|
|
353
|
+
Each connection reloads its own CA and verifies encryption, trust, validity and the
|
|
354
|
+
configured DNS/IP identity; explicit SQL TLS refuses Unix sockets. Failures stop
|
|
355
|
+
before the user query. Repair the CA, hostname or certificate; keep verification
|
|
356
|
+
and TLS required. On binary rollback, stop TLS-required workflows or retain a
|
|
357
|
+
supporting version: older binaries may strip `sqlTls`. Local fixture evidence does
|
|
358
|
+
not establish real RDS acceptance. Configured permitted reads work in agent mode;
|
|
359
|
+
`init` and other configuration changes remain refused.
|
|
360
|
+
|
|
361
|
+
For TLS error recovery, repair certificates while retaining TLS, then explicitly
|
|
362
|
+
select `--config <path>` or `--global`; v2 also requires `--use <name>` or
|
|
363
|
+
`DBCLI_CONNECTION`. The selected profile must retain `sqlTls.mode: verify-full`.
|
|
364
|
+
Missing, ambiguous or plaintext selections block live steps. Saved envelopes
|
|
365
|
+
redact original selectors, so current targeting does not establish original
|
|
366
|
+
provenance. Apply and verification use the current CLI binary. Example:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
bun run src/cli.ts --config .dbcli --use verified-mysql recover --apply --format json
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
For the complete configuration, example and failure contract, read
|
|
373
|
+
[SQL verified TLS](reference.md#verified-tls-for-postgresql-mysql-and-mariadb).
|
|
374
|
+
|
|
329
375
|
### Decision tree (ask before writing)
|
|
330
376
|
|
|
331
377
|
1. **What is the connection name?** Every new connection uses named v2, even
|