Class: StimulusPlumbers::MCP::ControllerSchemaLoader

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

Constant Summary collapse

MANIFEST_FILENAME =
"controllers.manifest.json"
VENDOR_FILENAME =

Vendored as manifest.json — the "controllers" prefix is redundant once nested under vendor/controller/ (mirrors the MCP server's controller:// namespace).

"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/controller_schema_loader.rb', line 12

def call
  path = resolved_path

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

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

.resolved_pathObject

Reused by VersionsLoader to report which fallback location resolved.



28
29
30
# File 'lib/stimulus_plumbers/mcp/loaders/controller_schema_loader.rb', line 28

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