Class: StimulusPlumbers::MCP::GuideLoader

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

Constant Summary collapse

OVERVIEW_PATH =
File.expand_path("guide.md", __dir__).freeze

Class Method Summary collapse

Class Method Details

.callObject



9
10
11
12
13
14
15
16
17
# File 'lib/stimulus_plumbers/mcp/loaders/guide_loader.rb', line 9

def call
  {
    overview:   read_file(OVERVIEW_PATH),
    component:  read_file(component_guide_path),
    controller: read_file(controller_guide_path),
    tailwind:   read_file(tailwind_guide_path),
    theme:      read_file(File.join(ComponentDocsLoader.docs_dir, "theme.md"))
  }
end

.controller_guide_pathObject

Reused by VersionsLoader to report which fallback location resolved.



20
21
22
23
24
25
26
27
# File 'lib/stimulus_plumbers/mcp/loaders/guide_loader.rb', line 20

def controller_guide_path
  # 1. Monorepo dev checkout — the JS package's own docs are freshest while working locally.
  dev_path = File.expand_path(File.join(__dir__, "../../../../..", "stimulus-plumbers", "docs", "guide.md"))
  return dev_path if File.exist?(dev_path)

  # 2. gem exec — vendored into the rails gem at release time, under vendor/controller/guide.md.
  GemVendorPath.resolve("controller", "guide.md")
end