Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 18:30 UTC
fix(cli): drop redirect copy when link runs with --no-browser
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sarah Simionescu committed
Jul 13, 2026 at 15:21 UTC
aad2e9a2fd7d49333bd24eccdfe97ce225940613
2 files changed
+10
-6
ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.link.cmd.ts
+8
-6
@@ -75,10 +75,14 @@ const list = Options.boolean('list').pipe(
75
const showRedirectUrl = (
76
ui: TerminalUI,
77
redirectUrl: string,
78
- options?: { readonly emitRaw?: boolean }
78
+ options?: { readonly emitRaw?: boolean; readonly manual?: boolean }
79
) =>
80
Effect.gen(function* () {
81
- yield* ui.log.step('Redirecting you to the authorization page');
81
+ yield* ui.log.step(
82
+ options?.manual
83
+ ? 'Open this URL in your browser to authorize'
84
+ : 'Redirecting you to the authorization page'
85
+ );
86
yield* ui.note(redirectUrl, 'Redirect URL');
87
if (options?.emitRaw) {
88
yield* ui.output(redirectUrl);
@@ -93,7 +97,7 @@ const waitForActiveConnection = (
97
noBrowser: boolean
98
) =>
99
Effect.gen(function* () {
96
- yield* showRedirectUrl(ui, redirectUrl);
100
+ yield* showRedirectUrl(ui, redirectUrl, { manual: noBrowser });
101
102
let urlSchemeValid = false;
103
try {
@@ -106,9 +110,7 @@ const waitForActiveConnection = (
110
if (!urlSchemeValid) {
111
yield* ui.log.warn(`Redirect URL has an unexpected scheme: ${redirectUrl}`);
112
yield* ui.log.info('Open the URL manually if you trust the source.');
109
- } else if (noBrowser) {
110
- yield* ui.log.info('Open the URL above in your browser to authorize.');
111
- } else {
113
+ } else if (!noBrowser) {
114
yield* Effect.tryPromise(() => open(redirectUrl, { wait: false })).pipe(
115
Effect.catchAll(error =>
116
Effect.gen(function* () {
ts/packages/cli/test/src/commands/connected-accounts/connected-accounts.link.cmd.test.ts
+2
@@ -143,6 +143,8 @@ describe('CLI: composio dev connected-accounts link', () => {
143
expect(parsed?.status).toBe('success');
144
expect(parsed?.connected_account_id).toBe('con_test_link');
145
expect(output).toContain('https://app.composio.dev/link?token=lt_test_token');
146
+ expect(output).toContain('Open this URL in your browser to authorize');
147
+ expect(output).not.toContain('Redirecting you to the authorization page');
148
expect(vi.mocked(open)).not.toHaveBeenCalled();
149
})
150
);