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

feat(cli): support `composio upgrade <version>` for specific releases (#3428)

## Summary - `composio upgrade` now accepts an optional `<version>` argument so users can install any published CLI release — stable or beta — without having to wait for the channel pointer to move. - Accepts `0.13.1`, `v0.13.1`, `0.13.1-beta.42`, or the full `@composio/cli@0.13.1` tag (normalized internally). - When a version is provided, the "already on latest" guard is skipped so the command also supports downgrades and reinstalls. `--beta` continues to control the no-arg case. ## Examples ```bash composio upgrade # latest stable (unchanged) composio upgrade --beta # latest beta (unchanged) composio upgrade 0.13.1 # pin to a specific stable composio upgrade 0.13.1-beta.42 # install a specific beta composio upgrade @composio/cli@0.13.1 # full release tag also accepted ``` ## Implementation - `upgrade.cmd.ts`: added optional `version` Args, normalizes input to a `@composio/cli@<semver>` release tag, passes it through to the service. - `upgrade-binary.ts`: `upgrade`/`fetchLatestRelease` now accept a `tag` option that fetches the GitHub release directly via `/releases/tags/<tag>`, bypassing the channel resolver. When a tag is explicit, the update-availability check is skipped. - Falls back to the explicit tag for `installSkillSafe` when the upgrade completes without returning one. ## Test plan - [x] `pnpm typecheck` (CLI package) — clean - [x] `pnpm test` in `ts/packages/cli` — 703 passed, 1 skipped, no regressions in `upgrade-binary.test.ts` - [ ] Manual: `composio upgrade 0.13.0` from a newer beta to confirm downgrade path works against real GitHub releases - [ ] Manual: `composio upgrade --beta` still resolves the latest beta when no version is given 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Rahul Tarak committed May 13, 2026 at 17:11 UTC 2d52e7f7c0ec2b6dfc858435a1073db6e2b0dab9
3 files changed +68 -19
.changeset/cli-upgrade-version-arg.md new
+5
@@ -0,0 +1,5 @@
1 +---
2 +"@composio/cli": patch
3 +---
4 +
5 +`composio upgrade` now accepts an optional `<version>` argument so you can install a specific stable release or beta (e.g. `composio upgrade 0.13.1`, `composio upgrade 0.13.1-beta.42`, or the full tag `@composio/cli@0.13.1`). When omitted, the command continues to install the latest release on the chosen channel (`--beta` for prereleases).
ts/packages/cli/src/commands/upgrade.cmd.ts
+41 -12
@@ -1,5 +1,5 @@
1 -import { Command, Options } from '@effect/cli';
2 -import { Effect } from 'effect';
1 +import { Args, Command, Options } from '@effect/cli';
2 +import { Effect, Option } from 'effect';
3 import { APP_VERSION } from 'src/constants';
4 import { UpgradeBinary } from 'src/services/upgrade-binary';
5 import { installSkillSafe } from 'src/effects/install-skill';
@@ -10,20 +10,49 @@ const betaOpt = Options.boolean('beta').pipe(
10 Options.withDescription('Upgrade to the latest beta CLI release instead of the stable channel')
11 );
12
13 +const versionArg = Args.text({ name: 'version' }).pipe(
14 + Args.withDescription(
15 + 'Install a specific CLI release (e.g. "0.13.1", "0.13.1-beta.42", or full tag "@composio/cli@0.13.1"). If omitted, installs the latest release.'
16 + ),
17 + Args.optional
18 +);
19 +
20 +const RELEASE_TAG_PREFIX = '@composio/cli@';
21 +
22 +const normalizeReleaseTag = (input: string): string => {
23 + const trimmed = input.trim();
24 + if (trimmed.startsWith(RELEASE_TAG_PREFIX)) return trimmed;
25 + // Allow leading "v" for friendliness, e.g. "v0.13.1"
26 + const stripped = trimmed.replace(/^v/, '');
27 + return `${RELEASE_TAG_PREFIX}${stripped}`;
28 +};
29 +
30 /**
14 - * CLI command to upgrade the CLI to the latest available version.
31 + * CLI command to upgrade the CLI to the latest available version,
32 + * or to install a specific version when one is provided.
33 *
34 * @example
35 * ```bash
36 * composio upgrade
37 + * composio upgrade 0.13.1
38 + * composio upgrade 0.13.1-beta.42
39 + * composio upgrade --beta
40 * ```
41 */
21 -export const upgradeCmd = Command.make('upgrade', { beta: betaOpt }, ({ beta }) =>
22 - Effect.gen(function* () {
23 - const upgradeBinary = yield* UpgradeBinary;
24 - const newReleaseTag = yield* upgradeBinary.upgrade({ prerelease: beta });
25 - yield* installSkillSafe({
26 - releaseTag: newReleaseTag ?? `@composio/cli@${APP_VERSION}`,
27 - });
28 - })
29 -).pipe(Command.withDescription('Upgrade your Composio CLI to the latest available version.'));
42 +export const upgradeCmd = Command.make(
43 + 'upgrade',
44 + { beta: betaOpt, version: versionArg },
45 + ({ beta, version }) =>
46 + Effect.gen(function* () {
47 + const upgradeBinary = yield* UpgradeBinary;
48 + const tag = Option.isSome(version) ? normalizeReleaseTag(version.value) : undefined;
49 + const newReleaseTag = yield* upgradeBinary.upgrade({ prerelease: beta, tag });
50 + yield* installSkillSafe({
51 + releaseTag: newReleaseTag ?? tag ?? `@composio/cli@${APP_VERSION}`,
52 + });
53 + })
54 +).pipe(
55 + Command.withDescription(
56 + 'Upgrade your Composio CLI. Pass a version (e.g. "0.13.1" or "0.13.1-beta.42") to install a specific release, or omit it to install the latest.'
57 + )
58 +);
ts/packages/cli/src/services/upgrade-binary.ts
+22 -7
@@ -103,11 +103,13 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
103 platformArch: PlatformArch,
104 options: {
105 prerelease?: boolean;
106 + tag?: string;
107 } = {}
108 ): Effect.Effect<GitHubRelease, UpgradeBinaryError, never> =>
109 Effect.gen(function* () {
110 const prerelease = options.prerelease ?? false;
110 - const release = yield* githubConfig.TAG.pipe(
111 + const explicitTag = options.tag ? Option.some(options.tag) : githubConfig.TAG;
112 + const release = yield* explicitTag.pipe(
113 Option.match({
114 onNone: Effect.fn(function* () {
115 yield* Effect.logDebug(
@@ -536,6 +538,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
538 const upgrade = (
539 options: {
540 prerelease?: boolean;
541 + tag?: string;
542 } = {}
543 ) =>
544 Effect.gen(function* () {
@@ -543,6 +546,7 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
546 const upgradeTargetOpt = yield* DEBUG_OVERRIDE_CONFIG['UPGRADE_TARGET'];
547 const currentPath = yield* getCurrentExecutablePath();
548 const prerelease = options.prerelease ?? false;
549 + const explicitTag = options.tag;
550 const currentReleaseIdentifier = resolveCurrentReleaseIdentifier(currentPath);
551 yield* Effect.logDebug(`Current executable path: ${currentPath}`);
552 yield* Effect.logDebug(`Current release identifier: ${currentReleaseIdentifier}`);
@@ -560,15 +564,26 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
564 const didUpgrade = yield* ui.useMakeSpinner('Checking for updates...', spinner =>
565 Effect.gen(function* () {
566 const platformArch = yield* detectPlatform;
563 - const release = yield* fetchLatestRelease(platformArch, { prerelease });
564 - const updateAvailable = yield* isUpdateAvailable(release, currentReleaseIdentifier);
565 - if (!updateAvailable) {
566 - yield* spinner.stop('You are already running the latest version!');
567 - return false;
567 + const release = yield* fetchLatestRelease(platformArch, {
568 + prerelease,
569 + tag: explicitTag,
570 + });
571 + if (!explicitTag) {
572 + const updateAvailable = yield* isUpdateAvailable(release, currentReleaseIdentifier);
573 + if (!updateAvailable) {
574 + yield* spinner.stop('You are already running the latest version!');
575 + return false;
576 + }
577 + } else if (release.tag_name === currentReleaseIdentifier) {
578 + yield* Effect.logDebug(
579 + `Already running ${release.tag_name}; re-installing as requested`
580 + );
581 }
582
583 yield* spinner.message(
571 - `New version available: ${release.tag_name} (current: ${currentReleaseIdentifier}). Downloading...`
584 + explicitTag
585 + ? `Installing ${release.tag_name} (current: ${currentReleaseIdentifier})...`
586 + : `New version available: ${release.tag_name} (current: ${currentReleaseIdentifier}). Downloading...`
587 );
588
589 const { name, data } = yield* downloadBinary(release, platformArch);