/** Sprint lifecycle phases */ export declare const SPRINT_PHASES: readonly ["planning", "reviewing", "implementing", "scoring", "complete"]; export type SprintPhase = typeof SPRINT_PHASES[number]; /** Gate names that must be completed before PR */ export type GateName = 'tests' | 'code_review' | 'architect_review' | 'scorecard' | 'review_md'; export type ReviewGateName = Extract; export type ReviewGateProvenance = 'pending' | 'self_review' | 'independent_review' | 'independent_review_waived' | 'manual_override' | 'pr_review'; export type ReviewGateCompletionProvenance = Exclude; export type ReviewGatePriority = 'required' | 'recommended' | 'optional' | 'unspecified'; export type ReviewGateVerdict = 'pass' | 'changes_requested' | 'blocked'; export interface ReviewGateRequirement { priority: ReviewGatePriority; reason?: string; source?: string; updated_at?: string; } export interface ReviewGateRequirementInput { gate: ReviewGateName; priority: Exclude; reason?: string; source?: string; } export interface ReviewGateState { provenance: ReviewGateProvenance; evidence: string[]; reviewer?: string; notes?: string; verdict?: ReviewGateVerdict; packet?: string; reviewed_commit?: string; token_budget?: string; tokens_used?: number; over_budget_reason?: string; updated_at?: string; } export interface ReviewGateCompletionInput { provenance: ReviewGateCompletionProvenance; evidence?: string[]; reviewer?: string; notes?: string; verdict?: ReviewGateVerdict; packet?: string; reviewed_commit?: string; token_budget?: string; tokens_used?: number; over_budget_reason?: string; } export interface UpdateGateOptions { review?: ReviewGateCompletionInput; } /** Sprint state persisted to .slope/sprint-state.json */ export interface SprintState { sprint: number; phase: SprintPhase; gates: Record; review_gates: Record; review_requirements?: Record; started_at: string; updated_at: string; rollover?: SprintRolloverLineage; } export interface SprintRolloverLineage { transition_id: string; from_sprint: number; audit_path: string; recorded_at: string; forced: boolean; reason?: string; } export type SprintStateLoadResult = { status: 'missing'; } | { status: 'corrupt'; path: string; } | { status: 'valid'; state: SprintState; }; export type SprintStateInitializationResult = { status: 'created'; state: SprintState; } | { status: 'existing'; state: SprintState; } | { status: 'corrupt'; path: string; }; /** Validate a user-provided sprint lifecycle phase. */ export declare function isSprintPhase(value: string): value is SprintPhase; export declare function isReviewGateName(value: string): value is ReviewGateName; export declare function createDefaultReviewGates(): Record; export declare function createDefaultReviewRequirements(): Record; export declare function isReviewGateVerdict(value: unknown): value is ReviewGateVerdict; export declare function validateReviewGateCompletion(input: ReviewGateCompletionInput | undefined): string | null; export declare function isReviewGateSatisfied(state: SprintState, gate: ReviewGateName): boolean; export declare function isRequiredReviewGate(state: SprintState, gate: ReviewGateName): boolean; export declare function waivedReviewGateNames(state: SprintState): ReviewGateName[]; /** Load sprint state from .slope/sprint-state.json. Returns null if missing or malformed. */ export declare function loadSprintState(cwd: string): SprintState | null; /** Strict persisted-state shape used at mutation and rollover trust boundaries. */ export declare function isValidSprintStateEvidence(value: unknown): value is SprintState; /** Distinguish absent local state from corrupt evidence that must fail closed. */ export declare function loadSprintStateResult(cwd: string): SprintStateLoadResult; /** True when sprint-state represents an active workflow sprint. */ export declare function isActiveSprintState(state: SprintState | null): state is SprintState; /** Save sprint state atomically via unique tmp + rename. */ export declare function saveSprintState(cwd: string, state: SprintState): void; /** Mutate sprint state while holding the state file lock. Returns null if missing/corrupt. */ export declare function mutateSprintState(cwd: string, mutator: (state: SprintState) => boolean): SprintState | null; /** Update a single gate and save. Returns false when a review gate lacks required provenance. */ export declare function updateGate(cwd: string, gate: GateName, value: boolean, options?: UpdateGateOptions): boolean; /** Create sprint state only when the tracked local slot is truly absent. */ export declare function initializeSprintState(cwd: string, state: SprintState): SprintStateInitializationResult; export interface SprintStateReplacement { previous: SprintState; current: SprintState; replaced: boolean; } /** * Replace sprint state while holding the same lock used by ordinary mutations. * The replacer may persist prerequisite audit evidence before returning the * new state. Returning null leaves the current state untouched. */ export declare function replaceSprintState(cwd: string, replacer: (state: SprintState) => SprintState | null): SprintStateReplacement | null; /** Persist review priorities inferred by `slope review recommend` for the matching active sprint. */ export declare function updateReviewRequirements(cwd: string, sprint: number, inputs: ReviewGateRequirementInput[]): boolean; /** Update the current sprint lifecycle phase. */ export declare function updateSprintPhase(cwd: string, phase: SprintPhase): SprintState | null; export interface ConditionalSprintPhaseUpdate { state: SprintState | null; matched: boolean; changed: boolean; } /** Update phase only if the state still represents the observed sprint. */ export declare function updateSprintPhaseForSprint(cwd: string, expectedSprint: number, phase: SprintPhase): ConditionalSprintPhaseUpdate; export interface WorktreePhaseReconcile { /** Checkout root whose sprint state was inspected. */ path: string; /** True when that checkout's state was for the expected sprint. */ matched: boolean; /** True when the phase actually changed. */ changed: boolean; } /** * Apply a conditional phase update to every checkout of this repository. * * Sprint state is per checkout, so reconciling only `cwd` left sibling worktrees * reporting an already-merged sprint as still in progress — agents then received * contradictory next actions and could restart completed work (GH #624). * Checkouts whose state is for a different sprint are reported as unmatched and * left untouched, so unrelated in-flight work is never clobbered. */ export declare function updateSprintPhaseForSprintAcrossWorktrees(cwd: string, expectedSprint: number, phase: SprintPhase): WorktreePhaseReconcile[]; /** Check if all gates are true. */ export declare function isSprintComplete(state: SprintState): boolean; /** Return machine-readable names of incomplete gates. */ export declare function pendingGateNames(state: SprintState): GateName[]; /** Return human-readable list of incomplete gates. */ export declare function pendingGates(state: SprintState): string[]; /** Create a fresh sprint state with all gates false. */ export declare function createSprintState(sprint: number, phase?: SprintPhase): SprintState; /** Delete the sprint state file. */ export declare function clearSprintState(cwd: string): void; //# sourceMappingURL=sprint-state.d.ts.map