@devries-cameron20 / composio Mirror · read-only / commits / a714bdb67
Fork 0

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 22, 22:00 UTC

fix(cli): login skeleton logic

jkomyno committed Jul 20, 2025 at 14:51 UTC a714bdb67f61514177a5a62142f9b4ceec0cdbb3
4 files changed +142 -13
pnpm-lock.yaml
+109 -6
@@ -529,9 +529,9 @@ importers:
529 '@effect/platform-node-shared':
530 specifier: ^0.40.4
531 version: 0.40.4(@effect/cluster@0.39.4(@effect/platform@0.85.2(effect@3.16.16))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(@effect/workflow@0.2.4(@effect/platform@0.85.2(effect@3.16.16))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(effect@3.16.16))(effect@3.16.16))(@effect/platform@0.85.2(effect@3.16.16))(@effect/rpc@0.62.4(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(@effect/sql@0.38.2(@effect/experimental@0.49.2(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(@effect/platform@0.85.2(effect@3.16.16))(effect@3.16.16))(effect@3.16.16)
532 - chalk:
533 - specifier: ^5.4.1
534 - version: 5.4.1
532 + ansis:
533 + specifier: ^4.1.0
534 + version: 4.1.0
535 effect:
536 specifier: ^3.16.16
537 version: 3.16.16
@@ -541,6 +541,9 @@ importers:
541 indent-string:
542 specifier: ^5.0.0
543 version: 5.0.0
544 + open:
545 + specifier: ^10.2.0
546 + version: 10.2.0
547 semver:
548 specifier: ^7.7.2
549 version: 7.7.2
@@ -3418,6 +3421,10 @@ packages:
3421 resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
3422 engines: {node: '>=12'}
3423
3424 + ansis@4.1.0:
3425 + resolution: {integrity: sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w==}
3426 + engines: {node: '>=14'}
3427 +
3428 any-promise@1.3.0:
3429 resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
3430
@@ -3514,6 +3521,10 @@ packages:
3521 bun-types@1.2.16:
3522 resolution: {integrity: sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A==}
3523
3524 + bundle-name@4.1.0:
3525 + resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}
3526 + engines: {node: '>=18'}
3527 +
3528 bundle-require@5.1.0:
3529 resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==}
3530 engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
@@ -3779,10 +3790,22 @@ packages:
3790 deep-is@0.1.4:
3791 resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
3792
3793 + default-browser-id@5.0.0:
3794 + resolution: {integrity: sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==}
3795 + engines: {node: '>=18'}
3796 +
3797 + default-browser@5.2.1:
3798 + resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==}
3799 + engines: {node: '>=18'}
3800 +
3801 define-lazy-prop@2.0.0:
3802 resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
3803 engines: {node: '>=8'}
3804
3805 + define-lazy-prop@3.0.0:
3806 + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
3807 + engines: {node: '>=12'}
3808 +
3809 defu@6.1.4:
3810 resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
3811
@@ -4461,6 +4484,11 @@ packages:
4484 engines: {node: '>=8'}
4485 hasBin: true
4486
4487 + is-docker@3.0.0:
4488 + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}
4489 + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
4490 + hasBin: true
4491 +
4492 is-extendable@0.1.1:
4493 resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}
4494 engines: {node: '>=0.10.0'}
@@ -4485,6 +4513,11 @@ packages:
4513 resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
4514 engines: {node: '>=0.10.0'}
4515
4516 + is-inside-container@1.0.0:
4517 + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==}
4518 + engines: {node: '>=14.16'}
4519 + hasBin: true
4520 +
4521 is-number@7.0.0:
4522 resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
4523 engines: {node: '>=0.12.0'}
@@ -4516,6 +4549,10 @@ packages:
4549 resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==}
4550 engines: {node: '>=8'}
4551
4552 + is-wsl@3.1.0:
4553 + resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==}
4554 + engines: {node: '>=16'}
4555 +
4556 isexe@2.0.0:
4557 resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
4558
@@ -4976,6 +5013,10 @@ packages:
5013 resolution: {integrity: sha512-M7CJbmv7UCopc0neRKdzfoGWaVZC+xC1925GitKH9EAqYFzX9//25Q7oX4+jw0tiCCj+t5l6VZh8UPH23NZkMA==}
5014 hasBin: true
5015
5016 + open@10.2.0:
5017 + resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}
5018 + engines: {node: '>=18'}
5019 +
5020 open@8.4.2:
5021 resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==}
5022 engines: {node: '>=12'}
@@ -5447,6 +5488,10 @@ packages:
5488 resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
5489 engines: {node: '>= 18'}
5490
5491 + run-applescript@7.0.0:
5492 + resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==}
5493 + engines: {node: '>=18'}
5494 +
5495 run-async@3.0.0:
5496 resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==}
5497 engines: {node: '>=0.12.0'}
@@ -6155,6 +6200,10 @@ packages:
6200 utf-8-validate:
6201 optional: true
6202
6203 + wsl-utils@0.1.0:
6204 + resolution: {integrity: sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==}
6205 + engines: {node: '>=18'}
6206 +
6207 xstate@5.19.4:
6208 resolution: {integrity: sha512-h1UMSYOB564NXqAI+VpXrxwaBdOJUh6LOStooQ+Rn/+gqJWtGBfjZn265BwFI8Mp4ZoOyoLDNf8X1yp3faBUZQ==}
6209
@@ -9359,6 +9408,14 @@ snapshots:
9408 chai: 5.2.0
9409 tinyrainbow: 2.0.0
9410
9411 + '@vitest/mocker@3.2.4(vite@6.3.5(@types/node@20.19.1)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
9412 + dependencies:
9413 + '@vitest/spy': 3.2.4
9414 + estree-walker: 3.0.3
9415 + magic-string: 0.30.17
9416 + optionalDependencies:
9417 + vite: 6.3.5(@types/node@20.19.1)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9418 +
9419 '@vitest/mocker@3.2.4(vite@6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
9420 dependencies:
9421 '@vitest/spy': 3.2.4
@@ -9367,6 +9424,14 @@ snapshots:
9424 optionalDependencies:
9425 vite: 6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9426
9427 + '@vitest/mocker@3.2.4(vite@6.3.5(@types/node@24.0.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
9428 + dependencies:
9429 + '@vitest/spy': 3.2.4
9430 + estree-walker: 3.0.3
9431 + magic-string: 0.30.17
9432 + optionalDependencies:
9433 + vite: 6.3.5(@types/node@24.0.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9434 +
9435 '@vitest/pretty-format@3.2.4':
9436 dependencies:
9437 tinyrainbow: 2.0.0
@@ -9396,7 +9461,7 @@ snapshots:
9461 sirv: 3.0.1
9462 tinyglobby: 0.2.14
9463 tinyrainbow: 2.0.0
9399 - vitest: 3.2.4(@types/node@22.15.32)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9464 + vitest: 3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9465
9466 '@vitest/utils@3.2.4':
9467 dependencies:
@@ -9479,6 +9544,8 @@ snapshots:
9544
9545 ansi-styles@6.2.1: {}
9546
9547 + ansis@4.1.0: {}
9548 +
9549 any-promise@1.3.0: {}
9550
9551 anymatch@3.1.3:
@@ -9591,6 +9658,10 @@ snapshots:
9658 dependencies:
9659 '@types/node': 24.0.3
9660
9661 + bundle-name@4.1.0:
9662 + dependencies:
9663 + run-applescript: 7.0.0
9664 +
9665 bundle-require@5.1.0(esbuild@0.25.5):
9666 dependencies:
9667 esbuild: 0.25.5
@@ -9846,8 +9917,17 @@ snapshots:
9917
9918 deep-is@0.1.4: {}
9919
9920 + default-browser-id@5.0.0: {}
9921 +
9922 + default-browser@5.2.1:
9923 + dependencies:
9924 + bundle-name: 4.1.0
9925 + default-browser-id: 5.0.0
9926 +
9927 define-lazy-prop@2.0.0: {}
9928
9929 + define-lazy-prop@3.0.0: {}
9930 +
9931 defu@6.1.4: {}
9932
9933 delayed-stream@1.0.0: {}
@@ -10590,6 +10670,8 @@ snapshots:
10670
10671 is-docker@2.2.1: {}
10672
10673 + is-docker@3.0.0: {}
10674 +
10675 is-extendable@0.1.1: {}
10676
10677 is-extglob@2.1.1: {}
@@ -10606,6 +10688,10 @@ snapshots:
10688 dependencies:
10689 is-extglob: 2.1.1
10690
10691 + is-inside-container@1.0.0:
10692 + dependencies:
10693 + is-docker: 3.0.0
10694 +
10695 is-number@7.0.0: {}
10696
10697 is-promise@4.0.0: {}
@@ -10626,6 +10712,10 @@ snapshots:
10712 dependencies:
10713 is-docker: 2.2.1
10714
10715 + is-wsl@3.1.0:
10716 + dependencies:
10717 + is-inside-container: 1.0.0
10718 +
10719 isexe@2.0.0: {}
10720
10721 jackspeak@3.4.3:
@@ -11041,6 +11131,13 @@ snapshots:
11131 dependencies:
11132 which-pm-runs: 1.1.0
11133
11134 + open@10.2.0:
11135 + dependencies:
11136 + default-browser: 5.2.1
11137 + define-lazy-prop: 3.0.0
11138 + is-inside-container: 1.0.0
11139 + wsl-utils: 0.1.0
11140 +
11141 open@8.4.2:
11142 dependencies:
11143 define-lazy-prop: 2.0.0
@@ -11516,6 +11613,8 @@ snapshots:
11613 transitivePeerDependencies:
11614 - supports-color
11615
11616 + run-applescript@7.0.0: {}
11617 +
11618 run-async@3.0.0: {}
11619
11620 run-parallel@1.2.0:
@@ -12227,7 +12326,7 @@ snapshots:
12326 dependencies:
12327 '@types/chai': 5.2.2
12328 '@vitest/expect': 3.2.4
12230 - '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12329 + '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@20.19.1)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12330 '@vitest/pretty-format': 3.2.4
12331 '@vitest/runner': 3.2.4
12332 '@vitest/snapshot': 3.2.4
@@ -12311,7 +12410,7 @@ snapshots:
12410 dependencies:
12411 '@types/chai': 5.2.2
12412 '@vitest/expect': 3.2.4
12314 - '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@22.15.32)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12413 + '@vitest/mocker': 3.2.4(vite@6.3.5(@types/node@24.0.3)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
12414 '@vitest/pretty-format': 3.2.4
12415 '@vitest/runner': 3.2.4
12416 '@vitest/snapshot': 3.2.4
@@ -12434,6 +12533,10 @@ snapshots:
12533
12534 ws@8.18.2: {}
12535
12536 + wsl-utils@0.1.0:
12537 + dependencies:
12538 + is-wsl: 3.1.0
12539 +
12540 xstate@5.19.4: {}
12541
12542 xtend@4.0.2: {}
ts/packages/cli/package.json
+2 -1
@@ -58,10 +58,11 @@
58 "@effect/cli": "^0.64.2",
59 "@effect/platform-bun": "^0.70.4",
60 "@effect/platform-node-shared": "^0.40.4",
61 - "chalk": "^5.4.1",
61 + "ansis": "^4.1.0",
62 "effect": "^3.16.16",
63 "effect-errors": "^1.10.11",
64 "indent-string": "^5.0.0",
65 + "open": "^10.2.0",
66 "semver": "^7.7.2",
67 "superjson": "^2.2.2"
68 },
ts/packages/cli/src/commands/generate.cmd.ts
+1 -1
@@ -34,7 +34,7 @@ export const generateCmd = Command.make('generate', { outputOpt }).pipe(
34 // Redirect to either `ts generate` or `py generate` commands
35 yield* Match.value(envLang).pipe(
36 Match.when('TypeScript', () =>
37 - generateTypescriptTypeStubs({ outputOpt, singleFile: false })
37 + generateTypescriptTypeStubs({ outputOpt, compact: false, transpiled: false })
38 ),
39 Match.when('Python', () => generatePythonTypeStubs({ outputOpt })),
40 Match.exhaustive
ts/packages/cli/src/commands/login.cmd.ts
+30 -5
@@ -1,8 +1,15 @@
1 -import { Command, Prompt } from '@effect/cli';
1 +import { Command, Options, Prompt } from '@effect/cli';
2 import { Effect, Console } from 'effect';
3 +import { green } from 'ansis';
4 +import open, { apps } from 'open';
5 import { ComposioSessionRepository } from 'src/services/composio-clients';
6 import { ComposioUserContext } from 'src/services/user-context';
7
8 +export const noBrowser = Options.boolean('no-browser').pipe(
9 + Options.withDefault(false),
10 + Options.withDescription('Login without browser interaction')
11 +);
12 +
13 /**
14 * CLI command to login using Composio's CLI session APIs.
15 *
@@ -11,11 +18,11 @@ import { ComposioUserContext } from 'src/services/user-context';
18 * composio login <command>
19 * ```
20 */
14 -export const loginCmd = Command.make('login', {}, () =>
21 +export const loginCmd = Command.make('login', { noBrowser }, ({ noBrowser }) =>
22 Effect.gen(function* () {
23 const ctx = yield* ComposioUserContext;
24
18 - if (!ctx.isLoggedIn) {
25 + if (ctx.isLoggedIn()) {
26 yield* Console.log(`✔ You're already logged in!.`);
27 yield* Console.log(
28 `✔ If you want to log in with a different account, please run \`composio logout\` first.`
@@ -30,10 +37,28 @@ export const loginCmd = Command.make('login', {}, () =>
37 const session = yield* client.createSession();
38
39 yield* Effect.logDebug(`Created session:`, session);
33 - yield* Console.log(`> Redirecting you to the login page`);
40
41 const url = `https://app.composio.dev?cliKey=${session.code}`;
36 - yield* Console.log(url);
42 +
43 + if (noBrowser) {
44 + yield* Console.log(`> Please login using the following URL:`);
45 + } else {
46 + yield* Console.log(`> Redirecting you to the login page`);
47 + }
48 +
49 + yield* Console.log(green`> ${url}`);
50 +
51 + if (!noBrowser) {
52 + // Open the given `url` in the default browser
53 + yield* Effect.tryPromise(() =>
54 + open(url, {
55 + app: {
56 + name: apps.browser,
57 + },
58 + wait: false,
59 + })
60 + );
61 + }
62
63 const authenticationCode = yield* Prompt.text({
64 message: '> Please enter the authentication code:',