claudish 3.2.2 → 3.3.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/dist/index.js +21354 -24857
- package/package.json +12 -20
- package/recommended-models.json +1 -1
- package/README.md +0 -1061
- package/scripts/extract-models.ts +0 -214
- package/scripts/generate-manifest.ts +0 -89
- package/scripts/postinstall.cjs +0 -13
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Extract model information from shared/recommended-models.md
|
|
5
|
-
* and generate TypeScript types for use in Claudish
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
9
|
-
import { join } from "node:path";
|
|
10
|
-
|
|
11
|
-
interface ModelInfo {
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
priority: number;
|
|
15
|
-
provider: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ExtractedModels {
|
|
19
|
-
[key: string]: ModelInfo;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function extractModels(markdownContent: string): ExtractedModels {
|
|
23
|
-
const models: ExtractedModels = {};
|
|
24
|
-
let priority = 1;
|
|
25
|
-
|
|
26
|
-
// Extract from Quick Reference section (lines 11-30)
|
|
27
|
-
const quickRefMatch = markdownContent.match(
|
|
28
|
-
/## Quick Reference - Model IDs Only\n\n([\s\S]*?)\n---/
|
|
29
|
-
);
|
|
30
|
-
if (!quickRefMatch) {
|
|
31
|
-
throw new Error("Could not find Quick Reference section");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const quickRef = quickRefMatch[1];
|
|
35
|
-
const lines = quickRef.split("\n");
|
|
36
|
-
|
|
37
|
-
for (const line of lines) {
|
|
38
|
-
// Match pattern: - `model-id` - Description (may contain commas), $price/1M or FREE, contextK/M [⭐]
|
|
39
|
-
// Use non-greedy match and look for $ or FREE to find the price section
|
|
40
|
-
const match = line.match(/^- `([^`]+)` - (.+?), (?:\$[\d.]+\/1M|FREE), ([\dKM]+)(?: ⭐)?$/);
|
|
41
|
-
if (match) {
|
|
42
|
-
const [, modelId, description] = match;
|
|
43
|
-
|
|
44
|
-
// Determine provider from model ID
|
|
45
|
-
let provider = "Unknown";
|
|
46
|
-
if (modelId.startsWith("x-ai/")) provider = "xAI";
|
|
47
|
-
else if (modelId.startsWith("minimax/")) provider = "MiniMax";
|
|
48
|
-
else if (modelId.startsWith("z-ai/")) provider = "Zhipu AI";
|
|
49
|
-
else if (modelId.startsWith("openai/")) provider = "OpenAI";
|
|
50
|
-
else if (modelId.startsWith("google/")) provider = "Google";
|
|
51
|
-
else if (modelId.startsWith("qwen/")) provider = "Alibaba";
|
|
52
|
-
else if (modelId.startsWith("deepseek/")) provider = "DeepSeek";
|
|
53
|
-
else if (modelId.startsWith("tngtech/")) provider = "TNG Tech";
|
|
54
|
-
else if (modelId.startsWith("openrouter/")) provider = "OpenRouter";
|
|
55
|
-
else if (modelId.startsWith("anthropic/")) provider = "Anthropic";
|
|
56
|
-
|
|
57
|
-
// Extract short name from description
|
|
58
|
-
const name = description.trim();
|
|
59
|
-
|
|
60
|
-
models[modelId] = {
|
|
61
|
-
name,
|
|
62
|
-
description: description.trim(),
|
|
63
|
-
priority: priority++,
|
|
64
|
-
provider,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Add custom option
|
|
70
|
-
models.custom = {
|
|
71
|
-
name: "Custom Model",
|
|
72
|
-
description: "Enter any OpenRouter model ID manually",
|
|
73
|
-
priority: 999,
|
|
74
|
-
provider: "Custom",
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return models;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function generateTypeScript(models: ExtractedModels): string {
|
|
81
|
-
const modelIds = Object.keys(models)
|
|
82
|
-
.filter((id) => id !== "custom")
|
|
83
|
-
.map((id) => ` | "${id}"`)
|
|
84
|
-
.join("\n");
|
|
85
|
-
|
|
86
|
-
const modelInfo = Object.entries(models)
|
|
87
|
-
.map(([id, info]) => {
|
|
88
|
-
return ` "${id}": {
|
|
89
|
-
name: "${info.name}",
|
|
90
|
-
description: "${info.description}",
|
|
91
|
-
priority: ${info.priority},
|
|
92
|
-
provider: "${info.provider}",
|
|
93
|
-
}`;
|
|
94
|
-
})
|
|
95
|
-
.join(",\n");
|
|
96
|
-
|
|
97
|
-
return `// AUTO-GENERATED from shared/recommended-models.md
|
|
98
|
-
// DO NOT EDIT MANUALLY - Run 'bun run extract-models' to regenerate
|
|
99
|
-
|
|
100
|
-
import type { OpenRouterModel } from "./types.js";
|
|
101
|
-
|
|
102
|
-
export const DEFAULT_MODEL: OpenRouterModel = "x-ai/grok-code-fast-1";
|
|
103
|
-
export const DEFAULT_PORT_RANGE = { start: 3000, end: 9000 };
|
|
104
|
-
|
|
105
|
-
// Model metadata for validation and display
|
|
106
|
-
export const MODEL_INFO: Record<
|
|
107
|
-
OpenRouterModel,
|
|
108
|
-
{ name: string; description: string; priority: number; provider: string }
|
|
109
|
-
> = {
|
|
110
|
-
${modelInfo},
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// Environment variable names
|
|
114
|
-
export const ENV = {
|
|
115
|
-
OPENROUTER_API_KEY: "OPENROUTER_API_KEY",
|
|
116
|
-
CLAUDISH_MODEL: "CLAUDISH_MODEL",
|
|
117
|
-
CLAUDISH_PORT: "CLAUDISH_PORT",
|
|
118
|
-
CLAUDISH_ACTIVE_MODEL_NAME: "CLAUDISH_ACTIVE_MODEL_NAME", // Set by claudish to show active model in status line
|
|
119
|
-
ANTHROPIC_MODEL: "ANTHROPIC_MODEL", // Claude Code standard env var for model selection
|
|
120
|
-
ANTHROPIC_SMALL_FAST_MODEL: "ANTHROPIC_SMALL_FAST_MODEL", // Claude Code standard env var for fast model
|
|
121
|
-
// Claudish model mapping overrides (highest priority)
|
|
122
|
-
CLAUDISH_MODEL_OPUS: "CLAUDISH_MODEL_OPUS",
|
|
123
|
-
CLAUDISH_MODEL_SONNET: "CLAUDISH_MODEL_SONNET",
|
|
124
|
-
CLAUDISH_MODEL_HAIKU: "CLAUDISH_MODEL_HAIKU",
|
|
125
|
-
CLAUDISH_MODEL_SUBAGENT: "CLAUDISH_MODEL_SUBAGENT",
|
|
126
|
-
// Claude Code standard model configuration (fallback if CLAUDISH_* not set)
|
|
127
|
-
ANTHROPIC_DEFAULT_OPUS_MODEL: "ANTHROPIC_DEFAULT_OPUS_MODEL",
|
|
128
|
-
ANTHROPIC_DEFAULT_SONNET_MODEL: "ANTHROPIC_DEFAULT_SONNET_MODEL",
|
|
129
|
-
ANTHROPIC_DEFAULT_HAIKU_MODEL: "ANTHROPIC_DEFAULT_HAIKU_MODEL",
|
|
130
|
-
CLAUDE_CODE_SUBAGENT_MODEL: "CLAUDE_CODE_SUBAGENT_MODEL",
|
|
131
|
-
} as const;
|
|
132
|
-
|
|
133
|
-
// OpenRouter API Configuration
|
|
134
|
-
export const OPENROUTER_API_URL = "https://openrouter.ai/api/v1/chat/completions";
|
|
135
|
-
export const OPENROUTER_HEADERS = {
|
|
136
|
-
"HTTP-Referer": "https://claudish.com",
|
|
137
|
-
"X-Title": "Claudish - OpenRouter Proxy",
|
|
138
|
-
} as const;
|
|
139
|
-
`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function generateTypes(models: ExtractedModels): string {
|
|
143
|
-
const modelIds = Object.keys(models)
|
|
144
|
-
.filter((id) => id !== "custom")
|
|
145
|
-
.map((id) => ` "${id}"`)
|
|
146
|
-
.join(",\n");
|
|
147
|
-
|
|
148
|
-
return `// AUTO-GENERATED from shared/recommended-models.md
|
|
149
|
-
// DO NOT EDIT MANUALLY - Run 'bun run extract-models' to regenerate
|
|
150
|
-
|
|
151
|
-
// OpenRouter Models - Top Recommended for Development (Priority Order)
|
|
152
|
-
export const OPENROUTER_MODELS = [
|
|
153
|
-
${modelIds},
|
|
154
|
-
"custom",
|
|
155
|
-
] as const;
|
|
156
|
-
|
|
157
|
-
export type OpenRouterModel = (typeof OPENROUTER_MODELS)[number];
|
|
158
|
-
`;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Main execution
|
|
162
|
-
try {
|
|
163
|
-
const sharedModelsPath = join(import.meta.dir, "../../../shared/recommended-models.md");
|
|
164
|
-
const configPath = join(import.meta.dir, "../src/config.ts");
|
|
165
|
-
const typesPath = join(import.meta.dir, "../src/types.ts");
|
|
166
|
-
|
|
167
|
-
console.log("📖 Reading shared/recommended-models.md...");
|
|
168
|
-
const markdownContent = readFileSync(sharedModelsPath, "utf-8");
|
|
169
|
-
|
|
170
|
-
console.log("🔍 Extracting model information...");
|
|
171
|
-
const models = extractModels(markdownContent);
|
|
172
|
-
|
|
173
|
-
console.log(`✅ Found ${Object.keys(models).length - 1} models + custom option`);
|
|
174
|
-
|
|
175
|
-
console.log("📝 Generating config.ts...");
|
|
176
|
-
const configCode = generateTypeScript(models);
|
|
177
|
-
writeFileSync(configPath, configCode);
|
|
178
|
-
|
|
179
|
-
console.log("📝 Generating types.ts...");
|
|
180
|
-
const typesCode = generateTypes(models);
|
|
181
|
-
const existingTypes = readFileSync(typesPath, "utf-8");
|
|
182
|
-
|
|
183
|
-
// Replace OPENROUTER_MODELS array and OpenRouterModel type, keep other types
|
|
184
|
-
// Handle both auto-generated and manual versions
|
|
185
|
-
let updatedTypes = existingTypes;
|
|
186
|
-
|
|
187
|
-
// Try to replace auto-generated section first
|
|
188
|
-
if (existingTypes.includes("// AUTO-GENERATED")) {
|
|
189
|
-
updatedTypes = existingTypes.replace(
|
|
190
|
-
/\/\/ AUTO-GENERATED[\s\S]*?export type OpenRouterModel = \(typeof OPENROUTER_MODELS\)\[number\];/,
|
|
191
|
-
typesCode.trim()
|
|
192
|
-
);
|
|
193
|
-
} else {
|
|
194
|
-
// First time - replace manual OPENROUTER_MODELS section
|
|
195
|
-
updatedTypes = existingTypes.replace(
|
|
196
|
-
/\/\/ OpenRouter Models[\s\S]*?export type OpenRouterModel = \(typeof OPENROUTER_MODELS\)\[number\];/,
|
|
197
|
-
typesCode.trim()
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
writeFileSync(typesPath, updatedTypes);
|
|
202
|
-
|
|
203
|
-
console.log("✅ Successfully generated TypeScript files");
|
|
204
|
-
console.log("");
|
|
205
|
-
console.log("Models:");
|
|
206
|
-
for (const [id, info] of Object.entries(models)) {
|
|
207
|
-
if (id !== "custom") {
|
|
208
|
-
console.log(` • ${id} - ${info.name} (${info.provider})`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
} catch (error) {
|
|
212
|
-
console.error("❌ Error:", error);
|
|
213
|
-
process.exit(1);
|
|
214
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Generate release manifest with checksums
|
|
4
|
-
*
|
|
5
|
-
* Usage: bun scripts/generate-manifest.ts <version> <release-dir>
|
|
6
|
-
*
|
|
7
|
-
* Creates manifest.json with checksums and file sizes for all platforms
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { createHash } from "node:crypto";
|
|
11
|
-
import { readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
-
import { join } from "node:path";
|
|
13
|
-
|
|
14
|
-
interface PlatformInfo {
|
|
15
|
-
checksum: string;
|
|
16
|
-
size: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface Manifest {
|
|
20
|
-
version: string;
|
|
21
|
-
buildDate: string;
|
|
22
|
-
platforms: Record<string, PlatformInfo>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const PLATFORM_MAP: Record<string, string> = {
|
|
26
|
-
"claudish-darwin-arm64": "darwin-arm64",
|
|
27
|
-
"claudish-darwin-x64": "darwin-x64",
|
|
28
|
-
"claudish-linux-x64": "linux-x64",
|
|
29
|
-
"claudish-linux-arm64": "linux-arm64",
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
function computeSha256(filePath: string): string {
|
|
33
|
-
const content = readFileSync(filePath);
|
|
34
|
-
return createHash("sha256").update(content).digest("hex");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function generateManifest(version: string, releaseDir: string): Manifest {
|
|
38
|
-
const platforms: Record<string, PlatformInfo> = {};
|
|
39
|
-
|
|
40
|
-
const files = readdirSync(releaseDir);
|
|
41
|
-
|
|
42
|
-
for (const file of files) {
|
|
43
|
-
const platform = PLATFORM_MAP[file];
|
|
44
|
-
if (!platform) continue;
|
|
45
|
-
|
|
46
|
-
const filePath = join(releaseDir, file);
|
|
47
|
-
const stats = statSync(filePath);
|
|
48
|
-
|
|
49
|
-
platforms[platform] = {
|
|
50
|
-
checksum: computeSha256(filePath),
|
|
51
|
-
size: stats.size,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
version,
|
|
57
|
-
buildDate: new Date().toISOString(),
|
|
58
|
-
platforms,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Main
|
|
63
|
-
const args = process.argv.slice(2);
|
|
64
|
-
|
|
65
|
-
if (args.length < 2) {
|
|
66
|
-
console.error("Usage: bun scripts/generate-manifest.ts <version> <release-dir>");
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const [version, releaseDir] = args;
|
|
71
|
-
|
|
72
|
-
const manifest = generateManifest(version, releaseDir);
|
|
73
|
-
|
|
74
|
-
// Write manifest.json
|
|
75
|
-
const manifestPath = join(releaseDir, "manifest.json");
|
|
76
|
-
writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
77
|
-
|
|
78
|
-
console.log("Generated manifest.json:");
|
|
79
|
-
console.log(JSON.stringify(manifest, null, 2));
|
|
80
|
-
|
|
81
|
-
// Also write checksums.txt for backwards compatibility
|
|
82
|
-
const checksumsPath = join(releaseDir, "checksums.txt");
|
|
83
|
-
const checksums = Object.entries(PLATFORM_MAP)
|
|
84
|
-
.filter(([file]) => manifest.platforms[PLATFORM_MAP[file]])
|
|
85
|
-
.map(([file, platform]) => `${manifest.platforms[platform].checksum} ${file}`)
|
|
86
|
-
.join("\n");
|
|
87
|
-
|
|
88
|
-
writeFileSync(checksumsPath, checksums + "\n");
|
|
89
|
-
console.log("\nGenerated checksums.txt");
|
package/scripts/postinstall.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
console.log("\x1b[32m✓ Claudish installed successfully!\x1b[0m");
|
|
4
|
-
console.log("");
|
|
5
|
-
console.log("\x1b[1mUsage:\x1b[0m");
|
|
6
|
-
console.log(' claudish --model x-ai/grok-code-fast-1 "your prompt"');
|
|
7
|
-
console.log(" claudish --interactive # Interactive model selection");
|
|
8
|
-
console.log(" claudish --list-models # List all available models");
|
|
9
|
-
console.log("");
|
|
10
|
-
console.log("\x1b[1mGet started:\x1b[0m");
|
|
11
|
-
console.log(" 1. Set OPENROUTER_API_KEY environment variable");
|
|
12
|
-
console.log(" 2. Run: claudish --interactive");
|
|
13
|
-
console.log("");
|