refactor(scenarios): split monolithic configuration into individual files

- Split `scenarios/scenarios.json` into individual JSON files under `scenarios/data/` named `<scenario-id>.json`
- Split `scenarios/bundles.json` into individual JSON files under `scenarios/bundles/` named `<bundle-id>.json`
- Updated `backend/server.js` to dynamically load scenario and bundle files from their respective directories
- Updated documentation in `scenarios/SCHEMA.md` and `README.md` to reflect the new repository layout and contributor workflow

Signed-off-by: Abhinav Sinha <[email protected]>
This commit is contained in:
Abhinav Sinha
2026-06-15 07:52:47 +05:30
parent 2104c5fea6
commit 124e5276d4
94 changed files with 4256 additions and 4217 deletions
+10 -4
View File
@@ -10,8 +10,8 @@ const PORT = 4000;
app.use(express.json());
app.use(express.static(path.join(__dirname, '../frontend/dist')));
const SCENARIOS_FILE = path.join(__dirname, '../scenarios/scenarios.json');
const BUNDLES_FILE = path.join(__dirname, '../scenarios/bundles.json');
const SCENARIOS_DIR = path.join(__dirname, '../scenarios/data');
const BUNDLES_DIR = path.join(__dirname, '../scenarios/bundles');
const DB_FILE = process.env.PROGRESS_DB || '/data/progress.db';
// ── SQLite progress store ─────────────────────────────────────────────────────
@@ -82,12 +82,18 @@ function saveProgress(progress) {
}
function loadJsonDir(dir) {
return fs.readdirSync(dir)
.filter(f => f.endsWith('.json'))
.map(f => JSON.parse(fs.readFileSync(path.join(dir, f), 'utf8')));
}
function loadScenarios() {
return JSON.parse(fs.readFileSync(SCENARIOS_FILE, 'utf8'));
return loadJsonDir(SCENARIOS_DIR);
}
function loadBundles() {
return JSON.parse(fs.readFileSync(BUNDLES_FILE, 'utf8'));
return loadJsonDir(BUNDLES_DIR);
}
function runCommand(cmd, timeoutMs = 15000) {