to_llm 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tasks/to_llm.rake +13 -6
- data/lib/to_llm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ad8dc7aa1fe23ab7edadb158054251138e6fa9d5b4f7412415f6ac8c6260328
|
4
|
+
data.tar.gz: a036334beb2f709b76b240a864429e147055796010a1d9f3f73d40cf6e26a214
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70fa48467dda813b75e72b0d8c4b4efd1145a782c6de1b3f63dad2b0e7b29c4e0f2aa953a86bea2221d05cbba0e11e7bf0afb166381f96362e6bb2a7ab8080cd
|
7
|
+
data.tar.gz: 8163a2ccb4a46d6a59f5b9987f13ff072ebdf6b831c5d0a02f3d35621d23d0439cecc9978db61548357c8a22140e4ed7854e7481270192645d8a8ca9da5fff8c
|
data/lib/tasks/to_llm.rake
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
namespace :to_llm do
|
5
|
+
def clean_content(content)
|
6
|
+
cleaned = content.lines.map(&:strip).join("\n")
|
7
|
+
cleaned.gsub(/\n{2,}/, "\n")
|
8
|
+
end
|
9
|
+
|
5
10
|
def run_extraction(extract_type, output_format)
|
6
11
|
extract_type = extract_type&.upcase || "ALL"
|
7
12
|
output_format = output_format&.downcase || "txt"
|
@@ -58,6 +63,7 @@ namespace :to_llm do
|
|
58
63
|
|
59
64
|
# Writes file content in either txt or md format
|
60
65
|
def write_content(path, content, output_format, output_file)
|
66
|
+
content = clean_content(content)
|
61
67
|
if output_format == "md"
|
62
68
|
language = detect_language(File.extname(path))
|
63
69
|
<<~MARKDOWN
|
@@ -70,7 +76,7 @@ namespace :to_llm do
|
|
70
76
|
# txt format
|
71
77
|
<<~TXT
|
72
78
|
#{path}:
|
73
|
-
|
79
|
+
-
|
74
80
|
#{content}
|
75
81
|
|
76
82
|
TXT
|
@@ -119,8 +125,11 @@ namespace :to_llm do
|
|
119
125
|
"Examples:\n" \
|
120
126
|
" rails \"to_llm:extract[ALL,md]\"\n" \
|
121
127
|
" rails \"to_llm:extract[MODELS,txt]\""
|
122
|
-
task :extract, [:
|
123
|
-
|
128
|
+
task :extract, [:type, :format] => :environment do |_t, args|
|
129
|
+
type = (args[:type] || "ALL").upcase
|
130
|
+
format = (args[:format] || "txt").downcase
|
131
|
+
|
132
|
+
if args[:type].blank? || args[:format].blank?
|
124
133
|
# No parameters passed -> show help message
|
125
134
|
puts "--------------------------------------------------------------------"
|
126
135
|
puts "Usage: rails \"to_llm:extract[TYPE,FORMAT]\""
|
@@ -133,9 +142,7 @@ namespace :to_llm do
|
|
133
142
|
next
|
134
143
|
end
|
135
144
|
|
136
|
-
|
137
|
-
type, format = args[:type_and_format].split(",")
|
138
|
-
|
145
|
+
|
139
146
|
if format.nil?
|
140
147
|
# Old usage
|
141
148
|
puts "You are using the old usage: rails to_llm:extract #{type}"
|
data/lib/to_llm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_llm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Carlos Maciel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|