Add a script to generate llms.txt#2004
Conversation
|
Hi @Simek! The purpose of this PR is to make React Native libraries easier to discover via LLMs, including the docs AI search. The RN Directory is not easily scannable with LLMs so we were finding that our docs search was giving incorrect information regarding RN libraries, or not even knowing they exist. With this, we can have more accurate and up to date information as well as be able to link back to RN Directory as the source of the info. What do you think? |
Simek
left a comment
There was a problem hiding this comment.
Hey Aman, hey Kadi! 👋
I think that this is a good idea and should help some users!
Left few suggestions below, but let's me summarize them also in the comment:
- I would base the generation fully on
assets/data.json, this way we would have access to broader dataset (download counts, latest release data etc.) and could simplify the logic in few places, - I would retain the split in term between platform and compatibility, so AI responses does not confuse people or add to the layer of misunderstanding the difference,
- more helpers/code we could reuse with website/API, the easier and less demanding the maintenance will be, when we apply changes to the app
One more thing which this PR misses is hooking this up into (or after) build process during the deployment. This can be done by updating the build script, and adding llms:generate after data:update call.
In the future it would be nice to add some more dat to entries, besides mentioned earlier ones topics/tags would be nice, some popularity stats, like downloads, stars or trending score, listing package website (if available) could also be handy, but definitely this can be done in a separate, follow-up PR. 🙂
|
Hi @Simek 👋 Thank you for your thorough feedback (as always!)! I've reused the helper functions/utilities that already exist in the codebase and removed duplicated/redundant code from this script. Also, added the generation script to the Since we are now relying on
|
Simek
left a comment
There was a problem hiding this comment.
Great work on that feature, thanks for all review follow-ups, let's ship it! 🚀

📝 Why & how
@kadikraman requested that a script be added to reactnative.directory to generate an
llms.txtfile. Once hosted, this file can be reused in AI integration tools and AI docs integrations such as Expo documentation.bun runllms:generate) to generate thellms.txt` file.react-native-libraries.jsonplus the cached GitHub metadata fromassets/data.json.llms.txt?" that provides instructions on how to generate this file.Example:
Test plan
bun run generate:llmsbun run start