Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
refactor(cli): defer setup telemetry
Kshitij Jhunjhunwala committed
Jul 14, 2026 at 20:07 UTC
333d2296eda6c8de1a450322affe7cf20e4639f8
5 files changed
+1
-169
install.sh
+1
-1
@@ -407,7 +407,7 @@ rm -f "$install_err"
407
if [[ $install_plugins = true ]]; then
408
echo
409
info "Checking for supported agent hosts..."
410
- if ! COMPOSIO_CLI_INVOCATION_ORIGIN=installer "$exe" setup --target auto --yes --if-present; then
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
test/install-sh-release-resolution.test.sh
-4
@@ -154,10 +154,6 @@ install)
154
exit 0
155
;;
156
setup)
157
- if [[ "${COMPOSIO_CLI_INVOCATION_ORIGIN:-}" != 'installer' ]]; then
158
- echo 'Expected automatic plugin setup telemetry origin to be installer.' >&2
159
- exit 97
160
- fi
157
exit "${TEST_SETUP_EXIT:-0}"
158
;;
159
--version|version)
ts/packages/cli/src/analytics/events.ts
-70
@@ -27,14 +27,6 @@ export const CLI_ANALYTICS_EVENTS = {
27
CLI_RUN_INVOKED: 'CLI_RUN_INVOKED',
28
CLI_RUN_SUCCEEDED: 'CLI_RUN_SUCCEEDED',
29
CLI_RUN_FAILED: 'CLI_RUN_FAILED',
30
- CLI_INSTALL_INVOKED: 'CLI_INSTALL_INVOKED',
31
- CLI_INSTALL_SUCCEEDED: 'CLI_INSTALL_SUCCEEDED',
32
- CLI_INSTALL_FAILED: 'CLI_INSTALL_FAILED',
33
- CLI_SETUP_INVOKED: 'CLI_SETUP_INVOKED',
34
- CLI_SETUP_SUCCEEDED: 'CLI_SETUP_SUCCEEDED',
35
- CLI_SETUP_FAILED: 'CLI_SETUP_FAILED',
36
- CLI_PLUGIN_SETUP_SUCCEEDED: 'CLI_PLUGIN_SETUP_SUCCEEDED',
37
- CLI_PLUGIN_UNINSTALL_SUCCEEDED: 'CLI_PLUGIN_UNINSTALL_SUCCEEDED',
30
CLI_TOOL_INVOCATION_VALIDATION_FAILED: 'CLI_TOOL_INVOCATION_VALIDATION_FAILED',
31
CLI_TOOL_INVOCATION_TOOL_NOT_FOUND: 'CLI_TOOL_INVOCATION_TOOL_NOT_FOUND',
32
CLI_TOOL_INVOCATION_FAILED: 'CLI_TOOL_INVOCATION_FAILED',
@@ -48,7 +40,6 @@ const KNOWN_COMMAND_TOKENS = new Set([
40
'logout',
41
'run',
42
'install',
51
- 'setup',
43
'dev',
44
'generate',
45
'tools',
@@ -290,28 +281,6 @@ const getRunCommandProperties = (context: CliCommandTelemetryContext) => ({
281
arg_count: Math.max(0, context.argv.length - 3),
282
});
283
293
-const getInstallCommandProperties = (context: CliCommandTelemetryContext) => ({
294
- source: 'cli',
295
- invocation_origin: getInvocationOrigin(),
296
- cli_version: context.cliVersion,
297
- command_path: context.commandPath,
298
- duration_ms: Date.now() - context.startedAt,
299
- completions: isFlagPresent(context.argv, '--completions'),
300
- no_completions: isFlagPresent(context.argv, '--no-completions'),
301
-});
302
-
303
-const getSetupCommandProperties = (context: CliCommandTelemetryContext) => ({
304
- source: 'cli',
305
- invocation_origin: getInvocationOrigin(),
306
- cli_version: context.cliVersion,
307
- command_path: context.commandPath,
308
- duration_ms: Date.now() - context.startedAt,
309
- operation: isFlagPresent(context.argv, '--uninstall') ? 'uninstall' : 'setup',
310
- target: getFlagValue(context.argv, '--target') ?? 'auto',
311
- yes: isFlagPresent(context.argv, '--yes', '-y'),
312
- if_present: isFlagPresent(context.argv, '--if-present'),
313
-});
314
-
284
const getLoginCommandProperties = (context: CliCommandTelemetryContext) => ({
285
source: 'cli',
286
invocation_origin: getInvocationOrigin(),
@@ -364,10 +333,6 @@ const isProxyCommand = (commandPath: string): boolean => commandPath === 'proxy'
333
334
const isRunCommand = (commandPath: string): boolean => commandPath === 'run';
335
367
-const isInstallCommand = (commandPath: string): boolean => commandPath === 'install';
368
-
369
-const isSetupCommand = (commandPath: string): boolean => commandPath === 'setup';
370
-
336
const isGenericOnlyCommand = (commandPath: string): boolean =>
337
commandPath === 'composio' || commandPath.startsWith('dev');
338
@@ -487,20 +452,6 @@ const SPECIAL_LIFECYCLE_FAMILIES: ReadonlyArray<SpecialLifecycleFamily> = [
452
failedEventName: CLI_ANALYTICS_EVENTS.CLI_RUN_FAILED,
453
getProperties: getRunCommandProperties,
454
},
490
- {
491
- match: isInstallCommand,
492
- invokedEventName: CLI_ANALYTICS_EVENTS.CLI_INSTALL_INVOKED,
493
- succeededEventName: CLI_ANALYTICS_EVENTS.CLI_INSTALL_SUCCEEDED,
494
- failedEventName: CLI_ANALYTICS_EVENTS.CLI_INSTALL_FAILED,
495
- getProperties: getInstallCommandProperties,
496
- },
497
- {
498
- match: isSetupCommand,
499
- invokedEventName: CLI_ANALYTICS_EVENTS.CLI_SETUP_INVOKED,
500
- succeededEventName: CLI_ANALYTICS_EVENTS.CLI_SETUP_SUCCEEDED,
501
- failedEventName: CLI_ANALYTICS_EVENTS.CLI_SETUP_FAILED,
502
- getProperties: getSetupCommandProperties,
503
- },
455
];
456
457
const getSpecialLifecycleFamily = (commandPath: string): SpecialLifecycleFamily | undefined =>
@@ -550,27 +501,6 @@ export const getPrimaryLifecycleFailedEvent = (
501
};
502
};
503
553
-export const getPluginLifecycleSucceededEvent = (params: {
554
- readonly operation: 'setup' | 'uninstall';
555
- readonly target: 'claude' | 'codex';
556
- readonly action: 'installed' | 'enabled' | 'configured' | 'uninstalled';
557
- readonly cliVersion: string;
558
-}): TrackEvent => ({
559
- name:
560
- params.operation === 'uninstall'
561
- ? CLI_ANALYTICS_EVENTS.CLI_PLUGIN_UNINSTALL_SUCCEEDED
562
- : CLI_ANALYTICS_EVENTS.CLI_PLUGIN_SETUP_SUCCEEDED,
563
- properties: {
564
- source: 'cli',
565
- invocation_origin: getInvocationOrigin(),
566
- cli_version: params.cliVersion,
567
- command_path: 'setup',
568
- operation: params.operation,
569
- agent_host: params.target,
570
- action: params.action,
571
- },
572
-});
573
-
504
export const getToolExecuteValidationFailedEvent = (params: {
505
readonly toolSlug: string;
506
readonly args: Record<string, unknown>;
ts/packages/cli/src/services/setup.ts
-28
@@ -1,9 +1,6 @@
1
import { Command } from '@effect/platform';
2
import { Data, Effect } from 'effect';
3
import semver from 'semver';
4
-import { trackCliEventEffect } from 'src/analytics/dispatch';
5
-import { getPluginLifecycleSucceededEvent } from 'src/analytics/events';
6
-import { APP_VERSION } from 'src/constants';
4
import { CommandRunner, type CommandResult } from './command-runner';
5
import { SetupSkillInstaller } from './setup-skill-installer';
6
@@ -749,21 +746,6 @@ export const installSetupTargets = (inspected: ReadonlyArray<InspectedSetupTarge
746
);
747
})
748
);
752
- if (result.plugin_changed) {
753
- const action = !status.plugin_installed
754
- ? 'installed'
755
- : !status.plugin_enabled
756
- ? 'enabled'
757
- : 'configured';
758
- yield* trackCliEventEffect(
759
- getPluginLifecycleSucceededEvent({
760
- operation: 'setup',
761
- target: result.target,
762
- action,
763
- cliVersion: APP_VERSION,
764
- })
765
- );
766
- }
749
completed.push(result);
750
}
751
return completed;
@@ -782,16 +764,6 @@ export const uninstallSetupTargets = (inspected: ReadonlyArray<InspectedSetupTar
764
);
765
})
766
);
785
- if (result.plugin_changed) {
786
- yield* trackCliEventEffect(
787
- getPluginLifecycleSucceededEvent({
788
- operation: 'uninstall',
789
- target: result.target,
790
- action: 'uninstalled',
791
- cliVersion: APP_VERSION,
792
- })
793
- );
794
- }
767
completed.push(result);
768
}
769
return completed;
ts/packages/cli/test/src/analytics.events.test.ts
-66
@@ -1,19 +1,12 @@
1
import { describe, expect, it } from 'vitest';
2
import { createCliCodactFailureBody } from 'src/analytics/dispatch';
3
import {
4
- CLI_ANALYTICS_EVENTS,
5
- createCliCommandTelemetryContext,
6
- getPluginLifecycleSucceededEvent,
7
- getPrimaryLifecycleFailedEvent,
8
- getPrimaryLifecycleInvokedEvent,
9
- getPrimaryLifecycleSucceededEvent,
4
getToolExecuteFailedEvent,
5
getToolExecuteToolNotFoundEvent,
6
getToolExecuteValidationFailedEvent,
7
isMaybeToolNotFoundError,
8
isMaybeToolValidationError,
9
} from 'src/analytics/events';
16
-import { APP_VERSION } from 'src/constants';
10
import { ToolInputValidationError } from 'src/services/tool-input-validation';
11
12
describe('CLI analytics execute failure events', () => {
@@ -134,62 +127,3 @@ describe('CLI analytics execute failure events', () => {
127
});
128
});
129
});
137
-
138
-describe('CLI analytics setup and install lifecycle events', () => {
139
- it('tracks setup as a dedicated lifecycle with safe option properties', () => {
140
- const context = createCliCommandTelemetryContext(
141
- ['bun', 'composio', 'setup', '--target', 'codex', '--uninstall', '--yes'],
142
- APP_VERSION
143
- );
144
-
145
- const invoked = getPrimaryLifecycleInvokedEvent(context);
146
- const succeeded = getPrimaryLifecycleSucceededEvent(context);
147
- const failed = getPrimaryLifecycleFailedEvent(context, new Error('native failure'));
148
-
149
- expect(invoked?.name).toBe(CLI_ANALYTICS_EVENTS.CLI_SETUP_INVOKED);
150
- expect(succeeded?.name).toBe(CLI_ANALYTICS_EVENTS.CLI_SETUP_SUCCEEDED);
151
- expect(failed?.name).toBe(CLI_ANALYTICS_EVENTS.CLI_SETUP_FAILED);
152
- expect(invoked?.properties).toMatchObject({
153
- command_path: 'setup',
154
- operation: 'uninstall',
155
- target: 'codex',
156
- yes: true,
157
- if_present: false,
158
- });
159
- });
160
-
161
- it('tracks shell installation separately from plugin setup', () => {
162
- const context = createCliCommandTelemetryContext(
163
- ['bun', 'composio', 'install', '--completions'],
164
- APP_VERSION
165
- );
166
-
167
- expect(getPrimaryLifecycleInvokedEvent(context)).toMatchObject({
168
- name: CLI_ANALYTICS_EVENTS.CLI_INSTALL_INVOKED,
169
- properties: {
170
- command_path: 'install',
171
- completions: true,
172
- no_completions: false,
173
- },
174
- });
175
- });
176
-
177
- it('tracks a verified per-host plugin change', () => {
178
- expect(
179
- getPluginLifecycleSucceededEvent({
180
- operation: 'setup',
181
- target: 'claude',
182
- action: 'installed',
183
- cliVersion: APP_VERSION,
184
- })
185
- ).toMatchObject({
186
- name: CLI_ANALYTICS_EVENTS.CLI_PLUGIN_SETUP_SUCCEEDED,
187
- properties: {
188
- command_path: 'setup',
189
- operation: 'setup',
190
- agent_host: 'claude',
191
- action: 'installed',
192
- },
193
- });
194
- });
195
-});