Module: Rails::Hyperdrive::InstallLayout

Defined in:
lib/rails/hyperdrive/install_layout.rb

Overview

The one place install paths and artifact names are built and parsed. Must stay require-free: the MCP server loads it and must not drag in the install machinery.

Constant Summary collapse

SKILLS_DIR =
".claude/skills".freeze
HYPERDRIVE_DIR =
".claude/hyperdrive".freeze
INDEX_PATH =
"#{HYPERDRIVE_DIR}/index.md".freeze
LOCK_PATH =
".hyperdrive/lock.yml".freeze
ARTIFACT_TYPES =
{ "skill" => :skill, "skill_support" => :skill_support, "guideline" => :guideline }.freeze

Class Method Summary collapse

Class Method Details

.base_name(name) ⇒ Object



40
41
42
# File 'lib/rails/hyperdrive/install_layout.rb', line 40

def base_name(name)
  name.split("--").first.to_s
end

.dest_for(type, final_name) ⇒ Object



16
17
18
19
20
21
# File 'lib/rails/hyperdrive/install_layout.rb', line 16

def dest_for(type, final_name)
  case type
  when :skill     then "#{SKILLS_DIR}/#{final_name}/SKILL.md"
  when :guideline then "#{HYPERDRIVE_DIR}/guidelines/#{final_name}.md"
  end
end

.installed_name(type, dest) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rails/hyperdrive/install_layout.rb', line 23

def installed_name(type, dest)
  case type
  when :skill         then File.basename(File.dirname(dest))
  when :skill_support then dest.split("/")[2] # .claude/skills/<name>/<relpath>
  when :guideline     then File.basename(dest, ".md")
  end
end

.postfixed_name(name, source_gem) ⇒ Object



36
37
38
# File 'lib/rails/hyperdrive/install_layout.rb', line 36

def postfixed_name(name, source_gem)
  "#{name}--#{source_gem}"
end

.skill_dir_of(dest) ⇒ Object



31
32
33
34
# File 'lib/rails/hyperdrive/install_layout.rb', line 31

def skill_dir_of(dest)
  segments = dest.split("/")
  File.join(*segments[0, 3]) # .claude/skills/<name>
end