@carllee1983/dbcli 1.37.1 → 1.38.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 +192 -281
- package/.cursor/skills/dbcli/reference.md +68 -0
- package/.github/skills/dbcli/SKILL.md +192 -281
- package/.github/skills/dbcli/reference.md +68 -0
- package/CHANGELOG.md +16 -0
- package/assets/SKILL.md +192 -281
- package/assets/SKILL.zh-TW.md +211 -331
- package/assets/reference.md +68 -0
- package/dist/cli.mjs +506 -24
- package/dist/core.mjs +1 -1
- package/package.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +192 -281
- package/plugins/dbcli-agent/skills/dbcli/reference.md +68 -0
- package/skills/dbcli/SKILL.md +192 -281
- package/skills/dbcli/reference.md +68 -0
|
@@ -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
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to dbcli are documented here.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.38.1] - 2026-06-23 - Redis delete 能力對齊 & SKILL.md 任務路由重構
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Redis `delete` 能力宣告由 `unsupported` 修正為 `limited` / `db-write`。** `delete.ts` 早已具備完整的 Redis 刪除分支(`DEL` / `HDEL` / `LREM` / `SREM` / `ZREM`、data-admin 權限閘、`--dry-run`、黑名單、稽核),但 `capabilities.ts` 仍宣告為 `unsupported`,與實作矛盾,導致能力表低報 Redis 刪除支援。改宣告為 `limited`(`db-write`,標註「基本刪除,需 data-admin、支援 `--dry-run`」)以對齊實作。於 SKILL.md 的 src 驗證期間發現。
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **`assets/SKILL.md` 重構為任務路由決策樹。** 由原先結構改寫為以任務為導向的決策樹(task-routing decision tree),讓安裝 skill 的 agent 能依任務類型快速定位對應的指令工作流。純文件結構調整,無程式行為更動。
|
|
17
|
+
|
|
18
|
+
## [1.38.0] - 2026-06-22 - verify constraint Scenario
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`dbcli verify constraint` 情境執行器(第四個內建 verify 情境)。** 以 preflight / after-write 兩種模式驗證「資料完整性不變式是否成立」,且**永遠不執行寫入或 DDL** — 只執行唯讀 `COUNT(*)` 違規查詢。以 `--check <kind>` 選擇四種限制類型:`fk`(孤兒列,需 `--column` + `--references <table.column>`)、`not-null`(NULL 值統計,`--column` 可重複)、`unique`(重複值統計,`--column` 可重複)、`custom`(呼叫端自訂的唯讀 `--violation-query <sql>`)。預設 threshold 為 `0`(嚴格:零違規即通過);啟用 `--allow-preexisting` + `--baseline <n>` 可改為無回退模式(after-write 筆數 ≤ preflight baseline 即通過)。文物沿用 `subject.kind = 'table'`、`subject.command = 'verify constraint'`,artifact schema 與版本不變。MVP 僅限 SQL 引擎,FK 僅支援單一子欄位。
|
|
23
|
+
|
|
8
24
|
## [1.37.1] - 2026-06-22 - Skill Documentation Parity for verify rollback
|
|
9
25
|
|
|
10
26
|
### Fixed
|