Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(cli): login skeleton logic

jkomynoa714bdb67f61
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4f4c3bd55..e3e6437a1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -529,9 +529,9 @@ importers:
'@effect/platform-node-shared':
specifier: ^0.40.4
- chalk:
- specifier: ^5.4.1
- version: 5.4.1
+ ansis:
+ specifier: ^4.1.0
+ version: 4.1.0
effect:
specifier: ^3.16.16
version: 3.16.16
@@ -541,6 +541,9 @@ importers:
indent-string:
specifier: ^5.0.0
version: 5.0.0
+ open:
+ specifier: ^10.2.0
+ version: 10.2.0
semver:
specifier: ^7.7.2
version: 7.7.2
@@ -3418,6 +3421,10 @@ packages:
resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
engines: {node: '>=12'}
+ resolution: {integrity: sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w==}
+ engines: {node: '>=14'}
+
resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==}
@@ -3514,6 +3521,10 @@ packages:
resolution: {integrity: sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A==}
+ resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
@@ -3779,10 +3790,22 @@ packages:
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
+ resolution: {integrity: sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
+ engines: {node: '>=12'}
+
resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
@@ -4461,6 +4484,11 @@ packages:
engines: {node: '>=8'}
hasBin: true
+ resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}
+ engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+ hasBin: true
+
resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}
engines: {node: '>=0.10.0'}
@@ -4485,6 +4513,11 @@ packages:
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==}
+ engines: {node: '>=14.16'}
+ hasBin: true
+
resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==}
engines: {node: '>=0.12.0'}
@@ -4516,6 +4549,10 @@ packages:
resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==}
+ engines: {node: '>=16'}
+
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
@@ -4976,6 +5013,10 @@ packages:
resolution: {integrity: sha512-M7CJbmv7UCopc0neRKdzfoGWaVZC+xC1925GitKH9EAqYFzX9//25Q7oX4+jw0tiCCj+t5l6VZh8UPH23NZkMA==}
hasBin: true
+ resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==}
engines: {node: '>=12'}
@@ -5447,6 +5488,10 @@ packages:
resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
engines: {node: '>= 18'}
+ resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==}
engines: {node: '>=0.12.0'}
@@ -6155,6 +6200,10 @@ packages:
utf-8-validate:
optional: true
+ resolution: {integrity: sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-h1UMSYOB564NXqAI+VpXrxwaBdOJUh6LOStooQ+Rn/+gqJWtGBfjZn265BwFI8Mp4ZoOyoLDNf8X1yp3faBUZQ==}
@@ -9359,6 +9408,14 @@ snapshots:
chai: 5.2.0
tinyrainbow: 2.0.0
+ dependencies:
+ '@vitest/spy': 3.2.4
+ estree-walker: 3.0.3
+ magic-string: 0.30.17
+ optionalDependencies:
+
dependencies:
'@vitest/spy': 3.2.4
@@ -9367,6 +9424,14 @@ snapshots:
optionalDependencies:
+ dependencies:
+ '@vitest/spy': 3.2.4
+ estree-walker: 3.0.3
+ magic-string: 0.30.17
+ optionalDependencies:
+
'@vitest/[email protected]':
dependencies:
tinyrainbow: 2.0.0
@@ -9396,7 +9461,7 @@ snapshots:
sirv: 3.0.1
tinyglobby: 0.2.14
tinyrainbow: 2.0.0
'@vitest/[email protected]':
dependencies:
@@ -9479,6 +9544,8 @@ snapshots:
+
@@ -9591,6 +9658,10 @@ snapshots:
dependencies:
'@types/node': 24.0.3
+ dependencies:
+ run-applescript: 7.0.0
+
dependencies:
esbuild: 0.25.5
@@ -9846,8 +9917,17 @@ snapshots:
+
+ dependencies:
+ bundle-name: 4.1.0
+ default-browser-id: 5.0.0
+
+
@@ -10590,6 +10670,8 @@ snapshots:
+
@@ -10606,6 +10688,10 @@ snapshots:
dependencies:
is-extglob: 2.1.1
+ dependencies:
+ is-docker: 3.0.0
+
@@ -10626,6 +10712,10 @@ snapshots:
dependencies:
is-docker: 2.2.1
+ dependencies:
+ is-inside-container: 1.0.0
+
@@ -11041,6 +11131,13 @@ snapshots:
dependencies:
which-pm-runs: 1.1.0
+ dependencies:
+ default-browser: 5.2.1
+ define-lazy-prop: 3.0.0
+ is-inside-container: 1.0.0
+ wsl-utils: 0.1.0
+
dependencies:
define-lazy-prop: 2.0.0
@@ -11516,6 +11613,8 @@ snapshots:
transitivePeerDependencies:
- supports-color
+
@@ -12227,7 +12326,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -12311,7 +12410,7 @@ snapshots:
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -12434,6 +12533,10 @@ snapshots:
+ dependencies:
+ is-wsl: 3.1.0
+
diff --git a/ts/packages/cli/package.json b/ts/packages/cli/package.json
index 4f04fb0c6..10f4e0e01 100644
--- a/ts/packages/cli/package.json
+++ b/ts/packages/cli/package.json
@@ -58,10 +58,11 @@
"@effect/cli": "^0.64.2",
"@effect/platform-bun": "^0.70.4",
"@effect/platform-node-shared": "^0.40.4",
- "chalk": "^5.4.1",
+ "ansis": "^4.1.0",
"effect": "^3.16.16",
"effect-errors": "^1.10.11",
"indent-string": "^5.0.0",
+ "open": "^10.2.0",
"semver": "^7.7.2",
"superjson": "^2.2.2"
},
diff --git a/ts/packages/cli/src/commands/generate.cmd.ts b/ts/packages/cli/src/commands/generate.cmd.ts
index 649049ee0..70c79df02 100644
--- a/ts/packages/cli/src/commands/generate.cmd.ts
+++ b/ts/packages/cli/src/commands/generate.cmd.ts
@@ -34,7 +34,7 @@ export const generateCmd = Command.make('generate', { outputOpt }).pipe(
// Redirect to either `ts generate` or `py generate` commands
yield* Match.value(envLang).pipe(
Match.when('TypeScript', () =>
- generateTypescriptTypeStubs({ outputOpt, singleFile: false })
+ generateTypescriptTypeStubs({ outputOpt, compact: false, transpiled: false })
),
Match.when('Python', () => generatePythonTypeStubs({ outputOpt })),
Match.exhaustive
diff --git a/ts/packages/cli/src/commands/login.cmd.ts b/ts/packages/cli/src/commands/login.cmd.ts
index 803eba08d..6aefe1ca4 100644
--- a/ts/packages/cli/src/commands/login.cmd.ts
+++ b/ts/packages/cli/src/commands/login.cmd.ts
@@ -1,8 +1,15 @@
-import { Command, Prompt } from '@effect/cli';
+import { Command, Options, Prompt } from '@effect/cli';
import { Effect, Console } from 'effect';
+import { green } from 'ansis';
+import open, { apps } from 'open';
import { ComposioSessionRepository } from 'src/services/composio-clients';
import { ComposioUserContext } from 'src/services/user-context';
+export const noBrowser = Options.boolean('no-browser').pipe(
+ Options.withDefault(false),
+ Options.withDescription('Login without browser interaction')
+);
+
/**
* CLI command to login using Composio's CLI session APIs.
*
@@ -11,11 +18,11 @@ import { ComposioUserContext } from 'src/services/user-context';
* composio login <command>
* ```
*/
-export const loginCmd = Command.make('login', {}, () =>
+export const loginCmd = Command.make('login', { noBrowser }, ({ noBrowser }) =>
Effect.gen(function* () {
const ctx = yield* ComposioUserContext;
- if (!ctx.isLoggedIn) {
+ if (ctx.isLoggedIn()) {
yield* Console.log(`✔ You're already logged in!.`);
yield* Console.log(
`✔ 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', {}, () =>
const session = yield* client.createSession();
yield* Effect.logDebug(`Created session:`, session);
- yield* Console.log(`> Redirecting you to the login page`);
const url = `https://app.composio.dev?cliKey=${session.code}`;
- yield* Console.log(url);
+
+ if (noBrowser) {
+ yield* Console.log(`> Please login using the following URL:`);
+ } else {
+ yield* Console.log(`> Redirecting you to the login page`);
+ }
+
+ yield* Console.log(green`> ${url}`);
+
+ if (!noBrowser) {
+ // Open the given `url` in the default browser
+ yield* Effect.tryPromise(() =>
+ open(url, {
+ app: {
+ name: apps.browser,
+ },
+ wait: false,
+ })
+ );
+ }
const authenticationCode = yield* Prompt.text({
message: '> Please enter the authentication code:',