Skip to content

feat(github-picker): include org and collaborator repos in the repo list - #73

Open
duncsdownunder wants to merge 1 commit into
CameronCrow:mainfrom
duncsdownunder:feat/github-picker-org-repos
Open

duncsdownunder wants to merge 1 commit into
CameronCrow:mainfrom
duncsdownunder:feat/github-picker-org-repos

Conversation

@duncsdownunder

Copy link
Copy Markdown

Problem

The New Agent modal's "Pick from GitHub" mode (issue #48) lists repos via gh repo list, which only returns repos the authenticated user owns. Anyone whose work lives in an organization sees only their personal repos — org repos can't be picked at all (hit this today trying to point an agent at a private org repo).

Fix

List via the REST /user/repos endpoint instead:

gh api --paginate --slurp "user/repos?affiliation=owner,collaborator,organization_member&sort=updated&per_page=100"
  • Returns personal + organization + collaborator repos, most recently updated first, capped at the existing REPO_LIST_LIMIT after flattening pages.
  • Response items are validated with a new zod schema for the REST field names and mapped to the existing GitHubRepoListItem shape, so the tRPC contract and UI are untouched.
  • --slurp needs a reasonably recent gh; on failure we fall back to the previous owner-only gh repo list behavior rather than losing the picker, and total failure still degrades to { repos: [], authenticated: false } as before.

Verified against a real account with org membership: org repos now appear (19 repos vs. owner-only before). tsc --noEmit clean on server-core.

🤖 Generated with Claude Code

gh repo list only returns repos the authenticated user owns, so the New
Agent modal's "Pick from GitHub" mode hid organization repos entirely.
List via the REST /user/repos endpoint instead, with
affiliation=owner,collaborator,organization_member (paginated, sorted by
updated). Falls back to the old owner-only gh repo list when gh api
--slurp is unavailable (gh too old), and keeps the existing
degrade-to-unauthenticated behavior on total failure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant