Skip to content

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 Jhunjhunwala53a4e7ca469a
diff --git a/ts/packages/cli/src/analytics/events.ts b/ts/packages/cli/src/analytics/events.ts
index 55b61e43d..c483c8556 100644
--- a/ts/packages/cli/src/analytics/events.ts
+++ b/ts/packages/cli/src/analytics/events.ts
@@ -114,18 +114,14 @@ export const configureCliAnalyticsReleaseVersion = (version: string): void => {
const buildEvent = (
name: CliAnalyticsEventName,
properties: Record<string, unknown>
-): TrackEvent => {
- const eventVersion =
- typeof properties.cli_version === 'string' ? properties.cli_version : undefined;
- return {
- name,
- properties: {
- ...properties,
- journey_stage: CLI_EVENT_JOURNEY_STAGES[name],
- cli_channel: eventVersion ? inferSkillReleaseChannel(eventVersion) : cliChannel,
- },
- };
-};
+): TrackEvent => ({
+ name,
+ properties: {
+ ...properties,
+ journey_stage: CLI_EVENT_JOURNEY_STAGES[name],
+ cli_channel: cliChannel,
+ },
+});
const KNOWN_COMMAND_TOKENS = new Set([
'version',
diff --git a/ts/packages/cli/test/src/analytics.events.test.ts b/ts/packages/cli/test/src/analytics.events.test.ts
index b08be9213..bc4ae477b 100644
--- a/ts/packages/cli/test/src/analytics.events.test.ts
+++ b/ts/packages/cli/test/src/analytics.events.test.ts
@@ -460,24 +460,18 @@ describe('CLI analytics journey taxonomy', () => {
{ stdoutIsTTY: false, stderrIsTTY: false }
);
const properties = getPrimaryLifecycleInvokedEvent(context)?.properties;
+ const pluginProperties = getPluginLifecycleSucceededEvent({
+ operation: 'setup',
+ target: 'codex',
+ action: 'installed',
+ cliVersion: APP_VERSION,
+ })?.properties;
expect(inferSkillReleaseChannel(APP_VERSION)).toBe('stable');
expect(properties?.cli_channel).toBe('beta');
+ expect(pluginProperties?.cli_channel).toBe('beta');
}).pipe(Effect.provide(Layer.merge(BunFileSystem.layer, BunPath.layer)));
});
- it('derives invoked-event channel from its resolved runtime version', () => {
- configureCliAnalyticsReleaseVersion(APP_VERSION);
- const context = createCliCommandTelemetryContext(['bun', 'composio', 'login'], '0.3.1-beta.7', {
- stdoutIsTTY: true,
- stderrIsTTY: true,
- });
-
- expect(getPrimaryLifecycleInvokedEvent(context)?.properties).toMatchObject({
- cli_version: '0.3.1-beta.7',
- cli_channel: 'beta',
- });
- });
-
it('propagates the installer invocation origin from the environment', () => {
vi.stubEnv('COMPOSIO_CLI_INVOCATION_ORIGIN', 'installer');