Skip to content

v2.0.0 - TypeScript Rewrite + CODEX_MODE

Choose a tag to compare

@numman-ali numman-ali released this 03 Oct 21:36
· 38 commits to main since this release

🚀 Version 2.0.0 - Major Release

This major release includes a complete TypeScript rewrite with enhanced configuration, CODEX_MODE for better Codex CLI parity, and comprehensive library reorganization.

✨ Highlights

🎯 CODEX_MODE (PR #10)

New configurable mode for better Codex CLI compatibility

  • Enabled by default - Provides optimal Codex CLI experience out of the box
  • Bridge Prompt - ~450 tokens (~90% reduction vs full OpenCode prompt)
  • Configurable - Via ~/.opencode/openai-codex-auth-config.json or CODEX_MODE env var
  • Smart Tool Mapping - Critical tool replacements, verification checklist, working style guidelines

Configuration:

{
  "codexMode": true  // default
}

Environment Override:

CODEX_MODE=0 opencode run "task"  # Disable temporarily
CODEX_MODE=1 opencode run "task"  # Enable temporarily

🔄 Complete TypeScript Rewrite (PR #9)

Modern, type-safe, well-tested codebase

  • Strict TypeScript - Full type safety with comprehensive type definitions
  • 123 Tests - Comprehensive test coverage (up from 0)
  • Modular Architecture - 10 focused helper functions, semantic folder structure
  • Enhanced Configuration - User-configurable reasoning, summaries, and verbosity
  • Animated OAuth UI - Beautiful success page with matrix rain effects

📦 What's New

CODEX_MODE Features

  • ✅ Codex-OpenCode bridge prompt for CLI parity
  • ✅ Configurable via config file or environment variable
  • ✅ Priority: env var > config file > default (true)
  • ✅ OpenCode system prompt filtering
  • ✅ Tool name confusion prevention

TypeScript Rewrite

  • ✅ Complete migration from .mjs to .ts
  • ✅ Strict type checking with comprehensive interfaces
  • ✅ 123 comprehensive tests with Vitest
  • ✅ Modular helper functions (all < 40 lines)
  • ✅ Enhanced error handling and logging

Enhanced Configuration

  • 9 pre-configured model variants matching Codex CLI
  • User-configurable reasoning - effort, summary, verbosity
  • Provider-level and model-level options - Fine-grained control
  • Plugin configuration support - ~/.opencode/openai-codex-auth-config.json

Improved OAuth Flow

  • ✅ Animated OAuth success page with matrix rain
  • ✅ Better error handling and user feedback
  • ✅ Automatic token refresh

📁 Library Reorganization

lib/
├── auth/              # OAuth authentication
│   ├── auth.ts
│   ├── browser.ts
│   └── server.ts
├── prompts/           # System prompts
│   ├── codex.ts
│   └── codex-opencode-bridge.ts
├── request/           # Request handling
│   ├── fetch-helpers.ts
│   ├── request-transformer.ts
│   └── response-handler.ts
├── config.ts          # Plugin configuration
├── constants.ts
├── logger.ts
├── types.ts
└── oauth-success.html

🧪 Testing

  • 123 total tests (all passing ✅)
  • 8 test files covering all functionality
  • 12 new tests for CODEX_MODE configuration
  • Zero test regressions

Test suites:

  • ✅ Authentication & OAuth
  • ✅ Browser utilities
  • ✅ Configuration parsing
  • ✅ Plugin configuration
  • ✅ Fetch helpers
  • ✅ Logger
  • ✅ Request transformation
  • ✅ Response handling

📚 Documentation

README Updates

  • ✅ Complete rewrite with better organization
  • ✅ Plugin configuration section
  • ✅ CODEX_MODE documentation
  • ✅ Installation guide (full vs minimal config)
  • ✅ Configuration examples
  • ✅ Model variants table
  • ✅ Troubleshooting guide

Configuration Files

  • config/full-opencode.json - 9 model variants (recommended)
  • config/minimal-opencode.json - Minimal setup
  • config/README.md - Configuration guide

🔧 Configuration

Recommended: Full Configuration

For the complete experience with all reasoning variants:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-openai-codex-auth"],
  "model": "openai/gpt-5-codex",
  "provider": {
    "openai": {
      "options": {
        "reasoningEffort": "medium",
        "reasoningSummary": "auto",
        "textVerbosity": "medium",
        "include": ["reasoning.encrypted_content"]
      },
      "models": {
        "GPT 5 Codex Low": { ... },
        "GPT 5 Codex Medium": { ... },
        "GPT 5 Codex High": { ... },
        // + 6 more variants
      }
    }
  }
}

See config/full-opencode.json for complete configuration.

Plugin Configuration

Create ~/.opencode/openai-codex-auth-config.json:

{
  "codexMode": true
}

⚠️ Breaking Changes

CODEX_MODE Enabled by Default

  • Impact: Users now get the Codex-OpenCode bridge prompt instead of tool remap message
  • Benefit: Better Codex CLI parity, fewer tool confusion errors
  • Migration: No action needed - works better by default
    • To disable: Set { "codexMode": false } in config file
    • Or use CODEX_MODE=0 environment variable

TypeScript Migration

  • Impact: Distributed files are now .js (compiled from .ts) instead of .mjs
  • Benefit: Better IDE support, type safety, source maps
  • Migration: No action needed - imports remain compatible

Node.js 20+ Required

  • Impact: Requires Node.js >= 20.0.0
  • Benefit: Better performance, modern features
  • Migration: Upgrade Node.js if using older version

📊 Stats

  • 19 files changed (+717, -35)
  • 123 tests (all passing)
  • 2 major PRs (#9, #10)
  • ~450 token bridge prompt (90% reduction)
  • 9 model variants in full config

🙏 Credits

Built with ❤️ using Claude Code

📝 Upgrade Notes

From v1.0.x

  1. Update plugin reference:

    {
      "plugin": ["[email protected]"]
    }
  2. Optional - Use full configuration:

  3. Optional - Configure CODEX_MODE:

    • CODEX_MODE is enabled by default (recommended)
    • To disable: Create ~/.opencode/openai-codex-auth-config.json with { "codexMode": false }
  4. Verify Node.js version:

    node --version  # Should be >= 20.0.0

🔗 Links


Full Changelog: v1.0.4...v2.0.0