Class: ActionMCP::Generators::IdentifierGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/action_mcp/identifier/identifier_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_identifier_fileObject



19
20
21
# File 'lib/generators/action_mcp/identifier/identifier_generator.rb', line 19

def create_identifier_file
  template "identifier.rb.erb", "app/mcp/identifiers/#{file_name}.rb"
end

#show_usage_instructionsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/action_mcp/identifier/identifier_generator.rb', line 23

def show_usage_instructions
  say "\nIdentifier generated successfully!", :green
  say "\nNext steps:", :blue
  say "1. Configure authentication methods in config/mcp.yml:"
  say "   authentication_methods: [\"#{auth_method}\"]", :yellow
  say "\n2. Register in ApplicationGateway:"
  say "   identified_by #{class_name}", :yellow
  say "\n3. Customize the resolve method in app/mcp/identifiers/#{file_name}.rb"

  if lookup_method == "database"
    say "\n4. Ensure your #{identity.capitalize} model has the required fields/methods", :cyan
  elsif lookup_method == "middleware"
    say "\n4. Ensure your middleware sets the required request.env keys", :cyan
  end
end