/** * Per-iteration scanner that advances a task based on its worktree's pull * request state. Sits after the dispatcher and before the cleaner in each * `orchestrate()` tick. * * - An **open** PR on an **in-progress** task → `markInReview`: frees a * dispatch slot (slot math counts only in-progress) while leaving the * worktree intact for review, since the cleaner only tears down `done`. * - A **merged** PR (on an in-progress or in-review task) → `markDone`: * the work has landed, so the task is terminal. On a successful `markDone` * the reviewer tears the worktree down immediately (same step). The cleaner * remains the level-triggered backstop for sources where `markDone` is * unsupported or that keep reporting `done`. `merged` never routes to * `in-review`. * * Sources that don't implement `markDone` (e.g. Linear) return `unsupported`; * the reviewer logs the skip and does nothing — there is no in-review * fallback. (Linear's own GitHub integration moves merged issues to Done, * which groundcrew observes via `fetch()`.) * * The write-back lands in the task source, not the in-memory `BoardState`, and * the dispatcher has already made the current tick's start decisions; the slot * frees on the NEXT tick's `board.fetch()`. That one-tick latency is * deliberate. One per `orchestrate()`; stateless across iterations. Mirrors * `Cleaner`. */ import type { Board } from "../lib/board.ts"; import type { ResolvedConfig } from "../lib/config.ts"; import type { PullRequestSummary } from "../lib/pullRequests.ts"; import { type BoardState } from "../lib/taskSource.ts"; import type { WorktreeEntry } from "../lib/worktrees.ts"; /** * Injected PR lookup. Matches `findPullRequestsForBranch`'s shape: best-effort, * never rejects — a failed lookup (gh missing, unauthenticated, non-GitHub * remote, network error) resolves to an empty list, indistinguishable from * "no PR yet". Both outcomes mean "skip this issue, retry next tick". */ export type FindPullRequests = (arguments_: { cwd: string; branchName: string; signal?: AbortSignal; }) => Promise; interface ReviewerDeps { board: Board; findPullRequests: FindPullRequests; config?: ResolvedConfig; } /** Per-tick inputs, mirroring the other orchestrator steps' shape. */ interface ReviewArguments { state: BoardState; worktreeEntries: readonly WorktreeEntry[]; dryRun: boolean; signal?: AbortSignal; } export interface Reviewer { runOnce: (arguments_: ReviewArguments) => Promise; } export declare function createReviewer(deps: ReviewerDeps): Reviewer; export {}; //# sourceMappingURL=reviewer.d.ts.map