Skip to content
Français

BranchPolicy

import type { BranchPolicy } from "@elie-laloum/outpost";

The fields below cover all variants; the signature specifies their allowed combinations.

  • modeRequired
    "current" | "named" | "integrate"
    current works in the checkout itself; named works on the branch name in a worktree under .outpost/workspaces; integrate creates an outpost/<label>-<id> branch there, which integrate() merges into the base branch.
  • nameVariant-dependent
    string
    Work branch for named mode, kept when the workspace closes. An existing branch continues from its tip and reuses its managed worktree; one checked out outside .outpost/workspaces fails with code conflict.
  • fromVariant-dependent
    string | undefined
    Revision a new work branch starts from, default HEAD. Ignored when the named branch already exists.
export type BranchPolicy =
  | {
      readonly mode: "current";
    }
  | {
      readonly mode: "named";
      readonly name: string;
      readonly from?: string;
    }
  | {
      readonly mode: "integrate";
      readonly from?: string;
    };