llmed 0.2.1 → 0.2.3
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/llmed.rb +12 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e332e8e63c2578dc7c15f3a93edaa4a45405e78215e8d4281e9dbaa92a7462
|
4
|
+
data.tar.gz: a53f681a2637f40081a219a7153685998089d1448f1811f1e3d7d49ae7e3aef3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777b63598f435c57ee7cc923872e7897a12bc56a02eb4e3c2d825c19e0742e6e376763bb1ed3e0e4bb10973c97fa020dbb25b0194b5f7c089f8c01e8259c3600
|
7
|
+
data.tar.gz: 96f8c34a8aa5c8919c5ba3273bdf93820087b9ba69c9aa4744c67f6d6c8fe3638c2441b6d1d43ad2726386c4a68c1c0fd0d82f4985d4bc9fab90c702cd02f8d4
|
data/lib/llmed.rb
CHANGED
@@ -68,7 +68,7 @@ class LLMed
|
|
68
68
|
class Configuration
|
69
69
|
def initialize
|
70
70
|
@prompt = LLMed::LLM::Template.build(template: "
|
71
|
-
You are a software developer
|
71
|
+
You are a software developer with knowledge only of the programming language {language}. Follow the SOLID principles strictly, use only imperative and functional programming, and design highly isolated components.
|
72
72
|
Your response must contain only the generated source code, with no additional text.
|
73
73
|
All source code must be written in a single file, and you must ensure it runs correctly on the first attempt.
|
74
74
|
Always include the properly escaped comment: LLMED-COMPILED.
|
@@ -209,11 +209,20 @@ Wrap with comment every code that belongs to the indicated context, example in r
|
|
209
209
|
if @release && File.exist?(release_source_code_path)
|
210
210
|
release_source_code = File.read(release_source_code_path)
|
211
211
|
output_contexts = output.scan(%r{<llmed-code context='(.+?)' digest='(.+?)'>(.+?)</llmed-code>}im)
|
212
|
+
|
212
213
|
output_contexts.each do |match|
|
213
214
|
name, digest, new_code = match
|
214
|
-
|
215
|
+
new_digest = digest
|
216
|
+
@contexts.each do |ctx|
|
217
|
+
if ctx.name == name
|
218
|
+
new_digest = ctx.digest
|
219
|
+
break
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
@logger.info("APPLICATION #{@name} PATCHING CONTEXT #{name} \n\tFROM #{digest}\n\tTO DIGEST #{new_digest}")
|
215
224
|
release_source_code = release_source_code.sub(%r{(.*?)(<llmed-code context='#{name}' digest='.*?'>)(.+?)(</llmed-code>)(.*?)}m) do
|
216
|
-
"#{::Regexp.last_match(1)}<llmed-code context='#{name}' digest='#{
|
225
|
+
"#{::Regexp.last_match(1)}<llmed-code context='#{name}' digest='#{new_digest}'>#{new_code}#{::Regexp.last_match(4)}#{::Regexp.last_match(5)}"
|
217
226
|
end
|
218
227
|
end
|
219
228
|
|
@@ -239,7 +248,6 @@ Wrap with comment every code that belongs to the indicated context, example in r
|
|
239
248
|
update_rest = false
|
240
249
|
@contexts.each do |ctx|
|
241
250
|
release_context_digest = release_contexts[ctx.name]
|
242
|
-
|
243
251
|
# maybe the context is not connected to the source code
|
244
252
|
next if release_context_digest.nil?
|
245
253
|
|