import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { parseTable, rollTable } from '@solo/oracle'; const HERE = path.dirname(fileURLToPath(import.meta.url)); /** Roll a starting background from characters/backgrounds.csv. */ function background() { const file = path.join(HERE, 'characters', 'backgrounds.csv'); const entries = parseTable(fs.readFileSync(file, 'utf8')); const { roll, entry } = rollTable(entries); const tags = entry.tags.length ? ` [${entry.tags.join(', ')}]` : ''; console.log(`background roll ${roll} → "${entry.text}"${tags}`); } /** * A game package's default export is its manifest. See docs/games.md. */ export default { id: 'generic', title: 'Generic d6 Oracle', description: 'System-agnostic solo play driven by the d6 oracle and spark tables.', rules: 'game.md', commands: { background: { description: 'Roll a starting character background.', run: background, }, }, };