postgresai 0.16.0-rc.5 → 0.17.0-dev.0
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 +88 -10
- package/dist/bin/postgres-ai.js +10019 -7504
- package/dist/sql/03.permissions.sql +9 -0
- package/dist/sql/sql/03.permissions.sql +9 -0
- package/package.json +9 -4
- package/schemas/F001.schema.json +138 -3
- package/schemas/F003.schema.json +120 -1
- package/sql/03.permissions.sql +9 -0
package/README.md
CHANGED
|
@@ -150,9 +150,51 @@ postgresai auth
|
|
|
150
150
|
|
|
151
151
|
This will:
|
|
152
152
|
- Open your browser for authentication
|
|
153
|
-
- Prompt you to select an organization
|
|
153
|
+
- Prompt you to select an organization — or **All my organizations**, which mints a *global token*
|
|
154
154
|
- Automatically save your API key to `~/.config/postgresai/config.json`
|
|
155
155
|
|
|
156
|
+
#### Token kinds
|
|
157
|
+
|
|
158
|
+
| | Per-organization token | Global token (`pai_global_…`) |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| Reaches | one organization | every organization you belong to |
|
|
161
|
+
| Org selection | implied by the token | **named on every org-specific command** |
|
|
162
|
+
| Lifetime | 1 year by default¹ | **at most** 1 year² |
|
|
163
|
+
|
|
164
|
+
¹ The Console pre-fills one year from today and accepts a later date; the
|
|
165
|
+
platform enforces no maximum on per-organization tokens.
|
|
166
|
+
|
|
167
|
+
² A hard cap: the platform refuses a global token expiring more than a year
|
|
168
|
+
out ("A global token may not be valid for more than 1 year"). Both limits are
|
|
169
|
+
the platform's, not the CLI's — see
|
|
170
|
+
[platform-all#629](https://gitlab.com/postgres-ai/platform-all/-/issues/629) /
|
|
171
|
+
[!709](https://gitlab.com/postgres-ai/platform-all/-/merge_requests/709).
|
|
172
|
+
|
|
173
|
+
A global token is bound to *you*, not to an organization, so working across
|
|
174
|
+
several companies no longer means re-running the browser login each time you
|
|
175
|
+
switch. The trade-off is that it cannot guess which organization a command
|
|
176
|
+
means, so it makes you say:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
pgai issues list --org acme # by alias
|
|
180
|
+
pgai reports list --org-id 5225 # by numeric id — same on every org-scoped command
|
|
181
|
+
PGAI_ORG=acme pgai checkup ... # for scripts and agents
|
|
182
|
+
|
|
183
|
+
pgai orgs # which organizations can this token reach?
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`--org` always means an alias and `--org-id` always means a numeric id.
|
|
187
|
+
Organization aliases have no format restriction, so an all-digit alias is
|
|
188
|
+
legal — one flag accepting both forms would have to guess, and guessing wrong
|
|
189
|
+
writes into the wrong organization.
|
|
190
|
+
|
|
191
|
+
Nothing is stored: there is no "current organization" to get out of sync, and
|
|
192
|
+
no shared state for parallel agents to race. Per-organization tokens are
|
|
193
|
+
unaffected and need no flag.
|
|
194
|
+
|
|
195
|
+
The MCP server follows the same rule — under a global token, `org_id` becomes a
|
|
196
|
+
required tool argument instead of falling back to a stored default.
|
|
197
|
+
|
|
156
198
|
### Start monitoring
|
|
157
199
|
|
|
158
200
|
Start monitoring with demo database:
|
|
@@ -201,7 +243,7 @@ postgresai mon health [--wait <sec>] # Check monitoring services health
|
|
|
201
243
|
|
|
202
244
|
##### local-install options
|
|
203
245
|
- `--demo` - Demo mode with sample database (testing only, cannot use with --api-key)
|
|
204
|
-
- `--api-key <key>` -
|
|
246
|
+
- `--api-key <key>` - PostgresAI API key for automated report uploads
|
|
205
247
|
- `--db-url <url>` - PostgreSQL connection URL to monitor (format: `postgresql://user:pass@host:port/db`)
|
|
206
248
|
- `--instance-id <uuid>` - Adopt a console-provisioned monitoring instance (also via the `PGAI_INSTANCE_ID` env var)
|
|
207
249
|
- `-y, --yes` - Accept all defaults and skip interactive prompts
|
|
@@ -251,15 +293,20 @@ Cursor configuration example (Settings → MCP):
|
|
|
251
293
|
}
|
|
252
294
|
```
|
|
253
295
|
|
|
296
|
+
Every org-scoped tool takes an `org_id` argument. Under a per-organization
|
|
297
|
+
token it is optional (the token supplies the org); under a **global token it is
|
|
298
|
+
required** — the server will not assume an organization. Call `orgs_list` (or
|
|
299
|
+
run `pgai orgs`) to discover the available ids.
|
|
300
|
+
|
|
254
301
|
Tools exposed:
|
|
255
|
-
- `list_issues`: returns the same JSON as `postgresai issues list
|
|
256
|
-
- `view_issue`: view a single issue with its comments (args: `{ issue_id, debug? }`).
|
|
302
|
+
- `list_issues`: returns the same JSON as `postgresai issues list` (args: `{ org_id, status?, hidden_only?, limit?, offset?, debug? }`).
|
|
303
|
+
- `view_issue`: view a single issue with its comments (args: `{ issue_id, org_id, debug? }`).
|
|
257
304
|
- `create_issue`: create a new issue (args: `{ title, description?, org_id, attachments?, debug? }`).
|
|
258
|
-
- `update_issue`: update title/description/status/labels (args: `{ issue_id, title?, description?, status?, labels?, attachments?, debug? }`).
|
|
259
|
-
- `post_issue_comment`: post a comment (args: `{ issue_id, content?, parent_comment_id?, attachments?, debug? }`).
|
|
260
|
-
- `update_issue_comment`: update an existing comment (args: `{ comment_id, content?, attachments?, debug? }`).
|
|
261
|
-
- `upload_file`: upload a local file and return the storage URL plus a ready-to-paste markdown link (args: `{ path, debug? }`).
|
|
262
|
-
- `download_file`: download a file from storage (args: `{ url, output_path?, debug? }`).
|
|
305
|
+
- `update_issue`: update title/description/status/labels (args: `{ issue_id, org_id, title?, description?, status?, labels?, attachments?, debug? }`).
|
|
306
|
+
- `post_issue_comment`: post a comment (args: `{ issue_id, org_id, content?, parent_comment_id?, attachments?, debug? }`).
|
|
307
|
+
- `update_issue_comment`: update an existing comment (args: `{ comment_id, org_id, content?, attachments?, debug? }`).
|
|
308
|
+
- `upload_file`: upload a local file and return the storage URL plus a ready-to-paste markdown link (args: `{ path, org_id, debug? }`).
|
|
309
|
+
- `download_file`: download a file from storage (args: `{ url, org_id, output_path?, debug? }`).
|
|
263
310
|
|
|
264
311
|
#### `attachments` parameter (issue/comment tools)
|
|
265
312
|
|
|
@@ -303,7 +350,8 @@ sensitive.
|
|
|
303
350
|
### Issues management (`issues` group)
|
|
304
351
|
|
|
305
352
|
```bash
|
|
306
|
-
postgresai issues list # List issues (shows: id, title, status, created_at)
|
|
353
|
+
postgresai issues list # List issues (shows: id, title, status, created_at; is_hidden only when set)
|
|
354
|
+
postgresai issues list --hidden-only # Only hidden issues (PostgresAI staff)
|
|
307
355
|
postgresai issues view <issueId> # View issue details and comments
|
|
308
356
|
postgresai issues create --org-id <id> --title <t> # Create a new issue
|
|
309
357
|
postgresai issues update <issueId> [--title ... --status ...]# Update an existing issue
|
|
@@ -317,6 +365,21 @@ postgresai issues files download <url> [-o <path>] # Download a file
|
|
|
317
365
|
# --json Output raw JSON (overrides default YAML)
|
|
318
366
|
```
|
|
319
367
|
|
|
368
|
+
#### Hidden issues (PostgresAI staff)
|
|
369
|
+
|
|
370
|
+
Hidden issues are staff-internal. `issues list` and `issues view` mark them
|
|
371
|
+
with `is_hidden: true`; the key is omitted entirely otherwise, so ordinary
|
|
372
|
+
issues look exactly as they always have. `--hidden-only` lists just the hidden
|
|
373
|
+
ones, filtered server-side.
|
|
374
|
+
|
|
375
|
+
Staff access is granted per credential, not per person, and a credential that
|
|
376
|
+
does not qualify simply sees nothing — `--hidden-only` returns an empty list
|
|
377
|
+
and `is_hidden` never appears, with no error, which is indistinguishable from
|
|
378
|
+
"there are no hidden issues". The token must be personal, not revoked, not
|
|
379
|
+
expired, and — if it is a per-organization token rather than a global one —
|
|
380
|
+
issued on or after 2026-08-14. Re-issue the token if `--hidden-only` comes
|
|
381
|
+
back unexpectedly empty.
|
|
382
|
+
|
|
320
383
|
#### Attaching files to issues and comments (`--attach`)
|
|
321
384
|
|
|
322
385
|
`create`, `update`, `post-comment`, and `update-comment` accept a repeatable
|
|
@@ -401,9 +464,24 @@ Normalization:
|
|
|
401
464
|
### Environment variables
|
|
402
465
|
|
|
403
466
|
- `PGAI_API_KEY` - API key for PostgresAI services
|
|
467
|
+
- `PGAI_ORG` - organization alias for org-specific commands (equivalent to `--org`; required with a global token)
|
|
468
|
+
- `PGAI_ORG_ID` - organization id for org-specific commands (equivalent to `--org-id`)
|
|
404
469
|
- `PGAI_API_BASE_URL` - API endpoint for backend RPC (default: `https://postgres.ai/api/general/`)
|
|
405
470
|
- `PGAI_UI_BASE_URL` - UI endpoint for browser routes (default: `https://console.postgres.ai`)
|
|
406
471
|
|
|
472
|
+
A flag beats the matching environment variable. Setting both `PGAI_ORG` and
|
|
473
|
+
`PGAI_ORG_ID` (or passing both flags) is an error rather than a silent
|
|
474
|
+
precedence win.
|
|
475
|
+
|
|
476
|
+
### Per-command options
|
|
477
|
+
|
|
478
|
+
Placed **after** the subcommand (`pgai projects --org acme`), not before it —
|
|
479
|
+
they are registered on each org-scoped command, so `pgai --org acme projects`
|
|
480
|
+
is an error.
|
|
481
|
+
|
|
482
|
+
- `--org <alias>` - organization alias; overrides `PGAI_ORG`
|
|
483
|
+
- `--org-id <id>` - organization id; overrides `PGAI_ORG_ID`
|
|
484
|
+
|
|
407
485
|
### CLI options
|
|
408
486
|
|
|
409
487
|
- `--api-base-url <url>` - overrides `PGAI_API_BASE_URL`
|