Skip to content

Plugin SDK

The public package third-party developers install to build a Verql plugin. It ships the types, pure helpers, and the capability model a plugin codes against — everything you need to author a driver, exporter, theme, AI provider, panel, or tool without a checkout of the Verql repo.

Terminal window
npm install @verql/plugin-sdk
# or: pnpm add @verql/plugin-sdk
  • New to plugins? Start with getting-started.md for a minimal end-to-end plugin.
  • Reference for every contribution surface (driver, exporter, importer, formatter, type mapper, theme, panel, command, AI provider, tool, …) lives in ../plugins.md. That doc is the canonical catalogue; this package is how you consume those surfaces from outside the repo.
  • Security & permissions: read ../plugin-security.md before you reach for keyring, connections, or ipc.
Export groupExamplesNotes
TypesPluginContext, DriverFactory, DbAdapter, Tool, ConnectionField, RegisteredTheme, …The full type surface a plugin codes against. Erased at runtime.
AuthoringdefinePlugin, PluginModuleTyped identity helper that pins your manifest + activate/deactivate shape.
SQL helpersquoteIdentifier, validateIdentifier, formatSqlValue, generateCreateTable, generateInsertStatements, splitSqlStatements, importCsvToTable, createRelationalGetTableDataParameterised on your driver’s quote char — compose them instead of hardcoding a dialect.
ThemesvalidateTheme, REQUIRED_THEME_TOKENS, RECOMMENDED_THEME_TOKENSValidate a theme with the same checker the host uses.
ToolsisWriteQuery, toJsonSchemaBuild AI/MCP tool schemas.
ErrorssafeCall, ErrorBudget, PluginErrorMatch the host’s error-handling contract.
PermissionsALL_PERMISSIONS, PERMISSION_INFO, PermissionDeniedError, hasPermission, effectiveGrants, isPluginPermission, type PluginPermissionThe capability model your manifest declares against.

Driver capabilities (declared, never branched on)

Section titled “Driver capabilities (declared, never branched on)”

The host treats every driver generically; a driver expresses dialect behaviour by declaring serializable capabilities on its DriverFactory (and a couple of optional adapter methods), not by the host special-casing its type:

  • statementSyntax — which statement splitter the CodeLens gutter uses ('sql' / 'redis' / 'mongodb').
  • errorRules — regex rules that classify query errors into a DbErrorCode (the host owns the friendly message).
  • parseQueryPlan(result) on the adapter — parse EXPLAIN output into a PlanNode tree for the Query Plan view.
  • plus sqlDialect, quoteChar, placeholderStyle, editorLanguage, defaultSchemaCandidates, session, explain, …

See ../plugins.md for the full driver example.

createPluginContext and the registry implementations (DriverRegistryImpl, …) are the host’s concern. A plugin receives a ready PluginContext in activate(ctx); it never constructs one. Those live in the app and pull in Electron, so the published package stays Electron-free and lightweight (~13 KB, zod as its only runtime dependency).

Verql loads plugins from userData/plugins/. Each plugin is a folder with a plugin-manifest.json (or a package.json carrying the verql-plugin keyword) and a compiled main entry that exports activate(ctx). The permissions array in the manifest declares the sensitive capabilities you need — see getting-started.md and ../plugin-security.md.

@verql/plugin-sdk is versioned and published independently of the desktop app so its API can stabilise on its own cadence:

  • The app releases on v*.*.* tags (.github/workflows/release.yml).
  • The SDK publishes on sdk-v* tags (.github/workflows/publish-sdk.yml), which verifies the tag matches packages/plugin-sdk/package.json, typechecks, builds with tsup, and runs pnpm publish --provenance.

To cut an SDK release: bump packages/plugin-sdk/package.json, commit, then git tag sdk-vX.Y.Z && git push origin sdk-vX.Y.Z.

The package is a pnpm workspace member under packages/plugin-sdk:

Terminal window
pnpm --filter @verql/plugin-sdk build # bundle ESM + CJS + d.ts into dist/
pnpm --filter @verql/plugin-sdk typecheck # tsc --noEmit