@carllee1983/dbcli 1.10.1 → 1.11.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/CHANGELOG.md +16 -0
- package/assets/SKILL.md +8 -0
- package/assets/snippets/diag/blocking-queries.postgres.sql +17 -0
- package/assets/snippets/diag/cache-hit.mysql.sql +1 -0
- package/assets/snippets/diag/cache-hit.postgres.sql +1 -0
- package/assets/snippets/diag/client-list.redis.sql +8 -0
- package/assets/snippets/diag/cluster-info.redis.sql +8 -0
- package/assets/snippets/diag/connections.mysql.sql +1 -0
- package/assets/snippets/diag/connections.postgres.sql +1 -0
- package/assets/snippets/diag/db-size.mysql.sql +1 -0
- package/assets/snippets/diag/db-size.postgres.sql +1 -0
- package/assets/snippets/diag/es-cluster-health.elasticsearch.sql +1 -0
- package/assets/snippets/diag/hot-threads.elasticsearch.sql +9 -0
- package/assets/snippets/diag/index-stats.elasticsearch.sql +16 -0
- package/assets/snippets/diag/index-usage.mysql.sql +1 -0
- package/assets/snippets/diag/index-usage.postgres.sql +1 -0
- package/assets/snippets/diag/locks.mysql.sql +1 -0
- package/assets/snippets/diag/locks.postgres.sql +1 -0
- package/assets/snippets/diag/long-running.mysql.sql +1 -0
- package/assets/snippets/diag/long-running.postgres.sql +1 -0
- package/assets/snippets/diag/memory-usage.redis.sql +8 -0
- package/assets/snippets/diag/missing-indexes.mysql.sql +1 -0
- package/assets/snippets/diag/missing-indexes.postgres.sql +1 -0
- package/assets/snippets/diag/pending-tasks.elasticsearch.sql +9 -0
- package/assets/snippets/diag/redis-key-stats.redis.sql +1 -0
- package/assets/snippets/diag/slowlog.redis.sql +12 -0
- package/assets/snippets/diag/table-sizes.mysql.sql +1 -0
- package/assets/snippets/diag/table-sizes.postgres.sql +1 -0
- package/assets/snippets/diag/unassigned-shards.elasticsearch.sql +9 -0
- package/dist/cli.mjs +742 -211
- package/package.json +12 -14
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.11.0] - 2026-05-08
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `dbcli queries search <keywords>` — fuzzy keyword search across saved queries.
|
|
13
|
+
- `dbcli queries suggest <intent>` — intent-prefix suggestion.
|
|
14
|
+
- Optional `intent` frontmatter field on snippets.
|
|
15
|
+
- 9 new diagnostic snippets: ES x4 (hot-threads, index-stats, unassigned-shards, pending-tasks); Redis x4 (slowlog, client-list, memory-usage, cluster-info); SQL x1 (blocking-queries.postgres).
|
|
16
|
+
- "When you don't know which query to run" section in SKILL.md.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- All 18 existing built-in diagnostic snippets backfilled with `intent`.
|
|
21
|
+
- `foldVariants` extracted from `src/commands/queries.ts` to `src/core/saved-queries/fold.ts`.
|
|
22
|
+
- Redis read-only allowlist gained `CLIENT`, `INFO`, `CLUSTER`, `SLOWLOG` for diagnostic snippets.
|
|
23
|
+
|
|
8
24
|
## [1.10.1] - 2026-05-08
|
|
9
25
|
|
|
10
26
|
### Fixed
|
package/assets/SKILL.md
CHANGED
|
@@ -224,6 +224,14 @@ Run reusable parameterised SELECT snippets stored in your repo.
|
|
|
224
224
|
| 2. Inspect | `dbcli queries show @<name>` |
|
|
225
225
|
| 3. Run | `dbcli q @<name> --param k=v` |
|
|
226
226
|
|
|
227
|
+
### When you don't know which query to run
|
|
228
|
+
|
|
229
|
+
1. `dbcli queries search <keywords>` — natural keywords, fuzzy ranked
|
|
230
|
+
2. `dbcli queries suggest <intent>` — browse a category
|
|
231
|
+
Common intents: perf.slow-query, perf.cache-hit, capacity.size,
|
|
232
|
+
safety.connections, monitor.cluster-health
|
|
233
|
+
3. Once you find one: `dbcli q @<name>` (blacklist always enforced)
|
|
234
|
+
|
|
227
235
|
Snippets resolve from three layers, **local > shared > builtin** (local wins):
|
|
228
236
|
- `builtin` — bundled with dbcli (e.g. `@diag/*`); read-only at runtime
|
|
229
237
|
- `.dbcli-shared/queries/` — committed, team-shared
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- ---
|
|
2
|
+
-- name: blocking-queries.postgres
|
|
3
|
+
-- description: Top queries blocking others, with blocker/blocked PIDs
|
|
4
|
+
-- engine: postgres
|
|
5
|
+
-- intent: safety.locks
|
|
6
|
+
-- tags: [diag, postgres, safety]
|
|
7
|
+
-- ---
|
|
8
|
+
SELECT blocked.pid AS blocked_pid,
|
|
9
|
+
blocked.usename AS blocked_user,
|
|
10
|
+
blocking.pid AS blocking_pid,
|
|
11
|
+
blocking.usename AS blocking_user,
|
|
12
|
+
blocked.query AS blocked_query,
|
|
13
|
+
blocking.query AS blocking_query
|
|
14
|
+
FROM pg_stat_activity blocked
|
|
15
|
+
JOIN pg_stat_activity blocking
|
|
16
|
+
ON blocking.pid = ANY(pg_blocking_pids(blocked.pid))
|
|
17
|
+
WHERE blocked.wait_event_type IS NOT NULL;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- ---
|
|
2
|
+
-- name: hot-threads.elasticsearch
|
|
3
|
+
-- description: ES nodes hot threads — surface CPU bottlenecks
|
|
4
|
+
-- engine: elasticsearch
|
|
5
|
+
-- index: '_nodes/hot_threads'
|
|
6
|
+
-- intent: monitor.cluster-health
|
|
7
|
+
-- tags: [diag, elasticsearch, perf]
|
|
8
|
+
-- ---
|
|
9
|
+
{ "size": 0 }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- ---
|
|
2
|
+
-- name: index-stats.elasticsearch
|
|
3
|
+
-- description: doc count + store size per index (top by store size)
|
|
4
|
+
-- engine: elasticsearch
|
|
5
|
+
-- index: '*'
|
|
6
|
+
-- intent: capacity.size
|
|
7
|
+
-- tags: [diag, elasticsearch, capacity]
|
|
8
|
+
-- ---
|
|
9
|
+
{
|
|
10
|
+
"size": 0,
|
|
11
|
+
"aggs": {
|
|
12
|
+
"by_index": {
|
|
13
|
+
"terms": { "field": "_index", "size": 50, "order": { "_count": "desc" } }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- ---
|
|
2
|
+
-- name: pending-tasks.elasticsearch
|
|
3
|
+
-- description: Cluster pending tasks queue depth and ages
|
|
4
|
+
-- engine: elasticsearch
|
|
5
|
+
-- index: '_cluster/pending_tasks'
|
|
6
|
+
-- intent: monitor.cluster-health
|
|
7
|
+
-- tags: [diag, elasticsearch]
|
|
8
|
+
-- ---
|
|
9
|
+
{ "size": 0 }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- ---
|
|
2
|
+
-- name: unassigned-shards.elasticsearch
|
|
3
|
+
-- description: Shards stuck in UNASSIGNED state
|
|
4
|
+
-- engine: elasticsearch
|
|
5
|
+
-- index: '_cluster/allocation/explain'
|
|
6
|
+
-- intent: monitor.cluster-health
|
|
7
|
+
-- tags: [diag, elasticsearch, safety]
|
|
8
|
+
-- ---
|
|
9
|
+
{ "size": 0 }
|