1
0
Fork
You've already forked transmog
0
No description
  • Rust 98.6%
  • Shell 1.4%
2026年06月23日 21:41:34 +10:00
benches v2 2026年06月22日 21:17:07 +10:00
bins v2 2026年06月22日 21:17:07 +10:00
eval v2 2026年06月22日 21:17:07 +10:00
src change text on readout at the end 2026年06月23日 21:41:34 +10:00
tests ~34% on _this_ dir... what about some bigger shit... 2026年06月22日 23:14:00 +10:00
.gitignore ~34% on _this_ dir... what about some bigger shit... 2026年06月22日 23:14:00 +10:00
Cargo.lock v2 2026年06月22日 21:17:07 +10:00
Cargo.toml v2 2026年06月22日 21:17:07 +10:00
README.md ~34% on _this_ dir... what about some bigger shit... 2026年06月22日 23:14:00 +10:00
rust-toolchain.toml v2 2026年06月22日 21:17:07 +10:00
typos.toml v2 2026年06月22日 21:17:07 +10:00

transmog

Shrink code before sending it to an LLM; restore the real names after.

Renames identifiers to tx_0, tx_1, ... and strips whitespace/comments. A ledger maps them back — even after the model edits the code.

use

transmog compress a.rs # -> a.rs.min + a.rs.min.map.txt
transmog compress ./src -e rs # -> ./.transmog/<tree> + ./transmog-out.md
transmog compress ./src -e rs --include-map # each .transmog file embeds its ledger
transmog compress --bundle ./src -e rs # -> transmog-out.md only
transmog --quiet compress ./src -e rs # no table/summary, just the files
transmog restore a.rs.min restored.rs --map a.rs.min.map.txt
transmog restore a.rs.min restored.rs # self-contained --include-map file
transmog restore --bundle transmog-out.md --out-dir ./out

transmog-out.md is the LLM prompt: a preamble explaining the minification, one <!-- transmog:src path lang --> + ```lang section per file, and the name->token mapping at the end. Dir mode also writes a ./.transmog/ tree (layout + file names preserved); --bundle emits only the md. Stdout prints a per-file table + net token savings (suppressed by --quiet).

Flags: -d/--dir, -e/--extension (repeatable, *.rs ok), -l/--level 1-3, --naming tx|short, --skip-short N, --include-map, --bundle, -o/--out, --no-recursive, --quiet.

worth it?

cargo run --bin should_use_transmog -- ./my-crate

USE/SKIP verdict + breakeven (savings vs the obfuscation preamble cost).

languages

Rust is full-feature (AST rename via syn); others minify lexically behind features: cargo build --features all (lang-c, lang-python, ...).

evaluate

cargo run --bin eval --release
cargo run --bin compression_results

tests

cargo test --all-features

Toy. Rust round-trips byte-for-byte; other languages minify only.