Class: RailsAiBridge::Registry::PackResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_ai_bridge/registry/pack_resolver.rb

Overview

Service object responsible for resolving and loading skill packs and registries.

Orchestrates the loading of packs from the registry manifest, handling framework auto-detection, explicit pack selection, and local registry overrides. Returns a Resolver instance with all packs loaded and prioritized.

Constant Summary collapse

RAILS_PACK =

Pack name constants

'rails'
HANAMI_PACK =
'hanami'
CORE_PACK =
'core'
PRIORITY_HIGH =

Priority constants (lower is higher priority)

10
PRIORITY_MEDIUM =
20
PRIORITY_LOW =
30

Instance Method Summary collapse

Constructor Details

#initialize(source_resolver, pack_detector = PackDetector) ⇒ PackResolver

Creates a new PackResolverService with a reference to a SkillSourceResolver.

Parameters:

  • source_resolver (SkillSourceResolver)

    resolver for remote git sources

  • pack_detector (Object) (defaults to: PackDetector)

    optional pack detector for testing (defaults to PackDetector)



25
26
27
28
# File 'lib/rails_ai_bridge/registry/pack_resolver.rb', line 25

def initialize(source_resolver, pack_detector = PackDetector)
  @source_resolver = source_resolver
  @pack_detector = pack_detector
end

Instance Method Details

#resolve(manifest, explicit_packs = nil, local_registries = nil) ⇒ Resolver

Resolves active packs from the manifest and custom configuration.

This will automatically resolve remote repositories if needed, load the tile manifest configurations, and merge local directory overrides.

:reek:TooManyStatements -- Necessary complexity for pack loading logic

Parameters:

  • manifest (RegistryManifest)

    the registry manifest containing pack definitions

  • explicit_packs (Array<String>, nil) (defaults to: nil)

    optional list of pack names to load

  • local_registries (Array<String>, nil) (defaults to: nil)

    optional list of local registry directory paths

Returns:

  • (Resolver)

    resolver with all active packs loaded



40
41
42
43
44
45
46
# File 'lib/rails_ai_bridge/registry/pack_resolver.rb', line 40

def resolve(manifest, explicit_packs = nil, local_registries = nil)
  active_pack_names = gather_active_packs(manifest, explicit_packs)
  loaded_packs = load_defined_packs(manifest, active_pack_names)
  load_local_registries(loaded_packs, local_registries)

  Resolver.new(loaded_packs)
end