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, 03:37 UTC
| 1 | name: Build CLI Binaries |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [next] |
| 6 | paths: |
| 7 | - 'ts/packages/cli/**' |
| 8 | - '.github/actions/setup-node-pnpm-bun/action.yml' |
| 9 | - '.github/scripts/cli-release/**' |
| 10 | - '.github/workflows/build-cli-binaries.yml' |
| 11 | - '.github/workflows/cli.windows.yml' |
| 12 | - '.github/workflows/cli.test-installation.yml' |
| 13 | - 'install.ps1' |
| 14 | - 'install.sh' |
| 15 | - 'install/**' |
| 16 | - 'mise.toml' |
| 17 | - 'mise.lock' |
| 18 | workflow_dispatch: |
| 19 | inputs: |
| 20 | action: |
| 21 | description: 'What to do (select the beta tag as the workflow ref for promote-stable)' |
| 22 | type: choice |
| 23 | options: |
| 24 | - build-beta |
| 25 | - promote-stable |
| 26 | default: build-beta |
| 27 | version: |
| 28 | description: 'Optional semver base for a manual beta (e.g. 0.3.0); omit for the next patch after latest stable' |
| 29 | required: false |
| 30 | |
| 31 | # Least privilege by default: only the release job creates/edits releases and uploads assets. |
| 32 | # `prepare` reads releases (gh release list) and `build` uploads workflow artifacts — both work |
| 33 | # with read access. The release job opts up to `contents: write` for itself. |
| 34 | permissions: |
| 35 | contents: read |
| 36 | |
| 37 | # Print Turborepo telemetry events to the logs instead of sending them. |
| 38 | env: |
| 39 | TURBO_TELEMETRY_DEBUG: 1 |
| 40 | |
| 41 | jobs: |
| 42 | prepare: |
| 43 | name: Resolve Release Metadata |
| 44 | runs-on: ubuntu-latest |
| 45 | outputs: |
| 46 | release_name: ${{ steps.resolve.outputs.release_name }} |
| 47 | release_tag: ${{ steps.resolve.outputs.release_tag }} |
| 48 | release_version: ${{ steps.resolve.outputs.release_version }} |
| 49 | prerelease: ${{ steps.resolve.outputs.prerelease }} |
| 50 | make_latest: ${{ steps.resolve.outputs.make_latest }} |
| 51 | previous_stable_tag: ${{ steps.resolve.outputs.previous_stable_tag }} |
| 52 | |
| 53 | steps: |
| 54 | - name: Checkout |
| 55 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 56 | with: |
| 57 | ref: ${{ github.sha }} |
| 58 | |
| 59 | - name: Resolve release target |
| 60 | id: resolve |
| 61 | env: |
| 62 | EVENT_NAME: ${{ github.event_name }} |
| 63 | ACTION_INPUT: ${{ inputs.action }} |
| 64 | VERSION_INPUT: ${{ inputs.version }} |
| 65 | REF_NAME: ${{ github.ref_name }} |
| 66 | REF_TYPE: ${{ github.ref_type }} |
| 67 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | REPOSITORY: ${{ github.repository }} |
| 69 | RUN_NUMBER: ${{ github.run_number }} |
| 70 | COMMIT_SHA: ${{ github.sha }} |
| 71 | run: bash .github/scripts/cli-release/resolve-release-target.sh |
| 72 | |
| 73 | # The baked toolkit slugs decide whether `composio execute` resolves a |
| 74 | # toolkit locally or pays for a catalog fetch. A stale list is never |
| 75 | # wrong, only slow, so this warns and never blocks a release. |
| 76 | # Refresh with the `CLI - Update Toolkit Slugs` workflow. |
| 77 | - name: Check baked toolkit slugs freshness |
| 78 | continue-on-error: true |
| 79 | run: | |
| 80 | set -euo pipefail |
| 81 | refreshed_at=$(sed -n "s/.*BAKED_TOOLKIT_SLUGS_REFRESHED_AT = '\(.*\)'.*/\1/p" \ |
| 82 | ts/packages/cli/src/generated/toolkit-slugs.ts) |
| 83 | age_days=$(( ( $(date -u +%s) - $(date -u -d "$refreshed_at" +%s) ) / 86400 )) |
| 84 | echo "Baked toolkit slugs were refreshed $age_days day(s) ago ($refreshed_at)." |
| 85 | if [ "$age_days" -gt 14 ]; then |
| 86 | echo "::warning::Baked toolkit slugs are $age_days days old. Run the 'CLI - Update Toolkit Slugs' workflow." |
| 87 | fi |
| 88 | |
| 89 | build: |
| 90 | name: Build ${{ matrix.artifact }} |
| 91 | needs: prepare |
| 92 | if: needs.prepare.result == 'success' |
| 93 | runs-on: ${{ matrix.runner }} |
| 94 | strategy: |
| 95 | # Never publish a partial platform set: with fail-fast disabled, the build job's |
| 96 | # result is `success` only when EVERY matrix leg passes, so a single failure makes |
| 97 | # `needs.build.result != 'success'` and the release job is skipped. It also surfaces |
| 98 | # all platform failures at once instead of cancelling siblings on the first error. |
| 99 | fail-fast: false |
| 100 | matrix: |
| 101 | include: |
| 102 | - target: bun-linux-x64 |
| 103 | artifact: composio-linux-x64 |
| 104 | runner: ubuntu-latest |
| 105 | - target: bun-linux-arm64 |
| 106 | artifact: composio-linux-aarch64 |
| 107 | runner: ubuntu-latest |
| 108 | - target: bun-darwin-x64 |
| 109 | artifact: composio-darwin-x64 |
| 110 | runner: macos-15-intel |
| 111 | - target: bun-darwin-arm64 |
| 112 | artifact: composio-darwin-aarch64 |
| 113 | runner: macos-15 |
| 114 | |
| 115 | steps: |
| 116 | - name: Checkout |
| 117 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 118 | with: |
| 119 | ref: ${{ github.sha }} |
| 120 | |
| 121 | - name: Setup Node.js, pnpm, Bun |
| 122 | uses: ./.github/actions/setup-node-pnpm-bun |
| 123 | |
| 124 | - name: Install dependencies |
| 125 | run: pnpm install --frozen-lockfile |
| 126 | |
| 127 | - name: Build packages |
| 128 | run: pnpm build:packages |
| 129 | |
| 130 | - name: Cross-compile CLI binary |
| 131 | working-directory: ts/packages/cli |
| 132 | env: |
| 133 | COMPOSIO_POSTHOG_PROJECT_API_KEY: ${{ vars.COMPOSIO_POSTHOG_PROJECT_API_KEY }} |
| 134 | RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} |
| 135 | run: pnpm build:binary:cross --target ${{ matrix.target }} |
| 136 | |
| 137 | - name: Verify binary |
| 138 | working-directory: ts/packages/cli |
| 139 | run: | |
| 140 | ls -la dist/binaries/${{ matrix.artifact }} |
| 141 | file dist/binaries/${{ matrix.artifact }} |
| 142 | |
| 143 | - name: Verify binary version |
| 144 | if: matrix.target == 'bun-linux-x64' |
| 145 | working-directory: ts/packages/cli |
| 146 | run: | |
| 147 | expected_version='${{ needs.prepare.outputs.release_tag }}' |
| 148 | test "$(./dist/binaries/${{ matrix.artifact }} --version)" = "${expected_version#@composio/cli@}" |
| 149 | |
| 150 | - name: Test binary |
| 151 | if: matrix.target == 'bun-linux-x64' |
| 152 | working-directory: ts/packages/cli |
| 153 | env: |
| 154 | COMPOSIO_USER_API_KEY: test-dummy-api-key-for-ci |
| 155 | run: | |
| 156 | ./dist/binaries/${{ matrix.artifact }} --version |
| 157 | ./dist/binaries/${{ matrix.artifact }} --help | head -5 |
| 158 | |
| 159 | - name: Create archive |
| 160 | working-directory: ts/packages/cli |
| 161 | env: |
| 162 | RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} |
| 163 | run: pnpm build:binary:package |
| 164 | |
| 165 | - name: Verify release metadata in archive |
| 166 | working-directory: ts/packages/cli |
| 167 | run: unzip -p dist/binaries/${{ matrix.artifact }}.zip ${{ matrix.artifact }}/release-tag.txt | grep -Fx '${{ needs.prepare.outputs.release_tag }}' |
| 168 | |
| 169 | - name: Verify companion layout in archive |
| 170 | working-directory: ts/packages/cli |
| 171 | env: |
| 172 | ARCHIVE: dist/binaries/${{ matrix.artifact }}.zip |
| 173 | ARTIFACT: ${{ matrix.artifact }} |
| 174 | run: bash "${{ github.workspace }}/.github/scripts/cli-release/verify-archive-companions.sh" |
| 175 | |
| 176 | - name: Upload artifact |
| 177 | uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 178 | with: |
| 179 | name: ${{ matrix.artifact }} |
| 180 | path: ts/packages/cli/dist/binaries/${{ matrix.artifact }}.zip |
| 181 | retention-days: 7 |
| 182 | |
| 183 | windows: |
| 184 | name: Windows x64 |
| 185 | needs: prepare |
| 186 | uses: ./.github/workflows/cli.windows.yml |
| 187 | with: |
| 188 | release_tag: ${{ needs.prepare.outputs.release_tag }} |
| 189 | |
| 190 | release: |
| 191 | name: Release (draft → verify → publish) |
| 192 | needs: [prepare, build, windows] |
| 193 | runs-on: ubuntu-latest |
| 194 | permissions: |
| 195 | contents: write # create/edit the GitHub Release and upload assets |
| 196 | # fail-fast: false on the build matrix ⇒ this is `success` only if ALL platforms built. |
| 197 | # Windows is experimental, so a failed Windows job does not block the release: it ships |
| 198 | # without the Windows archive instead (see "Drop unverified Windows archive"). |
| 199 | if: ${{ !cancelled() && needs.build.result == 'success' }} |
| 200 | # Serialize runs that target the SAME release tag (e.g. two quick pushes, or a re-run |
| 201 | # racing the original) so they cannot interleave uploads. Keyed on the resolved tag so |
| 202 | # unrelated beta builds are not serialized behind each other. Job-level concurrency may |
| 203 | # read `needs.*` outputs (workflow-level cannot). The serialized loser fails loudly at the |
| 204 | # "already published" guard in create-or-resume-draft.sh — that red ❌ is by design. |
| 205 | concurrency: |
| 206 | group: cli-release-${{ needs.prepare.outputs.release_tag }} |
| 207 | cancel-in-progress: false |
| 208 | env: |
| 209 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 210 | RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} |
| 211 | RELEASE_NAME: ${{ needs.prepare.outputs.release_name }} |
| 212 | PRERELEASE: ${{ needs.prepare.outputs.prerelease }} |
| 213 | MAKE_LATEST: ${{ needs.prepare.outputs.make_latest }} |
| 214 | PREVIOUS_STABLE_TAG: ${{ needs.prepare.outputs.previous_stable_tag }} |
| 215 | CHECKOUT_REF: ${{ github.sha }} |
| 216 | RELEASE_HELPERS_DIR: ${{ github.workspace }}/.release-workflow/.github/scripts/cli-release |
| 217 | |
| 218 | steps: |
| 219 | - name: Checkout |
| 220 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 221 | with: |
| 222 | ref: ${{ github.sha }} |
| 223 | |
| 224 | - name: Setup Node.js, pnpm, Bun |
| 225 | uses: ./.github/actions/setup-node-pnpm-bun |
| 226 | |
| 227 | - name: Install dependencies |
| 228 | run: pnpm install --frozen-lockfile |
| 229 | |
| 230 | - name: Download all artifacts |
| 231 | uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 |
| 232 | with: |
| 233 | path: ts/packages/cli/dist/binaries |
| 234 | merge-multiple: true |
| 235 | |
| 236 | # The Windows build job uploads its archive before the native checks run, so a failed |
| 237 | # check leaves an unverified archive behind. Never publish that one. |
| 238 | - name: Drop unverified Windows archive |
| 239 | if: needs.windows.result != 'success' |
| 240 | run: | |
| 241 | echo "::warning::Windows x64 verification did not pass. Releasing without composio-windows-x64.zip." |
| 242 | rm -f ts/packages/cli/dist/binaries/composio-windows-x64.zip |
| 243 | |
| 244 | # Package skills BEFORE generating checksums so composio-skill.zip is included in |
| 245 | # checksums.txt alongside the platform binaries (generate-checksums hashes every .zip |
| 246 | # in dist/binaries). |
| 247 | - name: Package skill files |
| 248 | working-directory: ts/packages/cli |
| 249 | env: |
| 250 | PRERELEASE: ${{ needs.prepare.outputs.prerelease }} |
| 251 | run: | |
| 252 | pnpm run validate:skills |
| 253 | if [[ "$PRERELEASE" == "true" ]]; then |
| 254 | channel=beta |
| 255 | else |
| 256 | channel=stable |
| 257 | fi |
| 258 | pnpm run build:skills -- --channel "$channel" --output-dir ./dist/skills |
| 259 | cd dist/skills && zip -r ../binaries/composio-skill.zip composio-cli/ |
| 260 | |
| 261 | - name: Generate checksums |
| 262 | working-directory: ts/packages/cli |
| 263 | run: bun run ./scripts/generate-checksums.ts |
| 264 | |
| 265 | - name: Display checksums |
| 266 | run: cat ts/packages/cli/dist/binaries/checksums.txt |
| 267 | |
| 268 | - name: Checkout workflow release helpers |
| 269 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 270 | with: |
| 271 | ref: ${{ github.workflow_sha }} |
| 272 | path: .release-workflow |
| 273 | sparse-checkout: | |
| 274 | .github/scripts/cli-release |
| 275 | sparse-checkout-cone-mode: false |
| 276 | |
| 277 | # Build the release as a DRAFT first. Drafts fire no `release: published` event and are |
| 278 | # excluded from the `/releases/latest` redirect, so no anonymous consumer (install.sh, |
| 279 | # the redirect) can ever observe a release before its assets are attached and |
| 280 | # verified. The release is only flipped to published as the final step below. |
| 281 | - name: Create draft release with all assets |
| 282 | run: bash "$RELEASE_HELPERS_DIR/create-or-resume-draft.sh" |
| 283 | |
| 284 | # Loud failure gate: assert the full canonical asset set is attached AND fully uploaded. |
| 285 | # An asset can appear in the list while still processing (`state != "uploaded"`), which is |
| 286 | # exactly how a release ends up serving 404s, so we require state == "uploaded". |
| 287 | - name: Verify all release assets are present and uploaded |
| 288 | env: |
| 289 | WINDOWS_VERIFIED: ${{ needs.windows.result == 'success' && 'true' || 'false' }} |
| 290 | run: bash "$RELEASE_HELPERS_DIR/verify-assets.sh" |
| 291 | |
| 292 | # Publishing is the ONLY step that exposes the release. Do not edit the body here: a known |
| 293 | # GitHub PATCH race drops body changes made in the same call as the draft flip, and the |
| 294 | # notes were already generated at draft creation. Prerelease status was set on the draft. |
| 295 | - name: Publish release (flip draft → published) |
| 296 | run: gh release edit "$RELEASE_TAG" --draft=false --latest="$MAKE_LATEST" |
| 297 | |
| 298 | test-installation: |
| 299 | name: Test Installation |
| 300 | needs: [prepare, windows, release] |
| 301 | if: always() && !cancelled() && needs.release.result == 'success' |
| 302 | uses: ./.github/workflows/cli.test-installation.yml |
| 303 | with: |
| 304 | version: ${{ needs.prepare.outputs.release_tag }} |
| 305 | windows: ${{ needs.windows.result == 'success' && 'true' || 'false' }} |
| 306 | |
| 307 | create-install-instructions: |
| 308 | name: Create Install Instructions |
| 309 | needs: [prepare, release] |
| 310 | runs-on: ubuntu-latest |
| 311 | if: always() && !cancelled() && needs.release.result == 'success' |
| 312 | |
| 313 | steps: |
| 314 | - name: Checkout |
| 315 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 316 | |
| 317 | - name: Create installation README |
| 318 | run: | |
| 319 | RELEASE_TAG="${{ needs.prepare.outputs.release_tag }}" |
| 320 | cat > INSTALL.md << 'EOF' |
| 321 | # Composio CLI installation |
| 322 | |
| 323 | ## Quick install |
| 324 | |
| 325 | ```bash |
| 326 | curl -fsSL https://composio.dev/install | sh |
| 327 | ``` |
| 328 | |
| 329 | The installer downloads the CLI and sets up your shell automatically: when |
| 330 | your login shell (`$SHELL`) is zsh, bash, or fish, it adds the CLI's |
| 331 | directory to `PATH` in that shell's startup file. Re-running the installer |
| 332 | never duplicates the entry. |
| 333 | |
| 334 | ### Windows x64 (experimental) |
| 335 | |
| 336 | Run in PowerShell: |
| 337 | |
| 338 | ```powershell |
| 339 | $env:COMPOSIO_INSTALL_VERSION = "RELEASE_TAG_PLACEHOLDER"; irm https://raw.githubusercontent.com/ComposioHQ/composio/next/install.ps1 | iex |
| 340 | ``` |
| 341 | |
| 342 | This verifies the archive, installs the complete bundle in |
| 343 | `$HOME\.composio`, and adds it to your User PATH. No administrator |
| 344 | access is needed. Keep `composio.exe` with its support files. |
| 345 | Windows support is experimental: commands other than `run`, |
| 346 | `upgrade`, and `setup` may not work yet. |
| 347 | |
| 348 | ### Install without shell setup |
| 349 | |
| 350 | ```bash |
| 351 | curl -fsSL https://composio.dev/install | COMPOSIO_INSTALL_SHELL=none sh |
| 352 | ``` |
| 353 | |
| 354 | Use `COMPOSIO_INSTALL_SHELL=none` in CI, Docker images, or when you manage |
| 355 | shell startup files yourself: it installs the CLI and leaves every startup |
| 356 | file untouched. Set `COMPOSIO_INSTALL_SHELL=zsh`, `bash`, or `fish` instead |
| 357 | to configure a specific shell regardless of `$SHELL`. |
| 358 | |
| 359 | ### Install specific version |
| 360 | ```bash |
| 361 | curl -fsSL https://composio.dev/install | sh -s -- RELEASE_TAG_PLACEHOLDER |
| 362 | ``` |
| 363 | |
| 364 | ## Manual Installation |
| 365 | |
| 366 | 1. Download the appropriate binary for your platform from the [releases page](https://github.com/ComposioHQ/composio/releases) |
| 367 | 2. Extract and install the complete bundle. The CLI loads support files shipped next to the executable, so do not move only the nested `composio` file. |
| 368 | |
| 369 | ```bash |
| 370 | # Replace this with the downloaded archive name, without ".zip" |
| 371 | bundle=composio-linux-x64 |
| 372 | COMPOSIO_INSTALL_DIR=${COMPOSIO_INSTALL_DIR:-"$HOME/.composio"} |
| 373 | COMPOSIO_BIN_DIR=${COMPOSIO_BIN_DIR:-"$HOME/.local/bin"} |
| 374 | |
| 375 | unzip "$bundle.zip" |
| 376 | mkdir -p "$COMPOSIO_INSTALL_DIR" |
| 377 | cp -Rp "$bundle"/. "$COMPOSIO_INSTALL_DIR/" |
| 378 | chmod +x "$COMPOSIO_INSTALL_DIR/composio" |
| 379 | mkdir -p "$COMPOSIO_BIN_DIR" |
| 380 | if [ "$COMPOSIO_BIN_DIR" != "$COMPOSIO_INSTALL_DIR" ]; then |
| 381 | ln -sf "$COMPOSIO_INSTALL_DIR/composio" "$COMPOSIO_BIN_DIR/composio" |
| 382 | fi |
| 383 | export PATH="$COMPOSIO_BIN_DIR:$PATH" |
| 384 | ``` |
| 385 | |
| 386 | After a manual installation, run `composio install --shell zsh|bash|fish` |
| 387 | (with your shell in place of `zsh|bash|fish`) to add the CLI to your |
| 388 | shell's `PATH` permanently. |
| 389 | |
| 390 | ## Usage |
| 391 | |
| 392 | ```bash |
| 393 | composio --help |
| 394 | composio login |
| 395 | composio generate |
| 396 | ``` |
| 397 | |
| 398 | ## Supported Platforms |
| 399 | |
| 400 | - Linux x64 |
| 401 | - Linux ARM64 |
| 402 | - macOS x64 (Intel) |
| 403 | - macOS ARM64 (Apple Silicon) |
| 404 | |
| 405 | - Windows: x64, experimental (Windows 10 1809+), installed with PowerShell. Requires an SSE4.2-capable CPU. |
| 406 | EOF |
| 407 | sed -i.bak "s|RELEASE_TAG_PLACEHOLDER|$RELEASE_TAG|g" INSTALL.md && rm -f INSTALL.md.bak |
| 408 | |
| 409 | - name: Upload install instructions |
| 410 | uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 411 | with: |
| 412 | name: install-instructions |
| 413 | path: INSTALL.md |