Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
refactor(cli): extract the setup and command runner doubles from the test layer (#4927)
This PR: - moves the `CommandRunner` double out of `test/__utils__/services/test-layer.ts` into `test/__utils__/layers/command-runner.ts`: `CommandRunnerTest(runner?)` answers with the runner the test passes, or exits 0 with empty output (`run` and `capture`) without spawning - moves the `SetupSkillInstaller` double into `test/__utils__/layers/setup.ts`: `SetupSkillInstallerTest(installer?)` answers with the installer the test passes, or the no-op one whose four effects answer `false` however often they run - adds `SetupTest({ commandRunner?, setupSkillInstaller? })` in the same file, the two layers merged, for handler tests of `setup` (U7) that need nothing else from `TestLive` - keeps `TestLive(input)` unchanged: `TestLiveInput`'s `commandRunner` and `setupSkillInstaller` keep their types and docs, and `TestLive` composes `CommandRunnerTest(input?.commandRunner)` and `SetupSkillInstallerTest(input?.setupSkillInstaller)` where the two inline layers were - exports `CommandRunnerTest` and `SetupTest` from `test/__utils__` - extends `test/src/services/test-layer.test.ts` with eight cases: the standalone layer and `TestLive` give the same default and override answers for the runner and the installer, and the runner doubles never reach a `ChildProcessSpawner` that dies on use ## Context Unit U3 of the command-layout series (KTD5), third family: setup and the command runner, which `setup` and `install` (U7) rely on. The moved bodies are unchanged; the two defaults are module constants now instead of being rebuilt per `TestLive` call, which changes nothing because they hold only `Effect.succeed` values. No suite under `test/src/commands/` changes. `test-layer.ts` goes from 1167 to 1139 lines. The runner gets its own file because `generate` and `run` also use `CommandRunner`, so it is not part of the setup family alone. `install` needs neither service: it reads `NodeOs`, `NodeProcess`, `FileSystem`, `Path`, `TerminalUI`, and `ComposioCliUserConfig`. The `NodeOs`/`NodeProcess` doubles depend on the per-test home directory and fixture copy that `TestLive` builds, so they stay in place until a host family moves them. U7's planned `src/services/shell-config.ts` does not exist yet, so there is no shell double to extract. `SetupSkillInstallerShape` is derived from the real installer (`Effect.Success<typeof makeSetupSkillInstaller>`), so its effects still name `FileSystem`, `Path`, `HttpClient`, `NodeOs`, and `TerminalUI` as requirements even when a double reads none of them. A test that provides `SetupTest` alone has to provide those too (the new cases do). Narrowing the shape would change `src/`, so this PR leaves it alone. ## Verification On the branch tip (`894b93535`): - `pnpm typecheck`: 14/14 tasks, `@composio/cli:typecheck` a cache miss (src and test configs) - `pnpm --filter @composio/cli test`: 156 files, 1862 passed, 1 skipped (the eight new cases included); `validate:command-tests` at 16 exemptions, unchanged - `pnpm --filter @composio/cli run lint:effect`: 0 errors, 0 warnings - `oxlint` and `prettier --check` clean on every touched file