diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 000000000..5044e70c3 --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,7 @@ +# Codex reads this project configuration only after you trust the project. +# Codex reads project instructions from `AGENTS.md` by default. This project keeps them in `CLAUDE.md`. +project_doc_fallback_filenames = ["CLAUDE.md"] + +[mcp_servers.chrome-host] +command = "sh" +args = ["scripts/mcps/chrome-host/mcp-entry.sh"] diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 41d225068..21372ff3d 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -41,6 +41,7 @@ services: - terminal-history:/home/developer/.terminal_history - claude-config:/home/developer/.config/claude - claude-state:/home/developer/.local/state/claude + - codex:/home/developer/.codex - copilot:/home/developer/.copilot - copilot-config:/home/developer/.config/copilot - opencode-config:/home/developer/.config/opencode @@ -86,6 +87,7 @@ volumes: terminal-history: claude-config: claude-state: + codex: copilot: copilot-config: opencode-config: diff --git a/docker-compose.yml.dist b/docker-compose.yml.dist index 1fa6346a1..d2aa7eb04 100644 --- a/docker-compose.yml.dist +++ b/docker-compose.yml.dist @@ -34,6 +34,7 @@ volumes: terminal-history: claude-config: claude-state: + codex: copilot: copilot-config: opencode-config: diff --git a/docker/react_ui_devcontainer/Dockerfile b/docker/react_ui_devcontainer/Dockerfile index b3f48f14b..0bd1ea612 100644 --- a/docker/react_ui_devcontainer/Dockerfile +++ b/docker/react_ui_devcontainer/Dockerfile @@ -91,10 +91,23 @@ RUN curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path # * RUN curl -fsSL https://gh.io/copilot-install | PREFIX="$HOME/.local" bash +# Install Codex CLI +# The standalone native build lives outside the Codex data directory (`~/.codex`), so the `codex` +# volume holds only data. Run `codex update` to update the binary. +ARG CODEX_VERSION=0.167.1 +RUN mkdir -p "$HOME/.codex" && \ + export PATH="$HOME/.local/bin:$PATH" && \ + curl -fsSL https://chatgpt.com/codex/install.sh | \ + CODEX_HOME="$HOME/.local/share/codex-install" CODEX_NON_INTERACTIVE=1 CODEX_RELEASE="${CODEX_VERSION}" sh && \ + rm -rf "$HOME/.local/share/codex-install/tmp" +# Run Codex without its own sandbox, which does not work in the container (see the file) +COPY files/etc/codex/config.toml /etc/codex/config.toml + # Wrapper scripts for AI coding assistants ensure they are available in PATH # and handle necessary environment variable setup COPY --chmod=+x files/usr/local/bin/copilot /usr/local/bin/copilot COPY --chmod=+x files/usr/local/bin/claude /usr/local/bin/claude +COPY --chmod=+x files/usr/local/bin/codex /usr/local/bin/codex COPY --chmod=+x files/usr/local/bin/opencode /usr/local/bin/opencode COPY --chmod=+x files/usr/local/bin/docker-entrypoint /usr/local/bin/docker-entrypoint COPY --chmod=+x files/home/$USERNAME/shell-init.sh ${HOME}/shell-init.sh diff --git a/docker/react_ui_devcontainer/files/etc/codex/config.toml b/docker/react_ui_devcontainer/files/etc/codex/config.toml new file mode 100644 index 000000000..c4a96da88 --- /dev/null +++ b/docker/react_ui_devcontainer/files/etc/codex/config.toml @@ -0,0 +1,6 @@ +# System-wide Codex configuration for the `devcontainer`. +# Codex's Linux sandbox needs user namespaces, which Docker blocks by default. Commands that run in +# other containers through Docker-from-Docker also need `sudo` and the Docker socket. Codex therefore +# runs commands without its own sandbox and the container isolates them. User and project +# configuration can override this. +sandbox_mode = "danger-full-access" diff --git a/docker/react_ui_devcontainer/files/usr/local/bin/codex b/docker/react_ui_devcontainer/files/usr/local/bin/codex new file mode 100644 index 000000000..4997e051b --- /dev/null +++ b/docker/react_ui_devcontainer/files/usr/local/bin/codex @@ -0,0 +1,11 @@ +#!/bin/sh + +# The Codex binary lives outside its data directory (`~/.codex`), so it belongs to the image, not the volume. +# The standalone updater needs the installation directory in `CODEX_HOME`. Appending `~/.local/bin` to PATH +# (lowest priority) lets the updater find the binary there without modifying shell profiles. +if [ "${1:-}" = "update" ]; then + CODEX_HOME="/home/developer/.local/share/codex-install" PATH="$PATH:/home/developer/.local/bin" \ + exec /home/developer/.local/bin/codex "$@" +fi + +exec /home/developer/.local/bin/codex "$@" diff --git a/scripts/mcps/chrome-host/README.md b/scripts/mcps/chrome-host/README.md index 56129520f..9582ed4ee 100644 --- a/scripts/mcps/chrome-host/README.md +++ b/scripts/mcps/chrome-host/README.md @@ -55,6 +55,15 @@ works — point its config at the script. } ``` +**Codex** — `.codex/config.toml` (repo root, applied once the project is +trusted): + +```toml +[mcp_servers.chrome-host] +command = "sh" +args = ["scripts/mcps/chrome-host/mcp-entry.sh"] +``` + **OpenCode** — `opencode.json` (repo root): ```json diff --git a/scripts/mcps/chrome-host/mcp-entry.sh b/scripts/mcps/chrome-host/mcp-entry.sh index 030ee7b74..fb9f43fa6 100755 --- a/scripts/mcps/chrome-host/mcp-entry.sh +++ b/scripts/mcps/chrome-host/mcp-entry.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Referenced by .mcp.json / opencode.json as the `chrome-host` MCP server command. +# Referenced by .mcp.json / .codex/config.toml / opencode.json as the `chrome-host` MCP server command. # # Spawns chrome-devtools-mcp inside the node container (via mcp-launch.sh), # whether the assistant runs in the devcontainer or on the host. Docker needs diff --git a/src/docs/contribute/ai-integration.md b/src/docs/contribute/ai-integration.md index edea31a08..a2b3ae6cf 100644 --- a/src/docs/contribute/ai-integration.md +++ b/src/docs/contribute/ai-integration.md @@ -4,6 +4,7 @@ The `devcontainer` ships several AI coding assistants (see [General Guidelines](./general-guidelines.md#what-the-devcontainer-contains)): * **Claude Code** +* **Codex** * **GitHub Copilot CLI** * **OpenCode** @@ -69,11 +70,14 @@ through Docker Compose). See `.env.dist` for the available options. A dedicated browser window opens using a throwaway profile, so your everyday browser and its logins are untouched. The command is safe to re-run. -2. **Trust the project's MCP servers.** All three assistants are pre-configured - in the repository. Each asks you once, on first run, to trust the project's - MCP servers — approve it. +2. **Trust the project's MCP servers.** All four assistants are pre-configured + in the repository. Each asks you once, on first run, to trust the project + or its MCP servers — approve it. * **Claude** and **GitHub Copilot CLI** read the project's `.mcp.json`. + * **Codex** reads the project's `.codex/config.toml` once you trust the + project. The file also points Codex to the project instructions in + `CLAUDE.md`. * **OpenCode** reads the project's `opencode.json`. 3. **Use it.** The assistant can now navigate, click, screenshot, and inspect diff --git a/src/docs/contribute/general-guidelines.md b/src/docs/contribute/general-guidelines.md index 9f3dd8a83..2b315155c 100644 --- a/src/docs/contribute/general-guidelines.md +++ b/src/docs/contribute/general-guidelines.md @@ -144,7 +144,7 @@ by wrapping commands to run in the appropriate service containers. * **Shells:** Bash, Zsh (with Oh My Zsh), Fish * **Editors:** Vim, Nano * **Tools:** Git, SSH client, Docker CLI (Docker-from-Docker) -* **AI coding assistants:** Claude Code, GitHub Copilot CLI, Open Code +* **AI coding assistants:** Claude Code, Codex, GitHub Copilot CLI, Open Code #### Local Layer (`react-ui_devcontainer_local`)