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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/llmed.rb +12 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c063383b284467008387eb7e8dd154a2e22b75b344301b6acb800b2c5dac94c
4
- data.tar.gz: 9d0b2491f94951b1308af3920f5e1ed539414205df67de9753c7f7c82b348381
3
+ metadata.gz: 90e332e8e63c2578dc7c15f3a93edaa4a45405e78215e8d4281e9dbaa92a7462
4
+ data.tar.gz: a53f681a2637f40081a219a7153685998089d1448f1811f1e3d7d49ae7e3aef3
5
5
  SHA512:
6
- metadata.gz: efd313a26bebbf65970f222beaf86179255305328751fdca89700700238b34c13a9a1b56c9ba95776b6ead6b628886e8b1831cbce76c012fe17200ce5bf3b463
7
- data.tar.gz: 615989ce41e43a865c8894f5523702595576307dc51696d012b42d7703b95cabd4c36a184ea30b2ce418615f5307292df6749b8fc7056766c9d604a2d1b99692
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 and only have knowledge of the programming language {language}.
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
- @logger.info("APPLICATION #{@name} PATCHING CONTEXT #{name}")
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='#{digest}'>#{new_code}#{::Regexp.last_match(4)}#{::Regexp.last_match(5)}"
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llmed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jovany Leandro G.C