Vibe Code

Your AI wrote it fast. CODE makes it readable: clear names, tidy folders, one job per function, and a map of where everything lives. Your app works exactly the same.

Preview JS / TS Runs locally Product page
Overview

What it does

CODE reads your JavaScript and TypeScript with a real parser, writes a plan of renames and moves, then applies it one step at a time with your build and tests run before and after every step.

  • Scan: every function with its file:line, what it calls, what calls it, network calls, storage and DOM events, plus a health score.
  • Plan: CODE-PLAN.md, a list you (or your AI) can read and edit before anything changes.
  • Apply: one rename, move or extract per step. Renames follow every import and call site; it is never search-and-replace. A step that breaks anything is put back on its own.
  • Map: CODEMAP.md answers "where do I fix…?" with a file and a line, and docs/CALLS.md lists every public function, endpoint and event.

Easiest path: paste the prompt into your coding AI in the project. It runs the commands below, fills in good names, shows you the plan and asks before it applies anything.

Same text as /code/prompt.md and the product page. Commands are pinned to this release.

Quick start

Scan, plan, apply, map

Run these from your project root. scan and plan never change your code.

Open CODE-PLAN.md. Fix any names you don't like, fill in every ?, and tick or untick lines. Then:

Changed your mind? code undo puts back the last step; code undo all puts back everything.

Reference

Commands

Every command is a sub-command of the pinned CLI: code …

CommandWhat it does
code scan [--json]Parses every JS/TS file, writes .vibe/code/scan.json, prints the score and findings. Changes nothing.
code plan [--json]Writes CODE-PLAN.md (and .vibe/code/plan.json). Edit it: names, checkboxes, add your own lines.
code apply [--only safe] [--step R1,M2] [--dry-run] [--yes]Runs the baseline build and tests, then one step at a time: change, re-test, commit. Failures are reverted automatically. Commit your own changes first (or --allow-dirty); without git, one patch file per step in .vibe/code/patches/. --yes when there is no terminal to ask.
code map [--html] [--jsdoc]Writes CODEMAP.md, docs/CALLS.md, CODE-RULES.md and the AI rules block. --html also writes CODEMAP.html; --jsdoc adds a one-line doc comment to each exported function from .vibe/code/purposes.json.
code check [--json]Re-scans against the last baseline. Exits 1 on new cryptic names, big files or long functions, so it can run in CI. The first run is the baseline.
code undo [step|all]A git revert of that step's commit (or restores its patch). With no step: the last one.
code statusScore, plan progress and which steps were applied, put back or are still to do.
code promptPrints the AI prompt, pinned to this release.
Format

The plan file

CODE-PLAN.md is a checklist. Each line is one step. [x] steps run, [ ] steps don't. Keep the format exactly; you can change names, tick or untick, delete lines and add your own.

- [x] R4 · rename · `src/app.js#valActCheck` → `startFaceScan` · safe · 5 refs in 3 files
  - does: opens the camera, sends one frame to /api/face/verify and saves the session
  - evidence: calls getUserMedia, grab, fetch · used by src/main.js:5, test/face.test.js:8
- [ ] R25 · rename · `src/legacy.js#loadPrfl` → `loadProfile` · risky · 0 refs in 1 file
  - ⚠ "loadPrfl" also appears in a data- attribute at index.html:12
- [x] M2 · move · `src/utils2.js` → `src/lib/utils.js` · safe · 3 importers
- [ ] E4 · extract · `src/app.js#showMsg` → `src/features/toast/toast.js` · medium · section "toast"
- D1 · dedupe · src/api.js:4 (fetchData2), src/api.js:13 (getUsr) · same 7-line block …
- X1 · dead · `src/app.js#saveP` (line 109) · exported and never used …
KindIdApplied?
renameR1, R2…Yes when ticked. Usually safe.
moveM1…Yes when ticked. Every import is rewritten.
extractE1…medium: unticked by default. Moves a function into its own file.
dedupe, deadD1, X1…Never. Listed with the evidence for you or your AI to decide.

A rename whose new name is ? is skipped: CODE never guesses a name silently. The names come from your AI reading the code, grounded in the scan.

Scan

Findings and score

FindingWhat counts
Cryptic namesNames that don't say what they do: doStuff2, valActCheck, tmp, handle.
God filesFiles over 400 lines.
Long functionsOver 60 lines, or nesting deeper than 4.
Duplicated blocksThe same code in more than one place.
Dead exportsExported, but nothing imports it.
Mixed concernsUI, network and storage all in one function.
Magic valuesUnnamed strings and numbers repeated across the code.
Mixed namingcamelCase and snake_case side by side.

The score runs from 0 to 100 with a grade from A to F. code status shows it before and after.

Safety

How it keeps your app working

  • Before anything changes: it runs your package.json build, test, lint and typecheck scripts. If the build or tests already fail, it stops (exit 2) and changes nothing; a lint or typecheck that already fails is left out of the checks, with a warning.
  • After every step: the same scripts again, plus its own check that every file still parses, every import resolves and no name became undefined.
  • Auto-revert: a step that fails any of those is put back and reported. The run moves on to the next step.
  • One commit per step: so code undo <step> is a normal git revert. Without git, each step is a patch file.
  • No tests? It writes a small smoke test first (does it build, do pages load, do exported functions keep their shape), so "nothing broke" is measured, not assumed.
  • Public names: anything your package exports for other code keeps its old name as an alias marked @deprecated.
  • Dynamic references: code like obj[name] can't be followed safely, so anything it might reach is flagged risky and left unticked.

Don't edit files by hand while code apply runs. Commit or stash your own changes first (CODE's own files don't count), so every step is its own clean commit. Without a terminal to ask (an AI or CI), it needs --yes.

Output

Files it writes

FileWhat's in it
CODE-PLAN.mdEvery rename, move and extract with its risk and call sites. Safe ones checked.
CODEMAP.mdFeatures → files → functions with file:line, and "Where do I fix…?".
docs/CALLS.mdEvery public function, endpoint and event with its inputs and side effects.
CODE-RULES.mdNaming and folder rules for this project.
CLAUDE.md / AGENTS.md / .cursorrulesA short rules block, added at the end. Never overwritten.
CODEMAP.htmlWith code map --html: the map as a searchable page.
test/code-smoke.test.mjs
test/code-smoke.snapshot.json
Only when the project has no tests: the smoke test and the shapes it checks.
.vibe/code/scan.jsonThe full scan.
.vibe/code/plan.jsonThe plan as data.
.vibe/code/steps.jsonWhat was applied, put back, and each step's commit.
.vibe/code/purposes.jsonWritten by your AI: one plain-English line per function, used by code map.
.vibe/code/patches/Without git: one patch file per step.
CI

Exit codes

CodeMeaning
0OK.
1Findings (code check: new cryptic names or god files), or a step failed and was put back.
2The baseline build or tests were already failing. Nothing was changed.
3No plan yet, or uncommitted changes to your files. Nothing was changed.
Limits

Scope and limits

  • Languages: JavaScript and TypeScript today (JSX, TSX, React, Next.js, Vite, Node). Python is on the roadmap.
  • Applied for you: renames and file moves (safe).
  • Unticked by default: moving a function into its own file (medium).
  • Left to you: merging duplicated code and deleting unused exports. Listed with the evidence, never done automatically.
  • Never renamed: anything in node_modules, public URLs, API routes, or names code outside the project uses (those keep a deprecated alias).
  • Names: come from your AI reading the code. A name it can't work out shows as ? and the step is skipped.

Nothing is uploaded: CODE runs on your machine, in your project.