@devries-cameron20 / composio-1 / commits / 12ef3d3a5
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.

ci: simplify CLI binary release workflow (#3121)

## Summary - **Auto-beta on push to `next`**: any merge touching `ts/packages/cli/**` automatically builds binaries and creates a `@composio/cli@X.Y.Z-beta.<run_number>` prerelease. Version = latest stable + patch bump. - **Stable on version bump**: if `ts/packages/cli/package.json` version changed in the push commit (i.e. changeset "Release: update version" merge), creates a stable release instead. - **`workflow_dispatch` build-beta**: build a beta from any branch on demand. - **`workflow_dispatch` promote-stable**: promote an existing beta tag to stable (unchanged). - Removes the old PR-title-gated flow (`pull_request` trigger with title check). ## Test plan - [ ] Merge into `next` with a CLI change → verify beta release is created - [ ] Trigger `workflow_dispatch` with `build-beta` on a feature branch → verify beta release - [ ] Merge a changeset "Release: update version" PR → verify stable release is created - [ ] Trigger `workflow_dispatch` with `promote-stable` + existing beta tag → verify stable release 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Rahul Tarak committed Apr 6, 2026 at 01:22 UTC 12ef3d3a5051072000873b3117ecfa738885c3ec
3 files changed +176 -38
.claude/skills/cli-release/SKILL.md
+26 -8
@@ -6,6 +6,15 @@ description: Release the CLI — diff features since last release, run /full-cli
6
7 Orchestrates a CLI release by identifying what changed since the last release, testing those changes via `/full-cli-test`, and creating a changeset PR with a patch version bump.
8
9 +## Background: Release Flow
10 +
11 +The CLI uses a two-channel release system:
12 +
13 +- **Beta (automatic):** Every push to `next` touching `ts/packages/cli/**` auto-builds binaries and creates a `@composio/cli@X.Y.Z-beta.<run>` prerelease. Also triggerable on any branch via `workflow_dispatch` → `build-beta`.
14 +- **Stable (via changeset):** Merge a changeset PR → changeset bot creates "Release: update version" PR → merge that → `package.json` version changes → workflow detects the change and creates a stable release.
15 +
16 +This skill handles the **changeset PR** side: identifying changes, testing, and opening the PR that kicks off the stable release pipeline.
17 +
18 ## Overview
19
20 Two workstreams run **in parallel**:
@@ -17,19 +26,18 @@ Once testing completes, update the PR description with test results.
26
27 ## Step 1: Identify Changes Since Last Release
28
20 -Find the last release tag or version bump commit for `@composio/cli`:
29 +Find the last stable release tag for `@composio/cli`:
30
31 ```bash
23 -# Find the last release commit (look for "Release: update version" commits that touched the CLI)
24 -git log --oneline --all -- ts/packages/cli/package.json | head -20
32 +# Find the latest stable CLI release
33 +gh release list --json tagName,isPrerelease --jq '[.[] | select(.tagName | startswith("@composio/cli@")) | select(.isPrerelease == false)] | last | .tagName'
34 ```
35
27 -Look for the most recent commit where the CLI version was bumped (typically a "Release: update version" commit). Use that as the base.
28 -
29 -Then collect all commits between that base and HEAD that touch the CLI:
36 +Find the commit for that tag, then collect all commits between it and HEAD that touch the CLI:
37
38 ```bash
32 -git log <base_commit>..HEAD --oneline -- ts/packages/cli/
39 +git log --oneline -1 <tag> # get the base commit
40 +git log <base>..HEAD --oneline -- ts/packages/cli/
41 ```
42
43 For each commit, read the commit message and understand what it does. Categorize changes as:
@@ -51,6 +59,14 @@ Run the `/full-cli-test` skill. This executes:
59 2. **Phase 2:** Local binary build and test (including Slack integration test)
60 3. **Phase 3:** Bundled binary build and test via CI (including Slack integration test)
61
62 +For Phase 3, trigger a beta build via `workflow_dispatch` → `build-beta` on the current branch:
63 +
64 +```bash
65 +gh workflow run build-cli-binaries.yml --ref <branch> -f action=build-beta
66 +```
67 +
68 +Then monitor the run, download the built binary artifact, and test it.
69 +
70 Track the results of each phase — you'll need them for the PR description.
71
72 ## Step 3: Create Changeset PR (Parallel Track 2)
@@ -183,6 +199,7 @@ gh pr ready <PR_NUMBER> --undo # Convert to draft
199 - **The changeset file format is strict:** YAML frontmatter with package name in quotes and bump type, then a blank line, then the description.
200 - **Feature-specific testing:** When identifying changes in Step 1, note any new commands or flags. During testing (Step 2), explicitly test those new features with the built binary beyond the standard test suite.
201 - **The PR targets `next`** — this is the main development branch.
202 +- **Beta builds are automatic.** Every push to `next` touching CLI files creates a beta. The changeset PR is only needed to trigger the stable release pipeline.
203
204 ## Reference Files
205
@@ -190,5 +207,6 @@ gh pr ready <PR_NUMBER> --undo # Convert to draft
207 |---|---|
208 | `ts/packages/cli/package.json` | Current CLI version |
209 | `.changeset/config.json` | Changeset configuration |
193 -| `.github/workflows/build-cli-binaries.yml` | CI binary build workflow |
210 +| `.github/workflows/build-cli-binaries.yml` | CI binary build + release workflow |
211 +| `.github/workflows/ts.release.yml` | Changeset bot + npm publish |
212 | `ts/packages/cli/src/commands/` | CLI command implementations |
.github/workflows/build-cli-binaries.yml
+98 -20
@@ -1,14 +1,22 @@
1 name: Build CLI Binaries
2
3 on:
4 - pull_request:
4 + push:
5 branches: [next]
6 - types: [opened, synchronize, reopened]
6 + paths:
7 + - 'ts/packages/cli/**'
8 workflow_dispatch:
9 inputs:
10 + action:
11 + description: 'What to do'
12 + type: choice
13 + options:
14 + - build-beta
15 + - promote-stable
16 + default: build-beta
17 beta_tag:
10 - description: 'Existing beta release tag to promote (e.g., @composio/cli@1.0.0-beta.123)'
11 - required: true
18 + description: 'Existing beta release tag to promote (only for promote-stable, e.g. @composio/cli@0.2.20-beta.42)'
19 + required: false
20
21 permissions:
22 contents: write
@@ -16,7 +24,6 @@ permissions:
24 jobs:
25 prepare:
26 name: Resolve Release Metadata
19 - if: "${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.title == 'Release: update version' }}"
27 runs-on: ubuntu-latest
28 outputs:
29 checkout_ref: ${{ steps.resolve.outputs.checkout_ref }}
@@ -27,44 +34,115 @@ jobs:
34 make_latest: ${{ steps.resolve.outputs.make_latest }}
35
36 steps:
30 - - name: Checkout release PR head
31 - if: github.event_name == 'pull_request'
37 + - name: Checkout
38 uses: actions/checkout@v6
39 with:
34 - ref: ${{ github.event.pull_request.head.sha }}
40 + ref: ${{ github.sha }}
41
36 - - name: Resolve beta or stable release target
42 + - name: Resolve release target
43 id: resolve
44 env:
45 EVENT_NAME: ${{ github.event_name }}
40 - PR_NUMBER: ${{ github.event.pull_request.number }}
41 - PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
46 + ACTION_INPUT: ${{ inputs.action }}
47 BETA_TAG_INPUT: ${{ inputs.beta_tag }}
48 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49 REPOSITORY: ${{ github.repository }}
50 + RUN_NUMBER: ${{ github.run_number }}
51 + COMMIT_SHA: ${{ github.sha }}
52 run: |
53 set -euo pipefail
54
48 - if [[ "$EVENT_NAME" == "pull_request" ]]; then
49 - version=$(node -p "require('./ts/packages/cli/package.json').version")
50 - if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
51 - echo "Expected ts/packages/cli/package.json version to be a stable semver on the release PR, got: $version"
52 - exit 1
55 + # ── Push to next ──
56 + if [[ "$EVENT_NAME" == "push" ]]; then
57 + # Check if ts/packages/cli/package.json version changed → stable release
58 + current_version=$(node -p "require('./ts/packages/cli/package.json').version")
59 + previous_version=$(git show HEAD^:ts/packages/cli/package.json 2>/dev/null | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).version" 2>/dev/null || echo "")
60 +
61 + if [[ -n "$previous_version" && "$current_version" != "$previous_version" ]]; then
62 + release_tag="@composio/cli@${current_version}"
63 + release_name="CLI ${release_tag}"
64 + {
65 + echo "checkout_ref=${COMMIT_SHA}"
66 + echo "release_name=${release_name}"
67 + echo "release_tag=${release_tag}"
68 + echo "release_version=${current_version}"
69 + echo "prerelease=false"
70 + echo "make_latest=true"
71 + } >> "$GITHUB_OUTPUT"
72 + exit 0
73 + fi
74 +
75 + # Otherwise → beta release
76 + # Find the latest stable CLI release to determine next version
77 + latest_stable_tag=$(gh release list \
78 + --repo "$REPOSITORY" \
79 + --json tagName,isPrerelease \
80 + --jq '[.[] | select(.tagName | startswith("@composio/cli@")) | select(.isPrerelease == false)] | sort_by(.tagName) | last | .tagName // empty')
81 +
82 + if [[ -z "$latest_stable_tag" ]]; then
83 + echo "No stable @composio/cli release found, falling back to package.json"
84 + current_version=$(node -p "require('./ts/packages/cli/package.json').version")
85 + else
86 + current_version=$(echo "$latest_stable_tag" | sed 's/@composio\/cli@//')
87 fi
88
55 - release_tag="@composio/cli@${version}-beta.${PR_NUMBER}"
89 + # Bump patch version for the beta
90 + IFS='.' read -r major minor patch <<< "$current_version"
91 + next_version="${major}.${minor}.$((patch + 1))"
92 +
93 + release_tag="@composio/cli@${next_version}-beta.${RUN_NUMBER}"
94 release_name="CLI Beta ${release_tag}"
95 {
58 - echo "checkout_ref=${PR_HEAD_SHA}"
96 + echo "checkout_ref=${COMMIT_SHA}"
97 echo "release_name=${release_name}"
98 echo "release_tag=${release_tag}"
61 - echo "release_version=${version}"
99 + echo "release_version=${next_version}"
100 echo "prerelease=true"
101 echo "make_latest=false"
102 } >> "$GITHUB_OUTPUT"
103 exit 0
104 fi
105
106 + # ── workflow_dispatch: build-beta ──
107 + if [[ "$EVENT_NAME" == "workflow_dispatch" ]] && [[ "$ACTION_INPUT" == "build-beta" ]]; then
108 + latest_stable_tag=$(gh release list \
109 + --repo "$REPOSITORY" \
110 + --json tagName,isPrerelease \
111 + --jq '[.[] | select(.tagName | startswith("@composio/cli@")) | select(.isPrerelease == false)] | sort_by(.tagName) | last | .tagName // empty')
112 +
113 + if [[ -z "$latest_stable_tag" ]]; then
114 + current_version=$(node -p "require('./ts/packages/cli/package.json').version")
115 + else
116 + current_version=$(echo "$latest_stable_tag" | sed 's/@composio\/cli@//')
117 + fi
118 +
119 + IFS='.' read -r major minor patch <<< "$current_version"
120 + next_version="${major}.${minor}.$((patch + 1))"
121 +
122 + release_tag="@composio/cli@${next_version}-beta.${RUN_NUMBER}"
123 + release_name="CLI Beta ${release_tag}"
124 + {
125 + echo "checkout_ref=${COMMIT_SHA}"
126 + echo "release_name=${release_name}"
127 + echo "release_tag=${release_tag}"
128 + echo "release_version=${next_version}"
129 + echo "prerelease=true"
130 + echo "make_latest=false"
131 + } >> "$GITHUB_OUTPUT"
132 + exit 0
133 + fi
134 +
135 + # ── Promote stable (workflow_dispatch with promote-stable) ──
136 + if [[ "$ACTION_INPUT" != "promote-stable" ]]; then
137 + echo "Unknown action: $ACTION_INPUT"
138 + exit 1
139 + fi
140 +
141 + if [[ -z "$BETA_TAG_INPUT" ]]; then
142 + echo "beta_tag input is required for promote-stable"
143 + exit 1
144 + fi
145 +
146 encoded_beta_tag=$(python3 -c 'import os, urllib.parse; print(urllib.parse.quote(os.environ["BETA_TAG_INPUT"], safe=""))')
147
148 release_json=$(curl -fsSL \
@@ -79,7 +157,7 @@ jobs:
157 fi
158
159 if [[ ! "$BETA_TAG_INPUT" =~ ^@composio/cli@([0-9]+\.[0-9]+\.[0-9]+)-beta\.[0-9]+$ ]]; then
82 - echo "Beta tag must match @composio/cli@<version>-beta.<pr-number>"
160 + echo "Beta tag must match @composio/cli@<version>-beta.<number>"
161 exit 1
162 fi
163
ts/packages/cli/AGENTS.md
+52 -10
@@ -27,16 +27,16 @@ Errors are captured via the custom `effect-errors/` module, which provides sourc
27
28 Each command is declared with `@effect/cli`'s `Command.make()` pattern:
29
30 -| Command | Description |
31 -| -------------------------------------------------------- | ---------------------------------------------------------- |
32 -| `composio version` | Display CLI version |
33 -| `composio whoami` | Show logged-in user's API key |
34 -| `composio login [--no-browser] [--no-wait] [--key text]` | Login with browser redirect |
35 -| `composio logout` | Clear stored API key |
36 -| `composio upgrade` | Self-update binary from GitHub releases |
37 -| `composio generate` | Auto-detect project language, delegate to `ts` or `py` |
38 -| `composio generate ts` | Generate TypeScript type stubs for toolkits/tools/triggers |
39 -| `composio generate py` | Generate Python type stubs |
30 +| Command | Description |
31 +| -------------------------------------------------------- | ------------------------------------------------------------------------------------- |
32 +| `composio version` | Display CLI version |
33 +| `composio whoami` | Show logged-in user's API key |
34 +| `composio login [--no-browser] [--no-wait] [--key text]` | Login with browser redirect |
35 +| `composio logout` | Clear stored API key |
36 +| `composio upgrade` | Self-update binary from GitHub releases |
37 +| `composio generate` | Auto-detect project language, delegate to `ts` or `py` |
38 +| `composio generate ts` | Generate TypeScript type stubs for toolkits/tools/triggers |
39 +| `composio generate py` | Generate Python type stubs |
40 | `composio manage <command>` | Manage Composio resources (toolkits, tools, accounts, triggers, logs, orgs, projects) |
41
42 Options use `Options.text()`, `Options.boolean()`, `Options.choice()`, `Options.directory()` with Effect Schema validation.
@@ -335,3 +335,45 @@ recordings/
335 - **Config**: `recordings/recordings.yaml`
336 - **Script**: `scripts/record.ts` — Bun + Effect.ts, parallel VHS execution
337 - **Shared tape**: `recordings/tapes/shared-config.tape` — common VHS settings (auto-generated)
338 +
339 +---
340 +
341 +## Release Workflow
342 +
343 +CLI releases use a two-channel system: **beta** (automatic) and **stable** (manual promotion).
344 +
345 +### Beta Releases (automatic)
346 +
347 +Every push to `next` that touches `ts/packages/cli/**` automatically triggers `.github/workflows/build-cli-binaries.yml`, which:
348 +
349 +1. Finds the latest stable `@composio/cli@X.Y.Z` release
350 +2. Computes the next patch version (`X.Y.Z+1`)
351 +3. Builds cross-platform binaries (linux-x64, linux-aarch64, darwin-x64, darwin-aarch64)
352 +4. Creates a GitHub prerelease tagged `@composio/cli@X.Y.(Z+1)-beta.<run_number>`
353 +
354 +You can also trigger a beta build from **any branch** via `workflow_dispatch` → `build-beta`.
355 +
356 +Users install beta releases with `composio upgrade --beta`.
357 +
358 +### Stable Releases (via changeset)
359 +
360 +To promote to a stable release:
361 +
362 +1. Create a changeset PR (`.changeset/<name>.md` with `"@composio/cli": patch`)
363 +2. Merge it into `next`
364 +3. The changeset bot creates a "Release: update version" PR that bumps `package.json`
365 +4. Merge that PR → the push to `next` detects the `package.json` version changed → builds a **stable** release (`@composio/cli@X.Y.Z`, marked as `latest`)
366 +5. `ts.release.yml` also publishes to npm
367 +
368 +### Manual Promotion
369 +
370 +You can also promote an existing beta to stable via `workflow_dispatch` → `promote-stable` with the beta tag (e.g. `@composio/cli@0.2.20-beta.42`).
371 +
372 +### Key Files
373 +
374 +| File | Purpose |
375 +| --------------------------------------------- | -------------------------------- |
376 +| `.github/workflows/build-cli-binaries.yml` | Binary build + release workflow |
377 +| `.github/workflows/ts.release.yml` | Changeset bot + npm publish |
378 +| `.github/workflows/cli.test-installation.yml` | Post-release install smoke tests |
379 +| `.changeset/config.json` | Changeset configuration |