Class: RailsAiBridge::Config::Registry
- Inherits:
-
Object
- Object
- RailsAiBridge::Config::Registry
- Defined in:
- lib/rails_ai_bridge/config/registry.rb
Overview
Holds registry resolution configuration for skill packs.
Controls how the bridge resolves and loads skill packs from git repositories, including cache location, manifest path, explicit pack selection, and local registry overrides.
Constant Summary collapse
- DEFAULT_REGISTRY_MANIFEST_PATH =
Default path for the registry manifest (4.2.0+ standard location).
'config/rails_ai_bridge/registry.json'- LEGACY_REGISTRY_MANIFEST_PATH =
Legacy manifest path used before 4.2.0; kept for backward-compat fallback.
'config/rails_ai_bridge_registry.json'- DEFAULT_LOCKFILE_PATH =
Default path for the skill pack lockfile (4.2.0+ standard location).
'config/rails_ai_bridge/registry.lock'- LEGACY_LOCKFILE_PATH =
Legacy lockfile path used before 4.2.0; kept for backward-compat fallback.
'config/rails_ai_bridge/directory.lock'
Instance Attribute Summary collapse
-
#auto_load_dependencies ⇒ Boolean
Whether declared
depends_onpacks are loaded transitively (default: false — dependencies must be listed explicitly and missing ones only warn). -
#git_pull_ttl ⇒ Integer
TTL in seconds between git pull refreshes per cached pack (default: 86400 = 24 h).
-
#git_timeout ⇒ Integer
Timeout in seconds for individual git operations (clone, pull, checkout).
-
#local_registry_paths ⇒ Array<String>
Local registry directory paths.
-
#lockfile_path ⇒ String?
Returns the configured lockfile path, applying a backward-compatibility fallback when the default path does not exist but the legacy path does.
-
#lockfile_verification ⇒ Symbol
How to behave when the lockfile differs from the resolved pack: :strict (default) raises, :warn logs but proceeds, :disabled skips verification.
-
#registry_manifest_path ⇒ String
Returns the configured registry manifest path, applying a backward-compatibility fallback when the default path does not exist but the legacy path does.
-
#resolver_ttl ⇒ Integer
TTL in seconds for the in-memory resolver cache (default: 1800 = 30 min).
-
#skill_cache_dir ⇒ String
Directory for caching git repositories.
-
#skill_packs ⇒ Array<String>?
Explicit pack names to load, or nil for auto-detection.
Instance Method Summary collapse
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #legacy_lockfile_path ⇒ Object private
- #legacy_manifest_path ⇒ Object private
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 142 def initialize @registry_manifest_path = DEFAULT_REGISTRY_MANIFEST_PATH @skill_cache_dir = File.('~/.rails-ai-bridge/cache') @skill_packs = nil @local_registry_paths = [] @resolver_ttl = 1800 @git_pull_ttl = 86_400 @git_timeout = 30 @lockfile_path = DEFAULT_LOCKFILE_PATH @lockfile_verification = :strict @auto_load_dependencies = false end |
Instance Attribute Details
#auto_load_dependencies ⇒ Boolean
Returns whether declared depends_on packs are loaded transitively
(default: false — dependencies must be listed explicitly and missing ones only warn).
90 91 92 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 90 def auto_load_dependencies @auto_load_dependencies end |
#git_pull_ttl ⇒ Integer
Returns TTL in seconds between git pull refreshes per cached pack (default: 86400 = 24 h). Set to 0 to pull on every resolver rebuild. Skill pack files are documentation and rarely change between releases, so a long freshness window is appropriate.
44 45 46 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 44 def git_pull_ttl @git_pull_ttl end |
#git_timeout ⇒ Integer
Returns timeout in seconds for individual git operations (clone, pull, checkout). Prevents a slow or unreachable remote from blocking the calling thread indefinitely.
48 49 50 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 48 def git_timeout @git_timeout end |
#local_registry_paths ⇒ Array<String>
Returns local registry directory paths.
36 37 38 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 36 def local_registry_paths @local_registry_paths end |
#lockfile_path ⇒ String?
Returns the configured lockfile path, applying a backward-compatibility
fallback when the default path does not exist but the legacy path does.
Returns nil when lockfile verification is disabled.
68 69 70 71 72 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 68 def lockfile_path return @lockfile_path unless @lockfile_path == DEFAULT_LOCKFILE_PATH File.exist?(DEFAULT_LOCKFILE_PATH) ? DEFAULT_LOCKFILE_PATH : legacy_lockfile_path end |
#lockfile_verification ⇒ Symbol
Returns how to behave when the lockfile differs from the resolved pack: :strict (default) raises, :warn logs but proceeds, :disabled skips verification.
86 87 88 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 86 def lockfile_verification @lockfile_verification end |
#registry_manifest_path ⇒ String
Returns the configured registry manifest path, applying a backward-compatibility fallback when the default path does not exist but the legacy path does.
57 58 59 60 61 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 57 def registry_manifest_path return @registry_manifest_path unless @registry_manifest_path == DEFAULT_REGISTRY_MANIFEST_PATH File.exist?(DEFAULT_REGISTRY_MANIFEST_PATH) ? DEFAULT_REGISTRY_MANIFEST_PATH : legacy_manifest_path end |
#resolver_ttl ⇒ Integer
Returns TTL in seconds for the in-memory resolver cache (default: 1800 = 30 min).
39 40 41 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 39 def resolver_ttl @resolver_ttl end |
#skill_cache_dir ⇒ String
Returns directory for caching git repositories.
30 31 32 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 30 def skill_cache_dir @skill_cache_dir end |
#skill_packs ⇒ Array<String>?
Returns explicit pack names to load, or nil for auto-detection.
33 34 35 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 33 def skill_packs @skill_packs end |
Instance Method Details
#legacy_lockfile_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
80 81 82 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 80 def legacy_lockfile_path File.exist?(LEGACY_LOCKFILE_PATH) ? LEGACY_LOCKFILE_PATH : DEFAULT_LOCKFILE_PATH end |
#legacy_manifest_path ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 |
# File 'lib/rails_ai_bridge/config/registry.rb', line 75 def legacy_manifest_path File.exist?(LEGACY_REGISTRY_MANIFEST_PATH) ? LEGACY_REGISTRY_MANIFEST_PATH : DEFAULT_REGISTRY_MANIFEST_PATH end |