Files
Fishing/tools/mcp/exec.js
T
2026-11-06 12:34:01 +05:00

11 lines
687 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// node tools/mcp/exec.js <file.lua> [Edit|Server|Client] — выполнить Luau-файл в Studio через MCP
const fs = require('fs'), path = require('path'), os = require('os'), { execFileSync } = require('child_process');
const code = fs.readFileSync(process.argv[2], 'utf8').replace(/^/, '');
const tmp = path.join(os.tmpdir(), 'fishing-mcp-steps-' + process.pid + '.json');
fs.writeFileSync(tmp, JSON.stringify([{ tool: 'execute_luau', args: { datamodel_type: process.argv[3] || 'Edit', code } }]));
try {
process.stdout.write(execFileSync('node', [path.join(__dirname, 'run.js'), tmp], { encoding: 'utf8', maxBuffer: 1 << 26 }));
} finally {
fs.unlinkSync(tmp);
}