Class: SublayerCommandGenerator

Inherits:
Sublayer::Generators::Base show all
Defined in:
lib/sublayer/cli/commands/generators/sublayer_command_generator.rb

Instance Attribute Summary

Attributes inherited from Sublayer::Generators::Base

#results

Instance Method Summary collapse

Methods inherited from Sublayer::Generators::Base

llm_output_adapter

Constructor Details

#initialize(generator_code:) ⇒ SublayerCommandGenerator

Returns a new instance of SublayerCommandGenerator.



12
13
14
# File 'lib/sublayer/cli/commands/generators/sublayer_command_generator.rb', line 12

def initialize(generator_code:)
  @generator_code = generator_code
end

Instance Method Details

#generateObject



16
17
18
# File 'lib/sublayer/cli/commands/generators/sublayer_command_generator.rb', line 16

def generate
  super
end

#promptObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/sublayer/cli/commands/generators/sublayer_command_generator.rb', line 20

def prompt
  "  You are an expert Ruby developer.\n\n  Given the following Sublayer generator code:\n\n  \#{@generator_code}\n\n  Please generate a Thor command class that interacts with this generator. The command should:\n\n  - Be a subclass of `BaseCommand`.\n  - Include a descriptive class name.\n  - Provide a description for the command.\n  - Implement an `execute` method that accepts appropriate arguments and invokes the generator.\n\n  Provide the class name, description, execute method body, and filename for the command.\n\n  These parameters will be used in a template to create the command file. The template is:\n       module <%= project_name.camelize %>\n   module Commands\n     class <%= command_class_name %> < BaseCommand\n       def self.description\n         \"<%= command_description %>\"\n       end\n\n       def execute(*args)\n         <%= command_execute_body %>\n       end\n     end\n   end\n end\n\n  Take into account any parameters the generator requires and map them to command-line arguments.\n  PROMPT\nend\n"