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.

test(cli): align the installer analytics guard with the shell-delegation flow

jkomynob381210c2d7f
diff --git a/ts/packages/cli/test/src/analytics.events.test.ts b/ts/packages/cli/test/src/analytics.events.test.ts
index 87d4dd10d..b3834afd6 100644
--- a/ts/packages/cli/test/src/analytics.events.test.ts
+++ b/ts/packages/cli/test/src/analytics.events.test.ts
@@ -481,23 +481,37 @@ describe('CLI analytics journey taxonomy', () => {
});
});
- it('keeps the base installer install-only and marks shell-variant delegation as installer-origin', () => {
+ it('keeps the base installer install-only and marks shell-setup delegation as installer-origin', () => {
const installScript = readFileSync(
new URL('../../../../../install.sh', import.meta.url),
'utf8'
);
- expect(installScript).not.toContain('"$exe" install');
+ // Join backslash-continued lines so multi-line invocations match as one logical line.
+ const logicalLines = installScript.replace(/\\\n\s*/g, ' ').split('\n');
+ const installInvocations = logicalLines.filter(line => line.includes('"$exe" install'));
+
+ // The installer may invoke `composio install` only for the `--shell` capability probe
+ // and the shell-setup delegation; any other invocation would emit install analytics
+ // events without the installer origin attached.
+ const helpProbes = installInvocations.filter(line => line.includes('"$exe" install --help'));
+ const shellDelegations = installInvocations.filter(line =>
+ line.includes('"$exe" install --shell')
+ );
+ expect(helpProbes).toHaveLength(1);
+ expect(shellDelegations).toHaveLength(1);
+ expect(installInvocations).toHaveLength(2);
+ expect(shellDelegations[0]).toContain('COMPOSIO_CLI_INVOCATION_ORIGIN=installer');
for (const shell of ['zsh', 'bash', 'fish']) {
const variantScript = readFileSync(
new URL(`../../../../../install/${shell}.sh`, import.meta.url),
'utf8'
);
- const installLine = variantScript
- .split('\n')
- .find(line => line.includes('"$variant_exe" install --shell'));
-
- expect(installLine).toContain('COMPOSIO_CLI_INVOCATION_ORIGIN=installer');
+ // Variants never invoke the CLI themselves: they re-exec the base installer with the
+ // shell pinned, so the delegation asserted above stays the only CLI install call.
+ expect(variantScript).not.toContain('"$exe"');
+ expect(variantScript).not.toContain(' install --shell');
+ expect(variantScript).toContain('COMPOSIO_INSTALL_SHELL="$variant_shell"');
}
});
});