Class: RosettAi::PathResolver
- Inherits:
-
Object
- Object
- RosettAi::PathResolver
- Defined in:
- lib/rosett_ai/path_resolver.rb
Overview
Resolves filesystem paths for rai configuration directories. Uses instance methods for future multi-engine support (ADR-006).
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
Class Method Summary collapse
-
.default ⇒ PathResolver
Memoized default instance for single-engine usage.
Instance Method Summary collapse
-
#claude_code_config_dir ⇒ Pathname
Claude engine configuration source directory.
-
#content_cache_dir ⇒ Pathname
Content pack cache directory.
-
#global_dir ⇒ Pathname
Global configuration directory.
-
#initialize(engine: :claude) ⇒ PathResolver
constructor
Create a new path resolver for the given engine.
-
#license_file ⇒ Pathname
Ed25519-signed JWT license key file.
-
#local_dir ⇒ Pathname
Project-local configuration directory.
-
#local_settings_path ⇒ Pathname
Local settings override (gitignored).
-
#managed_settings_path ⇒ Pathname
System-wide managed settings (enterprise).
-
#packaged_conf_dir ⇒ Pathname
Packaged defaults directory (from .deb install).
-
#premium_content_dir ⇒ Pathname
Premium content packs directory.
-
#project_claude_md ⇒ Pathname
Project-level CLAUDE.md file.
-
#project_settings_path ⇒ Pathname
Project-level settings file.
-
#rai_conf_dir ⇒ Pathname
XDG-compliant rai behaviour/design conf directory.
-
#rai_config_dir ⇒ Pathname
XDG-compliant rai configuration directory.
-
#rules_dir ⇒ Pathname
Compiled rules output directory.
-
#rules_display_path ⇒ String
Tilde-form display path for lockfile output.
-
#secrets_file ⇒ Pathname
Encrypted secrets store.
-
#user_pwd ⇒ String
The user's original working directory.
-
#user_settings_path ⇒ Pathname
Global user settings file.
Constructor Details
#initialize(engine: :claude) ⇒ PathResolver
Create a new path resolver for the given engine.
17 18 19 |
# File 'lib/rosett_ai/path_resolver.rb', line 17 def initialize(engine: :claude) @engine = engine end |
Instance Attribute Details
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
11 12 13 |
# File 'lib/rosett_ai/path_resolver.rb', line 11 def engine @engine end |
Class Method Details
.default ⇒ PathResolver
Memoized default instance for single-engine usage.
111 112 113 |
# File 'lib/rosett_ai/path_resolver.rb', line 111 def self.default @default ||= new end |
Instance Method Details
#claude_code_config_dir ⇒ Pathname
Claude engine configuration source directory.
95 |
# File 'lib/rosett_ai/path_resolver.rb', line 95 def claude_code_config_dir = RosettAi.root.join('conf', 'engines', 'claude', 'config') |
#content_cache_dir ⇒ Pathname
Content pack cache directory.
71 |
# File 'lib/rosett_ai/path_resolver.rb', line 71 def content_cache_dir = rai_config_dir.join('cache', 'content') |
#global_dir ⇒ Pathname
Global configuration directory.
25 |
# File 'lib/rosett_ai/path_resolver.rb', line 25 def global_dir = Pathname.new(File.('~/.claude')) |
#license_file ⇒ Pathname
Ed25519-signed JWT license key file.
63 |
# File 'lib/rosett_ai/path_resolver.rb', line 63 def license_file = rai_config_dir.join('license.key') |
#local_dir ⇒ Pathname
Project-local configuration directory.
33 |
# File 'lib/rosett_ai/path_resolver.rb', line 33 def local_dir = Pathname.new(user_pwd).join('.claude') |
#local_settings_path ⇒ Pathname
Local settings override (gitignored).
91 |
# File 'lib/rosett_ai/path_resolver.rb', line 91 def local_settings_path = local_dir.join('settings.local.json') |
#managed_settings_path ⇒ Pathname
System-wide managed settings (enterprise).
77 78 79 |
# File 'lib/rosett_ai/path_resolver.rb', line 77 def managed_settings_path Pathname.new('/etc/claude-code/managed-settings.json') end |
#packaged_conf_dir ⇒ Pathname
Packaged defaults directory (from .deb install).
55 |
# File 'lib/rosett_ai/path_resolver.rb', line 55 def packaged_conf_dir = Pathname.new('/opt/rosett-ai/app/conf') |
#premium_content_dir ⇒ Pathname
Premium content packs directory.
67 |
# File 'lib/rosett_ai/path_resolver.rb', line 67 def premium_content_dir = rai_config_dir.join('premium') |
#project_claude_md ⇒ Pathname
Project-level CLAUDE.md file.
37 |
# File 'lib/rosett_ai/path_resolver.rb', line 37 def project_claude_md = Pathname.new(user_pwd).join('CLAUDE.md') |
#project_settings_path ⇒ Pathname
Project-level settings file.
87 |
# File 'lib/rosett_ai/path_resolver.rb', line 87 def project_settings_path = local_dir.join('settings.json') |
#rai_conf_dir ⇒ Pathname
XDG-compliant rai behaviour/design conf directory. This is where user-level behaviours live — the global compile source.
51 |
# File 'lib/rosett_ai/path_resolver.rb', line 51 def rai_conf_dir = rai_config_dir.join('conf') |
#rai_config_dir ⇒ Pathname
XDG-compliant rai configuration directory.
43 44 45 46 |
# File 'lib/rosett_ai/path_resolver.rb', line 43 def rai_config_dir xdg = ENV.fetch('XDG_CONFIG_HOME', File.join(Dir.home, '.config')) Pathname.new(xdg).join('rosett-ai') end |
#rules_dir ⇒ Pathname
Compiled rules output directory.
29 |
# File 'lib/rosett_ai/path_resolver.rb', line 29 def rules_dir = global_dir.join('rules') |
#rules_display_path ⇒ String
Tilde-form display path for lockfile output.
99 |
# File 'lib/rosett_ai/path_resolver.rb', line 99 def rules_display_path = '~/.claude/rules' |
#secrets_file ⇒ Pathname
Encrypted secrets store.
59 |
# File 'lib/rosett_ai/path_resolver.rb', line 59 def secrets_file = rai_config_dir.join('secrets.yml') |
#user_pwd ⇒ String
The user's original working directory. When running from the .deb wrapper, Dir.pwd is /opt/rosett-ai/app, so RAI_ORIGINAL_PWD (set by the wrapper) preserves the real directory.
105 106 107 |
# File 'lib/rosett_ai/path_resolver.rb', line 105 def user_pwd ENV.fetch('RAI_ORIGINAL_PWD', Dir.pwd) end |
#user_settings_path ⇒ Pathname
Global user settings file.
83 |
# File 'lib/rosett_ai/path_resolver.rb', line 83 def user_settings_path = global_dir.join('settings.json') |