const fs = require('fs'); const p = 'D:/拼豆/taskboard/tasks.json'; const db = JSON.parse(fs.readFileSync(p, 'utf8')); const TZ = 8 * 60 * 60 * 1000; function migrate(v) { if (typeof v === 'string' && /^\d{4}-\d{2}-\d{2}T[\d:.]+Z$/.test(v)) { const d = new Date(Date.parse(v) + TZ); return d.toISOString().replace('Z', '+08:00'); } return v; } function walk(obj) { if (Array.isArray(obj)) { obj.forEach(walk); return; } if (obj && typeof obj === 'object') { for (const k of Object.keys(obj)) obj[k] = migrate(obj[k]); for (const k of Object.keys(obj)) if (obj[k] && typeof obj[k] === 'object') walk(obj[k]); } } walk(db); fs.writeFileSync(p, JSON.stringify(db, null, 2), 'utf8'); console.log('migrated to +08:00, tasks:', db.tasks.length, 'agents:', Object.keys(db.agents || {}).length);