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 | #!/usr/bin/env bun |
| 2 | |
| 3 | /** |
| 4 | * Build all platform binaries via Bun cross-compilation. |
| 5 | * |
| 6 | * Usage: `bun scripts/build-all-binaries.ts` |
| 7 | * |
| 8 | * Builds every target in `RELEASE_TARGETS` sequentially. |
| 9 | * |
| 10 | * Output: `dist/binaries/composio-*` |
| 11 | */ |
| 12 | |
| 13 | import { Config, ConfigProvider, Console, Effect, Logger, Layer, References } from 'effect'; |
| 14 | import * as BunServices from '@effect/platform-bun/BunServices'; |
| 15 | import * as BunRuntime from '@effect/platform-bun/BunRuntime'; |
| 16 | import { buildCompanionModules, compileBinary, teardown } from './_shared'; |
| 17 | import { RELEASE_TARGETS } from './_release-artifacts'; |
| 18 | |
| 19 | export function buildAllBinaries() { |
| 20 | return Effect.gen(function* () { |
| 21 | yield* Console.log(`Building ${RELEASE_TARGETS.length} platform binaries...`); |
| 22 | |
| 23 | for (const target of RELEASE_TARGETS) { |
| 24 | yield* Console.log(`\nBuilding ${target.artifact} (${target.bunTarget})...`); |
| 25 | const outfile = yield* compileBinary(target); |
| 26 | yield* Console.log(`Built: ${outfile}`); |
| 27 | } |
| 28 | |
| 29 | const companionOutputDir = './dist/binaries/companions'; |
| 30 | yield* Console.log(`\nBuilding run companion modules in ${companionOutputDir}...`); |
| 31 | yield* buildCompanionModules(companionOutputDir); |
| 32 | |
| 33 | yield* Console.log(`\nAll ${RELEASE_TARGETS.length} binaries built successfully.`); |
| 34 | }); |
| 35 | } |
| 36 | |
| 37 | const ConfigLive = Effect.gen(function* () { |
| 38 | const logLevel = yield* Config.LogLevel('COMPOSIO_LOG_LEVEL').pipe(Config.withDefault('Info')); |
| 39 | |
| 40 | return Layer.succeed(References.MinimumLogLevel, logLevel); |
| 41 | }).pipe(Layer.unwrap, Layer.merge(ConfigProvider.layer(ConfigProvider.fromEnv()))); |
| 42 | |
| 43 | if (require.main === module) { |
| 44 | buildAllBinaries().pipe( |
| 45 | Effect.provide(ConfigLive), |
| 46 | Effect.provide(Logger.layer([Logger.consolePretty()])), |
| 47 | Effect.provide(BunServices.layer), |
| 48 | Effect.scoped, |
| 49 | Effect.map(() => ({ message: 'Process completed successfully.' })), |
| 50 | BunRuntime.runMain({ |
| 51 | teardown, |
| 52 | }) |
| 53 | ); |
| 54 | } |