urai-ecma: Compressing JavaScript and TypeScript Codebases into Token-Efficient Context for Large Language Models
Abstract—Large Language Models (LLMs) are now everydaytools for reading, explaining, and improving source code. Butreal JavaScript and TypeScript projects are large, and sendinga whole codebase to an LLM wastes tokens, costs money, andcan confuse the model, since the parts that matter get buried in boilerplate. This paper presents urai-ecma, a command-line tool written in Rust that turns a JavaScript or TypeScript codebase into a compact, LLM-ready summary. urai-ecmaparses every source file into a full Abstract Syntax Treewith SWC, then walks that tree with a pipeline of visitors:one finds backend API routes, one reads React componentstructure, one keeps or writes short function summaries, andone shortens long Tailwind CSS class names. A local hybridcache remembers past AI-written summaries, so repeat runsare almost instant. We test urai-ecma on six real open-sourcerepositories. Across these repositories it cuts token count by24% to 65%, and by up to 82.7% in a larger real-world casethat motivated the project. Runs that hit the cache finish upto three orders of magnitude faster than the first, cold run.We describe the design, the core algorithms, the benchmarkresults, and the trade-offs, and we suggest directions forfuture work.
Authors
- Sanjaiyan Parthipan
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-09-15
- DOI
- https://doi.org/10.5281/zenodo.22774527
- Primary Topic
- Natural Language Processing Techniques
- Type
- preprint