Skip to Content
harness-kit

merge-method

The built-in Policy merge-method, against commits and pushes to shared branches, lost stashes, merges only people should make: its defaults, its options and a configuration that writes it.

To learn what it guards against and see it at work, read the guide: Git and forge.

Defaults

DefaultValue
On by defaultno: an entry turns it on
Fail modeclosed
Timeout10000 ms
EventsPreToolUse
ToolsBash
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
rulesobject[][]The rules, each the merge methods it forbids onto the branches it names, such as { onto: ['staging'], forbid: ['squash'] }.

Example

A configuration that writes every option, a comment above each:

import { defineConfig } from '@microeinhundert/harness-kit';

export default defineConfig({
  // The Policy entries, in the order their Decisions merge in.
  policies: [
    {
      // The Policy's name, unique in the configuration; messages and logs name the Policy by it.
      id: 'merge-method',
      // The constructor's options, which it decodes.
      options: {
        // The rules, each the merge methods it forbids onto the branches it names, such as
        // `{ onto: ['staging'], forbid: ['squash'] }`.
        rules: [
          {
            // The merge methods that may not land on the branches `onto` names.
            forbid: ['merge'],
            // The branches, names or globs, the rule applies to, such as `staging` or `release/*`.
            onto: ['staging'],
          },
        ],
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'merge-method',
    },
  ],
});

On this page