Skip to content

Add web URL display to graph command for GitHub issues search#4

Merged
maxbeizer merged 3 commits intomainfrom
copilot/fix-3
Jul 15, 2025
Merged

Add web URL display to graph command for GitHub issues search#4
maxbeizer merged 3 commits intomainfrom
copilot/fix-3

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 15, 2025

Currently the graph command shows contribution statistics but doesn't provide an easy way to view the same results in the GitHub web interface. This PR adds a web URL link that points to the GitHub issues search page with the same query parameters.

Changes

  • Added buildWebURL() function that generates properly encoded GitHub search URLs
  • Modified handleGraphCommand() to display the web URL after the summary statistics
  • Uses GitHub's web search syntax with proper URL encoding
  • Added comprehensive tests for the new functionality

Example Output

After running gh contrib graph username, the output now includes:

Total Contributions: 5 over 30 days (avg: 0.17 per day)
PRs: 2 total (1 closed, 1 open)
Issues: 3 total (2 closed, 1 open)

View issues in GitHub: https://github.com/issues?q=is%3Aissue+org%3Agithub+author%3Ausername+sort%3Aupdated-desc+created%3A%3E2025-06-15

The URL respects all the same filters as the API query:

  • Organization scope (org:github)
  • Author filter (author:username)
  • Date filtering when --since flag is used (created:>YYYY-MM-DD)
  • Issue type filtering (is:issue)

Testing

  • All existing tests continue to pass (17/17)
  • Added TestHandleGraphCommand_WebURL to verify URL generation in integration
  • Added TestBuildWebURL to test the URL building function in isolation
  • Manually verified URL encoding and GitHub search compatibility

Fixes #3.


💡 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.

Co-authored-by: maxbeizer <2006658+maxbeizer@users.noreply.github.com>
Copilot AI changed the title [WIP] Display a link to the web version of the search Add web URL display to graph command for GitHub issues search Jul 15, 2025
Copilot AI requested a review from maxbeizer July 15, 2025 15:42
Comment thread main.go Outdated
len(issueItems), closedIssues, openIssues)

// Display web URL for the issues search
issuesWebURL := buildWebURL("is:issue", login)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot let's not limit this to just issues. Please remove is:issue from the search string

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed is:issue filter from the search string. The web URL now includes both issues and pull requests. Updated display text to "View in GitHub:" and added tests to verify the new behavior. (commit b18cddc)

Co-authored-by: maxbeizer <2006658+maxbeizer@users.noreply.github.com>
Copilot AI requested a review from maxbeizer July 15, 2025 16:24
@maxbeizer maxbeizer marked this pull request as ready for review July 15, 2025 16:25
@maxbeizer maxbeizer merged commit e83b45d into main Jul 15, 2025
@maxbeizer maxbeizer deleted the copilot/fix-3 branch July 15, 2025 16:25
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.

Display a link to the web version of the search

2 participants