@devries-cameron20 / composio Mirror · read-only / commits / fb5e97749
Fork 0

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

feat(cli): install detected agent plugins

Kshitij Jhunjhunwala committed Jul 14, 2026 at 10:50 UTC fb5e97749d6eb04c8e83488d3d30603c8523a875
7 files changed +169 -49
install.sh
+24 -3
@@ -75,17 +75,30 @@ command -v curl >/dev/null || error 'curl is required to install Composio CLI'
75 command -v unzip >/dev/null || error 'unzip is required to install Composio CLI'
76
77 install_agent=false
78 +install_plugins=true
79 version_arg=""
80
81 +case "${COMPOSIO_INSTALL_PLUGINS:-1}" in
82 +1) ;;
83 +0) install_plugins=false ;;
84 +*) error 'COMPOSIO_INSTALL_PLUGINS must be 1 or 0' ;;
85 +esac
86 +
87 while [[ $# -gt 0 ]]; do
88 case "$1" in
89 --agent)
90 install_agent=true
91 shift
92 ;;
93 + --no-plugins)
94 + install_plugins=false
95 + shift
96 + ;;
97 -h|--help)
87 - echo 'Usage: install.sh [--agent] [version-tag] (e.g. "@composio/cli@0.1.32")'
88 - echo ' --agent After installing, sign up/log in as a Composio agent.'
98 + echo 'Usage: install.sh [--agent] [--no-plugins] [version-tag] (e.g. "@composio/cli@0.1.32")'
99 + echo ' --agent After installing, sign up/log in as a Composio agent.'
100 + echo ' --no-plugins Skip installing plugins for detected agent hosts.'
101 + echo ' Set COMPOSIO_INSTALL_PLUGINS=0 to skip plugin installation in automation.'
102 exit 0
103 ;;
104 --*)
@@ -93,7 +106,7 @@ while [[ $# -gt 0 ]]; do
106 ;;
107 *)
108 if [[ -n "$version_arg" ]]; then
96 - error 'Too many arguments. Usage: install.sh [--agent] [version-tag] (e.g. "@composio/cli@0.1.32")'
109 + error 'Too many arguments. Usage: install.sh [--agent] [--no-plugins] [version-tag] (e.g. "@composio/cli@0.1.32")'
110 fi
111 version_arg=$1
112 shift
@@ -391,6 +404,14 @@ else
404 fi
405 rm -f "$install_err"
406
407 +if [[ $install_plugins = true ]]; then
408 + echo
409 + info "Checking for supported agent hosts..."
410 + if ! "$exe" setup --target auto --yes --if-present; then
411 + error 'Composio CLI was installed, but agent plugin setup failed. Retry with `composio setup --target auto --yes`.'
412 + fi
413 +fi
414 +
415 if [[ $install_agent = true ]]; then
416 echo
417 info "Setting up Composio agent login..."
test/install-sh-release-resolution.test.sh
+73 -11
@@ -29,6 +29,7 @@ api_base='https://api.example.test'
29 archive_url="https://downloads.example.test/$valid_tag/$archive_name"
30 curl_log="$tmpdir/curl.log"
31 git_log="$tmpdir/git.log"
32 +composio_log="$tmpdir/composio.log"
33
34 cat > "$bin_dir/curl" <<'EOF'
35 #!/usr/bin/env bash
@@ -144,10 +145,17 @@ fi
145 mkdir -p "$dest"
146 cat > "$dest/composio" <<'BIN'
147 #!/usr/bin/env bash
148 +set -euo pipefail
149 +
150 +printf '%s\n' "$*" >> "$TEST_COMPOSIO_LOG"
151 +
152 case "${1:-}" in
153 install)
154 exit 0
155 ;;
156 +setup)
157 + exit "${TEST_SETUP_EXIT:-0}"
158 + ;;
159 --version|version)
160 echo 'composio fake 98.0.0'
161 exit 0
@@ -172,6 +180,7 @@ chmod +x "$bin_dir/git"
180
181 export TEST_CURL_LOG="$curl_log"
182 export TEST_GIT_LOG="$git_log"
183 +export TEST_COMPOSIO_LOG="$composio_log"
184 export TEST_API_BASE="$api_base"
185 export TEST_ARCHIVE_NAME="$archive_name"
186 export TEST_ARCHIVE_URL="$archive_url"
@@ -179,16 +188,26 @@ export TEST_VALID_TAG="$valid_tag"
188 export TEST_MISSING_ASSET_TAG="$missing_asset_tag"
189 export TEST_TAG_WITHOUT_RELEASE="$tag_without_release"
190
182 -output=$(env \
183 - PATH="$bin_dir:$PATH" \
184 - HOME="$home_dir" \
185 - SHELL="/bin/bash" \
186 - COMPOSIO_INSTALL_DIR="$install_dir" \
187 - COMPOSIO_GITHUB_URL='https://github.example.test' \
188 - COMPOSIO_GITHUB_API_BASE_URL="$api_base" \
189 - COMPOSIO_GITHUB_OWNER='FakeOwner' \
190 - COMPOSIO_GITHUB_REPO='fake-repo' \
191 - bash "$repo_root/install.sh" 2>&1)
191 +run_installer() {
192 + local test_home="$1"
193 + local test_install_dir="$2"
194 + shift 2
195 +
196 + env \
197 + PATH="$bin_dir:$PATH" \
198 + HOME="$test_home" \
199 + SHELL="/bin/bash" \
200 + COMPOSIO_INSTALL_DIR="$test_install_dir" \
201 + COMPOSIO_INSTALL_PLUGINS="${COMPOSIO_INSTALL_PLUGINS:-1}" \
202 + COMPOSIO_GITHUB_URL='https://github.example.test' \
203 + COMPOSIO_GITHUB_API_BASE_URL="$api_base" \
204 + COMPOSIO_GITHUB_OWNER='FakeOwner' \
205 + COMPOSIO_GITHUB_REPO='fake-repo' \
206 + TEST_SETUP_EXIT="${TEST_SETUP_EXIT:-0}" \
207 + bash "$repo_root/install.sh" "$@"
208 +}
209 +
210 +output=$(run_installer "$home_dir" "$install_dir" 2>&1)
211
212 printf '%s\n' "$output"
213
@@ -224,4 +243,47 @@ if grep -q "$tag_without_release" "$curl_log"; then
243 exit 1
244 fi
245
227 -printf 'install.sh release fallback test passed\n'
246 +expected_setup='setup --target auto --yes --if-present'
247 +if ! grep -qxF "$expected_setup" "$composio_log"; then
248 + echo "Expected installer to invoke: composio $expected_setup" >&2
249 + cat "$composio_log" >&2
250 + exit 1
251 +fi
252 +
253 +no_plugins_home="$tmpdir/home-no-plugins"
254 +no_plugins_install="$tmpdir/install-no-plugins"
255 +mkdir -p "$no_plugins_home" "$no_plugins_install"
256 +: > "$composio_log"
257 +run_installer "$no_plugins_home" "$no_plugins_install" --no-plugins >/dev/null 2>&1
258 +if grep -q '^setup ' "$composio_log"; then
259 + echo 'Expected --no-plugins to skip agent plugin setup.' >&2
260 + cat "$composio_log" >&2
261 + exit 1
262 +fi
263 +
264 +env_opt_out_home="$tmpdir/home-env-opt-out"
265 +env_opt_out_install="$tmpdir/install-env-opt-out"
266 +mkdir -p "$env_opt_out_home" "$env_opt_out_install"
267 +: > "$composio_log"
268 +COMPOSIO_INSTALL_PLUGINS=0 run_installer "$env_opt_out_home" "$env_opt_out_install" >/dev/null 2>&1
269 +if grep -q '^setup ' "$composio_log"; then
270 + echo 'Expected COMPOSIO_INSTALL_PLUGINS=0 to skip agent plugin setup.' >&2
271 + cat "$composio_log" >&2
272 + exit 1
273 +fi
274 +
275 +failed_setup_home="$tmpdir/home-failed-setup"
276 +failed_setup_install="$tmpdir/install-failed-setup"
277 +mkdir -p "$failed_setup_home" "$failed_setup_install"
278 +: > "$composio_log"
279 +if failed_output=$(TEST_SETUP_EXIT=23 run_installer "$failed_setup_home" "$failed_setup_install" 2>&1); then
280 + echo 'Expected installer to fail when detected agent plugin setup fails.' >&2
281 + exit 1
282 +fi
283 +if ! grep -q 'Composio CLI was installed, but agent plugin setup failed' <<<"$failed_output"; then
284 + echo 'Expected installer to explain how to retry failed plugin setup.' >&2
285 + printf '%s\n' "$failed_output" >&2
286 + exit 1
287 +fi
288 +
289 +printf 'install.sh release fallback and plugin setup tests passed\n'
ts/e2e-tests/cli/setup-plugins/e2e.test.ts
+8
@@ -48,6 +48,7 @@ e2e(import.meta.url, {
48 let claude: E2ETestResultWithFiles<'first-run.log' | 'second-run.log'>;
49 let codex: E2ETestResultWithFiles<'first-run.log' | 'second-run.log'>;
50 let unavailable: E2ETestResult;
51 + let skippedUnavailable: E2ETestResult;
52
53 beforeAll(async () => {
54 // The shared E2E runner derives container names from Date.now(), so keep
@@ -61,6 +62,7 @@ e2e(import.meta.url, {
62 files: ['first-run.log', 'second-run.log'],
63 });
64 unavailable = await runCmd('composio setup --target auto --yes');
65 + skippedUnavailable = await runCmd('composio setup --target auto --yes --if-present');
66 }, TIMEOUTS.FIXTURE);
67
68 describe.each([
@@ -116,6 +118,12 @@ e2e(import.meta.url, {
118 expect(unavailable.stdout).toBe('');
119 expect(unavailable.stderr).toContain('No supported agent host was detected');
120 });
121 +
122 + it('can skip cleanly when invoked by an installer', () => {
123 + expect(skippedUnavailable.exitCode).toBe(0);
124 + expect(skippedUnavailable.stdout).toBe('');
125 + expect(skippedUnavailable.stderr).toBe('');
126 + });
127 });
128 },
129 });
ts/packages/cli/src/commands/root-help.ts
+5 -1
@@ -874,7 +874,7 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
874 description: 'Display your account information.',
875 },
876 setup: {
877 - usage: 'composio setup [--target auto|claude|codex|all] [--yes]',
877 + usage: 'composio setup [--target auto|claude|codex|all] [--yes] [--if-present]',
878 description: 'Install plugins for supported agent hosts.',
879 examples: [
880 'composio setup',
@@ -884,6 +884,10 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
884 options: [
885 { name: '--target <target>', description: 'auto, claude, codex, or all' },
886 { name: '-y, --yes', description: 'Accept setup changes without prompting' },
887 + {
888 + name: '--if-present',
889 + description: 'Exit successfully when automatic detection finds no supported host',
890 + },
891 ],
892 },
893 version: {
ts/packages/cli/src/commands/setup.cmd.ts
+45 -33
@@ -20,47 +20,59 @@ const yes = Options.boolean('yes').pipe(
20 Options.withDescription('Accept setup changes without prompting')
21 );
22
23 -const setupBaseCmd = Command.make('setup', { target, yes }, ({ target, yes }) =>
24 - Effect.gen(function* () {
25 - const ui = yield* TerminalUI;
26 - yield* ui.intro('composio setup');
23 +const ifPresent = Options.boolean('if-present').pipe(
24 + Options.withDefault(false),
25 + Options.withDescription('Exit successfully when automatic detection finds no supported host')
26 +);
27
28 - if (!yes && !isInteractiveTerminal()) {
29 - return yield* Effect.fail(
30 - new Error('Non-interactive setup requires `--yes` to approve local changes.')
31 - );
32 - }
28 +const setupBaseCmd = Command.make(
29 + 'setup',
30 + { target, yes, ifPresent },
31 + ({ target, yes, ifPresent }) =>
32 + Effect.gen(function* () {
33 + const ui = yield* TerminalUI;
34 + yield* ui.intro('composio setup');
35
34 - const targets = yield* resolveSetupTargets(target);
35 - if (!yes) {
36 - const confirmed = yield* ui.confirm(`Install Composio for ${targets.join(' and ')}?`, {
37 - defaultValue: true,
38 - });
39 - if (!confirmed) {
40 - yield* ui.outro('Setup cancelled.');
41 - return;
36 + if (!yes && !isInteractiveTerminal()) {
37 + return yield* Effect.fail(
38 + new Error('Non-interactive setup requires `--yes` to approve local changes.')
39 + );
40 }
43 - }
41
45 - const results = yield* installSetupTargets(targets);
46 - for (const result of results) {
47 - let pluginMessage = `The Composio plugin for ${result.target} is already installed and enabled.`;
48 - if (result.plugin_changed) {
49 - pluginMessage = `Configured and enabled the Composio plugin for ${result.target}.`;
42 + const targets = yield* resolveSetupTargets(target, { allowEmpty: ifPresent });
43 + if (targets.length === 0) {
44 + yield* ui.outro('No supported agent host detected; plugin setup skipped.');
45 + return;
46 }
51 - yield* ui.log.success(pluginMessage);
52 -
53 - if (result.target === 'codex') {
54 - yield* ui.log.success('The Codex plugin includes the composio-cli skill.');
55 - continue;
47 + if (!yes) {
48 + const confirmed = yield* ui.confirm(`Install Composio for ${targets.join(' and ')}?`, {
49 + defaultValue: true,
50 + });
51 + if (!confirmed) {
52 + yield* ui.outro('Setup cancelled.');
53 + return;
54 + }
55 }
57 - if (!result.skill_changed) {
58 - yield* ui.log.success('The composio-cli skill for Claude Code is already installed.');
56 +
57 + const results = yield* installSetupTargets(targets);
58 + for (const result of results) {
59 + let pluginMessage = `The Composio plugin for ${result.target} is already installed and enabled.`;
60 + if (result.plugin_changed) {
61 + pluginMessage = `Configured and enabled the Composio plugin for ${result.target}.`;
62 + }
63 + yield* ui.log.success(pluginMessage);
64 +
65 + if (result.target === 'codex') {
66 + yield* ui.log.success('The Codex plugin includes the composio-cli skill.');
67 + continue;
68 + }
69 + if (!result.skill_changed) {
70 + yield* ui.log.success('The composio-cli skill for Claude Code is already installed.');
71 + }
72 }
60 - }
73
62 - yield* ui.outro('Composio setup complete.');
63 - })
74 + yield* ui.outro('Composio setup complete.');
75 + })
76 );
77
78 export const setupCmd = setupBaseCmd.pipe(
ts/packages/cli/src/services/setup.ts
+5 -1
@@ -420,7 +420,10 @@ const FIXED_TARGETS: Readonly<Partial<Record<SetupTarget, ReadonlyArray<AgentHos
420 all: ['claude', 'codex'],
421 };
422
423 -export const resolveSetupTargets = (target: SetupTarget) =>
423 +export const resolveSetupTargets = (
424 + target: SetupTarget,
425 + options: { readonly allowEmpty?: boolean } = {}
426 +) =>
427 Effect.gen(function* () {
428 const fixedTargets = FIXED_TARGETS[target];
429 if (fixedTargets) return fixedTargets;
@@ -434,6 +437,7 @@ export const resolveSetupTargets = (target: SetupTarget) =>
437 );
438 const detected = statuses.filter(status => status.available).map(status => status.target);
439 if (detected.length === 0) {
440 + if (options.allowEmpty) return detected;
441 return yield* Effect.fail(
442 new Error(
443 'No supported agent host was detected. Install Claude Code or Codex, or pass `--target claude|codex` after installing it.'
ts/packages/cli/test/src/commands/setup.cmd.test.ts
+9
@@ -422,6 +422,15 @@ describe('CLI: composio setup', () => {
422 expect(Exit.isFailure(exit)).toBe(true);
423 })
424 );
425 +
426 + it.scoped('can skip automatic setup for installer integration', () =>
427 + Effect.gen(function* () {
428 + const exit = yield* Effect.exit(
429 + cli(['setup', '--target', 'auto', '--yes', '--if-present'])
430 + );
431 + expect(Exit.isSuccess(exit)).toBe(true);
432 + })
433 + );
434 });
435
436 const conflict = makeFakeHosts({