Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
ts 14 lines 742 Bytes
Raw
1 import { Effect } from 'effect';
2 import { runInvocation } from 'src/invocation/invocation';
3 import { exitCodeOf } from './exit-code';
4
5 /**
6 * Runs the CLI with `args` (no executable prefix) through the full invocation, the one the binary
7 * runs: invocation hooks, lifecycle telemetry, the command, and its failure on stderr. Fails with
8 * the command's own error, so `Effect.flip` and tag matching see it.
9 */
10 export const cli = (args: ReadonlyArray<string>) => runInvocation(['node', '<CMD>', ...args]);
11
12 /** Runs `cli(args)` and reports how it ended, with the code the process would exit with. */
13 export const cliExit = (args: ReadonlyArray<string>) =>
14 Effect.map(Effect.exit(cli(args)), exit => ({ exit, exitCode: exitCodeOf(exit) }));