MCPcopy Index your code
hub / github.com/Microck/opencode-studio / buildBackupData

Function buildBackupData

server/index.js:1685–1719  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1683const DROPBOX_CLIENT_ID = 'your-dropbox-app-key';
1684
1685function 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
1721function restoreFromBackup(backup, studio) {
1722 if (backup.studioConfig) {

Callers 1

index.jsFile · 0.85

Calls 4

loadStudioConfigFunction · 0.85
loadConfigFunction · 0.85
getActiveSkillDirFunction · 0.85
getActivePluginDirFunction · 0.85

Tested by

no test coverage detected