Skip to content

Refactor: Split fetcher.py into focused modules #513

@kasperjunge

Description

@kasperjunge

agr/fetcher.py is the largest module (~11k tokens) and handles too many responsibilities: skill installation, ralph installation, uninstallation, query operations, repo preparation, sparse checkout coordination, name conflict resolution, and metadata stamping. This makes it the hardest file to reason about and modify.

Proposal

Split into focused modules:

  • installer.py — install orchestration (skill + ralph)
  • uninstaller.py — removal logic
  • resolver.py — name conflict resolution and destination resolution
  • Keep fetcher.py as a thin facade re-exporting the public API for backward compatibility

Motivation

  • Easier to navigate and understand individual concerns
  • Reduces merge conflicts when multiple contributors touch install vs remove logic
  • Makes it possible to test each concern in isolation
  • The current module mixes high-level orchestration with low-level details (e.g., _resolve_skill_destination alongside fetch_and_install_to_tools)

Context

Identified in architecture audit: docs/contributing/architecture-audit.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions