Class: Senren::Rails::HostPaths
- Inherits:
-
Object
- Object
- Senren::Rails::HostPaths
- Defined in:
- lib/senren/rails/host_paths.rb
Overview
Resolves canonical paths inside a host Rails application. Accepts an explicit root for tests; defaults to Rails.root when present.
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #agent_rules_file ⇒ Object
- #base_component_path ⇒ Object
- #claude_md ⇒ Object
- #codex_agents_md ⇒ Object
- #components_dir ⇒ Object
- #conventions_file ⇒ Object
- #copilot_instructions ⇒ Object
- #cursor_rule_file ⇒ Object
- #cursor_rules_dir ⇒ Object
- #ensure_agent_dirs! ⇒ Object
-
#ensure_dirs! ⇒ Object
Pathname#mkpath stops at File.directory?, which follows symlinks, so a checkout shipping app/components/senren as a link to somewhere outside the project had that link preserved and every later write redirected through it.
- #github_dir ⇒ Object
-
#initialize(root = nil) ⇒ HostPaths
constructor
A new instance of HostPaths.
- #installed_components ⇒ Object
- #registry_mirror ⇒ Object
- #senren_dir ⇒ Object
- #skill_file ⇒ Object
- #stimulus_dir ⇒ Object
- #stylesheet_path ⇒ Object
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
9 10 11 |
# File 'lib/senren/rails/host_paths.rb', line 9 def root @root end |
Instance Method Details
#agent_rules_file ⇒ Object
20 |
# File 'lib/senren/rails/host_paths.rb', line 20 def agent_rules_file = senren_dir.join('agent-rules.md') |
#base_component_path ⇒ Object
23 |
# File 'lib/senren/rails/host_paths.rb', line 23 def base_component_path = components_dir.join('base_component.rb') |
#claude_md ⇒ Object
33 |
# File 'lib/senren/rails/host_paths.rb', line 33 def claude_md = root.join('CLAUDE.md') |
#codex_agents_md ⇒ Object
34 |
# File 'lib/senren/rails/host_paths.rb', line 34 def codex_agents_md = root.join('AGENTS.md') |
#components_dir ⇒ Object
22 |
# File 'lib/senren/rails/host_paths.rb', line 22 def components_dir = root.join('app', 'components', 'senren') |
#conventions_file ⇒ Object
19 |
# File 'lib/senren/rails/host_paths.rb', line 19 def conventions_file = senren_dir.join('conventions.md') |
#copilot_instructions ⇒ Object
30 |
# File 'lib/senren/rails/host_paths.rb', line 30 def copilot_instructions = github_dir.join('copilot-instructions.md') |
#cursor_rule_file ⇒ Object
32 |
# File 'lib/senren/rails/host_paths.rb', line 32 def cursor_rule_file = cursor_rules_dir.join('senren.mdc') |
#cursor_rules_dir ⇒ Object
31 |
# File 'lib/senren/rails/host_paths.rb', line 31 def cursor_rules_dir = root.join('.cursor', 'rules') |
#ensure_agent_dirs! ⇒ Object
47 48 49 50 51 |
# File 'lib/senren/rails/host_paths.rb', line 47 def ensure_agent_dirs! [senren_dir, github_dir, cursor_rules_dir].each do |dir| SafeWrite.mkdir_p!(dir, root, 'ensure_agent_dirs!') end end |
#ensure_dirs! ⇒ Object
Pathname#mkpath stops at File.directory?, which follows symlinks, so a checkout shipping app/components/senren as a link to somewhere outside the project had that link preserved and every later write redirected through it. SafeWrite refuses instead of silently accepting it.
40 41 42 43 44 45 |
# File 'lib/senren/rails/host_paths.rb', line 40 def ensure_dirs! [senren_dir, components_dir, stimulus_dir, stylesheet_path.dirname, github_dir, cursor_rules_dir].each do |dir| SafeWrite.mkdir_p!(dir, root, 'ensure_dirs!') end end |
#github_dir ⇒ Object
29 |
# File 'lib/senren/rails/host_paths.rb', line 29 def github_dir = root.join('.github') |
#installed_components ⇒ Object
18 |
# File 'lib/senren/rails/host_paths.rb', line 18 def installed_components = senren_dir.join('installed_components.yml') |
#registry_mirror ⇒ Object
17 |
# File 'lib/senren/rails/host_paths.rb', line 17 def registry_mirror = senren_dir.join('registry.yml') |
#senren_dir ⇒ Object
15 |
# File 'lib/senren/rails/host_paths.rb', line 15 def senren_dir = root.join('.senren') |
#skill_file ⇒ Object
16 |
# File 'lib/senren/rails/host_paths.rb', line 16 def skill_file = senren_dir.join('skill.md') |
#stimulus_dir ⇒ Object
27 |
# File 'lib/senren/rails/host_paths.rb', line 27 def stimulus_dir = root.join('app', 'javascript', 'controllers', 'senren') |
#stylesheet_path ⇒ Object
25 |
# File 'lib/senren/rails/host_paths.rb', line 25 def stylesheet_path = root.join('app', 'assets', 'stylesheets', 'senren.css') |