Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 29, 2025

This PR adds comprehensive GitHub Copilot integration to TreeAgent, enabling AI-assisted development with GitHub issue tracking capabilities.

New GitHub Copilot Accessor

Added GITHUB_COPILOT as a new model accessor type that interfaces with GitHub Copilot via the gh copilot agent-task create CLI command. The accessor creates agentic tasks that handle code generation and issue creation, returning the issue ID in the response.

from src.orchestrator import AgentOrchestrator
from src.dataModel.model import AccessorType

# Use GitHub Copilot for AI assistance - creates agentic tasks
orchestrator = AgentOrchestrator(default_accessor_type=AccessorType.GITHUB_COPILOT)
project = orchestrator.implement_project("Create a REST API server")
# The response will contain the GitHub issue ID that was created

The accessor:

  • Uses gh copilot agent-task create to create GitHub agentic tasks
  • Returns the issue ID created by the agentic task
  • Includes automatic issue ID extraction from command output

GitHub Issue Tracking Tools (API-based)

Implemented a complete suite of GitHub issue management tools using the GitHub REST API:

  • get_github_issue - Retrieve issue details
  • create_github_issue - Create new issues with labels
  • update_github_issue - Update existing issues
  • comment_github_issue - Add comments to issues
  • list_github_issues - List issues with filtering
  • close_github_issue - Close issues

All tools use the GitHub REST API via the requests library for direct, authenticated operations. No CLI dependency required for tools.

from src.tools.github_tools import get_issue, create_issue, comment_on_issue

# Create an issue using GitHub API
issue = create_issue("owner/repo", "New Feature", "Description")

# Get issue details
details = get_issue("owner/repo", 123)

# Add a comment
comment_on_issue("owner/repo", 123, "Work in progress")

Key Benefits

  • Unified Workflow: Combine AI-powered code generation with GitHub issue tracking
  • Enhanced Collaboration: Tasks are tracked as GitHub issues for team visibility
  • Flexible Integration: Accessor uses gh CLI, tools use REST API
  • Robust Error Handling: Clear error messages for missing dependencies or tokens

Prerequisites

  • For Accessor: GitHub CLI (gh) installed and authenticated, GitHub Copilot CLI extension installed (gh extension install github/gh-copilot)
  • For Tools: GITHUB_TOKEN or GH_TOKEN environment variable set (create at https://github.com/settings/tokens)

The implementation includes comprehensive tests to ensure reliability and ease of use.

Original prompt

can you add a new accessor, githubCopilotAccessor under the model accessor?

I want to use the following type of command to trigger this

gh copilot agent-task create "Create a basic Flask app with one GET /hello endpoint returning JSON {'message': 'Hello'}" --follow

then in the tools add github as a tool that can track issues (get, update, comment, etc).

and allow for follow-ups on specific task(issue) ids


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title can you add a new accessor, githubCopilotAccessor under the model accessor? I want to use the following type of command to trigger this ``` gh copilot agent-task create "Create a basic Flask app with one GET /hello endpoint returning JSON {'message':... Add GitHub Copilot accessor and GitHub issue tracking integration Sep 29, 2025
Copilot AI requested a review from JPrier September 29, 2025 03:44
Copy link
Owner

@JPrier JPrier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot
This misses the mark I wanted something that only acted as an accessor but instead you created an entirely new CLI tool but I wanted was the accessor to use the existing CLI tools because there's currently no API to create github agentic tasks which would then handle the creation of issues and code and the response of the accessor would be the issue id that was created.

Then I wanted you to create a tool similar to what you did that would then utilize the GitHub API not the CLI. This with an abstract the use of that API, like getting the issue information, adding comments, Etc.

Please remove the custom c l i tool that you added and do the previously mentioned changes

@@ -0,0 +1,134 @@
# GitHub Copilot Integration
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I like adding random markdown files to the Root of the repo. Delete this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Deleted the GITHUB_COPILOT_INTEGRATION.md file in commit 6bac6af.

- Remove custom CLI tool (gh-copilot-agent-task)
- Update accessor to use gh copilot agent-task create for agentic tasks
- Accessor now returns issue ID as response
- Rewrite GitHub tools to use GitHub API instead of CLI
- Update tests to match new implementation
- Remove GITHUB_COPILOT_INTEGRATION.md documentation file

Co-authored-by: JPrier <[email protected]>
Copy link
Contributor Author

Copilot AI commented Sep 30, 2025

@copilot
This misses the mark I wanted something that only acted as an accessor but instead you created an entirely new CLI tool but I wanted was the accessor to use the existing CLI tools because th...

I've made the requested changes in commit 6bac6af:

  1. Removed the custom CLI tool - Deleted src/cli/copilot_cli.py and its test file
  2. Updated the accessor - Now uses gh copilot agent-task create to create GitHub agentic tasks. The response contains the issue ID that was created.
  3. Rewrote GitHub tools to use GitHub API - All tools now use the GitHub REST API via the requests library instead of CLI. Requires GITHUB_TOKEN environment variable.

The accessor now properly calls gh copilot agent-task create "<description>" --follow and extracts the issue ID from the output to return in the response.

Copilot AI changed the title Add GitHub Copilot accessor and GitHub issue tracking integration Add GitHub Copilot accessor and GitHub API-based issue tracking integration Sep 30, 2025
Copilot AI requested a review from JPrier September 30, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants