@carllee1983/dbcli 1.37.1 → 1.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/dbcli.mdc +204 -282
- package/.cursor/skills/dbcli/reference.md +68 -0
- package/.github/skills/dbcli/SKILL.md +204 -282
- package/.github/skills/dbcli/reference.md +68 -0
- package/CHANGELOG.md +32 -0
- package/assets/SKILL.md +204 -282
- package/assets/SKILL.zh-TW.md +220 -331
- package/assets/reference.md +68 -0
- package/assets/ui-template.html +8 -8
- package/dist/cli.mjs +564 -72
- package/dist/core.mjs +14 -3
- package/dist/ui-style.css +1 -1
- package/package.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +204 -282
- package/plugins/dbcli-agent/skills/dbcli/reference.md +68 -0
- package/skills/dbcli/SKILL.md +204 -282
- package/skills/dbcli/reference.md +68 -0
package/assets/reference.md
CHANGED
|
@@ -1294,6 +1294,74 @@ The artifact schema is unchanged: a rollback reuses the existing subject kinds
|
|
|
1294
1294
|
`subject.command = "verify rollback"` plus the summary, so `verification` filters and
|
|
1295
1295
|
retention are unaffected.
|
|
1296
1296
|
|
|
1297
|
+
#### `verify constraint`
|
|
1298
|
+
|
|
1299
|
+
(v1.38.0+) Preflight or after-write verification that a **data-integrity invariant holds**
|
|
1300
|
+
across your change — foreign-key consistency, NOT NULL coverage, uniqueness, or a custom
|
|
1301
|
+
violation query. **This command never executes a write** — it only runs read-only
|
|
1302
|
+
`COUNT(*)` violation queries against the live table and (in after-write mode) records
|
|
1303
|
+
evidence. Four check kinds, selected by `--check`:
|
|
1304
|
+
|
|
1305
|
+
- `--check fk` — counts orphaned rows in the child table. Requires `--column` (the child
|
|
1306
|
+
FK column) and `--references <table.column>` (the referenced parent column).
|
|
1307
|
+
- `--check not-null` — counts rows where the column value is NULL. `--column` is
|
|
1308
|
+
repeatable; each column is checked independently.
|
|
1309
|
+
- `--check unique` — counts duplicate values in one or more columns. `--column` is
|
|
1310
|
+
repeatable; all listed columns are combined into a single uniqueness check.
|
|
1311
|
+
- `--check custom` — executes the caller-supplied `--violation-query <sql>`, which must
|
|
1312
|
+
be a plain read-only `SELECT` returning a single integer count of violations.
|
|
1313
|
+
|
|
1314
|
+
```bash
|
|
1315
|
+
# FK preflight — verify no orphaned orders before a migration.
|
|
1316
|
+
dbcli verify constraint \
|
|
1317
|
+
--table orders \
|
|
1318
|
+
--check fk \
|
|
1319
|
+
--column customer_id \
|
|
1320
|
+
--references customers.id
|
|
1321
|
+
|
|
1322
|
+
# NOT NULL preflight — verify the column is fully populated.
|
|
1323
|
+
dbcli verify constraint \
|
|
1324
|
+
--table users \
|
|
1325
|
+
--check not-null \
|
|
1326
|
+
--column email
|
|
1327
|
+
|
|
1328
|
+
# After the write is applied externally — record evidence.
|
|
1329
|
+
dbcli verify constraint --table orders --check fk --column customer_id \
|
|
1330
|
+
--references customers.id --after-write
|
|
1331
|
+
|
|
1332
|
+
# JSON output for agents.
|
|
1333
|
+
dbcli verify constraint --table users --check not-null --column email --format json
|
|
1334
|
+
```
|
|
1335
|
+
|
|
1336
|
+
| Option | Required | Description |
|
|
1337
|
+
| --- | --- | --- |
|
|
1338
|
+
| `--table <table>` | yes | Table the invariant is checked on. |
|
|
1339
|
+
| `--check <kind>` | yes | Constraint kind: `fk` \| `not-null` \| `unique` \| `custom`. |
|
|
1340
|
+
| `--column <name>` | yes (fk/not-null/unique) | Column to check. Repeatable for `not-null`/`unique`; the child FK column for `fk`. |
|
|
1341
|
+
| `--references <table.column>` | yes (fk only) | Referenced `<table>.<column>` for the FK parent lookup. |
|
|
1342
|
+
| `--violation-query <sql>` | yes (custom only) | Read-only `SELECT` returning a single integer count of violations. |
|
|
1343
|
+
| `--allow-preexisting` | no | Tolerate pre-existing violations: verified when `count ≤ --baseline` (default: `false`). |
|
|
1344
|
+
| `--baseline <n>` | no | Baseline violation count measured at preflight (use with `--allow-preexisting`). |
|
|
1345
|
+
| `--after-write` | no | Re-run the violation count and write a v1 verification artifact. |
|
|
1346
|
+
| `--format <table\|json>` | no | Output format, default `table`. |
|
|
1347
|
+
| `--subject-name <name>` | no | Artifact subject name. Default is the table name. |
|
|
1348
|
+
| `--summary <text>` | no | Optional artifact summary override (after-write mode). |
|
|
1349
|
+
|
|
1350
|
+
**Verdict rules.** Preflight returns `ready` or `blocked`; **`ready` is not `verified`**.
|
|
1351
|
+
After-write maps the violation count to `verified` (violations ≤ threshold) or
|
|
1352
|
+
`not_verified` (violations > threshold), and a failed guard to `blocked`; a query error
|
|
1353
|
+
yields `indeterminate`. The default threshold is `0` (strict: zero violations allowed).
|
|
1354
|
+
With `--allow-preexisting`, the threshold is the `--baseline` count captured at preflight,
|
|
1355
|
+
so the no-regression rule passes as long as the after-write count does not exceed the
|
|
1356
|
+
preflight count.
|
|
1357
|
+
|
|
1358
|
+
**MVP restrictions.** SQL engines only (PostgreSQL / MySQL / MariaDB — requires an active
|
|
1359
|
+
`--config` connection). FK checks support a single child column; composite FK constraints
|
|
1360
|
+
are not yet supported. The command never executes any write or DDL statement.
|
|
1361
|
+
|
|
1362
|
+
The artifact uses `subject.kind = 'table'` and `subject.command = 'verify constraint'`,
|
|
1363
|
+
so `verification` filters and retention are unaffected by the new scenario.
|
|
1364
|
+
|
|
1297
1365
|
### verification
|
|
1298
1366
|
|
|
1299
1367
|
(v1.33.0+) Local **VerificationArtifact** inspection and lifecycle surface over
|