Skip to content

Commit 70eac9e

Browse files
committed
refactor: move key commands under auth group and fix help consistency
- Convert auth to command group with login as default subcommand - Move add-key, show-key, remove-key as subcommands under auth - Fix "Prepare" -> "prepare" in help text for consistent lowercase style
1 parent 08f1e7d commit 70eac9e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cli/bin/postgres-ai.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ program
204204

205205
program
206206
.command("prepare-db [conn]")
207-
.description("Prepare database for monitoring: create monitoring user, required view(s), and grant permissions (idempotent)")
207+
.description("prepare database for monitoring: create monitoring user, required view(s), and grant permissions (idempotent)")
208208
.option("--db-url <url>", "PostgreSQL connection URL (admin) to run the setup against (deprecated; pass it as positional arg)")
209209
.option("-h, --host <host>", "PostgreSQL host (psql-like)")
210210
.option("-p, --port <port>", "PostgreSQL port (psql-like)")
@@ -1534,8 +1534,10 @@ targets
15341534
});
15351535

15361536
// Authentication and API key management
1537-
program
1538-
.command("auth")
1537+
const auth = program.command("auth").description("authentication and API key management");
1538+
1539+
auth
1540+
.command("login", { isDefault: true })
15391541
.description("authenticate via browser (OAuth) or store API key directly")
15401542
.option("--set-key <key>", "store API key directly without OAuth flow")
15411543
.option("--port <port>", "local callback server port (default: random)", parseInt)
@@ -1779,7 +1781,7 @@ program
17791781
}
17801782
});
17811783

1782-
program
1784+
auth
17831785
.command("add-key <apiKey>")
17841786
.description("store API key (deprecated: use 'auth --set-key' instead)")
17851787
.action(async (apiKey: string) => {
@@ -1788,7 +1790,7 @@ program
17881790
console.log(`API key saved to ${config.getConfigPath()}`);
17891791
});
17901792

1791-
program
1793+
auth
17921794
.command("show-key")
17931795
.description("show API key (masked)")
17941796
.action(async () => {
@@ -1806,7 +1808,7 @@ program
18061808
console.log(`Config location: ${config.getConfigPath()}`);
18071809
});
18081810

1809-
program
1811+
auth
18101812
.command("remove-key")
18111813
.description("remove API key")
18121814
.action(async () => {

0 commit comments

Comments
 (0)