Aligns the library with v2 of the llms.txt specification. Closes issue 10.
Added
- New
optionalandgetOptionalmethods to set and access theOptionalsection of allms.txtfile. - New
Discoveryclass for the link relations v2 introduced. It rendersrel="alternate" type="text/markdown"and
rel="describedby"as HTML<link>elements or as an HTTPLinkheader value, reads both back out of HTML content
or aLinkheader value, and provides the specification's Markdown URL forms and subpath scoping as helpers. - New
ValidationResult::warningsandValidationResult::hasWarningsmethods, reporting the recommended, but not
specification required, elements allms.txtfile are missing.
Changed
- The
Optionalsection is no longer skipped when expanding allms.txtfile into a LLM context file,
since v2 removed its mechanical semantics along with thellms_txt2ctxtooling. The$includeOptionalparameter of
toLlmContext,toLlmContextFile, andLlmContext::expandhas been replaced by$skipOptional, which inverts the
meaning of a passed argument. validatenow reports a missing title as the only validation error, as it is the only element the
specification requires. A missing description, details, section, or section link is reported as a validation warning
instead of an error, which makesvalidatereturntruefor files it rejected before.validatenow looks for section links in all sections instead of only in the first one.