An AI-powered CLI agent that generates and edits interactive CLI games from natural language prompts, with Relace integration for cloud-backed version control.
Stack: Relace Repos, OpenAI, Cursor
- Relace Repos demo - CLI mini game vibe coding agent
- ๐ฎ Generate CLI games from natural language prompts
- โ๏ธ Edit existing games with AI assistance
- โ๏ธ Relace integration as source of truth for version control
- ๐ Live preview with auto-restart
- ๐จ Beautiful CLI interface with colored output
- ๐ฏ Interactive mode for continuous development
- ๐ Smart diff-based updates (AI generates changes โ Relace โ local sync)
npm install- Create a
.envfile with your API keys:
OPENAI_API_KEY=your_openai_api_key
RELACE_API_KEY=your_relace_api_key- Install dependencies:
npm install# Start interactive mode
npm start
# or
node src/index.jsNote: If API keys aren't configured, interactive mode will prompt you to enter them automatically!
# Generate a CLI game
vibe generate "Create a number guessing game"
# Start preview server
vibe preview
# List all local projects
npm run list
# Delete a single project
npm run delete
## Interactive Commands
When in interactive mode, you can use these commands:
### Creating New Games
- `generate <prompt>` - Generate a new CLI game from prompt
### Editing Existing Games
- `select` - Choose a game to work on
- `edit <prompt>` - Edit the selected game with AI (auto-runs preview after)
### Management
- `preview` - Start/restart preview server for current game
- `delete` - Delete a project (local + Relace repo)
- `status` - Show current status and selected project
- `help` - Show help message
- `exit` - Exit interactive mode
## Examples
### Generate CLI Games
vibe> generate "Create a number guessing game where the player has 5 tries"
vibe> generate "Create a word scramble game with a score system"
vibe> generate "Create a simple RPG battle game with health and attack commands"
### Edit an Existing Game
vibe> select
# Choose a game from the list
vibe> edit "add a timer that counts down from 60 seconds"
# AI generates diff โ commits to Relace โ pulls updated code โ starts preview
vibe> edit "make the game harder by reducing tries to 3"
# Iteratively improve the selected game
vibe> edit "add colors using chalk to make output more fun"
# Keep editing with natural language
When you run edit <prompt>:
- ๐ค AI generates JSON diff operations (not full code, just the changes)
- โ๏ธ Commits diff to Relace repo (Relace becomes source of truth)
- ๐ฅ Pulls latest code from Relace (syncs local files with cloud)
- ๐ฎ Starts preview server (runs the updated game)
This ensures Relace is always the authoritative source, enabling proper version control and multi-device workflows.
Each CLI game is a single-file Node.js program saved in its own folder under vibe_projects/:
vibe_projects/
โโโ a-number-guessing-2025-10-08T05-16-00-706Z/
โ โโโ game.js # Single game file with all logic
โ โโโ package.json # Dependencies and metadata
โ โโโ node_modules/ # Installed packages
โโโ a-word-scramble-2025-10-08T06-20-29-325Z/
โโโ game.js
โโโ package.json
โโโ node_modules/
Simple structure:
game.js- The complete game in a single filepackage.json- Dependencies (likechalk,inquirer) and Relace metadata- Project folders are named based on the prompt and timestamp to avoid conflicts
Each generated project automatically stores its Relace repo ID in package.json:
{
"name": "a-number-guessing-game",
"version": "1.0.0",
...
"vibe": {
"generated": "2025-10-08T12:00:00.000Z",
"relaceRepoId": "9195bae7-04f7-406e-a13b-9e77b8744320",
"lastBackup": "2025-10-08T12:05:00.000Z"
}
}This metadata enables:
- ๐ Track which Relace repo belongs to which local project
- ๐๏ธ Delete the correct repo when deleting a project
- ๐ Update the same repo on subsequent edits
- ๐ฆ Preserve local metadata when pulling from Relace
Relace repos serve as the source of truth for game code:
- All edits go through Relace first - AI generates diff operations that are committed to Relace
- Local files sync from Relace - After committing, we pull the latest code from Relace
- Metadata preserved locally - Special handling ensures
relaceRepoIdis never lost during sync
- Used for generating and editing game code
- Requires OpenAI API key
- Uses GPT-4 for intelligent code generation
- For edits: generates JSON diff operations instead of full code
- Cloud-based version control for generated games
- Requires Relace API key
- Automatic backup after each generation
- Diff-based updates for efficient editing
- Clone operation to sync code from cloud to local
The preview server:
- Runs CLI games in an isolated process
- Auto-restarts when files change (during development)
- Provides interactive terminal experience
- Shows game output in real-time
To delete a single project:
npm run deleteOr in interactive mode:
vibe> delete
This will:
- Show you a list of available projects
- Let you select which one to delete
- Ask for confirmation
- Delete the local project folder
- Delete the associated Relace repo (reads
relaceRepoIdfrompackage.json)
- AI generates JSON diff operations
- Commit diff to Relace using
@relace-ai/relaceSDK - Pull latest code from Relace using
clone() - Save files locally (preserving
package.jsonmetadata) - Start preview server
Example Diff Operations:
[
{
"type": "write",
"filename": "game.js",
"content": "// Updated game code here"
},
{
"type": "delete",
"filename": "old-file.js"
},
{
"type": "rename",
"old_filename": "utils.js",
"new_filename": "helpers.js"
}
]# Start interactive mode, it will prompt for keys
npm startMake sure to run preview at least once before editing:
vibe> select
vibe> preview
vibe> edit "your changes"
The first preview creates a Relace backup, subsequent edits update that same repo.
Check your Relace API key and ensure you have sufficient quota. The edit command will show detailed logs including the update result.
# Run with detailed logs
node --no-deprecation src/index.jsMIT