refactor: (CLI) move key auth-related commands under auth group
Related to https://gitlab.com/postgres-ai/platform/-/issues/346
Summary
- Reorganize CLI by moving
add-key,show-key, andremove-keycommands under theauthcommand group - Convert
authfrom a standalone command to a command group withloginas the default subcommand - Fix inconsistent help text capitalization ("Prepare" → "prepare")
Changes
Before:
% npx pgai@0.14.0-dev.41
Need to install the following packages:
pgai@0.14.0-dev.41
Ok to proceed? (y)
Usage: postgres-ai [options] [command]
PostgresAI CLI
Options:
-V, --version output the version number
--api-key <key> API key (overrides PGAI_API_KEY)
--api-base-url <url> API base URL for backend RPC (overrides PGAI_API_BASE_URL)
--ui-base-url <url> UI base URL for browser routes (overrides PGAI_UI_BASE_URL)
-h, --help display help for command
Commands:
prepare-db [options] [conn] Prepare database for monitoring: create monitoring user, required view(s), and grant permissions (idempotent)
help show help
mon monitoring services management
auth [options] authenticate via browser (OAuth) or store API key directly
add-key <apiKey> store API key (deprecated: use 'auth --set-key' instead)
show-key show API key (masked)
remove-key remove API key
issues issues management
mcp MCP server integration
| Command | Description |
|---|---|
auth |
authenticate via browser (OAuth) or store API key directly |
add-key |
store API key |
show-key |
show API key (masked) |
remove-key |
remove API key |
After:
nik@niks-mbp ~ % npx pgai@0.14.0-dev.43
Usage: postgres-ai [options] [command]
PostgresAI CLI
Options:
-V, --version output the version number
--api-key <key> API key (overrides PGAI_API_KEY)
--api-base-url <url> API base URL for backend RPC (overrides PGAI_API_BASE_URL)
--ui-base-url <url> UI base URL for browser routes (overrides PGAI_UI_BASE_URL)
-h, --help display help for command
Commands:
prepare-db [options] [conn] prepare database for monitoring: create monitoring user, required view(s), and grant permissions (idempotent)
help show help
mon monitoring services management
auth authentication and API key management
issues issues management
mcp MCP server integration
nik@niks-mbp ~ % npx pgai@0.14.0-dev.43 auth --help
Usage: postgres-ai auth [options] [command]
authentication and API key management
Options:
-h, --help display help for command
Commands:
login [options] authenticate via browser (OAuth) or store API key directly
add-key <apiKey> store API key (deprecated: use 'auth --set-key' instead)
show-key show API key (masked)
remove-key remove API key
help [command] display help for command
| Command | Description |
|---|---|
auth |
authentication and API key management |
auth login |
authenticate via browser (OAuth) or store API key directly |
auth add-key |
store API key (deprecated: use auth --set-key instead) |
auth show-key |
show API key (masked) |
auth remove-key |
remove API key |
Usage
-
pgai auth— runs OAuth login flow (default) -
pgai auth --set-key <key>— store API key directly -
pgai auth show-key— show masked API key -
pgai auth remove-key— remove API key
Edited by Nikolay Samokhvalov