/**
 * Post-Execution Transition Hook
 *
 * Handles automatic ticket state transitions after an action execution completes.
 * Primary use case: when the implement action completes and a PR was created,
 * automatically move the ticket from In Progress to Review.
 *
 * Includes commit validation (PRLT-984): before auto-transitioning, checks that
 * meaningful code was committed on the branch. Prevents agents that only wrote
 * boilerplate (README) from being marked as ready for review.
 *
 * Uses the provider abstraction to write directly to the configured provider
 * (Linear, Jira, etc.) — not through the local PMO as a cache layer.
 * The local PMO is just the default provider for users without integrations.
 */
import Database from 'better-sqlite3';
import type { StateCategory } from '../pmo/types.js';
import type { ProviderStorage } from '../providers/types.js';
import { type CommitValidationResult } from '../execution/commit-validation.js';
export interface PostExecutionContext {
    ticketId: string;
    actionId?: string;
    /** Agent name — used to resolve the agent's repository for commit validation */
    agentName?: string;
    /** Branch name — used for commit validation */
    branch?: string;
    /** Agent directory path — used to find the git repository */
    agentDir?: string;
    /** Repo worktree names within agentDir */
    repoWorktrees?: string[];
}
export interface PostExecutionResult {
    transitioned: boolean;
    fromState?: string;
    toState?: string;
    /** Which provider handled the transition */
    provider?: string;
    /** Error from the provider (transition may have partially succeeded) */
    providerError?: string;
    /** Commit validation result (PRLT-984) — present when validation was attempted */
    validation?: CommitValidationResult;
    /** True if the transition was blocked by commit validation */
    blockedByValidation?: boolean;
}
/**
 * Minimal storage interface for post-execution transitions.
 * @deprecated Use ProviderStorage from providers/types.ts instead.
 */
export interface PostExecutionStorage {
    getTicket: (id: string) => Promise<{
        id: string;
        projectId?: string;
        statusName?: string;
        statusCategory?: StateCategory | null;
        metadata?: Record<string, string> | null;
    } | null>;
    getProjectBoard: (projectId: string) => Promise<{
        columns: Array<{
            name: string;
        }>;
    } | null>;
    moveTicket: (projectId: string, ticketId: string, columnName: string) => Promise<unknown>;
}
/**
 * Check if a completed execution should trigger an automatic state transition.
 *
 * When an execution completes and the ticket:
 * 1. Is in a "started" category (e.g., In Progress)
 * 2. Has a PR URL in its metadata
 * 3. Has meaningful code committed (not just boilerplate) — PRLT-984
 *
 * Then automatically move the ticket to the Review column via the appropriate
 * provider (Linear, Jira, or local PMO).
 *
 * Provider resolution:
 * - If the ticket has an external_source (e.g., 'linear') and that provider
 *   is configured, write directly to that provider's API.
 * - Otherwise, write to the local PMO (default for users without integrations).
 *
 * @param context - Execution context with ticket and optional action/agent info
 * @param storage - PMO storage instance for ticket operations
 * @param db - Database for work column settings and provider config
 * @returns Result indicating whether a transition occurred
 */
export declare function handlePostExecutionTransition(context: PostExecutionContext, storage: PostExecutionStorage | ProviderStorage, db: Database.Database): Promise<PostExecutionResult>;
