Skip to Content
harness-kit

status-sync

The built-in Policy status-sync, 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
Eventsset by its options
Toolsevery tool, or as its options set
Agent typesevery agent, or as its options set

Options

OptionTypeDefaultDescription
branchKeystring"^[^/]+/([a-z]+-[0-9]+)"The pattern whose first group is the branch's issue key, read in capitals.
copiesobject{"multiTargetSuffix":"-onto-","worktreeSuffix":"-[0-9]+$"}How a worktree's copy of a branch is named, so feature/t-1-x-2 answers for feature/t-1-x.
mapobject[][{"pr":"draft","role":"in_flight"},{"pr":"ready","role":"first_review"},{"pr":"merged_into_default","role":"deploy_queue"}]The role each pull request stage asks of its issue.
projectsobject{}Roles of their own for single tracker projects, by key prefix ({ "OPS": { "roles": [] } } holds a project to nothing).
regressFromobject{"in_flight":["first_review"]}The roles an issue moves back from when its pull request moves back, by the role asked.
rolesobject[]requiredThe board's roles in workflow order, each { role, status }, such as { "role": "in_flight", "status": "In Progress" }.
skipBranchesstring[]["^epic/"]Patterns of branches never judged.
transitionHintstring"harness-kit tracker transition {key} \"{status}\""The fix that moves an issue, with {key} and {status} in place.

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: 'status-sync',
      // The constructor's options, which it decodes.
      options: {
        // The pattern whose first group is the branch's issue key, read in capitals.
        branchKey: '^[^/]+/([a-z]+-[0-9]+)',
        // How a worktree's copy of a branch is named, so `feature/t-1-x-2` answers for
        // `feature/t-1-x`.
        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 role each pull request stage asks of its issue.
        map: [
          {
            // The state of the pull request: `draft`, `ready`, or `merged_into_default`.
            pr: 'draft',
            // The role the issue of a pull request in that state is asked to have.
            role: 'in_flight',
          },
          {
            // The state of the pull request: `draft`, `ready`, or `merged_into_default`.
            pr: 'ready',
            // The role the issue of a pull request in that state is asked to have.
            role: 'first_review',
          },
          {
            // The state of the pull request: `draft`, `ready`, or `merged_into_default`.
            pr: 'merged_into_default',
            // The role the issue of a pull request in that state is asked to have.
            role: 'deploy_queue',
          },
        ],
        // Roles of their own for single tracker projects, by key prefix
        // (`{ "OPS": { "roles": [] } }` holds a project to nothing).
        projects: {
          OPS: {
            // The project's roles in workflow order, each `{ role, status }`; an empty list holds
            // the project to nothing.
            roles: [
              {
                // The role's name, which `map` and `regressFrom` refer to.
                role: 'in_flight',
                // The status name the role reads on the board; `null` switches the role off.
                status: 'In Progress',
              },
            ],
          },
        },
        // The roles an issue moves back from when its pull request moves back, by the role asked.
        regressFrom: {
          in_flight: ['first_review'],
        },
        // The board's roles in workflow order, each `{ role, status }`, such as
        // `{ "role": "in_flight", "status": "In Progress" }`.
        roles: [
          {
            // The role's name, which `map` and `regressFrom` refer to.
            role: 'in_flight',
            // The status name the role reads on the board; `null` switches the role off.
            status: 'In Progress',
          },
        ],
        // Patterns of branches never judged.
        skipBranches: ['^epic/'],
        // The fix that moves an issue, with `{key}` and `{status}` in place.
        transitionHint: 'harness-kit tracker transition {key} "{status}"',
      },
      // The name of the kit's Policy constructor that builds the Policy.
      use: 'status-sync',
    },
  ],
});

On this page