@devries-cameron20 / composio-1 / commits / fa02366d7
Fork 0

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): restrict binary test to x64 runner, extract shared teardown

- Only test binaries when target is `bun-linux-x64` since ARM64 binaries can't execute on the x64 CI runner. - Extract duplicated `teardown` function from 8 scripts into `scripts/_shared.ts`. - Fix `build-binary.ts` silent exit on failure (Effect.logInfo → Effect.fail), matching the fix already applied to build-binary-cross.

jkomyno committed Mar 4, 2026 at 12:31 UTC fa02366d794d642157e2d1be4e6c72feaa8ea9f7
10 files changed +33 -139
.github/workflows/build-cli-binaries.yml
+1 -1
@@ -63,7 +63,7 @@ jobs:
63 file dist/binaries/${{ matrix.artifact }}
64
65 - name: Test binary
66 - if: startsWith(matrix.target, 'bun-linux')
66 + if: matrix.target == 'bun-linux-x64'
67 working-directory: ts/packages/cli
68 env:
69 COMPOSIO_USER_API_KEY: test-dummy-api-key-for-ci
ts/packages/cli/scripts/_shared.ts new
+15
@@ -0,0 +1,15 @@
1 +import process from 'node:process';
2 +import { Cause, Exit } from 'effect';
3 +import type { Teardown } from '@effect/platform/Runtime';
4 +
5 +/**
6 + * Shared teardown for all CLI scripts.
7 + *
8 + * Exits with a non-zero code when the Effect program fails
9 + * (unless the failure is an interrupt-only cause).
10 + */
11 +export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
12 + const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
13 + const errorCode = Number(process.exitCode ?? 1);
14 + onExit(shouldFail ? errorCode : 0);
15 +};
ts/packages/cli/scripts/build-all-binaries.ts
+2 -19
@@ -13,21 +13,10 @@
13 */
14
15 import process from 'node:process';
16 -import {
17 - Cause,
18 - Config,
19 - ConfigProvider,
20 - Console,
21 - Effect,
22 - Exit,
23 - Stream,
24 - Logger,
25 - Layer,
26 - LogLevel,
27 -} from 'effect';
16 +import { Config, ConfigProvider, Console, Effect, Stream, Logger, Layer, LogLevel } from 'effect';
17 import { Command } from '@effect/platform';
18 import { BunContext, BunRuntime } from '@effect/platform-bun';
30 -import type { Teardown } from '@effect/platform/Runtime';
19 +import { teardown } from './_shared';
20
21 /**
22 * All cross-compilation targets and their artifact names.
@@ -100,12 +89,6 @@ export function buildAllBinaries() {
89 });
90 }
91
103 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
104 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
105 - const errorCode = Number(process.exitCode ?? 1);
106 - onExit(shouldFail ? errorCode : 0);
107 -};
108 -
92 const ConfigLive = Effect.gen(function* () {
93 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
94 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/build-binary-cross.ts
+2 -19
@@ -15,21 +15,10 @@
15 */
16
17 import process from 'node:process';
18 -import {
19 - Cause,
20 - Config,
21 - ConfigProvider,
22 - Console,
23 - Effect,
24 - Exit,
25 - Stream,
26 - Logger,
27 - Layer,
28 - LogLevel,
29 -} from 'effect';
18 +import { Config, ConfigProvider, Console, Effect, Stream, Logger, Layer, LogLevel } from 'effect';
19 import { Command } from '@effect/platform';
20 import { BunContext, BunRuntime } from '@effect/platform-bun';
32 -import type { Teardown } from '@effect/platform/Runtime';
21 +import { teardown } from './_shared';
22
23 /**
24 * Maps Bun cross-compilation targets to Composio artifact names.
@@ -121,12 +110,6 @@ export function buildBinaryCross() {
110 });
111 }
112
124 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
125 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
126 - const errorCode = Number(process.exitCode ?? 1);
127 - onExit(shouldFail ? errorCode : 0);
128 -};
129 -
113 const ConfigLive = Effect.gen(function* () {
114 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
115 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/build-binary.ts
+3 -20
@@ -1,19 +1,8 @@
1 import process from 'node:process';
2 -import {
3 - Cause,
4 - Config,
5 - ConfigProvider,
6 - Console,
7 - Effect,
8 - Exit,
9 - Stream,
10 - Logger,
11 - Layer,
12 - LogLevel,
13 -} from 'effect';
2 +import { Config, ConfigProvider, Console, Effect, Stream, Logger, Layer, LogLevel } from 'effect';
3 import { Command } from '@effect/platform';
4 import { BunContext, BunRuntime } from '@effect/platform-bun';
16 -import type { Teardown } from '@effect/platform/Runtime';
5 +import { teardown } from './_shared';
6
7 /**
8 * Usage: `bun scripts/build-binary.ts`
@@ -79,19 +68,13 @@ export function buildBinary() {
68 process.exitCode = exitCode;
69
70 if (exitCode !== 0) {
82 - return yield* Effect.logInfo('Failed to build binary');
71 + return yield* Effect.fail(new Error('Failed to build binary'));
72 }
73
74 yield* Effect.logDebug('', 'Binary built successfully');
75 });
76 }
77
89 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
90 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
91 - const errorCode = Number(process.exitCode ?? 1);
92 - onExit(shouldFail ? errorCode : 0);
93 -};
94 -
78 const ConfigLive = Effect.gen(function* () {
79 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
80 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/copy-mocks-from-cache.ts
+2 -18
@@ -1,18 +1,8 @@
1 import process from 'node:process';
2 -import {
3 - Cause,
4 - Config,
5 - ConfigProvider,
6 - Console,
7 - Effect,
8 - Exit,
9 - Logger,
10 - Layer,
11 - LogLevel,
12 -} from 'effect';
2 +import { Config, ConfigProvider, Console, Effect, Logger, Layer, LogLevel } from 'effect';
3 import { BunContext, BunFileSystem, BunRuntime } from '@effect/platform-bun';
4 import { FileSystem } from '@effect/platform';
15 -import type { Teardown } from '@effect/platform/Runtime';
5 +import { teardown } from './_shared';
6 import path from 'node:path';
7 import { $ } from 'bun';
8 import { CACHE_FILES } from '../src/services/composio-clients-cached';
@@ -59,12 +49,6 @@ export function copyMocksFromCache() {
49 });
50 }
51
62 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
63 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
64 - const errorCode = Number(process.exitCode ?? 1);
65 - onExit(shouldFail ? errorCode : 0);
66 -};
67 -
52 const ConfigLive = Effect.gen(function* () {
53 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
54 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/generate-checksums.ts
+2 -18
@@ -15,19 +15,9 @@
15 */
16
17 import process from 'node:process';
18 -import {
19 - Cause,
20 - Config,
21 - ConfigProvider,
22 - Console,
23 - Effect,
24 - Exit,
25 - Logger,
26 - Layer,
27 - LogLevel,
28 -} from 'effect';
18 +import { Config, ConfigProvider, Console, Effect, Logger, Layer, LogLevel } from 'effect';
19 import { BunContext, BunRuntime } from '@effect/platform-bun';
30 -import type { Teardown } from '@effect/platform/Runtime';
20 +import { teardown } from './_shared';
21 import { readdir, readFile, writeFile } from 'node:fs/promises';
22 import path from 'node:path';
23
@@ -68,12 +58,6 @@ export function generateChecksums() {
58 });
59 }
60
71 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
72 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
73 - const errorCode = Number(process.exitCode ?? 1);
74 - onExit(shouldFail ? errorCode : 0);
75 -};
76 -
61 const ConfigLive = Effect.gen(function* () {
62 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
63 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/install-binary.ts
+2 -18
@@ -1,17 +1,7 @@
1 import process from 'node:process';
2 -import {
3 - Cause,
4 - Config,
5 - ConfigProvider,
6 - Console,
7 - Effect,
8 - Exit,
9 - Logger,
10 - Layer,
11 - LogLevel,
12 -} from 'effect';
2 +import { Config, ConfigProvider, Console, Effect, Logger, Layer, LogLevel } from 'effect';
3 import { BunContext, BunRuntime } from '@effect/platform-bun';
14 -import type { Teardown } from '@effect/platform/Runtime';
4 +import { teardown } from './_shared';
5 import path from 'node:path';
6 import os from 'node:os';
7 import { $ } from 'bun';
@@ -40,12 +30,6 @@ export function installBinary() {
30 });
31 }
32
43 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
44 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
45 - const errorCode = Number(process.exitCode ?? 1);
46 - onExit(shouldFail ? errorCode : 0);
47 -};
48 -
33 const ConfigLive = Effect.gen(function* () {
34 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
35 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/package-binaries.ts
+2 -18
@@ -15,19 +15,9 @@
15 */
16
17 import process from 'node:process';
18 -import {
19 - Cause,
20 - Config,
21 - ConfigProvider,
22 - Console,
23 - Effect,
24 - Exit,
25 - Logger,
26 - Layer,
27 - LogLevel,
28 -} from 'effect';
18 +import { Config, ConfigProvider, Console, Effect, Logger, Layer, LogLevel } from 'effect';
19 import { BunContext, BunRuntime } from '@effect/platform-bun';
30 -import type { Teardown } from '@effect/platform/Runtime';
20 +import { teardown } from './_shared';
21 import { $ } from 'bun';
22 import { readdir, stat } from 'node:fs/promises';
23 import path from 'node:path';
@@ -82,12 +72,6 @@ export function packageBinaries() {
72 });
73 }
74
85 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
86 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
87 - const errorCode = Number(process.exitCode ?? 1);
88 - onExit(shouldFail ? errorCode : 0);
89 -};
90 -
75 const ConfigLive = Effect.gen(function* () {
76 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
77 Config.withDefault(LogLevel.Info)
ts/packages/cli/scripts/record.ts
+2 -8
@@ -17,10 +17,10 @@
17 import process from 'node:process';
18 import path from 'node:path';
19 import os from 'node:os';
20 -import { Cause, Config, ConfigProvider, Effect, Exit, Logger, Layer, LogLevel, Ref } from 'effect';
20 +import { Config, ConfigProvider, Effect, Logger, Layer, LogLevel, Ref } from 'effect';
21 import { BunContext, BunFileSystem, BunRuntime } from '@effect/platform-bun';
22 import { FileSystem } from '@effect/platform';
23 -import type { Teardown } from '@effect/platform/Runtime';
23 +import { teardown } from './_shared';
24 import { $ } from 'bun';
25 import * as p from '@clack/prompts';
26 import color from 'picocolors';
@@ -456,12 +456,6 @@ function recordAll() {
456
457 // --- Bootstrap ---
458
459 -export const teardown: Teardown = <E, A>(exit: Exit.Exit<E, A>, onExit: (code: number) => void) => {
460 - const shouldFail = Exit.isFailure(exit) && !Cause.isInterruptedOnly(exit.cause);
461 - const errorCode = Number(process.exitCode ?? 1);
462 - onExit(shouldFail ? errorCode : 0);
463 -};
464 -
459 const ConfigLive = Effect.gen(function* () {
460 const logLevel = yield* Config.logLevel('COMPOSIO_LOG_LEVEL').pipe(
461 Config.withDefault(LogLevel.Info)