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, lockfile = nil) ⇒ 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)

  • lockfile (Lockfile, nil) (defaults to: nil)

    optional lockfile for pack verification



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

def initialize(source_resolver, pack_detector = PackDetector, lockfile = nil)
  @source_resolver = source_resolver
  @pack_detector = pack_detector
  @lockfile = lockfile || default_lockfile
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, merge local directory overrides, and verify pack commit SHAs against the configured lockfile.

: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



43
44
45
46
47
48
49
# File 'lib/rails_ai_bridge/registry/pack_resolver.rb', line 43

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