Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Fix install logging for skipped completions (#3052)
Rahul Tarak5a3c66176410
diff --git a/.changeset/calm-dingos-divide.md b/.changeset/calm-dingos-divide.mdnew file mode 100644index 000000000..33ee41155--- /dev/null+++ b/.changeset/calm-dingos-divide.md@@ -0,0 +1,5 @@+---+'@composio/cli': patch+---++Change `composio install` to skip shell completions by default and require `--completions` to install them explicitly. Also keep the skipped-completions logging consistent.diff --git a/ts/packages/cli/src/commands/install.cmd.ts b/ts/packages/cli/src/commands/install.cmd.tsindex 3053523b8..424ed8072 100644--- a/ts/packages/cli/src/commands/install.cmd.ts+++ b/ts/packages/cli/src/commands/install.cmd.ts@@ -12,8 +12,13 @@ import { getCompletionScript } from 'src/effects/shell-completions';// Options// ---------------------------------------------------------------------------+const completionsOpt = Options.boolean('completions').pipe(+ Options.withDescription('Install shell completions.'),+ Options.withDefault(false)+);+const noCompletionsOpt = Options.boolean('no-completions').pipe(- Options.withDescription('Skip shell completions setup.'),+ Options.withDescription('Deprecated: shell completions are skipped by default.'),Options.withDefault(false));@@ -122,7 +127,7 @@ const tildify = (p: string, homedir: string): string =>// ---------------------------------------------------------------------------export const installShellIntegration = (params: {- readonly noCompletions: boolean;+ readonly completions: boolean;}): Effect.Effect<void, PlatformError, TerminalUI | NodeOs | FileSystem.FileSystem> =>Effect.gen(function* () {const ui = yield* TerminalUI;@@ -162,7 +167,7 @@ export const installShellIntegration = (params: {// Lazy-import the root command to avoid a circular dependency// (index.ts → install.cmd.ts → index.ts).let completionScript: string | undefined;- if (!params.noCompletions && shell !== 'zsh') {+ if (params.completions && shell !== 'zsh') {const mod = yield* Effect.promise(() => import('src/commands'));const lines = yield* getCompletionScript(mod.rootCommand, shell);completionScript = lines.length > 0 ? Arr.join(lines, '\n') : undefined;@@ -191,10 +196,10 @@ export const installShellIntegration = (params: {yield* ui.log.step('PATH: already configured');}- if (params.noCompletions) {- yield* ui.log.step('Completions: skipped (--no-completions)');- } else if (shell === 'zsh') {+ if (shell === 'zsh') {yield* ui.log.step('Completions: skipped for zsh');+ } else if (!params.completions) {+ yield* ui.log.step('Completions: skipped by default (pass --completions to enable)');} else if (config.completionBlock && !fileContains(existing, COMPLETIONS_MARKER)) {blocks.push(config.completionBlock);yield* ui.log.step('Completions: will install shell completions');@@ -246,11 +251,13 @@ export const installShellIntegration = (params: {* @example* ```bash* composio install+ * composio install --completions* composio install --no-completions* ```*/export const installCmd = Command.make('install',- { noCompletions: noCompletionsOpt },- ({ noCompletions }) => installShellIntegration({ noCompletions })+ { completions: completionsOpt, noCompletions: noCompletionsOpt },+ ({ completions, noCompletions }) =>+ installShellIntegration({ completions: completions && !noCompletions })).pipe(Command.withDescription('Set up shell integration (PATH and completions).'));diff --git a/ts/packages/cli/test/src/commands/install.cmd.test.ts b/ts/packages/cli/test/src/commands/install.cmd.test.tsindex a9a101bde..0ef5d1c40 100644--- a/ts/packages/cli/test/src/commands/install.cmd.test.ts+++ b/ts/packages/cli/test/src/commands/install.cmd.test.ts@@ -31,7 +31,7 @@ describe('CLI: composio install', () => {describe('[When] shell is zsh', () => {layer(TestLive())(it => {- it.scoped('[Then] creates .zshrc with PATH only', () =>+ it.scoped('[Then] creates .zshrc with PATH only by default', () =>Effect.gen(function* () {const os = yield* NodeOs;process.env.SHELL = '/bin/zsh';@@ -62,7 +62,7 @@ describe('CLI: composio install', () => {describe('[When] shell is bash', () => {layer(TestLive())(it => {- it.scoped('[Then] creates .bashrc with PATH and completions', () =>+ it.scoped('[Then] creates .bashrc with PATH only by default', () =>Effect.gen(function* () {const os = yield* NodeOs;process.env.SHELL = '/bin/bash';@@ -77,7 +77,7 @@ describe('CLI: composio install', () => {expect(contents).toContain('# Composio CLI');expect(contents).toContain('export COMPOSIO_INSTALL_DIR=');expect(contents).toContain('export PATH="$COMPOSIO_INSTALL_DIR:$PATH"');- expect(contents).toContain('# Composio CLI completions');+ expect(contents).not.toContain('# Composio CLI completions');}));});@@ -85,7 +85,7 @@ describe('CLI: composio install', () => {describe('[When] shell is fish', () => {layer(TestLive())(it => {- it.scoped('[Then] creates config.fish with PATH and completions', () =>+ it.scoped('[Then] creates config.fish with PATH only by default', () =>Effect.gen(function* () {const os = yield* NodeOs;process.env.SHELL = '/usr/bin/fish';@@ -100,7 +100,33 @@ describe('CLI: composio install', () => {expect(contents).toContain('# Composio CLI');expect(contents).toContain('set --export COMPOSIO_INSTALL_DIR');expect(contents).toContain('set --export PATH $COMPOSIO_INSTALL_DIR $PATH');+ expect(contents).not.toContain('# Composio CLI completions');+ })+ );+ });+ });++ describe('[When] --completions is passed', () => {+ layer(TestLive())(it => {+ it.scoped('[Then] writes PATH block and installs completions', () =>+ Effect.gen(function* () {+ const os = yield* NodeOs;+ process.env.SHELL = '/bin/bash';+ process.env.COMPOSIO_INSTALL_DIR = path.join(os.homedir, '.composio');++ yield* cli(['install', '--completions']);++ const fs = yield* FileSystem.FileSystem;+ const rcPath = path.join(os.homedir, '.bashrc');+ const contents = yield* fs.readFileString(rcPath);++ expect(contents).toContain('# Composio CLI');+ expect(contents).toContain('export COMPOSIO_INSTALL_DIR=');expect(contents).toContain('# Composio CLI completions');++ const lines = yield* MockConsole.getLines();+ const output = lines.join('\n');+ expect(output).toContain('Completions: will install shell completions');}));});@@ -126,7 +152,7 @@ describe('CLI: composio install', () => {const lines = yield* MockConsole.getLines();const output = lines.join('\n');- expect(output).toContain('Completions: skipped (--no-completions)');+ expect(output).toContain('Completions: skipped for zsh');}));});@@ -137,15 +163,15 @@ describe('CLI: composio install', () => {it.scoped('[Then] does not duplicate entries', () =>Effect.gen(function* () {const os = yield* NodeOs;- process.env.SHELL = '/bin/zsh';+ process.env.SHELL = '/bin/bash';process.env.COMPOSIO_INSTALL_DIR = path.join(os.homedir, '.composio');// Run install twice- yield* cli(['install']);- yield* cli(['install']);+ yield* cli(['install', '--completions']);+ yield* cli(['install', '--completions']);const fs = yield* FileSystem.FileSystem;- const rcPath = path.join(os.homedir, '.zshrc');+ const rcPath = path.join(os.homedir, '.bashrc');const contents = yield* fs.readFileString(rcPath);// Count occurrences of each marker — should be exactly 1@@ -154,7 +180,7 @@ describe('CLI: composio install', () => {expect(pathMarkerCount).toBe(1);const completionsCount = contents.match(/^# Composio CLI completions$/gm)?.length ?? 0;- expect(completionsCount).toBe(0);+ expect(completionsCount).toBe(1);}));});@@ -176,7 +202,7 @@ describe('CLI: composio install', () => {'# existing config\n# Composio CLI\nexport COMPOSIO_INSTALL_DIR=/old\n# Composio CLI completions\n_composio() {}\n');- yield* cli(['install']);+ yield* cli(['install', '--completions']);const lines = yield* MockConsole.getLines();const output = lines.join('\n');