llmed 0.3.9 → 0.3.11
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/application.rb +2 -0
- data/lib/llmed/configuration.rb +12 -8
- data/lib/llmed/deployment.rb +18 -0
- data/lib/llmed/deployment.rb~ +16 -0
- data/lib/llmed/release.rb +1 -1
- data/lib/llmed.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a76594513224861d625b7f9bccec631ce781a119dd940eb3136a035054c4bd5
|
4
|
+
data.tar.gz: d308c71076898ec61f0a20453c762983a841955875cc1f181f6dd809b650538b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8946ce2b8ba9bf2a7e34065c62e3c911441cbda1f9770f04f47550ad654abbfd2d59e3a3c174c9a449712e6374a2b23aa387f30783c2cb32e2b02787169dac0
|
7
|
+
data.tar.gz: c9d99c0f4f6e2af6d304051608fa5dfbba3063023c5aa3c44c13ae07d74f276f7fe9bb8695d614296b8a26addb0efab8ca48cb41642b7964512ce567a0139ffd
|
data/lib/llmed/application.rb
CHANGED
@@ -120,6 +120,8 @@ class LLMed
|
|
120
120
|
def system_prompt(configuration)
|
121
121
|
configuration.prompt(language: language,
|
122
122
|
source_code: source_code,
|
123
|
+
code_comment_begin: @code_comment.begin,
|
124
|
+
code_comment_end: @code_comment.end,
|
123
125
|
update_context_digests: digests_of_context_to_update)
|
124
126
|
end
|
125
127
|
|
data/lib/llmed/configuration.rb
CHANGED
@@ -9,7 +9,6 @@ class LLMed
|
|
9
9
|
You are a software developer with knowledge only of the programming language {language}, following the SOLID principles strictly, you always use only imperative and functional programming, design highly isolated components.
|
10
10
|
The contexts are declarations of how the source code will be (not a file) ensure to follow this always.
|
11
11
|
The contexts are connected as a flat linked list.
|
12
|
-
Your response must contain only the generated source code, with no additional text or comments, and ou must ensure that runs correctly on the first attempt.
|
13
12
|
All the contexts represent one source code.
|
14
13
|
There is always a one-to-one correspondence between context and source code.
|
15
14
|
Always include the properly escaped comment: LLMED-COMPILED.
|
@@ -19,22 +18,27 @@ You must only modify the following source code:
|
|
19
18
|
|
20
19
|
Only generate source code of the context who digest belongs to {update_context_digests} or a is a new context.
|
21
20
|
|
22
|
-
Wrap with comment every code that belongs to the indicated context, example in
|
23
|
-
|
21
|
+
Wrap with comment every code that belongs to the indicated context, example in {language}:
|
22
|
+
{code_comment_begin}<llmed-code context='context name' digest='....' after='digest next context'>{code_comment_end}
|
24
23
|
...
|
25
|
-
|
26
|
-
|
24
|
+
{code_comment_begin}</llmed-code>{code_comment_end}
|
25
|
+
|
26
|
+
!!Your response must contain only the generated source code, with no additional text or comments, and you must ensure that runs correctly on the first attempt.
|
27
|
+
", input_variables: %w[language source_code code_comment_begin code_comment_end update_context_digests])
|
27
28
|
end
|
28
29
|
|
29
|
-
def prompt(language:, source_code:, update_context_digests: [])
|
30
|
-
@prompt.format(language: language,
|
30
|
+
def prompt(language:, source_code:, code_comment_begin:, code_comment_end:, update_context_digests: [])
|
31
|
+
@prompt.format(language: language,
|
32
|
+
source_code: source_code,
|
33
|
+
code_comment_begin: code_comment_begin,
|
34
|
+
code_comment_end: code_comment_end,
|
31
35
|
update_context_digests: update_context_digests.join(','))
|
32
36
|
end
|
33
37
|
|
34
38
|
# Change the default prompt, input variables: language, source_code
|
35
39
|
# Example:
|
36
40
|
# set_prompt "my new prompt"
|
37
|
-
def set_prompt(*arg, input_variables: %w[language source_code], **args)
|
41
|
+
def set_prompt(*arg, input_variables: %w[language code_comment_begin code_comment_end source_code], **args)
|
38
42
|
input_variables = {} if args[:file]
|
39
43
|
prompt = File.read(args[:file]) if args[:file]
|
40
44
|
prompt ||= arg.first
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright 2025 Jovany Leandro G.C <bit4bit@riseup.net>
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
class LLMed
|
5
|
+
class Deployment
|
6
|
+
def initialize(name:, output_dir:, logger:, block:)
|
7
|
+
@name = name
|
8
|
+
@output_dir = output_dir
|
9
|
+
@logger = logger
|
10
|
+
@block = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
@logger.info("DEPLOYMENT [#{@name}] EXECUTING")
|
15
|
+
instance_eval(&@block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Copyright 2025 Jovany Leandro G.C <bit4bit@riseup.net>
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
class LLMed
|
5
|
+
class Deployment
|
6
|
+
def initialize(name:, output_dir:, block:)
|
7
|
+
@name = name
|
8
|
+
@output_dir = output_dir
|
9
|
+
@block = block
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute()
|
13
|
+
self.instance_eval(@block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/llmed/release.rb
CHANGED
@@ -125,7 +125,7 @@ class LLMed
|
|
125
125
|
@code_comment = code_comment
|
126
126
|
@contexts = []
|
127
127
|
|
128
|
-
@origin.scan(%r{<llmed-code context='(.+?)' digest='(.+?)'\s*(after='.*?')?>#{@code_comment.end}(.+?)#{@code_comment.begin}
|
128
|
+
@origin.scan(%r{<llmed-code context='(.+?)' digest='(.+?)'\s*(after='.*?')?>#{@code_comment.end}(.+?)#{@code_comment.begin}+\s*<?/?llmed-code}im).each do |match|
|
129
129
|
name, digest, after_block, code = match
|
130
130
|
after = if after_block.nil?
|
131
131
|
''
|
data/lib/llmed.rb
CHANGED
@@ -16,6 +16,7 @@ class LLMed
|
|
16
16
|
def initialize(logger:, output_dir:, release_dir:)
|
17
17
|
@logger = logger
|
18
18
|
@applications = []
|
19
|
+
@deploys = []
|
19
20
|
@configuration = Configuration.new
|
20
21
|
@release_dir = release_dir || output_dir
|
21
22
|
@output_dir = output_dir
|
@@ -46,10 +47,18 @@ class LLMed
|
|
46
47
|
@applications << @app
|
47
48
|
end
|
48
49
|
|
50
|
+
def deploy(name, &block)
|
51
|
+
@deploys << Deployment.new(name: name, output_dir: @output_dir, logger: @logger, block: block)
|
52
|
+
end
|
53
|
+
|
49
54
|
def compile
|
50
55
|
@applications.each do |app|
|
51
56
|
compile_application(app)
|
52
57
|
end
|
58
|
+
|
59
|
+
@deploys.each do |deploy|
|
60
|
+
deploy.execute
|
61
|
+
end
|
53
62
|
end
|
54
63
|
|
55
64
|
private
|
@@ -84,3 +93,4 @@ require_relative 'llmed/configuration'
|
|
84
93
|
require_relative 'llmed/context'
|
85
94
|
require_relative 'llmed/release'
|
86
95
|
require_relative 'llmed/application'
|
96
|
+
require_relative 'llmed/deployment'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llmed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jovany Leandro G.C
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: langchainrb
|
@@ -102,6 +102,8 @@ files:
|
|
102
102
|
- lib/llmed/configuration.rb~
|
103
103
|
- lib/llmed/context.rb
|
104
104
|
- lib/llmed/context.rb~
|
105
|
+
- lib/llmed/deployment.rb
|
106
|
+
- lib/llmed/deployment.rb~
|
105
107
|
- lib/llmed/release.rb
|
106
108
|
- lib/llmed/release.rb~
|
107
109
|
homepage: https://github.com/bit4bit/llmed
|