Skip to Content
harness-kit

work-saved

The built-in Policy work-saved, against a turn that ends with failing lint, unsaved work or an incomplete hand-off: its defaults, its options and a configuration that writes it.

To learn what it guards against and see it at work, read the guide: Stop checks and hand-off.

Defaults

DefaultValue
On by defaultno: an entry turns it on
Fail modeopen
Timeout30000 ms
EventsStop
Toolsevery tool, or as its options set
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
protectedBranchesstring[]—Globs of the branches that are never judged; the repository's default branch when absent. The deploy branches of the repository's project are never judged either.
remotestring—The remote a branch that was never pushed is pushed to; origin when absent.
require("committed" | "pushed")[]—What a touched branch must be: committed, pushed, or both (the default).
skipStates("cherry-pick" | "merge" | "rebase" | "revert")[]—The operations in progress that spare a branch: merge, rebase, cherry-pick, revert (all four when absent).

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: 'work-saved',
      // The constructor's options, which it decodes.
      options: {
        // Globs of the branches that are never judged; the repository's default branch when absent.
        // The deploy branches of the repository's project are never judged either.
        protectedBranches: ['release/*'],
        // The remote a branch that was never pushed is pushed to; `origin` when absent.
        remote: 'origin',
        // What a touched branch must be: `committed`, `pushed`, or both (the default).
        require: ['committed'],
        // The operations in progress that spare a branch: `merge`, `rebase`, `cherry-pick`,
        // `revert` (all four when absent).
        skipStates: ['cherry-pick'],
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'work-saved',
    },
  ],
});

On this page