export interface WorktreeRecord { path: string; branch: string | null; isMain: boolean; } /** Parse `git worktree list --porcelain`. Records are blank-line separated; * each opens with a `worktree ` line and carries a `branch refs/heads/` * line when checked out on a branch. The first record is the repo's main * worktree; the rest are linked worktrees. */ export declare function parseWorktrees(porcelain: string): WorktreeRecord[]; /** Clean up the local branch — and, when applicable, the worktree — left behind * after a PR is merged or squash-merged. `gh --delete-branch` removes the * *remote* branch; this clears the local side so the loop doesn't accumulate * stale merged/squashed branches and dead worktrees across issues. * * If the merged branch is checked out in a *dedicated* per-issue/feature * worktree — a linked worktree that is neither the reusable `shipflow-loop` * loop worktree nor the current working directory — the whole worktree is * removed (its work has landed). The reusable loop worktree, the repo's main * checkout, and the current cwd's worktree are instead detached (branch freed, * worktree kept). The local branch is then force-deleted and `git worktree * prune` clears any now-dangling worktree admin entries. * * Best-effort: never throws, since cleanup must not fail an otherwise- * successful merge. Keeps `stdio: "ignore"` so git chatter stays quiet. */ export declare function cleanupMergedLocalBranch(headBranch: string): void; /** A local branch head: short name + tip SHA. */ export interface LocalBranchTip { name: string; tip: string; } /** Local `fix/*` branches with their tip SHAs. At or under the cap, ordered * oldest-committed first; over the cap, a RANDOM sample of `GC_MAX_BRANCHES` — * a stable "oldest 20" slice would query the same never-merged branches every * tick and permanently starve the rest (PR #456 review), while random sampling * reaches every branch eventually with the same per-tick bound. Empty on any * git failure — the GC is a heal, never a blocker. */ export declare function localGcCandidates(): LocalBranchTip[]; /** Does the cwd's repo actually point at `repoFullName` ON GITHUB? The inbox * can be run from anywhere; without this guard a tick started in some OTHER * repo would compare that repo's local branches against this project's PRs and * delete branches whose names happen to collide. The HOST must match too * (PR #456 review): `gitlab.com/Acme/widget` or `file:///tmp/Acme/widget.git` * ends in the same owner/name pair but is not the repo the PR lookup consults. * Fails closed (false) on any error. */ export declare function localRepoMatches(repoFullName: string): boolean; /** Does a local branch ref still exist? Used to CONFIRM a cleanup actually * removed the branch — `cleanupMergedLocalBranch` is deliberately best-effort * and silent, so without this check the GC would report "cleaned" for a branch * that survived (PR #456 review). Fails closed (true = still exists). */ export declare function localBranchExists(branch: string): boolean; /** Is `tip` an ancestor of `mergedHeadOid` — i.e. the local branch is merely * BEHIND the merged PR head (update-branch, review fixups pushed elsewhere) * with no commits of its own? Such a branch is as safe to clean as an * exact-tip match; only a tip with commits UNREACHABLE from the merged head is * un-landed work (PR #456 review). Requires the merged head object locally * (a fetch usually has it); unknown objects fail closed (false = keep). */ export declare function isAncestorOfMergedHead(tip: string, mergedHeadOid: string): boolean; /** Is the worktree holding `branch` dirty (uncommitted changes)? A merged-at- * exact-tip branch can still sit in a worktree with un-landed EDITS on top — * `git worktree remove --force` would destroy them (seen live: renaiss-os-index * loop worktree on merged #565 with two modified files). No worktree holds the * branch → false (nothing to lose). Any error → true: fail closed, keep. */ export declare function branchWorktreeDirty(branch: string): boolean; /** The merged PR that a local branch was the head of, as the planner needs it. */ export interface MergedHeadPR { number: number; headRefOid: string; } export interface MergedBranchGcPlan { /** Branch tips that EQUAL their merged PR's head — safe to clean. */ clean: { name: string; prNumber: number; }[]; /** Merged, but the local tip has commits the PR never saw — report, keep. */ unpushed: { name: string; prNumber: number; }[]; } /** Decide which local branches a merged PR has orphaned. Pure: the caller * supplies the branch tips and the merged-PR lookup results. A branch is * cleaned ONLY when its tip is byte-equal to the merged PR's `headRefOid` — * a differing tip means local work that never reached the PR, which is * un-landed work, not garbage. Branches with no merged PR are not the GC's * concern (open PR, never PR'd, or closed-unmerged — a human call). */ export declare function planMergedBranchGc(branches: LocalBranchTip[], mergedByHead: Map): MergedBranchGcPlan; /** Why an author email will fail forge matching, or null when it looks fine. */ export declare function suspiciousCommitEmail(email: string, hostname: string): string | null; /** Deduped "email — reason" lines for every suspicious address in the list. */ export declare function findSuspiciousEmails(emails: string[], hostname: string): string[]; //# sourceMappingURL=git-local.d.ts.map