Skip to main content
JUMP TO:Quick StartCLI CommandsConfigurationPlaywright APIMCP ServerGitHub Actions
Guides / Create & Publish a Plugin(20 of 37)

Create & Publish a Plugin

TYPED PLUGIN. Build against the FrontguardPlugin interface from the CLI version you install.

Write a TypeScript factory returning a FrontguardPlugin object. Frontguard does not operate a plugin registry or compatibility certification service.

Plugin Scaffolder and 9-Hook Architecture
FIG 01 · CREATE-FRONTGUARD-PLUGIN — BASIC, LIFECYCLE & REPORTER TEMPLATES ACROSS 9 PIPELINE HOOKS

Current status

Use the public interfaces exported by your installed CLI, add tests in the plugin repository, and follow the npm publishing process you independently verify.

Authoring a typed plugin package

src/index.ts: standalone plugin structure
import type { FrontguardPlugin } from '@frontguard/cli/plugins'

export interface StorageStateOptions {
  path: string
}

export function createStorageStatePlugin(options: StorageStateOptions): FrontguardPlugin {
  return {
    name: 'frontguard-plugin-storage-state',
    beforeRender({ routes, config }) {
      return {
        routes,
        config: { ...config, auth: { storageState: options.path } },
      }
    },
  }
}

Safe workflow

  • Use beforeRender for capture configuration, afterRender for captured screenshot results, and afterRun for reporting.
  • Clean up external handles or temporary files in teardown.
  • Pin the peerDependency range for @frontguard/cli and test with representative route and result fixtures.