postgresai 0.11.0-alpha.1 → 0.11.0-alpha.2
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 +63 -18
- package/bin/postgres-ai.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,31 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
# PostgresAI CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for PostgresAI monitoring and database management.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
2
6
|
|
|
3
|
-
### run without install
|
|
4
7
|
```bash
|
|
5
|
-
npm
|
|
6
|
-
node ./cli/bin/postgres-ai.js --help
|
|
8
|
+
npm install -g postgresai@alpha
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The CLI provides two command aliases:
|
|
10
14
|
```bash
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
postgres-ai --help
|
|
16
|
+
pgai --help # short alias
|
|
17
|
+
```
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
|
|
16
|
-
exec zsh -l
|
|
19
|
+
## Quick start
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
Start monitoring with demo database:
|
|
22
|
+
```bash
|
|
23
|
+
postgres-ai quickstart --demo
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This will:
|
|
27
|
+
- Generate secure Grafana password
|
|
28
|
+
- Start all monitoring services
|
|
29
|
+
- Open Grafana at http://localhost:3000
|
|
30
|
+
|
|
31
|
+
## Commands
|
|
32
|
+
|
|
33
|
+
### Monitoring services
|
|
34
|
+
```bash
|
|
35
|
+
postgres-ai start # Start all services
|
|
36
|
+
postgres-ai stop # Stop all services
|
|
37
|
+
postgres-ai restart # Restart all services
|
|
38
|
+
postgres-ai status # Show service status
|
|
39
|
+
postgres-ai logs [service] # Show logs
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Instance management
|
|
43
|
+
```bash
|
|
44
|
+
postgres-ai list-instances # List configured instances
|
|
45
|
+
postgres-ai add-instance <conn-string> <name> # Add new instance
|
|
46
|
+
postgres-ai remove-instance <name> # Remove instance
|
|
47
|
+
postgres-ai update-config # Regenerate config files
|
|
21
48
|
```
|
|
22
49
|
|
|
23
|
-
###
|
|
50
|
+
### Configuration
|
|
24
51
|
```bash
|
|
25
|
-
|
|
52
|
+
postgres-ai config # Show current configuration
|
|
53
|
+
postgres-ai check # Verify prerequisites
|
|
26
54
|
```
|
|
27
55
|
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
-
|
|
56
|
+
### API key management
|
|
57
|
+
```bash
|
|
58
|
+
postgres-ai add-key <key> # Store API key
|
|
59
|
+
postgres-ai show-key # Show stored key (masked)
|
|
60
|
+
postgres-ai remove-key # Remove stored key
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Environment variables
|
|
64
|
+
|
|
65
|
+
- `PGAI_API_KEY` - API key for PostgresAI services
|
|
66
|
+
- `PGAI_BASE_URL` - API endpoint (default: `https://postgres.ai/api/general/`)
|
|
67
|
+
|
|
68
|
+
## Requirements
|
|
69
|
+
|
|
70
|
+
- Node.js 18 or higher
|
|
71
|
+
- Docker and Docker Compose
|
|
72
|
+
|
|
73
|
+
## Learn more
|
|
31
74
|
|
|
75
|
+
- Documentation: https://postgres.ai/docs
|
|
76
|
+
- Issues: https://gitlab.com/postgres-ai/postgres_ai/-/issues
|
package/bin/postgres-ai.js
CHANGED
|
@@ -7,7 +7,7 @@ const pkg = require("../package.json");
|
|
|
7
7
|
function getConfig(opts) {
|
|
8
8
|
const apiKey = opts.apiKey || process.env.PGAI_API_KEY || "";
|
|
9
9
|
const baseUrl =
|
|
10
|
-
opts.baseUrl || process.env.PGAI_BASE_URL || "https://
|
|
10
|
+
opts.baseUrl || process.env.PGAI_BASE_URL || "https://postgres.ai/api/general/";
|
|
11
11
|
return { apiKey, baseUrl };
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ program
|
|
|
21
21
|
.option(
|
|
22
22
|
"--base-url <url>",
|
|
23
23
|
"API base URL (overrides PGAI_BASE_URL)",
|
|
24
|
-
"https://
|
|
24
|
+
"https://postgres.ai/api/general/"
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
const stub = (name) => async () => {
|