Skip to content

Conversation

@apraditya
Copy link
Contributor

@apraditya apraditya commented Oct 27, 2025

Summary

  • Implement complete CCR (Claude Code Router) engine following the same pattern as other engines
  • Add token-based authentication via CCR_CODE_TOKEN environment variable (no interactive setup required)
  • Create comprehensive test suite with 22 passing tests covering all CCR functionality
  • Update engine registry to include CCR alongside other engines (codex, claude, cursor)

Changes

New Files

  • src/infra/engines/providers/ccr/ - Complete CCR engine implementation
    • metadata.ts - Engine configuration
    • auth.ts - Token-based authentication
    • execution/ - Command building, execution, and running logic
  • tests/unit/infra/ccr-*.spec.ts - Comprehensive test suite

Modified Files

  • src/infra/engines/core/registry.ts - Register CCR engine
  • src/infra/engines/index.ts - Export CCR engine

Testing

  • All 22 CCR-specific tests pass
  • All existing tests continue to pass (no regressions)
  • Build process completes successfully

Usage

Users need to install the CCR CLI separately:

npm install -g @musistudio/claude-code-router

Then set the authentication token:

export CCR_CODE_TOKEN=<your-token>

The CCR engine will be available alongside other engines in the provider selection.

Assuming the CCR is setup and ready to use:

  1. run codemachine from your terminal.
  2. Inside CodeMachine, run /login and choose CCR.

- Implement CCR engine with token-based authentication
- Add CCR command execution using 'ccr code' commands
- Update engine registry to include CCR provider
- Create complete execution pipeline for CCR commands
- Support model mapping and telemetry capture for CCR

The CCR engine provides Claude Code Router integration
with the same API as Claude but using 'ccr code' instead of 'claude'
commands and token-based authentication via CCR_CODE_TOKEN.
- Add unit tests for CCR command builder functionality
- Add unit tests for CCR executor with dry-run and error handling
- Add unit tests for CCR engine runner with streaming callbacks
- Add unit tests for CCR registry integration
- All tests pass with 100% coverage of CCR functionality
@apraditya apraditya marked this pull request as draft October 27, 2025 02:15
- Add --dangerously-skip-permissions and --permission-mode bypassPermissions flags
- Update tests to reflect new command structure with bypass flags
- Make CCR engine behavior consistent with Claude engine
@moazbuilds
Copy link
Owner

Thanks for pushing this forward! I did a general pass on PR #14 and the added CCR engine looks good overall, nice work ..

Could you add a short section to the PR describing the first-time setup and usage flow for regular users using CCR inside CodeMachine?

@bahyali bahyali requested a review from moazbuilds October 29, 2025 13:04
@apraditya apraditya marked this pull request as ready for review October 31, 2025 02:52
@apraditya
Copy link
Contributor Author

Thanks for your support! I added a quick steps to use CCR inside CodeMachine.

I've been using it for some time and I don't have anything else to this PR so I marked it as ready for review.

@moazbuilds moazbuilds merged commit db10ce0 into moazbuilds:main Nov 2, 2025
@moazbuilds
Copy link
Owner

Hi, I've taken a closer look at this PR. If the token can be set to anything and isn't required for CCR code authentication, I'm confused about its purpose. I assumed the CCR code would need a token for custom setups. Can you clarify what benefit this token provides?

@moazbuilds moazbuilds added the Engine Support Integrate new AI engines (e.g., Codex, OpenCode) label Nov 8, 2025
@moazbuilds moazbuilds removed their request for review November 8, 2025 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engine Support Integrate new AI engines (e.g., Codex, OpenCode)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants