Class: StimulusPlumbers::MCP::ComponentManifestLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/stimulus_plumbers/mcp/loaders/component_manifest_loader.rb

Overview

Reads the stimulus_plumbers gem's own generated wiring manifest (vendor/component/manifest.json). Unlike ControllerSchemaLoader, this never crosses ecosystems — stimulus_plumbers is always installed alongside this gem (hard runtime dependency), so there's no node_modules-style path.

Constant Summary collapse

MANIFEST_FILENAME =
"manifest.json"

Class Method Summary collapse

Class Method Details

.callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/stimulus_plumbers/mcp/loaders/component_manifest_loader.rb', line 12

def call
  path = resolved_path

  unless path
    StimulusPlumbers::Logger.warn(
      "component manifest not found. Tried:\n" \
      "#{manifest_paths.map { |p| "  - #{p}" }.join("\n")}\n" \
      "Run `bundle exec rake build:manifest` in stimulus-plumbers-rails/ to generate it."
    )
    return {}
  end

  JSON.parse(File.read(path))
end

.resolved_pathObject



27
28
29
# File 'lib/stimulus_plumbers/mcp/loaders/component_manifest_loader.rb', line 27

def resolved_path
  manifest_paths.find { |p| File.exist?(p) }
end