Skip to content

Replace gh CLI with /api/v1/repositories for dispatch wizard#1023

Merged
Soph merged 2 commits intomainfrom
soph/use-repo-endpoint
Apr 24, 2026
Merged

Replace gh CLI with /api/v1/repositories for dispatch wizard#1023
Soph merged 2 commits intomainfrom
soph/use-repo-endpoint

Conversation

@Soph
Copy link
Copy Markdown
Collaborator

@Soph Soph commented Apr 24, 2026

https://entire.io/gh/entireio/cli/trails/23a58f348df1

https://github.com/entirehq/entire.io/pull/1642 <- API on the other side.

Swaps the cloud-dispatch repo picker from shelling out to gh api user/repos to calling the Entire API's new /api/v1/repositories endpoint via the existing authenticated api.Client. Removes the hard dependency on a locally-installed, logged-in gh.

Repos with zero checkpoints are filtered out of the picker since dispatching them would produce nothing. Server order (recent-first) is preserved; buildDispatchRepoOptions no longer alphabetizes so the API's ordering surfaces in the picker — / filtering handles search.


Note

Medium Risk
Changes the cloud dispatch repo discovery path to depend on a new authenticated /api/v1/repositories call and different ordering/filtering behavior, which could impact who sees which repos and in what order. Risk is moderate because it alters a user-facing workflow but doesn’t touch auth/token handling beyond reusing the existing client.

Overview
The dispatch wizard’s cloud repo picker now fetches repositories via the CLI’s authenticated Entire API client (GET /api/v1/repositories, with sort=recent) instead of shelling out to gh api, removing the hard dependency on a locally installed/logged-in GitHub CLI.

Repo options no longer get alphabetized in buildDispatchRepoOptions, so the server-provided recent-first ordering is preserved, and repos with checkpoint_count <= 0 (or blank full_name) are filtered out of the picker. Tests were updated/added to validate ordering, deduping, and checkpoint filtering.

Reviewed by Cursor Bugbot for commit c683c71. Configure here.

Swaps the cloud-dispatch repo picker from shelling out to `gh api
user/repos` to calling the Entire API's new /api/v1/repositories
endpoint via the existing authenticated api.Client. Removes the hard
dependency on a locally-installed, logged-in gh.

Repos with zero checkpoints are filtered out of the picker since
dispatching them would produce nothing. Server order (recent-first)
is preserved; buildDispatchRepoOptions no longer alphabetizes so the
API's ordering surfaces in the picker — `/` filtering handles search.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1d85b50ab77b
@Soph Soph requested a review from a team as a code owner April 24, 2026 13:29
Copilot AI review requested due to automatic review settings April 24, 2026 13:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the dispatch wizard’s cloud repo picker to use the Entire API (GET /api/v1/repositories) via the existing authenticated api.Client, removing the need to shell out to the local gh CLI and preserving server-side “recent-first” ordering for cloud repos.

Changes:

  • Add api.Client.ListRepositories to call /api/v1/repositories with optional sort.
  • Switch dispatch wizard authenticated repo discovery from gh api user/repos to the Entire API and filter out repos with zero checkpoints.
  • Adjust repo option building/tests to preserve caller order (rather than alphabetizing).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cmd/entire/cli/dispatch_wizard.go Uses authenticated Entire API repo listing (recent-first) and preserves caller ordering for picker options.
cmd/entire/cli/dispatch_wizard_test.go Updates ordering expectations and adds a test for filtering zero-checkpoint/blank repos while preserving order.
cmd/entire/cli/api/repositories.go Introduces /api/v1/repositories client types and a ListRepositories helper method.

Comment thread cmd/entire/cli/dispatch_wizard.go Outdated
Comment thread cmd/entire/cli/api/repositories.go
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c683c71. Configure here.

Comment thread cmd/entire/cli/dispatch_wizard.go Outdated
Fix misleading doc-comment on buildDispatchRepoOptions that claimed the
local-discovery fallback sorts before calling — it doesn't. Rewrite the
comment to describe what actually happens: each source picks its own
order (API is recent-first, local is current-repo-first).

Add httptest-based unit tests for api.Client.ListRepositories covering
the sort query param, empty-sort case, JSON decoding, and error-path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: db22f43fb922
@Soph Soph merged commit 65b10ca into main Apr 24, 2026
9 checks passed
@Soph Soph deleted the soph/use-repo-endpoint branch April 24, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants