[GH-ISSUE #51] [Implementation] Implement GitHub Copilot CLI Adapter #17

Closed
opened 2026-02-27 10:21:47 +03:00 by kerem · 3 comments
Owner

Originally created by @mikeyobrien on GitHub (Jan 12, 2026).
Original GitHub issue: https://github.com/mikeyobrien/ralph-orchestrator/issues/51

Ref: #48

Task: Implement GitHub Copilot CLI Adapter

Description

Implement a new adapter class CopilotAdapter in src/ralph_orchestrator/adapters/copilot.py to integrate the GitHub Copilot CLI (gh copilot) into Ralph Orchestrator. This enables Ralph to use GitHub Copilot as an agent backend.

Background

Issue #48 requests support for the GitHub Copilot CLI. This tool is accessed via the GitHub CLI extension gh copilot. The adapter must handle the invocation of this command and parse its response.

Reference Documentation

Required:

  • Design: src/ralph_orchestrator/adapters/base.py (ToolAdapter interface)
  • Existing Implementation: src/ralph_orchestrator/adapters/kiro.py

Additional References:

  • GitHub Copilot CLI documentation

Note: You MUST read the base adapter interface before beginning.

Technical Requirements

  1. Create src/ralph_orchestrator/adapters/copilot.py.
  2. Define CopilotAdapter class inheriting from ToolAdapter.
  3. Implement __init__ defaulting to gh command with copilot subcommand args.
  4. Implement aexecute to run gh copilot suggest or gh copilot explain based on context, or a generic query.
    • Constraint: gh copilot is often interactive. The adapter must use flags (like -t shell or generic query flags) to try and get non-interactive output, or document limitations.
  5. Handle output parsing.
  6. Implement unit tests in tests/test_copilot_adapter.py.

Dependencies

  • src/ralph_orchestrator/adapters/base.py
  • gh CLI tool installed with copilot extension.

Implementation Approach

  1. Create the adapter file.
  2. Implement the command construction. Likely gh copilot suggest "<prompt>" or gh copilot explain "<prompt>".
  3. Since Ralph sends generic prompts, we might default to explain or suggest -t shell depending on heuristic, or expose a configuration option. For now, treat the prompt as a query passed to the CLI.
  4. Wrap the subprocess call.
  5. Add unit tests mocking the gh command.

Acceptance Criteria

  1. Initialization

    • Given CopilotAdapter
    • When initialized
    • Then defaults to gh command
  2. Execution

    • Given a prompt
    • When executed
    • Then gh copilot is invoked with the prompt
    • And output is returned in the ToolResponse
  3. Safety

    • Given gh is missing
    • When executed
    • Then returns failure without crashing
  4. Tests

    • Given unit tests
    • When run
    • Then they pass

Metadata

  • Complexity: Medium
  • Labels: Adapter, GitHub, Copilot, Integration
  • Required Skills: Python, CLI integration
Originally created by @mikeyobrien on GitHub (Jan 12, 2026). Original GitHub issue: https://github.com/mikeyobrien/ralph-orchestrator/issues/51 # Ref: #48 # Task: Implement GitHub Copilot CLI Adapter ## Description Implement a new adapter class `CopilotAdapter` in `src/ralph_orchestrator/adapters/copilot.py` to integrate the GitHub Copilot CLI (`gh copilot`) into Ralph Orchestrator. This enables Ralph to use GitHub Copilot as an agent backend. ## Background Issue #48 requests support for the GitHub Copilot CLI. This tool is accessed via the GitHub CLI extension `gh copilot`. The adapter must handle the invocation of this command and parse its response. ## Reference Documentation **Required:** - Design: `src/ralph_orchestrator/adapters/base.py` (ToolAdapter interface) - Existing Implementation: `src/ralph_orchestrator/adapters/kiro.py` **Additional References:** - GitHub Copilot CLI documentation **Note:** You MUST read the base adapter interface before beginning. ## Technical Requirements 1. Create `src/ralph_orchestrator/adapters/copilot.py`. 2. Define `CopilotAdapter` class inheriting from `ToolAdapter`. 3. Implement `__init__` defaulting to `gh` command with `copilot` subcommand args. 4. Implement `aexecute` to run `gh copilot suggest` or `gh copilot explain` based on context, or a generic query. * *Constraint*: `gh copilot` is often interactive. The adapter must use flags (like `-t shell` or generic query flags) to try and get non-interactive output, or document limitations. 5. Handle output parsing. 6. Implement unit tests in `tests/test_copilot_adapter.py`. ## Dependencies - `src/ralph_orchestrator/adapters/base.py` - `gh` CLI tool installed with `copilot` extension. ## Implementation Approach 1. Create the adapter file. 2. Implement the command construction. Likely `gh copilot suggest "<prompt>"` or `gh copilot explain "<prompt>"`. 3. Since Ralph sends generic prompts, we might default to `explain` or `suggest -t shell` depending on heuristic, or expose a configuration option. For now, treat the prompt as a query passed to the CLI. 4. Wrap the subprocess call. 5. Add unit tests mocking the `gh` command. ## Acceptance Criteria 1. **Initialization** - Given `CopilotAdapter` - When initialized - Then defaults to `gh` command 2. **Execution** - Given a prompt - When executed - Then `gh copilot` is invoked with the prompt - And output is returned in the `ToolResponse` 3. **Safety** - Given `gh` is missing - When executed - Then returns failure without crashing 4. **Tests** - Given unit tests - When run - Then they pass ## Metadata - **Complexity**: Medium - **Labels**: Adapter, GitHub, Copilot, Integration - **Required Skills**: Python, CLI integration
kerem closed this issue 2026-02-27 10:21:47 +03:00
Author
Owner

@honestemployee2024 commented on GitHub (Jan 13, 2026):

@mikeyobrien thank you for your work on this. Excited about this and the other adapters you're adding support for.

<!-- gh-comment-id:3746586233 --> @honestemployee2024 commented on GitHub (Jan 13, 2026): @mikeyobrien thank you for your work on this. Excited about this and the other adapters you're adding support for.
Author
Owner

@aappddeevv commented on GitHub (Jan 17, 2026):

The standalone and preferred copilot cli is out so the way to call it is copilot and not gh copilot.

<!-- gh-comment-id:3764278367 --> @aappddeevv commented on GitHub (Jan 17, 2026): The standalone and preferred copilot cli is out so the way to call it is `copilot` and not `gh copilot`.
Author
Owner

@mikeyobrien commented on GitHub (Jan 17, 2026):

https://github.com/mikeyobrien/ralph-orchestrator/pull/64

<!-- gh-comment-id:3764413860 --> @mikeyobrien commented on GitHub (Jan 17, 2026): https://github.com/mikeyobrien/ralph-orchestrator/pull/64
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ralph-orchestrator#17
No description provided.