feat: Major TypeScript rewrite with enhanced configuration and OAuth UI #9
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.
🎯 Overview
This PR represents a complete TypeScript rewrite of the plugin with comprehensive testing, modular architecture, and significantly enhanced user experience. The plugin now offers 9 pre-configured model variants matching Codex CLI presets and features a beautiful animated OAuth success page.
✨ What's New
🎨 Enhanced User Experience
9 Model Variants (Codex CLI Parity)
Users can now choose from pre-configured reasoning levels:
All variants appear in the opencode model selector with optimal settings for each reasoning level.
Beautiful OAuth Success Page
🏗️ Technical Improvements
TypeScript Rewrite
.mjsto.tswith strict typinganytypes - fully type-safe codebaselib/types.tsModular Architecture
lib/constants.tsComprehensive Testing
Enhanced Documentation
📦 Configuration System
Full Configuration (
config/full-opencode.json)Ready-to-use configuration with all 9 model variants. Users can copy this directly to their opencode config for the complete experience.
Features:
Minimal Configuration (
config/minimal-opencode.json)Simple setup for users who want basic functionality with plugin defaults.
📊 Changes by Category
New Files (Major Additions)
Configuration & Docs:
config/full-opencode.json- Complete configuration exampleconfig/minimal-opencode.json- Minimal configuration exampleconfig/README.md- Configuration documentationAGENTS.md- AI maintenance guide (568 lines)assets/opencode-logo-ornate-dark.svg- Branding assetCore TypeScript:
index.ts- Main plugin entry (from index.mjs)lib/types.ts- Comprehensive type definitionslib/constants.ts- Centralized constantslib/fetch-helpers.ts- 10 focused helper functionslib/browser.ts- Platform-specific browser openinglib/oauth-success.html- Animated OAuth success page (22KB)Testing:
test/auth.test.ts- 16 tests for OAuth logictest/browser.test.ts- 4 tests for platform detectiontest/config.test.ts- 13 tests for configurationtest/fetch-helpers.test.ts- 15 tests for helperstest/logger.test.ts- 5 tests for loggingtest/request-transformer.test.ts- 30 tests for transformationstest/response-handler.test.ts- 10 tests for SSE conversiontest/README.md- Testing documentationvitest.config.ts- Vitest configurationCI/CD:
.github/workflows/ci.yml- GitHub Actions workflowBuild:
tsconfig.json- TypeScript configurationModified Files
Core:
package.json- Updated scripts, added devDependencies for TypeScript/Vitest.gitignore- Added TypeScript build artifactsRenamed (.mjs → .ts):
lib/auth.ts(from auth.mjs)lib/codex.ts(from codex.mjs)lib/logger.ts(from logger.mjs)lib/request-transformer.ts(from request-transformer.mjs)lib/response-handler.ts(from response-handler.mjs)lib/server.ts(from server.mjs)Documentation:
README.md- Major updates with new configuration instructionsDeleted Files
index.mjs- Replaced byindex.tstest-config.json- Replaced by proper config examplestest-config.mjs- No longer needed🔍 Key Implementation Details
Configuration Lookup
The plugin now properly looks up configuration by model name:
Model names like "GPT 5 Codex Low (ChatGPT Subscription)" are used for UI selection, and the
idfield determines which base model is used (gpt-5-codexorgpt-5).OAuth Success Flow
When users complete OAuth:
oauth-success.htmlat startupBuild Process
npm run build # Compiles TypeScript + copies HTML to dist/The build process:
dist/oauth-success.htmltodist/lib/Testing Strategy
Tests cover:
📈 Impact
For Users
For Developers
For the Plugin
🧪 Testing Performed
🚀 Migration Guide
For Existing Users
Option 1: Full Configuration (Recommended)
Copy
config/full-opencode.jsonto your opencode config for all 9 model variants.Option 2: Minimal Configuration
Continue with minimal config - plugin defaults unchanged (medium/auto/medium).
Build Requirement
If using local development, rebuild after pulling:
📸 Screenshots
OAuth Success Page
Configuration Structure
{ "provider": { "openai": { "options": { /* defaults */ }, "models": { "GPT 5 Codex Low (ChatGPT Subscription)": { "id": "gpt-5-codex", "options": { "reasoningEffort": "low" } } // ... 8 more variants } } } }🎯 Next Steps
After merging:
📝 Notes
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]