From repo to roguelike: turning source code into a dungeon
GitHub Copilot CLI's /delegate command hands a task to GitHub's cloud-based coding agent, which works independently and opens a pull request when done. Developer Lee Reilly used that capability to build GitHub Dungeons, a Go-based terminal game that converts your repository into a procedurally generated roguelike map. The resulting dungeon is seeded by your latest commit SHA: same code, same layout; change the code and the map shifts. Hit zero HP and you restart from scratch.

The connection to roguelike tradition is deliberate. Games like Rogue in the 1980s paired procedural generation with permadeath in a text interface, a formula later codified in the "Berlin Interpretation." That design philosophy maps cleanly onto the command line, and the /yolo alias — Copilot CLI's shorthand for /allow-all — fits the permadeath spirit: you only live once.
How a repository becomes a map
GitHub Dungeons builds its layouts using Binary Space Partitioning (BSP). Rather than designing one level by hand, the game defines a recursive rule set that generates many: start with a large empty rectangle, split it into smaller regions, split those again, and continue until regions fall below a size where a room can fit. Each final "leaf" region becomes a room, with randomized size and position to break the grid feel. Corridors connect rooms by walking back up the split tree and linking siblings with L-shaped passages.
You don’t need any code blocks that aren't supported here.

BSP avoids the classic procedural generation failure modes. Pure randomness produces messy, unstructured maps; rigid grids are predictable and boring. BSP lands in the middle: rooms feel intentional, corridors guarantee connectivity, and the result is reproducible per seed while varying across runs.
Delegating the build
The project was written in Go, a language Reilly doesn't normally use. Working with Copilot CLI shifted the focus from syntax to behavior. Instead of writing every function, Reilly described features in plain English and delegated them. Requests such as /delegate Make each level progressively harder e.g. on level 2 there are extra baddies, but more health potions returned a solid first pass in a pull request that could be reviewed and fine-tuned.
The same approach scaled to peripheral features: cheat codes for invincibility, fog of war, auto-attack mechanics, and stat tracking for kills and levels. Copilot also generated a "dungeon scribe" agent (defined in .github/agents/dungeon-scribe.agent.md) tasked with writing documentation and ASCII art diagrams explaining how dungeon generation works. Reilly's summary of the workflow: "Using Copilot (especially with /delegate) is like having an army of NPCs available to do whatever I want them to do."
Playing your codebase
With GitHub Copilot CLI installed, the extension can be run with:
gh extension install leereilly/gh-dungeons
Launch gh dungeons to generate a dungeon from the current repository. Movement uses WASD, arrow keys, or Vim keys. The objective is reaching the hidden door and escaping through five levels of enemies, under fog-of-war visibility limits.
If you're feeling particularly reckless, there's a "crazy mode": a pre-commit hook that deletes saved changes unless you clear the entire game. The warning is unambiguous — this will destroy uncommitted work and likely some sanity along with it. An editor's note adds: "Please, please, please do not do this."
# Create the pre-commit hook
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
gh dungeons
if [ $? -ne 0 ]; then
echo "You died! Your changes have been stashed into oblivion..."
git stash && git stash drop stash@{0}
exit 1
fi
EOF
# Make it executable
chmod +x .git/hooks/pre-commit
# To be clear, you’ll lose all your uncommited changes if you enable this
# and fail to beat the dungeon, adventurer.
Patterns worth keeping
The experiment started as a throwaway, but it demonstrates a development loop that may outlast the game itself: quickly build a minimal viable product, delegate the heavy scaffolding (including the BSP generation and monster behaviors defined in a YAML file of Yendor), and reserve human attention for iteration on player experience rather than boilerplate. Reilly's takeaway is that delegating implementation details let him stay in a game-design mindset, testing mechanics and tweaking difficulty instead of dropping into syntax and edge cases.



