@dedenlabs/claude-code-router-cli 2.0.0 → 2.0.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +39 -9
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -58274,7 +58274,7 @@ var require_package3 = __commonJS({
58274
58274
  "package.json"(exports2, module2) {
58275
58275
  module2.exports = {
58276
58276
  name: "@dedenlabs/claude-code-router-cli",
58277
- version: "2.0.0",
58277
+ version: "2.0.1",
58278
58278
  description: "\u57FA\u4E8E@musistudio/claude-code-router\u7684\u589E\u5F3A\u7248CLI\u8DEF\u7531\u5DE5\u5177 - \u652F\u6301\u7EDF\u4E00\u8DEF\u7531\u5F15\u64CE\u3001\u5916\u90E8\u89C4\u5219\u52A0\u8F7D\u3001\u667A\u80FD\u65E5\u5FD7\u7CFB\u7EDF\u3001\u81EA\u52A8\u914D\u7F6E\u8FC1\u79FB\u548CGLM\u601D\u8003\u6A21\u5F0F",
58279
58279
  bin: {
58280
58280
  ccr: "dist/cli.js"
@@ -58298,7 +58298,7 @@ var require_package3 = __commonJS({
58298
58298
  license: "MIT",
58299
58299
  repository: {
58300
58300
  type: "git",
58301
- url: "https://github.com/dedenlabs/claude-code-router-cli"
58301
+ url: "git+https://github.com/dedenlabs/claude-code-router-cli.git"
58302
58302
  },
58303
58303
  bugs: {
58304
58304
  url: "https://github.com/dedenlabs/claude-code-router-cli/issues"
@@ -58331,7 +58331,10 @@ var require_package3 = __commonJS({
58331
58331
  "LICENSE",
58332
58332
  "README.md",
58333
58333
  "tsconfig.json"
58334
- ]
58334
+ ],
58335
+ publishConfig: {
58336
+ access: "public"
58337
+ }
58335
58338
  };
58336
58339
  }
58337
58340
  });
@@ -77472,9 +77475,10 @@ async function initializeClaudeConfig() {
77472
77475
  async function run(options = {}) {
77473
77476
  const isRunning = await isServiceRunning();
77474
77477
  if (isRunning) {
77475
- console.log("\u2705 Service is already running in the background.");
77478
+ console.log("\u2705 Service is already running.");
77476
77479
  return;
77477
77480
  }
77481
+ const isInternalBackground = process.argv.includes("--internal-bg");
77478
77482
  await initializeClaudeConfig();
77479
77483
  await initDir();
77480
77484
  await cleanupLogFiles();
@@ -77742,7 +77746,13 @@ async function run(options = {}) {
77742
77746
  event.emit("onSend", req, reply, payload);
77743
77747
  return payload;
77744
77748
  });
77749
+ const isForegroundMode = options.foreground || !process.argv.includes("--internal-bg");
77745
77750
  server.start();
77751
+ if (isForegroundMode) {
77752
+ console.log("\n\u{1F680} Claude Code Router v2.0 is running on http://127.0.0.1:" + servicePort);
77753
+ console.log(" Press Ctrl+C to stop the server\n");
77754
+ } else {
77755
+ }
77746
77756
  }
77747
77757
 
77748
77758
  // src/utils/status.ts
@@ -80302,10 +80312,10 @@ async function main() {
80302
80312
  // src/cli.ts
80303
80313
  var command = process.argv[2];
80304
80314
  var HELP_TEXT = `
80305
- Usage: ccr [command]
80315
+ Usage: ccr [command] [options]
80306
80316
 
80307
80317
  Commands:
80308
- start Start server
80318
+ start Start server (default: foreground mode)
80309
80319
  stop Stop server
80310
80320
  restart Restart server
80311
80321
  status Show server status
@@ -80317,8 +80327,13 @@ Commands:
80317
80327
  -v, version Show version information
80318
80328
  -h, help Show help information
80319
80329
 
80320
- Example:
80321
- ccr start
80330
+ Options for 'start' command:
80331
+ -b, --background Run server in background mode
80332
+ -d, --daemon Alias for --background
80333
+
80334
+ Examples:
80335
+ ccr start # Start server in foreground mode
80336
+ ccr start --background # Start server in background mode
80322
80337
  ccr code "Write a Hello World"
80323
80338
  ccr model
80324
80339
  eval "$(ccr activate)" # Set environment variables globally
@@ -80341,7 +80356,22 @@ async function main2() {
80341
80356
  const isRunning = await isServiceRunning();
80342
80357
  switch (command) {
80343
80358
  case "start":
80344
- run();
80359
+ {
80360
+ const args = process.argv.slice(3);
80361
+ const hasBackgroundFlag = args.includes("--background") || args.includes("-b") || args.includes("--daemon") || args.includes("-d");
80362
+ if (hasBackgroundFlag) {
80363
+ const cliPath2 = (0, import_path8.join)(__dirname, "cli.js");
80364
+ (0, import_child_process6.spawn)("node", [cliPath2, "start", "--internal-bg"], {
80365
+ detached: true,
80366
+ stdio: "ignore"
80367
+ }).unref();
80368
+ console.log("\u2705 Service started successfully in the background.");
80369
+ console.log(" Use 'ccr status' to check service status");
80370
+ console.log(" Use 'ccr stop' to stop the service");
80371
+ } else {
80372
+ run();
80373
+ }
80374
+ }
80345
80375
  break;
80346
80376
  case "stop":
80347
80377
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dedenlabs/claude-code-router-cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "基于@musistudio/claude-code-router的增强版CLI路由工具 - 支持统一路由引擎、外部规则加载、智能日志系统、自动配置迁移和GLM思考模式",
5
5
  "bin": {
6
6
  "ccr": "dist/cli.js"
@@ -24,7 +24,7 @@
24
24
  "license": "MIT",
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "https://github.com/dedenlabs/claude-code-router-cli"
27
+ "url": "git+https://github.com/dedenlabs/claude-code-router-cli.git"
28
28
  },
29
29
  "bugs": {
30
30
  "url": "https://github.com/dedenlabs/claude-code-router-cli/issues"