@carllee1983/dbcli 1.37.0 → 1.37.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbcli-agent",
3
- "version": "1.37.0",
3
+ "version": "1.37.1",
4
4
  "description": "Database CLI skill and command reference for AI agents.",
5
5
  "author": {
6
6
  "name": "Carl Lee",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbcli-agent",
3
- "version": "1.37.0",
3
+ "version": "1.37.1",
4
4
  "description": "Database CLI skill and command reference for AI agents",
5
5
  "author": {
6
6
  "name": "Carl Lee",
@@ -160,6 +160,7 @@ Developer workflow guardrails:
160
160
  (`--after-write`) when durable evidence is required. Never executes the write.
161
161
  - `tasks plan migration-review` — when the user needs a migration plan only (plan output, no DDL executed).
162
162
  - `verify migration` — preflight a schema migration (analyze DDL, run guards) and after the migration is applied externally (`--after-write`) to record evidence. Never executes DDL.
163
+ - `verify rollback --kind <ddl|dml>` — verify that a reverting change restored the prior state: preflight analyzes the reverting `ALTER TABLE` (`--kind ddl`) or `UPDATE` (`--kind dml`) via `--statement`, and `--after-write` records evidence after you apply it externally. Never executes the statement.
163
164
  - `verification show <id>` — cite the final artifact.
164
165
 
165
166
  Full flags, per-command copy-paste blocks, `migrate` DDL, interactive `shell`, and MongoDB/Redis/ES walkthroughs are in [reference.md](reference.md) (installed next to this file).
@@ -1147,8 +1147,8 @@ Output reports: writer enabled/disabled, last write result, file-lock state, rot
1147
1147
  ### verify
1148
1148
 
1149
1149
  Run a verification scenario. `verify` **runs** verification scenarios (safe-backfill,
1150
- migration) and never executes writes/DDL. `verification` **inspects and manages** the
1151
- local result artifacts those scenarios produce under `.dbcli/verification/`.
1150
+ migration, rollback) and never executes writes/DDL. `verification` **inspects and manages**
1151
+ the local result artifacts those scenarios produce under `.dbcli/verification/`.
1152
1152
 
1153
1153
  ```bash
1154
1154
  # Preflight (default): read-only guards + the exact after-write command. No artifact.
@@ -1233,6 +1233,67 @@ cannot be fully parsed under this contract (unterminated quotes, unsupported esc
1233
1233
  or more than three parts) are blocked before the after-write assertion with a
1234
1234
  "could not be parsed" reason, distinct from the `must match --table` mismatch reason.
1235
1235
 
1236
+ #### `verify rollback`
1237
+
1238
+ (v1.37.0+) Preflight or after-write verification for an **externally-applied rollback** —
1239
+ confirming that after you reverted a change the database is back to the expected prior
1240
+ state. **This command never executes the reverting statement** — it analyzes it, runs
1241
+ read-only guards, and (in after-write mode) records evidence after you apply the rollback
1242
+ externally. One scenario covers both schema and data rollbacks via a required
1243
+ `--kind <ddl|dml>` selector:
1244
+
1245
+ - `--kind ddl` — revert a schema migration. `--statement` is a single `ALTER TABLE`
1246
+ (e.g. dropping a column a forward migration added). Reuses the `migration` DDL gates.
1247
+ - `--kind dml` — revert a data change. `--statement` is a single `UPDATE` that restores
1248
+ prior values. Reuses the `safe-backfill` UPDATE plan gates.
1249
+
1250
+ ```bash
1251
+ # Schema rollback (--kind ddl) — preflight, then record evidence after applying it.
1252
+ dbcli verify rollback \
1253
+ --kind ddl \
1254
+ --table users \
1255
+ --statement "ALTER TABLE users DROP COLUMN verified_at" \
1256
+ --verify-query "SELECT count(*)::int AS n FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'verified_at'" \
1257
+ --expect "value == 0"
1258
+ dbcli verify rollback --kind ddl ... --after-write
1259
+
1260
+ # Data rollback (--kind dml) — revert an UPDATE, then read back.
1261
+ dbcli verify rollback \
1262
+ --kind dml \
1263
+ --table users \
1264
+ --statement "UPDATE users SET status = NULL WHERE status = 1" \
1265
+ --verify-query "SELECT count(*)::int AS n FROM users WHERE status = 1" \
1266
+ --expect "value == 0"
1267
+ dbcli verify rollback --kind dml ... --after-write
1268
+
1269
+ # JSON for agents (both kinds).
1270
+ dbcli verify rollback --kind ddl ... --format json
1271
+ ```
1272
+
1273
+ | Option | Required | Description |
1274
+ | --- | --- | --- |
1275
+ | `--kind <ddl\|dml>` | yes | Reverting-statement grammar: `ddl` (single `ALTER TABLE`) or `dml` (single `UPDATE`). Invalid value fails closed before any DB connection. |
1276
+ | `--table <table>` | yes | Table affected by the rollback. |
1277
+ | `--statement <sql>` | yes | Proposed reverting statement, analyzed but never executed. |
1278
+ | `--verify-query <sql>` | yes | Plain `SELECT` for post-rollback read-back verification. |
1279
+ | `--expect <expr>` | yes | Assertion expression for the read-back result. |
1280
+ | `--after-write` | no | Run the post-rollback assertion and write a v1 artifact. |
1281
+ | `--format <table\|json>` | no | Output format, default `table`. |
1282
+ | `--subject-name <name>` | no | Artifact subject name. Default is the table name. |
1283
+ | `--summary <text>` | no | Optional artifact summary override. |
1284
+
1285
+ A single `--statement` flag is used for both kinds (instead of reusing `--ddl` / `--query`)
1286
+ to keep the dual-kind surface honest. The guard sequence, statuses (`ready`/`blocked` in
1287
+ preflight; `verified` / `not_verified` / `blocked` / `indeterminate` in after-write), and
1288
+ exit codes are identical to the other two scenarios. **MVP restrictions:** DML rollback is
1289
+ `UPDATE`-only (INSERT/DELETE reverts deferred); DDL rollback is single `ALTER TABLE` only,
1290
+ using the same identifier contract as `verify migration`.
1291
+
1292
+ The artifact schema is unchanged: a rollback reuses the existing subject kinds —
1293
+ `--kind ddl` → `migration`, `--kind dml` → `backfill` — and records its provenance via
1294
+ `subject.command = "verify rollback"` plus the summary, so `verification` filters and
1295
+ retention are unaffected.
1296
+
1236
1297
  ### verification
1237
1298
 
1238
1299
  (v1.33.0+) Local **VerificationArtifact** inspection and lifecycle surface over
@@ -2,7 +2,7 @@
2
2
  "name": "dbcli-agent",
3
3
  "displayName": "dbcli Agent",
4
4
  "description": "Database CLI skill and command reference for AI agents.",
5
- "version": "1.37.0",
5
+ "version": "1.37.1",
6
6
  "author": {
7
7
  "name": "Carl Lee",
8
8
  "url": "https://github.com/CarlLee1983"
@@ -160,6 +160,7 @@ Developer workflow guardrails:
160
160
  (`--after-write`) when durable evidence is required. Never executes the write.
161
161
  - `tasks plan migration-review` — when the user needs a migration plan only (plan output, no DDL executed).
162
162
  - `verify migration` — preflight a schema migration (analyze DDL, run guards) and after the migration is applied externally (`--after-write`) to record evidence. Never executes DDL.
163
+ - `verify rollback --kind <ddl|dml>` — verify that a reverting change restored the prior state: preflight analyzes the reverting `ALTER TABLE` (`--kind ddl`) or `UPDATE` (`--kind dml`) via `--statement`, and `--after-write` records evidence after you apply it externally. Never executes the statement.
163
164
  - `verification show <id>` — cite the final artifact.
164
165
 
165
166
  Full flags, per-command copy-paste blocks, `migrate` DDL, interactive `shell`, and MongoDB/Redis/ES walkthroughs are in [reference.md](reference.md) (installed next to this file).
@@ -1147,8 +1147,8 @@ Output reports: writer enabled/disabled, last write result, file-lock state, rot
1147
1147
  ### verify
1148
1148
 
1149
1149
  Run a verification scenario. `verify` **runs** verification scenarios (safe-backfill,
1150
- migration) and never executes writes/DDL. `verification` **inspects and manages** the
1151
- local result artifacts those scenarios produce under `.dbcli/verification/`.
1150
+ migration, rollback) and never executes writes/DDL. `verification` **inspects and manages**
1151
+ the local result artifacts those scenarios produce under `.dbcli/verification/`.
1152
1152
 
1153
1153
  ```bash
1154
1154
  # Preflight (default): read-only guards + the exact after-write command. No artifact.
@@ -1233,6 +1233,67 @@ cannot be fully parsed under this contract (unterminated quotes, unsupported esc
1233
1233
  or more than three parts) are blocked before the after-write assertion with a
1234
1234
  "could not be parsed" reason, distinct from the `must match --table` mismatch reason.
1235
1235
 
1236
+ #### `verify rollback`
1237
+
1238
+ (v1.37.0+) Preflight or after-write verification for an **externally-applied rollback** —
1239
+ confirming that after you reverted a change the database is back to the expected prior
1240
+ state. **This command never executes the reverting statement** — it analyzes it, runs
1241
+ read-only guards, and (in after-write mode) records evidence after you apply the rollback
1242
+ externally. One scenario covers both schema and data rollbacks via a required
1243
+ `--kind <ddl|dml>` selector:
1244
+
1245
+ - `--kind ddl` — revert a schema migration. `--statement` is a single `ALTER TABLE`
1246
+ (e.g. dropping a column a forward migration added). Reuses the `migration` DDL gates.
1247
+ - `--kind dml` — revert a data change. `--statement` is a single `UPDATE` that restores
1248
+ prior values. Reuses the `safe-backfill` UPDATE plan gates.
1249
+
1250
+ ```bash
1251
+ # Schema rollback (--kind ddl) — preflight, then record evidence after applying it.
1252
+ dbcli verify rollback \
1253
+ --kind ddl \
1254
+ --table users \
1255
+ --statement "ALTER TABLE users DROP COLUMN verified_at" \
1256
+ --verify-query "SELECT count(*)::int AS n FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'verified_at'" \
1257
+ --expect "value == 0"
1258
+ dbcli verify rollback --kind ddl ... --after-write
1259
+
1260
+ # Data rollback (--kind dml) — revert an UPDATE, then read back.
1261
+ dbcli verify rollback \
1262
+ --kind dml \
1263
+ --table users \
1264
+ --statement "UPDATE users SET status = NULL WHERE status = 1" \
1265
+ --verify-query "SELECT count(*)::int AS n FROM users WHERE status = 1" \
1266
+ --expect "value == 0"
1267
+ dbcli verify rollback --kind dml ... --after-write
1268
+
1269
+ # JSON for agents (both kinds).
1270
+ dbcli verify rollback --kind ddl ... --format json
1271
+ ```
1272
+
1273
+ | Option | Required | Description |
1274
+ | --- | --- | --- |
1275
+ | `--kind <ddl\|dml>` | yes | Reverting-statement grammar: `ddl` (single `ALTER TABLE`) or `dml` (single `UPDATE`). Invalid value fails closed before any DB connection. |
1276
+ | `--table <table>` | yes | Table affected by the rollback. |
1277
+ | `--statement <sql>` | yes | Proposed reverting statement, analyzed but never executed. |
1278
+ | `--verify-query <sql>` | yes | Plain `SELECT` for post-rollback read-back verification. |
1279
+ | `--expect <expr>` | yes | Assertion expression for the read-back result. |
1280
+ | `--after-write` | no | Run the post-rollback assertion and write a v1 artifact. |
1281
+ | `--format <table\|json>` | no | Output format, default `table`. |
1282
+ | `--subject-name <name>` | no | Artifact subject name. Default is the table name. |
1283
+ | `--summary <text>` | no | Optional artifact summary override. |
1284
+
1285
+ A single `--statement` flag is used for both kinds (instead of reusing `--ddl` / `--query`)
1286
+ to keep the dual-kind surface honest. The guard sequence, statuses (`ready`/`blocked` in
1287
+ preflight; `verified` / `not_verified` / `blocked` / `indeterminate` in after-write), and
1288
+ exit codes are identical to the other two scenarios. **MVP restrictions:** DML rollback is
1289
+ `UPDATE`-only (INSERT/DELETE reverts deferred); DDL rollback is single `ALTER TABLE` only,
1290
+ using the same identifier contract as `verify migration`.
1291
+
1292
+ The artifact schema is unchanged: a rollback reuses the existing subject kinds —
1293
+ `--kind ddl` → `migration`, `--kind dml` → `backfill` — and records its provenance via
1294
+ `subject.command = "verify rollback"` plus the summary, so `verification` filters and
1295
+ retention are unaffected.
1296
+
1236
1297
  ### verification
1237
1298
 
1238
1299
  (v1.33.0+) Local **VerificationArtifact** inspection and lifecycle surface over
package/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ 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.37.1] - 2026-06-22 - Skill Documentation Parity for verify rollback
9
+
10
+ ### Fixed
11
+
12
+ - **Skill 文件補上 `verify rollback`。** v1.37.0 出貨的 `dbcli verify rollback` 先前未寫進可安裝的 skill 文件,導致安裝 skill 的 agent 不知道此指令存在。於 `assets/SKILL.md` / `assets/SKILL.zh-TW.md` 加入工作流速覽行,並於 `assets/reference.md` 新增完整 `#### verify rollback` 區段(`--kind ddl|dml`、`--statement`、preflight / after-write 雙範例、MVP 限制與 artifact subject 對應)。透過 `plugin:sync` 將內容傳播到所有受管理的平台副本(`skills/`、`.github/skills/`、`.cursor/`、`.windsurf/`、`plugins/`)。純文件變更,無程式行為更動。
13
+
8
14
  ## [1.37.0] - 2026-06-22 - Rollback Scenario & Nested Shell Completions
9
15
 
10
16
  ### Added
package/assets/SKILL.md CHANGED
@@ -160,6 +160,7 @@ Developer workflow guardrails:
160
160
  (`--after-write`) when durable evidence is required. Never executes the write.
161
161
  - `tasks plan migration-review` — when the user needs a migration plan only (plan output, no DDL executed).
162
162
  - `verify migration` — preflight a schema migration (analyze DDL, run guards) and after the migration is applied externally (`--after-write`) to record evidence. Never executes DDL.
163
+ - `verify rollback --kind <ddl|dml>` — verify that a reverting change restored the prior state: preflight analyzes the reverting `ALTER TABLE` (`--kind ddl`) or `UPDATE` (`--kind dml`) via `--statement`, and `--after-write` records evidence after you apply it externally. Never executes the statement.
163
164
  - `verification show <id>` — cite the final artifact.
164
165
 
165
166
  Full flags, per-command copy-paste blocks, `migrate` DDL, interactive `shell`, and MongoDB/Redis/ES walkthroughs are in [reference.md](reference.md) (installed next to this file).
@@ -134,6 +134,7 @@ dbcli inspect --for-agent --no-connect --format json
134
134
  - `verify safe-backfill` — 在真實 backfill 前(preflight)及執行後(`--after-write`)使用,需要持久佐證時必用。永不執行寫入。
135
135
  - `tasks plan migration-review` — 當使用者只需要 migration 計畫時使用(僅輸出計畫,不執行 DDL)。
136
136
  - `verify migration` — 預檢 schema migration(分析 DDL、執行防護),並在外部套用 migration 後(`--after-write`)記錄佐證。永不執行 DDL。
137
+ - `verify rollback --kind <ddl|dml>` — 驗證「還原變更」是否讓資料庫回到先前狀態:preflight 透過 `--statement` 分析還原用的 `ALTER TABLE`(`--kind ddl`)或 `UPDATE`(`--kind dml`),並於外部套用後以 `--after-write` 記錄佐證。永不執行該語句。
137
138
  - `verification show <id>` — 引用最終文物。
138
139
 
139
140
  完整旗標、每個指令的可貼上範例、`migrate` DDL、互動式 `shell` 與 MongoDB / Redis / ES 教學在 [reference.md](reference.md)(安裝時與本檔放在一起)。
@@ -1147,8 +1147,8 @@ Output reports: writer enabled/disabled, last write result, file-lock state, rot
1147
1147
  ### verify
1148
1148
 
1149
1149
  Run a verification scenario. `verify` **runs** verification scenarios (safe-backfill,
1150
- migration) and never executes writes/DDL. `verification` **inspects and manages** the
1151
- local result artifacts those scenarios produce under `.dbcli/verification/`.
1150
+ migration, rollback) and never executes writes/DDL. `verification` **inspects and manages**
1151
+ the local result artifacts those scenarios produce under `.dbcli/verification/`.
1152
1152
 
1153
1153
  ```bash
1154
1154
  # Preflight (default): read-only guards + the exact after-write command. No artifact.
@@ -1233,6 +1233,67 @@ cannot be fully parsed under this contract (unterminated quotes, unsupported esc
1233
1233
  or more than three parts) are blocked before the after-write assertion with a
1234
1234
  "could not be parsed" reason, distinct from the `must match --table` mismatch reason.
1235
1235
 
1236
+ #### `verify rollback`
1237
+
1238
+ (v1.37.0+) Preflight or after-write verification for an **externally-applied rollback** —
1239
+ confirming that after you reverted a change the database is back to the expected prior
1240
+ state. **This command never executes the reverting statement** — it analyzes it, runs
1241
+ read-only guards, and (in after-write mode) records evidence after you apply the rollback
1242
+ externally. One scenario covers both schema and data rollbacks via a required
1243
+ `--kind <ddl|dml>` selector:
1244
+
1245
+ - `--kind ddl` — revert a schema migration. `--statement` is a single `ALTER TABLE`
1246
+ (e.g. dropping a column a forward migration added). Reuses the `migration` DDL gates.
1247
+ - `--kind dml` — revert a data change. `--statement` is a single `UPDATE` that restores
1248
+ prior values. Reuses the `safe-backfill` UPDATE plan gates.
1249
+
1250
+ ```bash
1251
+ # Schema rollback (--kind ddl) — preflight, then record evidence after applying it.
1252
+ dbcli verify rollback \
1253
+ --kind ddl \
1254
+ --table users \
1255
+ --statement "ALTER TABLE users DROP COLUMN verified_at" \
1256
+ --verify-query "SELECT count(*)::int AS n FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'verified_at'" \
1257
+ --expect "value == 0"
1258
+ dbcli verify rollback --kind ddl ... --after-write
1259
+
1260
+ # Data rollback (--kind dml) — revert an UPDATE, then read back.
1261
+ dbcli verify rollback \
1262
+ --kind dml \
1263
+ --table users \
1264
+ --statement "UPDATE users SET status = NULL WHERE status = 1" \
1265
+ --verify-query "SELECT count(*)::int AS n FROM users WHERE status = 1" \
1266
+ --expect "value == 0"
1267
+ dbcli verify rollback --kind dml ... --after-write
1268
+
1269
+ # JSON for agents (both kinds).
1270
+ dbcli verify rollback --kind ddl ... --format json
1271
+ ```
1272
+
1273
+ | Option | Required | Description |
1274
+ | --- | --- | --- |
1275
+ | `--kind <ddl\|dml>` | yes | Reverting-statement grammar: `ddl` (single `ALTER TABLE`) or `dml` (single `UPDATE`). Invalid value fails closed before any DB connection. |
1276
+ | `--table <table>` | yes | Table affected by the rollback. |
1277
+ | `--statement <sql>` | yes | Proposed reverting statement, analyzed but never executed. |
1278
+ | `--verify-query <sql>` | yes | Plain `SELECT` for post-rollback read-back verification. |
1279
+ | `--expect <expr>` | yes | Assertion expression for the read-back result. |
1280
+ | `--after-write` | no | Run the post-rollback assertion and write a v1 artifact. |
1281
+ | `--format <table\|json>` | no | Output format, default `table`. |
1282
+ | `--subject-name <name>` | no | Artifact subject name. Default is the table name. |
1283
+ | `--summary <text>` | no | Optional artifact summary override. |
1284
+
1285
+ A single `--statement` flag is used for both kinds (instead of reusing `--ddl` / `--query`)
1286
+ to keep the dual-kind surface honest. The guard sequence, statuses (`ready`/`blocked` in
1287
+ preflight; `verified` / `not_verified` / `blocked` / `indeterminate` in after-write), and
1288
+ exit codes are identical to the other two scenarios. **MVP restrictions:** DML rollback is
1289
+ `UPDATE`-only (INSERT/DELETE reverts deferred); DDL rollback is single `ALTER TABLE` only,
1290
+ using the same identifier contract as `verify migration`.
1291
+
1292
+ The artifact schema is unchanged: a rollback reuses the existing subject kinds —
1293
+ `--kind ddl` → `migration`, `--kind dml` → `backfill` — and records its provenance via
1294
+ `subject.command = "verify rollback"` plus the summary, so `verification` filters and
1295
+ retention are unaffected.
1296
+
1236
1297
  ### verification
1237
1298
 
1238
1299
  (v1.33.0+) Local **VerificationArtifact** inspection and lifecycle surface over