Module: RailsAiBridge::Registry

Defined in:
lib/rails_ai_bridge/registry.rb,
lib/rails_ai_bridge/registry/lockfile.rb,
lib/rails_ai_bridge/registry/resolver.rb,
lib/rails_ai_bridge/registry/truncatable.rb,
lib/rails_ai_bridge/registry/pack_detector.rb,
lib/rails_ai_bridge/registry/pack_resolver.rb,
lib/rails_ai_bridge/registry/source_parser.rb,
lib/rails_ai_bridge/registry/tile_manifest.rb,
lib/rails_ai_bridge/registry/rake_presenter.rb,
lib/rails_ai_bridge/registry/resolver_cache.rb,
lib/rails_ai_bridge/registry/pack_definition.rb,
lib/rails_ai_bridge/registry/registry_manifest.rb,
lib/rails_ai_bridge/registry/frontmatter_parser.rb,
lib/rails_ai_bridge/registry/skill_source_resolver.rb

Overview

Registry resolution system for skill packs.

Provides priority-based loading of skill packs from git repositories, deprecation redirect handling, and framework auto-detection.

Defined Under Namespace

Modules: GitRunner, SourceParser, Truncatable Classes: AgentEntry, DefaultGitRunner, DeprecatedEntry, DetectedFramework, FrontmatterParser, LoadedPack, Lockfile, PackDefinition, PackDetector, PackResolver, RakePresenter, RegistryManifest, ResolvedSkill, Resolver, ResolverCache, SkillEntry, SkillSourceResolver, SkillSummary, TileManifest

Class Method Summary collapse

Class Method Details

.build_resolver(config = RailsAiBridge.configuration.registry) ⇒ Resolver?

Builds (or returns a cached) Resolver from the current Config::Registry.

The first call for a given TTL window loads the manifest from disk, wires the SkillSourceResolver and PackResolver pipeline, and caches the result. Subsequent calls within the TTL window return the same resolver without I/O.

Returns nil when the registry manifest file does not exist, allowing callers to surface a helpful setup message rather than raising. A nil result is never cached — the next call will retry.

Parameters:

Returns:

  • (Resolver, nil)

    wired resolver, or nil if manifest file is missing



81
82
83
# File 'lib/rails_ai_bridge/registry.rb', line 81

def self.build_resolver(config = RailsAiBridge.configuration.registry)
  resolver_cache.fetch(config) { build_resolver_uncached(config) }
end

.invalidate_resolver_cache!void

This method returns an undefined value.

Discards the cached resolver so the next build_resolver call rebuilds from disk.

Call this after clearing the git cache or modifying the registry manifest at runtime.



65
66
67
# File 'lib/rails_ai_bridge/registry.rb', line 65

def self.invalidate_resolver_cache!
  @resolver_cache_mutex.synchronize { @resolver_cache&.invalidate! }
end

.resolver_cacheObject

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.

Returns the module-level ResolverCache instance, creating it on first call.



54
55
56
57
58
# File 'lib/rails_ai_bridge/registry.rb', line 54

def self.resolver_cache
  @resolver_cache_mutex.synchronize do
    @resolver_cache ||= ResolverCache.new
  end
end

.write_lockfile(config = RailsAiBridge.configuration.registry) ⇒ void

This method returns an undefined value.

Writes a lockfile containing the current HEAD commit SHA for every pack in the registry manifest.

Parameters:

Raises:

  • (ArgumentError)

    when the manifest file does not exist



91
92
93
94
95
96
97
98
99
100
# File 'lib/rails_ai_bridge/registry.rb', line 91

def self.write_lockfile(config = RailsAiBridge.configuration.registry)
  manifest_path = config.registry_manifest_path
  raise ArgumentError, "Registry manifest not found at #{manifest_path}" unless File.exist?(manifest_path)

  manifest = RegistryManifest.from_file(manifest_path)
  git_runner = DefaultGitRunner.new(timeout: config.git_timeout)
  source_resolver = SkillSourceResolver.new(config.skill_cache_dir, git_runner, pull_ttl: config.git_pull_ttl)

  Lockfile.write(config.lockfile_path, manifest, source_resolver)
end