postgresai 0.12.0-beta.6 → 0.14.0-beta.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.
package/README.md CHANGED
@@ -10,9 +10,9 @@ Command-line interface for PostgresAI monitoring and database management.
10
10
  npm install -g postgresai
11
11
  ```
12
12
 
13
- Or install the latest alpha release explicitly:
13
+ Or install the latest beta release explicitly:
14
14
  ```bash
15
- npm install -g postgresai@alpha
15
+ npm install -g postgresai@beta
16
16
  ```
17
17
 
18
18
  ### From Homebrew (macOS)
@@ -34,6 +34,64 @@ postgresai --help
34
34
  pgai --help # short alias
35
35
  ```
36
36
 
37
+ ## init (create monitoring user in Postgres)
38
+
39
+ This command creates (or updates) the `postgres_ai_mon` user and grants the permissions described in the root `README.md` (it is idempotent).
40
+
41
+ Run without installing (positional connection string):
42
+
43
+ ```bash
44
+ npx postgresai init postgresql://admin@host:5432/dbname
45
+ ```
46
+
47
+ It also accepts libpq “conninfo” syntax:
48
+
49
+ ```bash
50
+ npx postgresai init "dbname=dbname host=host user=admin"
51
+ ```
52
+
53
+ And psql-like options:
54
+
55
+ ```bash
56
+ npx postgresai init -h host -p 5432 -U admin -d dbname
57
+ ```
58
+
59
+ Password input options (in priority order):
60
+ - `--password <password>`
61
+ - `PGAI_MON_PASSWORD` environment variable
62
+ - if not provided: a strong password is generated automatically
63
+
64
+ By default, the generated password is printed **only in interactive (TTY) mode**. In non-interactive mode, you must either provide the password explicitly, or opt-in to printing it:
65
+ - `--print-password` (dangerous in CI logs)
66
+
67
+ Optional permissions (RDS/self-managed extras from the root `README.md`) are enabled by default. To skip them:
68
+
69
+ ```bash
70
+ npx postgresai init postgresql://admin@host:5432/dbname --skip-optional-permissions
71
+ ```
72
+
73
+ ### Print SQL / dry run
74
+
75
+ To see what SQL would be executed (passwords redacted by default):
76
+
77
+ ```bash
78
+ npx postgresai init postgresql://admin@host:5432/dbname --print-sql
79
+ ```
80
+
81
+ ### Verify and password reset
82
+
83
+ Verify that everything is configured as expected (no changes):
84
+
85
+ ```bash
86
+ npx postgresai init postgresql://admin@host:5432/dbname --verify
87
+ ```
88
+
89
+ Reset monitoring user password only (no other changes):
90
+
91
+ ```bash
92
+ npx postgresai init postgresql://admin@host:5432/dbname --reset-password --password 'new_password'
93
+ ```
94
+
37
95
  ## Quick start
38
96
 
39
97
  ### Authentication
@@ -55,7 +113,19 @@ Start monitoring with demo database:
55
113
  postgres-ai mon quickstart --demo
56
114
  ```
57
115
 
116
+ Start monitoring with your own database:
117
+ ```bash
118
+ postgres-ai mon quickstart --db-url postgresql://user:pass@host:5432/db
119
+ ```
120
+
121
+ Complete automated setup with API key and database:
122
+ ```bash
123
+ postgres-ai mon quickstart --api-key your_key --db-url postgresql://user:pass@host:5432/db -y
124
+ ```
125
+
58
126
  This will:
127
+ - Configure API key for automated report uploads (if provided)
128
+ - Add PostgreSQL instance to monitor (if provided)
59
129
  - Generate secure Grafana password
60
130
  - Start all monitoring services
61
131
  - Open Grafana at http://localhost:3000
@@ -66,7 +136,15 @@ This will:
66
136
 
67
137
  #### Service lifecycle
68
138
  ```bash
69
- postgres-ai mon quickstart [--demo] # Complete setup (generate config, start services)
139
+ # Complete setup with various options
140
+ postgres-ai mon quickstart # Interactive setup for production
141
+ postgres-ai mon quickstart --demo # Demo mode with sample database
142
+ postgres-ai mon quickstart --api-key <key> # Setup with API key
143
+ postgres-ai mon quickstart --db-url <url> # Setup with database URL
144
+ postgres-ai mon quickstart --api-key <key> --db-url <url> # Complete automated setup
145
+ postgres-ai mon quickstart -y # Auto-accept all defaults
146
+
147
+ # Service management
70
148
  postgres-ai mon start # Start monitoring services
71
149
  postgres-ai mon stop # Stop monitoring services
72
150
  postgres-ai mon restart [service] # Restart all or specific monitoring service
@@ -74,6 +152,12 @@ postgres-ai mon status # Show monitoring services status
74
152
  postgres-ai mon health [--wait <sec>] # Check monitoring services health
75
153
  ```
76
154
 
155
+ ##### Quickstart options
156
+ - `--demo` - Demo mode with sample database (testing only, cannot use with --api-key)
157
+ - `--api-key <key>` - Postgres AI API key for automated report uploads
158
+ - `--db-url <url>` - PostgreSQL connection URL to monitor (format: `postgresql://user:pass@host:port/db`)
159
+ - `-y, --yes` - Accept all defaults and skip interactive prompts
160
+
77
161
  #### Monitoring target databases (`mon targets` subgroup)
78
162
  ```bash
79
163
  postgres-ai mon targets list # List databases to monitor
@@ -96,7 +180,7 @@ postgres-ai mon shell <service> # Open shell to monitoring servic
96
180
  ### MCP server (`mcp` group)
97
181
 
98
182
  ```bash
99
- pgai mcp start # Start MCP stdio server exposing list_issues tool
183
+ pgai mcp start # Start MCP stdio server exposing tools
100
184
  ```
101
185
 
102
186
  Cursor configuration example (Settings → MCP):
@@ -117,6 +201,36 @@ Cursor configuration example (Settings → MCP):
117
201
 
118
202
  Tools exposed:
119
203
  - list_issues: returns the same JSON as `pgai issues list`.
204
+ - view_issue: view a single issue with its comments (args: { issue_id, debug? })
205
+ - post_issue_comment: post a comment (args: { issue_id, content, parent_comment_id?, debug? })
206
+
207
+ ### Issues management (`issues` group)
208
+
209
+ ```bash
210
+ pgai issues list # List issues (shows: id, title, status, created_at)
211
+ pgai issues view <issueId> # View issue details and comments
212
+ pgai issues post_comment <issueId> <content> # Post a comment to an issue
213
+ # Options:
214
+ # --parent <uuid> Parent comment ID (for replies)
215
+ # --debug Enable debug output
216
+ # --json Output raw JSON (overrides default YAML)
217
+ ```
218
+
219
+ #### Output format for issues commands
220
+
221
+ By default, issues commands print human-friendly YAML when writing to a terminal. For scripting, you can:
222
+
223
+ - Use `--json` to force JSON output:
224
+
225
+ ```bash
226
+ pgai issues list --json | jq '.[] | {id, title}'
227
+ ```
228
+
229
+ - Rely on auto-detection: when stdout is not a TTY (e.g., piped or redirected), output is JSON automatically:
230
+
231
+ ```bash
232
+ pgai issues view <issueId> > issue.json
233
+ ```
120
234
 
121
235
  #### Grafana management
122
236
  ```bash