Class: Plasma::ComponentGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/plasma/component_generator.rb

Overview

Handles generating individual MCP components (tools, prompts, resources, variables)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component_type, name, params = {}) ⇒ ComponentGenerator

Returns a new instance of ComponentGenerator.



13
14
15
16
17
18
19
# File 'lib/plasma/component_generator.rb', line 13

def initialize(component_type, name, params = {})
  @component_type = component_type
  @name = name
  @params = params
  @template_dir = File.expand_path("templates", __dir__)
  puts "Template directory: #{@template_dir}"
end

Instance Attribute Details

#component_typeObject (readonly)

Returns the value of attribute component_type.



11
12
13
# File 'lib/plasma/component_generator.rb', line 11

def component_type
  @component_type
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/plasma/component_generator.rb', line 11

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



11
12
13
# File 'lib/plasma/component_generator.rb', line 11

def params
  @params
end

Instance Method Details

#generateObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/plasma/component_generator.rb', line 21

def generate
  # Check if we're in a PLASMA project directory
  unless plasma_project?
    puts "Error: Not a PLASMA project directory. Please run this command from the root of a PLASMA project."
    return false
  end

  create_component_file
  true
end