@devries-cameron20 / composio Mirror · read-only / commits / 20273ea66
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

fix(cli): honor if-present for unsupported hosts

Kshitij Jhunjhunwala committed Jul 14, 2026 at 19:35 UTC 20273ea66e306511e55ac95ab384d424f6a03e33
3 files changed +37 -1
ts/e2e-tests/cli/setup-plugins/e2e.test.ts
+13
@@ -53,6 +53,11 @@ export PATH=/tmp/bin:$PATH
53 composio setup --target auto --yes
54 `;
55
56 +const legacyCodexIfPresentFixture = legacyCodexFixture.replace(
57 + 'composio setup --target auto --yes',
58 + 'composio setup --target auto --yes --if-present'
59 +);
60 +
61 const legacyClaudeFixture = `
62 set -eu
63 mkdir -p /tmp/bin /tmp/host-state
@@ -119,6 +124,7 @@ e2e(import.meta.url, {
124 let skippedUnavailableUninstall: E2ETestResult;
125 let legacyClaude: E2ETestResult;
126 let legacyCodex: E2ETestResult;
127 + let legacyCodexIfPresent: E2ETestResult;
128 let claudeWithLegacyCodex: E2ETestResult;
129 let codexWithLegacyClaude: E2ETestResult;
130 let failedClaudeInspection: E2ETestResult;
@@ -141,6 +147,7 @@ e2e(import.meta.url, {
147 );
148 legacyClaude = await runCmd(legacyClaudeFixture);
149 legacyCodex = await runCmd(legacyCodexFixture);
150 + legacyCodexIfPresent = await runCmd(legacyCodexIfPresentFixture);
151 claudeWithLegacyCodex = await runCmd(claudeWithLegacyCodexFixture);
152 codexWithLegacyClaude = await runCmd(codexWithLegacyClaudeFixture);
153 failedClaudeInspection = await runCmd(failedClaudeInspectionFixture);
@@ -238,6 +245,12 @@ e2e(import.meta.url, {
245 expect(legacyCodex.stderr).not.toContain("unexpected argument '--json'");
246 });
247
248 + it('skips an unsupported-only host when invoked by an installer', () => {
249 + expect(legacyCodexIfPresent.exitCode).toBe(0);
250 + expect(legacyCodexIfPresent.stdout).toBe('');
251 + expect(legacyCodexIfPresent.stderr).toBe('');
252 + });
253 +
254 it('continues with Claude when Codex is unsupported', () => {
255 expect(claudeWithLegacyCodex.exitCode).toBe(0);
256 expect(claudeWithLegacyCodex.stdout).toBe('');
ts/packages/cli/src/commands/setup.cmd.ts
+10 -1
@@ -82,12 +82,21 @@ const setupBaseCmd = Command.make(
82 .map(result => result.unsupportedReason)
83 .filter((message): message is string => Boolean(message))
84 .join(' ');
85 - if (target !== 'auto' || supported.length === 0) {
85 + if (target !== 'auto') {
86 return yield* Effect.fail(new Error(reason));
87 }
88 yield* ui.log.warn(
89 `${formatTargets(unsupported.map(result => result.target))} plugin setup skipped. ${reason}`
90 );
91 + if (supported.length === 0) {
92 + if (ifPresent) {
93 + yield* ui.outro(
94 + `No supported agent host detected; plugin ${uninstall ? 'uninstall' : 'setup'} skipped.`
95 + );
96 + return;
97 + }
98 + return yield* Effect.fail(new Error(reason));
99 + }
100 }
101 if (detected.length === 0) {
102 if (target === 'claude' || target === 'codex') {
ts/packages/cli/test/src/commands/setup.cmd.test.ts
+14
@@ -1003,6 +1003,20 @@ describe('CLI: composio setup', () => {
1003 })
1004 );
1005
1006 + it.scoped('skips cleanly for installer integration when no supported host remains', () =>
1007 + Effect.gen(function* () {
1008 + const exit = yield* Effect.exit(
1009 + cli(['setup', '--target', 'auto', '--yes', '--if-present'])
1010 + );
1011 +
1012 + expect(Exit.isSuccess(exit)).toBe(true);
1013 + const output = (yield* MockConsole.getLines()).join('\n');
1014 + expect(output).toContain('Codex plugin setup skipped.');
1015 + expect(output).toContain('No supported agent host detected; plugin setup skipped.');
1016 + expect(legacyCodex.commands.some(parts => parts.includes('--json'))).toBe(false);
1017 + })
1018 + );
1019 +
1020 it.scoped('fails with an actionable upgrade message before running setup mutations', () =>
1021 Effect.gen(function* () {
1022 const exit = yield* Effect.exit(cli(['setup', '--target', 'codex', '--yes']));