Module: Legion::CLI::LexTemplates

Defined in:
lib/legion/cli/lex_templates.rb

Defined Under Namespace

Classes: TemplateOverlay

Constant Summary collapse

TEMPLATES_DIR =
File.join(File.dirname(__FILE__), 'lex', 'templates').freeze
REGISTRY =
{
  'basic'               => {
    runners:      ['default'],
    actors:       ['subscription'],
    tools:        [],
    client:       false,
    dependencies: [],
    description:  'Basic extension with subscription actor'
  },
  'llm-agent'           => {
    runners:      %w[processor analyzer],
    actors:       %w[subscription polling],
    tools:        %w[process analyze],
    client:       true,
    dependencies: ['legion-llm'],
    description:  'LLM-powered agent extension',
    template_dir: 'llm_agent'
  },
  'service-integration' => {
    runners:      ['operations'],
    actors:       ['subscription'],
    tools:        [],
    client:       true,
    dependencies: [],
    description:  'External service integration with standalone client',
    template_dir: 'service_integration'
  },
  'data-pipeline'       => {
    runners:      ['transform'],
    actors:       ['ingest'],
    tools:        [],
    client:       false,
    dependencies: [],
    description:  'Event-driven data processing pipeline',
    template_dir: 'data_pipeline'
  },
  'scheduled-task'      => {
    runners:      ['executor'],
    actors:       ['interval'],
    tools:        [],
    client:       false,
    dependencies: [],
    description:  'Scheduled task with interval actor'
  },
  'webhook-handler'     => {
    runners:      %w[handler validator],
    actors:       ['subscription'],
    tools:        [],
    client:       false,
    dependencies: [],
    description:  'Inbound webhook processing'
  }
}.freeze

Class Method Summary collapse

Class Method Details

.get(name) ⇒ Object



70
71
72
# File 'lib/legion/cli/lex_templates.rb', line 70

def get(name)
  REGISTRY[name.to_s]
end

.listObject



66
67
68
# File 'lib/legion/cli/lex_templates.rb', line 66

def list
  REGISTRY.map { |name, config| { name: name, description: config[:description] } }
end

.template_dir(name) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/legion/cli/lex_templates.rb', line 78

def template_dir(name)
  config = REGISTRY[name.to_s]
  return nil unless config

  dir_key = config[:template_dir]
  return nil unless dir_key

  File.join(TEMPLATES_DIR, dir_key)
end

.valid?(name) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/legion/cli/lex_templates.rb', line 74

def valid?(name)
  REGISTRY.key?(name.to_s)
end