diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 0000000..5044e70 --- /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 a601816..c1e68e0 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -39,6 +39,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 @@ -74,6 +75,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 c538797..712a255 100644 --- a/docker-compose.yml.dist +++ b/docker-compose.yml.dist @@ -28,6 +28,7 @@ volumes: terminal-history: claude-config: claude-state: + codex: copilot: copilot-config: opencode-config: diff --git a/docker/docoff_devcontainer/Dockerfile b/docker/docoff_devcontainer/Dockerfile index 3a44b07..36e3192 100644 --- a/docker/docoff_devcontainer/Dockerfile +++ b/docker/docoff_devcontainer/Dockerfile @@ -94,10 +94,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/docoff_devcontainer/files/etc/codex/config.toml b/docker/docoff_devcontainer/files/etc/codex/config.toml new file mode 100644 index 0000000..c4a96da --- /dev/null +++ b/docker/docoff_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/docoff_devcontainer/files/usr/local/bin/codex b/docker/docoff_devcontainer/files/usr/local/bin/codex new file mode 100644 index 0000000..4997e05 --- /dev/null +++ b/docker/docoff_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/docs/ai-integration.md b/docs/ai-integration.md index f840798..aad49ee 100644 --- a/docs/ai-integration.md +++ b/docs/ai-integration.md @@ -3,6 +3,7 @@ The `devcontainer` ships several AI coding assistants: * **Claude Code** +* **Codex** * **GitHub Copilot CLI** * **OpenCode** @@ -66,11 +67,14 @@ options. the dev server (`http://localhost:${COMPOSE_START_PORT:-8080}`) by default — start it with `npm start` inside the `devcontainer`. -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/docs/dev-environment.md b/docs/dev-environment.md index 228e9fc..e1d41cb 100644 --- a/docs/dev-environment.md +++ b/docs/dev-environment.md @@ -1,7 +1,7 @@ # Development Environment This project ships a Dockerized development environment with AI coding -assistants (Claude Code, GitHub Copilot CLI, OpenCode) pre-installed. +assistants (Claude Code, Codex, GitHub Copilot CLI, OpenCode) pre-installed. ## What the stack contains diff --git a/scripts/mcps/chrome-host/README.md b/scripts/mcps/chrome-host/README.md index 5612952..9582ed4 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 030ee7b..fb9f43f 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