import type { Intake, IntakeIssue } from '../capabilities/intake.js'; import type { FactoryProject, FactoryProjectsStorage } from '../storage/domains/projects/base.js'; import type { WorkItemRow, WorkItemsStorage } from '../storage/domains/work-items/base.js'; export interface IssueReconcileSummary { projects: number; checked: number; updated: number; closed: number; missing: number; failed: number; errors: Array<{ projectId: string; workItemId?: string; error: string; }>; } /** * Scope passed in by the caller. Providers that reconcile per-repository (like * GitHub, sharing target discovery with the PR reconciler) pass a target set * and a `matches(item, scope)` predicate. Providers with no repository concept * (Linear) pass no scope and every issue item is considered. */ export interface IssueReconcileScope { scopes: TScope[]; matches(item: WorkItemRow, scope: TScope): boolean; } export interface IssueReconcilerOptions { integrationId: string; intake: Intake; projects: Pick; storage: WorkItemsStorage; externalSource?(item: WorkItemRow): { type: string; externalId: string; }; issueId(item: WorkItemRow): string | undefined; metadata(item: WorkItemRow, issue: IntakeIssue): Record; /** * Called when a closed issue (stateType 'completed' or 'canceled') is detected * on a non-terminal work item. Use this to replay the close event through * the provider's rules ingress. */ onClosed?(item: WorkItemRow, issue: IntakeIssue, project: FactoryProject): Promise; /** Whether the item already rests in a terminal phase of its board. Unknown phases are not terminal. */ isTerminal(item: WorkItemRow): boolean; } export type IssueReconciler = TScope extends void ? () => Promise : (scope: IssueReconcileScope) => Promise; export declare function createIssueReconciler(options: IssueReconcilerOptions): IssueReconciler; //# sourceMappingURL=issue-reconciler.d.ts.map