@halilertekin/claude-code-router-config 1.1.1 ā 1.2.2
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/README.md +6 -0
- package/cli/analytics.js +3 -3
- package/cli/chalk-safe.js +31 -0
- package/cli/commands.js +1 -1
- package/package.json +2 -2
- package/plugins/plugin-manager.js +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ ccr config template balanced # Best of all worlds
|
|
|
38
38
|
|
|
39
39
|
## Features
|
|
40
40
|
|
|
41
|
+
- **Node.js 16+ Support**: Compatible with modern Node.js environments
|
|
41
42
|
- **7 Provider Support**: OpenAI, Anthropic, Gemini, Qwen, GLM, OpenRouter, GitHub Copilot
|
|
42
43
|
- **Smart Intent-Based Routing**: Automatically selects the best model based on your request
|
|
43
44
|
- **Advanced CLI Tools**: Test, benchmark, analyze, and monitor your setup
|
|
@@ -58,6 +59,11 @@ ccr config template balanced # Best of all worlds
|
|
|
58
59
|
| Complex algorithms | OpenAI | o1 |
|
|
59
60
|
| Coding assistance | GitHub Copilot | copilot |
|
|
60
61
|
|
|
62
|
+
## Requirements
|
|
63
|
+
|
|
64
|
+
- **Node.js**: >= 16.0.0
|
|
65
|
+
- **Package Manager**: pnpm (preferred) or npm
|
|
66
|
+
|
|
61
67
|
## Installation
|
|
62
68
|
|
|
63
69
|
### Option 1: Homebrew (Recommended)
|
package/cli/analytics.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const chalk = require('chalk');
|
|
5
|
+
const chalk = require('./chalk-safe');
|
|
6
6
|
const os = require('os');
|
|
7
7
|
|
|
8
8
|
// Analytics storage path
|
|
@@ -404,7 +404,7 @@ function displayAnalytics(period = 'today', options = {}) {
|
|
|
404
404
|
if (detailed && Object.keys(summary.providers).length > 0) {
|
|
405
405
|
console.log(chalk.yellow('\nš Provider Breakdown:'));
|
|
406
406
|
const sortedProviders = Object.entries(summary.providers)
|
|
407
|
-
.sort(([,a], [,b]) => b - a);
|
|
407
|
+
.sort(([, a], [, b]) => b - a);
|
|
408
408
|
|
|
409
409
|
sortedProviders.forEach(([provider, count]) => {
|
|
410
410
|
const percentage = ((count / summary.totalRequests) * 100).toFixed(1);
|
|
@@ -415,7 +415,7 @@ function displayAnalytics(period = 'today', options = {}) {
|
|
|
415
415
|
if (detailed && Object.keys(summary.models).length > 0) {
|
|
416
416
|
console.log(chalk.yellow('\nš¤ Model Breakdown:'));
|
|
417
417
|
const sortedModels = Object.entries(summary.models)
|
|
418
|
-
.sort(([,a], [,b]) => b - a)
|
|
418
|
+
.sort(([, a], [, b]) => b - a)
|
|
419
419
|
.slice(0, 10); // Top 10 models
|
|
420
420
|
|
|
421
421
|
sortedModels.forEach(([model, count]) => {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Safely loads chalk and provides fallbacks for missing methods.
|
|
6
|
+
* This handles ESM/CJS interop and pnpm global install issues.
|
|
7
|
+
*/
|
|
8
|
+
function getSafeChalk() {
|
|
9
|
+
let chalk;
|
|
10
|
+
try {
|
|
11
|
+
chalk = require('chalk');
|
|
12
|
+
if (chalk.default) chalk = chalk.default;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
// Fallback if chalk is missing
|
|
15
|
+
chalk = {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Ensure common methods exist as fallbacks
|
|
19
|
+
const methods = ['blue', 'red', 'green', 'yellow', 'gray', 'cyan', 'magenta', 'bold'];
|
|
20
|
+
const safeChalk = { ...chalk };
|
|
21
|
+
|
|
22
|
+
methods.forEach(method => {
|
|
23
|
+
if (typeof safeChalk[method] !== 'function') {
|
|
24
|
+
safeChalk[method] = (str) => str || '';
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return safeChalk;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = getSafeChalk();
|
package/cli/commands.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { spawn } = require('child_process');
|
|
6
|
-
const chalk = require('chalk');
|
|
6
|
+
const chalk = require('./chalk-safe');
|
|
7
7
|
const configPath = path.join(require('os').homedir(), '.claude-code-router');
|
|
8
8
|
|
|
9
9
|
// Load config
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halilertekin/claude-code-router-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"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.",
|
|
5
5
|
"main": "install.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"install": "node install.js",
|
|
15
15
|
"setup": "chmod +x install.sh && ./install.sh",
|
|
16
16
|
"postinstall": "node postinstall.js",
|
|
17
|
-
"test": "
|
|
17
|
+
"test": "jest",
|
|
18
18
|
"cli": "node cli/commands.js",
|
|
19
19
|
"benchmark": "node cli/benchmark.js",
|
|
20
20
|
"analytics": "node cli/analytics.js",
|