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
fix(cli): verify plugin setup state
Kshitij Jhunjhunwalab4dbab5060b4
diff --git a/docs/content/docs/claude-code-plugin.mdx b/docs/content/docs/claude-code-plugin.mdxindex 227d86170..e590c9047 100644--- a/docs/content/docs/claude-code-plugin.mdx+++ b/docs/content/docs/claude-code-plugin.mdx@@ -1,82 +1,62 @@---title: Claude Code Plugin-description: Install the Composio CLI plugin for Claude Code — connect and act across 1000+ apps with managed authentication.-keywords: [claude code, plugin, marketplace, composio cli, composio connect, skills]+description: Install Composio in Claude Code as a plugin — connect 1000+ apps with managed OAuth and ready-made skills.+keywords: [claude code, plugin, marketplace, mcp, composio connect, skills]----The **Composio plugin for Claude Code** helps Claude discover and run the right Composio CLI command when a task involves an external app. It is a thin, CLI-based plugin: the plugin adds Claude Code hooks and a connection command, while the `composio` CLI handles tool search, execution, and authentication.+The **Composio plugin for Claude Code** bundles the Composio Connect MCP server with a set of opinionated skills, so Claude Code can search, connect, and act across 1000+ apps right after install. Authentication is fully managed — no API key handling, no manual MCP config.-The plugin does **not** bundle an MCP server or a skill. If you want to add the remote Composio MCP server to Claude Code, see [Composio Connect](/docs/composio-connect).+<Callout type="info">+Looking for the API-key based MCP setup (or other clients like Cursor, Codex, Claude Desktop)? See [Composio Connect](/docs/composio-connect).+</Callout>## What you get-| Component | Purpose |-| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| **SessionStart hook** | Tells Claude about Composio's `search` → `execute` workflow, reports CLI authentication status, and warms a local cache of popular toolkits. It runs when a session starts, resumes, clears, or compacts. |-| **UserPromptSubmit hook** | Nudges Claude toward `composio search` when your prompt names an app in the local toolkit cache. It uses the cache and does not make a network request for each prompt. |-| **`/composio-connect <app>` command** | Connects an app with `composio link` and managed OAuth, then verifies the connection. |+The plugin ships two things together:-The Composio CLI installs the full `composio-cli` skill separately when you sign in. That skill contains the detailed CLI reference; it is not packaged inside this plugin.+- **Composio Connect MCP server** — the same gateway documented in [Composio Connect](/docs/composio-connect), pre-configured. Auth is handled via in-flow OAuth, so you don't paste API keys into your config.+- **Bundled skills** — pre-written prompts that show Claude how to use the MCP server effectively:+ - **`composio-mcp`** — reference for the 7 meta-tools (`COMPOSIO_SEARCH_TOOLS`, `COMPOSIO_MANAGE_CONNECTIONS`, etc.) and the recommended search → connect → execute flow.+ - **`onboarding`** — interactive setup that asks what you want to automate, recommends 2–4 apps, and walks you through connecting them.+ - **`company-activity-summary`** — cross-app activity summary across Slack, GitHub, Notion, Linear, Gmail, and more.+ - **`prefer-composio`** — routing skill that tells Claude to reach for Composio first whenever you paste an app URL or mention an external service, so you don't end up using less reliable native connectors.## Install<Steps><Step>-<StepTitle>Install and set up Composio</StepTitle>+<StepTitle>Add the Composio marketplace</StepTitle>-If the CLI is not already installed, run:+In Claude Code, run:```bash-curl -fsSL https://composio.dev/install | bash+/plugin marketplace add ComposioHQ/composio-plugin-cc```-The installer adds `composio` to your `PATH`. Open a new terminal, or source the shell profile printed by the installer, before continuing:+This registers the catalog. No plugins are installed yet.++</Step>+<Step>+<StepTitle>Install the Composio plugin</StepTitle>```bash-composio login-composio setup --target claude+/plugin install composio-mcp@composio```-Login authenticates the CLI. Setup then adds the GitHub-hosted marketplace, installs and enables `composio@composio`, and installs the matching `composio-cli` skill. Setup is safe to rerun.+Restart Claude Code (or run `/reload-plugins`) when prompted.</Step><Step>-<StepTitle>Try it</StepTitle>--Ask Claude to act on an app, for example: _"List my open GitHub pull requests."_ Claude can search for the appropriate tool, ask you to connect GitHub if necessary, and execute it.+<StepTitle>Connect your first app</StepTitle>-You can also connect an app directly:--```text-/composio-connect github-```+Ask Claude something that needs an external service — for example: *"Star `composiohq/composio` on GitHub"* — and Claude will run the `onboarding` skill, walk you through connecting GitHub, and execute the action. Subsequent runs reuse the same connection.</Step></Steps>-### Manual plugin fallback--If you need to register the plugin directly in Claude Code, add the marketplace:--In Claude Code, run:--```text-/plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git-```--This adds Composio's GitHub-hosted marketplace. It does not install the plugin yet.--Then install the plugin:--```text-/plugin install composio@composio-```--Finish the local prerequisites with `composio login` and `composio --install-skill claude` if they are not already ready. `composio setup --target claude` is preferred for plugin and skill installation because it verifies those pieces together.-## Team setup-To make the marketplace and plugin available to everyone working in a repository, add this to the project's `.claude/settings.json`:+To pre-install the plugin for everyone on your team, add this to your project's `.claude/settings.json`:```json title=".claude/settings.json"{@@ -89,85 +69,42 @@ To make the marketplace and plugin available to everyone working in a repository}},"enabledPlugins": {- "composio@composio": true+ "composio-mcp@composio": true}}```-Claude Code prompts teammates to trust and enable the plugin when they open the project. Each teammate still needs the `composio` CLI installed and must sign in on their machine.--## How it works--The plugin keeps the integration lightweight and lets the CLI own its capabilities:--1. **Session context** — the SessionStart hook tells Claude to use Composio for external apps, surfaces CLI authentication status, and caches a small list of popular toolkits.-2. **Prompt routing** — the UserPromptSubmit hook checks the prompt against that local cache. When it recognizes an app, it reminds Claude to use Composio's just-in-time tool search.-3. **Tool discovery and execution** — Claude runs `composio search "<task>"`, then `composio execute` with the selected tool. If an app is not connected, it runs `composio link <app>` to start managed OAuth.-4. **CLI-provided guidance** — the separately installed `composio-cli` skill gives Claude the full command and workflow reference.--The hooks guide Claude; they do not expose tools or execute app actions themselves.+Anyone who clones the repo and opens it in Claude Code will be prompted to enable the plugin. See the Claude Code [plugin scopes](https://docs.claude.com/en/docs/claude-code/plugins-reference#plugin-installation-scopes) reference for `user` vs `project` vs `local` scope behavior.## Updating-Plugin updates and CLI updates are separate. Update the marketplace checkout and reload plugins in Claude Code:+The plugin is versioned via the `version` field in its `plugin.json`. To pull the latest release:-```text+```bash/plugin marketplace update composio/reload-plugins```-Update the CLI to receive the latest Composio commands, tool-routing behavior, and generated skill:--```bash-composio upgrade-```--## Plugin or MCP setup?+## How it differs from the API-key MCP setup-The Claude Code plugin and the API-key MCP setup are two different ways to use Composio:+Both paths give Claude Code access to the same Composio Connect MCP server and the same 1000+ apps. The differences:-| | Claude Code plugin | Composio Connect MCP |-| ------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------- |-| Runtime | Local `composio` CLI | Remote MCP server |-| Tool access | Claude runs `composio search`, `composio execute`, and `composio link` | Claude calls Composio's MCP meta-tools |-| Claude Code integration | Session and prompt hooks plus `/composio-connect` | MCP tools registered with `claude mcp add` |-| Skill | Installed and updated separately by the CLI | No CLI skill required |-| Initial Composio authentication | `composio login` | Consumer API key in the MCP configuration |-| Updates | Update both the marketplace plugin and CLI | Server-side; the MCP configuration remains in Claude Code |+| | Plugin install | `claude mcp add` |+|---|---|---|+| Setup steps | Two slash commands | One terminal command, requires copying an API key |+| Auth | OAuth, no API key in your config | API key in `--header "x-consumer-api-key: ..."` |+| Bundled skills | Yes (onboarding, routing, summaries) | No |+| Discoverable in Claude Code marketplace | Yes | No |+| Updates | `/plugin marketplace update composio` | Manual re-run of `claude mcp add` |-Choose the plugin when you want Claude Code to use the local CLI and its scripting workflows. Choose [Composio Connect](/docs/composio-connect) when you want an MCP-native setup or the same remote MCP interface across multiple clients.+Pick the plugin path if you want the fastest install and the bundled skills. Pick the `claude mcp add` path if you already have an API key and want a single-command setup script you can replicate across machines.## Source code-The plugin is open source at [ComposioHQ/composio-plugin-cc](https://github.com/ComposioHQ/composio-plugin-cc).+The plugin is open source: [ComposioHQ/composio-plugin-cc](https://github.com/ComposioHQ/composio-plugin-cc). Issues and PRs welcome.## Troubleshooting-### The plugin installs, but Claude cannot run Composio--Confirm the CLI is available and that you are signed in:--```bash-composio --version-composio whoami-```--If the first command fails, [install the CLI](#install). If the second reports that you are signed out, run `composio login`.--### The CLI skill is missing--The plugin does not bundle the `composio-cli` skill. Rerun `composio setup --target claude`, or install the skill explicitly:--```bash-composio --install-skill claude-```--### Claude does not receive an app-specific nudge--The UserPromptSubmit hook only matches apps in its cached popular-toolkit list. Claude can still use Composio for any supported app: ask it to run `composio search "<task>"`, or connect the app with `/composio-connect <app>`.--### An app is not connected or a tool call fails--Run `composio link <app>` to connect the app, then retry the action. For CLI-specific diagnostics, use the troubleshooting guidance in the installed `composio-cli` skill. For the separate MCP integration, see [Composio Connect troubleshooting](/docs/composio-connect#troubleshooting).+For tools-not-appearing, OAuth, and connection issues, see the [Composio Connect troubleshooting section](/docs/composio-connect#troubleshooting). The same checks apply to the plugin install (the underlying MCP server is identical).-For marketplace registration, plugin loading, or hook errors, see the [Claude Code plugin troubleshooting documentation](https://code.claude.com/docs/en/plugins-reference#common-issues).+For plugin-specific issues — install errors, marketplace not updating, skills not appearing — see the [Claude Code plugin troubleshooting docs](https://docs.claude.com/en/docs/claude-code/plugins-reference#common-issues).diff --git a/ts/e2e-tests/cli/setup-plugins/e2e.test.ts b/ts/e2e-tests/cli/setup-plugins/e2e.test.tsindex 91e6dc442..2dd03167b 100644--- a/ts/e2e-tests/cli/setup-plugins/e2e.test.ts+++ b/ts/e2e-tests/cli/setup-plugins/e2e.test.ts@@ -15,12 +15,16 @@ set -eumkdir -p /tmp/bin /tmp/host-statecp fixtures/fake-agent-host.sh /tmp/bin/${host}chmod +x /tmp/bin/${host}-${host === 'claude' ? 'mkdir -p /tmp/.claude/skills/composio-cli' : ''}+${+ host === 'claude'+ ? `mkdir -p /tmp/.claude/skills/composio-cli /tmp/.agents/skills/composio-cli+printf '@composio/cli@%s\n' "$(composio --version)" > /tmp/.agents/skills/composio-cli/.composio-release-tag`+ : ''+}export HOST_STATE_DIR=/tmp/host-stateexport PATH=/tmp/bin:$PATHcomposio setup --target ${host} --yes > first.jsoncomposio setup --target ${host} --yes > second.json-composio setup status --json > status.jsoncp /tmp/host-state/commands.log commands.log`;@@ -29,12 +33,8 @@ e2e(import.meta.url, {cli: ['current'],},defineTests: ({ runCmd }) => {- let claude: E2ETestResultWithFiles<- 'first.json' | 'second.json' | 'status.json' | 'commands.log'- >;- let codex: E2ETestResultWithFiles<- 'first.json' | 'second.json' | 'status.json' | 'commands.log'- >;+ let claude: E2ETestResultWithFiles<'first.json' | 'second.json' | 'commands.log'>;+ let codex: E2ETestResultWithFiles<'first.json' | 'second.json' | 'commands.log'>;let unavailable: E2ETestResult;beforeAll(async () => {@@ -42,11 +42,11 @@ e2e(import.meta.url, {// these fresh-container cases sequential to avoid same-millisecond names.claude = await runCmd({command: setupFixture('claude'),- files: ['first.json', 'second.json', 'status.json', 'commands.log'],+ files: ['first.json', 'second.json', 'commands.log'],});codex = await runCmd({command: setupFixture('codex'),- files: ['first.json', 'second.json', 'status.json', 'commands.log'],+ files: ['first.json', 'second.json', 'commands.log'],});unavailable = await runCmd('composio setup --target auto --yes');}, TIMEOUTS.FIXTURE);@@ -78,17 +78,6 @@ e2e(import.meta.url, {targets: Array<{ target: string; changed: boolean; cli_skill_ready: boolean }>;};const second = JSON.parse(execution.files['second.json']) as typeof first;- const status = JSON.parse(execution.files['status.json']) as {- targets: Array<{- target: string;- available: boolean;- marketplace_configured: boolean;- plugin_installed: boolean;- plugin_enabled: boolean;- cli_skill_ready: boolean;- }>;- };-expect(first.success).toBe(true);expect(first.targets).toContainEqual(expect.objectContaining({ target: host, changed: true, cli_skill_ready: true })@@ -96,15 +85,6 @@ e2e(import.meta.url, {expect(second.targets).toContainEqual(expect.objectContaining({ target: host, changed: false, cli_skill_ready: true }));- expect(status.targets).toContainEqual({- target: host,- available: true,- marketplace_configured: true,- plugin_installed: true,- plugin_enabled: true,- cli_skill_ready: true,- });-const commands = execution.files['commands.log'].trim().split('\n');expect(commands.filter(command => command === marketplaceCommand)).toHaveLength(1);expect(commands.filter(command => command === installCommand)).toHaveLength(1);diff --git a/ts/packages/cli/src/commands/root-help.ts b/ts/packages/cli/src/commands/root-help.tsindex 7940097a8..c4b0750fc 100644--- a/ts/packages/cli/src/commands/root-help.ts+++ b/ts/packages/cli/src/commands/root-help.ts@@ -880,18 +880,12 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel'composio setup','composio setup --target auto --yes','composio setup --target all',- 'composio setup status --json',],options: [{ name: '--target <target>', description: 'auto, claude, codex, or all' },{ name: '-y, --yes', description: 'Accept setup changes without prompting' },],},- 'setup status': {- usage: 'composio setup status [--json]',- description: 'Inspect agent plugin installation status.',- flags: [{ name: '--json', description: 'Print machine-readable JSON' }],- },version: {usage: 'composio version',description: 'Display the current Composio CLI version.',diff --git a/ts/packages/cli/src/commands/setup.cmd.ts b/ts/packages/cli/src/commands/setup.cmd.tsindex 3d1473ceb..58a4eae7f 100644--- a/ts/packages/cli/src/commands/setup.cmd.ts+++ b/ts/packages/cli/src/commands/setup.cmd.ts@@ -1,7 +1,6 @@import { Command, Options } from '@effect/cli';import { Effect } from 'effect';import {- inspectSetupTargets,installSetupTargets,resolveSetupTargets,SETUP_TARGETS,@@ -20,46 +19,6 @@ const yes = Options.boolean('yes').pipe(Options.withDescription('Accept setup changes without prompting'));-const json = Options.boolean('json').pipe(- Options.withDefault(false),- Options.withDescription('Print machine-readable JSON')-);--const setupStatusCmd = Command.make('status', { json }).pipe(- Command.withDescription('Inspect agent plugin installation status.'),- Command.withHandler(({ json }) =>- Effect.gen(function* () {- const ui = yield* TerminalUI;- const targets = yield* inspectSetupTargets;- const result = { targets };-- if (!json) {- yield* ui.note(- [- ...targets.map(item => {- const state = !item.available- ? 'not detected'- : !item.plugin_installed- ? 'not installed'- : item.plugin_enabled- ? 'installed and enabled'- : 'installed but disabled';- return `${item.target}: ${state}`;- }),- ...targets- .filter(item => item.available)- .map(- item => `${item.target} CLI skill: ${item.cli_skill_ready ? 'ready' : 'not ready'}`- ),- ].join('\n'),- 'Composio setup status'- );- }- yield* ui.output(JSON.stringify(result), { force: json });- })- )-);-const setupBaseCmd = Command.make('setup', { target, yes }, ({ target, yes }) =>Effect.gen(function* () {const ui = yield* TerminalUI;@@ -84,11 +43,9 @@ const setupBaseCmd = Command.make('setup', { target, yes }, ({ target, yes }) =>: `The Composio plugin for ${result.target} is already installed and enabled.`);if (result.target === 'claude') {- yield* ui.log.success(- result.skill_changed- ? 'Installed the composio-cli skill for Claude Code.'- : 'The composio-cli skill for Claude Code is already installed.'- );+ if (!result.skill_changed) {+ yield* ui.log.success('The composio-cli skill for Claude Code is already installed.');+ }} else {yield* ui.log.success('The Codex plugin includes the composio-cli skill.');}@@ -105,6 +62,5 @@ const setupBaseCmd = Command.make('setup', { target, yes }, ({ target, yes }) =>);export const setupCmd = setupBaseCmd.pipe(- Command.withDescription('Install Composio plugins for supported agent hosts.'),- Command.withSubcommands([setupStatusCmd])+ Command.withDescription('Install Composio plugins for supported agent hosts.'));diff --git a/ts/packages/cli/src/effects/install-skill.ts b/ts/packages/cli/src/effects/install-skill.tsindex 0e8264bd3..b6b61b2ad 100644--- a/ts/packages/cli/src/effects/install-skill.ts+++ b/ts/packages/cli/src/effects/install-skill.ts@@ -15,6 +15,7 @@ import extractZip from 'extract-zip';const SKILL_NAME = 'composio-cli';const SKILL_ASSET_NAME = 'composio-skill.zip';+export const SKILL_RELEASE_TAG_FILENAME = '.composio-release-tag';export type SkillReleaseChannel = CliReleaseChannel;export type SkillInstallTarget = 'claude' | 'codex' | 'openclaw';@@ -66,6 +67,15 @@ export const resolveTargetSkillPath = ({}};+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;+ }+};+const resolveTargetLabel = (target: SkillInstallTarget): string => SKILL_TARGET_LABELS[target];export const inferSkillReleaseChannel = (tagOrVersion: string): SkillReleaseChannel =>@@ -204,6 +214,7 @@ export const installSkill = (options?: {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 });}diff --git a/ts/packages/cli/src/services/setup-skill-installer.ts b/ts/packages/cli/src/services/setup-skill-installer.tsindex a91f01e37..6b47d6445 100644--- a/ts/packages/cli/src/services/setup-skill-installer.ts+++ b/ts/packages/cli/src/services/setup-skill-installer.ts@@ -1,7 +1,7 @@-import { FileSystem } from '@effect/platform';import { Effect } from 'effect';+import fs from 'node:fs';import path from 'node:path';-import { installSkill } from 'src/effects/install-skill';+import { installSkill, readInstalledSkillReleaseTag } from 'src/effects/install-skill';import { APP_VERSION } from 'src/constants';import { readInstalledReleaseTag } from 'src/services/run-companion-modules';import { NodeOs } from './node-os';@@ -11,24 +11,28 @@ export const resolveSetupSkillReleaseTag = (fallbackVersion = APP_VERSION): string => readInstalledReleaseTag(execPath) ?? `@composio/cli@${fallbackVersion}`;+export const isClaudeSkillCurrent = (home: string, releaseTag: string): boolean => {+ const target = path.join(home, '.claude', 'skills', 'composio-cli');+ const skillDir = path.join(home, '.agents', 'skills', 'composio-cli');+ return fs.existsSync(target) && readInstalledSkillReleaseTag(skillDir) === releaseTag;+};+export class SetupSkillInstaller extends Effect.Service<SetupSkillInstaller>()('services/SetupSkillInstaller',{sync: () => ({isClaudeSkillInstalled: Effect.gen(function* () {- const fs = yield* FileSystem.FileSystem;const os = yield* NodeOs;- return yield* fs.exists(path.join(os.homedir, '.claude', 'skills', 'composio-cli'));+ return isClaudeSkillCurrent(os.homedir, resolveSetupSkillReleaseTag());}),ensureClaudeSkill: Effect.gen(function* () {- const fs = yield* FileSystem.FileSystem;const os = yield* NodeOs;- const target = path.join(os.homedir, '.claude', 'skills', 'composio-cli');- if (yield* fs.exists(target)) return false;+ const releaseTag = resolveSetupSkillReleaseTag();+ if (isClaudeSkillCurrent(os.homedir, releaseTag)) return false;yield* installSkill({target: 'claude',- releaseTag: resolveSetupSkillReleaseTag(),+ releaseTag,});return true;}),diff --git a/ts/packages/cli/src/services/setup.ts b/ts/packages/cli/src/services/setup.tsindex 6958834a1..ff04ad314 100644--- a/ts/packages/cli/src/services/setup.ts+++ b/ts/packages/cli/src/services/setup.ts@@ -46,6 +46,10 @@ interface SetupTargetAdapter {readonly pluginEnableArgs: ReadonlyArray<string>;}+interface InspectedSetupTarget extends SetupTargetStatus {+ readonly marketplace_conflict: boolean;+}+const CLAUDE_ADAPTER: SetupTargetAdapter = {target: 'claude',executable: 'claude',@@ -127,10 +131,14 @@ const normalizeGitHubRepository = (value: string): string | undefined => {return parts.join('/').toLowerCase();};-const marketplaceIsConfigured = (adapter: SetupTargetAdapter, output: string): boolean => {+const marketplaceState = (+ adapter: SetupTargetAdapter,+ output: string+): { readonly configured: boolean; readonly conflicting: boolean } => {const parsed = parseJson(output);const records = recordsFrom(parsed, adapter.target === 'codex' ? 'marketplaces' : undefined);- return records.some(record => {+ const expected = normalizeGitHubRepository(adapter.marketplace.source);+ const sourceMatches = (record: Record<string, unknown>) => {const repo = typeof record.repo === 'string' ? record.repo : undefined;const url = typeof record.url === 'string' ? record.url : undefined;const nestedSource = asRecord(record.source);@@ -140,12 +148,16 @@ const marketplaceIsConfigured = (adapter: SetupTargetAdapter, output: string): b(typeof nestedSource?.repo === 'string' ? nestedSource.repo : undefined) ??(typeof nestedSource?.source === 'string' ? nestedSource.source : undefined) ??(typeof marketplaceSource?.source === 'string' ? marketplaceSource.source : undefined);- const expected = normalizeGitHubRepository(adapter.marketplace.source);return [repo, url, source].some(candidate =>typeof candidate === 'string' && normalizeGitHubRepository(candidate) === expected);- });+ };+ const configured = records.some(sourceMatches);+ const conflicting = records.some(+ record => record.name === adapter.marketplace.name && !sourceMatches(record)+ );+ return { configured, conflicting };};const pluginState = (@@ -182,7 +194,8 @@ const inspectAdapter = (adapter: SetupTargetAdapter) =>plugin_installed: false,plugin_enabled: false,cli_skill_ready: false,- } satisfies SetupTargetStatus;+ marketplace_conflict: false,+ } satisfies InspectedSetupTarget;}const [marketplaces, plugins] = yield* Effect.all([@@ -195,21 +208,22 @@ const inspectAdapter = (adapter: SetupTargetAdapter) =>: { installed: false, enabled: false };const pluginReady = plugin.installed && plugin.enabled;+ const marketplace =+ marketplaces && marketplaces.exitCode === 0+ ? marketplaceState(adapter, marketplaces.stdout)+ : { configured: false, conflicting: false };return {target: adapter.target,available: true,- marketplace_configured: Boolean(- marketplaces &&- marketplaces.exitCode === 0 &&- marketplaceIsConfigured(adapter, marketplaces.stdout)- ),+ marketplace_configured: marketplace.configured,plugin_installed: plugin.installed,plugin_enabled: plugin.enabled,// Codex loads the composio-cli skill from the plugin package itself. Claude's// plugin uses the standalone skill installed from the matching CLI release.cli_skill_ready:adapter.target === 'codex' ? pluginReady : yield* skillInstaller.isClaudeSkillInstalled,- } satisfies SetupTargetStatus;+ marketplace_conflict: marketplace.conflicting,+ } satisfies InspectedSetupTarget;});const runRequired = (adapter: SetupTargetAdapter, args: ReadonlyArray<string>, operation: string) =>@@ -234,6 +248,17 @@ const installAdapter = (adapter: SetupTargetAdapter) =>));}+ if (initial.marketplace_conflict) {+ const removeCommand =+ adapter.target === 'claude'+ ? 'claude plugin marketplace remove composio --scope user'+ : 'codex plugin marketplace remove composio --json';+ return yield* Effect.fail(+ new Error(+ `The ${adapter.target} marketplace named "composio" points to a different source. Run \`${removeCommand}\`, then rerun \`composio setup --target ${adapter.target}\`.`+ )+ );+ }let pluginChanged = false;if (!initial.marketplace_configured) {@@ -266,20 +291,35 @@ const installAdapter = (adapter: SetupTargetAdapter) =>? yield* skillInstaller.ensureClaudeSkill: false;+ const final = yield* inspectAdapter(adapter);+ if (+ !final.available ||+ !final.marketplace_configured ||+ !final.plugin_installed ||+ !final.plugin_enabled ||+ !final.cli_skill_ready+ ) {+ return yield* Effect.fail(+ new Error(+ `Setup commands completed, but ${adapter.target} did not report the Composio plugin and CLI skill as ready. Rerun \`composio setup --target ${adapter.target}\` or inspect the native ${adapter.target} plugin configuration.`+ )+ );+ }+return {target: adapter.target,- available: true,- marketplace_configured: true,- plugin_installed: true,- plugin_enabled: true,- cli_skill_ready: true,+ available: final.available,+ marketplace_configured: final.marketplace_configured,+ plugin_installed: final.plugin_installed,+ plugin_enabled: final.plugin_enabled,+ cli_skill_ready: final.cli_skill_ready,changed: pluginChanged || skillChanged,plugin_changed: pluginChanged,skill_changed: skillChanged,} satisfies SetupTargetResult;});-export const inspectSetupTargets = Effect.all(ADAPTERS.map(inspectAdapter));+const inspectSetupTargets = Effect.all(ADAPTERS.map(inspectAdapter));export const resolveSetupTargets = (target: SetupTarget) =>Effect.gen(function* () {diff --git a/ts/packages/cli/test/src/commands/setup.cmd.test.ts b/ts/packages/cli/test/src/commands/setup.cmd.test.tsindex 36e507e51..df980b911 100644--- a/ts/packages/cli/test/src/commands/setup.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/setup.cmd.test.ts@@ -6,9 +6,18 @@ import { CommandRunner } from 'src/services/command-runner';import { SetupSkillInstaller } from 'src/services/setup-skill-installer';import { cli, MockConsole, TestLive } from 'test/__utils__';+type AgentHost = 'claude' | 'codex';+type MarketplaceState = 'missing' | 'canonical' | 'conflict';+type PluginState = 'missing' | 'disabled' | 'enabled';++interface FakeHostState {+ available: boolean;+ marketplace: MarketplaceState;+ plugin: PluginState;+}+const commandParts = (command: Command.Command): ReadonlyArray<string> => {- const flattened = Command.flatten(command);- const first = flattened[0];+ const first = Command.flatten(command)[0];return [first.command, ...first.args];};@@ -17,15 +26,10 @@ const makeRunner = (readonly exitCode?: number;readonly stdout?: string;readonly stderr?: string;- },- onRun: (parts: ReadonlyArray<string>) => void = () => undefined+ }) =>new CommandRunner({- run: command =>- Effect.sync(() => {- onRun(commandParts(command));- return CommandExecutor.ExitCode(0);- }),+ run: () => Effect.succeed(CommandExecutor.ExitCode(0)),capture: command => {const result = respond(commandParts(command));return Effect.succeed({@@ -36,286 +40,198 @@ const makeRunner = (},});-describe('CLI: composio setup', () => {- afterEach(() => {- vi.restoreAllMocks();- vi.unstubAllEnvs();- process.exitCode = undefined;- });-- const humanCommands: string[][] = [];- const humanRunner = makeRunner(parts => {- humanCommands.push([...parts]);- if (parts.join(' ') === 'claude --version') return { stdout: '2.1.0' };- if (parts.join(' ') === 'claude plugin marketplace list --json') {- return { stdout: '[]' };- }- if (parts.join(' ') === 'claude plugin list --json') return { stdout: '[]' };- return {};+const makeSkillInstaller = (initiallyReady = false, failInstall = false) => {+ let ready = initiallyReady;+ return new SetupSkillInstaller({+ isClaudeSkillInstalled: Effect.sync(() => ready),+ ensureClaudeSkill: failInstall+ ? Effect.fail(new Error('skill download failed'))+ : Effect.sync(() => {+ const changed = !ready;+ ready = true;+ return changed;+ }),});+};- layer(TestLive({ fixture: 'user-config-example', commandRunner: humanRunner }))(- 'Claude plugin install',- it => {- it.scoped('registers and installs the Claude plugin with exact native commands', () =>- Effect.gen(function* () {- humanCommands.length = 0;- yield* cli(['setup', '--target', 'claude', '--yes']);+const defaultHostState = (): FakeHostState => ({+ available: false,+ marketplace: 'missing',+ plugin: 'missing',+});- expect(humanCommands).toContainEqual([- 'claude',- 'plugin',- 'marketplace',- 'add',- 'https://github.com/ComposioHQ/composio-plugin-cc.git',- '--scope',- 'user',- ]);- expect(humanCommands).toContainEqual([- 'claude',- 'plugin',- 'install',- 'composio@composio',- '--scope',- 'user',- ]);+const makeFakeHosts = (+ initial: Partial<Record<AgentHost, Partial<FakeHostState>>>,+ options: { readonly noOp?: boolean; readonly failOn?: string } = {}+) => {+ const state: Record<AgentHost, FakeHostState> = {+ claude: { ...defaultHostState(), ...initial.claude },+ codex: { ...defaultHostState(), ...initial.codex },+ };+ const commands: string[][] = [];- const output = (yield* MockConsole.getLines()).join('\n');- expect(output).toContain('Configured and enabled the Composio plugin for claude');- expect(output).toContain('"success":true');- })- );+ const marketplaceOutput = (host: AgentHost): string => {+ const current = state[host].marketplace;+ const source =+ current === 'canonical'+ ? host === 'claude'+ ? 'https://github.com/ComposioHQ/composio-plugin-cc.git'+ : 'ComposioHQ/composio-plugin-openai'+ : 'someone-else/not-composio';+ if (host === 'claude') {+ return current === 'missing'+ ? '[]'+ : JSON.stringify([{ name: 'composio', source: { source: 'github', repo: source } }]);}- );-- const codexCommands: string[][] = [];- const codexInstalledRunner = makeRunner(parts => {- codexCommands.push([...parts]);- if (parts.join(' ') === 'codex --version') return { stdout: 'codex-cli 0.144.1' };- if (parts.join(' ') === 'codex plugin marketplace list --json') {- return {- stdout: JSON.stringify({- marketplaces: [- {- name: 'composio',- marketplaceSource: {- sourceType: 'git',- source: 'https://github.com/COMPOSIOHQ/composio-plugin-openai.git/',+ return JSON.stringify({+ marketplaces:+ current === 'missing'+ ? []+ : [+ {+ name: 'composio',+ marketplaceSource: { sourceType: 'git', source },},- },- ],- }),- };- }- if (parts.join(' ') === 'codex plugin list --json') {- return {- stdout: JSON.stringify({- installed: [{ pluginId: 'composio@composio', installed: true, enabled: true }],- }),- };- }- return {};- });+ ],+ });+ };- layer(TestLive({ fixture: 'user-config-example', commandRunner: codexInstalledRunner }))(- 'existing Codex install',- it => {- it.scoped('is idempotent when the Codex marketplace and plugin are already installed', () =>- Effect.gen(function* () {- codexCommands.length = 0;- yield* cli(['setup', '--target', 'codex', '--yes']);-- expect(codexCommands).not.toContainEqual([- 'codex',- 'plugin',- 'marketplace',- 'add',- 'https://github.com/ComposioHQ/composio-plugin-openai.git',- '--json',- ]);- expect(codexCommands).not.toContainEqual([- 'codex',- 'plugin',- 'add',- 'composio@composio',- '--json',- ]);+ const pluginOutput = (host: AgentHost): string => {+ const current = state[host].plugin;+ const installed = current !== 'missing';+ const enabled = current === 'enabled';+ return host === 'claude'+ ? JSON.stringify(installed ? [{ id: 'composio@composio', installed, enabled }] : [])+ : JSON.stringify({+ installed: installed ? [{ pluginId: 'composio@composio', installed, enabled }] : [],+ available: [],+ });+ };- const output = (yield* MockConsole.getLines()).join('\n');- expect(output).toContain('already installed and enabled');- expect(output).toContain('"changed":false');- expect(output).toContain('"cli_skill_ready":true');- expect(output).toContain('"success":true');- expect(output).not.toContain('uak_');- expect(process.exitCode).toBeUndefined();- })- );+ const runner = makeRunner(parts => {+ commands.push([...parts]);+ const host = parts[0] as AgentHost;+ const command = parts.join(' ');+ if (parts[1] === '--version') {+ return state[host].available+ ? { stdout: host === 'claude' ? '2.1.0' : 'codex-cli 0.144.1' }+ : { exitCode: 127, stderr: 'not found' };}- );-- const disabledClaudeCommands: string[][] = [];- const disabledClaudeRunner = makeRunner(parts => {- disabledClaudeCommands.push([...parts]);- if (parts.join(' ') === 'claude --version') return { stdout: '2.1.0' };- if (parts.join(' ') === 'claude plugin marketplace list --json') {- return {- stdout: JSON.stringify([- {- name: 'composio',- source: 'git',- url: 'https://github.com/ComposioHQ/composio-plugin-cc.git',- },- ]),- };+ if (command === `${host} plugin marketplace list --json`) {+ return { stdout: marketplaceOutput(host) };}- if (parts.join(' ') === 'claude plugin list --json') {- return {- stdout: JSON.stringify([{ id: 'composio@composio', installed: true, enabled: false }]),- };+ if (command === `${host} plugin list --json`) {+ return { stdout: pluginOutput(host) };+ }+ if (options.failOn && command.includes(options.failOn)) {+ return { exitCode: 2, stderr: 'native operation failed' };+ }+ if (!options.noOp && command.includes('plugin marketplace add')) {+ state[host].marketplace = 'canonical';+ }+ if (+ !options.noOp &&+ (command.includes('plugin install') ||+ command.includes('plugin enable') ||+ command === 'codex plugin add composio@composio --json')+ ) {+ state[host].plugin = 'enabled';}return {};});- layer(TestLive({ fixture: 'user-config-example', commandRunner: disabledClaudeRunner }))(- 'disabled Claude plugin',- it => {- it.scoped('repairs a disabled Claude plugin with the native enable command', () =>- Effect.gen(function* () {- disabledClaudeCommands.length = 0;- yield* cli(['setup', '--target', 'claude', '--yes']);+ return { commands, runner, state };+};- expect(disabledClaudeCommands).toContainEqual([- 'claude',- 'plugin',- 'enable',- 'composio@composio',- ]);- expect(disabledClaudeCommands).not.toContainEqual([- 'claude',- 'plugin',- 'install',- 'composio@composio',- '--scope',- 'user',- ]);- const output = (yield* MockConsole.getLines()).join('\n');- expect(output).toContain('"plugin_installed":true');- expect(output).toContain('"plugin_enabled":true');- })- );+describe('CLI: composio setup', () => {+ afterEach(() => {+ vi.restoreAllMocks();+ vi.unstubAllEnvs();+ process.exitCode = undefined;+ });- it.scoped('reports a disabled plugin as not enabled in machine status', () =>- Effect.gen(function* () {- disabledClaudeCommands.length = 0;- yield* cli(['setup', 'status', '--json']);+ const freshClaude = makeFakeHosts({ claude: { available: true } });+ layer(+ TestLive({+ fixture: 'user-config-example',+ commandRunner: freshClaude.runner,+ setupSkillInstaller: makeSkillInstaller(),+ })+ )('fresh Claude install', it => {+ it.scoped('uses exact native commands and verifies readiness', () =>+ Effect.gen(function* () {+ yield* cli(['setup', '--target', 'claude', '--yes']);- const lines = yield* MockConsole.getLines();- const jsonLine = lines.filter(line => line.startsWith('{')).at(-1);- const status = JSON.parse(jsonLine ?? '{}') as {- targets?: Array<Record<string, unknown>>;- };- expect(status.targets?.find(item => item.target === 'claude')).toMatchObject({- plugin_installed: true,- plugin_enabled: false,- });- expect(disabledClaudeCommands).not.toContainEqual([- 'claude',- 'plugin',- 'enable',- 'composio@composio',- ]);- })- );- }- );+ expect(freshClaude.commands).toContainEqual([+ 'claude',+ 'plugin',+ 'marketplace',+ 'add',+ 'https://github.com/ComposioHQ/composio-plugin-cc.git',+ '--scope',+ 'user',+ ]);+ expect(freshClaude.commands).toContainEqual([+ 'claude',+ 'plugin',+ 'install',+ 'composio@composio',+ '--scope',+ 'user',+ ]);+ expect(freshClaude.state.claude).toMatchObject({+ marketplace: 'canonical',+ plugin: 'enabled',+ });+ expect((yield* MockConsole.getLines()).join('\n')).toContain('"success":true');+ })+ );+ });- const disabledCodexCommands: string[][] = [];- const disabledCodexRunner = makeRunner(parts => {- disabledCodexCommands.push([...parts]);- if (parts.join(' ') === 'codex --version') return { stdout: 'codex-cli 0.144.1' };- if (parts.join(' ') === 'codex plugin marketplace list --json') {- return {- stdout: JSON.stringify({- marketplaces: [- {- name: 'composio',- marketplaceSource: {- sourceType: 'git',- source: 'ComposioHQ/composio-plugin-openai',- },- },- ],- }),- };- }- if (parts.join(' ') === 'codex plugin list --json') {- return {- stdout: JSON.stringify({- installed: [{ pluginId: 'composio@composio', installed: true, enabled: false }],- }),- };- }- return {};+ const existingCodex = makeFakeHosts({+ codex: { available: true, marketplace: 'canonical', plugin: 'enabled' },});+ layer(TestLive({ commandRunner: existingCodex.runner }))('existing Codex install', it => {+ it.scoped('is idempotent', () =>+ Effect.gen(function* () {+ yield* cli(['setup', '--target', 'codex', '--yes']);- layer(TestLive({ fixture: 'user-config-example', commandRunner: disabledCodexRunner }))(- 'disabled Codex plugin',- it => {- it.scoped('repairs a disabled Codex plugin through its native add path', () =>+ expect(existingCodex.commands.some(parts => parts.includes('add'))).toBe(false);+ const output = (yield* MockConsole.getLines()).join('\n');+ expect(output).toContain('"changed":false');+ expect(output).toContain('"success":true');+ })+ );+ });++ for (const host of ['claude', 'codex'] as const) {+ const disabled = makeFakeHosts({+ [host]: { available: true, marketplace: 'canonical', plugin: 'disabled' },+ });+ layer(+ TestLive({+ commandRunner: disabled.runner,+ setupSkillInstaller: makeSkillInstaller(true),+ })+ )(`disabled ${host} plugin`, it => {+ it.scoped('repairs the plugin through the native path', () =>Effect.gen(function* () {- disabledCodexCommands.length = 0;- yield* cli(['setup', '--target', 'codex', '--yes']);+ yield* cli(['setup', '--target', host, '--yes']);- expect(disabledCodexCommands).toContainEqual([- 'codex',- 'plugin',- 'add',- 'composio@composio',- '--json',- ]);- const output = (yield* MockConsole.getLines()).join('\n');- expect(output).toContain('"plugin_installed":true');- expect(output).toContain('"plugin_enabled":true');- expect(output).toContain('"success":true');+ expect(disabled.state[host].plugin).toBe('enabled');+ expect((yield* MockConsole.getLines()).join('\n')).toContain('"plugin_enabled":true');}));- }- );+ });+ }- const codexFreshCommands: string[][] = [];- const codexFreshRunner = makeRunner(parts => {- codexFreshCommands.push([...parts]);- if (parts.join(' ') === 'codex --version') return { stdout: 'codex-cli 0.144.1' };- if (parts.join(' ') === 'codex plugin marketplace list --json') {- return { stdout: JSON.stringify({ marketplaces: [] }) };- }- if (parts.join(' ') === 'codex plugin list --json') {- return { stdout: JSON.stringify({ installed: [], available: [] }) };- }- return {};- });- const codexBundledSkillInstaller = new SetupSkillInstaller({- isClaudeSkillInstalled: Effect.die(- new Error('Codex setup must not inspect the standalone Claude skill')- ),- ensureClaudeSkill: Effect.die(- new Error('Codex setup must not install a redundant global CLI skill')- ),- });-- layer(- TestLive({- fixture: 'user-config-example',- commandRunner: codexFreshRunner,- setupSkillInstaller: codexBundledSkillInstaller,- })- )('fresh Codex install', it => {- it.scoped('uses the planned OpenAI marketplace and exact Codex commands', () =>+ const freshCodex = makeFakeHosts({ codex: { available: true } });+ layer(TestLive({ commandRunner: freshCodex.runner }))('fresh Codex install', it => {+ it.scoped('uses the public OpenAI marketplace and exact native commands', () =>Effect.gen(function* () {- codexFreshCommands.length = 0;yield* cli(['setup', '--target', 'codex', '--yes']);- expect(codexFreshCommands).toContainEqual([+ expect(freshCodex.commands).toContainEqual(['codex','plugin','marketplace',@@ -323,79 +239,84 @@ describe('CLI: composio setup', () => {'https://github.com/ComposioHQ/composio-plugin-openai.git','--json',]);- expect(codexFreshCommands).toContainEqual([+ expect(freshCodex.commands).toContainEqual(['codex','plugin','add','composio@composio','--json',]);- const output = (yield* MockConsole.getLines()).join('\n');- expect(output).toContain('"cli_skill_ready":true');- expect(output).toContain('"success":true');}));});- const unavailableRunner = makeRunner(() => ({ exitCode: 127, stderr: 'not found' }));- layer(TestLive({ commandRunner: unavailableRunner }))('status', it => {- it.scoped('prints machine-readable status without installing anything', () =>+ const autoClaude = makeFakeHosts({ claude: { available: true } });+ layer(+ TestLive({+ commandRunner: autoClaude.runner,+ setupSkillInstaller: makeSkillInstaller(),+ })+ )('automatic setup with one host', it => {+ it.scoped('installs only the detected host', () =>Effect.gen(function* () {- yield* cli(['setup', 'status', '--json']);- const lines = yield* MockConsole.getLines();- expect(lines).toHaveLength(1);- expect(JSON.parse(lines[0] ?? '{}')).toMatchObject({- targets: [- { target: 'claude', available: false, cli_skill_ready: false },- { target: 'codex', available: false, cli_skill_ready: false },- ],- });+ yield* cli(['setup', '--target', 'auto', '--yes']);++ const output = (yield* MockConsole.getLines()).join('\n');+ expect(output).toContain('"target":"claude"');+ expect(output).not.toContain('"target":"codex"');}));});- const wrongMarketplaceRunner = makeRunner(parts => {- if (parts.join(' ') === 'claude --version') return { stdout: '2.1.0' };- if (parts.join(' ') === 'codex --version') return { exitCode: 127 };- if (parts.join(' ') === 'claude plugin marketplace list --json') {- return {- stdout: JSON.stringify([- {- name: 'composio',- source: { source: 'github', repo: 'someone-else/not-composio' },- },- ]),- };- }- if (parts.join(' ') === 'claude plugin list --json') return { stdout: '[]' };- return {};+ const autoBoth = makeFakeHosts({+ claude: { available: true, marketplace: 'canonical', plugin: 'enabled' },+ codex: { available: true, marketplace: 'canonical', plugin: 'enabled' },});- layer(TestLive({ commandRunner: wrongMarketplaceRunner }))('exact marketplace status', it => {- it.scoped('does not accept a same-named marketplace from the wrong repository', () =>+ layer(+ TestLive({+ commandRunner: autoBoth.runner,+ setupSkillInstaller: makeSkillInstaller(true),+ })+ )('automatic setup with both hosts', it => {+ it.scoped('selects both detected hosts', () =>Effect.gen(function* () {- yield* cli(['setup', 'status', '--json']);- const [line] = yield* MockConsole.getLines();- const status = JSON.parse(line ?? '{}') as {- targets?: Array<Record<string, unknown>>;- };- expect(status.targets?.find(item => item.target === 'claude')).toMatchObject({- marketplace_configured: false,- });+ yield* cli(['setup', '--target', 'auto', '--yes']);++ const output = (yield* MockConsole.getLines()).join('\n');+ expect(output).toContain('"target":"claude"');+ expect(output).toContain('"target":"codex"');}));});- const failingInstallRunner = makeRunner(parts => {- if (parts.join(' ') === 'claude --version') return { stdout: '2.1.0' };- if (parts.join(' ') === 'claude plugin marketplace list --json') return { stdout: '[]' };- if (parts.join(' ') === 'claude plugin list --json') return { stdout: '[]' };- if (parts.includes('install')) return { exitCode: 2, stderr: 'install failed' };- return {};+ const unavailable = makeFakeHosts({});+ layer(TestLive({ commandRunner: unavailable.runner }))('no supported host', it => {+ it.scoped('fails automatic setup', () =>+ Effect.gen(function* () {+ const exit = yield* Effect.exit(cli(['setup', '--target', 'auto', '--yes']));+ expect(Exit.isFailure(exit)).toBe(true);+ })+ );+ });++ const conflict = makeFakeHosts({+ claude: { available: true, marketplace: 'conflict' },});- layer(TestLive({ fixture: 'user-config-example', commandRunner: failingInstallRunner }))(- 'partial failure',+ layer(TestLive({ commandRunner: conflict.runner }))('marketplace source conflict', it => {+ it.scoped('fails safely instead of replacing the marketplace', () =>+ Effect.gen(function* () {+ const exit = yield* Effect.exit(cli(['setup', '--target', 'claude', '--yes']));+ expect(Exit.isFailure(exit)).toBe(true);+ expect(conflict.state.claude.marketplace).toBe('conflict');+ })+ );+ });++ const noOp = makeFakeHosts({ claude: { available: true } }, { noOp: true });+ layer(TestLive({ commandRunner: noOp.runner, setupSkillInstaller: makeSkillInstaller() }))(+ 'post-install verification',it => {- it.scoped('fails the command when a native plugin install fails', () =>+ it.scoped('fails when successful commands do not change native state', () =>Effect.gen(function* () {const exit = yield* Effect.exit(cli(['setup', '--target', 'claude', '--yes']));expect(Exit.isFailure(exit)).toBe(true);@@ -404,18 +325,29 @@ describe('CLI: composio setup', () => {});- const failingSkillInstaller = new SetupSkillInstaller({- isClaudeSkillInstalled: Effect.succeed(false),- ensureClaudeSkill: Effect.fail(new Error('skill download failed')),+ const failedInstall = makeFakeHosts(+ { claude: { available: true } },+ { failOn: 'plugin install' }+ );+ layer(TestLive({ commandRunner: failedInstall.runner }))('native install failure', it => {+ it.scoped('fails the command', () =>+ Effect.gen(function* () {+ const exit = yield* Effect.exit(cli(['setup', '--target', 'claude', '--yes']));+ expect(Exit.isFailure(exit)).toBe(true);+ })+ );+ });++ const skillFailure = makeFakeHosts({+ claude: { available: true, marketplace: 'canonical', plugin: 'enabled' },});layer(TestLive({- fixture: 'user-config-example',- commandRunner: humanRunner,- setupSkillInstaller: failingSkillInstaller,+ commandRunner: skillFailure.runner,+ setupSkillInstaller: makeSkillInstaller(false, true),})- )('skill failure', it => {- it.scoped('fails rather than reporting readiness when the required Claude skill fails', () =>+ )('skill install failure', it => {+ it.scoped('fails instead of reporting readiness', () =>Effect.gen(function* () {const exit = yield* Effect.exit(cli(['setup', '--target', 'claude', '--yes']));expect(Exit.isFailure(exit)).toBe(true);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 03190dec7..9afd09055 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,12 @@-import { writeFileSync } from 'node:fs';+import { mkdirSync, writeFileSync } from 'node:fs';import path from 'node:path';import { describe, expect, it } from 'vitest';import * as tempy from 'tempy';-import { resolveSetupSkillReleaseTag } from 'src/services/setup-skill-installer';+import { SKILL_RELEASE_TAG_FILENAME } from 'src/effects/install-skill';+import {+ isClaudeSkillCurrent,+ resolveSetupSkillReleaseTag,+} from 'src/services/setup-skill-installer';describe('SetupSkillInstaller', () => {it('uses the packaged CLI release tag', () => {@@ -20,4 +24,26 @@ describe('SetupSkillInstaller', () => {'@composio/[email protected]');});++ it('only accepts a Claude skill installed from the running CLI release', () => {+ const home = tempy.temporaryDirectory();+ const target = path.join(home, '.claude', 'skills', 'composio-cli');+ const skillDir = path.join(home, '.agents', 'skills', 'composio-cli');+ mkdirSync(target, { recursive: true });+ mkdirSync(skillDir, { recursive: true });+ writeFileSync(+ path.join(skillDir, SKILL_RELEASE_TAG_FILENAME),+ '@composio/[email protected]\n'+ );++ expect(isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(true);+ expect(isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);+ });++ it('treats an unversioned existing Claude skill as stale', () => {+ const home = tempy.temporaryDirectory();+ mkdirSync(path.join(home, '.claude', 'skills', 'composio-cli'), { recursive: true });++ expect(isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);+ });});