```diff
--- test_files/447-original.txt	2025-03-07 19:07:00
+++ test_files/447-modified.txt	2025-03-07 19:07:00
@@ -1,13 +1,40 @@
+/* eslint-disable no-console */
 import chalk from "chalk";
 import { Command } from "commander";
-import { Composio } from "../sdk";
 import inquirer from "inquirer";
 import open from "open";
-import { GetConnectorListResDTO } from "../sdk/client";
+import { z } from "zod";
+import { Composio } from "../sdk";
+import { GetConnectorInfoResDTO, GetConnectorListResDTO } from "../sdk/client";
+import { ZAuthMode } from "../sdk/types/integration";
 
+type TInputField = {
+  name: string;
+  displayName?: string;
+  display_name?: string;
+  expected_from_customer?: boolean;
+  required?: boolean;
+  message_name?: string;
+  type?: string;
+};
+
+type THandleActionOptions = {
+  force?: boolean;
+  skipDefaultConnector?: boolean;
+  noBrowser?: boolean;
+  integrationId?: string;
+  authMode?: string;
+  scope?: string[];
+  label?: string[];
+};
+
+type TAuthScheme = {
+  auth_mode: string;
+  fields: TInputField[];
+};
+
 export default class AddCommand {
   private program: Command;
-  private composioClient: Composio;
 
   constructor(program: Command) {
     this.program = program;
@@ -16,58 +43,122 @@
       .description("Add a new app")
       .argument("<app-name>", "The name of the app")
       .option("-f, --force", "Force the connection setup")
+      .option(
+        "--skip-default-connector",
+        "Skip the default connector auth prompt"
+      )
+      .option("-n, --no-browser", "Don't open browser for verifying connection")
+      .option(
+        "-i, --integration-id <id>",
+        "Specify integration ID to use existing integration"
+      )
+      .option("-a, --auth-mode <mode>", "Specify auth mode for given app")
+      .option(
+        "-s, --scope <scope>",
+        "Specify scopes for the connection",
+        (value, previous: string[]) => previous.concat([value]),
+        []
+      )
+      .option(
+        "-l, --label <label>",
+        "Labels for connected account",
+        (value, previous: string[]) => previous.concat([value]),
+        []
+      )
       .action(this.handleAction.bind(this));
-
-    this.composioClient = new Composio();
   }
 
   private async handleAction(
     appName: string,
-    options: { force?: boolean },
+    options: THandleActionOptions
   ): Promise<void> {
-    let integration: GetConnectorListResDTO | undefined =
-      await this.composioClient.integrations.list({
-        // @ts-ignore
+    const composioClient = new Composio({});
+    let integration:
+      | GetConnectorInfoResDTO
+      | GetConnectorListResDTO
+      | undefined;
+
+    if (options.integrationId) {
+      integration = await composioClient.integrations.get({
+        integrationId: options.integrationId,
+      });
+    } else {
+      integration = await composioClient.integrations.list({
         appName: appName.toLowerCase(),
       });
+    }
 
-
-    if (integration?.items.length === 0) {
-      integration = (await this.createIntegration(
+    let firstIntegration: GetConnectorInfoResDTO | undefined;
+    if (
+      (integration as GetConnectorListResDTO)?.items?.length === 0 ||
+      options.force ||
+      options.skipDefaultConnector
+    ) {
+      const integrationResult = await this.createIntegration(
         appName,
-      )) as GetConnectorListResDTO;
-    }
+        options.skipDefaultConnector,
+        options.authMode,
+        options
+      );
 
-    const firstIntegration = (integration as GetConnectorListResDTO)?.items[0];
+      if (integrationResult) {
+        firstIntegration =
+          integrationResult as unknown as GetConnectorInfoResDTO;
+      }
+    } else {
+      firstIntegration = integration as GetConnectorInfoResDTO;
+    }
     if (!firstIntegration) {
       console.log(chalk.red("No integration found or created"));
       return;
     }
 
-    const connection = await this.composioClient.connectedAccounts.list({
-      // @ts-ignore
+    const connection = await composioClient.connectedAccounts.list({
       integrationId: firstIntegration.id,
     });
 
     if (connection.items.length > 0 && !options.force) {
-      console.log(chalk.green("Connection already exists for", appName));
-      return;
+      await this.shouldForceConnectionSetup();
     }
 
-    // @ts-ignore
-    await this.setupConnections(firstIntegration.id);
+    if (firstIntegration && firstIntegration.id) {
+      await this.setupConnections(firstIntegration.id, options);
+    } else {
+      console.log(chalk.red("Integration ID is undefined"));
+    }
   }
 
+  async shouldForceConnectionSetup() {
+    const prompt = inquirer.createPromptModule();
+    const { shouldForce } = await prompt([
+      {
+        type: "confirm",
+        name: "shouldForce",
+        message:
+          "A connection already exists. Do you want to force a new connection?",
+        default: false,
+      },
+    ]);
+
+    if (!shouldForce) {
+      console.log(
+        chalk.yellow("Operation cancelled. Existing connection will be used.")
+      );
+      process.exit(0);
+    }
+  }
+
   private async waitUntilConnected(
     connectedAccountId: string,
-    timeout: number = 30000,
+    timeout: number = 30000
   ): Promise<void> {
+    const composioClient = new Composio({});
     const startTime = Date.now();
     const pollInterval = 3000; // 3 seconds
 
     while (Date.now() - startTime < timeout) {
       try {
-        const data = (await this.composioClient.connectedAccounts.get({
+        const data = (await composioClient.connectedAccounts.get({
           connectedAccountId: connectedAccountId,
         })) as { status: string };
 
@@ -82,31 +173,41 @@
     }
 
     throw new Error(
-      `Connection did not become active within ${timeout / 1000} seconds`,
+      `Connection did not become active within ${timeout / 1000} seconds`
     );
   }
 
-  private async setupConnections(integrationId: string): Promise<void> {
-    const data = await this.composioClient.integrations.get({ integrationId });
-    const { expectedInputFields } = data;
+  private async setupConnections(
+    integrationId: string,
+    options: Record<string, unknown>
+  ): Promise<void> {
+    const composioClient = new Composio({});
+    const data = await composioClient.integrations.get({ integrationId });
+    const { expectedInputFields } = data!;
 
+    const config = await this.collectInputFields(
+      expectedInputFields as unknown as TInputField[],
+      true
+    );
 
+    if (options.scope) {
+      config.scopes = (options.scope as string[]).join(",");
+    }
 
-    const config = await this.collectInputFields(expectedInputFields, true);
-
-    const connectionData = await this.composioClient.connectedAccounts.create({
+    const connectionData = await composioClient.connectedAccounts.initiate({
       integrationId,
-      data: config,
+      connectionParams: config,
+      labels: options.label as string[],
     });
 
     if (connectionData.connectionStatus === "ACTIVE") {
       console.log(chalk.green("Connection created successfully"));
     }
 
-    if (connectionData.redirectUrl) {
+    if (connectionData.redirectUrl && !options.noBrowser) {
       console.log(
         chalk.white("Redirecting to the app"),
-        chalk.blue(connectionData.redirectUrl),
+        chalk.blue(connectionData.redirectUrl)
       );
       open(connectionData.redirectUrl);
 
@@ -114,26 +215,73 @@
 
       console.log(chalk.green("Connection is active"));
       process.exit(0);
+    } else if (connectionData.redirectUrl && options.noBrowser) {
+      console.log(
+        chalk.white(
+          "Please authenticate the app by visiting the following URL:"
+        ),
+        chalk.blue(connectionData.redirectUrl)
+      );
+      console.log(
+        chalk.green("Waiting for the connection to become active...")
+      );
+
+      await this.waitUntilConnected(connectionData.connectedAccountId);
+
+      console.log(chalk.green("Connection is active"));
+      process.exit(0);
     }
   }
 
-  private async createIntegration(appName: string) {
-    const app = await this.composioClient.apps.get({
+  private async createIntegration(
+    appName: string,
+    skipDefaultConnectorAuth: boolean = false,
+    userAuthMode?: string,
+    options?: THandleActionOptions
+  ) {
+    const composioClient = new Composio({});
+    const app = await composioClient.apps.get({
       appKey: appName.toLowerCase(),
     });
 
-
     if (app.no_auth) {
-        console.log(chalk.green(`The app '${appName}' does not require authentication. You can connect it directly.\n`));
-        process.exit(0);
+      console.log(
+        chalk.green(
+          `The app '${appName}' does not require authentication. You can connect it directly.\n`
+        )
+      );
+      process.exit(0);
     }
 
-    const config: Record<string, any> = {};
+    const testConnectors = app.testConnectors || [];
 
-    const { integrationName } = await inquirer.prompt({
+    const config: Record<string, unknown> = {};
+    let useComposioAuth = true;
+    const authSchemeExpectOauth = ["bearer_token", "api_key", "basic"];
+    if (
+      !app.no_auth &&
+      testConnectors.length > 0 &&
+      !skipDefaultConnectorAuth &&
+      testConnectors.find((connector) => connector.auth_mode === userAuthMode)
+    ) {
+      const prompt = inquirer.createPromptModule();
+      const { doYouWantToUseComposioAuth } = await prompt({
+        type: "confirm",
+        name: "doYouWantToUseComposioAuth",
+        message: "Do you want to use Composio Auth?",
+      });
+      useComposioAuth = doYouWantToUseComposioAuth;
+    }
+
+    if (skipDefaultConnectorAuth) {
+      useComposioAuth = false;
+    }
+
+    const prompt = inquirer.createPromptModule();
+    const { integrationName } = await prompt({
       type: "input",
       name: "integrationName",
-      message: "Enter the app name",
+      message: "Enter the Integration name",
     });
 
     if (!integrationName) {
@@ -142,55 +290,135 @@
     }
 
     config.name = integrationName;
-    // @ts-ignore
-    const authSchema = app.auth_schemes[0]?.auth_mode;
+    const authSchema: string | undefined =
+      userAuthMode ||
+      (app.auth_schemes &&
+        (app.auth_schemes[0]?.auth_mode as string | undefined));
 
-    // @ts-ignore
-    if (app?.testConnectors?.length > 0 || app.no_auth) {
-      let useComposioAuth = false;
-      if (!app.no_auth) {
-        const { doYouWantToUseComposioAuth } = await inquirer.prompt({
-          type: "confirm",
-          name: "doYouWantToUseComposioAuth",
-          message: "Do you want to use Composio Auth?",
-        });
-        useComposioAuth = doYouWantToUseComposioAuth;
-      }
+    const authModes = (app.auth_schemes || []).reduce(
+      (acc, scheme: Record<string, unknown>) => {
+        acc[scheme.auth_mode as string] = scheme;
+        return acc;
+      },
+      {}
+    );
 
-      config.useComposioAuth = useComposioAuth;
-      return this.setupIntegration(app, authSchema, useComposioAuth, config);
+    if (
+      authSchema &&
+      typeof authSchema === "string" &&
+      !authModes[authSchema]
+    ) {
+      console.log(
+        chalk.red(
+          `Invalid value for auth_mode, select from ${Object.keys(authModes)}`
+        )
+      );
+      return null;
     }
 
+    const selectedAuthMode = authSchema || Object.keys(authModes)[0];
+    const selectedAuthScheme = authModes[selectedAuthMode];
 
+    if (authSchemeExpectOauth.includes(selectedAuthMode.toLowerCase())) {
+      return this.handleBasicAuth(
+        app,
+        selectedAuthMode,
+        selectedAuthScheme as TAuthScheme,
+        config,
+        integrationName
+      );
+    }
+
+    return this.handleOAuth(
+      app,
+      selectedAuthMode,
+      selectedAuthScheme as TAuthScheme,
+      config,
+      integrationName,
+      options?.noBrowser ?? false,
+      options?.scope ?? [],
+      useComposioAuth
+    );
+  }
+
+  private async handleBasicAuth(
+    app: Record<string, unknown>,
+    authMode: string,
+    authScheme: TAuthScheme,
+    config: Record<string, unknown>,
+    integrationName: string
+  ) {
+    const composioClient = new Composio({});
+    const authConfig = await this.collectInputFields(authScheme.fields);
+
+    const integration = await composioClient.integrations.create({
+      appId: app.appId as string,
+      authScheme: authMode as unknown as z.infer<typeof ZAuthMode>,
+      useComposioAuth: false,
+      name: integrationName,
+      authConfig,
+    });
+
+    return integration;
+  }
+
+  private async handleOAuth(
+    app: Record<string, unknown>,
+    authMode: string,
+    authScheme: TAuthScheme,
+    config: Record<string, unknown>,
+    integrationName: string,
+    noBrowser: boolean,
+    scopes: string[],
+    useComposioAuth: boolean
+  ) {
+    if (useComposioAuth) {
+      return this.setupIntegration(
+        app as {
+          appId: string;
+        },
+        authMode,
+        useComposioAuth,
+        {},
+        integrationName
+      );
+    }
+
     const authConfig = await this.collectInputFields(
-      // @ts-ignore
-      app.auth_schemes[0].fields,
+      authScheme.fields as TInputField[]
     );
-    return this.setupIntegration(app, authSchema, false, authConfig);
+
+    if (scopes) {
+      authConfig.scopes = scopes.join(",");
+    }
+
+    return this.setupIntegration(
+      app as {
+        appId: string;
+      },
+      authMode,
+      useComposioAuth,
+      authConfig,
+      integrationName
+    );
   }
 
   async collectInputFields(
-    fields: {
-      name: string;
-      displayName: string;
-      display_name: string;
-      expected_from_customer: boolean;
-      required: boolean;
-      type: string;
-    }[],
-    isConnection = false,
-  ): Promise<Record<string, any>> {
-    const config: Record<string, any> = {};
+    fields: TInputField[],
+    isConnection = false
+  ): Promise<Record<string, unknown>> {
+    const config: Record<string, unknown> = {};
 
     for (const field of fields) {
       if (field.expected_from_customer && !isConnection) {
         continue;
       }
 
-      const { [field.name]: value } = await inquirer.prompt({
+      const prompt = inquirer.createPromptModule();
+      const { [field.name]: value } = await prompt({
         type: "input",
         name: field.name,
-        message: field.displayName || field.display_name,
+        message: (field.displayName || field.display_name) as string,
       });
 
       if (value) {
@@ -202,22 +430,22 @@
   }
 
   async setupIntegration(
-    app: any,
-    authMode: any,
+    app: {
+      appId: string;
+    },
+    authMode: string,
     useComposioAuth: boolean,
-    config: Record<string, any>,
+    config: Record<string, unknown>,
+    name: string
   ) {
-    await this.composioClient.integrations.create({
-      appId: app.id,
-      authScheme: authMode,
+    const composioClient = new Composio({});
+    const integration = await composioClient.integrations.create({
+      appId: app.appId,
+      authScheme: authMode as unknown as z.infer<typeof ZAuthMode>,
       useComposioAuth,
-
+      name,
       authConfig: config,
     });
-
-    return this.composioClient.integrations.list({
-      // @ts-ignore
-      appName: app.name.toLowerCase(),
-    });
+    return integration;
   }
 }
```
