postgresai 0.12.0-beta.6 → 0.14.0-dev.10

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
@@ -34,6 +34,53 @@ 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 and printed once
63
+
64
+ Optional permissions (RDS/self-managed extras from the root `README.md`) are enabled by default. To skip them:
65
+
66
+ ```bash
67
+ npx postgresai init postgresql://admin@host:5432/dbname --skip-optional-permissions
68
+ ```
69
+
70
+ ### Print SQL / dry run
71
+
72
+ To see what SQL would be executed (passwords redacted by default):
73
+
74
+ ```bash
75
+ npx postgresai init postgresql://admin@host:5432/dbname --print-sql
76
+ ```
77
+
78
+ To print SQL and exit without applying anything:
79
+
80
+ ```bash
81
+ npx postgresai init postgresql://admin@host:5432/dbname --dry-run
82
+ ```
83
+
37
84
  ## Quick start
38
85
 
39
86
  ### Authentication
@@ -55,7 +102,19 @@ Start monitoring with demo database:
55
102
  postgres-ai mon quickstart --demo
56
103
  ```
57
104
 
105
+ Start monitoring with your own database:
106
+ ```bash
107
+ postgres-ai mon quickstart --db-url postgresql://user:pass@host:5432/db
108
+ ```
109
+
110
+ Complete automated setup with API key and database:
111
+ ```bash
112
+ postgres-ai mon quickstart --api-key your_key --db-url postgresql://user:pass@host:5432/db -y
113
+ ```
114
+
58
115
  This will:
116
+ - Configure API key for automated report uploads (if provided)
117
+ - Add PostgreSQL instance to monitor (if provided)
59
118
  - Generate secure Grafana password
60
119
  - Start all monitoring services
61
120
  - Open Grafana at http://localhost:3000
@@ -66,7 +125,15 @@ This will:
66
125
 
67
126
  #### Service lifecycle
68
127
  ```bash
69
- postgres-ai mon quickstart [--demo] # Complete setup (generate config, start services)
128
+ # Complete setup with various options
129
+ postgres-ai mon quickstart # Interactive setup for production
130
+ postgres-ai mon quickstart --demo # Demo mode with sample database
131
+ postgres-ai mon quickstart --api-key <key> # Setup with API key
132
+ postgres-ai mon quickstart --db-url <url> # Setup with database URL
133
+ postgres-ai mon quickstart --api-key <key> --db-url <url> # Complete automated setup
134
+ postgres-ai mon quickstart -y # Auto-accept all defaults
135
+
136
+ # Service management
70
137
  postgres-ai mon start # Start monitoring services
71
138
  postgres-ai mon stop # Stop monitoring services
72
139
  postgres-ai mon restart [service] # Restart all or specific monitoring service
@@ -74,6 +141,12 @@ postgres-ai mon status # Show monitoring services status
74
141
  postgres-ai mon health [--wait <sec>] # Check monitoring services health
75
142
  ```
76
143
 
144
+ ##### Quickstart options
145
+ - `--demo` - Demo mode with sample database (testing only, cannot use with --api-key)
146
+ - `--api-key <key>` - Postgres AI API key for automated report uploads
147
+ - `--db-url <url>` - PostgreSQL connection URL to monitor (format: `postgresql://user:pass@host:port/db`)
148
+ - `-y, --yes` - Accept all defaults and skip interactive prompts
149
+
77
150
  #### Monitoring target databases (`mon targets` subgroup)
78
151
  ```bash
79
152
  postgres-ai mon targets list # List databases to monitor
@@ -96,7 +169,7 @@ postgres-ai mon shell <service> # Open shell to monitoring servic
96
169
  ### MCP server (`mcp` group)
97
170
 
98
171
  ```bash
99
- pgai mcp start # Start MCP stdio server exposing list_issues tool
172
+ pgai mcp start # Start MCP stdio server exposing tools
100
173
  ```
101
174
 
102
175
  Cursor configuration example (Settings → MCP):
@@ -117,6 +190,36 @@ Cursor configuration example (Settings → MCP):
117
190
 
118
191
  Tools exposed:
119
192
  - list_issues: returns the same JSON as `pgai issues list`.
193
+ - view_issue: view a single issue with its comments (args: { issue_id, debug? })
194
+ - post_issue_comment: post a comment (args: { issue_id, content, parent_comment_id?, debug? })
195
+
196
+ ### Issues management (`issues` group)
197
+
198
+ ```bash
199
+ pgai issues list # List issues (shows: id, title, status, created_at)
200
+ pgai issues view <issueId> # View issue details and comments
201
+ pgai issues post_comment <issueId> <content> # Post a comment to an issue
202
+ # Options:
203
+ # --parent <uuid> Parent comment ID (for replies)
204
+ # --debug Enable debug output
205
+ # --json Output raw JSON (overrides default YAML)
206
+ ```
207
+
208
+ #### Output format for issues commands
209
+
210
+ By default, issues commands print human-friendly YAML when writing to a terminal. For scripting, you can:
211
+
212
+ - Use `--json` to force JSON output:
213
+
214
+ ```bash
215
+ pgai issues list --json | jq '.[] | {id, title}'
216
+ ```
217
+
218
+ - Rely on auto-detection: when stdout is not a TTY (e.g., piped or redirected), output is JSON automatically:
219
+
220
+ ```bash
221
+ pgai issues view <issueId> > issue.json
222
+ ```
120
223
 
121
224
  #### Grafana management
122
225
  ```bash