UNPKG

@gabrielmaialva33/mcp-filesystem

Version:
50 lines 1.64 kB
import { promisify } from 'node:util'; import { exec } from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; promisify(exec); export function errorTypeToString(errorCode) { const errorTypes = { TS2339: 'Property Error', TS2393: 'Duplicate Implementation', TS2367: 'Type Comparison Error', TS2322: 'Type Assignment Error', TS6133: 'Unused Variable', }; return errorTypes[errorCode] || 'Unknown Error'; } export async function detectPackageManager(projectPath) { const lockFiles = { 'pnpm-lock.yaml': 'pnpm', 'yarn.lock': 'yarn', 'package-lock.json': 'npm', }; for (const [lockFile, manager] of Object.entries(lockFiles)) { if (fs.existsSync(path.join(projectPath, lockFile))) { return manager; } } return 'unknown'; } export function getProjectCommands(packageManager) { const pmCmd = packageManager === 'pnpm' ? 'pnpm' : packageManager === 'yarn' ? 'yarn' : 'npm'; const commands = { install: `${pmCmd} install`, build: `${pmCmd} run build`, start: `${pmCmd} run start`, test: `${pmCmd} run test`, }; if (packageManager === 'pnpm' || packageManager === 'npm') { commands.dev = `${pmCmd} run dev`; commands.preview = `${pmCmd} run preview`; commands.serve = `${pmCmd} run serve`; } if (packageManager === 'npm') { commands.lint = `${pmCmd} run lint`; } return commands; } export async function detectProjectType(_projectPath) { return 'nodejs'; } //# sourceMappingURL=project_detector.js.map