Flowlib
Plugins

Version Control

Sync flows to Git repositories with @flowlib/version-control.

The version control plugin syncs flows to Git repositories (GitHub, GitLab, Bitbucket). Push flow definitions as .flow.ts files, pull changes back, create PRs on publish, and keep flows in sync via webhooks.

Installation

pnpm add @flowlib/version-control
npm install @flowlib/version-control
yarn add @flowlib/version-control
bun add @flowlib/version-control

Setup

The plugin requires a Git provider and a target repository:

flowlib.config.ts
import { versionControl } from '@flowlib/version-control';
import { githubProvider } from '@flowlib/version-control/providers/github';

export const flowlibConfig = defineConfig({
  // ...
  plugins: [
    versionControl({
      provider: githubProvider({ token: process.env.GITHUB_TOKEN }),
      repo: 'my-org/my-flows',
    }),
  ],
});

After adding the plugin, regenerate and apply the schema:

npx flowlib-cli generate
npx flowlib-cli migrate --push

Options

OptionTypeRequiredDefaultDescription
providerGitProviderYesGit hosting provider (e.g. githubProvider())
repostringYesTarget repository in owner/name format
defaultBranchstringNo'main'Default branch for push/pull operations
pathstringNo'/'Directory in the repository for flow files
modeVcSyncModeNo'pr-per-publish''pr-per-publish' creates a PR per publish, 'direct-push' commits directly
syncDirectionVcSyncDirectionNo'push''push', 'pull', or 'bidirectional'
webhookSecretstringNoSecret for verifying Git webhook signatures

How it works

Once configured, you can sync individual flows or all flows at once:

  • Push — export a flow from Flowlib to the Git repository
  • Pull — import a flow from the Git repository into Flowlib
  • Publish — in pr-per-publish mode, creates a pull request for review
  • Force push/pull — resolve conflicts by choosing one side as the source of truth
  • Webhook — automatically sync when the repository is updated

API endpoints

EndpointMethodDescription
/plugins/version-control/vc/flowsGETList all synced flows
/plugins/version-control/vc/flows/:flowId/configurePOSTConfigure sync for a flow
/plugins/version-control/vc/flows/:flowId/statusGETGet sync status for a flow
/plugins/version-control/vc/flows/:flowId/disconnectDELETEDisconnect a flow from sync
/plugins/version-control/vc/flows/:flowId/pushPOSTPush flow to remote
/plugins/version-control/vc/flows/:flowId/pullPOSTPull flow from remote
/plugins/version-control/vc/flows/:flowId/publishPOSTPublish flow (creates PR in pr-per-publish mode)
/plugins/version-control/vc/flows/:flowId/historyGETGet sync history for a flow
/plugins/version-control/vc/push-allPOSTPush all synced flows
/plugins/version-control/vc/pull-allPOSTPull all synced flows
/plugins/version-control/vc/webhookPOSTWebhook receiver for Git events (public)

On this page