Skip to content

Commit 9bccd33

Browse files
committed
chore: prepare release for vpatch
1 parent 294a89d commit 9bccd33

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

cli/analytics.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
const fs = require('fs');
44
const path = require('path');
5-
let chalk = require('chalk');
6-
if (chalk.default) chalk = chalk.default;
5+
const chalk = require('./chalk-safe');
76
const os = require('os');
87

98
// Analytics storage path

cli/chalk-safe.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

cli/commands.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
const fs = require('fs');
44
const path = require('path');
55
const { spawn } = require('child_process');
6-
let chalk = require('chalk');
7-
if (chalk.default) chalk = chalk.default;
6+
const chalk = require('./chalk-safe');
87
const configPath = path.join(require('os').homedir(), '.claude-code-router');
98

109
// Load config

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@halilertekin/claude-code-router-config",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
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": {
@@ -88,4 +88,4 @@
8888
"devDependencies": {
8989
"jest": "^29.7.0"
9090
}
91-
}
91+
}

plugins/plugin-manager.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
const fs = require('fs');
44
const path = require('path');
55
const os = require('os');
6-
let chalk = require('chalk');
7-
if (chalk.default) chalk = chalk.default;
6+
const chalk = require('../cli/chalk-safe');
87

98
class PluginManager {
109
constructor(options = {}) {

0 commit comments

Comments
 (0)