Skip to Content
harness-kit

forge-guard

The built-in Policy forge-guard, 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
Timeout5000 ms
EventsPreToolUse
ToolsBash
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
refuse("approve" | "merge")[]["approve","merge"]The verdicts no agent may give on a pull request.
unreadable"allow" | "refuse""refuse"refuse refuses a forge command whose effect cannot be read; allow lets it run.

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: 'forge-guard',
      // The constructor's options, which it decodes.
      options: {
        // The verdicts no agent may give on a pull request.
        refuse: ['approve', 'merge'],
        // `refuse` refuses a forge command whose effect cannot be read; `allow` lets it run.
        unreadable: 'refuse',
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'forge-guard',
    },
  ],
});

On this page