Skip to content

feat: add preview commands#55

Merged
angeloashmore merged 4 commits intomainfrom
aa/preview-commands
Mar 20, 2026
Merged

feat: add preview commands#55
angeloashmore merged 4 commits intomainfrom
aa/preview-commands

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 19, 2026

Resolves: #18

Description

Add CRUD commands for managing preview configurations (preview add, preview list, preview remove, preview set-simulator).

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • 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.

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 preview command group with subcommands to add, list (optionally --json), and remove preview configurations, plus set-simulator to update the repository’s slice simulator URL (auto-appending /slice-simulator).

Introduces a new clients/core API wrapper for preview and repository simulator URL endpoints (with Zod validation where responses are parsed), wires the new top-level command into src/index.ts, and adds end-to-end tests plus test helpers for preview/simulator operations (including a small help-output test for webhook).

Written by Cursor Bugbot for commit c4619cd. This will update automatically on new commits. Configure here.

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 3 commits March 19, 2026 13:51
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>
@angeloashmore angeloashmore marked this pull request as ready for review March 20, 2026 00:07
The client maps to the core API service, not specifically to previews.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@angeloashmore angeloashmore merged commit b56262f into main Mar 20, 2026
12 checks passed
@angeloashmore angeloashmore deleted the aa/preview-commands branch March 20, 2026 00:11
Copy link

@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.

if (!parsed.pathname.endsWith("/slice-simulator")) {
parsed.pathname =
parsed.pathname.replace(/\/+$/, "") + "/slice-simulator";
}
Copy link

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

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.

Re-enable preview commands

1 participant