Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make RepoContext work outside of GitHub repos#307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Copilot wants to merge3 commits intocopilot/vscode1752863607621
base:copilot/vscode1752863607621
Choose a base branch
Loading
fromcopilot/fix-b01e2f27-9e93-47f1-bbab-fe8d39081a5e

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJul 18, 2025
edited by digitarald
Loading

Fixesmicrosoft/vscode#256597

Problem

The currentRepoContext component in the agent prompt was limited to GitHub repositories because it usedgetGitHubRepoInfoFromContext(), which only returns information for GitHub repos. This blocked the component from providing valuable SCM context for CI/CD tools and other use cases in non-GitHub repositories.

When working with Azure DevOps, GitLab, or other Git repositories, the RepoContext component would fail silently and provide no repository context to the AI assistant, limiting its ability to understand the codebase structure and provide relevant suggestions.

Solution

This PR updates theRepoContext component to work with any Git repository, not just GitHub repositories:

Key Changes

  1. Use generic repository detection: ReplacegetGitHubRepoInfoFromContext() withgetOrderedRepoInfosFromContext() which supports GitHub, Azure DevOps, and other repository types

  2. Provide repository context regardless of type: Show basic repository information (current branch, repository name/path) even for repositories that aren't GitHub or Azure DevOps

  3. Handle GitHub-specific features gracefully: Only attempt to fetch GitHub-specific information (like PR descriptions) when the repository is actually hosted on GitHub

  4. Maintain backward compatibility: Keep the same output format and behavior for GitHub repositories

Repository Support Matrix

Repository TypeInformation Displayed
GitHubRepository name, Owner, Current branch, Default branch*, Active PR*
Azure DevOpsRepository name, Organization, Project, Current branch
Other GitRepository name, Repository path, Current branch
LocalRepository name, Repository path, Current branch

* Only available when GitHub PR extension is installed and accessible

Example Output

Before (GitHub only):

// GitHub repoRepository name: vscode-copilot-chatOwner: microsoftCurrent branch: main// Azure DevOps repo(No output - component fails silently)

After (All repository types):

// GitHub repo (unchanged)Repository name: vscode-copilot-chatOwner: microsoftCurrent branch: main// Azure DevOps repo (now works!)Repository name: myprojectOrganization: myorgProject: myteamCurrent branch: develop// GitLab repo (fallback)Repository name: my-gitlab-projectRepository path: /workspace/my-gitlab-projectCurrent branch: main

Benefits

  • Broader compatibility: Works with Azure DevOps, GitLab, and other Git repositories
  • Better CI/CD support: Provides useful repository context for CI/CD tools regardless of hosting platform
  • Consistent behavior: Always shows repository context when available, rather than failing silently
  • Backward compatibility: No breaking changes for existing GitHub repository usage

Testing

Added comprehensive unit tests covering:

  • GitHub repository detection and information extraction
  • Azure DevOps repository support
  • Fallback behavior for unknown repository types
  • Local repository handling
  • Error handling for GitHub-specific features

Fixesmicrosoft/vscode#256753

Created from VS Code via theGitHub Pull Request extension.


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

Co-authored-by: digitarald <8599+digitarald@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] Make RepoContext work outside of GitHub reposMake RepoContext work outside of GitHub reposJul 18, 2025
@CopilotCopilotAI requested a review fromdigitaraldJuly 18, 2025 18:52
Copilot finished work on behalf ofdigitaraldJuly 18, 2025 18:52
@digitaralddigitarald marked this pull request as ready for reviewJuly 18, 2025 22:48
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@digitaralddigitaraldAwaiting requested review from digitarald

@osortegaosortegaAwaiting requested review from osortega

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Copilot@digitarald

[8]ページ先頭

©2009-2025 Movatter.jp