Skip to content

feat: list repositories from the user API - #419

Merged
tomaboro merged 3 commits into
mainfrom
agent/repo-list-token-repositories-bc97
Oct 15, 2026
Merged

tomaboro merged 3 commits into
mainfrom
agent/repo-list-token-repositories-bc97

Conversation

@tomaboro

@tomaboro tomaboro commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

prismic repo list called https://user-service.${host}/repositories. A Write API token has no user on that service, so the list failed when PRISMIC_TOKEN was set. The command now always calls GET /user/repositories on the Obelix user API, using the same https://api.internal.${host}/ base as getProfile. 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

  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

How to QA

  1. Sign in and run prismic repo list and prismic repo list --json. The request should be GET https://api.internal.<host>/user/repositories, with the same columns and JSON fields.
  2. Set PRISMIC_TOKEN to a Write API token and run prismic repo list --json. The output should be that one repository, from the same URL.
Open in Web Open in Cursor 

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.

cursoragent and others added 2 commits October 14, 2026 09:07
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>
@cursor cursor Bot changed the title feat: list the repository for a Write API token feat: list repositories from the user API Oct 14, 2026
@tomaboro
tomaboro marked this pull request as ready for review October 14, 2026 10:11

@angeloashmore angeloashmore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice changes! We can simplify the tests, as noted in the comments below. Once those are addressed, let's merge!

Comment thread test/repo-list.test.ts Outdated
expect(urls).not.toContain(`https://user-service.${host}/repositories`);
});

it("requests the user API when signed in", async ({ expect, prismic, host, home }) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ #issue: This test and the helpers below can be removed. We only care about the behavior, not the implementation, which the above test covers correctly.

Comment thread test/repo-list.test.ts Outdated
]);
const urls = await fetches.urls();
expect(urls).toContain(`https://api.internal.${host}/user/repositories`);
expect(urls).not.toContain(`https://user-service.${host}/repositories`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ #issue: These 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>
@tomaboro
tomaboro merged commit 036e781 into main Oct 15, 2026
16 checks passed
@tomaboro
tomaboro deleted the agent/repo-list-token-repositories-bc97 branch October 15, 2026 14:33
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.

3 participants