/** * Stack engine — detect stacks from metadata, build ordering, integrity checks. */ import * as git from './git.js'; import * as github from './github.js'; import { type StackMetadata } from './metadata.js'; export interface StackEntry { /** Commit hash */ hash: string; shortHash: string; subject: string; /** ghls metadata (null if commit not yet stamped) */ meta: StackMetadata | null; /** Associated PR (null if not yet submitted) */ pr: github.PullRequest | null; /** Diff stats for this commit */ stats: git.DiffStats | null; /** Remote branch name for this entry */ remoteBranch: string; } export interface Stack { id: string; baseBranch: string; entries: StackEntry[]; } /** * Build a stack from the current branch's commits since baseBranch. * Fetches should be done by caller so origin/baseBranch is up to date. * If the branch has a huge history vs base, uses upstream ref so we show only "your" commits. */ export declare function buildStack(baseBranch: string, branchTemplate: string, cwd?: string): Promise; /** * Hydrate stack with PR data from GitHub. */ export declare function hydrateWithPRs(stack: Stack): Promise; /** * Hydrate stack with diff stats for each commit (parallel, each with timeout). */ export declare function hydrateWithStats(stack: Stack, cwd?: string): Promise; /** * Validate stack integrity — check ordering, no gaps, consistent stack id. */ export declare function validateStack(stack: Stack): void; /** * Generate a markdown visualization of the stack for PR descriptions. * Shows a navigable table with status indicators and position context. */ export declare function renderStackComment(stack: Stack, currentPrNumber?: number): string; /** * Extract the user-authored PR body content (everything outside ghls-stack markers). * Preserves any text the author wrote before or after the stack section. */ export declare function extractUserBody(body: string): string; /** * Merge user body with stack visualization. * Stack section goes at the bottom, user content stays on top. */ export declare function mergeBodyWithStack(userBody: string, stack: Stack, currentPrNumber?: number): string; //# sourceMappingURL=stack.d.ts.map