@halilertekin/claude-code-router-config 1.3.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -4
- package/NPM_README.md +15 -8
- package/README.md +22 -18
- package/cli/commands.js +257 -145
- package/config/config.json +4 -3
- package/config/glm-only.json +1 -1
- package/config/intent-router.js +1 -2
- package/docs/AGENTSKILLS_INTEGRATION.md +3 -4
- package/docs/AGENTSKILLS_SETUP.md +7 -11
- package/docs/AGENTSKILLS_SETUP_TR.md +7 -11
- package/docs/FULL_DOCUMENTATION.md +7 -12
- package/docs/FULL_DOCUMENTATION_EN.md +7 -12
- package/docs/HOMEBREW_SETUP.md +4 -7
- package/docs/README_EN.md +4 -3
- package/docs/SETUP_PROMPT.md +9 -9
- package/docs/SETUP_PROMPT_EN.md +9 -9
- package/docs/v1.1.0-FEATURES.md +2 -3
- package/install.js +45 -48
- package/install.sh +3 -6
- package/package.json +4 -4
- package/setup-glm.sh +13 -2
- package/templates/balanced.json +1 -1
- package/templates/cost-optimized.json +1 -1
- package/templates/development.json +1 -1
- package/templates/performance-optimized.json +1 -1
- package/templates/quality-focused.json +1 -1
|
@@ -27,12 +27,11 @@ Edit `~/.claude-code-router/config.json` and add the AgentSkills provider:
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
29
|
"_comment": "Claude Code Router Configuration with AgentSkills Integration",
|
|
30
|
-
"_attribution": "Original project: https://github.com/musistudio/claude-code-router",
|
|
31
30
|
"_author": "Configuration by Halil Ertekin",
|
|
32
31
|
"LOG": true,
|
|
33
32
|
"LOG_LEVEL": "info",
|
|
34
33
|
"API_TIMEOUT_MS": 300000,
|
|
35
|
-
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
|
|
34
|
+
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/smart-intent-router.js",
|
|
36
35
|
|
|
37
36
|
"Providers": [
|
|
38
37
|
{
|
|
@@ -110,18 +109,16 @@ EOF
|
|
|
110
109
|
|
|
111
110
|
```bash
|
|
112
111
|
# Backup current router
|
|
113
|
-
cp ~/.claude-code-router/intent-router.js ~/.claude-code-router/intent-router.js.backup
|
|
112
|
+
cp ~/.claude-code-router/smart-intent-router.js ~/.claude-code-router/smart-intent-router.js.backup
|
|
114
113
|
```
|
|
115
114
|
|
|
116
|
-
Create a new enhanced intent router at `~/.claude-code-router/intent-router.js`:
|
|
115
|
+
Create a new enhanced intent router at `~/.claude-code-router/smart-intent-router.js`:
|
|
117
116
|
|
|
118
117
|
```javascript
|
|
119
118
|
/**
|
|
120
119
|
* Multi-Provider Intent Router with AgentSkills Integration
|
|
121
120
|
* Routes requests based on task type and skill requirements to optimal provider
|
|
122
121
|
*
|
|
123
|
-
* This router is designed for use with @musistudio/claude-code-router
|
|
124
|
-
* Original project: https://github.com/musistudio/claude-code-router
|
|
125
122
|
*
|
|
126
123
|
* Enhanced with AgentSkills support by Halil Ertekin
|
|
127
124
|
*/
|
|
@@ -593,7 +590,7 @@ source ~/.zshrc
|
|
|
593
590
|
# Test SuperClaude command detection
|
|
594
591
|
echo "Testing skill detection..."
|
|
595
592
|
node -e "
|
|
596
|
-
const router = require('$HOME/.claude-code-router/intent-router.js');
|
|
593
|
+
const router = require('$HOME/.claude-code-router/smart-intent-router.js');
|
|
597
594
|
const mockReq = {
|
|
598
595
|
body: {
|
|
599
596
|
messages: [{ role: 'user', content: '/sc:business-panel analyze our competitive position' }]
|
|
@@ -692,10 +689,10 @@ setInterval(() => {
|
|
|
692
689
|
2. **Router not using AgentSkills**
|
|
693
690
|
```bash
|
|
694
691
|
# Check intent router syntax
|
|
695
|
-
node -c ~/.claude-code-router/intent-router.js
|
|
692
|
+
node -c ~/.claude-code-router/smart-intent-router.js
|
|
696
693
|
|
|
697
694
|
# Test routing manually
|
|
698
|
-
node -e "console.log(require('./intent-router.js').detectIntent('/sc:business-panel test'))"
|
|
695
|
+
node -e "console.log(require('./smart-intent-router.js').detectIntent('/sc:business-panel test'))"
|
|
699
696
|
```
|
|
700
697
|
|
|
701
698
|
3. **Skill files not found**
|
|
@@ -738,6 +735,5 @@ ccr code --verbose
|
|
|
738
735
|
## Attribution
|
|
739
736
|
|
|
740
737
|
This setup guide is for the [claude-code-router-config](https://github.com/halilertekin/CC-RouterMultiProvider) project.
|
|
741
|
-
Original project: https://github.com/musistudio/claude-code-router
|
|
742
738
|
AgentSkills: https://github.com/agentskills/agentskills
|
|
743
|
-
Guide by Halil Ertekin
|
|
739
|
+
Guide by Halil Ertekin
|
|
@@ -27,12 +27,11 @@ cp ~/.claude-code-router/config.json ~/.claude-code-router/config.json.backup
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
29
|
"_comment": "AgentSkills Entegrasyonlu Claude Code Router Yapılandırması",
|
|
30
|
-
"_attribution": "Orijinal proje: https://github.com/musistudio/claude-code-router",
|
|
31
30
|
"_author": "Yapılandırma: Halil Ertekin",
|
|
32
31
|
"LOG": true,
|
|
33
32
|
"LOG_LEVEL": "info",
|
|
34
33
|
"API_TIMEOUT_MS": 300000,
|
|
35
|
-
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
|
|
34
|
+
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/smart-intent-router.js",
|
|
36
35
|
|
|
37
36
|
"Providers": [
|
|
38
37
|
{
|
|
@@ -110,18 +109,16 @@ EOF
|
|
|
110
109
|
|
|
111
110
|
```bash
|
|
112
111
|
# Mevcut router'ı yedekle
|
|
113
|
-
cp ~/.claude-code-router/intent-router.js ~/.claude-code-router/intent-router.js.backup
|
|
112
|
+
cp ~/.claude-code-router/smart-intent-router.js ~/.claude-code-router/smart-intent-router.js.backup
|
|
114
113
|
```
|
|
115
114
|
|
|
116
|
-
`~/.claude-code-router/intent-router.js` dosyasında yeni gelişmiş intent router oluşturun:
|
|
115
|
+
`~/.claude-code-router/smart-intent-router.js` dosyasında yeni gelişmiş intent router oluşturun:
|
|
117
116
|
|
|
118
117
|
```javascript
|
|
119
118
|
/**
|
|
120
119
|
* AgentSkills Entegrasyonlu Çoklu Sağlayıcı Intent Router
|
|
121
120
|
- İsteğin görev türüne ve beceri gereksinimlerine göre optimal sağlayıcıya yönlendirme
|
|
122
121
|
*
|
|
123
|
-
* Bu router @musistudio/claude-code-router ile kullanım için tasarlanmıştır
|
|
124
|
-
* Orijinal proje: https://github.com/musistudio/claude-code-router
|
|
125
122
|
*
|
|
126
123
|
* AgentSkills desteği ile geliştiren: Halil Ertekin
|
|
127
124
|
*/
|
|
@@ -586,7 +583,7 @@ source ~/.zshrc
|
|
|
586
583
|
# SuperClaude komut tespitini test et
|
|
587
584
|
echo "Beceri tespiti test ediliyor..."
|
|
588
585
|
node -e "
|
|
589
|
-
const router = require('$HOME/.claude-code-router/intent-router.js');
|
|
586
|
+
const router = require('$HOME/.claude-code-router/smart-intent-router.js');
|
|
590
587
|
const mockReq = {
|
|
591
588
|
body: {
|
|
592
589
|
messages: [{ role: 'user', content: '/sc:business-panel rekabet konumumuzu analiz edin' }]
|
|
@@ -685,10 +682,10 @@ setInterval(() => {
|
|
|
685
682
|
2. **Router AgentSkills kullanmıyor**
|
|
686
683
|
```bash
|
|
687
684
|
# Intent router sözdizimini kontrol et
|
|
688
|
-
node -c ~/.claude-code-router/intent-router.js
|
|
685
|
+
node -c ~/.claude-code-router/smart-intent-router.js
|
|
689
686
|
|
|
690
687
|
# Yönlendirmeyi manuel olarak test et
|
|
691
|
-
node -e "console.log(require('./intent-router.js').detectIntent('/sc:business-panel test'))"
|
|
688
|
+
node -e "console.log(require('./smart-intent-router.js').detectIntent('/sc:business-panel test'))"
|
|
692
689
|
```
|
|
693
690
|
|
|
694
691
|
3. **Skill dosyaları bulunamadı**
|
|
@@ -731,6 +728,5 @@ ccr code --verbose
|
|
|
731
728
|
## Atıf
|
|
732
729
|
|
|
733
730
|
Bu kurulum rehberi [claude-code-router-config](https://github.com/halilertekin/CC-RouterMultiProvider) projesi içindir.
|
|
734
|
-
Orijinal proje: https://github.com/musistudio/claude-code-router
|
|
735
731
|
AgentSkills: https://github.com/agentskills/agentskills
|
|
736
|
-
Rehber: Halil Ertekin
|
|
732
|
+
Rehber: Halil Ertekin
|
|
@@ -58,7 +58,7 @@ Claude Code Router, Claude Code CLI'ı bir proxy üzerinden çalıştırarak ist
|
|
|
58
58
|
|
|
59
59
|
1. Kullanıcı Claude Code'a istek gönderir
|
|
60
60
|
2. İstek `localhost:3456`'ya (router) gider
|
|
61
|
-
3. Router, `intent-router.js` ile intent analizi yapar
|
|
61
|
+
3. Router, `smart-intent-router.js` ile intent analizi yapar
|
|
62
62
|
4. İstek uygun provider'a yönlendirilir
|
|
63
63
|
5. Cevap kullanıcıya döner
|
|
64
64
|
|
|
@@ -162,7 +162,6 @@ brew install halilertekin/tap/claude-code-router-config
|
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
Homebrew kurulumu her şeyi otomatik yapar:
|
|
165
|
-
- @musistudio/claude-code-router kurar
|
|
166
165
|
- Konfigürasyon dosyalarını kopyalar
|
|
167
166
|
- ~/.env dosyasını şablonlarla oluşturur
|
|
168
167
|
- Sonraki adımları gösterir
|
|
@@ -179,7 +178,7 @@ ccr-setup
|
|
|
179
178
|
#### Adım 1: Paket Kurulumu
|
|
180
179
|
|
|
181
180
|
```bash
|
|
182
|
-
pnpm add -g @
|
|
181
|
+
pnpm add -g @halilertekin/claude-code-router-config
|
|
183
182
|
mkdir -p ~/.claude-code-router
|
|
184
183
|
```
|
|
185
184
|
|
|
@@ -240,7 +239,7 @@ ccr code
|
|
|
240
239
|
"LOG": true, // Loglama aktif
|
|
241
240
|
"LOG_LEVEL": "info", // Log seviyesi: fatal|error|warn|info|debug|trace
|
|
242
241
|
"API_TIMEOUT_MS": 300000, // 5 dakika timeout
|
|
243
|
-
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
|
|
242
|
+
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/smart-intent-router.js",
|
|
244
243
|
|
|
245
244
|
"Providers": [
|
|
246
245
|
{
|
|
@@ -295,7 +294,7 @@ ccr code
|
|
|
295
294
|
|
|
296
295
|
### Özelleştirme
|
|
297
296
|
|
|
298
|
-
`intent-router.js` dosyasını düzenleyerek:
|
|
297
|
+
`smart-intent-router.js` dosyasını düzenleyerek:
|
|
299
298
|
- Yeni intent'ler ekleyebilirsin
|
|
300
299
|
- Pattern'leri değiştirebilirsin
|
|
301
300
|
- Route'ları güncelleyebilirsin
|
|
@@ -425,12 +424,12 @@ cat ~/.claude-code-router/config.json | grep CUSTOM_ROUTER
|
|
|
425
424
|
|
|
426
425
|
2. Router dosyasının var olduğunu kontrol et:
|
|
427
426
|
```bash
|
|
428
|
-
ls -la ~/.claude-code-router/intent-router.js
|
|
427
|
+
ls -la ~/.claude-code-router/smart-intent-router.js
|
|
429
428
|
```
|
|
430
429
|
|
|
431
430
|
3. Syntax hatası var mı kontrol et:
|
|
432
431
|
```bash
|
|
433
|
-
node -c ~/.claude-code-router/intent-router.js
|
|
432
|
+
node -c ~/.claude-code-router/smart-intent-router.js
|
|
434
433
|
```
|
|
435
434
|
|
|
436
435
|
---
|
|
@@ -475,7 +474,7 @@ node -c ~/.claude-code-router/intent-router.js
|
|
|
475
474
|
```
|
|
476
475
|
~/.claude-code-router/
|
|
477
476
|
├── config.json # Ana konfigürasyon
|
|
478
|
-
├── intent-router.js # Custom routing logic
|
|
477
|
+
├── smart-intent-router.js # Custom routing logic
|
|
479
478
|
├── README.md # Kısa dokümantasyon
|
|
480
479
|
├── FULL_DOCUMENTATION.md # Bu dosya
|
|
481
480
|
└── logs/ # Log dosyaları
|
|
@@ -495,14 +494,10 @@ node -c ~/.claude-code-router/intent-router.js
|
|
|
495
494
|
|
|
496
495
|
## Atıf (Attribution)
|
|
497
496
|
|
|
498
|
-
Bu yapılandırma paketi [@musistudio/claude-code-router](https://github.com/musistudio/claude-code-router) için tasarlanmıştır. Bu, Claude Code'u birden fazla AI sağlayıcısıyla kullanmanızı sağlayan mükemmel bir araçtır.
|
|
499
497
|
|
|
500
|
-
Orijinal Claude Code Router projesi musistudio tarafından geliştirilmektedir ve bakımı yapılmaktadır. Bu paket, kullanıcıların hızla başlamasına yardımcı olmak için önceden yapılandırılmış routing mantığı ve sağlayıcı konfigürasyonları içermektedir.
|
|
501
498
|
|
|
502
499
|
## Kaynaklar
|
|
503
500
|
|
|
504
|
-
- [GitHub - musistudio/claude-code-router](https://github.com/musistudio/claude-code-router)
|
|
505
|
-
- [npm - @musistudio/claude-code-router](https://www.npmjs.com/package/@musistudio/claude-code-router)
|
|
506
501
|
- [OpenAI API Docs](https://platform.openai.com/docs)
|
|
507
502
|
- [Anthropic API Docs](https://docs.anthropic.com)
|
|
508
503
|
- [Gemini API Docs](https://ai.google.dev/gemini-api/docs)
|
|
@@ -58,7 +58,7 @@ Claude Code Router acts as a proxy that intercepts Claude Code CLI requests and
|
|
|
58
58
|
|
|
59
59
|
1. User sends request to Claude Code
|
|
60
60
|
2. Request goes to `localhost:3456` (router)
|
|
61
|
-
3. Router analyzes intent using `intent-router.js`
|
|
61
|
+
3. Router analyzes intent using `smart-intent-router.js`
|
|
62
62
|
4. Request is routed to appropriate provider
|
|
63
63
|
5. Response is returned to user
|
|
64
64
|
|
|
@@ -172,7 +172,6 @@ brew install halilertekin/tap/claude-code-router-config
|
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
The Homebrew installation handles everything automatically:
|
|
175
|
-
- Installs @musistudio/claude-code-router
|
|
176
175
|
- Copies configuration files
|
|
177
176
|
- Creates ~/.env with templates
|
|
178
177
|
- Provides next-step instructions
|
|
@@ -189,7 +188,7 @@ ccr-setup
|
|
|
189
188
|
#### Step 1: Install Package
|
|
190
189
|
|
|
191
190
|
```bash
|
|
192
|
-
pnpm add -g @
|
|
191
|
+
pnpm add -g @halilertekin/claude-code-router-config
|
|
193
192
|
mkdir -p ~/.claude-code-router
|
|
194
193
|
```
|
|
195
194
|
|
|
@@ -244,7 +243,7 @@ ccr code
|
|
|
244
243
|
"LOG": true, // Enable logging
|
|
245
244
|
"LOG_LEVEL": "info", // Log level: fatal|error|warn|info|debug|trace
|
|
246
245
|
"API_TIMEOUT_MS": 300000, // 5 minute timeout
|
|
247
|
-
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
|
|
246
|
+
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/smart-intent-router.js",
|
|
248
247
|
|
|
249
248
|
"Providers": [
|
|
250
249
|
{
|
|
@@ -300,7 +299,7 @@ ccr code
|
|
|
300
299
|
|
|
301
300
|
### Customization
|
|
302
301
|
|
|
303
|
-
Edit `intent-router.js` to:
|
|
302
|
+
Edit `smart-intent-router.js` to:
|
|
304
303
|
- Add new intents
|
|
305
304
|
- Modify patterns
|
|
306
305
|
- Update routes
|
|
@@ -434,12 +433,12 @@ cat ~/.claude-code-router/config.json | grep CUSTOM_ROUTER
|
|
|
434
433
|
|
|
435
434
|
2. Check router file exists:
|
|
436
435
|
```bash
|
|
437
|
-
ls -la ~/.claude-code-router/intent-router.js
|
|
436
|
+
ls -la ~/.claude-code-router/smart-intent-router.js
|
|
438
437
|
```
|
|
439
438
|
|
|
440
439
|
3. Check for syntax errors:
|
|
441
440
|
```bash
|
|
442
|
-
node -c ~/.claude-code-router/intent-router.js
|
|
441
|
+
node -c ~/.claude-code-router/smart-intent-router.js
|
|
443
442
|
```
|
|
444
443
|
|
|
445
444
|
---
|
|
@@ -490,7 +489,7 @@ node -c ~/.claude-code-router/intent-router.js
|
|
|
490
489
|
```
|
|
491
490
|
~/.claude-code-router/
|
|
492
491
|
├── config.json # Main configuration
|
|
493
|
-
├── intent-router.js # Custom routing logic
|
|
492
|
+
├── smart-intent-router.js # Custom routing logic
|
|
494
493
|
├── README.md # Quick documentation
|
|
495
494
|
├── FULL_DOCUMENTATION.md # This file
|
|
496
495
|
└── logs/ # Log files
|
|
@@ -510,14 +509,10 @@ node -c ~/.claude-code-router/intent-router.js
|
|
|
510
509
|
|
|
511
510
|
## Attribution
|
|
512
511
|
|
|
513
|
-
This configuration package is designed for use with [@musistudio/claude-code-router](https://github.com/musistudio/claude-code-router), an excellent tool that enables Claude Code functionality with multiple AI providers.
|
|
514
512
|
|
|
515
|
-
The original Claude Code Router project is developed and maintained by musistudio. This package contains pre-configured routing logic and provider configurations to help users get started quickly.
|
|
516
513
|
|
|
517
514
|
## Resources
|
|
518
515
|
|
|
519
|
-
- [GitHub - musistudio/claude-code-router](https://github.com/musistudio/claude-code-router)
|
|
520
|
-
- [npm - @musistudio/claude-code-router](https://www.npmjs.com/package/@musistudio/claude-code-router)
|
|
521
516
|
- [OpenAI API Docs](https://platform.openai.com/docs)
|
|
522
517
|
- [Anthropic API Docs](https://docs.anthropic.com)
|
|
523
518
|
- [Gemini API Docs](https://ai.google.dev/gemini-api/docs)
|
package/docs/HOMEBREW_SETUP.md
CHANGED
|
@@ -82,11 +82,10 @@ ccr code
|
|
|
82
82
|
The Homebrew formula installs the following components:
|
|
83
83
|
|
|
84
84
|
### 1. Core Package
|
|
85
|
-
- **@musistudio/claude-code-router**: The main routing application (via pnpm)
|
|
86
85
|
|
|
87
86
|
### 2. Configuration Files
|
|
88
87
|
- **`~/.claude-code-router/config.json`**: Multi-provider configuration with 7 AI providers
|
|
89
|
-
- **`~/.claude-code-router/intent-router.js`**: Intelligent intent-based routing logic
|
|
88
|
+
- **`~/.claude-code-router/smart-intent-router.js`**: Intelligent intent-based routing logic
|
|
90
89
|
|
|
91
90
|
### 3. Environment Template
|
|
92
91
|
- **`~/.env`**: Environment variables file (created from `.env.example`)
|
|
@@ -149,7 +148,7 @@ The router automatically routes requests to the most appropriate provider based
|
|
|
149
148
|
ls -la ~/.claude-code-router/
|
|
150
149
|
|
|
151
150
|
# Verify config syntax
|
|
152
|
-
node -c ~/.claude-code-router/intent-router.js
|
|
151
|
+
node -c ~/.claude-code-router/smart-intent-router.js
|
|
153
152
|
```
|
|
154
153
|
|
|
155
154
|
5. **API Key Issues**
|
|
@@ -203,7 +202,7 @@ brew untap halilertekin/homebrew-tap
|
|
|
203
202
|
|
|
204
203
|
### Custom Intent Patterns
|
|
205
204
|
|
|
206
|
-
Edit `~/.claude-code-router/intent-router.js` to add custom routing patterns:
|
|
205
|
+
Edit `~/.claude-code-router/smart-intent-router.js` to add custom routing patterns:
|
|
207
206
|
|
|
208
207
|
```javascript
|
|
209
208
|
// Add custom intent
|
|
@@ -247,6 +246,4 @@ Modify the routing order in `~/.claude-code-router/config.json`:
|
|
|
247
246
|
|
|
248
247
|
## Attribution
|
|
249
248
|
|
|
250
|
-
|
|
251
|
-
Original project: https://github.com/musistudio/claude-code-router
|
|
252
|
-
Configuration by Halil Ertekin
|
|
249
|
+
Configuration by Halil Ertekin
|
package/docs/README_EN.md
CHANGED
|
@@ -41,7 +41,7 @@ chmod +x install.sh
|
|
|
41
41
|
### 1. Install Package
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
pnpm add -g @
|
|
44
|
+
pnpm add -g @halilertekin/claude-code-router-config
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### 2. Copy Configuration Files
|
|
@@ -49,7 +49,8 @@ pnpm add -g @musistudio/claude-code-router
|
|
|
49
49
|
```bash
|
|
50
50
|
mkdir -p ~/.claude-code-router
|
|
51
51
|
cp config/config.json ~/.claude-code-router/
|
|
52
|
-
cp config/intent-router.js ~/.claude-code-router/
|
|
52
|
+
cp config/smart-intent-router.js ~/.claude-code-router/
|
|
53
|
+
cp config/smart-smart-intent-router.js ~/.claude-code-router/
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
### 3. Set Up Environment Variables
|
|
@@ -126,7 +127,7 @@ Inside Claude Code:
|
|
|
126
127
|
```
|
|
127
128
|
~/.claude-code-router/
|
|
128
129
|
├── config.json # Provider configuration
|
|
129
|
-
├── intent-router.js # Routing logic
|
|
130
|
+
├── smart-intent-router.js # Routing logic
|
|
130
131
|
└── logs/ # Log files
|
|
131
132
|
```
|
|
132
133
|
|
package/docs/SETUP_PROMPT.md
CHANGED
|
@@ -35,9 +35,9 @@ Intent-Based Routing Kuralları:
|
|
|
35
35
|
- Eşleşme yok → OpenAI (fallback)
|
|
36
36
|
|
|
37
37
|
Yapılacaklar:
|
|
38
|
-
1. pnpm ile @
|
|
38
|
+
1. pnpm ile @halilertekin/claude-code-router-config kur
|
|
39
39
|
2. ~/.claude-code-router/config.json oluştur (tüm provider'lar)
|
|
40
|
-
3. ~/.claude-code-router/intent-router.js oluştur (routing logic)
|
|
40
|
+
3. ~/.claude-code-router/smart-smart-intent-router.js oluştur (routing logic)
|
|
41
41
|
4. ~/.zshrc için gerekli env var'ları göster
|
|
42
42
|
|
|
43
43
|
API Endpoint'leri:
|
|
@@ -58,7 +58,7 @@ Router Ayarları:
|
|
|
58
58
|
Çıktı:
|
|
59
59
|
1. Kurulum komutları
|
|
60
60
|
2. config.json içeriği
|
|
61
|
-
3. intent-router.js içeriği
|
|
61
|
+
3. smart-intent-router.js içeriği
|
|
62
62
|
4. .zshrc eklemeleri
|
|
63
63
|
5. Başlatma ve test komutları
|
|
64
64
|
```
|
|
@@ -72,7 +72,7 @@ Eğer prompt kullanmak istemiyorsan, aşağıdaki adımları manuel uygula:
|
|
|
72
72
|
### 1. Kurulum
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
pnpm add -g @
|
|
75
|
+
pnpm add -g @halilertekin/claude-code-router-config
|
|
76
76
|
mkdir -p ~/.claude-code-router
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -84,7 +84,7 @@ cat > ~/.claude-code-router/config.json << 'EOF'
|
|
|
84
84
|
"LOG": true,
|
|
85
85
|
"LOG_LEVEL": "info",
|
|
86
86
|
"API_TIMEOUT_MS": 300000,
|
|
87
|
-
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
|
|
87
|
+
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/smart-intent-router.js",
|
|
88
88
|
|
|
89
89
|
"Providers": [
|
|
90
90
|
{
|
|
@@ -147,10 +147,10 @@ cat > ~/.claude-code-router/config.json << 'EOF'
|
|
|
147
147
|
EOF
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
### 3. intent-router.js
|
|
150
|
+
### 3. smart-intent-router.js
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
|
-
cat > ~/.claude-code-router/intent-router.js << 'EOF'
|
|
153
|
+
cat > ~/.claude-code-router/smart-intent-router.js << 'EOF'
|
|
154
154
|
const INTENTS = {
|
|
155
155
|
CODING: {
|
|
156
156
|
patterns: [
|
|
@@ -274,11 +274,11 @@ Tüm dosyaları tek seferde oluşturmak için:
|
|
|
274
274
|
|
|
275
275
|
```bash
|
|
276
276
|
# 1. Kur
|
|
277
|
-
pnpm add -g @
|
|
277
|
+
pnpm add -g @halilertekin/claude-code-router-config && mkdir -p ~/.claude-code-router
|
|
278
278
|
|
|
279
279
|
# 2. Config'leri indir (bu repo'dan)
|
|
280
280
|
curl -sL https://raw.githubusercontent.com/YOUR_REPO/main/config.json > ~/.claude-code-router/config.json
|
|
281
|
-
curl -sL https://raw.githubusercontent.com/YOUR_REPO/main/intent-router.js > ~/.claude-code-router/intent-router.js
|
|
281
|
+
curl -sL https://raw.githubusercontent.com/YOUR_REPO/main/smart-intent-router.js > ~/.claude-code-router/smart-intent-router.js
|
|
282
282
|
|
|
283
283
|
# 3. API key'leri .zshrc'ye ekle (manuel)
|
|
284
284
|
# 4. Başlat
|
package/docs/SETUP_PROMPT_EN.md
CHANGED
|
@@ -36,9 +36,9 @@ Intent-Based Routing Rules:
|
|
|
36
36
|
- No match → OpenAI (fallback)
|
|
37
37
|
|
|
38
38
|
Tasks:
|
|
39
|
-
1. Install @
|
|
39
|
+
1. Install @halilertekin/claude-code-router-config with pnpm
|
|
40
40
|
2. Create ~/.claude-code-router/config.json (all providers)
|
|
41
|
-
3. Create ~/.claude-code-router/intent-router.js (routing logic)
|
|
41
|
+
3. Create ~/.claude-code-router/smart-smart-intent-router.js (routing logic)
|
|
42
42
|
4. Show required .zshrc additions
|
|
43
43
|
|
|
44
44
|
API Endpoints:
|
|
@@ -60,7 +60,7 @@ Router Settings:
|
|
|
60
60
|
Output:
|
|
61
61
|
1. Installation commands
|
|
62
62
|
2. config.json content
|
|
63
|
-
3. intent-router.js content
|
|
63
|
+
3. smart-intent-router.js content
|
|
64
64
|
4. .zshrc additions
|
|
65
65
|
5. Startup and test commands
|
|
66
66
|
```
|
|
@@ -74,7 +74,7 @@ If you prefer manual setup:
|
|
|
74
74
|
### 1. Install
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
|
-
pnpm add -g @
|
|
77
|
+
pnpm add -g @halilertekin/claude-code-router-config
|
|
78
78
|
mkdir -p ~/.claude-code-router
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ cat > ~/.claude-code-router/config.json << 'EOF'
|
|
|
86
86
|
"LOG": true,
|
|
87
87
|
"LOG_LEVEL": "info",
|
|
88
88
|
"API_TIMEOUT_MS": 300000,
|
|
89
|
-
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
|
|
89
|
+
"CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/smart-intent-router.js",
|
|
90
90
|
|
|
91
91
|
"Providers": [
|
|
92
92
|
{
|
|
@@ -156,10 +156,10 @@ cat > ~/.claude-code-router/config.json << 'EOF'
|
|
|
156
156
|
EOF
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
### 3. intent-router.js
|
|
159
|
+
### 3. smart-intent-router.js
|
|
160
160
|
|
|
161
161
|
```bash
|
|
162
|
-
cat > ~/.claude-code-router/intent-router.js << 'EOF'
|
|
162
|
+
cat > ~/.claude-code-router/smart-intent-router.js << 'EOF'
|
|
163
163
|
const INTENTS = {
|
|
164
164
|
CODING: {
|
|
165
165
|
patterns: [
|
|
@@ -291,11 +291,11 @@ To create all files at once:
|
|
|
291
291
|
|
|
292
292
|
```bash
|
|
293
293
|
# 1. Install
|
|
294
|
-
pnpm add -g @
|
|
294
|
+
pnpm add -g @halilertekin/claude-code-router-config && mkdir -p ~/.claude-code-router
|
|
295
295
|
|
|
296
296
|
# 2. Download configs (from this repo)
|
|
297
297
|
curl -sL https://raw.githubusercontent.com/YOUR_REPO/main/config/config.json > ~/.claude-code-router/config.json
|
|
298
|
-
curl -sL https://raw.githubusercontent.com/YOUR_REPO/main/config/intent-router.js > ~/.claude-code-router/intent-router.js
|
|
298
|
+
curl -sL https://raw.githubusercontent.com/YOUR_REPO/main/config/smart-intent-router.js > ~/.claude-code-router/smart-intent-router.js
|
|
299
299
|
|
|
300
300
|
# 3. Add API keys to .zshrc (manual)
|
|
301
301
|
# 4. Start
|
package/docs/v1.1.0-FEATURES.md
CHANGED
|
@@ -555,7 +555,7 @@ Your existing configuration will continue to work, but you can enhance it:
|
|
|
555
555
|
ccr config backup
|
|
556
556
|
|
|
557
557
|
# Apply enhanced smart routing
|
|
558
|
-
cp config/smart-intent-router.js ~/.claude-code-router/intent-router.js
|
|
558
|
+
cp config/smart-smart-intent-router.js ~/.claude-code-router/smart-intent-router.js
|
|
559
559
|
|
|
560
560
|
# Or use a template
|
|
561
561
|
ccr config template balanced
|
|
@@ -725,7 +725,6 @@ rm ~/.claude-code-router/logs/*.log.2
|
|
|
725
725
|
|
|
726
726
|
### Support
|
|
727
727
|
- [GitHub Issues](https://github.com/halilertekin/CC-RouterMultiProvider/issues)
|
|
728
|
-
- [Original Router Project](https://github.com/musistudio/claude-code-router)
|
|
729
728
|
|
|
730
729
|
---
|
|
731
730
|
|
|
@@ -749,4 +748,4 @@ Have ideas for improvement? Found a bug? Please open an issue on GitHub.
|
|
|
749
748
|
|
|
750
749
|
*Last Updated: December 20, 2025*
|
|
751
750
|
*Version: 1.1.0*
|
|
752
|
-
*Author: Halil Ertekin*
|
|
751
|
+
*Author: Halil Ertekin*
|
package/install.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Claude Code Router Config - Interactive Installer
|
|
5
|
-
*
|
|
5
|
+
* Unified router + configuration package
|
|
6
6
|
*
|
|
7
|
-
* Original project: https://github.com/musistudio/claude-code-router
|
|
8
7
|
* Configuration by Halil Ertekin
|
|
9
8
|
*/
|
|
10
9
|
|
|
@@ -12,11 +11,22 @@ const fs = require('fs-extra');
|
|
|
12
11
|
const path = require('path');
|
|
13
12
|
const chalk = require('chalk');
|
|
14
13
|
const inquirer = require('inquirer');
|
|
15
|
-
const dotenv = require('dotenv');
|
|
16
14
|
const { execSync } = require('child_process');
|
|
17
15
|
|
|
18
16
|
const configDir = path.join(process.env.HOME || process.env.USERPROFILE, '.claude-code-router');
|
|
19
17
|
const packageDir = __dirname;
|
|
18
|
+
const argv = new Set(process.argv.slice(2));
|
|
19
|
+
const envIsTrue = (value) => /^(1|true|yes|y)$/i.test(value || '');
|
|
20
|
+
const forceOverwrite =
|
|
21
|
+
argv.has('--overwrite') ||
|
|
22
|
+
argv.has('--force') ||
|
|
23
|
+
envIsTrue(process.env.CCR_CONFIG_OVERWRITE);
|
|
24
|
+
const nonInteractive =
|
|
25
|
+
argv.has('--no-prompt') ||
|
|
26
|
+
argv.has('--non-interactive') ||
|
|
27
|
+
envIsTrue(process.env.CCR_CONFIG_NO_PROMPT) ||
|
|
28
|
+
envIsTrue(process.env.CI);
|
|
29
|
+
const canPrompt = Boolean(process.stdin.isTTY) && !nonInteractive;
|
|
20
30
|
|
|
21
31
|
async function checkRequirements() {
|
|
22
32
|
console.log(chalk.blue('📋 Checking requirements...'));
|
|
@@ -31,35 +41,12 @@ async function checkRequirements() {
|
|
|
31
41
|
}
|
|
32
42
|
console.log(chalk.green(`✅ Node.js ${nodeVersion}`));
|
|
33
43
|
|
|
34
|
-
// Check for
|
|
44
|
+
// Check for npm (for optional updates)
|
|
35
45
|
try {
|
|
36
|
-
execSync('
|
|
37
|
-
console.log(chalk.green('✅
|
|
38
|
-
return 'pnpm';
|
|
46
|
+
execSync('npm --version', { stdio: 'ignore' });
|
|
47
|
+
console.log(chalk.green('✅ npm found'));
|
|
39
48
|
} catch {
|
|
40
|
-
|
|
41
|
-
execSync('npm --version', { stdio: 'ignore' });
|
|
42
|
-
console.log(chalk.yellow('⚠️ pnpm not found, using npm'));
|
|
43
|
-
return 'npm';
|
|
44
|
-
} catch {
|
|
45
|
-
console.error(chalk.red('❌ Neither pnpm nor npm found'));
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function installRouter(packageManager) {
|
|
52
|
-
console.log(chalk.blue('📦 Installing claude-code-router...'));
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
const command = `${packageManager} add -g @musistudio/claude-code-router`;
|
|
56
|
-
console.log(chalk.gray(`Running: ${command}`));
|
|
57
|
-
execSync(command, { stdio: 'inherit' });
|
|
58
|
-
console.log(chalk.green('✅ claude-code-router installed'));
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.error(chalk.red('❌ Failed to install claude-code-router'));
|
|
61
|
-
console.error(error.message);
|
|
62
|
-
process.exit(1);
|
|
49
|
+
console.log(chalk.yellow('⚠️ npm not found (optional)'));
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
52
|
|
|
@@ -70,24 +57,35 @@ async function setupConfig() {
|
|
|
70
57
|
await fs.ensureDir(configDir);
|
|
71
58
|
|
|
72
59
|
// Copy config files
|
|
73
|
-
const configFiles = ['config.json', 'intent-router.js'];
|
|
60
|
+
const configFiles = ['config.json', 'intent-router.js', 'smart-intent-router.js'];
|
|
74
61
|
for (const file of configFiles) {
|
|
75
62
|
const src = path.join(packageDir, 'config', file);
|
|
76
63
|
const dest = path.join(configDir, file);
|
|
77
64
|
|
|
78
65
|
if (await fs.pathExists(dest)) {
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (!overwrite) {
|
|
89
|
-
console.log(chalk.yellow(`⚠️ Skipping ${file}`));
|
|
66
|
+
if (forceOverwrite) {
|
|
67
|
+
console.log(chalk.yellow(`⚠️ Overwriting ${file} (forced)`));
|
|
68
|
+
} else if (!canPrompt) {
|
|
69
|
+
console.log(
|
|
70
|
+
chalk.yellow(
|
|
71
|
+
`⚠️ Skipping ${file} (non-interactive). Set CCR_CONFIG_OVERWRITE=1 to overwrite.`
|
|
72
|
+
)
|
|
73
|
+
);
|
|
90
74
|
continue;
|
|
75
|
+
} else {
|
|
76
|
+
const { overwrite } = await inquirer.prompt([
|
|
77
|
+
{
|
|
78
|
+
type: 'confirm',
|
|
79
|
+
name: 'overwrite',
|
|
80
|
+
message: `File ${file} exists. Overwrite?`,
|
|
81
|
+
default: false
|
|
82
|
+
}
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
if (!overwrite) {
|
|
86
|
+
console.log(chalk.yellow(`⚠️ Skipping ${file}`));
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
|
|
@@ -125,6 +123,7 @@ async function showNextSteps() {
|
|
|
125
123
|
console.log(chalk.gray(' source ~/.zshrc'));
|
|
126
124
|
|
|
127
125
|
console.log('\n4. Start the router:');
|
|
126
|
+
console.log(chalk.gray(' ccr start'));
|
|
128
127
|
console.log(chalk.gray(' ccr code'));
|
|
129
128
|
|
|
130
129
|
console.log(chalk.blue('\n📚 Documentation:'));
|
|
@@ -139,16 +138,14 @@ async function showNextSteps() {
|
|
|
139
138
|
console.log(chalk.gray(' OpenRouter: https://openrouter.ai/keys'));
|
|
140
139
|
console.log(chalk.gray(' Copilot: https://github.com/settings/tokens'));
|
|
141
140
|
|
|
142
|
-
console.log(chalk.yellow('\n⭐
|
|
143
|
-
console.log(chalk.gray('
|
|
144
|
-
console.log(chalk.gray(' Original: https://github.com/musistudio/claude-code-router'));
|
|
141
|
+
console.log(chalk.yellow('\n⭐ Info:'));
|
|
142
|
+
console.log(chalk.gray(' Unified router + config package'));
|
|
145
143
|
}
|
|
146
144
|
|
|
147
145
|
async function main() {
|
|
148
146
|
console.log(chalk.cyan.bold('\n🚀 Claude Code Router Config Installer\n'));
|
|
149
147
|
|
|
150
|
-
|
|
151
|
-
await installRouter(packageManager);
|
|
148
|
+
await checkRequirements();
|
|
152
149
|
await setupConfig();
|
|
153
150
|
await showNextSteps();
|
|
154
151
|
}
|
|
@@ -157,4 +154,4 @@ if (require.main === module) {
|
|
|
157
154
|
main().catch(console.error);
|
|
158
155
|
}
|
|
159
156
|
|
|
160
|
-
module.exports = { checkRequirements,
|
|
157
|
+
module.exports = { checkRequirements, setupConfig };
|