Class: RailsAiBridge::Config::Registry

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeRegistry

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.expand_path('~/.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_dependenciesBoolean

Returns whether declared depends_on packs are loaded transitively (default: false — dependencies must be listed explicitly and missing ones only warn).

Returns:

  • (Boolean)

    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_ttlInteger

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.

Returns:

  • (Integer)

    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_timeoutInteger

Returns timeout in seconds for individual git operations (clone, pull, checkout). Prevents a slow or unreachable remote from blocking the calling thread indefinitely.

Returns:

  • (Integer)

    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_pathsArray<String>

Returns local registry directory paths.

Returns:

  • (Array<String>)

    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_pathString?

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.

Returns:

  • (String, nil)

    resolved lockfile path



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_verificationSymbol

Returns how to behave when the lockfile differs from the resolved pack: :strict (default) raises, :warn logs but proceeds, :disabled skips verification.

Returns:

  • (Symbol)

    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_pathString

Returns the configured registry manifest path, applying a backward-compatibility fallback when the default path does not exist but the legacy path does.

Returns:

  • (String)

    resolved manifest path



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_ttlInteger

Returns TTL in seconds for the in-memory resolver cache (default: 1800 = 30 min).

Returns:

  • (Integer)

    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_dirString

Returns directory for caching git repositories.

Returns:

  • (String)

    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_packsArray<String>?

Returns explicit pack names to load, or nil for auto-detection.

Returns:

  • (Array<String>, nil)

    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_pathObject

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_pathObject

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