diff --git a/.github/workflows/codex-plugin.yml b/.github/workflows/codex-plugin.yml new file mode 100644 index 0000000..58bb702 --- /dev/null +++ b/.github/workflows/codex-plugin.yml @@ -0,0 +1,25 @@ +name: Codex loads the plugin + +on: + pull_request: + push: + branches: [main] + schedule: + # Weekly against the latest Codex, which can stop reading a file we haven't changed. + - cron: '17 6 * * 1' + workflow_dispatch: + +permissions: + contents: read + +jobs: + codex-loads-mcp: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - run: npm install -g @openai/codex@latest + - run: bash scripts/check-codex-loads.sh diff --git a/README.md b/README.md index e38d684..e19a3bd 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,16 @@ The plugin directory takes the plugin folder as a ZIP: cd plugins/devtune && zip -r ../../devtune-plugin.zip . -x '.*' ``` +## Check that Codex loads it + +CI installs the plugin into an empty Codex home and fails unless Codex loads +the DevTune MCP server. Run the same check locally with `codex` and `jq` +installed: + +```bash +scripts/check-codex-loads.sh +``` + ## License MIT. See [LICENSE.md](./LICENSE.md). diff --git a/scripts/check-codex-loads.sh b/scripts/check-codex-loads.sh new file mode 100755 index 0000000..957bee5 --- /dev/null +++ b/scripts/check-codex-loads.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Installs the DevTune plugin from this checkout into an empty Codex home and +# fails unless Codex loads its MCP server at the URL in plugins/devtune/mcp.json. +# Codex drops a server it can't parse and still installs the plugin's skills, so +# a successful install alone proves nothing. +# Usage: scripts/check-codex-loads.sh (needs codex and jq on PATH) +set -euo pipefail + +repo=$(cd "$(dirname "$0")/.." && pwd) +want=$(jq -r '.mcpServers.devtune.url' "$repo/plugins/devtune/mcp.json") +CODEX_HOME=$(mktemp -d "${RUNNER_TEMP:-${TMPDIR:-/tmp}}/codex-home.XXXXXX") +export CODEX_HOME +trap 'rm -rf "$CODEX_HOME"' EXIT + +codex --version +codex plugin marketplace add "$repo" +codex plugin add devtune@devtune-plugins + +servers=$(codex mcp list --json) +got=$(jq -r '.[] | select(.name == "devtune" and .enabled) | .transport.url' <<<"$servers") + +if [[ "$got" != "$want" ]]; then + echo "Codex did not load the devtune MCP server (want $want, got '${got}')." >&2 + echo "codex mcp list --json:" >&2 + echo "$servers" >&2 + exit 1 +fi +echo "Codex loads the devtune MCP server: $got"