Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | export const CLI_RELEASE_TAG_PREFIX = '@composio/cli@'; |
| 2 | export const CLI_RELEASE_VERSION_DEFINE = '__COMPOSIO_CLI_RELEASE_VERSION__'; |
| 3 | |
| 4 | const CLI_RELEASE_TAG_PATTERN = |
| 5 | /^@composio\/cli@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)$/u; |
| 6 | |
| 7 | export const extractCliReleaseVersion = (releaseTag: string): string | undefined => |
| 8 | CLI_RELEASE_TAG_PATTERN.exec(releaseTag.trim())?.[1]; |
| 9 | |
| 10 | export const buildCliReleaseVersionDefineArgs = ( |
| 11 | releaseTag: string | undefined |
| 12 | ): ReadonlyArray<string> => { |
| 13 | if (!releaseTag?.trim()) return []; |
| 14 | |
| 15 | const releaseVersion = extractCliReleaseVersion(releaseTag); |
| 16 | if (!releaseVersion) { |
| 17 | throw new Error(`Invalid Composio CLI release tag: ${releaseTag}`); |
| 18 | } |
| 19 | |
| 20 | return ['--define', `${CLI_RELEASE_VERSION_DEFINE}=${JSON.stringify(releaseVersion)}`] as const; |
| 21 | }; |