* fix(shellcheck): declare and assign separately in router.sh (SC2155) * feat(plugin): enhance context management and skill invocation - Update .context-manifest.json to include profile and detailed source information. - Revise context-scout.md to clarify context root discovery and navigation. - Modify commands to replace deprecated skills with updated ones (brainstorming → approach, systematic-debugging → debugger). - Streamline install-context.md for clarity and remove interactive profile selection. - Improve oac-status.md to provide a more comprehensive status report. - Add OAC system paths to session-start.sh for better context management. - Remove obsolete skills and improve documentation for existing commands.
6 KiB
Guide: Compatibility Layer Development Workflow
Purpose: Step-by-step process for extending the compatibility layer to support new AI coding tools
Last Updated: 2026-02-05
When to Use This Guide
- Adding support for a new AI coding tool (e.g., Codeium, GitHub Copilot)
- Extending existing adapter capabilities
- Understanding the development phases for compatibility work
Development Phases
Phase 1: Foundation ✅ COMPLETE
Objective: Set up project infrastructure and core types
-
Project Setup (1.5h) ✅
- Create
packages/compatibility-layer/package.json - Configure TypeScript with strict mode
- Set up Vitest with 80%+ coverage thresholds
- Create
-
Type System (1.5h) ✅
- Create
src/types.tswith Zod schemas - Define
OpenAgentSchema,AgentFrontmatterSchema - Export TypeScript types with
z.infer<>
- Create
-
Base Adapter (1.5h) ✅
- Create
src/adapters/BaseAdapter.tsabstract class - Define abstract methods:
toOAC(),fromOAC(),getCapabilities()
- Create
-
Agent Loader (1.5h) ✅
- Create
src/core/AgentLoader.ts - Use gray-matter for YAML frontmatter parsing
- Create
-
Adapter Registry (1h) ✅
- Create
src/core/AdapterRegistry.ts - Implement registry pattern with
Map<string, BaseAdapter>
- Create
-
Public API (1h) ✅
- Create
src/index.ts - Export all public APIs
- Create
Result: 1,475 lines TypeScript, 0 compilation errors
Phase 2: Adapter Migration ✅ COMPLETE
Objective: Migrate existing adapters to TypeScript
- Claude Adapter (3h) ✅ - 600 lines
- Cursor Adapter (3h) ✅ - 554 lines
- Windsurf Adapter (3h) ✅ - 514 lines
- ClaudeAdapter Tests ✅ - 80 tests, 96% coverage
- CursorAdapter Tests ✅ - 78 tests, 99% coverage
- WindsurfAdapter Tests ✅ - 78 tests, 99% coverage
Result: 1,858 lines TypeScript, 236 tests passing
Phase 3: Mappers & Translation ✅ COMPLETE
Objective: Implement feature mapping logic
- Tool Mapper ✅ - 308 lines, 34 tests, 100% coverage
- Permission Mapper ✅ - 354 lines, 37 tests, 98% coverage
- Model Mapper ✅ - 413 lines, 37 tests, 99% coverage
- Context Mapper ✅ - 384 lines, 51 tests, 97% coverage
- Capability Matrix ✅ - 559 lines, 43 tests, 99% coverage
- Translation Engine ✅ - 453 lines, 47 tests, 99% coverage
- Mapper Tests ✅ - 249 tests total
Result: 2,471 lines TypeScript, 249 tests passing
Phase 4: CLI Tool ⬅️ NEXT
Objective: Build command-line interface
-
CLI Scaffolding (1.5h)
- Create
src/cli/index.tswith Commander.js - Define commands: convert, validate, migrate, info
- Set up chalk for colored output, ora for spinners
- Create
-
Convert Command (2h)
- Implement
commands/convert.ts - Usage:
oac-compat convert --from oac --to claude agent.md - Support batch conversion
- Implement
-
Validate Command (1.5h)
- Implement
commands/validate.ts - Check compatibility before conversion
- Report warnings and incompatibilities
- Implement
-
Migrate Command (2h)
- Implement
commands/migrate.ts - Migrate entire projects (all agents + context)
- Generate migration report
- Implement
-
Info Command (1h)
- Implement
commands/info.ts - Show tool capabilities and feature matrices
- Display adapter list
- Implement
-
CLI Integration Tests (2h)
- Test each command end-to-end
- Test error handling
- Test output formatting
Phase 5: Documentation
Objective: Create migration guides and API docs
26-30. Migration Guides (4h total)
- docs/migration-guides/cursor-to-oac.md
- docs/migration-guides/claude-to-oac.md
- docs/migration-guides/oac-to-cursor.md
- docs/migration-guides/oac-to-claude.md
- docs/migration-guides/oac-to-windsurf.md
-
Feature Matrices (1h)
- Generate comparison tables
- Document degradation patterns
-
API Documentation (1h)
- Document programmatic API usage
- Add examples for each adapter
Adding a New Tool Adapter
Step-by-Step
-
Research Tool Format
- Study tool's configuration file structure
- Identify supported features
- Note limitations vs OAC
-
Create Adapter Class
export class NewToolAdapter extends BaseAdapter { name = 'newtool' displayName = 'New Tool' async toOAC(source: string): Promise<OpenAgent> { /* ... */ } async fromOAC(agent: OpenAgent): Promise<ConversionResult> { /* ... */ } getConfigPath(): string { /* ... */ } getCapabilities(): ToolCapabilities { /* ... */ } validateConversion(agent: OpenAgent): string[] { /* ... */ } } -
Use Existing Mappers
- ToolMapper for tool name translation
- PermissionMapper for permission translation
- ModelMapper for model ID translation
- ContextMapper for context path translation
-
Register Adapter
AdapterRegistry.register(new NewToolAdapter()) -
Write Tests (Target: 80%+ coverage)
-
Update Documentation
Success Criteria
Phase 1-3 ✅ ACHIEVED:
- All files compile without errors
- Zod schemas validate correctly
- All 3 adapters migrated to TypeScript
- Unit tests pass with 80%+ coverage
- All mappers are pure functions
- Graceful degradation works
Phase 4 (upcoming):
- CLI commands work end-to-end
- Error handling is comprehensive
- Output is user-friendly
Phase 5 (upcoming):
- Migration guides cover all tools
- API docs are complete
- Examples demonstrate usage
Reference
- Issue: https://github.com/darrenhinde/OpenAgentsControl/issues/141
- Branch:
devalexanderdaza/issue141 - Location:
packages/compatibility-layer/
Related:
- lookup/compatibility-layer-progress.md
- lookup/compatibility-layer-adapters.md
- lookup/compatibility-layer-structure.md