Skip to content

Add Repository Count to "devopsmigration discovery inventory" Command #6

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 21, 2025

Changes Made

This PR enhances the devopsmigration discovery inventory command to include repository counts in the output. Previously, the command only provided work item counts, but now it also includes repository information.

Implementation Details:

  1. Added a new method to the ICatalogService interface:

    IAsyncEnumerable<ProjectDiscoverySummary> CountRepositoriesAsync(string orgUrl, string project, string pat, CancellationToken cancellationToken = default);
  2. Implemented the method in CatalogService class using the GitHttpClient to retrieve repositories:

    public async IAsyncEnumerable<ProjectDiscoverySummary> CountRepositoriesAsync(
        string orgUrl,
        string project,
        string pat,
        [EnumeratorCancellation] CancellationToken cancellationToken = default)
    {
        var credentials = new VssBasicCredential(string.Empty, pat);
        var connection = new VssConnection(new Uri(orgUrl), credentials);
        var gitClient = connection.GetClient<GitHttpClient>();
    
        ProjectDiscoverySummary repoStats = new ProjectDiscoverySummary();
        
        // Get all repositories for the project
        var repositories = await gitClient.GetRepositoriesAsync(project, cancellationToken: cancellationToken);
        
        // Set the repository count
        repoStats.ReposCount = repositories.Count;
        repoStats.IsRepoComplete = true;
        repoStats.LastUpdatedUtc = DateTime.UtcNow;
        
        yield return repoStats;
    }
  3. Updated InventoryCommand.cs to call the new method and incorporate repository counts in the output table.

Output Format:

The command now displays the repository count in both the console table output and the CSV export. The table already had a "Repos" column defined, which is now populated with the actual repository count data.

Fixes #5.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add "Repos" count to devopsmigration discovery invantory command Add Repository Count to "devopsmigration discovery inventory" Command May 21, 2025
@Copilot Copilot AI requested a review from MrHinsh May 21, 2025 12:55
Copilot finished work on behalf of MrHinsh May 21, 2025 12:55
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.

Add "Repos" count to devopsmigration discovery invantory command
2 participants