Skip to content

Commit 62f8a4a

Browse files
committed
Release 2.0.6
1 parent e147cca commit 62f8a4a

File tree

8 files changed

+60
-15
lines changed

8 files changed

+60
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.0.6
4+
- UI sürüm etiketi artık paket versiyonunu gösteriyor.
5+
- Dashboard dil dosyalarındaki hatalı virgüller düzeltildi (dil seçimi ve sağlayıcı listesi geri geldi).
6+
- `ccr activate` artık yapılandırılan env dosyasını (`CCR_ENV_PATH`) export ediyor.
7+
- GLM wrapper: z.ai için doğru auth/timeout/model eşlemeleri ve python3 fallback.
8+
39
## 2.0.5
410
- UI üzerinden `.env` anahtarları ekleme/güncelleme eklendi.
511
- API tarafına `GET/POST /api/env` eklendi.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Claude Code Router Config - Advanced Multi-Provider Setup
22

3-
🚀 **v2.0.5** - Unified router + config package with z.ai (GLM 4.7) support, advanced CLI tools, analytics, smart routing, and configuration templates!
3+
🚀 **v2.0.6** - Unified router + config package with z.ai (GLM 4.7) support, advanced CLI tools, analytics, smart routing, and configuration templates!
44

55
Use Claude Code as a single interface to access multiple AI providers with intelligent routing for optimal performance, cost, and quality.
66

7-
## ✨ New in v2.0.5
7+
## ✨ New in v2.0.6
88
- UI üzerinden `.env` anahtarları ekleme/güncelleme (TR/NL).
99
- `~/.env` otomatik yükleme ile API anahtarlarının bulunması (CLI + health monitor).
1010
- **z.ai Support**: Native integration for GLM-4.7 via z.ai (PPInfra).

cli/commands.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const os = require('os');
55
const path = require('path');
66
const { spawn } = require('child_process');
77
const chalk = require('./chalk-safe');
8-
const { resolveProviderKey } = require('../router/config');
8+
const { resolveProviderKey, readEnvFile } = require('../router/config');
99
const configPath = path.join(os.homedir(), '.claude-code-router');
1010
const pidFile = path.join(configPath, 'router.pid');
1111
const serverScript = path.join(__dirname, '..', 'router', 'server.js');
@@ -20,6 +20,12 @@ function loadConfig() {
2020
}
2121
}
2222

23+
function formatEnvValue(value) {
24+
const safe = /^[A-Za-z0-9_./:@-]+$/.test(value);
25+
if (safe) return value;
26+
return JSON.stringify(value);
27+
}
28+
2329
function readPid() {
2430
if (!fs.existsSync(pidFile)) return null;
2531
const pid = parseInt(fs.readFileSync(pidFile, 'utf8'), 10);
@@ -392,7 +398,11 @@ async function main() {
392398
case 'activate': {
393399
const config = loadConfig();
394400
const port = config.PORT || 3456;
395-
console.log('export $(cat ~/.env | xargs)');
401+
const { entries } = readEnvFile();
402+
Object.entries(entries).forEach(([key, value]) => {
403+
if (value === undefined) return;
404+
console.log(`export ${key}=${formatEnvValue(String(value))}`);
405+
});
396406
console.log(`export ANTHROPIC_BASE_URL="http://127.0.0.1:${port}"`);
397407
console.log('export NO_PROXY="127.0.0.1"');
398408
break;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@halilertekin/claude-code-router-config",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"description": "Multi-provider configuration for Claude Code Router with intent-based routing, advanced CLI tools, analytics, and smart routing. Setup OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, and GitHub Copilot with intelligent routing.",
55
"main": "install.js",
66
"bin": {

router/server.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,22 @@ function setupApi(app) {
518518

519519
function setupUi(app) {
520520
const uiRoot = path.join(__dirname, '..', 'web-dashboard', 'public');
521+
const indexPath = path.join(uiRoot, 'index.html');
522+
523+
const renderIndex = () => {
524+
const version = require('../package.json').version;
525+
const html = fs.readFileSync(indexPath, 'utf8');
526+
return html.replace(/__CCR_VERSION__/g, version);
527+
};
528+
529+
app.get(['/ui', '/ui/', '/ui/index.html'], (req, res, next) => {
530+
try {
531+
res.type('html').send(renderIndex());
532+
} catch (error) {
533+
next(error);
534+
}
535+
});
536+
521537
app.use('/ui', express.static(uiRoot));
522538
app.get('/', (req, res) => res.redirect('/ui'));
523539
}

setup-glm.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ CONFIG_DIR="$HOME/.claude-code-router"
66
BIN_DIR="$HOME/.local/bin"
77
KEYS_FILE="$CONFIG_DIR/keys.env"
88
ZSHRC="${HOME}/.zshrc"
9+
PYTHON_BIN="python"
10+
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then
11+
PYTHON_BIN="python3"
12+
fi
913

1014
GLM_KEY="${GLM_API_KEY:-}"
1115
SKIP_INSTALL=0
@@ -188,14 +192,23 @@ if ! port_open; then
188192
exit 1
189193
fi
190194
195+
export CCR_ENV_PATH="$KEYS_FILE"
191196
eval "$(ccr activate)"
192197
193-
export ANTHROPIC_MODEL="glm,glm-4.7"
194-
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm,glm-4.7"
195-
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm,glm-4.7"
196-
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm,glm-4.7"
197-
export CLAUDE_CODE_SUBAGENT_MODEL="glm,glm-4.7"
198-
export ANTHROPIC_SMALL_FAST_MODEL="glm,glm-4.7"
198+
# Ensure Claude Code doesn't fall back to Claude Pro when glm is requested.
199+
export ANTHROPIC_AUTH_TOKEN="${GLM_API_KEY}"
200+
export ANTHROPIC_API_KEY="${GLM_API_KEY}"
201+
202+
export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
203+
export NO_PROXY="127.0.0.1"
204+
export API_TIMEOUT_MS="${API_TIMEOUT_MS:-3000000}"
205+
206+
export ANTHROPIC_MODEL="${ANTHROPIC_MODEL:-glm,glm-4.7}"
207+
export ANTHROPIC_DEFAULT_OPUS_MODEL="${ANTHROPIC_DEFAULT_OPUS_MODEL:-glm,glm-4.7}"
208+
export ANTHROPIC_DEFAULT_SONNET_MODEL="${ANTHROPIC_DEFAULT_SONNET_MODEL:-glm,glm-4.7}"
209+
export ANTHROPIC_DEFAULT_HAIKU_MODEL="${ANTHROPIC_DEFAULT_HAIKU_MODEL:-glm,glm-4.5-air}"
210+
export ANTHROPIC_SMALL_FAST_MODEL="${ANTHROPIC_SMALL_FAST_MODEL:-glm,glm-4.5-air}"
211+
export CLAUDE_CODE_SUBAGENT_MODEL="${CLAUDE_CODE_SUBAGENT_MODEL:-glm,glm-4.7}"
199212
200213
CLAUDE_BIN="$HOME/.claude/local/claude"
201214
if [[ ! -x "$CLAUDE_BIN" ]]; then
@@ -235,7 +248,7 @@ backup_file "$CONFIG_DIR/config.json"
235248
cp "$SCRIPT_DIR/config/glm-only.json" "$CONFIG_DIR/config.json"
236249
backup_file "$CONFIG_DIR/intent-router-glm.js"
237250
cp "$SCRIPT_DIR/config/intent-router-glm.js" "$CONFIG_DIR/intent-router-glm.js"
238-
python - <<'PY'
251+
"$PYTHON_BIN" - <<'PY'
239252
import json
240253
import os
241254

web-dashboard/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ <h3 data-i18n="envUpdate">Güncelle</h3>
224224
</main>
225225

226226
<footer class="footer">
227-
<span id="version">v2</span>
227+
<span id="version">v__CCR_VERSION__</span>
228228
</footer>
229229
</div>
230230

web-dashboard/public/js/dashboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Dashboard {
6363
envSet: 'Tanımlı',
6464
envMissing: 'Eksik',
6565
envPath: 'Dosya',
66-
envSelect: 'Anahtar seç'
66+
envSelect: 'Anahtar seç',
6767
logOn: 'Açık',
6868
logOff: 'Kapalı',
6969
statusHealthy: 'Sağlıklı',
@@ -122,7 +122,7 @@ class Dashboard {
122122
envSet: 'Ingesteld',
123123
envMissing: 'Ontbreekt',
124124
envPath: 'Bestand',
125-
envSelect: 'Sleutel kiezen'
125+
envSelect: 'Sleutel kiezen',
126126
logOn: 'Aan',
127127
logOff: 'Uit',
128128
statusHealthy: 'Gezond',

0 commit comments

Comments
 (0)