Skip to content

Official Plugins

Official plugins live alongside pubm and follow the same release and compatibility expectations as the core project. Use them when you want a supported integration without building your own plugin from scratch.

@pubm/plugin-brew helps CLI projects keep Homebrew formulae in sync with each release. It registers rollback actions that close any Homebrew PRs created if the pipeline fails after the PR is opened.

  • shipping a CLI binary through Homebrew
  • updating a dedicated tap repository automatically
  • keeping formula checksums aligned with release assets
import { defineConfig } from "@pubm/core";
import { brewTap } from "@pubm/plugin-brew";
export default defineConfig({
plugins: [
brewTap({
formula: "Formula/my-tool.rb",
repo: "https://github.com/my-org/homebrew-tap",
}),
],
});
OptionTypeDescription
formulastringFormula path relative to the repository root.
repostringOptional remote tap repository URL. If omitted, the current repository is used.
packageNamestringOptional package name filter. When set, the plugin only runs for releases matching this package name. Useful in monorepos.
assetPlatformsRecord<string, (asset: ReleaseAsset) => boolean>Optional custom platform matchers. Overrides the default os + arch matching logic.

The plugin uses structured ParsedPlatform data from each ReleaseAsset to match assets to formula platform entries. The default matching logic covers four platforms:

Formula keyMatches when
darwin-arm64asset.platform.os === "darwin" && asset.platform.arch === "arm64"
darwin-x64asset.platform.os === "darwin" && asset.platform.arch === "x64"
linux-arm64asset.platform.os === "linux" && asset.platform.arch === "arm64"
linux-x64asset.platform.os === "linux" && asset.platform.arch === "x64"

This replaces the previous approach of string-matching asset names (e.g., asset.name.includes("darwin-arm64")), which was fragile when names changed.

Use assetPlatforms when the default os + arch matching is not enough, for example when you only want musl builds for Linux:

brewTap({
formula: "Formula/mytool.rb",
assetPlatforms: {
"darwin-arm64": (asset) =>
asset.platform.os === "darwin" && asset.platform.arch === "arm64",
"linux-x64": (asset) =>
asset.platform.os === "linux" &&
asset.platform.arch === "x64" &&
asset.platform.abi === "musl",
},
})

Each predicate receives a ReleaseAsset and returns true if the asset should be used for that formula entry.

@pubm/plugin-brew declares its own credentials and checks automatically. You do not need to configure them manually.

Required credential:

Environment variableGitHub Secret namePurpose
PUBM_BREW_GITHUB_TOKENPUBM_BREW_GITHUB_TOKENGitHub Personal Access Token with repo scope, used to push formula updates and open pull requests.

In local runs, pubm prompts for this token and stores it in the system keyring. In CI, provide the token via the PUBM_BREW_GITHUB_TOKEN environment variable. Run pubm --mode ci --phase prepare or pubm secrets sync to sync the stored token into your repository’s GitHub Secrets so CI workflows can consume it automatically.

The plugin also registers a preflight check that verifies the token is present and has the required repository access before the publish phase begins.

The plugin can:

  • create a formula scaffold when one does not exist
  • update url and sha256 values for release assets using structured platform info
  • commit and push formula changes
  • fall back to a pull-request workflow when direct push is not appropriate
Terminal window
pubm brew init

Use this to scaffold a starting formula from package metadata.

For contributing to homebrew-core (the default Homebrew repository), use brewCore instead of brewTap:

import { brewCore } from "@pubm/plugin-brew";
export default defineConfig({
plugins: [
brewCore({
formula: "Formula/my-tool.rb",
}),
],
});
OptionTypeDescription
formulastringFormula path relative to the repository root.
packageNamestringOptional package name filter for monorepos.
assetPlatformsRecord<string, (asset: ReleaseAsset) => boolean>Optional custom platform matchers.

brewCore forks homebrew/homebrew-core, updates the formula, and opens a PR automatically. Like brewTap, it declares the PUBM_BREW_GITHUB_TOKEN credential and a preflight check automatically.

This plugin keeps non-manifest files aligned with your package version. It registers rollback actions to restore original file contents if the pipeline fails after version sync.

Use it when a release should also update:

  • README.md install snippets
  • docs examples
  • app manifests
  • source constants
  • metadata JSON files
import { defineConfig } from "@pubm/core";
import { externalVersionSync } from "@pubm/plugin-external-version-sync";
export default defineConfig({
plugins: [
externalVersionSync({
targets: [
{
file: "src/constants.ts",
pattern: /export const VERSION = "([^"]+)";/,
},
{
file: "manifest.json",
jsonPath: "metadata.version",
},
{
file: "README.md",
pattern: /pubm@([\\w.-]+)/,
},
],
}),
],
});

Use for arbitrary text files:

{
file: "README.md",
pattern: /pubm@([\\w.-]+)/,
}

Requirements:

  • the pattern must isolate the version in exactly one capturing group
  • the file should have a stable format so release automation can update it safely

Use for machine-readable manifests:

{
file: "manifest.json",
jsonPath: "metadata.version",
}

If you are not sure where versions appear in your repository, run:

Terminal window
pubm sync --discover

That command scans for likely version references and prints candidate files and paths you can adapt into plugin config.

Choosing between official and custom plugins

Section titled “Choosing between official and custom plugins”

Use an official plugin when:

  • your need matches an existing integration
  • you want a lower-maintenance setup
  • the release path is common enough to benefit from standardization

Build a custom plugin when:

  • your registry or post-release workflow is organization-specific
  • you need custom policy or deployment logic
  • you want additional CLI commands for operators

Read the Plugins API Reference if you need to extend beyond the official set.

Runtime plugins are only part of the story. This repository also ships a pubm plugin bundle under plugins/pubm-plugin/skills/* for coding-agent workflows such as:

  • release setup
  • preview-first publish assistance
  • version-sync discovery
  • plugin scaffolding

If you are integrating pubm into an agent environment, pair runtime plugins with these skill-style assets so setup and publish flows stay explicit and repeatable.

Read the Coding Agent Integration guide for the integration layout.