Repository navigation
feat: list repositories from the user API - #419
Merged
Merged
Conversation
prismic repo list reads GET /user/repositories when PRISMIC_TOKEN is set. A saved login still requests the legacy user service. Co-authored-by: tomasz.borowicz <tomasz.borowicz@prismic.io>
A saved login uses GET /user/repositories, the same call as a Write API token. Co-authored-by: tomasz.borowicz <tomasz.borowicz@prismic.io>
tomaboro
marked this pull request as ready for review
October 14, 2026 10:11
angeloashmore
approved these changes
Oct 14, 2026
angeloashmore
left a comment
Member
There was a problem hiding this comment.
Nice changes! We can simplify the tests, as noted in the comments below. Once those are addressed, let's merge!
| expect(urls).not.toContain(`https://user-service.${host}/repositories`); | ||
| }); | ||
|
|
||
| it("requests the user API when signed in", async ({ expect, prismic, host, home }) => { |
Member
There was a problem hiding this comment.
| ]); | ||
| const urls = await fetches.urls(); | ||
| expect(urls).toContain(`https://api.internal.${host}/user/repositories`); | ||
| expect(urls).not.toContain(`https://user-service.${host}/repositories`); |
Member
There was a problem hiding this comment.
expects can be removed. We only care about the behavior, not the implementation, which the above test covers correctly.
Drop the fetch recorder and the checks that name the request URL. Co-authored-by: tomasz.borowicz <tomasz.borowicz@prismic.io>
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.
Description
prismic repo listcalledhttps://user-service.${host}/repositories. A Write API token has no user on that service, so the list failed whenPRISMIC_TOKENwas set. The command now always callsGET /user/repositorieson the Obelix user API, using the samehttps://api.internal.${host}/base asgetProfile. A saved login and a Write API token use that one call. A Write API token returns the one repository it can write to. The table and JSON output are unchanged (domain,name,role,url).Checklist
How to QA
prismic repo listandprismic repo list --json. The request should beGET https://api.internal.<host>/user/repositories, with the same columns and JSON fields.PRISMIC_TOKENto a Write API token and runprismic repo list --json. The output should be that one repository, from the same URL.Note
Medium Risk
Switches repository listing to a new internal API and auth style; behavior for saved login and Write API tokens should be verified, though CLI output shape is unchanged.
Reviewed by Cursor Bugbot for commit d3deea0. Bugbot is set up for automated code reviews on this repo. Configure here.