feat: Add CODEX_MODE with bridge prompt and reorganize lib/ structure #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces CODEX_MODE - a configurable system that replaces OpenCode's default system prompt with a specialized Codex-OpenCode bridge prompt for better Codex CLI parity. It also reorganizes the
lib/folder structure into semantic subfolders for improved maintainability.Key Changes
🎯 CODEX_MODE Implementation
What is CODEX_MODE?
Bridge Prompt Features:
Configuration:
Users can configure via
~/.opencode/openai-codex-auth-config.json:{ "codexMode": true // default }Priority Order:
CODEX_MODEenvironment variable (0 or 1)Examples:
📁 Library Reorganization
Restructured
lib/into semantic subfolders:Benefits:
Files Changed
New Files
lib/config.ts- Plugin configuration loading with graceful error handlinglib/prompts/codex-opencode-bridge.ts- Bridge prompt with metadatatest/plugin-config.test.ts- 12 comprehensive tests for config loadingModified Files
lib/request/request-transformer.ts- AddedcodexModeparameterlib/request/fetch-helpers.ts- Pass codexMode through transformation pipelineindex.ts- Load plugin config and determine effective codexModelib/types.ts- AddedPluginConfiginterfaceREADME.md- Comprehensive CODEX_MODE documentationReorganized Files
All files in
lib/moved to semantic subfolders:lib/auth/lib/prompts/lib/request/Testing
Test Coverage
New Tests (test/plugin-config.test.ts)
getCodexMode()priority orderUpdated Tests (test/request-transformer.test.ts)
Documentation
README.md Updates
Code Documentation
Behavior Changes
CODEX_MODE is now ENABLED by default (previously there was no CODEX_MODE)
Impact:
Migration:
~/.opencode/openai-codex-auth-config.jsonwith{ "codexMode": false }CODEX_MODE=0environment variableImplementation Details
Configuration Loading Flow
~/.opencode/openai-codex-auth-config.jsonexistsCODEX_MODEenvironment variableRequest Transformation Flow
getCodexMode()transformRequestForCodex()codexMode=true:codexMode=false:Benefits
For Users
For Developers
Related Issues
Closes #[issue_number] (if applicable)
Checklist
Screenshots
N/A - Backend/configuration changes only
🤖 Generated with Claude Code