Stop guessing what code does. WispGPT translates complex scripts from any language into easy-to-understand, greentext-style explanations. Understand, debug, and review code faster.
Understand AI-generated code, review PRs faster, and onboard new devs with ease.
Free tier demo: Limited daily use. Join waitlist for unlimited recipes & Pro features!
WispGPT cuts through the noise, giving you clear, concise explanations so you can focus on building, not deciphering.
Pasted from Stack Overflow? AI-generated? Legacy nightmare? Get a plain English summary in seconds.
Copilot or ChatGPT wrote it, but do you *really* know what it does? WispGPT gives you the ground truth.
Quickly grasp pull requests, teach juniors, or learn new languages by seeing the core logic.
Code explained step-by-step in a simple, scannable `> action` format. No jargon, just clarity.
From Python and JavaScript to C++, Java, Rust, Go, and more. If it's code, WispGPT can explain it.
Understand the 'what' and 'why' behind the code, not just the syntactic details. Perfect for high-level views.
Easily copy recipes for documentation, PR comments, or teaching. (Sharable links coming soon!).
The killer feature: See code changes explained in plain English. ">**changed** > old way >**to** >! new way".
Junior devs, senior architects, students, reviewers, even non-technical stakeholders can benefit.
WispGPT turns intimidating code blocks into a friendly, step-by-step narrative. It's like having a patient expert explain things.
// src/index.js
// Helper function to add CORS headers
function addCorsHeaders(response) {
const headers = new Headers(response.headers);
headers.set('Access-Control-Allow-Origin', '*');
headers.set('Access-Control-Allow-Methods', 'POST, OPTIONS');
headers.set('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Language');
return new Response(response.body, { ...response, headers });
}
// --- Comment Removal Functions ---
function removeLuaComments(code) {
return code.replace(/--.*/g, '');
}
function removePythonComments(code) {
return code.replace(/#.*/g, '');
}
function removeJSComments(code) {
return code.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
}
function removeJavaComments(code) {
return code.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
}
function removeCSharpComments(code) {
return code.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
}
function removeCComments(code) {
return code.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
}
function removePHPComments(code) {
return code.replace(/\/\*[\s\S]*?\*\/|#.*|\/\/.*/g, '');
}
const commentRemovers = {
lua: removeLuaComments,
python: removePythonComments,
javascript: removeJSComments,
java: removeJavaComments,
csharp: removeCSharpComments,
c_cpp: removeCComments,
php: removePHPComments,
};
function getCommentRemover(language) {
return commentRemovers[language] || removeJSComments;
}
// Generate diff with only changes
function generateChangesOnlyDiff(original, modified, language) {
const removeComments = getCommentRemover(language);
const cleanOriginal = removeComments(original);
const cleanModified = removeComments(modified);
const originalLines = cleanOriginal.split('\n')
.map(line => line.trim())
.filter(line => line.length > 0);
const modifiedLines = cleanModified.split('\n')
.map(line => line.trim())
.filter(line => line.length > 0);
const changes = [];
let i = 0, j = 0;
while (i < originalLines.length || j < modifiedLines.length) {
if (i >= originalLines.length) {
changes.push(`+ ${modifiedLines[j]}`);
j++;
} else if (j >= modifiedLines.length) {
changes.push(`- ${originalLines[i]}`);
i++;
} else if (originalLines[i] === modifiedLines[j]) {
i++;
j++;
} else {
// Diff logic continues...
}
}
return changes.join('\n');
}
export default {
async fetch(request, env, ctx) {
if (request.method === 'OPTIONS') {
return addCorsHeaders(new Response(null, { status: 204 }));
}
if (request.method !== 'POST') {
return addCorsHeaders(new Response('Expected POST request', { status: 405 }));
}
try {
const { original_code, modified_code, language = 'lua' } = await request.json();
if (!original_code || !modified_code) {
return addCorsHeaders(Response.json({ error: 'Missing original_code or modified_code' }, { status: 400 }));
}
const makerSystemPromptKey = `${language.toUpperCase()}_MAKER_SYSTEM_PROMPT`;
const makerSystemPrompt = env[makerSystemPromptKey];
const bakerSystemPrompt = env.BAKER_SYSTEM_PROMPT;
if (!makerSystemPrompt || !bakerSystemPrompt) {
return addCorsHeaders(Response.json({ error: `System prompts not configured for language: ${language}` }, { status: 500 }));
}
const modelIdentifier = "@cf/meta/llama-3.1-8b-instruct";
// --- Phase 1: Generate initial recipe ---
const removeComments = getCommentRemover(language);
const cleanedOriginalCode = removeComments(original_code);
const makerMessages = [
{ role: "system", content: makerSystemPrompt },
{ role: "user", content: `Code:\n\`\`\`${language}\n${cleanedOriginalCode}\n\`\`\`` }
];
const makerOutput = await env.AI.run(modelIdentifier, { messages: makerMessages });
const initialRecipe = makerOutput.response?.trim();
if (!initialRecipe) {
return addCorsHeaders(Response.json({ error: 'Maker returned empty recipe' }, { status: 500 }));
}
// --- Generate changes-only diff ---
const changesOnlyDiff = generateChangesOnlyDiff(original_code, modified_code, language);
if (!changesOnlyDiff.trim()) {
return addCorsHeaders(Response.json({
updated_recipe_with_changes: initialRecipe + "\n\n> **no changes detected**"
}));
}
// --- Phase 2: Generate diff recipe ---
const bakerMessages = [
{ role: "system", content: bakerSystemPrompt },
{ role: "user", content: `Original Recipe:\n${initialRecipe}\n\nCode Changes Only:\n\`\`\`diff\n${changesOnlyDiff}\n\`\`\`` }
];
const bakerOutput = await env.AI.run(modelIdentifier, { messages: bakerMessages });
const diffRecipe = bakerOutput.response?.trim();
if (!diffRecipe) {
return addCorsHeaders(Response.json({ error: 'Baker returned empty diff recipe' }, { status: 500 }));
}
return addCorsHeaders(Response.json({ updated_recipe_with_changes: diffRecipe }));
} catch (e) {
console.error("Worker Error:", e.message, e.stack);
return addCorsHeaders(Response.json({ error: "Internal error: " + e.message }, { status: 500 }));
}
},
};
Before WispGPT (left) vs. After WispGPT (right)
Copy any code snippet from any language into WispGPT.
One click is all it takes for our AI to analyze the logic.
Instantly get a plain English greentext recipe. Copy and use anywhere!
"WispGPT is a game-changer for understanding the mountain of code my AI assistant spits out. Finally, I know what it's *actually* doing!"
- Dev Who Uses Copilot
"Our code reviews are going to be so much faster with this. Especially the diff tracking feature – can't wait for that!"
- Eager Tech Lead
The free WispGPT recipe generator is just the beginning. Join the waitlist for Pro features like **unlimited recipes, code diff tracking, history, team collaboration, API access**, and more!
Be the first to know when Pro launches and get early bird discounts!
WispGPT is a tool that converts programming code from any language into simple, human-readable "greentext recipes." It helps you quickly understand the logic and flow of code.
WispGPT is designed to work with virtually any programming language. Our AI model analyzes the structure and semantics to provide explanations.
The recipes provide a high-level, logical flow. While great for understanding, always cross-reference with the original code for critical applications. It's an explainer, not a compiler!
Yes! You can use the basic recipe generator for free with daily usage limits. Pro features like diff tracking will be part of a paid plan.
We're working hard on them! Join our waitlist to be notified as soon as they launch and to get access to early bird pricing.
Code generators *write* code for you. WispGPT *explains* existing code (whether written by a human or AI) so you can understand it better. They are complementary tools!