"""Procedurally fabricate a convincing home directory inside the VFS. Used on HF Spaces and whenever the player declines the real mirror. Seeded so a run's sandbox is reproducible. """ from __future__ import annotations import random from .vfs import VFS FIRST_NAMES = ["sam", "alex", "jordan", "casey", "morgan", "riley"] PROJECTS = ["budget-tracker", "recipe-site", "dotfiles", "game-jam-2025", "scraper"] BANDS = ["radiohead", "boards_of_canada", "deftones", "carly_rae_jepsen"] TODO = """\ - renew car insurance (DUE FRIDAY) - call mom back - finish {project} readme - cancel the gym membership. actually do it this time - backup photos somewhere?? important """ JOURNAL = """\ {month} 3 couldn't sleep again. the fan in the desktop is making that noise. {month} 9 {name} says I should get outside more. they're right. tomorrow. {month} 17 weird. could've sworn I had more files in here yesterday. """ def fabricate_home(vfs: VFS, seed: int = 0) -> None: rng = random.Random(seed) name = rng.choice(FIRST_NAMES) project = rng.choice(PROJECTS) month = rng.choice(["jan", "feb", "mar", "oct", "nov"]) home = "/home/drifter" vfs.write(f"{home}/documents/todo.txt", TODO.format(project=project)) vfs.write(f"{home}/documents/journal.txt", JOURNAL.format(name=name, month=month)) vfs.write( f"{home}/documents/taxes_2025/receipts.csv", "date,amount,vendor\n2025-03-11,49.99,cloud storage (annual)\n2025-04-02,12.50,coffee", ) for i in rng.sample(range(100, 999), 6): vfs.write(f"{home}/photos/vacation/IMG_{i}.jpg", "\x89JPEG\x00") vfs.write(f"{home}/photos/cat_first_day.jpg", "\x89JPEG\x00") vfs.write( f"{home}/projects/{project}/README.md", f"# {project}\n\nGoing to finish this one. For real.\n", ) vfs.write(f"{home}/projects/{project}/main.py", "def main():\n pass # TODO\n") vfs.write(f"{home}/music/{rng.choice(BANDS)}/.keep", "") vfs.write( f"{home}/.bash_history", "ls\ncd projects\ngit status\ngit stash\ngit stash pop\nls\nls -a\nman tar", ) vfs.chdir(home)