Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
fix(cli): preserve configured analytics channel
Kshitij Jhunjhunwala committed
Jul 29, 2026 at 16:36 UTC
53a4e7ca469aab635986df999798e029fe311318
2 files changed
+15
-25
ts/packages/cli/src/analytics/events.ts
+8
-12
@@ -114,18 +114,14 @@ export const configureCliAnalyticsReleaseVersion = (version: string): void => {
114
const buildEvent = (
115
name: CliAnalyticsEventName,
116
properties: Record<string, unknown>
117
-): TrackEvent => {
118
- const eventVersion =
119
- typeof properties.cli_version === 'string' ? properties.cli_version : undefined;
120
- return {
121
- name,
122
- properties: {
123
- ...properties,
124
- journey_stage: CLI_EVENT_JOURNEY_STAGES[name],
125
- cli_channel: eventVersion ? inferSkillReleaseChannel(eventVersion) : cliChannel,
126
- },
127
- };
128
-};
117
+): TrackEvent => ({
118
+ name,
119
+ properties: {
120
+ ...properties,
121
+ journey_stage: CLI_EVENT_JOURNEY_STAGES[name],
122
+ cli_channel: cliChannel,
123
+ },
124
+});
125
126
const KNOWN_COMMAND_TOKENS = new Set([
127
'version',
ts/packages/cli/test/src/analytics.events.test.ts
+7
-13
@@ -460,24 +460,18 @@ describe('CLI analytics journey taxonomy', () => {
460
{ stdoutIsTTY: false, stderrIsTTY: false }
461
);
462
const properties = getPrimaryLifecycleInvokedEvent(context)?.properties;
463
+ const pluginProperties = getPluginLifecycleSucceededEvent({
464
+ operation: 'setup',
465
+ target: 'codex',
466
+ action: 'installed',
467
+ cliVersion: APP_VERSION,
468
+ })?.properties;
469
expect(inferSkillReleaseChannel(APP_VERSION)).toBe('stable');
470
expect(properties?.cli_channel).toBe('beta');
471
+ expect(pluginProperties?.cli_channel).toBe('beta');
472
}).pipe(Effect.provide(Layer.merge(BunFileSystem.layer, BunPath.layer)));
473
});
474
468
- it('derives invoked-event channel from its resolved runtime version', () => {
469
- configureCliAnalyticsReleaseVersion(APP_VERSION);
470
- const context = createCliCommandTelemetryContext(['bun', 'composio', 'login'], '0.3.1-beta.7', {
471
- stdoutIsTTY: true,
472
- stderrIsTTY: true,
473
- });
474
-
475
- expect(getPrimaryLifecycleInvokedEvent(context)?.properties).toMatchObject({
476
- cli_version: '0.3.1-beta.7',
477
- cli_channel: 'beta',
478
- });
479
- });
480
-
475
it('propagates the installer invocation origin from the environment', () => {
476
vi.stubEnv('COMPOSIO_CLI_INVOCATION_ORIGIN', 'installer');
477