Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(cli): drop redirect copy when link runs with --no-browser
Sarah Simionescuaad2e9a2fd7d
diff --git a/ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.link.cmd.ts b/ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.link.cmd.tsindex 361403285..89dd85024 100644--- a/ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.link.cmd.ts+++ b/ts/packages/cli/src/commands/connected-accounts/commands/connected-accounts.link.cmd.ts@@ -75,10 +75,14 @@ const list = Options.boolean('list').pipe(const showRedirectUrl = (ui: TerminalUI,redirectUrl: string,- options?: { readonly emitRaw?: boolean }+ options?: { readonly emitRaw?: boolean; readonly manual?: boolean }) =>Effect.gen(function* () {- yield* ui.log.step('Redirecting you to the authorization page');+ yield* ui.log.step(+ options?.manual+ ? 'Open this URL in your browser to authorize'+ : 'Redirecting you to the authorization page'+ );yield* ui.note(redirectUrl, 'Redirect URL');if (options?.emitRaw) {yield* ui.output(redirectUrl);@@ -93,7 +97,7 @@ const waitForActiveConnection = (noBrowser: boolean) =>Effect.gen(function* () {- yield* showRedirectUrl(ui, redirectUrl);+ yield* showRedirectUrl(ui, redirectUrl, { manual: noBrowser });let urlSchemeValid = false;try {@@ -106,9 +110,7 @@ const waitForActiveConnection = (if (!urlSchemeValid) {yield* ui.log.warn(`Redirect URL has an unexpected scheme: ${redirectUrl}`);yield* ui.log.info('Open the URL manually if you trust the source.');- } else if (noBrowser) {- yield* ui.log.info('Open the URL above in your browser to authorize.');- } else {+ } else if (!noBrowser) {yield* Effect.tryPromise(() => open(redirectUrl, { wait: false })).pipe(Effect.catchAll(error =>Effect.gen(function* () {diff --git a/ts/packages/cli/test/src/commands/connected-accounts/connected-accounts.link.cmd.test.ts b/ts/packages/cli/test/src/commands/connected-accounts/connected-accounts.link.cmd.test.tsindex 6f87544d7..79ee6d7aa 100644--- a/ts/packages/cli/test/src/commands/connected-accounts/connected-accounts.link.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/connected-accounts/connected-accounts.link.cmd.test.ts@@ -143,6 +143,8 @@ describe('CLI: composio dev connected-accounts link', () => {expect(parsed?.status).toBe('success');expect(parsed?.connected_account_id).toBe('con_test_link');expect(output).toContain('https://app.composio.dev/link?token=lt_test_token');+ expect(output).toContain('Open this URL in your browser to authorize');+ expect(output).not.toContain('Redirecting you to the authorization page');expect(vi.mocked(open)).not.toHaveBeenCalled();}));