Skip to content

feat: add webhook commands#35

Open
angeloashmore wants to merge 1 commit intomainfrom
feat/webhook-commands
Open

feat: add webhook commands#35
angeloashmore wants to merge 1 commit intomainfrom
feat/webhook-commands

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 10, 2026

Resolves:

Description

Add webhook management commands to the CLI. This introduces the prismic webhook command with subcommands for creating, listing, viewing, removing, testing, enabling, disabling webhooks, as well as managing custom HTTP headers and triggers.

Depends on #34 (removal of the dead webhook files from main).

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

Build and run ./dist/index.mjs webhook to see the help output. Individual subcommands can be tested against a Prismic repository with --repo.


Note

Medium Risk
Adds new networked CLI functionality that mutates webhook configuration in Prismic repos; mistakes in request payload mapping (e.g., trigger fields) could lead to incorrect webhook settings or unexpected event delivery.

Overview
Adds a new top-level prismic webhook command with subcommands to list, create, view, remove, test, enable/disable, check status, and manage webhook headers and trigger events.

Introduces a wroom client (src/clients/wroom.ts) that calls Prismic repository settings endpoints (with prismic-auth cookie) to fetch, create, update, trigger, and delete webhooks, using valibot schemas for response validation and FormData for writes.

Written by Cursor Bugbot for commit 21b0a37. 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.

Add commands to manage webhooks in a Prismic repository:
create, list, view, remove, test, enable, disable, status,
add-header, remove-header, and set-triggers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@angeloashmore angeloashmore force-pushed the feat/webhook-commands branch from c0da499 to 21b0a37 Compare March 10, 2026 19:17
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 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

body.set("releasesCreated", webhookConfig.documentsUnpublished.toString());
body.set("releasesUpdated", webhookConfig.documentsUnpublished.toString());
body.set("tagsCreated", webhookConfig.documentsUnpublished.toString());
body.set("documentsPublished", webhookConfig.documentsUnpublished.toString());
Copy link

Choose a reason for hiding this comment

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

All trigger fields use wrong property value

High Severity

In both createWebhook and updateWebhook, every trigger field reads its value from webhookConfig.documentsUnpublished instead of the corresponding property. For example, documentsPublished uses webhookConfig.documentsUnpublished, releasesCreated uses webhookConfig.documentsUnpublished, etc. This means all triggers are always set to whatever the documentsUnpublished value is, completely ignoring the caller's intended per-trigger settings.

Additional Locations (1)
Fix in Cursor Fix in Web

body.set("releasesCreated", webhookConfig.documentsUnpublished.toString());
body.set("releasesUpdated", webhookConfig.documentsUnpublished.toString());
body.set("tagsCreated", webhookConfig.documentsUnpublished.toString());
body.set("documentsPublished", webhookConfig.documentsUnpublished.toString());
Copy link

Choose a reason for hiding this comment

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

Duplicate key overwrites documentsPublished, tagsDeleted never set

High Severity

In both createWebhook and updateWebhook, the last body.set call uses the key "documentsPublished" instead of "tagsDeleted". This means tagsDeleted is never sent to the API, and the documentsPublished value is set twice (with the second call overwriting the first). The tagsDeleted trigger can never be configured through either function.

Additional Locations (1)
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.

1 participant