Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
[codex] fix CLI binary release workflow (#3041)
Rahul Tarak603b8e49303a
diff --git a/.github/workflows/build-cli-binaries.yml b/.github/workflows/build-cli-binaries.ymlindex b76a20b7e..218227411 100644--- a/.github/workflows/build-cli-binaries.yml+++ b/.github/workflows/build-cli-binaries.yml@@ -80,6 +80,7 @@ jobs:rm -rf "$temp_dir"mkdir -p "$temp_dir/${{ matrix.artifact }}"cp "${{ matrix.artifact }}" "$temp_dir/${{ matrix.artifact }}/composio"+ cp companions/run-subagent-*.mjs "$temp_dir/${{ matrix.artifact }}/"cd "$temp_dir" && zip -r "../${{ matrix.artifact }}.zip" "${{ matrix.artifact }}"cd .. && rm -r "$temp_dir"diff --git a/.github/workflows/cli.test-installation.yml b/.github/workflows/cli.test-installation.ymlindex 096abe064..8fc0dba54 100644--- a/.github/workflows/cli.test-installation.yml+++ b/.github/workflows/cli.test-installation.yml@@ -148,19 +148,19 @@ jobs:# Verify installationsource ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true- export PATH="$HOME/.composio/bin:$PATH"+ export PATH="$HOME/.composio:$PATH"# Check if binary exists- if [[ -f "$HOME/.composio/bin/composio" ]]; then+ if [[ -f "$HOME/.composio/composio" ]]; thenecho "✅ Binary installed successfully"- ls -la "$HOME/.composio/bin/composio"+ ls -la "$HOME/.composio/composio"elseecho "❌ Binary not found"exit 1fi# Test binary execution- if "$HOME/.composio/bin/composio" --version; then+ if "$HOME/.composio/composio" --version; thenecho "✅ Binary executes successfully"elseecho "❌ Binary execution failed"@@ -179,19 +179,19 @@ jobs:# Verify installationsource ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null || true- export PATH="$HOME/.composio/bin:$PATH"+ export PATH="$HOME/.composio:$PATH"# Check if binary exists- if [[ -f "$HOME/.composio/bin/composio" ]]; then+ if [[ -f "$HOME/.composio/composio" ]]; thenecho "✅ Binary installed successfully"- ls -la "$HOME/.composio/bin/composio"+ ls -la "$HOME/.composio/composio"elseecho "❌ Binary not found"exit 1fi# Test binary execution- if "$HOME/.composio/bin/composio" --version; then+ if "$HOME/.composio/composio" --version; thenecho "✅ Binary executes successfully"elseecho "❌ Binary execution failed"@@ -219,7 +219,7 @@ jobs:fiecho "=== Installation directory ==="- ls -la ~/.composio/bin/ || echo "~/.composio/bin/ not found"+ ls -la ~/.composio/ || echo "~/.composio/ not found"echo "=== Current PATH before sourcing ==="echo "$PATH"@@ -262,28 +262,28 @@ jobs:echo "Checking shell configuration updates..."if [[ "${{ matrix.shell }}" == "zsh" ]]; then- if grep -q "COMPOSIO_INSTALL" ~/.zshrc; then+ if grep -q "COMPOSIO_INSTALL_DIR" ~/.zshrc; thenecho "✅ .zshrc updated with COMPOSIO_INSTALL"elseecho "❌ .zshrc not updated"exit 1fi- if grep -q "COMPOSIO_INSTALL/bin" ~/.zshrc; then+ if grep -q 'PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.zshrc; thenecho "✅ .zshrc updated with PATH"elseecho "❌ .zshrc PATH not updated"exit 1fielse- if grep -q "COMPOSIO_INSTALL" ~/.bashrc; then+ if grep -q "COMPOSIO_INSTALL_DIR" ~/.bashrc; thenecho "✅ .bashrc updated with COMPOSIO_INSTALL"elseecho "❌ .bashrc not updated"exit 1fi- if grep -q "COMPOSIO_INSTALL/bin" ~/.bashrc; then+ if grep -q 'PATH="\\$COMPOSIO_INSTALL_DIR:\\$PATH"' ~/.bashrc; thenecho "✅ .bashrc updated with PATH"elseecho "❌ .bashrc PATH not updated"@@ -300,7 +300,7 @@ jobs:rm -rf ~/.composio# Test with custom directory using the same version as the workflow- export COMPOSIO_INSTALL="/tmp/custom-composio"+ export COMPOSIO_INSTALL_DIR="/tmp/custom-composio"if [[ "${{ steps.release_target.outputs.use_latest }}" == "true" ]]; thenbash install.shelse@@ -309,16 +309,16 @@ jobs:fi# Verify custom installation- if [[ -f "/tmp/custom-composio/bin/composio" ]]; then+ if [[ -f "/tmp/custom-composio/composio" ]]; thenecho "✅ Custom directory installation successful"- ls -la "/tmp/custom-composio/bin/composio"+ ls -la "/tmp/custom-composio/composio"elseecho "❌ Custom directory installation failed"exit 1fi# Test execution- if "/tmp/custom-composio/bin/composio" --version; then+ if "/tmp/custom-composio/composio" --version; thenecho "✅ Custom installation executes successfully"elseecho "❌ Custom installation execution failed"@@ -333,7 +333,7 @@ jobs:rm -rf ~/.composio /tmp/custom-composio# Check if binary is gone- if [[ ! -f "$HOME/.composio/bin/composio" ]]; then+ if [[ ! -f "$HOME/.composio/composio" ]]; thenecho "✅ Binary removed successfully"elseecho "❌ Binary removal failed"diff --git a/install.sh b/install.shindex 6804fe534..d622b7460 100755--- a/install.sh+++ b/install.sh@@ -164,12 +164,27 @@ mkdir -p "$COMPOSIO_INSTALL_DIR" ||error "Failed to create install directory \"$COMPOSIO_INSTALL_DIR\""exe="$COMPOSIO_INSTALL_DIR/composio"+companion_modules=(+ "run-subagent-shared.mjs"+ "run-subagent-acp.mjs"+ "run-subagent-legacy.mjs"+)# Handle nested directory structure (composio-<target>/composio)if [[ -f "$tmpdir/composio-$target/composio" ]]; thenmv "$tmpdir/composio-$target/composio" "$exe"+ for module in "${companion_modules[@]}"; do+ if [[ -f "$tmpdir/composio-$target/$module" ]]; then+ mv "$tmpdir/composio-$target/$module" "$COMPOSIO_INSTALL_DIR/$module"+ fi+ doneelif [[ -f "$tmpdir/composio" ]]; thenmv "$tmpdir/composio" "$exe"+ for module in "${companion_modules[@]}"; do+ if [[ -f "$tmpdir/$module" ]]; then+ mv "$tmpdir/$module" "$COMPOSIO_INSTALL_DIR/$module"+ fi+ doneelseerror 'Binary not found in extracted archive'fidiff --git a/ts/packages/cli/scripts/build-binary-cross.ts b/ts/packages/cli/scripts/build-binary-cross.tsindex a1f0687dc..c962025d5 100644--- a/ts/packages/cli/scripts/build-binary-cross.ts+++ b/ts/packages/cli/scripts/build-binary-cross.ts@@ -14,6 +14,7 @@* Output: `dist/binaries/<artifact-name>`*/+import { mkdir } from 'node:fs/promises';import process from 'node:process';import { Config, ConfigProvider, Console, Effect, Stream, Logger, Layer, LogLevel } from 'effect';import { Command } from '@effect/platform';@@ -32,6 +33,12 @@ const TARGET_MAP: Record<string, string> = {const VALID_TARGETS = Object.keys(TARGET_MAP);+const RUN_COMPANION_MODULE_BASENAMES = [+ 'run-subagent-shared',+ 'run-subagent-acp',+ 'run-subagent-legacy',+] as const;+function parseTarget(): { target: string; artifact: string } {const targetIdx = process.argv.indexOf('--target');if (targetIdx === -1 || !process.argv[targetIdx + 1]) {@@ -106,6 +113,50 @@ export function buildBinaryCross() {return yield* Effect.fail(new Error(`Failed to cross-compile binary for ${target}`));}+ const companionOutputDir = './dist/binaries/companions';+ yield* Effect.tryPromise(() => mkdir(companionOutputDir, { recursive: true }));++ for (const name of RUN_COMPANION_MODULE_BASENAMES) {+ const companionArgs = [+ 'bun',+ 'build',+ `./src/services/${name}.ts`,+ '--outfile',+ `${companionOutputDir}/${name}.mjs`,+ '--format',+ 'esm',+ '--target',+ 'bun',+ ] as const satisfies ReadonlyArray<string>;++ const companionCmd = Command.make(...companionArgs);+ const { exitCode: companionExitCode } = yield* companionCmd.pipe(+ Command.start,+ Effect.flatMap(process =>+ Effect.all(+ {+ exitCode: process.exitCode,+ output: Stream.merge(+ Stream.decodeText(process.stdout, 'utf-8'),+ Stream.decodeText(process.stderr, 'utf-8'),+ { haltStrategy: 'left' }+ ).pipe(+ Stream.tap(chunk => Console.log(chunk)),+ Stream.runDrain+ ),+ },+ {+ concurrency: 'unbounded',+ }+ )+ )+ );++ if (companionExitCode !== 0) {+ return yield* Effect.fail(new Error(`Failed to build companion module: ${name}`));+ }+ }+yield* Console.log(`Binary cross-compiled: ${outfile}`);});}