astrc (asset trace) is a highly optimized command-line tool to find unreferenced assets (or any file really) in a large codebase, helping remove dead files and optimize your projects!
- Parses given config file to identify mappable file extensions (the files that will be searched for in source files) e.g. static images in a web project. Optionally identifies specified source file extensions to search in (e.g. search for .png in .jsx files). Optionally ignores specified folders to optimize search (e.g. ignore /build, /node_modules).
- Recursively explores given root directory & creates a map of all given file extensions.
- Recursively explores root directory again, instead reading source files for mapped assets.
- If any mapped assets are found unreferenced, those are the files holding zero value in your project.
- Memory-mapped IO: Instead of reading line by line straight from disk.
- Aho-Corasick Searching: Find mapped assets in a single pass.
- Simple Config: Managed via a simple
.astrcor.astrc.jsonfile for CI.
git clone https://github.com/jaschrs/astrc.git
cd astrc
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cd buildNavigate to project directory and create a .astrc or .astrc.json file to config the tool (yes, comments are allowed). Below is an example.
In this case, the tool will look for .png files in .jsx files, and retrieve any unreferenced mapped files. Technically one can search for any file extension and/or scan in any type of source file.
Technically version isn't required, but a recommended convention (to check version astrc -v, astrc --version.
{
"version": "2026.0.1",
"targetExtensions": [ // Look for these files in source files
".png",
".jpg",
".jpeg",
".gif",
".svg"
],
"scanExtensions": [ // Check these files for assets specified above
".html",
".txt",
".jsx",
".ts",
".tsx",
".vue",
".cpp",
".hpp",
".py"
],
"ignoreDirectories": [ // directories to skip searching
"node_modules",
"build"
]
}Any compatible with std::filesystem:
astrc <your_project_directory>