@halilertekin/claude-code-router-config 1.2.0 → 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/cli/analytics.js CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
- let chalk = require('chalk');
6
- if (chalk.default) chalk = chalk.default;
5
+ const chalk = require('./chalk-safe');
7
6
  const os = require('os');
8
7
 
9
8
  // Analytics storage path
@@ -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,8 +3,7 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { spawn } = require('child_process');
6
- let chalk = require('chalk');
7
- if (chalk.default) chalk = chalk.default;
6
+ const chalk = require('./chalk-safe');
8
7
  const configPath = path.join(require('os').homedir(), '.claude-code-router');
9
8
 
10
9
  // Load config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halilertekin/claude-code-router-config",
3
- "version": "1.2.0",
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": {
@@ -3,8 +3,7 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
- let chalk = require('chalk');
7
- if (chalk.default) chalk = chalk.default;
6
+ const chalk = require('../cli/chalk-safe');
8
7
 
9
8
  class PluginManager {
10
9
  constructor(options = {}) {