Merged
Conversation
Add CRUD commands for managing preview configurations: add, list, remove, and set-simulator. Includes a preview API client and tests. Resolves #18 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The vitest config enables concurrent test execution within files. Since both simulator URL tests write to the same singleton resource on the shared repo, they must run sequentially. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The client maps to the core API service, not specifically to previews. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| if (!parsed.pathname.endsWith("/slice-simulator")) { | ||
| parsed.pathname = | ||
| parsed.pathname.replace(/\/+$/, "") + "/slice-simulator"; | ||
| } |
There was a problem hiding this comment.
Trailing slash causes duplicate /slice-simulator path segment
Medium Severity
When a user provides a URL ending with /slice-simulator/ (trailing slash), endsWith("/slice-simulator") returns false, so the code strips the trailing slash and appends /slice-simulator again, producing a path like /slice-simulator/slice-simulator. The replace(/\/+$/, "") correctly removes the trailing slash but then incorrectly re-appends the suffix that was already present. This results in a broken simulator URL being saved to the repository configuration.
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: #18
Description
Add CRUD commands for managing preview configurations (
preview add,preview list,preview remove,preview set-simulator).Checklist
Preview
How to QA 1
Note
Medium Risk
Adds new CLI commands that perform authenticated write operations against repository endpoints (create/delete preview configs and update simulator URL), so mistakes could modify repo settings. Changes are otherwise isolated and covered by new integration tests.
Overview
Adds a new
prismic previewcommand group with subcommands to add, list (optionally--json), and remove preview configurations, plusset-simulatorto update the repository’s slice simulator URL (auto-appending/slice-simulator).Introduces a new
clients/coreAPI wrapper for preview and repository simulator URL endpoints (with Zod validation where responses are parsed), wires the new top-level command intosrc/index.ts, and adds end-to-end tests plus test helpers for preview/simulator operations (including a small help-output test forwebhook).Written by Cursor Bugbot for commit c4619cd. This will update automatically on new commits. 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. ↩