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): use Effect platform for skill installs
jkomyno33b5a2a60a7c
diff --git a/ts/packages/cli/src/cli-main.ts b/ts/packages/cli/src/cli-main.tsindex 9c30230e1..af88bef70 100644--- a/ts/packages/cli/src/cli-main.ts+++ b/ts/packages/cli/src/cli-main.ts@@ -3,7 +3,7 @@ import { Cause, Console, Effect, Exit, HashMap, Layer, Logger, Option } from 'efimport { captureErrors, prettyPrintFromCapturedErrors } from 'effect-errors/index';import { CliConfig, CommandDescriptor, HelpDoc, Usage, ValidationError } from '@effect/cli';import { FetchHttpClient } from '@effect/platform';-import { BunContext, BunRuntime, BunFileSystem } from '@effect/platform-bun';+import { BunContext, BunRuntime, BunFileSystem, BunPath } from '@effect/platform-bun';import type { Teardown } from '@effect/platform/Runtime';import { buildRootCommand, runWithConfig } from 'src/commands';import { matchCommandFromArgv, getCommandHelpText } from 'src/commands/root-help';@@ -97,7 +97,7 @@ export const ProjectContextLive = Layer.provide(export const SetupSkillInstallerLive = Layer.provide(SetupSkillInstaller.Default,- Layer.mergeAll(BunFileSystem.layer, NodeOs.Default)+ Layer.mergeAll(BunFileSystem.layer, BunPath.layer, NodeOs.Default)) satisfies RequiredLayer;const layers = Layer.mergeAll(diff --git a/ts/packages/cli/src/effects/install-skill.ts b/ts/packages/cli/src/effects/install-skill.tsindex b6b61b2ad..8ee2086db 100644--- a/ts/packages/cli/src/effects/install-skill.ts+++ b/ts/packages/cli/src/effects/install-skill.ts@@ -1,7 +1,5 @@-import * as fs from 'node:fs';-import * as path from 'node:path';import { Effect, Config, Option } from 'effect';-import { HttpClient } from '@effect/platform';+import { FileSystem, HttpClient, Path } from '@effect/platform';import { NodeOs } from 'src/services/node-os';import { TerminalUI } from 'src/services/terminal-ui';import { GITHUB_CONFIG } from 'src/effects/github-config';@@ -27,6 +25,12 @@ const SKILL_TARGET_LABELS: Record<SkillInstallTarget, string> = {openclaw: 'OpenClaw',};+const SKILL_TARGET_DIRECTORIES: Record<SkillInstallTarget, ReadonlyArray<string>> = {+ claude: ['.claude', 'skills'],+ codex: ['.codex', 'skills'],+ openclaw: ['.openclaw', 'skills'],+};+type GitHubConfig = GitHubRepoConfig & {TAG: Option.Option<string>;ACCESS_TOKEN: Option.Option<string>;@@ -50,31 +54,15 @@ export const resolveInstalledSkillName = (skillName?: string): string => {export const resolveTargetSkillPath = ({home,+ path,skillName,target,}: {home: string;+ path: Path.Path;skillName: string;target: SkillInstallTarget;-}): string => {- switch (target) {- case 'claude':- return path.join(home, '.claude', 'skills', skillName);- case 'codex':- return path.join(home, '.codex', 'skills', skillName);- case 'openclaw':- return path.join(home, '.openclaw', 'skills', skillName);- }-};--export const readInstalledSkillReleaseTag = (skillDir: string): string | undefined => {- try {- const value = fs.readFileSync(path.join(skillDir, SKILL_RELEASE_TAG_FILENAME), 'utf8').trim();- return value || undefined;- } catch {- return undefined;- }-};+}): string => path.join(home, ...SKILL_TARGET_DIRECTORIES[target], skillName);const resolveTargetLabel = (target: SkillInstallTarget): string => SKILL_TARGET_LABELS[target];@@ -135,6 +123,8 @@ export const installSkill = (options?: {Effect.gen(function* () {const os = yield* NodeOs;const ui = yield* TerminalUI;+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;const httpClient = yield* HttpClient.HttpClient;const githubConfig = yield* Config.all(GITHUB_CONFIG);const home = os.homedir;@@ -142,7 +132,7 @@ export const installSkill = (options?: {const skillName = resolveInstalledSkillName(options?.skillName);const agentSkillDir = path.join(home, '.agents', 'skills', skillName);- const targetSkillPath = resolveTargetSkillPath({ home, skillName, target });+ const targetSkillPath = resolveTargetSkillPath({ home, path, skillName, target });const tag = yield* resolveSkillReleaseTag({channel: options?.channel,@@ -193,11 +183,11 @@ export const installSkill = (options?: {// Extract to a temp dir, then move into placeconst tmpDir = path.join(os.homedir, '.agents', '.tmp-skill-install');- fs.mkdirSync(tmpDir, { recursive: true });- try {+ yield* Effect.gen(function* () {+ yield* fs.makeDirectory(tmpDir, { recursive: true });const zipPath = path.join(tmpDir, SKILL_ASSET_NAME);- fs.writeFileSync(zipPath, new Uint8Array(zipData));+ yield* fs.writeFile(zipPath, new Uint8Array(zipData));yield* Effect.tryPromise({try: () => extractZip(zipPath, { dir: tmpDir }),@@ -206,36 +196,25 @@ export const installSkill = (options?: {// The zip contains composio-cli/ directoryconst extractedDir = path.join(tmpDir, SKILL_NAME);- if (!fs.existsSync(extractedDir)) {+ if (!(yield* fs.exists(extractedDir))) {return yield* Effect.fail(new Error('Extracted skill directory not found'));}- // Remove old skill dir and move new one into place- fs.rmSync(agentSkillDir, { recursive: true, force: true });- fs.mkdirSync(path.dirname(agentSkillDir), { recursive: true });- fs.cpSync(extractedDir, agentSkillDir, { recursive: true });- fs.writeFileSync(path.join(agentSkillDir, SKILL_RELEASE_TAG_FILENAME), `${tag}\n`, 'utf8');- } finally {- fs.rmSync(tmpDir, { recursive: true, force: true });- }-- // Create agent-specific symlink — always replace any existing entry.- fs.mkdirSync(path.dirname(targetSkillPath), { recursive: true });- try {- const stat = fs.lstatSync(targetSkillPath);- // Entry exists (symlink, broken symlink, or directory) — remove it- if (stat.isSymbolicLink()) {- fs.unlinkSync(targetSkillPath);- } else if (stat.isDirectory()) {- fs.rmSync(targetSkillPath, { recursive: true, force: true });- } else {- fs.unlinkSync(targetSkillPath);- }- } catch {- // lstatSync throws if nothing exists at the path — that's fine- }- const relativeTarget = path.relative(path.dirname(targetSkillPath), agentSkillDir);- fs.symlinkSync(relativeTarget, targetSkillPath);+ yield* Effect.gen(function* () {+ // Replace the canonical skill and agent target without interruption leaving either absent.+ yield* fs.remove(agentSkillDir, { recursive: true, force: true });+ yield* fs.makeDirectory(path.dirname(agentSkillDir), { recursive: true });+ yield* fs.copy(extractedDir, agentSkillDir, { overwrite: true });+ yield* fs.writeFileString(path.join(agentSkillDir, SKILL_RELEASE_TAG_FILENAME), `${tag}\n`);++ yield* fs.makeDirectory(path.dirname(targetSkillPath), { recursive: true });+ yield* fs.remove(targetSkillPath, { recursive: true, force: true });+ const relativeTarget = path.relative(path.dirname(targetSkillPath), agentSkillDir);+ yield* fs.symlink(relativeTarget, targetSkillPath);+ }).pipe(Effect.uninterruptible);+ }).pipe(+ Effect.ensuring(fs.remove(tmpDir, { recursive: true, force: true }).pipe(Effect.orDie))+ );yield* ui.log.success(`Installed ${skillName} skill for ${resolveTargetLabel(target)}`);});diff --git a/ts/packages/cli/src/services/setup-skill-installer.ts b/ts/packages/cli/src/services/setup-skill-installer.tsindex 90d449757..27f48dcd4 100644--- a/ts/packages/cli/src/services/setup-skill-installer.ts+++ b/ts/packages/cli/src/services/setup-skill-installer.ts@@ -1,5 +1,4 @@-import path from 'node:path';-import { FileSystem } from '@effect/platform';+import { FileSystem, Path } from '@effect/platform';import { Effect } from 'effect';import {installSkill,@@ -16,10 +15,15 @@ export const resolveSetupSkillReleaseTag = (fallbackVersion = APP_VERSION): string => readInstalledReleaseTag(execPath) ?? `@composio/cli@${fallbackVersion}`;-const checkClaudeSkillCurrent = (fs: FileSystem.FileSystem, home: string, releaseTag: string) =>+const checkClaudeSkillCurrent = (+ fs: FileSystem.FileSystem,+ path: Path.Path,+ home: string,+ releaseTag: string+) =>Effect.gen(function* () {const skillName = resolveInstalledSkillName();- const target = resolveTargetSkillPath({ home, skillName, target: 'claude' });+ const target = resolveTargetSkillPath({ home, path, skillName, target: 'claude' });const installedReleaseTag = yield* fs.readFileString(path.join(target, SKILL_RELEASE_TAG_FILENAME), 'utf8').pipe(@@ -34,15 +38,21 @@ const checkClaudeSkillCurrent = (fs: FileSystem.FileSystem, home: string, releas});export const isClaudeSkillCurrent = (home: string, releaseTag: string) =>- Effect.flatMap(FileSystem.FileSystem, fs => checkClaudeSkillCurrent(fs, home, releaseTag));+ Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;+ return yield* checkClaudeSkillCurrent(fs, path, home, releaseTag);+ });export class SetupSkillInstaller extends Effect.Service<SetupSkillInstaller>()('services/SetupSkillInstaller',{effect: Effect.gen(function* () {const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;const os = yield* NodeOs;- const isCurrent = (releaseTag: string) => checkClaudeSkillCurrent(fs, os.homedir, releaseTag);+ const isCurrent = (releaseTag: string) =>+ checkClaudeSkillCurrent(fs, path, os.homedir, releaseTag);return {isClaudeSkillReady: isCurrent(resolveSetupSkillReleaseTag()),diff --git a/ts/packages/cli/test/__utils__/services/test-layer.ts b/ts/packages/cli/test/__utils__/services/test-layer.tsindex 595af6936..8e85b4d54 100644--- a/ts/packages/cli/test/__utils__/services/test-layer.ts+++ b/ts/packages/cli/test/__utils__/services/test-layer.ts@@ -1,7 +1,6 @@-import path from 'node:path';import * as tempy from 'tempy';import { CliApp, CliConfig } from '@effect/cli';-import { Command, FetchHttpClient, FileSystem } from '@effect/platform';+import { Command, FetchHttpClient, FileSystem, Path } from '@effect/platform';import { BunFileSystem, BunContext, BunPath } from '@effect/platform-bun';import {ConfigProvider,@@ -1317,14 +1316,10 @@ function setupFixtureFolder({ fixture, tempDir }: { fixture?: string; tempDir: s}const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;- const realFixturePath = path.resolve(- new URL('.', import.meta.url).pathname,- '..',- '..',- '__fixtures__',- fixture- );+ const fixtureRoot = yield* path.fromFileUrl(new URL('.', import.meta.url));+ const realFixturePath = path.resolve(fixtureRoot, '..', '..', '__fixtures__', fixture);const tmpFixturesPath = path.join(tempDir, 'test', '__fixtures__', fixture);yield* Effect.logDebug(`Using fixture at: ${tmpFixturesPath}`);@@ -1360,10 +1355,10 @@ function setupFixtureFolder({ fixture, tempDir }: { fixture?: string; tempDir: s// Break symlinks in node_modules to isolate test from real packagesconst nodeModulesPath = path.join(tmpFixturesPath, 'node_modules');- yield* breakSymlinksInNodeModules(fs, nodeModulesPath);+ yield* breakSymlinksInNodeModules(fs, path, nodeModulesPath);return tmpFixturesPath;- }).pipe(Effect.provide(BunFileSystem.layer));+ }).pipe(Effect.provide(Layer.mergeAll(BunFileSystem.layer, BunPath.layer)));}/**@@ -1373,6 +1368,7 @@ function setupFixtureFolder({ fixture, tempDir }: { fixture?: string; tempDir: s*/function breakSymlinksInNodeModules(fs: FileSystem.FileSystem,+ path: Path.Path,nodeModulesPath: string): Effect.Effect<void, never, never> {// Helper: break a symlink by replacing it with a copy of its targetdiff --git a/ts/packages/cli/test/src/effects/install-skill.test.ts b/ts/packages/cli/test/src/effects/install-skill.test.tsindex 51d92599a..ad436c970 100644--- a/ts/packages/cli/test/src/effects/install-skill.test.ts+++ b/ts/packages/cli/test/src/effects/install-skill.test.ts@@ -1,15 +1,113 @@import { describe, expect, it, vi } from '@effect/vitest';-import { Config, ConfigProvider, Effect } from 'effect';-import { FetchHttpClient, HttpClient } from '@effect/platform';+import { Config, ConfigProvider, Effect, Exit, Layer } from 'effect';+import { FetchHttpClient, FileSystem, HttpClient, Path } from '@effect/platform';+import type * as PlatformError from '@effect/platform/Error';+import { BunFileSystem, BunPath } from '@effect/platform-bun';+import * as tempy from 'tempy';import { withHttpServer } from 'test/__utils__/http-server';+import { TerminalUITest } from 'test/__utils__/services/terminal-ui-test';import {inferSkillReleaseChannel,+ installSkill,resolveInstalledSkillName,resolveSkillReleaseTag,resolveTargetSkillPath,+ SKILL_RELEASE_TAG_FILENAME,type SkillReleaseChannel,} from 'src/effects/install-skill';import { GITHUB_CONFIG } from 'src/effects/github-config';+import { defaultNodeOs, NodeOs } from 'src/services/node-os';++const path = Effect.runSync(Effect.provide(Path.Path, Path.layer));+const TEST_RELEASE_TAG = '@composio/[email protected]';+const TEST_SKILL_ZIP = Uint8Array.from(+ atob(+ 'UEsDBAoAAAAAAEGX7lwAAAAAAAAAAAAAAAANABwAY29tcG9zaW8tY2xpL1VUCQADeU5WanlOVmp1eAsAAQT1AQAABBQAAABQSwMECgAAAAAAQZfuXMXglUQPAAAADwAAABUAHABjb21wb3Npby1jbGkvU0tJTEwubWRVVAkAA3lOVmp5TlZqdXgLAAEE9QEAAAQUAAAAIyBjb21wb3Npby1jbGkKUEsBAh4DCgAAAAAAQZfuXAAAAAAAAAAAAAAAAA0AGAAAAAAAAAAQAO1BAAAAAGNvbXBvc2lvLWNsaS9VVAUAA3lOVmp1eAsAAQT1AQAABBQAAABQSwECHgMKAAAAAABBl+5cxeCVRA8AAAAPAAAAFQAYAAAAAAABAAAApIFHAAAAY29tcG9zaW8tY2xpL1NLSUxMLm1kVVQFAAN5TlZqdXgLAAEE9QEAAAQUAAAAUEsFBgAAAAACAAIArgAAAKUAAAAAAA=='+ ),+ character => character.charCodeAt(0)+);++const TestPlatform = Layer.mergeAll(BunFileSystem.layer, BunPath.layer);++const makeInstallEffect = (home: string, apiBaseUrl: string) =>+ installSkill({ target: 'claude', releaseTag: TEST_RELEASE_TAG }).pipe(+ Effect.provide(+ Layer.mergeAll(+ TestPlatform,+ FetchHttpClient.layer,+ TerminalUITest,+ Layer.succeed(NodeOs, defaultNodeOs({ homedir: home }))+ )+ ),+ Effect.withConfigProvider(+ ConfigProvider.fromMap(+ new Map([+ ['GITHUB_API_BASE_URL', apiBaseUrl],+ ['GITHUB_OWNER', 'test-owner'],+ ['GITHUB_REPO', 'test-repo'],+ ])+ )+ ),+ Effect.scoped+ );++const withSkillRelease = (skillZip: Uint8Array, run: (apiBaseUrl: string) => Promise<void>) =>+ withHttpServer((req, res) => {+ if (req.url === '/skill.zip') {+ res.writeHead(200, { 'content-type': 'application/zip' });+ res.end(skillZip);+ return;+ }++ res.writeHead(200, { 'content-type': 'application/json' });+ res.end(+ JSON.stringify({+ assets: [+ {+ name: 'composio-skill.zip',+ browser_download_url: `http://${req.headers.host}/skill.zip`,+ },+ ],+ })+ );+ }, run);++type TargetSetup = (+ fs: FileSystem.FileSystem,+ path: Path.Path,+ home: string,+ target: string+) => Effect.Effect<void, PlatformError.PlatformError>;++const TARGET_SCENARIOS = [+ ['a missing', (() => Effect.void) satisfies TargetSetup],+ [+ 'an existing directory',+ ((fs, _path, _home, target) =>+ fs.makeDirectory(target, { recursive: true })) satisfies TargetSetup,+ ],+ [+ 'an existing symlink',+ ((fs, path, home, target) =>+ Effect.gen(function* () {+ const existingTarget = path.join(home, 'existing-skill');+ yield* fs.makeDirectory(existingTarget, { recursive: true });+ yield* fs.makeDirectory(path.dirname(target), { recursive: true });+ yield* fs.symlink(path.relative(path.dirname(target), existingTarget), target);+ })) satisfies TargetSetup,+ ],+ [+ 'a broken symlink',+ ((fs, path, home, target) =>+ Effect.gen(function* () {+ yield* fs.makeDirectory(path.dirname(target), { recursive: true });+ yield* fs.symlink(+ path.relative(path.dirname(target), path.join(home, 'missing-skill')),+ target+ );+ })) satisfies TargetSetup,+ ],+] as const;const makeResolveEffect = (configEntries: ReadonlyArray<[string, string]>,@@ -60,6 +158,7 @@ describe('install-skill', () => {expect(resolveTargetSkillPath({home: '/tmp/test-home',+ path,skillName: 'composio-cli',target: 'claude',})@@ -67,6 +166,7 @@ describe('install-skill', () => {expect(resolveTargetSkillPath({home: '/tmp/test-home',+ path,skillName: 'composio-cli',target: 'codex',})@@ -74,6 +174,7 @@ describe('install-skill', () => {expect(resolveTargetSkillPath({home: '/tmp/test-home',+ path,skillName: 'composio-cli',target: 'openclaw',})@@ -90,6 +191,55 @@ describe('install-skill', () => {expect(tag).toBe(releaseTag);});+ it.each(TARGET_SCENARIOS)('installs over %s target', async (_description, prepareTarget) => {+ await withSkillRelease(TEST_SKILL_ZIP, async apiBaseUrl => {+ const home = tempy.temporaryDirectory();+ const target = path.join(home, '.claude', 'skills', 'composio-cli');+ const canonicalSkill = path.join(home, '.agents', 'skills', 'composio-cli');++ await Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const platformPath = yield* Path.Path;+ yield* prepareTarget(fs, platformPath, home, target);+ }).pipe(Effect.provide(TestPlatform), Effect.runPromise);++ await makeInstallEffect(home, apiBaseUrl).pipe(Effect.runPromise);++ await Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const platformPath = yield* Path.Path;+ expect(yield* fs.readFileString(platformPath.join(target, 'SKILL.md'))).toBe(+ '# composio-cli\n'+ );+ expect(+ yield* fs.readFileString(platformPath.join(canonicalSkill, SKILL_RELEASE_TAG_FILENAME))+ ).toBe(`${TEST_RELEASE_TAG}\n`);+ expect(yield* fs.readLink(target)).toBe(+ platformPath.relative(platformPath.dirname(target), canonicalSkill)+ );+ expect(yield* fs.exists(platformPath.join(home, '.agents', '.tmp-skill-install'))).toBe(+ false+ );+ }).pipe(Effect.provide(TestPlatform), Effect.runPromise);+ });+ });++ it('removes the temporary install directory after extraction fails', async () => {+ await withSkillRelease(new TextEncoder().encode('not a zip'), async apiBaseUrl => {+ const home = tempy.temporaryDirectory();+ const exit = await makeInstallEffect(home, apiBaseUrl).pipe(Effect.exit, Effect.runPromise);++ expect(Exit.isFailure(exit)).toBe(true);+ expect(+ await FileSystem.FileSystem.pipe(+ Effect.flatMap(fs => fs.exists(path.join(home, '.agents', '.tmp-skill-install'))),+ Effect.provide(TestPlatform),+ Effect.runPromise+ )+ ).toBe(false);+ });+ });+it('resolves the latest stable release when the stable channel is requested', async () => {vi.stubGlobal('Bun', { which: vi.fn(() => null) });diff --git a/ts/packages/cli/test/src/services/setup-skill-installer.test.ts b/ts/packages/cli/test/src/services/setup-skill-installer.test.tsindex b44b2d0a7..bec1fcb3d 100644--- a/ts/packages/cli/test/src/services/setup-skill-installer.test.ts+++ b/ts/packages/cli/test/src/services/setup-skill-installer.test.ts@@ -1,8 +1,7 @@-import { mkdirSync, symlinkSync, writeFileSync } from 'node:fs';-import path from 'node:path';-import { BunFileSystem } from '@effect/platform-bun';-import { Effect } from 'effect';-import { describe, expect, it } from 'vitest';+import { FileSystem, Path } from '@effect/platform';+import { BunFileSystem, BunPath } from '@effect/platform-bun';+import { describe, expect, layer } from '@effect/vitest';+import { Effect, Layer } from 'effect';import * as tempy from 'tempy';import { SKILL_RELEASE_TAG_FILENAME } from 'src/effects/install-skill';import {@@ -10,59 +9,84 @@ import {resolveSetupSkillReleaseTag,} from 'src/services/setup-skill-installer';-const runIsClaudeSkillCurrent = (home: string, releaseTag: string) =>- isClaudeSkillCurrent(home, releaseTag).pipe(- Effect.provide(BunFileSystem.layer),- Effect.runPromise- );+const TestPlatform = Layer.mergeAll(BunFileSystem.layer, BunPath.layer);describe('SetupSkillInstaller', () => {- it('uses the packaged CLI release tag', () => {- const installDir = tempy.temporaryDirectory();- const execPath = path.join(installDir, 'composio');- writeFileSync(path.join(installDir, 'release-tag.txt'), '@composio/[email protected]\n');+ layer(TestPlatform)(it => {+ it.effect('uses the packaged CLI release tag', () =>+ Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;+ const installDir = tempy.temporaryDirectory();+ const execPath = path.join(installDir, 'composio');+ yield* fs.writeFileString(+ path.join(installDir, 'release-tag.txt'),+ '@composio/[email protected]\n'+ );- expect(resolveSetupSkillReleaseTag(execPath, '0.3.0')).toBe('@composio/[email protected]');- });+ expect(resolveSetupSkillReleaseTag(execPath, '0.3.0')).toBe('@composio/[email protected]');+ })+ );- it('falls back to the build version outside a packaged install', () => {- const installDir = tempy.temporaryDirectory();+ it.effect('falls back to the build version outside a packaged install', () =>+ Effect.gen(function* () {+ const path = yield* Path.Path;+ const installDir = tempy.temporaryDirectory();- expect(resolveSetupSkillReleaseTag(path.join(installDir, 'composio'), '0.3.0')).toBe(- '@composio/[email protected]'+ expect(resolveSetupSkillReleaseTag(path.join(installDir, 'composio'), '0.3.0')).toBe(+ '@composio/[email protected]'+ );+ }));- });- it('only accepts a Claude skill installed from the running CLI release', async () => {- const home = tempy.temporaryDirectory();- const target = path.join(home, '.claude', 'skills', 'composio-cli');- const skillDir = path.join(home, '.agents', 'skills', 'composio-cli');- mkdirSync(skillDir, { recursive: true });- mkdirSync(path.dirname(target), { recursive: true });- symlinkSync(path.relative(path.dirname(target), skillDir), target);- writeFileSync(- path.join(skillDir, SKILL_RELEASE_TAG_FILENAME),- '@composio/[email protected]\n'- );- writeFileSync(path.join(skillDir, 'SKILL.md'), '# composio-cli\n');+ it.effect('only accepts a Claude skill installed from the running CLI release', () =>+ Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;+ const home = tempy.temporaryDirectory();+ const target = path.join(home, '.claude', 'skills', 'composio-cli');+ const skillDir = path.join(home, '.agents', 'skills', 'composio-cli');+ yield* fs.makeDirectory(skillDir, { recursive: true });+ yield* fs.makeDirectory(path.dirname(target), { recursive: true });+ yield* fs.symlink(path.relative(path.dirname(target), skillDir), target);+ yield* fs.writeFileString(+ path.join(skillDir, SKILL_RELEASE_TAG_FILENAME),+ '@composio/[email protected]\n'+ );+ yield* fs.writeFileString(path.join(skillDir, 'SKILL.md'), '# composio-cli\n');- expect(await runIsClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(true);- expect(await runIsClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);- });+ expect(yield* isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(true);+ expect(yield* isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);+ })+ );- it('treats an unversioned existing Claude skill as stale', async () => {- const home = tempy.temporaryDirectory();- mkdirSync(path.join(home, '.claude', 'skills', 'composio-cli'), { recursive: true });+ it.effect('treats an unversioned existing Claude skill as stale', () =>+ Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;+ const home = tempy.temporaryDirectory();+ yield* fs.makeDirectory(path.join(home, '.claude', 'skills', 'composio-cli'), {+ recursive: true,+ });- expect(await runIsClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);- });+ expect(yield* isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);+ })+ );- it('treats a release marker without a readable skill as stale', async () => {- const home = tempy.temporaryDirectory();- const target = path.join(home, '.claude', 'skills', 'composio-cli');- mkdirSync(target, { recursive: true });- writeFileSync(path.join(target, SKILL_RELEASE_TAG_FILENAME), '@composio/[email protected]\n');+ it.effect('treats a release marker without a readable skill as stale', () =>+ Effect.gen(function* () {+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;+ const home = tempy.temporaryDirectory();+ const target = path.join(home, '.claude', 'skills', 'composio-cli');+ yield* fs.makeDirectory(target, { recursive: true });+ yield* fs.writeFileString(+ path.join(target, SKILL_RELEASE_TAG_FILENAME),+ '@composio/[email protected]\n'+ );- expect(await runIsClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);+ expect(yield* isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);+ })+ );});});