Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(cli): harden plugin setup installation

Kshitij Jhunjhunwalad583e7ef6f3c
diff --git a/.changeset/cli-setup-agent-plugins.md b/.changeset/cli-setup-agent-plugins.md
deleted file mode 100644
index 21b061417..000000000
--- a/.changeset/cli-setup-agent-plugins.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@composio/cli': minor
----
-
-Add `composio setup` to idempotently install and enable the Composio marketplace and plugin for Claude Code and Codex. Claude setup also installs the matching standalone CLI skill; the Codex plugin bundles it.
diff --git a/docs/content/docs/claude-code-plugin.mdx b/docs/content/docs/claude-code-plugin.mdx
index 546b0cd18..227d86170 100644
--- a/docs/content/docs/claude-code-plugin.mdx
+++ b/docs/content/docs/claude-code-plugin.mdx
@@ -28,6 +28,11 @@ If the CLI is not already installed, run:
```bash
curl -fsSL https://composio.dev/install | bash
+```
+
+The installer adds `composio` to your `PATH`. Open a new terminal, or source the shell profile printed by the installer, before continuing:
+
+```bash
composio login
composio setup --target claude
```
@@ -56,7 +61,7 @@ If you need to register the plugin directly in Claude Code, add the marketplace:
In Claude Code, run:
```text
-/plugin marketplace add ComposioHQ/composio-plugin-cc
+/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.
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0bceb4359..423ab61b8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -199,6 +199,12 @@ importers:
specifier: 'catalog:'
version: 6.0.3
+ ts/e2e-tests/cli/setup-plugins:
+ devDependencies:
+ '@e2e-tests/utils':
+ specifier: workspace:*
+ version: link:../../_utils
+
ts/e2e-tests/cli/toolkits/info:
devDependencies:
'@e2e-tests/utils':
diff --git a/ts/e2e-tests/cli/setup-plugins/e2e.test.ts b/ts/e2e-tests/cli/setup-plugins/e2e.test.ts
new file mode 100644
index 000000000..91e6dc442
--- /dev/null
+++ b/ts/e2e-tests/cli/setup-plugins/e2e.test.ts
@@ -0,0 +1,122 @@
+/**
+ * CLI plugin setup end-to-end tests.
+ *
+ * Runs the compiled standalone binary with HOME=/tmp in fresh Debian
+ * containers. The host executables implement the native Claude Code and Codex
+ * JSON contracts while recording every command for exact invocation checks.
+ */
+
+import { e2e, type E2ETestResult, type E2ETestResultWithFiles } from '@e2e-tests/utils';
+import { TIMEOUTS } from '@e2e-tests/utils/const';
+import { beforeAll, describe, expect, it } from 'bun:test';
+
+const setupFixture = (host: 'claude' | 'codex') => `
+set -eu
+mkdir -p /tmp/bin /tmp/host-state
+cp fixtures/fake-agent-host.sh /tmp/bin/${host}
+chmod +x /tmp/bin/${host}
+${host === 'claude' ? 'mkdir -p /tmp/.claude/skills/composio-cli' : ''}
+export HOST_STATE_DIR=/tmp/host-state
+export PATH=/tmp/bin:$PATH
+composio setup --target ${host} --yes > first.json
+composio setup --target ${host} --yes > second.json
+composio setup status --json > status.json
+cp /tmp/host-state/commands.log commands.log
+`;
+
+e2e(import.meta.url, {
+ versions: {
+ 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 unavailable: E2ETestResult;
+
+ beforeAll(async () => {
+ // The shared E2E runner derives container names from Date.now(), so keep
+ // 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'],
+ });
+ codex = await runCmd({
+ command: setupFixture('codex'),
+ files: ['first.json', 'second.json', 'status.json', 'commands.log'],
+ });
+ unavailable = await runCmd('composio setup --target auto --yes');
+ }, TIMEOUTS.FIXTURE);
+
+ describe.each([
+ {
+ host: 'claude' as const,
+ result: () => claude,
+ marketplaceCommand:
+ 'claude plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git --scope user',
+ installCommand: 'claude plugin install composio@composio --scope user',
+ },
+ {
+ host: 'codex' as const,
+ result: () => codex,
+ marketplaceCommand:
+ 'codex plugin marketplace add https://github.com/ComposioHQ/composio-plugin-openai.git --json',
+ installCommand: 'codex plugin add composio@composio --json',
+ },
+ ])('$host setup', ({ host, result, marketplaceCommand, installCommand }) => {
+ it('installs once, is idempotent, and reports ready status', () => {
+ const execution = result();
+ expect(execution.exitCode).toBe(0);
+ expect(execution.stdout).toBe('');
+ expect(execution.stderr).toBe('');
+
+ const first = JSON.parse(execution.files['first.json']) as {
+ success: boolean;
+ 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 })
+ );
+ 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);
+ });
+ });
+
+ describe('automatic host detection', () => {
+ it('fails clearly when neither supported host is installed', () => {
+ expect(unavailable.exitCode).not.toBe(0);
+ expect(unavailable.stdout).toBe('');
+ expect(unavailable.stderr).toContain('No supported agent host was detected');
+ });
+ });
+ },
+});
diff --git a/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh b/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh
new file mode 100644
index 000000000..93936a454
--- /dev/null
+++ b/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+set -eu
+
+state_dir="${HOST_STATE_DIR:?HOST_STATE_DIR is required}"
+host="$(basename "$0")"
+command="$*"
+
+mkdir -p "$state_dir"
+printf '%s %s\n' "$host" "$command" >> "$state_dir/commands.log"
+
+case "$host:$command" in
+ "claude:--version")
+ printf '%s\n' '2.1.207 (Claude Code)'
+ ;;
+ "claude:plugin marketplace list --json")
+ if [ -f "$state_dir/claude-marketplace" ]; then
+ printf '%s\n' '[{"name":"composio","source":"git","url":"https://github.com/ComposioHQ/composio-plugin-cc.git"}]'
+ else
+ printf '%s\n' '[]'
+ fi
+ ;;
+ "claude:plugin list --json")
+ if [ -f "$state_dir/claude-plugin" ]; then
+ printf '%s\n' '[{"id":"composio@composio","installed":true,"enabled":true}]'
+ else
+ printf '%s\n' '[]'
+ fi
+ ;;
+ "claude:plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git --scope user")
+ touch "$state_dir/claude-marketplace"
+ ;;
+ "claude:plugin install composio@composio --scope user")
+ touch "$state_dir/claude-plugin"
+ ;;
+ "claude:plugin enable composio@composio")
+ touch "$state_dir/claude-plugin"
+ ;;
+ "codex:--version")
+ printf '%s\n' 'codex-cli 0.144.1'
+ ;;
+ "codex:plugin marketplace list --json")
+ if [ -f "$state_dir/codex-marketplace" ]; then
+ printf '%s\n' '{"marketplaces":[{"name":"composio","marketplaceSource":{"sourceType":"git","source":"ComposioHQ/composio-plugin-openai"}}]}'
+ else
+ printf '%s\n' '{"marketplaces":[]}'
+ fi
+ ;;
+ "codex:plugin list --json")
+ if [ -f "$state_dir/codex-plugin" ]; then
+ printf '%s\n' '{"installed":[{"pluginId":"composio@composio","installed":true,"enabled":true}]}'
+ else
+ printf '%s\n' '{"installed":[],"available":[]}'
+ fi
+ ;;
+ "codex:plugin marketplace add https://github.com/ComposioHQ/composio-plugin-openai.git --json")
+ touch "$state_dir/codex-marketplace"
+ ;;
+ "codex:plugin add composio@composio --json")
+ touch "$state_dir/codex-plugin"
+ ;;
+ *)
+ printf 'Unexpected fake host command: %s %s\n' "$host" "$command" >&2
+ exit 64
+ ;;
+esac
diff --git a/ts/e2e-tests/cli/setup-plugins/package.json b/ts/e2e-tests/cli/setup-plugins/package.json
new file mode 100644
index 000000000..3ca646d0a
--- /dev/null
+++ b/ts/e2e-tests/cli/setup-plugins/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@e2e-tests/cli-setup-plugins",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "typecheck": "tsc --noEmit",
+ "test:e2e": "bun test e2e.test.ts",
+ "test:e2e:cli": "bun test e2e.test.ts"
+ },
+ "devDependencies": {
+ "@e2e-tests/utils": "workspace:*"
+ }
+}
diff --git a/ts/packages/cli/src/services/setup.ts b/ts/packages/cli/src/services/setup.ts
index f6d1db186..6958834a1 100644
--- a/ts/packages/cli/src/services/setup.ts
+++ b/ts/packages/cli/src/services/setup.ts
@@ -9,13 +9,13 @@ export type AgentHost = Exclude<SetupTarget, 'auto' | 'all'>;
export const CLAUDE_PLUGIN_MARKETPLACE = {
name: 'composio',
- source: 'ComposioHQ/composio-plugin-cc',
+ source: 'https://github.com/ComposioHQ/composio-plugin-cc.git',
plugin: 'composio@composio',
} as const;
export const CODEX_PLUGIN_MARKETPLACE = {
name: 'composio',
- source: 'ComposioHQ/composio-plugin-openai',
+ source: 'https://github.com/ComposioHQ/composio-plugin-openai.git',
plugin: 'composio@composio',
} as const;
@@ -132,6 +132,7 @@ const marketplaceIsConfigured = (adapter: SetupTargetAdapter, output: string): b
const records = recordsFrom(parsed, adapter.target === 'codex' ? 'marketplaces' : undefined);
return records.some(record => {
const repo = typeof record.repo === 'string' ? record.repo : undefined;
+ const url = typeof record.url === 'string' ? record.url : undefined;
const nestedSource = asRecord(record.source);
const marketplaceSource = asRecord(record.marketplaceSource);
const source =
@@ -140,7 +141,7 @@ const marketplaceIsConfigured = (adapter: SetupTargetAdapter, output: string): b
(typeof nestedSource?.source === 'string' ? nestedSource.source : undefined) ??
(typeof marketplaceSource?.source === 'string' ? marketplaceSource.source : undefined);
const expected = normalizeGitHubRepository(adapter.marketplace.source);
- return [repo, source].some(
+ return [repo, url, source].some(
candidate =>
typeof candidate === 'string' && normalizeGitHubRepository(candidate) === expected
);
diff --git a/ts/packages/cli/test/src/commands/setup.cmd.test.ts b/ts/packages/cli/test/src/commands/setup.cmd.test.ts
index 9769d14ea..36e507e51 100644
--- a/ts/packages/cli/test/src/commands/setup.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/setup.cmd.test.ts
@@ -67,7 +67,7 @@ describe('CLI: composio setup', () => {
'plugin',
'marketplace',
'add',
- 'ComposioHQ/composio-plugin-cc',
+ 'https://github.com/ComposioHQ/composio-plugin-cc.git',
'--scope',
'user',
]);
@@ -130,7 +130,7 @@ describe('CLI: composio setup', () => {
'plugin',
'marketplace',
'add',
- 'ComposioHQ/composio-plugin-openai',
+ 'https://github.com/ComposioHQ/composio-plugin-openai.git',
'--json',
]);
expect(codexCommands).not.toContainEqual([
@@ -162,7 +162,8 @@ describe('CLI: composio setup', () => {
stdout: JSON.stringify([
{
name: 'composio',
- source: { source: 'github', repo: 'ComposioHQ/composio-plugin-cc' },
+ source: 'git',
+ url: 'https://github.com/ComposioHQ/composio-plugin-cc.git',
},
]),
};
@@ -319,7 +320,7 @@ describe('CLI: composio setup', () => {
'plugin',
'marketplace',
'add',
- 'ComposioHQ/composio-plugin-openai',
+ 'https://github.com/ComposioHQ/composio-plugin-openai.git',
'--json',
]);
expect(codexFreshCommands).toContainEqual([