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.
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 | PostToolUse, Stop |
| Tools | Bash |
| Agent types | every agent, or as its options set |
Options
| Option | Type | Default | Description |
|---|---|---|---|
body | false | object | {"enforceOn":["create","edit"],"firstLine":"^{issue_url}$"} | After a create or an edit, the body opens with the configured first line, such as the issue's URL; false switches the check off. |
copies | object | {"multiTargetSuffix":"-onto-","worktreeSuffix":"-[0-9]+$"} | The suffixes of a branch's copies. |
currency | false | object | {"checks":["ahead","open_threads","ready_when_finished","stale_body"],"finishMarker":"<!-- harness-finish -->","readyVerdict":"ready","threadMarker":"<!-- harness-thread: (open|fixed) -->"} | The open pull request of every touched branch is current: it carries the branch's commits, a body edited after its last commit, no unanswered review thread, and is out of draft once marked finished; false switches the check off. |
exists | false | object | {"createHint":"gh pr create --draft --base {base} --title \"<the issue’s title>\" --body-file <file>","integrationBranches":["epic/*"],"seenMinutes":60} | Every touched work branch with commits beyond the branches it was cut from has a pull request, or pushes to its worktree sibling's; false switches the check off. |
protectedBranches | string[] | — | The shared branches, which are never judged; the repository's default branch when absent. |
remote | string | "origin" | The remote the branches are pushed to. |
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: 'pull-request',
// The constructor's options, which it decodes.
options: {
// After a create or an edit, the body opens with the configured first line, such as the
// issue's URL; `false` switches the check off.
body: {
// The commands after which a pull request's body is read back: `create` for
// `gh pr create`, `edit` for `gh pr edit`.
enforceOn: ['create', 'edit'],
// The pattern the first non-blank line of a pull request's body must match, with
// `{issue_url}` standing for the URL of any issue of the tracker.
firstLine: '^{issue_url}$',
},
// The suffixes of a branch's copies.
copies: {
// The text that opens the suffix of a branch's copy made for one target, such as `-onto-`
// in `feat-x-onto-release-3`.
multiTargetSuffix: '-onto-',
// The pattern of the suffix a worktree's copy of a branch adds, such as `-[0-9]+$` for
// `feat-x-2`, a copy of `feat-x`.
worktreeSuffix: '-[0-9]+$',
},
// The open pull request of every touched branch is current: it carries the branch's
// commits, a body edited after its last commit, no unanswered review thread, and is out of
// draft once marked finished; `false` switches the check off.
currency: {
// The ways a pull request may fall behind its branch that are looked for: `ahead`,
// `stale_body`, `open_threads` and `ready_when_finished`.
checks: [
'ahead',
'open_threads',
'ready_when_finished',
'stale_body',
],
// The marker of the finish comment, which says the pull request is ready at its head.
finishMarker: '<!-- harness-finish -->',
// The word the line after the finish marker starts with when the pull request is ready,
// followed by the head it was judged at (`ready 3f2c1a9`, at least 7 characters).
readyVerdict: 'ready',
// The pattern of the marker of a review thread's answer, whose first group is `open` (the
// thread stays open on purpose) or another word such as `fixed`.
threadMarker: '<!-- harness-thread: (open|fixed) -->',
},
// Every touched work branch with commits beyond the branches it was cut from has a pull
// request, or pushes to its worktree sibling's; `false` switches the check off.
exists: {
// The command that opens the pull request, with `{base}` and `{branch}` standing for the
// base and the branch.
createHint: 'gh pr create --draft --base {base} --title "<the issue’s title>" --body-file <file>',
// Globs of the integration branches a work branch may be cut from and target.
integrationBranches: ['epic/*'],
// How many minutes a branch found with a pull request is not asked about again.
seenMinutes: 60,
},
// The shared branches, which are never judged; the repository's default branch when absent.
protectedBranches: ['release/*'],
// The remote the branches are pushed to.
remote: 'origin',
},
// The name of the kit's Policy constructor that builds the Policy.
use: 'pull-request',
},
],
});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.
references
The built-in Policy references, 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.