postgresai 0.16.0-dev.10 → 0.16.0-dev.11
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/CHANGELOG.md +11 -0
- package/README.md +1 -84
- package/bin/postgres-ai.ts +140 -540
- package/bun.lock +4 -4
- package/dist/bin/postgres-ai.js +790 -2282
- package/lib/checkup-summary.ts +25 -0
- package/lib/checkup.ts +88 -2
- package/lib/init.ts +29 -0
- package/lib/joe.ts +333 -391
- package/lib/mcp-server.ts +0 -625
- package/lib/util.ts +145 -29
- package/package.json +1 -1
- package/test/auth.test.ts +30 -1
- package/test/checkup.integration.test.ts +31 -21
- package/test/checkup.test.ts +48 -3
- package/test/init.test.ts +35 -0
- package/test/joe.cli.test.ts +355 -196
- package/test/joe.test.ts +565 -568
- package/test/schema-validation.test.ts +40 -0
- package/test/test-utils.ts +5 -0
- package/test/util.test.ts +116 -0
- package/lib/dblab.ts +0 -449
- package/test/dblab.cli.test.ts +0 -373
- package/test/dblab.test.ts +0 -488
- package/test/e2e/pgai-e2e-smoke.sh +0 -192
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `checkup --markdown` previously performed server-side conversion and sent the
|
|
8
|
+
full report JSON to the PostgresAI API even when `--no-upload` was set. The
|
|
9
|
+
flags are now mutually exclusive, and `--no-upload` prevents report data from
|
|
10
|
+
being sent to the PostgresAI API. Use `--json` or `--output` for local-only
|
|
11
|
+
output.
|
package/README.md
CHANGED
|
@@ -229,67 +229,10 @@ postgresai mon check # System readiness check
|
|
|
229
229
|
postgresai mon shell <service> # Open shell to monitoring service
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
### Joe API v2 (`joe` group)
|
|
233
|
-
|
|
234
|
-
Run database-optimization commands on the project's ephemeral DBLab clone via the
|
|
235
|
-
platform Joe API v2. Every verb takes `--project <id|alias>` (a numeric project id,
|
|
236
|
-
or the project's alias/name/label); use `pgai projects` to discover them.
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
pgai projects # org-level discovery: which projects have Joe ready
|
|
240
|
-
|
|
241
|
-
pgai joe plan "select * from users where email = $1" --project 12 # EXPLAIN, plan-only (never executes)
|
|
242
|
-
pgai joe explain "select ..." --project main-db # EXPLAIN ANALYZE (executes on the clone)
|
|
243
|
-
pgai joe exec "create index on users (email)" --project 12 # arbitrary DDL/DML on the clone
|
|
244
|
-
pgai joe hypo "create index on users (name)" --query "select ..." --project 12 # HypoPG what-if + re-plan
|
|
245
|
-
pgai joe activity --project 12 # pg_stat_activity snapshot (query text redacted)
|
|
246
|
-
pgai joe describe users --project 12 [--variant "\d+"] # \d-family metadata
|
|
247
|
-
pgai joe terminate <pid> --project 12 # pg_terminate_backend on the clone
|
|
248
|
-
pgai joe reset --project 12 # reset the session's clone
|
|
249
|
-
pgai joe status <commandId> # command status (metadata only)
|
|
250
|
-
pgai joe result <commandId> # fetch/resume a command result
|
|
251
|
-
pgai joe history <terms> # search prior analyses (M1b — not yet available)
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Shared options: `--session <id>` / `--new-session` (session/clone threading — the
|
|
255
|
-
session returned by a command is auto-reused per project), `--budget <seconds>`
|
|
256
|
-
(one-shot poll budget, default 25; on expiry the command exits 0 and prints a
|
|
257
|
-
resume handle: `pgai joe result <commandId>`), `--debug`, `--json`.
|
|
258
|
-
|
|
259
|
-
Exit codes: 0 on success or budget expiry (resume handle); 1 on a server-side
|
|
260
|
-
`error` or `timed_out`, a refused submit (e.g. missing scope, `ai_enabled=false`),
|
|
261
|
-
or invalid arguments.
|
|
262
|
-
|
|
263
|
-
### DBLab companion (`dblab` group)
|
|
264
|
-
|
|
265
|
-
Manage the project's DBLab thin clones, branches, and snapshots — proxies the same
|
|
266
|
-
Platform DBLab API the Console uses. Read/create verbs require the `joe:plan` token
|
|
267
|
-
scope; destructive verbs (clone reset/destroy, branch delete, snapshot destroy)
|
|
268
|
-
require `joe:admin` (enforced server-side).
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
pgai dblab clone create --project 12 --id my-clone --db-user u --db-password p \
|
|
272
|
-
[--branch <branch>] [--snapshot <id>] [--protected]
|
|
273
|
-
pgai dblab clone list --project 12
|
|
274
|
-
pgai dblab clone status <cloneId> --project 12
|
|
275
|
-
pgai dblab clone reset <cloneId> --project 12 [--snapshot <id> | --latest]
|
|
276
|
-
pgai dblab clone destroy <cloneId> --project 12
|
|
277
|
-
|
|
278
|
-
pgai dblab branch list --project 12
|
|
279
|
-
pgai dblab branch create <name> --project 12 [--snapshot <id>] [--base-branch <branch>]
|
|
280
|
-
pgai dblab branch delete <name> --project 12
|
|
281
|
-
pgai dblab branch log <name> --project 12
|
|
282
|
-
|
|
283
|
-
pgai dblab snapshot list --project 12 [--branch <branch>] [--dataset <dataset>]
|
|
284
|
-
pgai dblab snapshot create --project 12 --clone <cloneId> [--message <msg>]
|
|
285
|
-
pgai dblab snapshot destroy <snapshotId> --project 12 [--force]
|
|
286
|
-
```
|
|
287
|
-
|
|
288
232
|
### MCP server (`mcp` group)
|
|
289
233
|
|
|
290
234
|
```bash
|
|
291
235
|
postgresai mcp start # Start MCP stdio server exposing tools
|
|
292
|
-
postgresai mcp install [client] # Install the MCP config for cursor/claude-code/windsurf/codex
|
|
293
236
|
```
|
|
294
237
|
|
|
295
238
|
Cursor configuration example (Settings → MCP):
|
|
@@ -308,9 +251,7 @@ Cursor configuration example (Settings → MCP):
|
|
|
308
251
|
}
|
|
309
252
|
```
|
|
310
253
|
|
|
311
|
-
Tools exposed
|
|
312
|
-
|
|
313
|
-
Issues & files:
|
|
254
|
+
Tools exposed:
|
|
314
255
|
- `list_issues`: returns the same JSON as `postgresai issues list`.
|
|
315
256
|
- `view_issue`: view a single issue with its comments (args: `{ issue_id, debug? }`).
|
|
316
257
|
- `create_issue`: create a new issue (args: `{ title, description?, org_id, attachments?, debug? }`).
|
|
@@ -320,30 +261,6 @@ Issues & files:
|
|
|
320
261
|
- `upload_file`: upload a local file and return the storage URL plus a ready-to-paste markdown link (args: `{ path, debug? }`).
|
|
321
262
|
- `download_file`: download a file from storage (args: `{ url, output_path?, debug? }`).
|
|
322
263
|
|
|
323
|
-
Action items:
|
|
324
|
-
- `view_action_item`, `list_action_items`, `create_action_item`, `update_action_item`: manage an issue's action items.
|
|
325
|
-
|
|
326
|
-
Checkup reports:
|
|
327
|
-
- `list_reports`, `list_report_files`, `get_report_data`: browse checkup reports and fetch their json/md content.
|
|
328
|
-
|
|
329
|
-
Joe API v2 (mirror `pgai joe <verb>`; every command tool takes `{ project_id, session_id?, new_session?, timeout_ms?, debug? }`
|
|
330
|
-
plus its own arguments — `timeout_ms` is the one-shot poll budget; on expiry the tool returns `budget_expired: true`
|
|
331
|
-
and a `resume` handle instead of blocking):
|
|
332
|
-
- `plan_query`: EXPLAIN, plan-only — never executes (args: `{ sql, ... }`). Requires `joe:plan`.
|
|
333
|
-
- `explain_query`: EXPLAIN ANALYZE — executes on the ephemeral DBLab clone (args: `{ sql, ... }`). Requires `joe:exec`.
|
|
334
|
-
- `exec_sql`: arbitrary DDL/DML on the clone — can return real table rows into the agent's context (args: `{ sql, ... }`). Requires `joe:exec`.
|
|
335
|
-
- `hypo_index`: HypoPG hypothetical index + re-plan (args: `{ sql, query, ... }`). Requires `joe:plan`.
|
|
336
|
-
- `activity`: pg_stat_activity snapshot, query text redacted. Requires `joe:plan`.
|
|
337
|
-
- `terminate_backend`: pg_terminate_backend on the clone (args: `{ pid, ... }`). Requires `joe:admin`.
|
|
338
|
-
- `reset_clone`: reset the session's thin clone. Requires `joe:admin`.
|
|
339
|
-
- `describe`: \d-family metadata introspection (args: `{ object, variant?, ... }`). Requires `joe:plan`.
|
|
340
|
-
- `list_projects`: org-level discovery (mirrors `pgai projects`) — which projects are Joe-ready.
|
|
341
|
-
|
|
342
|
-
DBLab companion (mirror `pgai dblab <group> <verb>`; every tool takes `{ project, org_id?, debug? }` plus its own arguments):
|
|
343
|
-
- `clone_create`, `clone_list`, `clone_status`, `clone_reset`, `clone_destroy`
|
|
344
|
-
- `branch_list`, `branch_create`, `branch_delete`, `branch_log`
|
|
345
|
-
- `snapshot_list`, `snapshot_create`, `snapshot_destroy`
|
|
346
|
-
|
|
347
264
|
#### `attachments` parameter (issue/comment tools)
|
|
348
265
|
|
|
349
266
|
`create_issue`, `update_issue`, `post_issue_comment`, and `update_issue_comment` accept an
|