{"id":27888033,"url":"https://github.com/Strawberry-Computer/vibe-compiler","last_synced_at":"2025-05-05T09:04:19.735Z","repository":{"id":283452279,"uuid":"951797630","full_name":"Strawberry-Computer/vibe-compiler","owner":"Strawberry-Computer","description":"Vibe coding tool with prompts in the repo","archived":false,"fork":false,"pushed_at":"2025-04-23T03:44:35.000Z","size":285,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-26T01:42:32.401Z","etag":null,"topics":["ai","vibe-coding","web4"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Strawberry-Computer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-20T09:03:09.000Z","updated_at":"2025-04-25T23:27:02.000Z","dependencies_parsed_at":"2025-04-26T01:42:34.594Z","dependency_job_id":"54ec22c4-6a91-4e8e-b4a7-bf0976fb3e34","html_url":"https://github.com/Strawberry-Computer/vibe-compiler","commit_stats":null,"previous_names":["vgrichina/vibe-compiler","strawberry-computer/vibe-compiler"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Strawberry-Computer%2Fvibe-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Strawberry-Computer%2Fvibe-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Strawberry-Computer%2Fvibe-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Strawberry-Computer%2Fvibe-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Strawberry-Computer","download_url":"https://codeload.github.com/Strawberry-Computer/vibe-compiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252470760,"owners_count":21753046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","vibe-coding","web4"],"created_at":"2025-05-05T09:02:20.388Z","updated_at":"2025-05-05T09:04:19.708Z","avatar_url":"https://github.com/Strawberry-Computer.png","language":"JavaScript","readme":"# Vibe Compiler (vibec)\n\nA self-compiling tool that transforms prompt stacks into code and tests using LLM generation.\n\n## Overview\n\n`vibec` is a unique compiler that processes markdown-based prompt stacks to generate code, tests, and documentation. It can compile itself through a bootstrap process, evolving its own implementation (`bin/vibec.js`) across numbered stages. The tool supports both static (`.md`) and dynamic (`.js`) plugins, maintains staged outputs in `output/stages/` for Git history, and aggregates the latest runtime version in `output/current/` using a \"Last-Wins\" merge strategy.\n\n## Project Structure\n\n```\nvibec/\n├── bin/                    # Initial implementation\n│   ├── vibec.js           # Core compiler script\n│   └── test.sh            # Test runner\n├── bootstrap/             # Bootstrap documentation\n├── stacks/                # Prompt stacks\n│   ├── core/             # Core functionality\n│   │   ├── 001_add_logging.md\n│   │   ├── 002_add_plugins.md\n│   │   ├── 003_add_cli.md\n│   │   ├── 004_add_config.md\n│   │   └── plugins/      # Core plugins\n│   └── tests/            # Test generation\n├── output/               # Generated artifacts\n│   ├── bootstrap/       # Bootstrap outputs\n│   │   ├── bin/        # Bootstrap compiler\n│   │   │   └── vibec.js\n│   │   ├── bootstrap.js # Bootstrap script\n│   │   └── test.sh     # Bootstrap test script\n│   ├── current/        # Latest merged runtime version\n│   │   ├── bin/       # Current compiler\n│   │   │   └── vibec.js\n│   │   ├── bootstrap.js # Current bootstrap script\n│   │   ├── test.js     # Current test suite\n│   │   └── test.sh     # Current test script\n│   └── stacks/         # Staged stack outputs\n│       ├── core/      # Core stack stages\n│       │   ├── 001_add_logging/\n│       │   │   └── bin/\n│       │   │       └── vibec.js\n│       │   ├── 002_add_plugins/\n│       │   │   └── bin/\n│       │   │       └── vibec.js\n│       │   ├── 003_add_cli/\n│       │   │   └── bin/\n│       │   │       └── vibec.js\n│       │   ├── 004_add_config/\n│       │   │   └── bin/\n│       │   │       └── vibec.js\n│       └── tests/     # Test stack stages\n│           ├── 001_basic_tests/\n│           │   ├── test.js\n│           │   └── test.sh\n│           ├── 002_feature_tests/\n│           │   └── test.js\n│           ├── 003_cli_tests/\n│           │   └── test.js\n│           └── 004_config_tests/\n│               └── test.js\n├── .vibec_hashes.json    # Prompt hashes and test results\n├── vibec.json            # Configuration file\n└── package.json          # Node dependencies\n```\n\n## Architecture\n\n`vibec` employs a progressive bootstrapping process:\n1. Begins with the initial `bin/vibec.js` implementation\n2. Processes numbered stages sequentially (001, 002, etc.)\n3. Updates `vibec.js` when generated in a stage, using the new version for subsequent stages\n4. Creates a self-improving cycle where the compiler evolves during compilation\n\n## Getting Started\n\n### Installation\n\nInstall globally:\n```bash\nnpm install -g vibec\n```\nOr use via npx:\n```bash\nnpx vibec --version\n```\n\nSet your LLM API key:\n```bash\nexport VIBEC_API_KEY=your_api_key_here\n```\n\n### Usage\n\nRun with custom options:\n```bash\nnpx vibec --stacks=core,tests --test-cmd=\"npm test\" --retries=2  --output=output\n```\n\nCLI options:\n- `--workdir=\u003cdir\u003e`: Working directory (default: `.`)\n- `--stacks=\u003cstack1,stack2,...\u003e`: Stacks to process (default: `core`)\n- `--dry-run`: Simulate without modifications (default: `false`)\n- `--start=\u003cnumber\u003e`: Start with specific stage number (default: none)\n- `--end=\u003cnumber\u003e`: End with specific stage number (default: none)\n- `--api-url=\u003curl\u003e`: LLM API endpoint (default: `https://openrouter.ai/api/v1`)\n- `--api-model=\u003cmodel\u003e`: LLM model (default: `anthropic/claude-3.7-sonnet`)\n- `--test-cmd=\u003ccommand\u003e`: Test command to run (default: none)\n- `--retries=\u003cnumber\u003e`: Retry attempts (≥ 0, default: `0`)\n- `--output=\u003cdir\u003e`: Output directory (default: `output`)\n- `--help`: Display usage information\n- `--version`: Show version (e.g., `vibec v1.0.0`)\n\n### Configuration\n\nConfigure via `vibec.json`:\n```json\n{\n  \"workdir\": \".\",\n  \"stacks\": [\"core\", \"tests\"],\n  \"dryRun\": false,\n  \"start\": null,\n  \"end\": null,\n  \"testCmd\": \"npm test\",\n  \"retries\": 2,\n  \"pluginTimeout\": 5000,\n  \"apiUrl\": \"https://openrouter.ai/api/v1\",\n  \"apiModel\": \"anthropic/claude-3.7-sonnet\",\n  \"output\": \"output\"\n}\n```\n\nOption precedence: CLI \u003e Environment Variables \u003e `vibec.json` \u003e Defaults\nValidation:\n- `retries`: Must be non-negative (≥ 0)\n- `pluginTimeout`: Must be positive (\u003e 0)\n- Malformed JSON in `vibec.json` triggers an error log and falls back to defaults\n\n### Environment Variables\n\n- `VIBEC_WORKDIR`: Working directory path.\n- `VIBEC_STACKS`: Comma-separated stacks (e.g., `core,tests`)\n- `VIBEC_DRY_RUN`: `true`/`false`.\n- `VIBEC_START`: Numeric stage value.\n- `VIBEC_END`: Numeric stage value.\n- `VIBEC_OUTPUT`: Output directory.\n- `VIBEC_TEST_CMD`: Test command\n- `VIBEC_RETRIES`: Retry count\n- `VIBEC_PLUGIN_TIMEOUT`: Plugin timeout (ms)\n- `VIBEC_API_URL`: LLM API endpoint\n- `VIBEC_API_KEY`: LLM API key (recommended over config)\n- `VIBEC_API_MODEL`: LLM model\n- `VIBEC_DEBUG`: Enable debug logging (`1` to enable)\n\n### LLM Integration\n\nCompatible with OpenAI-style APIs. Configure via `VIBEC_API_URL` and `VIBEC_API_KEY`.\n\n## Prompt Structure\n\nPrompts use markdown:\n```markdown\n# Component Name\n\nDescription of the generation task.\n\n## Context: file1.js, file2.js\n## Output: path/to/output.js\n```\n\n- `## Context:`: Reference files for context\n- `## Output:`: Specify output file paths (multiple allowed)\n\n## Plugin System\n\nAdded in stage `002_add_plugins.md`:\n- **Static Plugins (`.md`)**: Stored in `stacks/\u003cstack\u003e/plugins/`, appended to prompts in alphabetical order\n- **Dynamic Plugins (`.js`)**: Async functions in `stacks/\u003cstack\u003e/plugins/`, executed with configurable timeout:\n  ```javascript\n  module.exports = async ({ config, stack, promptNumber, promptContent, workingDir, testCmd, testResult }) =\u003e {\n    return \"Generated content\";\n  };\n  ```\n- Plugin errors are logged and skipped without halting execution\n\n## Development\n\n### Adding Prompts\n\n1. Create a new numbered file (e.g., `stacks/core/005_new_feature.md`)\n2. Use `NNN_name.md` naming convention\n3. Specify outputs with `## Output:`\n\n### Testing\n\nTests in `stacks/tests/` generate:\n- `test.sh`: Validates `vibec.js` and runs `test.js`\n- `test.js`: Uses `tape` for unit tests (Node builtins only)\n\n## Tutorial: Building a Simple Pong Game\n\n### 1. Initialize Project\n```bash\nmkdir pong-game \u0026\u0026 cd pong-game\nmkdir -p stacks/pong output\n```\n\n### 2. Define Initial Prompt\n```markdown stacks/pong/001_create_pong.md\n# Pong Game Base\n\nCreate a basic Pong game:\n- HTML: Canvas element in a centered container\n- CSS: Black canvas with borders\n- JS: Canvas-based paddle and ball with arrow key controls\n\n## Output: index.html\n## Output: styles.css\n## Output: game.js\n```\n\n### 3. Configure\n```json vibec.json\n{\n  \"stacks\": [\"pong\"],\n  \"output\": \"output\"\n}\n```\n\n### 4. Compile\n```bash\nexport VIBEC_API_KEY=your_api_key_here\nnpx vibec\n```\n\n### 5. Test\n```bash\ncd output/current\npython3 -m http.server 8000\n```\nVisit `http://localhost:8000`.\n\n### 6. Enhance\n```markdown stacks/pong/002_add_score.md\n# Pong Scoring\n\nAdd scoring:\n- Display score above canvas\n- Increment when ball passes paddle, reset ball\n\n## Context: index.html, game.js\n## Output: game.js\n```\nRe-run `npx vibec`.\n\n### 7. Debug\nUse `VIBEC_DEBUG=1 npx vibec` for detailed logs.\n\n## Troubleshooting\n\n- **API Key Missing**: Set `VIBEC_API_KEY`\n- **No Output**: Verify `## Output:` in prompts\n- **Command Not Found**: Use `npx vibec` or install globally\n\n## License\n\nMIT\n","funding_links":[],"categories":["HarmonyOS","ツール","LLM-powered natural language compilers","Terminal","⚙️ Natural Language to Code Tools","AI Coding Agents","Projects"],"sub_categories":["Windows Manager","エージェント型コーディング環境","CLI Utilities","General Purpose"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStrawberry-Computer%2Fvibe-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStrawberry-Computer%2Fvibe-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStrawberry-Computer%2Fvibe-compiler/lists"}