优化工具

This commit is contained in:
2025-12-10 17:11:46 +08:00
parent 4b451b2d58
commit af1185c4d7
18 changed files with 316 additions and 214 deletions
+15
View File
@@ -0,0 +1,15 @@
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export function loadDescription(toolName: string): string {
const filePath = path.join(__dirname, 'descriptions', `${toolName}.txt`);
try {
return fs.readFileSync(filePath, 'utf-8').trim();
} catch {
throw new Error(`无法加载工具描述文件: ${filePath}`);
}
}