@carllee1983/dbcli 12.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 +54 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +46 -0
- package/.github/skills/dbcli/reference.md +54 -1
- package/CHANGELOG.md +18 -0
- package/README.md +16 -13
- package/assets/SKILL.md +46 -0
- package/assets/reference.md +54 -1
- package/dist/cli-runtime.mjs +2097 -1807
- package/dist/cli.mjs +2 -1
- package/dist/core.d.ts +629 -562
- package/dist/core.mjs +6185 -6094
- 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 +54 -1
- package/skills/dbcli/SKILL.md +46 -0
- package/skills/dbcli/reference.md +54 -1
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.
|
|
@@ -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.
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ 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
|
+
|
|
10
28
|
## [12.0.0] - 2026-10-18
|
|
11
29
|
|
|
12
30
|
版本為 **12.0.0**。SQL 單一物件 `schema` 現在將含點號的輸入解析為完整名稱,
|
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
|
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.
|