Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { layer } from '@effect/vitest'; |
| 2 | import { Effect } from 'effect'; |
| 3 | import { describe, expect, it } from 'vitest'; |
| 4 | import { buildRootCommand } from 'src/commands'; |
| 5 | import { cli, MockConsole, TestLive } from 'test/__utils__'; |
| 6 | |
| 7 | const rootNames = (experimental: boolean) => |
| 8 | buildRootCommand({ |
| 9 | isDevModeEnabled: true, |
| 10 | isExperimentalFeatureEnabled: () => experimental, |
| 11 | }).subcommands.flatMap(group => group.commands.map(cmd => cmd.name)); |
| 12 | |
| 13 | describe('CLI experimental feature visibility', () => { |
| 14 | it('keeps experimental commands out of the stable command tree', () => { |
| 15 | expect(rootNames(false)).not.toContain('listen'); |
| 16 | expect(rootNames(true)).toContain('listen'); |
| 17 | }); |
| 18 | |
| 19 | describe.each([ |
| 20 | { listen: false, helpAlias: 'Failure' }, |
| 21 | { listen: true, helpAlias: 'Success' }, |
| 22 | ])('listen=$listen', ({ listen, helpAlias }) => { |
| 23 | layer(TestLive({ cliUserConfig: { experimentalFeatures: { listen } } }))(it => { |
| 24 | it.effect('uses the same visibility for root help and help aliases', () => |
| 25 | Effect.gen(function* () { |
| 26 | yield* cli(['--help']); |
| 27 | const output = (yield* MockConsole.getLines({ stripAnsi: true, stream: 'stdout' })).join( |
| 28 | '\n' |
| 29 | ); |
| 30 | expect(output.includes('listen')).toBe(listen); |
| 31 | const result = yield* Effect.result(cli(['help', 'listen'])); |
| 32 | expect(result._tag).toBe(helpAlias); |
| 33 | }) |
| 34 | ); |
| 35 | }); |
| 36 | }); |
| 37 | }); |