sokko-g/scripts/backup-nebula-cards.mjs
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

24 lines
1.4 KiB
JavaScript

/**
* @file Sauvegarde ou vérifie la base Sokko TCG depuis les tâches d'exploitation.
*/
import { resolve } from "node:path";
import { backupCardsDatabase, restoreCardsDatabase, runScheduledBackup, verifyCardsDatabase } from "../services/cards/backup.js";
const [mode, source, destination, keepFlag, keepValue] = process.argv.slice(2);
if (mode === "backup" && source && destination) {
await backupCardsDatabase(resolve(source), resolve(destination));
console.log(`Sokko TCG backup written to ${resolve(destination)}`);
} else if (mode === "scheduled" && source && destination && (!keepFlag || keepFlag === "--keep")) {
const written = await runScheduledBackup(resolve(source), resolve(destination), keepFlag ? { keep: Number(keepValue) } : {});
console.log(`Sokko TCG scheduled backup written to ${written}`);
} else if (mode === "verify" && source) {
verifyCardsDatabase(resolve(source));
console.log(`Sokko TCG backup verified: ${resolve(source)}`);
} else if (mode === "restore" && source && destination) {
restoreCardsDatabase(resolve(source), resolve(destination));
console.log(`Sokko TCG database restored to ${resolve(destination)}`);
} else {
console.error("Usage: node scripts/backup-nebula-cards.mjs backup <database> <backup> | scheduled <database> <directory> [--keep <count>] | verify <backup> | restore <backup> <database>");
process.exitCode = 1;
}