(self, environment: BaseEnvironment)
| 109 | |
| 110 | @property |
| 111 | def _install_agent_template_path(self) -> Path: |
| 112 | return Path(__file__).parent / "install-opencode.sh.j2" |
| 113 | |
| 114 | @staticmethod |
| 115 | def name() -> str: |
| 116 | return "opencode-adapter" |
| 117 | |
| 118 | async def install(self, environment: BaseEnvironment) -> None: |
| 119 | # OpenCode is pre-installed in the Docker image via NVM. |
| 120 | # Verify it's accessible; if not, install it. |
| 121 | result = await environment.exec( |
| 122 | command='export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; command -v opencode', |
| 123 | ) |
| 124 | if result.return_code != 0: |
| 125 | await self.exec_as_agent( |
| 126 | environment, |
| 127 | command=( |
| 128 | "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash && " |
| 129 | 'export NVM_DIR="$HOME/.nvm" && ' |
| 130 | '. "$NVM_DIR/nvm.sh" && ' |
nothing calls this directly
no test coverage detected