vibescript
Version:
The ultimate prompt-driven, component-based, AI-powered, vibe-oriented programming language.
249 lines (177 loc) β’ 6.92 kB
Markdown
# π VibeScript
> **Code is dead. Vibes are forever.**
VibeScript is the **worldβs first prompt-driven, component-based, full-stack, AI-powered, vibe-oriented programming language**.
You donβt write code. You write *vibes*.
VibeScript compiles your vibes into production-ready HTML/CSS/JS using an LLM, caches the results, and serves them like a normal website.
Itβs like React, but instead of JSX, you just say:
```
component Navbar:
"A minimalistic navbar with a logo on the left and a glowing 'Sign Up' button on the right."
```
---
## β¨ Features
- **π§ AI-Driven Compilation** β Your code is literally just English prompts. The AI does the rest.
- **π¦ Component-Based** β Break your vibes into reusable components.
- **π Recursive Nesting** β Components can contain other components, infinitely deep.
- **β‘ Hot Reload** β Save your `.vibe` file, and your browser updates instantly.
- **π Build Overlay** β Shows a ββ¨ Building vibesβ¦β overlay while the AI thinks.
- **π One-Command Deploy** β Deploy to Vercel with `--deploy`.
- **π‘οΈ Prompt Caching** β Change one component without regenerating the whole site.
- **π§ Zero Learning Curve** β If you can describe it, you can ship it.
- **π§ Model Selection** β Choose your OpenAI LLM for generation.
- **βοΈ Config File Support** β Set defaults in `vibe.config.json`.
---
## π Why Use VibeScript?
- You hate typing `div` tags.
- You believe βdesign is just vibesβ.
- You want to feel like a **10x developer** without actually learning anything.
- You want to deploy a site in 5 minutes and spend the rest of the day tweeting about it.
---
## π¦ Installation
```bash
npm install -g vibescript
```
**Note:** If you get an access error, try using `sudo`:
```bash
sudo npm install -g vibescript
```
Youβll also need an **OpenAI API key**:
```bash
export OPENAI_API_KEY="your_api_key_here"
```
---
## π Usage
### Create a `.vibe` file
Check out the `example/App.vibe` file for a complete working example, or create your own:
```vibescript
component NavButton:
"A glowing button that says 'Sign Up' in TailwindCSS."
component Navbar:
"A minimalistic navbar with a logo on the left and the NavButton on the right."
component HeroSection:
"Big bold headline saying 'Welcome to the Vibe'. Background is a gradient from pink to purple. Add a call-to-action button."
page HomePage:
Navbar
HeroSection
```
---
### Build Once
```bash
# Build the example app
vibe example/App.vibe
# Or build your own file
vibe MyApp.vibe
```
Outputs HTML to `dist/`.
---
### Hot Reload (Dev Mode)
```bash
# Start dev server with the example app
vibe example/App.vibe --watch
# Or with your own file
vibe MyApp.vibe --watch
```
- Starts a dev server at `http://localhost:3000`
- Injects a live reload script into your HTML
- Shows a **"β¨ Building vibes..."** overlay while the AI generates
- Reloads automatically when done
---
### Deploy to Vercel
```bash
# Deploy the example app
vibe example/App.vibe --deploy
# Or deploy your own
vibe MyApp.vibe --deploy
```
This will:
1. Build your vibes
2. Deploy `dist/` to Vercel
3. Make you feel like a 10x developer
---
## π§© Nested Components
VibeScript supports **recursive nesting**.
Example:
```vibescript
component Icon:
"A small SVG star icon."
component NavButton:
"A glowing button that says 'Sign Up' with the Icon inside."
component Navbar:
"A minimalistic navbar with a logo on the left and the NavButton on the right."
page HomePage:
Navbar
```
The compiler will:
- Generate `Icon`
- Inject it into `NavButton`
- Inject `NavButton` into `Navbar`
- Inject `Navbar` into your page
- Ship it
---
## π§ Choosing Your OpenAI Model
VibeScript lets you choose which OpenAI LLM to use for generating your vibes.
### Available Models:
- `gpt-5` β Latest and most capable model for complex generation and the best UI. **Best quality, highest cost.**
- `gpt-4o` β High-quality, multimodal model. **Good quality, high cost.**
- `gpt-4.1` β Advanced reasoning and analysis capabilities. **Very good quality, moderate-high cost.**
- `gpt-4.1-mini` β Faster, more cost-effective version of GPT-4.1. **Good quality, moderate cost.**
- `gpt-4.1-nano` β Even faster, more cost-effective version of GPT-4.1-mini. **Basic quality, low cost.**
- `o3` β OpenAI's reasoning-focused model. **Good quality, moderate cost.**
- `o4-mini` β Smaller, faster reasoning model. **Basic quality, low cost.**
- `gpt-oss-120b` β Open source model with 120B parameters. **Variable quality, very low cost.**
- `gpt-oss-20b` β Open source model with 20B parameters. **Basic quality, very low cost.**
### Model Selection Guide:
- **Production/Professional Sites**: Use `gpt-5`, `gpt-4o`, or `gpt-4.1`
- **Personal Projects/Prototypes**: Use `gpt-4.1-mini` or `gpt-4.1-nano`
- **Budget-Conscious Development**: Use `o3` or `o4-mini`
- **Experimental/Open Source**: Use `gpt-oss-120b` or `gpt-oss-20b`
### Example:
```bash
vibe App.vibe --model gpt-5
```
This will:
- Use `gpt-5` for all component generation
- Produce higher quality, more polished websites
- Cache results separately per model (so switching models won't overwrite previous cache)
- Allow you to experiment with speed vs. quality trade-offs
---
## βοΈ Configuration
VibeScript can be configured via:
1. **Command-line flags** (e.g., `--model gpt-4o`)
2. **Optional config file** (`vibe.config.json`)
### Example `vibe.config.json`
```json
{
"model": "gpt-5",
"port": 4000
}
```
- `model` β Default OpenAI model to use for component generation. **Recommended: gpt-5 for best results.**
- `port` β Port for the dev server in `--watch` mode.
### Priority:
1. Command-line flags (highest priority)
2. `vibe.config.json`
3. Built-in defaults (`gpt-4.1-mini` for model, `3000` for port)
### Example Usage:
```bash
# Uses model from config file
vibe example/App.vibe --watch
# Overrides config file with higher quality model
vibe example/App.vibe --model gpt-4o --port 5000
# Quick test with budget model
vibe example/App.vibe --model gpt-4.1-nano
```
---
## βοΈ How It Works
1. **Prompt Parsing** β VibeScript reads your `.vibe` file and extracts components and pages.
2. **Hashing & Caching** β Each prompt is hashed. If unchanged, itβs pulled from `.vibecache.json`.
3. **AI Compilation** β Prompts are sent to an LLM (e.g., GPT-4o-mini) to generate HTML/CSS/JS.
4. **Recursive Resolution** β If a component references another, itβs resolved first.
5. **Assembly** β Components are stitched together into full HTML pages.
6. **Live Reload** β A WebSocket server pushes reload events to your browser.
7. **Deployment** β `--deploy` sends your vibes to Vercel.
---
## π‘ Requirements
- Node.js 18+
- An OpenAI API key
- A willingness to let AI decide your design choices