Wakaru

Rewrite levels

Choose between behavioral fidelity and maximum readability.

Edit on GitHub

Wakaru has three rewrite levels, from behavioral fidelity to maximum readability:

npx wakaru input.js --level minimal
npx wakaru input.js                     # standard is the default
npx wakaru input.js --level aggressive

Choosing a level

LevelWhat it doesUse it for
minimalHighest-confidence, semantics-preserving transforms onlyAuditing, diffing, malware triage
standardFull helper and syntax recovery under documented assumptionsEveryday reading and code recovery
aggressiveStronger intent-recovery heuristics. May alter edge-case behaviorYou just want to read the code

Every level has a documented semantic contract. The named assumptions each level may rely on are listed in rewrite-assumptions.md. A Test262 round-trip harness continuously measures semantic preservation.

Dead code

By default, Wakaru removes only the dead code its own transforms create. Dead code that already existed in the input stays. Opt into a full reachability sweep with:

npx wakaru input.js --dce

On this page