Add repository traffic/insights tools (views, clones, referrers, paths) - #3246
Open
musch711 wants to merge 7 commits into
Open
Add repository traffic/insights tools (views, clones, referrers, paths)#3246musch711 wants to merge 7 commits into
musch711 wants to merge 7 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3164.
Adds four read-only tools under the
repostoolset that wrap GitHub's repository traffic endpoints:get_traffic_viewsGET /repos/{owner}/{repo}/traffic/viewsget_traffic_clonesGET /repos/{owner}/{repo}/traffic/clonesget_traffic_referrersGET /repos/{owner}/{repo}/traffic/popular/referrersget_traffic_pathsGET /repos/{owner}/{repo}/traffic/popular/pathsWhy
Agents can already read stars and forks but have no view into whether a repo is actually being visited or cloned, which is the primary signal for adoption and reach. Because GitHub only retains traffic data for a rolling 14-day window, an agent that snapshots it on a schedule is the natural use case for longer-term trend tracking.
Implementation notes
ReadOnlyHint: trueunder the existingrepostoolset.go-githubv89 client already exposesListTrafficViews,ListTrafficClones,ListTrafficReferrers, andListTrafficPaths, so there is no new HTTP plumbing.views/clonestake an optionalper(day|week) mapping toTrafficBreakdownOptions;referrers/pathstake justowner/repo.Administration: Read), so the tools usescopes.RequireAll(scopes.Repo)rather than public-read.LabelRepoTraffic()(always private, mirroringLabelCollaboratorRoster).