Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@biomejs/biome": "^2.0.0",
"@clack/prompts": "^0.11.0",
"@clack/prompts": "^1.0.1",
"@types/bun": "^1.2.15",
"@types/common-tags": "^1.8.4",
"@types/cors": "^2.8.19",
Expand Down
22 changes: 10 additions & 12 deletions src/cli/commands/connectors/oauth-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface OAuthPromptOptions {
}

/**
* Clack's block() puts stdin in raw mode where Ctrl+C calls process.exit(0)
* Clack's block() puts stdin in raw mode where Ctrl+C/Esc calls process.exit(0)
* directly instead of emitting SIGINT. We override process.exit temporarily
* so Ctrl+C/Esc skips the current connector instead of killing the process.
*/
Expand All @@ -42,7 +42,6 @@ async function runOAuthFlowWithSkip(
): Promise<OAuthFlowStatus> {
await open(connector.redirectUrl);

// Mutated inside the pWaitFor callback — use `as` to prevent TS narrowing
let finalStatus = "PENDING" as OAuthFlowStatus;
let skipped = false;

Expand All @@ -51,7 +50,6 @@ async function runOAuthFlowWithSkip(
const originalExit = process.exit;
process.exit = (() => {
skipped = true;
s.stop(`${connector.type} skipped`);
}) as unknown as typeof process.exit;

s.start(`Waiting for ${connector.type} authorization... (Esc to skip)`);
Expand Down Expand Up @@ -84,14 +82,14 @@ async function runOAuthFlowWithSkip(
} finally {
process.exit = originalExit;

if (!skipped) {
if (finalStatus === "ACTIVE") {
s.stop(`${connector.type} authorization complete`);
} else if (finalStatus === "FAILED") {
s.stop(`${connector.type} authorization failed`);
} else {
s.stop(`${connector.type} authorization timed out`);
}
if (skipped) {
s.cancel(`${connector.type} skipped`);
} else if (finalStatus === "ACTIVE") {
s.stop(`${connector.type} authorization complete`);
} else if (finalStatus === "FAILED") {
s.error(`${connector.type} authorization failed`);
} else {
s.error(`${connector.type} authorization timed out`);
}
}

Expand Down Expand Up @@ -135,7 +133,7 @@ export async function promptOAuthFlows(

for (const connector of pending) {
try {
log.info(`\nOpening browser for ${connector.type}...`);
log.info(`Opening browser for ${connector.type}...`);
const status = await runOAuthFlowWithSkip(connector);
outcomes.set(connector.type, status);
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/utils/runTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function runTask<T>(
s.stop(options?.successMessage || startMessage);
return result;
} catch (error) {
s.stop(options?.errorMessage || "Failed");
s.error(options?.errorMessage || "Failed");
throw error;
}
}
Loading