@devries-cameron20 / composio-1 / commits / acf8a9ca1
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.

test(cli): cover fish completion install idempotency (#3688)

This PR: - follows up on https://github.com/ComposioHQ/composio/pull/3440 and credits Deepak Singh Kandari / @aptsalt from the original implementation - builds on the fish completion fix already merged in https://github.com/ComposioHQ/composio/pull/3162 - references https://github.com/ComposioHQ/composio/issues/3147 - adds regression coverage for running `composio install --completions` twice under fish - verifies `config.fish` keeps a single PATH marker and never receives completion markers - verifies `~/.config/fish/completions/composio.fish` keeps one completion marker ## Testing - `MISE_TRUSTED_CONFIG_PATHS=$PWD mise exec -- pnpm --filter @composio/cli exec vitest run test/src/commands/install.cmd.test.ts` - `MISE_TRUSTED_CONFIG_PATHS=$PWD mise exec -- pnpm --filter @composio/cli typecheck:test` - `git diff --check origin/next...HEAD` Co-authored-by: Deepak Singh Kandari <deepaksinghkandari07@gmail.com>

Alberto Schiabel committed Jun 26, 2026 at 14:26 UTC acf8a9ca1fe31aac65b0b1e1e4f45539ad27546d
1 file changed +37
ts/packages/cli/test/src/commands/install.cmd.test.ts
+37
@@ -173,6 +173,43 @@ describe('CLI: composio install', () => {
173 });
174 });
175
176 + describe('[When] fish shell installs completions twice', () => {
177 + layer(TestLive())(it => {
178 + it.scoped('[Then] keeps config.fish and composio.fish idempotent', () =>
179 + Effect.gen(function* () {
180 + const os = yield* NodeOs;
181 + process.env.SHELL = '/usr/bin/fish';
182 + process.env.COMPOSIO_INSTALL_DIR = path.join(os.homedir, '.composio');
183 +
184 + yield* cli(['install', '--completions']);
185 + yield* cli(['install', '--completions']);
186 +
187 + const fs = yield* FileSystem.FileSystem;
188 + const configPath = path.join(os.homedir, '.config', 'fish', 'config.fish');
189 + const completionPath = path.join(
190 + os.homedir,
191 + '.config',
192 + 'fish',
193 + 'completions',
194 + 'composio.fish'
195 + );
196 + const configContents = yield* fs.readFileString(configPath);
197 + const completionContents = yield* fs.readFileString(completionPath);
198 +
199 + const pathMarkerCount = configContents.match(/^# Composio CLI$/gm)?.length ?? 0;
200 + const configCompletionsCount =
201 + configContents.match(/^# Composio CLI completions$/gm)?.length ?? 0;
202 + const fishCompletionsCount =
203 + completionContents.match(/^# Composio CLI completions$/gm)?.length ?? 0;
204 +
205 + expect(pathMarkerCount).toBe(1);
206 + expect(configCompletionsCount).toBe(0);
207 + expect(fishCompletionsCount).toBe(1);
208 + })
209 + );
210 + });
211 + });
212 +
213 describe('[When] --no-completions is passed', () => {
214 layer(TestLive())(it => {
215 it.scoped('[Then] writes PATH block but skips completions', () =>