import { PrLifecycleGuardConfig } from '@webpieces/rules-config'; import type { BashContext, Violation } from '../types'; import { BashRuleBase } from '../rule-base'; import { FixHint } from '../fix-hint'; export declare class PrMergeGuardRule extends BashRuleBase { constructor(config: PrLifecycleGuardConfig); readonly description = "Redirect a hand-rolled `gh pr merge` to `pnpm wp-land-pr`, then require branch cleanup."; private currentBranch; private treeKind; private worktreePath; private readonly recovery; get fixHint(): FixHint; /** * Any hand-rolled `gh pr merge` is blocked outright — there is no "but I cleaned up afterwards" * escape, because the damage is the commit message that merge writes into main, which cleanup * cannot undo. `pnpm wp-land-pr` is the way through; its own `gh pr merge` runs as a child * process this hook never sees, exactly like the other gated commands. * * ─── Why a CORRECT-LOOKING `gh pr merge --auto --subject --body-file` is still blocked ────────── * Full reasoning, and what was rejected: `decisions/0005-the-pr-description-is-the-merge-body.md` * § "pr-merge-guard stays blocking" (which supersedes `0004` § 8). It has now been re-examined * twice — once when the gated body moved out of the worktree, and again when it moved onto the PR * itself — and the block stands. A `--body-file` proves a file was passed, never that it holds the * GATED bytes: the guard sees a command string and cannot read the file, so any file at all — a * hand-written one, an older run's — could land as the reviewed body with nothing to distinguish it * afterwards. * * One more thing depends on that: landing DECIDES whether the archive/merge-info/reap bookkeeping * belongs to this tree, by comparing this tree's branch tip against the PR's `headRefOid`. A * hand-rolled merge skips that decision silently, which is how a landed worktree becomes a corpse. * * The tree kind still decides which cleanup steps the hint prints: in a linked worktree * `git checkout main` FATALS, so demanding it there would be demanding an impossible command. */ check(ctx: BashContext): readonly Violation[]; }