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
refactor(cli): simplify atomic upgrade helpers
jkomyno9b752b694df9
diff --git a/ts/packages/cli/src/services/run-companion-modules.ts b/ts/packages/cli/src/services/run-companion-modules.tsindex 3b570e76c..c1ce5f798 100644--- a/ts/packages/cli/src/services/run-companion-modules.ts+++ b/ts/packages/cli/src/services/run-companion-modules.ts@@ -340,9 +340,10 @@ export const resolveRunningCliReleaseTag = (appVersion: string,isReleaseBuild = IS_RELEASE_BUILD): Effect.Effect<string, never, FileSystem.FileSystem | Path.Path> =>- isReleaseBuild- ? Effect.succeed(normalizeCliReleaseTag(appVersion))- : resolveInstalledCliReleaseTag(execPath, appVersion);+ Effect.map(+ resolveRunningCliVersion(execPath, appVersion, isReleaseBuild),+ normalizeCliReleaseTag+ );export const writeInstalledReleaseTag = (installDir: string,diff --git a/ts/packages/cli/src/utils/atomic-replace.ts b/ts/packages/cli/src/utils/atomic-replace.tsindex 8ed236bde..1cef136db 100644--- a/ts/packages/cli/src/utils/atomic-replace.ts+++ b/ts/packages/cli/src/utils/atomic-replace.ts@@ -88,13 +88,7 @@ export const atomicReplaceDirectory = ({yield* fs.rename(targetPath, asidePath);yield* fs.rename(stagedPath, targetPath)- .pipe(- Effect.catchAll(cause =>- fs- .rename(asidePath, targetPath)- .pipe(Effect.ignore, Effect.zipRight(Effect.fail(cause)))- )- );+ .pipe(Effect.tapError(() => fs.rename(asidePath, targetPath).pipe(Effect.ignore)));yield* fs.remove(asidePath, { recursive: true });}));diff --git a/ts/packages/cli/test/src/services/running-cli-version.test.ts b/ts/packages/cli/test/src/services/running-cli-version.test.tsindex 07b83fd70..bb512b991 100644--- a/ts/packages/cli/test/src/services/running-cli-version.test.ts+++ b/ts/packages/cli/test/src/services/running-cli-version.test.ts@@ -3,6 +3,7 @@ import { BunFileSystem, BunPath } from '@effect/platform-bun';import { describe, expect, layer } from '@effect/vitest';import { Effect, Layer } from 'effect';import {+ RUN_COMPANION_RELEASE_TAG_FILENAME,resolveRunningCliReleaseTag,resolveRunningCliVersion,} from 'src/services/run-companion-modules';@@ -19,7 +20,10 @@ describe('running CLI version authority', () => {const execPath = path.join(installDirectory, 'composio');for (const installedTag of ['@composio/[email protected]', '@composio/[email protected]']) {- yield* fs.writeFileString(path.join(installDirectory, 'release-tag.txt'), installedTag);+ yield* fs.writeFileString(+ path.join(installDirectory, RUN_COMPANION_RELEASE_TAG_FILENAME),+ installedTag+ );expect(yield* resolveRunningCliVersion(execPath, '0.3.0', true)).toBe('0.3.0');expect(yield* resolveRunningCliReleaseTag(execPath, '0.3.0', true)).toBe(@@ -49,7 +53,7 @@ describe('running CLI version authority', () => {const path = yield* Path.Path;const installDirectory = yield* fs.makeTempDirectoryScoped();const execPath = path.join(installDirectory, 'composio');- const releaseTagPath = path.join(installDirectory, 'release-tag.txt');+ const releaseTagPath = path.join(installDirectory, RUN_COMPANION_RELEASE_TAG_FILENAME);yield* fs.writeFileString(releaseTagPath, '@composio/[email protected]');expect(yield* resolveRunningCliVersion(execPath, '0.0.0-development', false)).toBe(