feat: 新增卸载脚本与统一版本管理

uninstall.mjs 一键清理 installed.json/managed 副本/含密钥配置目录(--yes/--dry-run,幂等);scripts/bump-version.mjs 以 package.json 为唯一版本来源同步 kimi.plugin.json,挂 npm version 钩子;vision.mjs VERSION 运行时读 package.json,并修复 modelsEndpoint 对 /chat/completions 结尾的边界。1.0.5 → 1.0.6。
This commit is contained in:
billowliu2 committed 2026-08-02 16:40:57 +08:00
1 parent 8a5d41ebca
commit 839a66ff5d
5 files changed
+263 -5

No files matched your search

+15 -1
View File
@@ -10,7 +10,19 @@ import { execFileSync } from 'node:child_process';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const MODELS_DB_PATH = path.join(__dirname, 'models-db.json');
export const VERSION = '1.0.2';
// Single source of truth for the version: package.json.
// Shared by the MCP server (serverInfo.version) and any consumer of this module.
function readPackageVersion() {
try {
const pkg = JSON.parse(
fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')
);
return typeof pkg.version === 'string' && pkg.version ? pkg.version : '0.0.0';
} catch {
return '0.0.0';
}
}
export const VERSION = readPackageVersion();
export const EXT_MEDIA = {
png: 'image/png',
@@ -145,6 +157,8 @@ export function anthropicEndpoint(baseUrl) {
export function modelsEndpoint(baseUrl, protocol) {
let b = String(baseUrl || '').trim().replace(/\/+$/, '');
if (!b) return '';
// 用户可能把完整 chat/completions 端点当 BaseUrl 填(与 openaiEndpoint 处理保持一致)
if (/\/chat\/completions$/i.test(b)) b = b.replace(/\/chat\/completions$/i, '');
if (/\/v\d+$/i.test(b)) return `${b}/models`;
return `${b}/v1/models`;
}