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.

Merge remote-tracking branch 'origin/claude/cli-adoption-funnel-d95660' into claude/posthog-a2-taxonomy

Kshitij Jhunjhunwala0b182a3c0f62
diff --cc install.sh
index 4370c0de3,d01ab257f..d6d4cd7b3
--- a/install.sh
+++ b/install.sh
@@@ -309,9 -315,9 +315,9 @@@ success "Composio CLI was installed suc
echo
- install_err=$(mktemp)
- if COMPOSIO_INSTALL_DIR="$COMPOSIO_INSTALL_DIR" COMPOSIO_CLI_INVOCATION_ORIGIN=installer "$exe" install 2>"$install_err"; then
- cat "$install_err" >&2 # Show CLI's TerminalUI output on success
+ if "$exe" --version >/dev/null 2>&1 &&
- COMPOSIO_INSTALL_DIR="$COMPOSIO_INSTALL_DIR" "$exe" install; then
++ COMPOSIO_INSTALL_DIR="$COMPOSIO_INSTALL_DIR" COMPOSIO_CLI_INVOCATION_ORIGIN=installer "$exe" install; then
+ : # the CLI printed its own shell-integration guidance
else
info "Setting up shell integration..."
diff --cc ts/packages/cli/src/analytics/events.ts
index 136dab901,4ebbd9985..e2257f584
--- a/ts/packages/cli/src/analytics/events.ts
+++ b/ts/packages/cli/src/analytics/events.ts
@@@ -505,8 -437,8 +503,7 @@@ const getCliCommandFailedEvent =
duration_ms: Date.now() - context.startedAt,
flag_names: context.flagNames,
error_name: errorNameOf(error),
- error_message: errorMessageOf(error),
- },
-});
+ });
type SpecialLifecycleFamily = {
readonly match: (commandPath: string) => boolean;
@@@ -613,11 -551,13 +610,10 @@@ export const getPrimaryLifecycleFailedE
if (!family || isGenericOnlyCommand(context.commandPath)) {
return getCliCommandFailedEvent(context, error);
}
- return {
- name: family.failedEventName,
- properties: {
- ...family.getProperties(context),
- error_name: errorNameOf(error),
- },
- };
+ return buildEvent(family.failedEventName, {
+ ...family.getProperties(context),
+ error_name: errorNameOf(error),
- error_message: errorMessageOf(error),
+ });
};
export const getPluginLifecycleSucceededEvent = (params: {
@@@ -657,8 -598,8 +653,7 @@@ export const getPluginLifecycleFailedEv
agent_host: params.target,
phase: params.phase,
error_name: errorNameOf(params.error),
- error_message: errorMessageOf(params.error),
- },
-});
+ });
export const getSetupHostDetectedEvent = (params: {
readonly operation: 'setup' | 'uninstall';
@@@ -791,9 -741,9 +786,8 @@@ export const getToolExecuteToolNotFound
error_slug: params.errorSlug,
http_status: params.status,
api_error_code: params.apiCode,
- error_message: params.message?.slice(0, 500),
...argumentShape(params.args),
- },
-});
+ });
export const getToolExecuteFailedEvent = (params: {
readonly toolSlug: string;
@@@ -824,7 -775,7 +818,6 @@@
http_status: params.status,
api_error_code: params.apiCode,
error_name: params.errorName,
- error_message: params.message?.slice(0, 500),
is_no_connection_error: Boolean(params.isNoConnectionError),
...argumentShape(params.args),
- },
-});
+ });
diff --cc ts/packages/cli/test/src/analytics.events.test.ts
index 57115b379,f2d09f7e1..d14acfa57
--- a/ts/packages/cli/test/src/analytics.events.test.ts
+++ b/ts/packages/cli/test/src/analytics.events.test.ts
@@@ -331,100 -353,3 +358,100 @@@ describe('CLI analytics setup runtime-c
});
});
});
+
+describe('CLI analytics journey taxonomy', () => {
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ const contextFor = (argv: ReadonlyArray<string>) =>
+ createCliCommandTelemetryContext(['bun', 'composio', ...argv], APP_VERSION, {
+ stdoutIsTTY: false,
+ stderrIsTTY: false,
+ });
+
+ const lifecycleCases: ReadonlyArray<[ReadonlyArray<string>, string]> = [
+ [['execute', 'GMAIL_SEND_EMAIL'], 'execute'],
+ [['search', 'send email'], 'other'],
+ [['link', 'github'], 'connect'],
+ [['login'], 'login'],
+ [['logout'], 'other'],
+ [['proxy', '/api/v3/toolkits'], 'other'],
+ [['run', 'echo hi'], 'other'],
+ [['install'], 'install'],
+ [['setup'], 'setup'],
+ [['version'], 'other'],
+ ];
+
+ it.each(lifecycleCases)('stamps %j lifecycle events with journey_stage %s', (argv, stage) => {
+ const context = contextFor(argv);
+
+ expect(getPrimaryLifecycleInvokedEvent(context)?.properties?.journey_stage).toBe(stage);
+ expect(getPrimaryLifecycleSucceededEvent(context)?.properties?.journey_stage).toBe(stage);
+ expect(
+ getPrimaryLifecycleFailedEvent(context, new Error('boom'))?.properties?.journey_stage
+ ).toBe(stage);
+ });
+
+ it('maps every analytics event name to a declared journey stage', () => {
+ for (const name of Object.values(CLI_ANALYTICS_EVENTS)) {
+ expect(CLI_JOURNEY_STAGES).toContain(CLI_EVENT_JOURNEY_STAGES[name]);
+ }
+ });
+
+ it('stamps standalone setup and tool-invocation events with their stages', () => {
+ expect(
+ getPluginLifecycleSucceededEvent({
+ operation: 'setup',
+ target: 'claude',
+ action: 'installed',
+ cliVersion: APP_VERSION,
+ })?.properties?.journey_stage
+ ).toBe('setup');
+
+ expect(
+ getSetupSkippedEvent({
+ operation: 'setup',
+ requestedTarget: 'auto',
+ cliVersion: APP_VERSION,
+ })?.properties?.journey_stage
+ ).toBe('setup');
+
+ expect(
+ getToolExecuteFailedEvent({
+ toolSlug: 'GMAIL_SEND_EMAIL',
+ args: {},
+ surface: 'root',
+ projectMode: 'consumer',
+ stage: 'execution',
+ failureOrigin: 'main_endpoint',
+ })?.properties?.journey_stage
+ ).toBe('execute');
+ });
+
+ it('stamps events with the release channel of the running build', () => {
+ const properties = getPrimaryLifecycleInvokedEvent(contextFor(['login']))?.properties;
+
+ expect(properties?.cli_channel).toBe(inferSkillReleaseChannel(APP_VERSION));
+ expect(CLI_RELEASE_CHANNELS).toContain(properties?.cli_channel);
+ });
+
+ it('propagates the installer invocation origin from the environment', () => {
+ vi.stubEnv('COMPOSIO_CLI_INVOCATION_ORIGIN', 'installer');
+
+ expect(getPrimaryLifecycleInvokedEvent(contextFor(['install']))?.properties).toMatchObject({
+ invocation_origin: 'installer',
+ journey_stage: 'install',
+ });
+ });
+
+ it('marks the install.sh shell-integration run as installer-origin', () => {
+ const installScript = readFileSync(
+ new URL('../../../../../install.sh', import.meta.url),
+ 'utf8'
+ );
- const installLine = installScript.split('\n').find(line => line.includes('"$exe" install '));
++ const installLine = installScript.split('\n').find(line => line.includes('"$exe" install'));
+
+ expect(installLine).toContain('COMPOSIO_CLI_INVOCATION_ORIGIN=installer');
+ });
+});