llmstxt-gen
Source

The whole tool, readable.

About 2,200 lines with tests. Pick a file, copy it, and keep the same folder layout so it runs.