()
| 1683 | const DROPBOX_CLIENT_ID = 'your-dropbox-app-key'; |
| 1684 | |
| 1685 | function buildBackupData() { |
| 1686 | const studio = loadStudioConfig(); |
| 1687 | const opencodeConfig = loadConfig(); |
| 1688 | const skills = []; |
| 1689 | const plugins = []; |
| 1690 | |
| 1691 | const sd = getActiveSkillDir(); |
| 1692 | if (sd && fs.existsSync(sd)) { |
| 1693 | fs.readdirSync(sd, { withFileTypes: true }) |
| 1694 | .filter(e => e.isDirectory() && fs.existsSync(path.join(sd, e.name, 'SKILL.md'))) |
| 1695 | .forEach(e => { |
| 1696 | skills.push({ name: e.name, content: fs.readFileSync(path.join(sd, e.name, 'SKILL.md'), 'utf8') }); |
| 1697 | }); |
| 1698 | } |
| 1699 | |
| 1700 | const pd = getActivePluginDir(); |
| 1701 | if (pd && fs.existsSync(pd)) { |
| 1702 | fs.readdirSync(pd, { withFileTypes: true }).forEach(e => { |
| 1703 | if (e.isFile() && /\.(js|ts)$/.test(e.name)) { |
| 1704 | plugins.push({ name: e.name.replace(/\.(js|ts)$/, ''), content: fs.readFileSync(path.join(pd, e.name), 'utf8') }); |
| 1705 | } |
| 1706 | }); |
| 1707 | } |
| 1708 | |
| 1709 | const cloudSettings = studio.cloudProvider ? { provider: studio.cloudProvider } : {}; |
| 1710 | |
| 1711 | return { |
| 1712 | version: 1, |
| 1713 | timestamp: new Date().toISOString(), |
| 1714 | studioConfig: { ...studio, cloudToken: undefined, cloudProvider: undefined }, |
| 1715 | opencodeConfig, |
| 1716 | skills, |
| 1717 | plugins |
| 1718 | }; |
| 1719 | } |
| 1720 | |
| 1721 | function restoreFromBackup(backup, studio) { |
| 1722 | if (backup.studioConfig) { |
no test coverage detected