@carllee1983/dbcli 7.0.1 → 9.0.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/.agents/skills/story-development/SKILL.md +70 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor/rules/dbcli.mdc +64 -1
- package/.cursor/skills/dbcli/reference.md +173 -7
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +64 -1
- package/.github/skills/dbcli/reference.md +173 -7
- package/CHANGELOG.md +299 -0
- package/README.zh-TW.md +1 -2
- package/assets/SKILL.md +64 -1
- package/assets/integration-kit/README.md +43 -0
- package/assets/integration-kit/external-consumers.ts +9 -0
- package/assets/integration-kit/skill-author-consumer.ts +77 -0
- package/assets/integration-kit/task-pack.md +18 -0
- package/assets/reference.md +173 -7
- package/assets/tasks/README.md +6 -0
- package/assets/tasks/analyze-table-perf.md +3 -3
- package/assets/tasks/audit-permissions.md +2 -2
- package/assets/tasks/connection-health.md +2 -2
- package/assets/tasks/design-review.md +3 -3
- package/assets/tasks/diagnose-slow-query.md +3 -3
- package/assets/tasks/migration-review.md +3 -3
- package/assets/tasks/mongo-safe-backfill.md +2 -2
- package/assets/tasks/mongo-schema-drift-review.md +2 -2
- package/assets/tasks/orm-drift-review.md +3 -3
- package/assets/tasks/pr-database-review.md +3 -3
- package/assets/tasks/safe-backfill-verify.md +3 -3
- package/assets/tasks/safe-backfill.md +3 -3
- package/assets/tasks/schema-drift-review.md +3 -3
- package/assets/tasks/slow-endpoint-investigation.md +19 -6
- package/assets/ui-template.html +18 -18
- package/dist/cli-runtime.mjs +25537 -22204
- package/dist/cli.mjs +7 -5
- package/dist/core.d.ts +297 -2
- package/dist/core.mjs +2075 -3
- package/dist/ui-style.css +1 -1
- package/gemini-extension.json +1 -1
- package/package.json +6 -4
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +64 -1
- package/plugins/dbcli-agent/skills/dbcli/reference.md +173 -7
- package/skills/dbcli/SKILL.md +64 -1
- package/skills/dbcli/reference.md +173 -7
- package/assets/SKILL.zh-TW.md +0 -506
|
@@ -43,6 +43,7 @@ never the right move.
|
|
|
43
43
|
[snapshot](#snapshot) ·
|
|
44
44
|
[assert](#assert) ·
|
|
45
45
|
[proxy](#proxy) ·
|
|
46
|
+
[capabilities](#capabilities) ·
|
|
46
47
|
[status](#status) ·
|
|
47
48
|
[inspect](#inspect) ·
|
|
48
49
|
[report](#report) ·
|
|
@@ -85,6 +86,8 @@ command-level option is only valid after the command that declares it.
|
|
|
85
86
|
| `--use <connection>` | Select a named connection for this invocation; place it before the command path unless that command explicitly lists a command-level `--use`. |
|
|
86
87
|
| `--timeout <ms>` | Connection timeout in milliseconds (integer, 100–600000), overriding the connection config's `timeout` field for this invocation. Applies to every engine adapter. Without either the flag or the config field, adapters fall back to their built-in 5000ms default. |
|
|
87
88
|
| `--statement-timeout <ms>` | How long a single statement may run, in milliseconds (integer, 0–3600000; `0` removes the limit), overriding the connection config's `statementTimeout` field. Independent of the connection timeout — raising it does not slow down detection of an unreachable host. Falls back to `--timeout` when unset, and to the server's own setting when neither is given. |
|
|
89
|
+
| `--agent-output` | Request the PLAT-005 v1 Operation Envelope. It must precede the subcommand and currently supports `capabilities` and `capabilities check`; it conflicts with explicit `--format` and command-local `--for-agent`. |
|
|
90
|
+
| `--correlation-id <id>` | Associate one invocation with a Story, incident, change request, migration, or backfill. Place it before the subcommand. IDs are 1–160 ASCII letters, numbers, dots, underscores, colons, or hyphens; never use sensitive or free-form data. |
|
|
88
91
|
|
|
89
92
|
`--timeout` is applied only when the adapter is constructed for this invocation — it is
|
|
90
93
|
never written back to `config.json`. Set the connection's `timeout` field instead for a
|
|
@@ -1298,6 +1301,10 @@ The normalized JSON escape hatch is Zod-validated and uses an array of tables
|
|
|
1298
1301
|
with explicit exact `identity` objects; optional parsed identifiers must include
|
|
1299
1302
|
their `quoted` flags, and every normalized JSON `unparsed.reason` must start with
|
|
1300
1303
|
`blocked:`.
|
|
1304
|
+
A Drizzle snapshot or normalized JSON artifact that is not valid JSON, and a
|
|
1305
|
+
normalized JSON artifact that violates that contract, fail closed: the error
|
|
1306
|
+
names the offending file and lists the fields at fault, bounded with a count of
|
|
1307
|
+
the remainder, rather than degrading to `unparsed`.
|
|
1301
1308
|
|
|
1302
1309
|
```json
|
|
1303
1310
|
{
|
|
@@ -1669,6 +1676,150 @@ Every actionable block carries machine-readable next steps so an agent can move
|
|
|
1669
1676
|
**Engines:** MySQL / MariaDB / PostgreSQL
|
|
1670
1677
|
**Permission:** n/a (acts as a TCP relay; does not use dbcli's SQL permission model)
|
|
1671
1678
|
|
|
1679
|
+
### capabilities
|
|
1680
|
+
|
|
1681
|
+
Discovery. Lists the static dbcli capability catalog — what this tool can do,
|
|
1682
|
+
described in a versioned shape an external Skill can parse before it starts
|
|
1683
|
+
working. It never opens a database connection and never writes anything.
|
|
1684
|
+
|
|
1685
|
+
A **capability** names one atomic dbcli ability (`schema.read`, `data.delete`).
|
|
1686
|
+
It is not a job and not a method: `dba.tune-production` or `crud.scaffold`
|
|
1687
|
+
belong to the Role or Method Skill that composes dbcli, never to dbcli itself.
|
|
1688
|
+
|
|
1689
|
+
```bash
|
|
1690
|
+
dbcli capabilities # human-readable (default)
|
|
1691
|
+
dbcli capabilities --format json # for agents and Skills
|
|
1692
|
+
dbcli capabilities --format markdown # table, for docs
|
|
1693
|
+
```
|
|
1694
|
+
|
|
1695
|
+
Each entry carries `id`, `description`, `command`, `risk`, `sideEffect`,
|
|
1696
|
+
`engines`, `limitedEngines`, `engineIndependent`, `minimumPermission`,
|
|
1697
|
+
`requiresConnection`, `mutatesConfiguration`, `supportsJson` and
|
|
1698
|
+
`supportsEvidence`. `limitedEngines` is the subset of `engines` the support
|
|
1699
|
+
matrix marks *limited* rather than fully supported. Output is sorted by `id`, so two runs of
|
|
1700
|
+
the same build are byte-identical.
|
|
1701
|
+
|
|
1702
|
+
`schemaVersion` is the **capability contract** version, not the npm package
|
|
1703
|
+
version. Pin `schemaVersion`, never `7.x`.
|
|
1704
|
+
|
|
1705
|
+
**Scope:** the catalog covers every public command, including `explain`, `plan`,
|
|
1706
|
+
`impact assess`, `assert`, `snapshot`, `verify`, `verification`, `evidence`,
|
|
1707
|
+
`contract`, `semantic`, `design`, `proxy`, `recovery`, `backfill artifact`,
|
|
1708
|
+
`password`, and `capabilities` itself. An id it does not know is still
|
|
1709
|
+
`unknown`, which fails closed.
|
|
1710
|
+
|
|
1711
|
+
Every engine claim was read out of the implementation. Where the code refuses a
|
|
1712
|
+
non-SQL connection outright — `explain`, `plan`, `assert`, `snapshot`, `verify`,
|
|
1713
|
+
`proxy` — the entry is `unsupported` for MongoDB, Redis and Elasticsearch and
|
|
1714
|
+
the note names the gate. Where only one *mode* needs SQL — `--against-cache` for
|
|
1715
|
+
`impact assess`, `design diff` and `design propose`, and `draft validate` for
|
|
1716
|
+
`semantic` — the entry is `limited` there, because the rest of the command runs
|
|
1717
|
+
fine. Where a command never opens a connection at all, it is
|
|
1718
|
+
engine-independent. Nothing is marked supported on an engine the code does not
|
|
1719
|
+
settle.
|
|
1720
|
+
|
|
1721
|
+
**Permission:** query-only+ (no connection is made)
|
|
1722
|
+
|
|
1723
|
+
#### capabilities check
|
|
1724
|
+
|
|
1725
|
+
Asks whether the capabilities you need are available *here* — against this
|
|
1726
|
+
machine's local configuration only. It reads engine and permission from the
|
|
1727
|
+
config; it does not connect to the database to find out.
|
|
1728
|
+
|
|
1729
|
+
```bash
|
|
1730
|
+
dbcli capabilities check --require schema.read,query.read
|
|
1731
|
+
dbcli capabilities check --require schema.read,data.delete --format json
|
|
1732
|
+
dbcli --use staging capabilities check --require schema.read --format json
|
|
1733
|
+
dbcli --agent-output capabilities check --require schema.read
|
|
1734
|
+
```
|
|
1735
|
+
|
|
1736
|
+
For a copyable Bun/TypeScript consumer that strictly parses this contract, pins schema
|
|
1737
|
+
versions, handles exit codes and Operation Envelopes, and includes Task Pack and
|
|
1738
|
+
correlation/evidence examples, see `assets/integration-kit/README.md`.
|
|
1739
|
+
|
|
1740
|
+
#### Agent output v1 (PLAT-005)
|
|
1741
|
+
|
|
1742
|
+
`dbcli --agent-output capabilities` and `dbcli --agent-output capabilities check --require <ids>`
|
|
1743
|
+
are the supported operations. Either emits one compact UTF-8 JSON document followed by one newline
|
|
1744
|
+
on stdout, with stderr empty. The envelope always has, in stable order, `schemaVersion`, `ok`,
|
|
1745
|
+
`operation`, `status`, `context`, `data`, `warnings`, `evidence`, `recovery`, and `error`; consumers
|
|
1746
|
+
must use the names, not the order. `schemaVersion` is `1`, `operation` is `capabilities.list` or
|
|
1747
|
+
`capabilities.check`, and `status` is `succeeded` or `failed`. The full document, including newline,
|
|
1748
|
+
is capped at 64 KiB.
|
|
1749
|
+
|
|
1750
|
+
The flag must be before the subcommand and conflicts with explicitly supplied `--format` or
|
|
1751
|
+
`--for-agent`. Invalid placement/input and unsupported operations exit `2`; success exits `0`;
|
|
1752
|
+
unmet requirements and internal failures exit `1`. This output is ephemeral: it is not evidence and
|
|
1753
|
+
adds no timestamp. `--correlation-id <id>` is an optional root option. For supported non-static
|
|
1754
|
+
agent output, it appears as `context.correlationId` and in the existing audit entry as
|
|
1755
|
+
`metadata.correlation_id`; command summaries redact it. Static `capabilities` output remains
|
|
1756
|
+
`context: null`, and the option creates or changes no evidence receipt.
|
|
1757
|
+
|
|
1758
|
+
Code/message vocabulary is locale-independent English. Stable error codes mean:
|
|
1759
|
+
|
|
1760
|
+
| Code | Meaning |
|
|
1761
|
+
|---|---|
|
|
1762
|
+
| `INVALID_AGENT_OUTPUT_OPTIONS` | The agent-output option is invalid, misplaced, or conflicts with explicit output options. |
|
|
1763
|
+
| `UNSUPPORTED_AGENT_OUTPUT_OPERATION` | The requested operation is outside PLAT-005 support. |
|
|
1764
|
+
| `INVALID_CAPABILITY_REQUIREMENTS` | `--require` is missing, empty, or malformed. |
|
|
1765
|
+
| `CAPABILITY_REQUIREMENTS_UNMET` | A completed check found one or more unavailable or unknown requirements. |
|
|
1766
|
+
| `AGENT_OUTPUT_LIMIT_EXCEEDED` | The otherwise valid serialized envelope exceeded 64 KiB. |
|
|
1767
|
+
| `AGENT_OUTPUT_INTERNAL_ERROR` | An unexpected failure was replaced with the safe agent-output failure. |
|
|
1768
|
+
| `INVALID_CORRELATION_ID` | The root correlation ID is absent or does not match the allowed identifier grammar. |
|
|
1769
|
+
|
|
1770
|
+
Stable warning codes mean:
|
|
1771
|
+
|
|
1772
|
+
| Code | Meaning |
|
|
1773
|
+
|---|---|
|
|
1774
|
+
| `DUPLICATE_CAPABILITY_REQUIREMENT` | A repeated required id was de-duplicated in first-seen order. |
|
|
1775
|
+
| `CAPABILITY_CONTEXT_UNAVAILABLE` | No local configuration was available to evaluate. |
|
|
1776
|
+
| `CAPABILITY_CONTEXT_UNRESOLVABLE` | Configuration exists but cannot yield an engine and permission. |
|
|
1777
|
+
| `AGENT_MODE_RESTRICTION_ACTIVE` | `DBCLI_AGENT_MODE=1` refuses configuration, permission, and credential changes. |
|
|
1778
|
+
|
|
1779
|
+
| Flag | Purpose |
|
|
1780
|
+
|---|---|
|
|
1781
|
+
| `--require <ids>` | Comma-separated capability ids. Required; an empty list is refused rather than reported as ok. |
|
|
1782
|
+
| `--format <type>` | `text` (default) or `json`. |
|
|
1783
|
+
|
|
1784
|
+
Each result is `available`, `unavailable` or `unknown`:
|
|
1785
|
+
|
|
1786
|
+
| Status | Reason | Means |
|
|
1787
|
+
|---|---|---|
|
|
1788
|
+
| `available` | `null` | The configured engine and permission would not refuse it. |
|
|
1789
|
+
| `unavailable` | `engine` | The configured engine does not support it. |
|
|
1790
|
+
| `unavailable` | `permission` | The configured permission level is below its minimum. |
|
|
1791
|
+
| `unavailable` | `agent-mode` | `DBCLI_AGENT_MODE=1` is set and the capability changes configuration, permission or credentials — refused unconditionally. |
|
|
1792
|
+
| `unavailable` | `context-unavailable` | No local config here, so there is nothing to evaluate against. |
|
|
1793
|
+
| `unavailable` | `context-unresolvable` | A config exists but could not be resolved into an engine and a permission — an `{"$env": "..."}` reference pointing at an unset variable, for instance. Distinct from "no config", because saying there is none would be false. |
|
|
1794
|
+
| `unknown` | `unknown-capability` | No such capability id. Never guessed at — a typo is refused, not resolved to a neighbour. |
|
|
1795
|
+
|
|
1796
|
+
A duplicate id in `--require` is de-duplicated in first-seen order and reported
|
|
1797
|
+
in `warnings`; `required` and `results` each hold it once.
|
|
1798
|
+
|
|
1799
|
+
`required` and `results` hold the ids you asked for in first-seen input order,
|
|
1800
|
+
so `results[i]` answers `required[i]` and you never have to re-index by id to
|
|
1801
|
+
read your own answer. Reordering the arguments therefore reorders the output and
|
|
1802
|
+
the two byte streams differ; what reordering never changes is a capability's
|
|
1803
|
+
status, its reason, or the overall `ok`. Identical input is byte-identical
|
|
1804
|
+
output.
|
|
1805
|
+
|
|
1806
|
+
**Exit codes:** `0` every requirement available · `1` any unavailable or
|
|
1807
|
+
unknown · `2` invalid input or an unreadable format.
|
|
1808
|
+
|
|
1809
|
+
Blockers are reported least-fixable first — engine, then agent mode, then
|
|
1810
|
+
permission — so `reason` names the one actually in the way.
|
|
1811
|
+
|
|
1812
|
+
**`available` is not approval.** It says the gate would not refuse on engine,
|
|
1813
|
+
agent-mode and permission grounds. Blacklist, write gate, confirmation and audit all still run
|
|
1814
|
+
at execution time, and no human has agreed to anything. `admin` in a config file
|
|
1815
|
+
is a permission level, not a DBA sign-off.
|
|
1816
|
+
|
|
1817
|
+
`schema.read` is available under `DBCLI_AGENT_MODE=1`, and `dbcli schema` runs
|
|
1818
|
+
there: storing the schema cache is not a configuration change. Agent mode still
|
|
1819
|
+
refuses every change to connection identity, permission and credentials.
|
|
1820
|
+
|
|
1821
|
+
**Permission:** query-only+ (no connection is made)
|
|
1822
|
+
|
|
1672
1823
|
### status
|
|
1673
1824
|
|
|
1674
1825
|
Show current configuration status (safe for AI agents, no credentials exposed).
|
|
@@ -2948,14 +3099,18 @@ The strict v1 artifact contains `version` and `contracts`. Each contract has a u
|
|
|
2948
3099
|
canonical `name`, `status` (`draft`, `approved`, or `deprecated`), bounded plain-text
|
|
2949
3100
|
`description` and `owner`, one or more canonical semantic `subjects`, optional aliases,
|
|
2950
3101
|
and an `evidencePolicy` of `none`, `receipt-required`, or `verification-required`.
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3102
|
+
Each subject must use one of the canonical `model:` / `field:` / `relationship:` /
|
|
3103
|
+
`metric:` forms and must remain in the existing visible semantic registry; protected
|
|
3104
|
+
identifiers, unknown keys, duplicate names or subjects, SQL-like text, credentials, and
|
|
3105
|
+
stale references fail closed without exposing protected names. Diagnostics name the
|
|
3106
|
+
offending property or subject position, never a rejected key, value, or local path taken
|
|
3107
|
+
from the artifact or the local configuration.
|
|
2954
3108
|
|
|
2955
3109
|
`contract validate` requires an explicit valid artifact. `contract context` and
|
|
2956
3110
|
`contract search` return only valid approved contracts; draft and deprecated contracts
|
|
2957
3111
|
remain local review artifacts. `contract drift` reports `valid`, `stale`, `invalid`, or
|
|
2958
|
-
`unavailable` evidence offline and exits non-zero except for `valid
|
|
3112
|
+
`unavailable` evidence offline and exits non-zero except for `valid`; a subject whose form
|
|
3113
|
+
is unsupported is `invalid`, while a well-formed subject that no longer exists is `stale`. A missing default
|
|
2959
3114
|
file is allowed by `skill context` and leaves ordinary semantic context unchanged; a
|
|
2960
3115
|
present invalid file fails closed. No contract command writes a file, opens a database
|
|
2961
3116
|
connection, widens a `QueryDraft`, or changes permission/blacklist behavior.
|
|
@@ -2982,7 +3137,7 @@ dbcli skill --install codex # install to ~/.codex/skills/dbcli/
|
|
|
2982
3137
|
**Options:**
|
|
2983
3138
|
- `--install <platform>` — `claude` | `gemini` | `antigravity` | `copilot` | `cursor` | `codex` | `windsurf`. Writes `SKILL.md` plus `reference.md` next to it so the agent gets progressive disclosure.
|
|
2984
3139
|
- `--output <path>` — write `SKILL.md` to a file instead of stdout. Does not install `reference.md`.
|
|
2985
|
-
-
|
|
3140
|
+
- Skill content is always the canonical English `assets/SKILL.md`; the install/output filename is `SKILL.md`.
|
|
2986
3141
|
|
|
2987
3142
|
**Notes:**
|
|
2988
3143
|
- Both files come straight from `assets/SKILL.md` + `assets/reference.md` inside the dbcli package — no runtime rendering. Keep these in sync when shipping a release.
|
|
@@ -3003,12 +3158,23 @@ Emit an AI-friendly snapshot of the connected database's schema and saved-query
|
|
|
3003
3158
|
dbcli skill context # XML (default)
|
|
3004
3159
|
dbcli skill context --format json
|
|
3005
3160
|
dbcli skill context --format markdown
|
|
3161
|
+
dbcli skill context --context-version 2 --format json
|
|
3006
3162
|
```
|
|
3007
3163
|
|
|
3008
3164
|
**Options:**
|
|
3009
3165
|
- `--format <xml|json|markdown>` — output format (default: `xml`)
|
|
3010
|
-
|
|
3011
|
-
|
|
3166
|
+
- `--context-version <version>` — explicit agent contract; version `2` supports
|
|
3167
|
+
PostgreSQL, MySQL, MariaDB, Elasticsearch, and Redis. Omit it for byte-compatible v1.
|
|
3168
|
+
|
|
3169
|
+
Version 2 is offline and bounded: it emits only visible cached SQL tables/fields,
|
|
3170
|
+
flattened Elasticsearch fields, or declared Redis key families, plus safe capability,
|
|
3171
|
+
snippet, semantic, contract, and data-access metadata. It never connects, scans Redis,
|
|
3172
|
+
reads documents or project source, or emits values, credentials, query bodies/defaults,
|
|
3173
|
+
source paths, counts, or raw mappings. Missing evidence is reported in `gaps`; invalid
|
|
3174
|
+
evidence fails with a stable `INVALID_*` code. MongoDB rejects explicit v2.
|
|
3175
|
+
|
|
3176
|
+
**Permission:** query-only+ — read-only; blacklisted objects are never emitted outside
|
|
3177
|
+
the blacklist policy.
|
|
3012
3178
|
|
|
3013
3179
|
### skill tasks (Agent Task Packs)
|
|
3014
3180
|
|