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
| Default | Value |
|---|---|
| On by default | no: an entry turns it on |
| Fail mode | open |
| Timeout | 30000 ms |
| Events | Stop |
| Tools | every tool, or as its options set |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
protectedBranches | string[] | — | 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. |
remote | string | — | 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',
},
],
});stop-command
The built-in Policy stop-command, 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.
pull-request
The built-in Policy pull-request, 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.