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 { Effect, Layer } from 'effect'; |
| 2 | import { CommandRunner, type CommandRunnerShape } from 'src/services/command-runner'; |
| 3 | |
| 4 | /** |
| 5 | * A runner that never spawns: every command exits 0 with empty output. |
| 6 | */ |
| 7 | const exitZeroCommandRunner = CommandRunner.of({ |
| 8 | run: () => Effect.succeed(0), |
| 9 | capture: () => |
| 10 | Effect.succeed({ |
| 11 | exitCode: 0, |
| 12 | stdout: '', |
| 13 | stderr: '', |
| 14 | }), |
| 15 | }); |
| 16 | |
| 17 | /** |
| 18 | * A `CommandRunner` that answers with `runner`, or exits 0 with empty output |
| 19 | * when the test leaves it out. It never spawns a process, but its methods |
| 20 | * still require the `ChildProcessSpawner` their shape names. |
| 21 | */ |
| 22 | export const CommandRunnerTest = (runner?: CommandRunnerShape) => |
| 23 | Layer.succeed(CommandRunner, runner ?? exitZeroCommandRunner); |