postgresai 0.11.0-alpha.9 → 0.12.0-alpha.14
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 +76 -18
- package/bin/postgres-ai.ts +258 -124
- package/dist/bin/postgres-ai.js +237 -117
- package/dist/bin/postgres-ai.js.map +1 -1
- package/dist/lib/auth-server.js +8 -8
- package/dist/lib/issues.d.ts +7 -0
- package/dist/lib/issues.d.ts.map +1 -0
- package/dist/lib/issues.js +105 -0
- package/dist/lib/issues.js.map +1 -0
- package/dist/lib/mcp-server.d.ts +9 -0
- package/dist/lib/mcp-server.d.ts.map +1 -0
- package/dist/lib/mcp-server.js +114 -0
- package/dist/lib/mcp-server.js.map +1 -0
- package/dist/lib/util.d.ts +27 -0
- package/dist/lib/util.d.ts.map +1 -0
- package/dist/lib/util.js +46 -0
- package/dist/lib/util.js.map +1 -0
- package/dist/package.json +5 -2
- package/lib/auth-server.ts +8 -8
- package/lib/issues.ts +83 -0
- package/lib/mcp-server.ts +98 -0
- package/lib/util.ts +60 -0
- package/package.json +5 -4
- package/tsconfig.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,11 @@ Command-line interface for PostgresAI monitoring and database management.
|
|
|
6
6
|
|
|
7
7
|
### From npm
|
|
8
8
|
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g postgresai
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install the latest alpha release explicitly:
|
|
9
14
|
```bash
|
|
10
15
|
npm install -g postgresai@alpha
|
|
11
16
|
```
|
|
@@ -47,7 +52,7 @@ This will:
|
|
|
47
52
|
|
|
48
53
|
Start monitoring with demo database:
|
|
49
54
|
```bash
|
|
50
|
-
postgres-ai quickstart --demo
|
|
55
|
+
postgres-ai mon quickstart --demo
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
This will:
|
|
@@ -57,27 +62,66 @@ This will:
|
|
|
57
62
|
|
|
58
63
|
## Commands
|
|
59
64
|
|
|
60
|
-
### Monitoring services
|
|
65
|
+
### Monitoring services management (`mon` group)
|
|
66
|
+
|
|
67
|
+
#### Service lifecycle
|
|
68
|
+
```bash
|
|
69
|
+
postgres-ai mon quickstart [--demo] # Complete setup (generate config, start services)
|
|
70
|
+
postgres-ai mon start # Start monitoring services
|
|
71
|
+
postgres-ai mon stop # Stop monitoring services
|
|
72
|
+
postgres-ai mon restart [service] # Restart all or specific monitoring service
|
|
73
|
+
postgres-ai mon status # Show monitoring services status
|
|
74
|
+
postgres-ai mon health [--wait <sec>] # Check monitoring services health
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Monitoring target databases (`mon targets` subgroup)
|
|
78
|
+
```bash
|
|
79
|
+
postgres-ai mon targets list # List databases to monitor
|
|
80
|
+
postgres-ai mon targets add <conn-string> <name> # Add database to monitor
|
|
81
|
+
postgres-ai mon targets remove <name> # Remove monitoring target
|
|
82
|
+
postgres-ai mon targets test <name> # Test target connectivity
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Configuration and maintenance
|
|
61
86
|
```bash
|
|
62
|
-
postgres-ai
|
|
63
|
-
postgres-ai
|
|
64
|
-
postgres-ai
|
|
65
|
-
postgres-ai
|
|
66
|
-
postgres-ai
|
|
87
|
+
postgres-ai mon config # Show monitoring configuration
|
|
88
|
+
postgres-ai mon update-config # Apply configuration changes
|
|
89
|
+
postgres-ai mon update # Update monitoring stack
|
|
90
|
+
postgres-ai mon reset [service] # Reset service data
|
|
91
|
+
postgres-ai mon clean # Cleanup artifacts
|
|
92
|
+
postgres-ai mon check # System readiness check
|
|
93
|
+
postgres-ai mon shell <service> # Open shell to monitoring service
|
|
67
94
|
```
|
|
68
95
|
|
|
69
|
-
###
|
|
96
|
+
### MCP server (`mcp` group)
|
|
97
|
+
|
|
70
98
|
```bash
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
pgai mcp start # Start MCP stdio server exposing list_issues tool
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Cursor configuration example (Settings → MCP):
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcpServers": {
|
|
107
|
+
"PostgresAI": {
|
|
108
|
+
"command": "pgai",
|
|
109
|
+
"args": ["mcp", "start"],
|
|
110
|
+
"env": {
|
|
111
|
+
"PGAI_API_BASE_URL": "https://postgres.ai/api/general/"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
75
116
|
```
|
|
76
117
|
|
|
77
|
-
|
|
118
|
+
Tools exposed:
|
|
119
|
+
- list_issues: returns the same JSON as `pgai issues list`.
|
|
120
|
+
|
|
121
|
+
#### Grafana management
|
|
78
122
|
```bash
|
|
79
|
-
postgres-ai
|
|
80
|
-
postgres-ai
|
|
123
|
+
postgres-ai mon generate-grafana-password # Generate new Grafana password
|
|
124
|
+
postgres-ai mon show-grafana-credentials # Show Grafana credentials
|
|
81
125
|
```
|
|
82
126
|
|
|
83
127
|
### Authentication and API key management
|
|
@@ -103,6 +147,20 @@ API key resolution order:
|
|
|
103
147
|
3. User config file (`~/.config/postgresai/config.json`)
|
|
104
148
|
4. Legacy project config (`.pgwatch-config`)
|
|
105
149
|
|
|
150
|
+
Base URL resolution order:
|
|
151
|
+
- API base URL (`apiBaseUrl`):
|
|
152
|
+
1. Command line option (`--api-base-url`)
|
|
153
|
+
2. Environment variable (`PGAI_API_BASE_URL`)
|
|
154
|
+
3. User config file `baseUrl` (`~/.config/postgresai/config.json`)
|
|
155
|
+
4. Default: `https://postgres.ai/api/general/`
|
|
156
|
+
- UI base URL (`uiBaseUrl`):
|
|
157
|
+
1. Command line option (`--ui-base-url`)
|
|
158
|
+
2. Environment variable (`PGAI_UI_BASE_URL`)
|
|
159
|
+
3. Default: `https://console.postgres.ai`
|
|
160
|
+
|
|
161
|
+
Normalization:
|
|
162
|
+
- A single trailing `/` is removed to ensure consistent path joining.
|
|
163
|
+
|
|
106
164
|
### Environment variables
|
|
107
165
|
|
|
108
166
|
- `PGAI_API_KEY` - API key for PostgresAI services
|
|
@@ -120,7 +178,7 @@ Linux/macOS (bash/zsh):
|
|
|
120
178
|
|
|
121
179
|
```bash
|
|
122
180
|
export PGAI_API_BASE_URL=https://v2.postgres.ai/api/general/
|
|
123
|
-
export PGAI_UI_BASE_URL=https://console.postgres.ai
|
|
181
|
+
export PGAI_UI_BASE_URL=https://console-dev.postgres.ai
|
|
124
182
|
pgai auth --debug
|
|
125
183
|
```
|
|
126
184
|
|
|
@@ -128,7 +186,7 @@ Windows PowerShell:
|
|
|
128
186
|
|
|
129
187
|
```powershell
|
|
130
188
|
$env:PGAI_API_BASE_URL = "https://v2.postgres.ai/api/general/"
|
|
131
|
-
$env:PGAI_UI_BASE_URL = "https://console.postgres.ai"
|
|
189
|
+
$env:PGAI_UI_BASE_URL = "https://console-dev.postgres.ai"
|
|
132
190
|
pgai auth --debug
|
|
133
191
|
```
|
|
134
192
|
|
|
@@ -137,7 +195,7 @@ Via CLI options (overrides env):
|
|
|
137
195
|
```bash
|
|
138
196
|
pgai auth --debug \
|
|
139
197
|
--api-base-url https://v2.postgres.ai/api/general/ \
|
|
140
|
-
--ui-base-url https://console.postgres.ai
|
|
198
|
+
--ui-base-url https://console-dev.postgres.ai
|
|
141
199
|
```
|
|
142
200
|
|
|
143
201
|
Notes:
|