Home
Softono
glupe

glupe

Open source C++
34
Stars
0
Forks
0
Issues
0
Watchers
2 months
Last Commit

About glupe

Glupe πŸ™πŸŒΉ. Constrain where AI can generate code. Keep the rest of your codebase untouched.

Platforms

Web Self-hosted Docker

Languages

C++

Links

Glupe

License: MIT GitHub Release C++17 Platforms AI-Powered

Use LLMs in your codebase without letting them rewrite your codebase.

LLMs are powerful, but unconstrained generation is dangerous. Glupe is a CLI tool that acts as a strict constraint layer (or firewall) for AI code generation. You write the load-bearing architecture; the AI is only allowed to fill in the explicit blanks.


🎬 Glupe in Action

Refine Build Fix Errors (auto-retry)

🧠 The problem

Using LLMs for code today looks like this:

  • paste prompt β†’ get code β†’ paste into project
  • or let an agent rewrite entire files

This creates real issues:

  • ❌ no boundaries (AI can change anything)
  • ❌ hard to review (what actually changed?)
  • ❌ not reproducible
  • ❌ easy to break working code

βœ… What Glupe does

Glupe adds explicit boundaries around AI-generated code.

int add(int a, int b) {
    $${
        // implement addition
    }$$
}
  • AI can only write inside $$ { ... } $$
  • Everything else is guaranteed unchanged
  • You control structure, AI fills implementation

⚑ TL;DR

  • You write the structure
  • AI fills small, isolated regions
  • Your codebase stays stable

πŸ”§ The workflow

1. Write normal code + intent

#include <vector>

void process_data(std::vector<int>& data) {
    $${
        // 1. Remove negative numbers
        // 2. Sort descending
        // 3. Remove duplicates
    }$$
}

2. Run Glupe

glupe main.cpp -fill -local

Glupe will:

  • extract the container
  • send only that part to the LLM
  • inject the result back into the file

πŸ€” Why not just prompt?

You can β€” and for small tasks, you probably should.

Glupe is useful when:

  • you care about not touching the rest of the file
  • you want repeatable structure
  • you want reviewable diffs
  • you’re integrating AI into a real codebase

βš–οΈ What this is (and isn’t)

βœ”οΈ This is

  • a constraint layer for LLM code generation
  • a way to keep AI edits local and predictable
  • a tool for gradual adoption of AI in real projects

❌ This is NOT

  • not a new programming language
  • not a replacement for compilers
  • not deterministic (LLMs are still LLMs)
  • not magic β€” bad prompts still produce bad code

⚑ Installation

Recommended: Pre-compiled Binaries

Download the standalone executable for your OS directly from the Releases page.

Alternative: Quick Install Scripts

Note: Piping scripts directly to your shell carries inherent security risks. We recommend using the pre-compiled binaries above, but provide these scripts for convenience. You can review install.ps1 and install.sh in the repository.

Windows

  1. Press Win + R, type cmd, and press Enter.
  2. In the command prompt, type powershell and press Enter.
  3. Run:
irm https://raw.githubusercontent.com/alonsovm44/glupe/master/install.ps1 | iex

Linux/macOS

curl -fsSL https://raw.githubusercontent.com/alonsovm44/glupe/master/install.sh | bash

πŸš€ Quick Start

glupe --init
glupe hello.glp -o hello.exe -cpp -local
./hello.exe

βš™οΈ How it works

Glupe is a thin layer between your code and an LLM:

  1. scans your file
  2. finds $$ { ... } $$ blocks
  3. sends only those blocks to the model
  4. injects generated code
  5. optionally compiles + retries on failure

πŸ”’ Determinism & Caching

A major issue with AI code generation is non-determinism: regenerating an app might introduce completely new bugs.

Glupe solves this via caching. Once a $$ block { ... } $$ block successfully compiles and passes your tests, its hash is locked in a .glupe.lock file.

Re-running the CLI will not regenerate that block unless you explicitly change the prompt inside the container. It behaves like incremental compilation: once a block works, it stays frozen safely.


πŸ”₯ Features

Scoped AI generation

Only touch what you explicitly allow.


Multi-file output

EXPORT: "mylib.h"
$$ myfunc { define a function that returns square }$$
EXPORT: END

Auto-fix compile errors

[Pass 1] Missing include
[Pass 2] Type error
[Pass 3] BUILD SUCCESSFUL

One-step run

glupe app.glp -o app.exe -cpp -local -run

πŸ‘€ Who this is for

  • developers experimenting with LLM-assisted coding
  • people who don’t want AI rewriting entire files
  • teams that want controlled integration of AI

⚠️ Tradeoffs

  • LLM output is still non-deterministic
  • requires writing inside containers
  • adds an extra step vs raw prompting

This is intentional:

Glupe trades speed for control and safety


βš™οΈ Configuration

Local model

glupe config model-local qwen2.5-coder:latest

Cloud model

glupe config api-key "YOUR_KEY"
glupe config model-cloud gemini-1.5-flash

🧰 Utility Commands

fix

glupe fix project.c "fix segfault" -local

explain

glupe explain main.cpp -cloud english

diff

glupe diff v1.py v2.py -cloud

sos

glupe sos english -local "KeyError in pandas"

🌍 Vision

LLMs are useful, but unsafe by default.

Glupe’s goal is simple:

make LLM-assisted programming controllable enough to use in real systems


πŸ“„ White Paper

https://github.com/alonsovm44/glupe/blob/master/.DOCUMENTATION/paper.md


🧩 Syntax Highlight Extension

https://github.com/alonsovm44/glupe-tutorial


πŸ‘₯ Contributors

  • Alonso Velazquez (Mexico)
  • Krzysztof Dudek (Poland)

πŸ“œ License

MIT License