claudish 1.7.0 → 1.8.0
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/dist/index.js +46 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -331,6 +331,13 @@ function getAvailableModels() {
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
// src/cli.ts
|
|
334
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
335
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
336
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
337
|
+
var __filename3 = fileURLToPath2(import.meta.url);
|
|
338
|
+
var __dirname3 = dirname2(__filename3);
|
|
339
|
+
var packageJson = JSON.parse(readFileSync2(join3(__dirname3, "../package.json"), "utf-8"));
|
|
340
|
+
var VERSION = packageJson.version;
|
|
334
341
|
function parseArgs(args) {
|
|
335
342
|
const config = {
|
|
336
343
|
model: undefined,
|
|
@@ -423,7 +430,12 @@ function parseArgs(args) {
|
|
|
423
430
|
printHelp();
|
|
424
431
|
process.exit(0);
|
|
425
432
|
} else if (arg === "--list-models") {
|
|
426
|
-
|
|
433
|
+
const hasJsonFlag = args.includes("--json");
|
|
434
|
+
if (hasJsonFlag) {
|
|
435
|
+
printAvailableModelsJSON();
|
|
436
|
+
} else {
|
|
437
|
+
printAvailableModels();
|
|
438
|
+
}
|
|
427
439
|
process.exit(0);
|
|
428
440
|
} else {
|
|
429
441
|
config.claudeArgs = args.slice(i);
|
|
@@ -472,7 +484,7 @@ function parseArgs(args) {
|
|
|
472
484
|
return config;
|
|
473
485
|
}
|
|
474
486
|
function printVersion() {
|
|
475
|
-
console.log(
|
|
487
|
+
console.log(`claudish version ${VERSION}`);
|
|
476
488
|
}
|
|
477
489
|
function printHelp() {
|
|
478
490
|
console.log(`
|
|
@@ -499,6 +511,7 @@ OPTIONS:
|
|
|
499
511
|
--audit-costs Show cost analysis report
|
|
500
512
|
--reset-costs Reset accumulated cost statistics
|
|
501
513
|
--list-models List available OpenRouter models
|
|
514
|
+
--list-models --json Output model list in JSON format
|
|
502
515
|
--version Show version information
|
|
503
516
|
-h, --help Show this help message
|
|
504
517
|
|
|
@@ -562,6 +575,7 @@ EXAMPLES:
|
|
|
562
575
|
|
|
563
576
|
AVAILABLE MODELS:
|
|
564
577
|
Run: claudish --list-models
|
|
578
|
+
JSON output: claudish --list-models --json
|
|
565
579
|
|
|
566
580
|
MORE INFO:
|
|
567
581
|
GitHub: https://github.com/MadAppGang/claude-code
|
|
@@ -585,6 +599,33 @@ Available OpenRouter Models (in priority order):
|
|
|
585
599
|
console.log(`Or use: claudish --model <model> ...
|
|
586
600
|
`);
|
|
587
601
|
}
|
|
602
|
+
function printAvailableModelsJSON() {
|
|
603
|
+
const jsonPath = join3(__dirname3, "../recommended-models.json");
|
|
604
|
+
try {
|
|
605
|
+
const jsonContent = readFileSync2(jsonPath, "utf-8");
|
|
606
|
+
const data = JSON.parse(jsonContent);
|
|
607
|
+
console.log(JSON.stringify(data, null, 2));
|
|
608
|
+
} catch (error) {
|
|
609
|
+
const models = getAvailableModels();
|
|
610
|
+
const modelInfo = loadModelInfo();
|
|
611
|
+
const output = {
|
|
612
|
+
version: VERSION,
|
|
613
|
+
lastUpdated: new Date().toISOString().split("T")[0],
|
|
614
|
+
source: "runtime",
|
|
615
|
+
models: models.filter((m) => m !== "custom").map((modelId) => {
|
|
616
|
+
const info = modelInfo[modelId];
|
|
617
|
+
return {
|
|
618
|
+
id: modelId,
|
|
619
|
+
name: info.name,
|
|
620
|
+
description: info.description,
|
|
621
|
+
provider: info.provider,
|
|
622
|
+
priority: info.priority
|
|
623
|
+
};
|
|
624
|
+
})
|
|
625
|
+
};
|
|
626
|
+
console.log(JSON.stringify(output, null, 2));
|
|
627
|
+
}
|
|
628
|
+
}
|
|
588
629
|
|
|
589
630
|
// src/index.ts
|
|
590
631
|
init_config();
|
|
@@ -736,7 +777,7 @@ async function selectModelInteractively() {
|
|
|
736
777
|
|
|
737
778
|
// src/logger.ts
|
|
738
779
|
import { writeFileSync as writeFileSync2, appendFile, existsSync as existsSync2, mkdirSync } from "fs";
|
|
739
|
-
import { join as
|
|
780
|
+
import { join as join4 } from "path";
|
|
740
781
|
var logFilePath = null;
|
|
741
782
|
var logLevel = "info";
|
|
742
783
|
var logBuffer = [];
|
|
@@ -781,12 +822,12 @@ function initLogger(debugMode, level = "info") {
|
|
|
781
822
|
return;
|
|
782
823
|
}
|
|
783
824
|
logLevel = level;
|
|
784
|
-
const logsDir =
|
|
825
|
+
const logsDir = join4(process.cwd(), "logs");
|
|
785
826
|
if (!existsSync2(logsDir)) {
|
|
786
827
|
mkdirSync(logsDir, { recursive: true });
|
|
787
828
|
}
|
|
788
829
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").split("T").join("_").slice(0, -5);
|
|
789
|
-
logFilePath =
|
|
830
|
+
logFilePath = join4(logsDir, `claudish_${timestamp}.log`);
|
|
790
831
|
writeFileSync2(logFilePath, `Claudish Debug Log - ${new Date().toISOString()}
|
|
791
832
|
Log Level: ${level}
|
|
792
833
|
${"=".repeat(80)}
|
package/package.json
CHANGED