Skip to content

feat: add webhook commands#35

Merged
angeloashmore merged 9 commits intomainfrom
feat/webhook-commands
Mar 19, 2026
Merged

feat: add webhook commands#35
angeloashmore merged 9 commits intomainfrom
feat/webhook-commands

Conversation

@angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Mar 10, 2026

Resolves: #52

Description

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

The following commands are included:

  • prismic webhook list
  • prismic webhook view
  • prismic webhook create
  • prismic webhook remove
  • prismic webhook set-triggers
  • prismic webhook enable
  • prismic webhook disable

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.


Note

Medium Risk
Adds new CLI subcommands that mutate repository webhook configuration via authenticated requests to Prismic settings endpoints, which could impact users’ webhook setups if request formatting/trigger selection is wrong. Changes are mostly additive and covered by new e2e tests, but touch live remote state (create/update/delete).

Overview
Adds a new prismic webhook top-level command with subcommands to list/view/create/remove webhooks, enable/disable them, and update trigger events (with trigger validation and helpful error handling).

Introduces a wroom client (getWebhooks, createWebhook, updateWebhook, deleteWebhook) that talks to Prismic’s webhooks settings endpoints using the existing request helper and zod schemas.

Updates tests to cover the new webhook workflows end-to-end and tweaks help-text assertions and test fixtures to pass through a configurable PRISMIC_HOST.

Written by Cursor Bugbot for commit 91f12f8. 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 angeloashmore force-pushed the feat/webhook-commands branch from c0da499 to 21b0a37 Compare March 10, 2026 19:17
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 21b0a37 to e29c315 Compare March 19, 2026 21:27
angeloashmore and others added 3 commits March 19, 2026 11:28
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Align webhook files with main's module structure:
- auth: ./lib/auth → ../auth
- config: ./lib/config (safeGetRepositoryFromConfig) → ../project (safeGetRepositoryName)
- env: ../lib/env → ../env
- valibot → zod/mini

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each trigger field was incorrectly reading from
webhookConfig.documentsUnpublished instead of the corresponding
property. The last line also used a duplicate "documentsPublished"
key instead of "tagsDeleted".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
angeloashmore and others added 5 commits March 19, 2026 12:25
…rectly

Remove the TRIGGER_DISPLAY mapping and reverse-lookup logic. Trigger
names now use the API's camelCase format (e.g. documentsPublished)
everywhere, eliminating unnecessary format conversion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove test, status, add-header, and remove-header webhook subcommands
that are not needed for the initial release. Tighten host parameter
types from `string | undefined` to `string` in wroom client functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 merged commit c7c763a into main Mar 19, 2026
20 of 22 checks passed
@angeloashmore angeloashmore deleted the feat/webhook-commands branch March 19, 2026 23:27
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.

await writeFile(
new URL(".prismic", home),
JSON.stringify({ token, host: DEFUALT_PRISMIC_HOST }),
);
Copy link

Choose a reason for hiding this comment

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

Login fixture ignores PRISMIC_HOST environment variable

Medium Severity

The login fixture now hardcodes DEFUALT_PRISMIC_HOST ("prismic.io") into the .prismic auth file, instead of using the process.env.PRISMIC_HOST value. Previously the module-level PRISMIC_HOST variable respected the environment variable. The new host fixture correctly reads from the env, but login doesn't use it — so when PRISMIC_HOST is set to a custom value, the CLI under test reads the wrong host from its auth file, while test helpers (like getWebhooks in test/prismic.ts) use the correct one.

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.

Re-enable webhook commands

1 participant