Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 17:15 UTC
test(cli): align the installer analytics guard with the shell-delegation flow
jkomyno committed
Aug 3, 2026 at 20:23 UTC
b381210c2d7f052b01827575888b2973223523d3
1 file changed
+21
-7
ts/packages/cli/test/src/analytics.events.test.ts
+21
-7
@@ -481,23 +481,37 @@ describe('CLI analytics journey taxonomy', () => {
481
});
482
});
483
484
- it('keeps the base installer install-only and marks shell-variant delegation as installer-origin', () => {
484
+ it('keeps the base installer install-only and marks shell-setup delegation as installer-origin', () => {
485
const installScript = readFileSync(
486
new URL('../../../../../install.sh', import.meta.url),
487
'utf8'
488
);
489
- expect(installScript).not.toContain('"$exe" install');
489
+ // Join backslash-continued lines so multi-line invocations match as one logical line.
490
+ const logicalLines = installScript.replace(/\\\n\s*/g, ' ').split('\n');
491
+ const installInvocations = logicalLines.filter(line => line.includes('"$exe" install'));
492
+
493
+ // The installer may invoke `composio install` only for the `--shell` capability probe
494
+ // and the shell-setup delegation; any other invocation would emit install analytics
495
+ // events without the installer origin attached.
496
+ const helpProbes = installInvocations.filter(line => line.includes('"$exe" install --help'));
497
+ const shellDelegations = installInvocations.filter(line =>
498
+ line.includes('"$exe" install --shell')
499
+ );
500
+ expect(helpProbes).toHaveLength(1);
501
+ expect(shellDelegations).toHaveLength(1);
502
+ expect(installInvocations).toHaveLength(2);
503
+ expect(shellDelegations[0]).toContain('COMPOSIO_CLI_INVOCATION_ORIGIN=installer');
504
505
for (const shell of ['zsh', 'bash', 'fish']) {
506
const variantScript = readFileSync(
507
new URL(`../../../../../install/${shell}.sh`, import.meta.url),
508
'utf8'
509
);
496
- const installLine = variantScript
497
- .split('\n')
498
- .find(line => line.includes('"$variant_exe" install --shell'));
499
-
500
- expect(installLine).toContain('COMPOSIO_CLI_INVOCATION_ORIGIN=installer');
510
+ // Variants never invoke the CLI themselves: they re-exec the base installer with the
511
+ // shell pinned, so the delegation asserted above stays the only CLI install call.
512
+ expect(variantScript).not.toContain('"$exe"');
513
+ expect(variantScript).not.toContain(' install --shell');
514
+ expect(variantScript).toContain('COMPOSIO_INSTALL_SHELL="$variant_shell"');
515
}
516
});
517
});