postgresai 0.11.0-alpha.7 → 0.11.0-alpha.9

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
@@ -4,10 +4,22 @@ Command-line interface for PostgresAI monitoring and database management.
4
4
 
5
5
  ## Installation
6
6
 
7
+ ### From npm
8
+
7
9
  ```bash
8
10
  npm install -g postgresai@alpha
9
11
  ```
10
12
 
13
+ ### From Homebrew (macOS)
14
+
15
+ ```bash
16
+ # Add the PostgresAI tap
17
+ brew tap postgres-ai/tap https://gitlab.com/postgres-ai/homebrew-tap.git
18
+
19
+ # Install postgresai
20
+ brew install postgresai
21
+ ```
22
+
11
23
  ## Usage
12
24
 
13
25
  The CLI provides three command aliases:
@@ -19,6 +31,20 @@ pgai --help # short alias
19
31
 
20
32
  ## Quick start
21
33
 
34
+ ### Authentication
35
+
36
+ Authenticate via browser to obtain API key:
37
+ ```bash
38
+ pgai auth
39
+ ```
40
+
41
+ This will:
42
+ - Open your browser for authentication
43
+ - Prompt you to select an organization
44
+ - Automatically save your API key to `~/.config/postgresai/config.json`
45
+
46
+ ### Start monitoring
47
+
22
48
  Start monitoring with demo database:
23
49
  ```bash
24
50
  postgres-ai quickstart --demo
@@ -54,17 +80,68 @@ postgres-ai config # Show current configuration
54
80
  postgres-ai check # Verify prerequisites
55
81
  ```
56
82
 
57
- ### API key management
83
+ ### Authentication and API key management
58
84
  ```bash
59
- postgres-ai add-key <key> # Store API key
85
+ postgres-ai auth # Authenticate via browser (recommended)
86
+ postgres-ai add-key <key> # Manually store API key
60
87
  postgres-ai show-key # Show stored key (masked)
61
88
  postgres-ai remove-key # Remove stored key
62
89
  ```
63
90
 
64
- ## Environment variables
91
+ ## Configuration
92
+
93
+ The CLI stores configuration in `~/.config/postgresai/config.json` including:
94
+ - API key
95
+ - Base URL
96
+ - Organization ID
97
+
98
+ ### Configuration priority
99
+
100
+ API key resolution order:
101
+ 1. Command line option (`--api-key`)
102
+ 2. Environment variable (`PGAI_API_KEY`)
103
+ 3. User config file (`~/.config/postgresai/config.json`)
104
+ 4. Legacy project config (`.pgwatch-config`)
105
+
106
+ ### Environment variables
65
107
 
66
108
  - `PGAI_API_KEY` - API key for PostgresAI services
67
- - `PGAI_BASE_URL` - API endpoint (default: `https://postgres.ai/api/general/`)
109
+ - `PGAI_API_BASE_URL` - API endpoint for backend RPC (default: `https://postgres.ai/api/general/`)
110
+ - `PGAI_UI_BASE_URL` - UI endpoint for browser routes (default: `https://console.postgres.ai`)
111
+
112
+ ### CLI options
113
+
114
+ - `--api-base-url <url>` - overrides `PGAI_API_BASE_URL`
115
+ - `--ui-base-url <url>` - overrides `PGAI_UI_BASE_URL`
116
+
117
+ ### Examples
118
+
119
+ Linux/macOS (bash/zsh):
120
+
121
+ ```bash
122
+ export PGAI_API_BASE_URL=https://v2.postgres.ai/api/general/
123
+ export PGAI_UI_BASE_URL=https://console.postgres.ai
124
+ pgai auth --debug
125
+ ```
126
+
127
+ Windows PowerShell:
128
+
129
+ ```powershell
130
+ $env:PGAI_API_BASE_URL = "https://v2.postgres.ai/api/general/"
131
+ $env:PGAI_UI_BASE_URL = "https://console.postgres.ai"
132
+ pgai auth --debug
133
+ ```
134
+
135
+ Via CLI options (overrides env):
136
+
137
+ ```bash
138
+ pgai auth --debug \
139
+ --api-base-url https://v2.postgres.ai/api/general/ \
140
+ --ui-base-url https://console.postgres.ai
141
+ ```
142
+
143
+ Notes:
144
+ - If `PGAI_UI_BASE_URL` is not set, the default is `https://console.postgres.ai`.
68
145
 
69
146
  ## Requirements
70
147