Custom Plugins
Plugins can hook into the capture lifecycle to register new pages, mutate context, or send
notifications. Start by creating a function that returns an object conforming to the plugin API from
@cappa/core
.
import type { CappaPlugin } from '@cappa/core';
export function myPlugin(): CappaPlugin { return { name: 'my-plugin', async execute(screenshotTool) { await screenshotTool.capture(page, 'my-page', { fullPage: true, viewport: { width: 1024, height: 768 }, }, { saveDiffImage: true, diffImageFilename: 'my-page-diff.png', }); } };}
Register the plugin in cappa.config.ts
and iterate on the callbacks until they match your use
case. Combine plugins to orchestrate complex capture flows without bloating the core CLI.