@indiekitai/pg-dash 0.3.2 → 0.3.4
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/README.md +88 -11
- package/README.zh-CN.md +87 -10
- package/dist/cli.js +318 -19
- package/dist/cli.js.map +1 -1
- package/dist/mcp.js +249 -9
- package/dist/mcp.js.map +1 -1
- package/dist/ui/assets/index-D5LMag3w.css +1 -0
- package/dist/ui/assets/index-RQDs_hnz.js +33 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/ui/assets/index-BI4_c1SD.js +0 -33
- package/dist/ui/assets/index-F2MaHZFy.css +0 -1
package/README.md
CHANGED
|
@@ -2,22 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
# pg-dash
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**The AI-native PostgreSQL health checker.** One command to audit your database, 14 MCP tools for AI-assisted optimization, CI integration for automated checks.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Not another monitoring dashboard — pg-dash is built to fit into your **AI coding workflow**:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Developer writes a migration → CI runs pg-dash check →
|
|
11
|
+
Finds missing indexes → MCP tool suggests fix → PR comment
|
|
12
|
+
```
|
|
8
13
|
|
|
9
14
|
```bash
|
|
10
|
-
|
|
15
|
+
# One-shot health check
|
|
16
|
+
npx @indiekitai/pg-dash check postgres://user:pass@host/db
|
|
17
|
+
|
|
18
|
+
# AI assistant (Claude/Cursor) via MCP
|
|
19
|
+
pg-dash-mcp postgres://user:pass@host/db
|
|
20
|
+
|
|
21
|
+
# CI pipeline with diff
|
|
22
|
+
npx @indiekitai/pg-dash check $DATABASE_URL --ci --diff --format md
|
|
11
23
|
```
|
|
12
24
|
|
|
13
|
-
##
|
|
25
|
+
## Philosophy
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
**Developer tools are use-and-go.** You don't stare at a PostgreSQL dashboard all day. You run a check, fix the issues, and move on. pg-dash embraces this:
|
|
28
|
+
|
|
29
|
+
- **Health check** → Find problems, get actionable SQL fixes, done
|
|
30
|
+
- **MCP tools** → Let your AI assistant query and fix your database directly (unique — pganalyze/pgwatch don't have this)
|
|
31
|
+
- **CI integration** → Catch issues automatically on every migration, not when production is on fire
|
|
32
|
+
- **Smart diff** → See what changed since last run, track your progress
|
|
33
|
+
|
|
34
|
+
The Dashboard is there when you need it. But the real power is in the CLI, MCP, and CI.
|
|
35
|
+
|
|
36
|
+
## Why pg-dash?
|
|
37
|
+
|
|
38
|
+
| Tool | Price | Setup | AI-native | CI-ready |
|
|
39
|
+
|------|-------|-------|-----------|----------|
|
|
40
|
+
| pganalyze | $149+/mo | SaaS signup | ❌ | ❌ |
|
|
41
|
+
| Grafana+Prometheus | Free | 3 services | ❌ | ❌ |
|
|
42
|
+
| pgAdmin | Free | Complex UI | ❌ | ❌ |
|
|
43
|
+
| **pg-dash** | **Free** | **One command** | **14 MCP tools** | **`--ci --diff`** |
|
|
21
44
|
|
|
22
45
|
## Features
|
|
23
46
|
|
|
@@ -144,7 +167,61 @@ pg-dash-mcp postgres://user:pass@host/db
|
|
|
144
167
|
PG_DASH_CONNECTION_STRING=postgres://... pg-dash-mcp
|
|
145
168
|
```
|
|
146
169
|
|
|
147
|
-
Available
|
|
170
|
+
### Available Tools (14)
|
|
171
|
+
|
|
172
|
+
| Tool | Description |
|
|
173
|
+
|------|-------------|
|
|
174
|
+
| `pg_dash_overview` | Database overview (version, uptime, size, connections) |
|
|
175
|
+
| `pg_dash_health` | Health advisor report with score, grade, and issues |
|
|
176
|
+
| `pg_dash_tables` | List all tables with sizes and row counts |
|
|
177
|
+
| `pg_dash_table_detail` | Detailed info about a specific table |
|
|
178
|
+
| `pg_dash_activity` | Current database activity (active queries, connections) |
|
|
179
|
+
| `pg_dash_schema_changes` | Recent schema changes |
|
|
180
|
+
| `pg_dash_fix` | Execute a safe fix (VACUUM, ANALYZE, REINDEX, etc.) |
|
|
181
|
+
| `pg_dash_alerts` | Alert history |
|
|
182
|
+
| `pg_dash_explain` | Run EXPLAIN ANALYZE on a SELECT query (read-only) |
|
|
183
|
+
| `pg_dash_batch_fix` | Get batch fix SQL for issues, optionally filtered by category |
|
|
184
|
+
| `pg_dash_slow_queries` | Top slow queries from pg_stat_statements |
|
|
185
|
+
| `pg_dash_table_sizes` | Table sizes with data/index breakdown (top 30) |
|
|
186
|
+
| `pg_dash_export` | Export full health report (JSON or Markdown) |
|
|
187
|
+
| `pg_dash_diff` | Compare current health with last saved snapshot |
|
|
188
|
+
|
|
189
|
+
## CI Integration
|
|
190
|
+
|
|
191
|
+
### GitHub Actions
|
|
192
|
+
|
|
193
|
+
Add `--ci` and `--diff` flags to integrate with CI pipelines:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# GitHub Actions annotations (::error::, ::warning::)
|
|
197
|
+
pg-dash check postgres://... --ci
|
|
198
|
+
|
|
199
|
+
# Markdown report for PR comments
|
|
200
|
+
pg-dash check postgres://... --ci --format md
|
|
201
|
+
|
|
202
|
+
# Compare with previous run
|
|
203
|
+
pg-dash check postgres://... --diff
|
|
204
|
+
|
|
205
|
+
# All together
|
|
206
|
+
pg-dash check postgres://... --ci --diff --format md
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Sample workflow (`.github/workflows/pg-check.yml`):
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
name: Database Health Check
|
|
213
|
+
on:
|
|
214
|
+
push:
|
|
215
|
+
paths: ['migrations/**', 'prisma/**', 'drizzle/**']
|
|
216
|
+
schedule:
|
|
217
|
+
- cron: '0 8 * * 1' # Weekly Monday 8am
|
|
218
|
+
jobs:
|
|
219
|
+
check:
|
|
220
|
+
runs-on: ubuntu-latest
|
|
221
|
+
steps:
|
|
222
|
+
- uses: actions/checkout@v4
|
|
223
|
+
- run: npx @indiekitai/pg-dash check ${{ secrets.DATABASE_URL }} --ci --diff --format md
|
|
224
|
+
```
|
|
148
225
|
|
|
149
226
|
## Health Checks
|
|
150
227
|
|
package/README.zh-CN.md
CHANGED
|
@@ -2,22 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
# pg-dash
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**AI 原生的 PostgreSQL 健康检查工具。** 一条命令审计数据库,14 个 MCP 工具让 AI 帮你优化,CI 集成自动检查。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
不是又一个监控面板 —— pg-dash 是为 **AI 编程工作流** 设计的:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
开发者写了一个 migration → CI 跑 pg-dash check →
|
|
11
|
+
发现缺失索引 → MCP 工具建议修复 → PR comment
|
|
12
|
+
```
|
|
8
13
|
|
|
9
14
|
```bash
|
|
10
|
-
|
|
15
|
+
# 一次性健康检查
|
|
16
|
+
npx @indiekitai/pg-dash check postgres://user:pass@host/db
|
|
17
|
+
|
|
18
|
+
# AI 助手(Claude/Cursor)通过 MCP 调用
|
|
19
|
+
pg-dash-mcp postgres://user:pass@host/db
|
|
20
|
+
|
|
21
|
+
# CI 流水线 + 差异对比
|
|
22
|
+
npx @indiekitai/pg-dash check $DATABASE_URL --ci --diff --format md
|
|
11
23
|
```
|
|
12
24
|
|
|
25
|
+
## 设计理念
|
|
26
|
+
|
|
27
|
+
**开发者工具就是用完即走的。** 你不会整天盯着 PostgreSQL 监控面板。你跑一次检查,修掉问题,然后继续干活。pg-dash 就是为此设计的:
|
|
28
|
+
|
|
29
|
+
- **健康检查** → 发现问题,拿到可执行的 SQL 修复建议,搞定
|
|
30
|
+
- **MCP 工具** → 让 AI 助手直接查询和修复你的数据库(独一份 —— pganalyze/pgwatch 都没有)
|
|
31
|
+
- **CI 集成** → 每次 migration 自动检查,不要等到生产环境出事
|
|
32
|
+
- **智能 diff** → 看到上次以来的变化,追踪改进进度
|
|
33
|
+
|
|
34
|
+
Dashboard 需要时可以用。但真正的核心能力在 CLI、MCP 和 CI。
|
|
35
|
+
|
|
13
36
|
## 为什么选 pg-dash?
|
|
14
37
|
|
|
15
|
-
| 工具 | 价格 | 部署 |
|
|
16
|
-
|
|
17
|
-
| pganalyze | $149+/月 | SaaS 注册 |
|
|
18
|
-
| Grafana+Prometheus | 免费 | 配置 3 个服务 |
|
|
19
|
-
| pgAdmin | 免费 | 界面复杂 |
|
|
20
|
-
| **pg-dash** | **免费** | **一条命令** |
|
|
38
|
+
| 工具 | 价格 | 部署 | AI 原生 | CI 就绪 |
|
|
39
|
+
|------|------|------|---------|---------|
|
|
40
|
+
| pganalyze | $149+/月 | SaaS 注册 | ❌ | ❌ |
|
|
41
|
+
| Grafana+Prometheus | 免费 | 配置 3 个服务 | ❌ | ❌ |
|
|
42
|
+
| pgAdmin | 免费 | 界面复杂 | ❌ | ❌ |
|
|
43
|
+
| **pg-dash** | **免费** | **一条命令** | **14 个 MCP 工具** | **`--ci --diff`** |
|
|
21
44
|
|
|
22
45
|
## 功能
|
|
23
46
|
|
|
@@ -144,7 +167,61 @@ pg-dash-mcp postgres://user:pass@host/db
|
|
|
144
167
|
PG_DASH_CONNECTION_STRING=postgres://... pg-dash-mcp
|
|
145
168
|
```
|
|
146
169
|
|
|
147
|
-
|
|
170
|
+
### 可用工具(14 个)
|
|
171
|
+
|
|
172
|
+
| 工具 | 描述 |
|
|
173
|
+
|------|------|
|
|
174
|
+
| `pg_dash_overview` | 数据库概览(版本、运行时间、大小、连接数) |
|
|
175
|
+
| `pg_dash_health` | 健康报告(评分、等级、问题列表) |
|
|
176
|
+
| `pg_dash_tables` | 所有表的大小和行数 |
|
|
177
|
+
| `pg_dash_table_detail` | 单个表的详细信息 |
|
|
178
|
+
| `pg_dash_activity` | 当前活动(查询、连接) |
|
|
179
|
+
| `pg_dash_schema_changes` | 最近的 schema 变更 |
|
|
180
|
+
| `pg_dash_fix` | 执行安全修复(VACUUM、ANALYZE、REINDEX 等) |
|
|
181
|
+
| `pg_dash_alerts` | 告警历史 |
|
|
182
|
+
| `pg_dash_explain` | 对 SELECT 查询运行 EXPLAIN ANALYZE(只读) |
|
|
183
|
+
| `pg_dash_batch_fix` | 获取批量修复 SQL,可按类别过滤 |
|
|
184
|
+
| `pg_dash_slow_queries` | pg_stat_statements 中的慢查询 |
|
|
185
|
+
| `pg_dash_table_sizes` | 表大小(数据/索引拆分,前 30) |
|
|
186
|
+
| `pg_dash_export` | 导出完整健康报告(JSON 或 Markdown) |
|
|
187
|
+
| `pg_dash_diff` | 与上次快照对比当前健康状态 |
|
|
188
|
+
|
|
189
|
+
## CI 集成
|
|
190
|
+
|
|
191
|
+
### GitHub Actions
|
|
192
|
+
|
|
193
|
+
使用 `--ci` 和 `--diff` 标志集成到 CI 流水线:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# GitHub Actions 注解(::error::、::warning::)
|
|
197
|
+
pg-dash check postgres://... --ci
|
|
198
|
+
|
|
199
|
+
# 适合 PR 评论的 Markdown 报告
|
|
200
|
+
pg-dash check postgres://... --ci --format md
|
|
201
|
+
|
|
202
|
+
# 与上次运行对比
|
|
203
|
+
pg-dash check postgres://... --diff
|
|
204
|
+
|
|
205
|
+
# 全部组合
|
|
206
|
+
pg-dash check postgres://... --ci --diff --format md
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
示例工作流(`.github/workflows/pg-check.yml`):
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
name: Database Health Check
|
|
213
|
+
on:
|
|
214
|
+
push:
|
|
215
|
+
paths: ['migrations/**', 'prisma/**', 'drizzle/**']
|
|
216
|
+
schedule:
|
|
217
|
+
- cron: '0 8 * * 1' # 每周一早 8 点
|
|
218
|
+
jobs:
|
|
219
|
+
check:
|
|
220
|
+
runs-on: ubuntu-latest
|
|
221
|
+
steps:
|
|
222
|
+
- uses: actions/checkout@v4
|
|
223
|
+
- run: npx @indiekitai/pg-dash check ${{ secrets.DATABASE_URL }} --ci --diff --format md
|
|
224
|
+
```
|
|
148
225
|
|
|
149
226
|
## 健康检查
|
|
150
227
|
|