# Plugin Development Template Each plugin should follow this structure: ``` plugins/ {plugin-name}/ package.json # Plugin metadata and build config tsconfig.json # TypeScript config (extends root) src/ index.ts # Main executor implementation dist/ # Generated by build README.md # Plugin documentation ``` ## package.json Template ```json { "name": "@metabuilder/workflow-plugin-{plugin-name}", "version": "1.0.0", "description": "Brief description of what this plugin does", "main": "dist/index.js", "types": "dist/index.d.ts", "exports": { ".": { "import": "./dist/index.js", "require": "./dist/index.js", "types": "./dist/index.d.ts" } }, "scripts": { "build": "tsc", "dev": "tsc --watch", "type-check": "tsc --noEmit" }, "keywords": ["workflow", "plugin", "..."], "author": "MetaBuilder Team", "license": "MIT", "devDependencies": { "@types/node": "^20.0.0", "typescript": "^5.0.0" }, "peerDependencies": { "@metabuilder/workflow": "^3.0.0" }, "repository": { "type": "git", "url": "https://github.com/metabuilder/metabuilder.git", "directory": "workflow/plugins/{plugin-name}" } } ``` ## tsconfig.json Template ```json { "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./dist", "rootDir": "./src" }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"] } ``` ## src/index.ts Template ```typescript import { INodeExecutor, WorkflowNode, WorkflowContext, ExecutionState, NodeResult, ValidationResult } from '@metabuilder/workflow'; export class YourExecutor implements INodeExecutor { nodeType = 'your-node-type'; async execute( node: WorkflowNode, context: WorkflowContext, state: ExecutionState ): Promise { // Implementation here } validate(node: WorkflowNode): ValidationResult { // Validation here } } export const yourExecutor = new YourExecutor(); ``` ## Building All Plugins ```bash # Build all plugins from root npm run build:plugins # Or individual plugin cd workflow/plugins/dbal-read npm run build ``` ## Publishing ```bash # Publish to npm cd workflow/plugins/dbal-read npm publish ``` ## Plugin Categories - **data**: DBAL operations (read, write, delete, aggregate) - **integration**: External API calls (HTTP, webhooks, etc.) - **control-flow**: Logic operations (condition, loop, parallel) - **action**: Output operations (email, notifications, responses) - **utility**: Helper operations (transform, wait, variables)