This commit is contained in:
heyshawtyy committed 2026-11-09 22:37:44 +05:00
1 parent fd5e92d0f5
commit 9f898c04dd
415 files changed
+6241617 -633464

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
// node tools/mcp/sync.js <пути от src/> … — записать исходники из src/ в открытый плейс через Studio MCP
// (без Rojo). Новые скрипты создаются через multi_edit, существующие обновляются через execute_luau.
const fs = require('fs'), path = require('path'), os = require('os'), { execFileSync } = require('child_process');
const SRC = path.join(__dirname, '..', '..', 'src');
const ROOTS = {
'ReplicatedFirst': 'game.ReplicatedFirst', 'ReplicatedStorage': 'game.ReplicatedStorage',
'ServerScriptService': 'game.ServerScriptService', 'StarterPlayer/StarterPlayerScripts': 'game.StarterPlayer.StarterPlayerScripts',
};
const steps = [];
for (const rel of process.argv.slice(2)) {
const norm = rel.replace(/\\/g, '/');
const rootKey = Object.keys(ROOTS).find(k => norm.startsWith(k + '/'));
if (!rootKey) throw new Error('неизвестная папка: ' + rel);
const file = path.basename(norm);
let name, cls;
if (file.endsWith('.server.lua')) { name = file.slice(0, -11); cls = 'Script'; }
else if (file.endsWith('.client.lua')) { name = file.slice(0, -11); cls = 'LocalScript'; }
else { name = file.slice(0, -4); cls = 'ModuleScript'; }
const src = fs.readFileSync(path.join(SRC, norm), 'utf8').replace(/^/, '');
let lvl = 1; while (src.includes(']' + '='.repeat(lvl) + ']')) lvl++;
const eq = '='.repeat(lvl);
steps.push({ tool: 'execute_luau', args: { datamodel_type: 'Edit', code: `local s = ${ROOTS[rootKey]}:FindFirstChild(${JSON.stringify(name)})
if not s or s.ClassName ~= ${JSON.stringify(cls)} then return ${JSON.stringify(name)} .. " НЕТ В ПЛЕЙСЕ" end
local src = [${eq}[${src}]${eq}]
local ok = pcall(function() game:GetService("ScriptEditorService"):UpdateSourceAsync(s, function() return src end) end)
if not ok then s.Source = src end
return ${JSON.stringify(name)} .. " ok " .. #s.Source` } });
}
const tmp = path.join(os.tmpdir(), 'fishing-sync-' + process.pid + '.json');
fs.writeFileSync(tmp, JSON.stringify(steps));
process.stdout.write(execFileSync('node', [path.join(__dirname, 'run.js'), tmp], { encoding: 'utf8', maxBuffer: 1 << 26 }));
fs.unlinkSync(tmp);