@@ -96,6 +96,28 @@ export DB_SSL=true
9696# export PGPASSWORD=...
9797```
9898
99+ ### Config file (` .analyzerrc.json ` )
100+
101+ Place ` .analyzerrc.json ` in your project root (or ` ~/.config/db-analyzer/config.json ` for global settings).
102+ Copy ` analyzerrc.example.json ` to get started:
103+
104+ ``` bash
105+ cp analyzerrc.example.json .analyzerrc.json
106+ ```
107+
108+ Connection profiles let you switch databases without re-typing flags:
109+
110+ ``` bash
111+ # use a named profile
112+ . ./.env && npx ts-node index.ts -c health --profile prod
113+
114+ # or with npm script
115+ pnpm analyze:health -- --profile staging
116+ ```
117+
118+ CLI flags always win. When you explicitly select a profile with ` --profile ` , that
119+ profile's connection fields override sourced environment defaults for that run.
120+
99121---
100122
101123## Usage
@@ -119,6 +141,8 @@ pnpm analyze:tables # Largest tables
119141pnpm analyze:fk # Foreign keys without indexes
120142pnpm analyze:connections # Connection statistics
121143pnpm analyze:config # PostgreSQL configuration
144+ pnpm analyze:html # Full analysis + Markdown + HTML reports
145+ pnpm analyze:watch # Live health dashboard (refreshes every 30s)
122146
123147# Server info
124148pnpm server:info
@@ -190,6 +214,13 @@ npx ts-node index.ts -h localhost -p 5432 -d mydb -U postgres -W secret --ssl -j
190214| ` --user ` | ` -U ` | Database user | ` postgres ` |
191215| ` --password ` | ` -W ` | Database password | - |
192216| ` --ssl ` | | Enable SSL | ` false ` |
217+ | ` --profile ` | | Use a named connection profile from ` .analyzerrc.json ` | - |
218+ | ` --config ` | | Path to a config file | auto-search |
219+ | ` --schemas ` | | Comma-separated schema names to analyze | all |
220+ | ` --tables ` | | Comma-separated table names to analyze | all |
221+ | ` --compare ` | | Path to a previous JSON report for diffing | - |
222+ | ` --html ` | | Also generate an HTML report | ` false ` |
223+ | ` --watch ` | | Poll interval in seconds (enables watch mode) | - |
193224| ` --command ` | ` -c ` | Run a single command (see table) | ` full ` |
194225| ` --json ` | ` -j ` | JSON output | ` false ` |
195226| ` --quiet ` | ` -q ` | Suppress progress output | ` false ` |
@@ -241,6 +272,40 @@ Saved to `./reports/db-analysis-{timestamp}.md`.
241272}
242273```
243274
275+ ### HTML report
276+
277+ Generated by ` pnpm analyze:html ` or ` pnpm analyze -- --html ` . Includes the same content
278+ as the Markdown report in a self-contained HTML file with:
279+
280+ - Light/dark mode (follows OS preference)
281+ - Color-coded severity badges
282+ - Collapsible sections
283+ - Sortable tables
284+ - No external dependencies — share as a single file
285+
286+ Saved to ` ./reports/db-analysis-{timestamp}.html ` .
287+
288+ ### Report diff
289+
290+ Compare two snapshots to see what changed:
291+
292+ ``` bash
293+ # save a baseline
294+ pnpm analyze
295+
296+ # later, compare
297+ pnpm analyze -- --compare ./reports/db-analysis-2026-01-01.json
298+ ```
299+
300+ Output:
301+ ```
302+ ⬆️ Health score 72 → 85 (+13) ✓ better
303+ ⬇️ Cache hit ratio 99.1% → 98.2% (-0.9%) ✗ worse
304+ ↔️ Slow queries 8 → 8 no change
305+ ⚠️ New issues (1): idx_products_old (unused index)
306+ ✓ Resolved (2): idx_users_tmp, idx_orders_status_old
307+ ```
308+
244309---
245310
246311## Health score
0 commit comments