scripts
Scripts used across all The Algorithms repositories
Helper scripts that automatically generate a table-of-contents file for The Algorithms repositories, keeping their algorithm indexes up to date without manual editing.
The Algorithms Scripts is a small set of internal tools that keep the sprawling "The Algorithms" project organized. The Algorithms is a large, community-driven effort that hosts example code for well-known algorithms across many programming languages. This repository holds the helper scripts that automate some of the behind-the-scenes upkeep so the collection stays navigable.
The main tool here, build_directory_md.py, automatically generates a file called DIRECTORY.md. That file acts as a table of contents for a given language's repository. When someone adds or changes code, the script scans the repository, finds all the relevant source files, and compiles them into a clean, up-to-date index. To do this, it takes a few simple inputs: the language name, where to start looking, which file types to include, and optional rules for skipping certain folders.
You would use this if you were maintaining one of the language-specific repositories in the The Algorithms family. For example, the people who manage the C++ repository can run the script to find all .cpp and .h files and generate their directory. The MATLAB and Octave maintainers can do the same, while telling the script to skip a top-level folder but still list the subfolders inside it. Instead of editing the index by hand every time a new algorithm is added, maintainers let the script rebuild it automatically.
The project is designed for automation. The script is meant to be run by a continuous integration workflow on every code update, so the directory file stays in sync with the actual code without anyone lifting a finger. The README is brief and focused, suggesting these tools are built specifically for existing maintainers rather than outside users.
Where it fits
- Maintainers of a language-specific Algorithms repository can regenerate the directory index after new algorithms are added.
- CI workflows can run the script on every code update so the table of contents stays in sync automatically.
- A maintainer can customize which file types and folders to include or skip when building the index.