Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 18:30 UTC
fix(cli): harden plugin setup installation
Kshitij Jhunjhunwala committed
Jul 13, 2026 at 15:19 UTC
d583e7ef6f3c964413308917fca539eff1c69cf2
8 files changed
+222
-13
.changeset/cli-setup-agent-plugins.md
deleted
-5
@@ -1,5 +0,0 @@
1
----
2
-'@composio/cli': minor
3
----
4
-
5
-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.
docs/content/docs/claude-code-plugin.mdx
+6
-1
@@ -28,6 +28,11 @@ If the CLI is not already installed, run:
28
29
```bash
30
curl -fsSL https://composio.dev/install | bash
31
+```
32
+
33
+The installer adds `composio` to your `PATH`. Open a new terminal, or source the shell profile printed by the installer, before continuing:
34
+
35
+```bash
36
composio login
37
composio setup --target claude
38
```
@@ -56,7 +61,7 @@ If you need to register the plugin directly in Claude Code, add the marketplace:
61
In Claude Code, run:
62
63
```text
59
-/plugin marketplace add ComposioHQ/composio-plugin-cc
64
+/plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git
65
```
66
67
This adds Composio's GitHub-hosted marketplace. It does not install the plugin yet.
pnpm-lock.yaml
+6
@@ -199,6 +199,12 @@ importers:
199
specifier: 'catalog:'
200
version: 6.0.3
201
202
+ ts/e2e-tests/cli/setup-plugins:
203
+ devDependencies:
204
+ '@e2e-tests/utils':
205
+ specifier: workspace:*
206
+ version: link:../../_utils
207
+
208
ts/e2e-tests/cli/toolkits/info:
209
devDependencies:
210
'@e2e-tests/utils':
ts/e2e-tests/cli/setup-plugins/e2e.test.ts
new
+122
@@ -0,0 +1,122 @@
1
+/**
2
+ * CLI plugin setup end-to-end tests.
3
+ *
4
+ * Runs the compiled standalone binary with HOME=/tmp in fresh Debian
5
+ * containers. The host executables implement the native Claude Code and Codex
6
+ * JSON contracts while recording every command for exact invocation checks.
7
+ */
8
+
9
+import { e2e, type E2ETestResult, type E2ETestResultWithFiles } from '@e2e-tests/utils';
10
+import { TIMEOUTS } from '@e2e-tests/utils/const';
11
+import { beforeAll, describe, expect, it } from 'bun:test';
12
+
13
+const setupFixture = (host: 'claude' | 'codex') => `
14
+set -eu
15
+mkdir -p /tmp/bin /tmp/host-state
16
+cp fixtures/fake-agent-host.sh /tmp/bin/${host}
17
+chmod +x /tmp/bin/${host}
18
+${host === 'claude' ? 'mkdir -p /tmp/.claude/skills/composio-cli' : ''}
19
+export HOST_STATE_DIR=/tmp/host-state
20
+export PATH=/tmp/bin:$PATH
21
+composio setup --target ${host} --yes > first.json
22
+composio setup --target ${host} --yes > second.json
23
+composio setup status --json > status.json
24
+cp /tmp/host-state/commands.log commands.log
25
+`;
26
+
27
+e2e(import.meta.url, {
28
+ versions: {
29
+ cli: ['current'],
30
+ },
31
+ defineTests: ({ runCmd }) => {
32
+ let claude: E2ETestResultWithFiles<
33
+ 'first.json' | 'second.json' | 'status.json' | 'commands.log'
34
+ >;
35
+ let codex: E2ETestResultWithFiles<
36
+ 'first.json' | 'second.json' | 'status.json' | 'commands.log'
37
+ >;
38
+ let unavailable: E2ETestResult;
39
+
40
+ beforeAll(async () => {
41
+ // The shared E2E runner derives container names from Date.now(), so keep
42
+ // these fresh-container cases sequential to avoid same-millisecond names.
43
+ claude = await runCmd({
44
+ command: setupFixture('claude'),
45
+ files: ['first.json', 'second.json', 'status.json', 'commands.log'],
46
+ });
47
+ codex = await runCmd({
48
+ command: setupFixture('codex'),
49
+ files: ['first.json', 'second.json', 'status.json', 'commands.log'],
50
+ });
51
+ unavailable = await runCmd('composio setup --target auto --yes');
52
+ }, TIMEOUTS.FIXTURE);
53
+
54
+ describe.each([
55
+ {
56
+ host: 'claude' as const,
57
+ result: () => claude,
58
+ marketplaceCommand:
59
+ 'claude plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git --scope user',
60
+ installCommand: 'claude plugin install composio@composio --scope user',
61
+ },
62
+ {
63
+ host: 'codex' as const,
64
+ result: () => codex,
65
+ marketplaceCommand:
66
+ 'codex plugin marketplace add https://github.com/ComposioHQ/composio-plugin-openai.git --json',
67
+ installCommand: 'codex plugin add composio@composio --json',
68
+ },
69
+ ])('$host setup', ({ host, result, marketplaceCommand, installCommand }) => {
70
+ it('installs once, is idempotent, and reports ready status', () => {
71
+ const execution = result();
72
+ expect(execution.exitCode).toBe(0);
73
+ expect(execution.stdout).toBe('');
74
+ expect(execution.stderr).toBe('');
75
+
76
+ const first = JSON.parse(execution.files['first.json']) as {
77
+ success: boolean;
78
+ targets: Array<{ target: string; changed: boolean; cli_skill_ready: boolean }>;
79
+ };
80
+ const second = JSON.parse(execution.files['second.json']) as typeof first;
81
+ const status = JSON.parse(execution.files['status.json']) as {
82
+ targets: Array<{
83
+ target: string;
84
+ available: boolean;
85
+ marketplace_configured: boolean;
86
+ plugin_installed: boolean;
87
+ plugin_enabled: boolean;
88
+ cli_skill_ready: boolean;
89
+ }>;
90
+ };
91
+
92
+ expect(first.success).toBe(true);
93
+ expect(first.targets).toContainEqual(
94
+ expect.objectContaining({ target: host, changed: true, cli_skill_ready: true })
95
+ );
96
+ expect(second.targets).toContainEqual(
97
+ expect.objectContaining({ target: host, changed: false, cli_skill_ready: true })
98
+ );
99
+ expect(status.targets).toContainEqual({
100
+ target: host,
101
+ available: true,
102
+ marketplace_configured: true,
103
+ plugin_installed: true,
104
+ plugin_enabled: true,
105
+ cli_skill_ready: true,
106
+ });
107
+
108
+ const commands = execution.files['commands.log'].trim().split('\n');
109
+ expect(commands.filter(command => command === marketplaceCommand)).toHaveLength(1);
110
+ expect(commands.filter(command => command === installCommand)).toHaveLength(1);
111
+ });
112
+ });
113
+
114
+ describe('automatic host detection', () => {
115
+ it('fails clearly when neither supported host is installed', () => {
116
+ expect(unavailable.exitCode).not.toBe(0);
117
+ expect(unavailable.stdout).toBe('');
118
+ expect(unavailable.stderr).toContain('No supported agent host was detected');
119
+ });
120
+ });
121
+ },
122
+});
ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh
new
+65
@@ -0,0 +1,65 @@
1
+#!/bin/sh
2
+set -eu
3
+
4
+state_dir="${HOST_STATE_DIR:?HOST_STATE_DIR is required}"
5
+host="$(basename "$0")"
6
+command="$*"
7
+
8
+mkdir -p "$state_dir"
9
+printf '%s %s\n' "$host" "$command" >> "$state_dir/commands.log"
10
+
11
+case "$host:$command" in
12
+ "claude:--version")
13
+ printf '%s\n' '2.1.207 (Claude Code)'
14
+ ;;
15
+ "claude:plugin marketplace list --json")
16
+ if [ -f "$state_dir/claude-marketplace" ]; then
17
+ printf '%s\n' '[{"name":"composio","source":"git","url":"https://github.com/ComposioHQ/composio-plugin-cc.git"}]'
18
+ else
19
+ printf '%s\n' '[]'
20
+ fi
21
+ ;;
22
+ "claude:plugin list --json")
23
+ if [ -f "$state_dir/claude-plugin" ]; then
24
+ printf '%s\n' '[{"id":"composio@composio","installed":true,"enabled":true}]'
25
+ else
26
+ printf '%s\n' '[]'
27
+ fi
28
+ ;;
29
+ "claude:plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git --scope user")
30
+ touch "$state_dir/claude-marketplace"
31
+ ;;
32
+ "claude:plugin install composio@composio --scope user")
33
+ touch "$state_dir/claude-plugin"
34
+ ;;
35
+ "claude:plugin enable composio@composio")
36
+ touch "$state_dir/claude-plugin"
37
+ ;;
38
+ "codex:--version")
39
+ printf '%s\n' 'codex-cli 0.144.1'
40
+ ;;
41
+ "codex:plugin marketplace list --json")
42
+ if [ -f "$state_dir/codex-marketplace" ]; then
43
+ printf '%s\n' '{"marketplaces":[{"name":"composio","marketplaceSource":{"sourceType":"git","source":"ComposioHQ/composio-plugin-openai"}}]}'
44
+ else
45
+ printf '%s\n' '{"marketplaces":[]}'
46
+ fi
47
+ ;;
48
+ "codex:plugin list --json")
49
+ if [ -f "$state_dir/codex-plugin" ]; then
50
+ printf '%s\n' '{"installed":[{"pluginId":"composio@composio","installed":true,"enabled":true}]}'
51
+ else
52
+ printf '%s\n' '{"installed":[],"available":[]}'
53
+ fi
54
+ ;;
55
+ "codex:plugin marketplace add https://github.com/ComposioHQ/composio-plugin-openai.git --json")
56
+ touch "$state_dir/codex-marketplace"
57
+ ;;
58
+ "codex:plugin add composio@composio --json")
59
+ touch "$state_dir/codex-plugin"
60
+ ;;
61
+ *)
62
+ printf 'Unexpected fake host command: %s %s\n' "$host" "$command" >&2
63
+ exit 64
64
+ ;;
65
+esac
ts/e2e-tests/cli/setup-plugins/package.json
new
+14
@@ -0,0 +1,14 @@
1
+{
2
+ "name": "@e2e-tests/cli-setup-plugins",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "typecheck": "tsc --noEmit",
8
+ "test:e2e": "bun test e2e.test.ts",
9
+ "test:e2e:cli": "bun test e2e.test.ts"
10
+ },
11
+ "devDependencies": {
12
+ "@e2e-tests/utils": "workspace:*"
13
+ }
14
+}
ts/packages/cli/src/services/setup.ts
+4
-3
@@ -9,13 +9,13 @@ export type AgentHost = Exclude<SetupTarget, 'auto' | 'all'>;
9
10
export const CLAUDE_PLUGIN_MARKETPLACE = {
11
name: 'composio',
12
- source: 'ComposioHQ/composio-plugin-cc',
12
+ source: 'https://github.com/ComposioHQ/composio-plugin-cc.git',
13
plugin: 'composio@composio',
14
} as const;
15
16
export const CODEX_PLUGIN_MARKETPLACE = {
17
name: 'composio',
18
- source: 'ComposioHQ/composio-plugin-openai',
18
+ source: 'https://github.com/ComposioHQ/composio-plugin-openai.git',
19
plugin: 'composio@composio',
20
} as const;
21
@@ -132,6 +132,7 @@ const marketplaceIsConfigured = (adapter: SetupTargetAdapter, output: string): b
132
const records = recordsFrom(parsed, adapter.target === 'codex' ? 'marketplaces' : undefined);
133
return records.some(record => {
134
const repo = typeof record.repo === 'string' ? record.repo : undefined;
135
+ const url = typeof record.url === 'string' ? record.url : undefined;
136
const nestedSource = asRecord(record.source);
137
const marketplaceSource = asRecord(record.marketplaceSource);
138
const source =
@@ -140,7 +141,7 @@ const marketplaceIsConfigured = (adapter: SetupTargetAdapter, output: string): b
141
(typeof nestedSource?.source === 'string' ? nestedSource.source : undefined) ??
142
(typeof marketplaceSource?.source === 'string' ? marketplaceSource.source : undefined);
143
const expected = normalizeGitHubRepository(adapter.marketplace.source);
143
- return [repo, source].some(
144
+ return [repo, url, source].some(
145
candidate =>
146
typeof candidate === 'string' && normalizeGitHubRepository(candidate) === expected
147
);
ts/packages/cli/test/src/commands/setup.cmd.test.ts
+5
-4
@@ -67,7 +67,7 @@ describe('CLI: composio setup', () => {
67
'plugin',
68
'marketplace',
69
'add',
70
- 'ComposioHQ/composio-plugin-cc',
70
+ 'https://github.com/ComposioHQ/composio-plugin-cc.git',
71
'--scope',
72
'user',
73
]);
@@ -130,7 +130,7 @@ describe('CLI: composio setup', () => {
130
'plugin',
131
'marketplace',
132
'add',
133
- 'ComposioHQ/composio-plugin-openai',
133
+ 'https://github.com/ComposioHQ/composio-plugin-openai.git',
134
'--json',
135
]);
136
expect(codexCommands).not.toContainEqual([
@@ -162,7 +162,8 @@ describe('CLI: composio setup', () => {
162
stdout: JSON.stringify([
163
{
164
name: 'composio',
165
- source: { source: 'github', repo: 'ComposioHQ/composio-plugin-cc' },
165
+ source: 'git',
166
+ url: 'https://github.com/ComposioHQ/composio-plugin-cc.git',
167
},
168
]),
169
};
@@ -319,7 +320,7 @@ describe('CLI: composio setup', () => {
320
'plugin',
321
'marketplace',
322
'add',
322
- 'ComposioHQ/composio-plugin-openai',
323
+ 'https://github.com/ComposioHQ/composio-plugin-openai.git',
324
'--json',
325
]);
326
expect(codexFreshCommands).toContainEqual([