Repository navigation
refactor: merge Prismic clients into one file - #445
Open
angeloashmore wants to merge 8 commits into
Open
angeloashmore wants to merge 8 commits into
angeloashmore wants to merge 8 commits into
Conversation
Move all Prismic service requests from src/lib/prismic/clients/ into src/lib/prismic/client.ts, grouped by service. The services now share one config type and two auth helpers: one sends the token as a Bearer header and one sends it as the prismic-auth cookie. Core and Wroom use the same repository domain, so they now share one request helper. The behavior does not change. AGENTS.md now describes the new file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
Each service request helper now takes a path. The helper builds the URL from the service base, so the separate base URL helpers are not needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
3 tasks done
Each client function now builds its own request: the URL, the token, and the error messages. A reader can see the full request in one function, and a new endpoint starts from a copy of a similar one. Small helpers still give the base URL of each service. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
Client functions now return the response that the API sends. The callers take the values that they need from the response. A client function then only describes one request. The screenshot upload gets its upload form from its own client function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
In one client file, a name like bulkUpdate or removeLocale does not say what it acts on. The names now include the object and stay close to the API endpoint, for example bulkUpdateModels and getUserProfile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
angeloashmore
marked this pull request as ready for review
October 29, 2026 22:13
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.
Resolves:
Description
Before this PR, each Prismic service had its own client file. The files hid parts of each request in shared helpers. For example, to know which token, headers, and error messages a request used, a reader had to follow two or three helpers.
After this PR, all requests to Prismic are in one client file, grouped by service. Each client function shows its full request and returns the API response as it is. A new endpoint starts from a copy of a similar function. The next PR adds a login retry to each of these functions (#443).
The behavior of the CLI does not change.
Checklist
Preview
How to QA 1
Run the commands that use the Prismic API, for example
prismic repo view,prismic pull, andprismic webhook list. They work as before.🤖 Generated with Claude Code
https://claude.ai/code/session_01L1dGD6G4hXCqeewEhox2Du
Note
Medium Risk
Wide mechanical refactor across all Prismic API usage; regressions would affect auth, repo settings, push/pull, and dev sync if any response handling was missed.
Overview
Consolidates every Prismic HTTP client that lived under
src/lib/prismic/clients/into a singlesrc/lib/prismic/client.ts, grouped by backend service. Shared request wrappers are removed so each export builds its own URL, headers/credentials, and Zod schema inline. AGENTS.md now points atclient.tsinstead of aclients/folder.Call sites across commands, adapters, auth, models, and tracking import from the new module. Several exports are renamed for clarity (
getProfile→getUserProfile,getRepositories→getUserRepositories,removePreview/removeLocale→deletePreview/deleteLocale, screenshot and API-access helpers similarly). List and metadata helpers now return parsed API envelopes (e.g.{ results }for previews/locales,{ simulator_url },{ id }fromcreateRelease,{ total }for document counts) instead of unwrapping inside the client—commands destructure those fields locally. Model sync usesbulkUpdateModels/BulkModelChangeinstead of the old custom-types names.Intended CLI behavior is unchanged; the shape change sets up a follow-up to add login retry per request.
Reviewed by Cursor Bugbot for commit 09efad4. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩