LlmsTxt (llms_txt v0.1.0)

Copy Markdown View Source

Reads a project's Hex dependencies from its lock file and turns each one's fetched hexdocs into an llms.txt file.

This is the data layer behind the mix docs.llms task: it locates the packages, resolves the local hexdocs cache, writes one llms.txt per package and prunes documentation that no longer matches a current dependency.

Summary

Functions

Converts the fetched docs for a single package into a llms.txt file.

Returns the base directory of the local hexdocs cache.

Returns the {app, version} tuples for every Hex dependency in the lock file.

Removes documentation that no longer matches a current dependency.

Functions

generate_package_llms(name, version, docs_base, output_dir)

Converts the fetched docs for a single package into a llms.txt file.

Returns {:ok, path} with the written file or {:error, :docs_not_found} when no docs were fetched for the given package and version.

hex_docs_base()

Returns the base directory of the local hexdocs cache.

hex_packages()

Returns the {app, version} tuples for every Hex dependency in the lock file.

Git and path dependencies are skipped because they have no Hex version and no documentation on HexDocs.

prune_stale_docs(output_dir, packages)

Removes documentation that no longer matches a current dependency.

Keeps only the <package>/<version> directory for each package in packages, deleting outdated version directories and packages that are no longer dependencies.