MCPcopy Create free account
hub / github.com/aomukai/Writingway2 / backupToLocalVersioning

Function backupToLocalVersioning

src/modules/github-backup.js:327–361  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

325 },
326
327 async backupToLocalVersioning(app) {
328 if (!app.currentProject) {
329 return { success: false, error: 'No project selected' };
330 }
331
332 try {
333 const projectData = await this.exportProjectData(app);
334 if (!projectData) {
335 return { success: false, error: 'No project data' };
336 }
337
338 const response = await fetch(LOCAL_BACKUP_CREATE_ENDPOINT, {
339 method: 'POST',
340 headers: {
341 'Content-Type': 'application/json'
342 },
343 body: JSON.stringify(projectData)
344 });
345
346 const result = await response.json().catch(() => ({}));
347 if (!response.ok || !result.ok) {
348 return { success: false, error: result.error || `HTTP ${response.status}` };
349 }
350
351 return {
352 success: true,
353 provider: 'local',
354 backupId: result.backupId,
355 path: result.path,
356 timestamp: result.timestamp
357 };
358 } catch (e) {
359 return { success: false, error: e.message };
360 }
361 },
362
363 async listLocalBackups(app) {
364 if (!app.currentProject) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected