Skip to content

refactor: extract shared _build_prompt and _derive_artifacts helpers out of provider adapters #229

Description

@Ryan-Atkinson87

Background

PRs #224 (CodexAdapter) and #225 (GeminiAdapter) each contain identical _build_prompt and _derive_artifacts module-level functions. ClaudeAdapter also contains its own _derive_artifacts (at claude.py:317). Any future ProviderAdapter implementation would need to duplicate them again.

Work

  • Create orchestrator-api/app/providers/utils.py (or subprocess_helpers.py) exporting:
    • build_prompt(prompt: str, context_files: list[Path]) -> str
    • derive_artifacts(repo: GitRepo, head_before: str) -> Coroutine[..., list[str]]
  • Update claude.py, codex.py, and gemini.py to import from the shared module and delete the local copies.
  • No behaviour change — pure refactor.

Acceptance criteria

  • Single implementation of each helper, imported by all three adapters
  • All existing adapter tests still pass (uv run pytest)
  • ruff check and pyright clean

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions