Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 3, 2025

  • Add Branch interface to shared types
  • Create BranchesSection frontend component
  • Add branch fetching method to GitHubService
  • Update CommitCultureService to fetch and include branches in analysis
  • Update AnalysisReport interface to include branches array
  • Add mock branch data for development
  • Integrate BranchesSection into MuiApp.tsx
  • Update component exports
  • Build and lint successfully
  • Test the implementation manually
  • Fix mock data for commits_all_branches field
  • Refactor fetchBranches to use only GraphQL
  • Fix code formatting issues

Summary

Successfully added a Branches section to the commit-culture app that provides a comprehensive view of repository branches, similar to GitHub's branches page.

Latest Update - Code Formatting

Fixed code formatting issues in src/services/github.ts to comply with Prettier rules:

  • Wrapped long lines to respect 80 character width limit
  • Reformatted function call arguments for better readability
  • All formatting checks now pass

Key Changes

GraphQL-Only Implementation - All operations use GraphQL exclusively:

  • Get default branch name using GraphQL query on repository.defaultBranchRef
  • List all branches using GraphQL refs query with pagination
  • Get branch details (last commit SHA and date) from GraphQL ref target
  • Calculate ahead/behind using GraphQL compare field

Features Implemented

Branch Information Display:

  • Branch name (clickable link to GitHub)
  • Contributors with avatars (using AvatarGroup component)
  • Last commit date and SHA
  • Ahead/behind counts compared to default branch
  • Sortable columns for easy navigation

Backend Integration (GraphQL Only):

  • Added Branch interface to shared types
  • Implemented fetchBranches() method in GitHubService using only GraphQL
  • Updated CommitCultureService to fetch and include branches in analysis report
  • Fetches branch contributors based on commit history within date range
  • Calculates ahead/behind metrics by comparing branches to default branch

Frontend Components:

  • Created BranchesSection.tsx with sorting capabilities
  • Integrated into main app after commits section
  • Added comprehensive mock data for development/testing
  • Consistent Material-UI styling matching existing sections

Screenshot

Branches Section

Testing

  • ✅ Backend builds successfully with TypeScript strict mode
  • ✅ Frontend builds successfully with Vite
  • ✅ ESLint passes with no errors
  • ✅ Prettier formatting checks pass
  • ✅ All type checks pass
  • ✅ Manual testing confirmed proper rendering and sorting functionality
  • ✅ Mock data validates the full data flow
  • ✅ All GitHub API calls use GraphQL exclusively
Original prompt

This section details on the original issue you should resolve

<issue_title>Add branches section to app</issue_title>
<issue_description>It would be great to quickly see what branches are being worked on. This can look very similar to the Branches page on GitHub, except that we can also show a list of contributors to that branch and possibly compute the size of the diff from that branch to the default (although this could potentially get expensive).

Image</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #19

💡 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 AI and others added 2 commits October 3, 2025 14:04
Co-authored-by: ChrisTimperley <523560+ChrisTimperley@users.noreply.github.com>
Co-authored-by: ChrisTimperley <523560+ChrisTimperley@users.noreply.github.com>
Copilot AI changed the title [WIP] Add branches section to app Add branches section to app Oct 3, 2025
Copilot AI requested a review from ChrisTimperley October 3, 2025 14:10
@ChrisTimperley
Copy link
Owner

@copilot there shouldn't be any need to use the REST API here. Can you update this to only use GraphQL?

Co-authored-by: ChrisTimperley <523560+ChrisTimperley@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 3, 2025

@copilot there shouldn't be any need to use the REST API here. Can you update this to only use GraphQL?

Updated in bd934e3. The fetchBranches() method now uses only GraphQL:

  • Repository info and default branch: repository.defaultBranchRef
  • List branches: refs query with pagination
  • Branch details: ref.target for commit info
  • Ahead/behind comparison: ref.compare field

All REST API calls (repos.get, repos.listBranches, repos.getBranch, repos.compareCommits) have been removed.

Screenshot

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/local/bin/node --require /home/REDACTED/work/commit-culture/commit-culture/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/commit-culture/commit-culture/node_modules/tsx/dist/loader.mjs src/server.ts (http block)
  • https://api.github.com/repos/cmu-sei/example-project/pulls
    • Triggering command: /usr/local/bin/node --require /home/REDACTED/work/commit-culture/commit-culture/node_modules/tsx/dist/preflight.cjs --import file:///home/REDACTED/work/commit-culture/commit-culture/node_modules/tsx/dist/loader.mjs src/server.ts (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Owner

@ChrisTimperley ChrisTimperley left a comment

Choose a reason for hiding this comment

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

This is awesome! 🙌🏻

@ChrisTimperley ChrisTimperley marked this pull request as ready for review October 3, 2025 14:47
@ChrisTimperley
Copy link
Owner

@copilot can you fix the formatting issues?

Co-authored-by: ChrisTimperley <523560+ChrisTimperley@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 3, 2025

@copilot can you fix the formatting issues?

Fixed in bd0b5e7. Reformatted src/services/github.ts to comply with Prettier rules (80 character line width). All formatting checks now pass.

Copilot AI requested a review from ChrisTimperley October 3, 2025 15:14
@ChrisTimperley ChrisTimperley merged commit cffc0e4 into main Oct 3, 2025
2 checks passed
@ChrisTimperley ChrisTimperley deleted the copilot/fix-7b64a8d1-9431-4c61-9289-c8889302767e branch October 3, 2025 15:29
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 branches section to app

2 participants