import type { ReviewRecommendation } from '../../core/index.js'; import { collectReviewDiff, type ReviewDiffResult } from '../review-diff.js'; /** * `slope pr ...` — agent-friendly PR helpers. * * Subcommands: * slope pr finalize [--pr=N] [--dry-run] Auto-add `Closes #N` lines to PR * body for any issue refs in commit * messages that GitHub's auto-close * parser would otherwise miss (#321). * slope pr review [--pr=N] [--sprint=N] Run the post-PR review workflow * for any PR creation transport. * slope pr status [--pr=N] [--sprint=N] Check sprint + PR closeout readiness. * slope pr issues [--pr=N] Print extracted issue refs (helper). * * Background: commits like `fix: ... (GH #297, #299)` or `… closes #314` mix * close-able patterns with non-canonical wording. Without one of GitHub's * magic keywords (`Close[s|d]`, `Fix[es|ed]`, `Resolve[s|d]`) on its own line * adjacent to the issue number, the issue stays open even after merge — the * scenario surfaced in PR #317. */ interface FinalizeOptions { pr?: number; dryRun?: boolean; } export interface PrReviewOptions { pr?: number; sprint?: number; type?: 'architect' | 'code' | 'both'; json?: boolean; paths?: string[]; excludePaths?: string[]; maxDiffBytes?: number; } export interface PrReviewPlan { pr: number; sprint?: number; ticketCount: number; slope: number; changedFiles: string[]; totalChangedFiles: number; hasNewInfra: boolean; recommendations: ReviewRecommendation[]; reviewType: 'architect' | 'code' | 'both'; branchSizeWarnings: string[]; reviewDiff: ReviewDiffResult; } export type PrReviewDiffCollector = typeof collectReviewDiff; export declare function prCommand(args: string[]): Promise; export declare function parsePrReviewFlags(args: string[]): PrReviewOptions; export declare function defaultReviewType(_recommendations: ReviewRecommendation[]): 'architect' | 'code' | 'both'; export declare function formatReviewRecommendations(recommendations: ReviewRecommendation[]): string; export declare function planPrReview(opts: PrReviewOptions, collect?: PrReviewDiffCollector): Promise; /** Record separator used to split `git log --format=%x1eBODY`. */ export declare const COMMIT_RECORD_SEPARATOR = "\u001E"; /** * Extract issue refs only from commits that claim to fix something. * * `slope pr finalize` previously swept every `#N` out of the concatenated commit * text. On PR #622 that included a roadmap-triage commit which merely *planned* * sprints for six issues, so merging would have auto-closed all six with no fix * shipped (GH #623). Intent lives in the conventional-commit type, so classify * per commit and ignore docs/chore/test/style entirely. */ export declare function extractFixIntentIssueRefs(commitText: string): number[]; export declare function extractIssueRefs(text: string): number[]; /** * Identify issues that GitHub will already auto-close from a PR body — * that is, ones already on a `Close[s|d]/Fix[es|ed]/Resolve[s|d] #N` form. * Returns them as a Set so callers can subtract. */ export declare function existingAutoCloseRefs(prBody: string): Set; interface FinalizeResult { pr: number; branch: string; found: number[]; alreadyClosed: number[]; toAdd: number[]; newBodyAppendix: string | null; applied: boolean; } /** * Compute the finalize plan without applying it. Pure-ish (only reads * git/gh state). Test-friendly. */ export declare function planPrFinalize(opts: FinalizeOptions): Promise; export {}; //# sourceMappingURL=pr.d.ts.map