Skip to content

Commit 3e808c7

Browse files
committed
fix(rebase): port co-located command changes missed during rebase
After rebasing onto main's co-location refactor, several changes from the PR's commits were only present in the old monolithic cli-program.ts and needed to be forwarded to the co-located command files: - cli-program.ts: expand Program type to include quiet and color opts - apps/index.ts: use field-aware --json descriptions for list and create - auth/index.ts: add --token option to auth login and hidden login commands
1 parent 8945792 commit 3e808c7

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

packages/cli-core/src/cli-program.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ import { registerExtras } from "@clerk/cli-extras";
5050
* The root `clerk` program with its global options applied, so registrants
5151
* can rely on the typed global option contract instead of a generic Command.
5252
*/
53-
export type Program = Command<[], { inputJson?: string; mode?: string; verbose?: boolean }>;
53+
export type Program = Command<
54+
[],
55+
{ inputJson?: string; mode?: string; verbose?: boolean; quiet?: boolean; color?: boolean }
56+
>;
5457

5558
type CommandRegistrant = (program: Program) => void;
5659

packages/cli-core/src/commands/apps/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export function registerApps(program: Program): void {
88
apps
99
.command("list")
1010
.description("List your Clerk applications")
11-
.option("--json", "Output as JSON")
11+
.option(
12+
"--json",
13+
"Output as JSON. Fields: application_id, name, instances[] (instance_id, environment_type, publishable_key)",
14+
)
1215
.setExamples([
1316
{ command: "clerk apps list", description: "List all applications" },
1417
{ command: "clerk apps list --json", description: "Output as JSON" },
@@ -19,7 +22,10 @@ export function registerApps(program: Program): void {
1922
.command("create")
2023
.description("Create a new Clerk application (not idempotent by default — use --if-not-exists)")
2124
.argument("<name>", "Application name")
22-
.option("--json", "Output as JSON")
25+
.option(
26+
"--json",
27+
"Output as JSON. Fields: application_id, name, instances[] (instance_id, environment_type, publishable_key)",
28+
)
2329
.option(
2430
"--if-not-exists",
2531
"Make the operation idempotent: if an application with this name already exists, return it instead of creating a duplicate",

packages/cli-core/src/commands/auth/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,29 @@ export function registerAuth(program: Program): void {
1111
{ command: "clerk auth logout", description: "Remove stored credentials" },
1212
]);
1313

14+
const TOKEN_OPTION_DESC =
15+
"Headless authentication with a Clerk PLAPI access token (skips OAuth; use `-` to read from stdin). For per-instance API access, CLERK_SECRET_KEY also works directly with `clerk api` / `users` / `config`.";
16+
1417
auth
1518
.command("login")
1619
.aliases(["signup", "signin", "sign-in"])
1720
.description("Log in to your Clerk account")
1821
.option("-y, --yes", "Proceed with OAuth without prompting when already logged in")
22+
.option("--token <key>", TOKEN_OPTION_DESC)
1923
.setExamples([
2024
{ command: "clerk auth login", description: "Log in via browser (OAuth)" },
2125
{
2226
command: "clerk auth login -y",
2327
description: "Re-authenticate via OAuth without confirmation when already signed in",
2428
},
29+
{
30+
command: "clerk auth login --token $CLERK_OAUTH_TOKEN",
31+
description: "Headless login with a PLAPI access token (CI / agents)",
32+
},
33+
{
34+
command: "cat token.txt | clerk auth login --token -",
35+
description: "Read the token from stdin",
36+
},
2537
])
2638
.action(async (opts) => {
2739
await login(opts);
@@ -38,6 +50,7 @@ export function registerAuth(program: Program): void {
3850
.command("login", { hidden: true })
3951
.description("Log in to your Clerk account")
4052
.option("-y, --yes", "Proceed with OAuth without prompting when already logged in")
53+
.option("--token <key>", TOKEN_OPTION_DESC)
4154
.action(async (opts) => {
4255
await login(opts);
4356
});

0 commit comments

Comments
 (0)