Plugin Architecture
Otso plugins extend imports, publishers, and enrichers. A plugin is a Node module exporting a manifest and hooks.
Discovery and manifest
Section titled “Discovery and manifest”Plugins are discovered via package.json
using the "otso"
field or by loading from the local plugins/
directory.
Example manifest:
export const manifest = { name: 'example', version: '1.0.0', hooks: ['import', 'publish']};
Minimal plugin interface
Section titled “Minimal plugin interface”import type { ImportHook } from 'otso';
export const importHook: ImportHook = async (ctx) => { // fetch data and yield events};
Hook functions receive a context with logging, storage, and config helpers.
Examples and testing
Section titled “Examples and testing”- Use
pnpm link
during development. - Provide fixtures for APIs and run
pnpm test
inside your plugin repo. - See
@otso/import-github
for a real world example.