Module: LlmsTxt
- Defined in:
- lib/llms_txt.rb,
lib/llms_txt/cli.rb,
lib/llms_txt/config.rb,
lib/llms_txt/errors.rb,
lib/llms_txt/parser.rb,
lib/llms_txt/version.rb,
lib/llms_txt/generator.rb,
lib/llms_txt/validator.rb,
lib/llms_txt/bulk_transformer.rb,
lib/llms_txt/markdown_transformer.rb
Defined Under Namespace
Modules: Errors Classes: BulkTransformer, CLI, Config, Generator, MarkdownTransformer, ParsedContent, Parser, Validator
Constant Summary collapse
- VERSION =
Current version of the LlmsTxt gem
'0.2.0'
Class Method Summary collapse
-
.bulk_transform(docs_path, options = {}) ⇒ Array<String>
Bulk transforms multiple markdown files to be AI-friendly.
-
.generate_from_docs(docs_path = nil, options = {}) ⇒ String
Generates llms.txt from existing markdown documentation.
-
.parse(file_path) ⇒ Parser
Parses an existing llms.txt file.
-
.transform_markdown(file_path, options = {}) ⇒ String
Transforms a markdown file to be AI-friendly.
-
.validate(content) ⇒ Boolean
Validates llms.txt content.
Class Method Details
.bulk_transform(docs_path, options = {}) ⇒ Array<String>
Bulk transforms multiple markdown files to be AI-friendly
107 108 109 110 111 112 |
# File 'lib/llms_txt.rb', line 107 def bulk_transform(docs_path, = {}) config = Config.new([:config_file]) = config.() BulkTransformer.new(docs_path, ).transform_all end |
.generate_from_docs(docs_path = nil, options = {}) ⇒ String
Generates llms.txt from existing markdown documentation
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/llms_txt.rb', line 41 def generate_from_docs(docs_path = nil, = {}) # Support config-first usage: generate_from_docs(config_file: 'path.yml') if docs_path.is_a?(Hash) && docs_path.key?(:config_file) = docs_path docs_path = nil end config = Config.new([:config_file]) = config.() # Use docs_path param or config file docs setting final_docs_path = docs_path || [:docs] Generator.new(final_docs_path, ).generate end |
.parse(file_path) ⇒ Parser
Parses an existing llms.txt file
118 119 120 |
# File 'lib/llms_txt.rb', line 118 def parse(file_path) Parser.new(file_path).parse end |
.transform_markdown(file_path, options = {}) ⇒ String
Transforms a markdown file to be AI-friendly
76 77 78 79 80 81 |
# File 'lib/llms_txt.rb', line 76 def transform_markdown(file_path, = {}) config = Config.new([:config_file]) = config.() MarkdownTransformer.new(file_path, ).transform end |