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, 04:45 UTC
| 1 | import { Argument, Command, Flag } from 'effect/cli'; |
| 2 | import { runAuthConfigsCreate } from './auth-configs.create.handler'; |
| 3 | |
| 4 | const name = Argument.String('name').pipe( |
| 5 | Argument.withDescription('Display name for the auth config'), |
| 6 | Argument.optional |
| 7 | ); |
| 8 | |
| 9 | const toolkit = Flag.String('toolkit').pipe(Flag.withDescription('Toolkit slug (e.g. "gmail")')); |
| 10 | |
| 11 | const authScheme = Flag.String('auth-scheme').pipe( |
| 12 | Flag.withDescription( |
| 13 | 'Auth scheme (e.g. OAUTH2, API_KEY, BEARER_TOKEN). If omitted, uses Composio managed defaults.' |
| 14 | ), |
| 15 | Flag.optional |
| 16 | ); |
| 17 | |
| 18 | const scopes = Flag.String('scopes').pipe( |
| 19 | Flag.withDescription('Comma-separated scopes (OAuth only, e.g. "send_email,read_email")'), |
| 20 | Flag.optional |
| 21 | ); |
| 22 | |
| 23 | const customCredentials = Flag.String('custom-credentials').pipe( |
| 24 | Flag.withDescription('Custom credentials as JSON string (for white-labeling)'), |
| 25 | Flag.optional |
| 26 | ); |
| 27 | |
| 28 | /** |
| 29 | * Create a new auth config. |
| 30 | * |
| 31 | * @example |
| 32 | * ```bash |
| 33 | * # Composio-managed defaults |
| 34 | * composio dev auth-configs create "my-gmail-config" --toolkit "gmail" |
| 35 | * |
| 36 | * # Custom auth with specific scheme |
| 37 | * composio dev auth-configs create "custom-gmail" --toolkit "gmail" --auth-scheme "OAUTH2" --scopes "send_email" |
| 38 | * |
| 39 | * # White-labeling with custom credentials |
| 40 | * composio dev auth-configs create "custom-gmail" --toolkit "gmail" --auth-scheme "OAUTH2" --custom-credentials '{"client_id":"...","client_secret":"..."}' |
| 41 | * ``` |
| 42 | */ |
| 43 | export const authConfigsCmd$Create = Command.make( |
| 44 | 'create', |
| 45 | { name, toolkit, authScheme, scopes, customCredentials }, |
| 46 | runAuthConfigsCreate |
| 47 | ).pipe(Command.withDescription('Create a new auth config.')); |