From cacbc460c1cad8bf6626a4eda074f54029a5d4d0 Mon Sep 17 00:00:00 2001 From: delta-cloud-208e Date: Sat, 7 Mar 2026 10:34:12 +0000 Subject: [PATCH] docs: add Codex CLI README + update main README with Codex install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added codex/README.md with full installation, update, troubleshooting guide. Updated main README: Codex status Planned → Active (v0.111.0), added Codex install section, updated Claude/Gemini versions. Co-Authored-By: Claude Opus 4.6 --- README.md | 42 +++++++++- codex/README.md | 211 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 250 insertions(+), 3 deletions(-) mode change 100644 => 100755 README.md create mode 100644 codex/README.md diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 063e126..8699d47 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Patched AI coding tools for use with custom API endpoints. | Folder | Tool | Status | |--------|------|--------| -| [claude/](claude/) | Claude Code | Active (v2.1.63) | -| codex/ | OpenAI Codex CLI | Planned | -| [gemini/](gemini/) | Gemini CLI | **Active (v0.29.5)** | +| [claude/](claude/) | Claude Code | Active (v2.1.71) | +| [codex/](codex/) | OpenAI Codex CLI | **Active (v0.111.0)** | +| [gemini/](gemini/) | Gemini CLI | **Active (v0.32.1)** | | qwen/ | Qwen Code | Planned | | antigravity/ | Antigravity | Planned | @@ -146,6 +146,42 @@ EOF See [gemini/README.md](gemini/README.md) for Windows instructions, alternative install methods and details. +### Codex CLI — Install + +> Codex CLI is a compiled Rust binary (not npm). Install via GitHub releases. + +**Step 1 — Clone repo and install binary:** + +```bash +git clone --depth 1 https://x-token:cadffcb0a6a3be728ac1ff619bb40c86588f6837@git.sensey24.ru/aibot777/unlimitedcoding.git +cd unlimitedcoding/codex +cp codex_config.example.json codex_config.json +# Edit codex_config.json — set your base_url and api_key +``` + +**Step 2 — Install + patch:** + +```bash +sudo bash ucodex_install.sh +``` + +Or manually: +```bash +sudo bash update-codex.sh # Install/update binary +sudo python3 codex_patcher.py --apply # Apply config patches +``` + +**Step 3 — Verify:** `codex exec "Hello"` + +**Update:** +```bash +cd unlimitedcoding/codex +git pull +sudo bash update-codex.sh && sudo python3 codex_patcher.py --apply +``` + +See [codex/README.md](codex/README.md) for details, troubleshooting, and configuration. + ### Manual install from release Clone repo and run platform installer: diff --git a/codex/README.md b/codex/README.md new file mode 100644 index 0000000..5b80100 --- /dev/null +++ b/codex/README.md @@ -0,0 +1,211 @@ +# Codex CLI — Patched + +Patched OpenAI Codex CLI for use with custom API endpoints. +Latest: **v0.111.0** (6 config patches). + +> Codex CLI — это compiled Rust binary. В отличие от Claude Code и Gemini CLI (JavaScript), +> патчинг выполняется через `config.toml` + переменные окружения. + +## Установка + +### Требования + +- **Python 3.11+** (для `tomllib`) +- **curl** (для скачивания бинарника) +- **Linux x86_64 или aarch64** (macOS/Windows — вручную) + +### Быстрая установка (Linux) + +```bash +# 1. Клонировать репо (или скачать файлы) +git clone https://git.sensey24.ru/aibot777/unlimitedcoding.git +cd unlimitedcoding/codex + +# 2. Настроить конфиг — указать свой API endpoint и ключ +cp codex_config.example.json codex_config.json +nano codex_config.json # Изменить base_url и api_key + +# 3. Установить бинарник + применить патчи +sudo bash ucodex_install.sh +``` + +### Ручная установка (шаг за шагом) + +**Шаг 1 — Установить бинарник Codex CLI:** + +```bash +# Скачать последнюю версию с GitHub +sudo bash update-codex.sh +codex --version # Должно показать: codex-cli 0.111.0 +``` + +**Шаг 2 — Настроить конфиг:** + +```bash +cp codex_config.example.json codex_config.json +``` + +Отредактировать `codex_config.json`: +```json +{ + "base_url": "https://your-api-endpoint.example.com", + "api_key": "YOUR_API_KEY", + "model": "gpt-5.2-codex" +} +``` + +**Шаг 3 — Применить патчи:** + +```bash +sudo python3 codex_patcher.py --apply --config codex_config.json +``` + +Вывод: +``` +Codex CLI Patcher + Version: 0.111.0 + Binary: /usr/local/bin/codex + Proxy: https://your-api-endpoint.example.com + + [OK] Target 1: base_url configured + [OK] Target 2: codex login: ok + [OK] Target 3: analytics disabled + [OK] Target 4: approval_policy=never, sandbox=danger-full-access + [OK] Target 5: model=gpt-5.2-codex, effort=high + [OK] Target 6: Set 2 env var(s) in /etc/environment + + All patches applied successfully! +``` + +**Шаг 4 — Проверить:** + +```bash +# Validate +python3 update_codex_patcher.py --validate + +# Test +codex exec "What is 2+2? Reply with just the number" +``` + +## Обновление + +### Обновить бинарник Codex CLI + +```bash +cd unlimitedcoding/codex +sudo bash update-codex.sh +``` + +Скрипт автоматически: +- Проверяет последнюю версию на GitHub +- Скачивает musl-совместимый бинарник +- Заменяет `/usr/local/bin/codex` + +### Обновить конфиг-патчи (после обновления бинарника) + +```bash +sudo python3 codex_patcher.py --apply +``` + +### Полный автоматический цикл + +```bash +sudo python3 update_codex_patcher.py --auto +``` + +Выполняет: check → update binary → apply patches → validate → test. + +### Обновить сам патчер (новая версия скриптов) + +```bash +cd unlimitedcoding +git pull +cd codex +sudo python3 codex_patcher.py --apply +``` + +## Что патчится (6 targets) + +| # | Target | Что делает | +|---|--------|------------| +| 1 | api_endpoint | Redirect API через `[model_providers.custom]` в config.toml | +| 2 | authentication | API key auth вместо ChatGPT OAuth (`codex login --with-api-key`) | +| 3 | telemetry | Отключить analytics: `[analytics] enabled = false` | +| 4 | permissions | `approval_policy = "never"`, `sandbox_mode = "danger-full-access"` | +| 5 | model_config | Модель, reasoning effort, отключить auto-update | +| 6 | system_env | `/etc/environment`: `OPENAI_BASE_URL`, `OPENAI_API_KEY` | + +## Конфигурация + +Файл `~/.codex/config.toml` (генерируется патчером): + +```toml +model = "gpt-5.2-codex" +model_reasoning_effort = "high" +model_provider = "custom" +approval_policy = "never" +sandbox_mode = "danger-full-access" +check_for_update_on_startup = false +forced_login_method = "api" + +[analytics] +enabled = false + +[model_providers.custom] +name = "custom" +base_url = "https://your-api-endpoint.example.com/v1" +env_key = "OPENAI_API_KEY" +wire_api = "responses" +``` + +## Rollback + +Восстановить оригинальный конфиг: + +```bash +python3 codex_patcher.py --rollback +``` + +## Troubleshooting + +### "Error loading configuration: missing field `name`" +Обновите патчер (`git pull`) и перезапустите: `python3 codex_patcher.py --apply` + +### codex не запускается (segfault / GLIBC) +Скрипт `update-codex.sh` скачивает musl-версию для совместимости. Если проблема остаётся: +```bash +# Проверить бинарник +file /usr/local/bin/codex +ldd /usr/local/bin/codex # Должно быть "not a dynamic executable" (static) +``` + +### "OPENAI_API_KEY not set" +```bash +# Вариант 1: Перезайти в shell (env vars из /etc/environment) +source /etc/environment + +# Вариант 2: Установить вручную +export OPENAI_BASE_URL="https://your-endpoint/v1" +export OPENAI_API_KEY="your-key" +``` + +### Permissions промпты всё ещё появляются +Убедитесь что config.toml содержит `approval_policy = "never"`: +```bash +cat ~/.codex/config.toml | grep approval +``` + +## Структура файлов + +``` +codex/ +├── codex_patcher.py # Главный патчер (6 targets) +├── codex_config.json # Ваш конфиг (не коммитить!) +├── codex_config.example.json # Пример конфига +├── update_codex_patcher.py # Pipeline CLI +├── update-codex.sh # Бинарный updater с GitHub +├── ucodex_install.sh # One-liner installer +└── updater/ + ├── __init__.py + └── config_validator.py # Валидация 6 targets +```