mirror of
https://github.com/musistudio/claude-code-router.git
synced 2026-02-02 23:00:50 +08:00
release v1.0.54
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@musistudio/claude-code-router",
|
"name": "@musistudio/claude-code-router",
|
||||||
"version": "1.0.53",
|
"version": "1.0.54",
|
||||||
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
"description": "Use Claude Code without an Anthropics account and route it to another LLM provider",
|
||||||
"bin": {
|
"bin": {
|
||||||
"ccr": "dist/cli.js"
|
"ccr": "dist/cli.js"
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"find-process": "^2.0.0",
|
"find-process": "^2.0.0",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
|
"minimist": "^1.2.8",
|
||||||
"openurl": "^1.1.1",
|
"openurl": "^1.1.1",
|
||||||
"rotating-file-stream": "^3.2.7",
|
"rotating-file-stream": "^3.2.7",
|
||||||
"shell-quote": "^1.8.3",
|
"shell-quote": "^1.8.3",
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -23,6 +23,9 @@ importers:
|
|||||||
json5:
|
json5:
|
||||||
specifier: ^2.2.3
|
specifier: ^2.2.3
|
||||||
version: 2.2.3
|
version: 2.2.3
|
||||||
|
minimist:
|
||||||
|
specifier: ^1.2.8
|
||||||
|
version: 1.2.8
|
||||||
openurl:
|
openurl:
|
||||||
specifier: ^1.1.1
|
specifier: ^1.1.1
|
||||||
version: 1.1.1
|
version: 1.1.1
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
incrementReferenceCount,
|
incrementReferenceCount,
|
||||||
} from "./processCheck";
|
} from "./processCheck";
|
||||||
import { quote } from 'shell-quote';
|
import { quote } from 'shell-quote';
|
||||||
|
import minimist from "minimist";
|
||||||
|
|
||||||
|
|
||||||
export async function executeCodeCommand(args: string[] = []) {
|
export async function executeCodeCommand(args: string[] = []) {
|
||||||
// Set environment variables
|
// Set environment variables
|
||||||
@@ -56,9 +58,17 @@ export async function executeCodeCommand(args: string[] = []) {
|
|||||||
const stdioConfig: StdioOptions = config.NON_INTERACTIVE_MODE
|
const stdioConfig: StdioOptions = config.NON_INTERACTIVE_MODE
|
||||||
? ["pipe", "inherit", "inherit"] // Pipe stdin for non-interactive
|
? ["pipe", "inherit", "inherit"] // Pipe stdin for non-interactive
|
||||||
: "inherit"; // Default inherited behavior
|
: "inherit"; // Default inherited behavior
|
||||||
|
|
||||||
|
const argsObj = minimist(args)
|
||||||
|
const argsArr = []
|
||||||
|
for (const [argsObjKey, argsObjValue] of Object.entries(argsObj)) {
|
||||||
|
if (argsObjKey !== '_' && argsObj[argsObjKey]) {
|
||||||
|
argsArr.push(`${argsObjKey.length === 1 ? '-' : '--'}${argsObjKey} ${JSON.stringify(argsObjValue)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
const claudeProcess = spawn(
|
const claudeProcess = spawn(
|
||||||
claudePath + (joinedArgs ? ` ${joinedArgs}` : ""),
|
claudePath,
|
||||||
[],
|
argsArr,
|
||||||
{
|
{
|
||||||
env: process.env,
|
env: process.env,
|
||||||
stdio: stdioConfig,
|
stdio: stdioConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user