# SplitCode
> Split large JS, TS, HTML or Python files into smaller dependency-ordered
> files with pure static analysis. No bundler, no LLM, no config.
> For AI agents: run ONE command blind (zero context), plan from
> manifest.json, edit file-by-file, then test. Up to ~85% fewer tokens
> per edit vs reading the whole file.
- Site: https://unn-Known1.github.io/splitcode/
- Repo: https://github.com/unn-Known1/splitcode
- npm: https://www.npmjs.com/package/splitcode (release pending; use source until then)
- License: MIT by unn-Known1 (ptelgm.yt@gmail.com)
## Install / run
```bash
npx splitcode app.js ./split-out # once published
node split-js.js app.js ./split-out # from source (needs: npm install)
```
- Dispatch by extension: `.js/.mjs/.cjs` `.ts/.tsx` `.html/.htm` `.py`
(override: `--lang js|ts|html|py`).
- Python needs `python3` on PATH. TypeScript uses `typescript@5`
(optional dependency — skippable with `--omit=optional`).
- Optional flags (defaults shown):
`[--hub-ratio 0.12] [--min-chars 400] [--loader app.js | --no-loader]
[--loader-mode classic|inline] [--no-louvain] [--no-hubs]
[--lang js|ts|html|py] [--check] [--strict] [--force] [--dry-run]
[--max-bytes 33554432] [--timing] [--quiet] [--help] [--version]`
- `--check`: preflight scan only (no output, outDir not needed).
Exit 0 = clean, 2 = risky. `--strict` refuses to write on warnings
(exit 2). Exit 1 = error. Flags may come before or after outDir.
Auto-runs before every split: eval/indirect-eval/new Function/string
setTimeout/dynamic import/prototype writes+methods/dynamic global keys,
template-nested scripts, relative Python imports, etc.
## What you get in outDir
- Cluster files (kebab-case of most-used declaration; `// Declares:` header).
- Loader (default `app.js`): pages keep loading just it; it pulls in parts
in order. Load with plain `