/**
 * Release manifest operations backed by the release_manifests SQLite table.
 *
 * Migrated from .cleo/releases.json to SQLite per T5580.
 * All reads/writes now go through Drizzle ORM via tasks.db.
 *
 * @task T5580
 * @task T4788
 */
import { createPage } from '../pagination.js';
import type { ReleaseChannel } from './channel.js';
import type { PushMode } from './release-config.js';
/** Release manifest structure. */
export interface ReleaseManifest {
    version: string;
    status: 'draft' | 'prepared' | 'committed' | 'tagged' | 'pushed' | 'rolled_back';
    createdAt: string;
    preparedAt?: string;
    committedAt?: string;
    taggedAt?: string;
    pushedAt?: string;
    tasks: string[];
    notes?: string;
    changelog?: string;
    previousVersion?: string;
    commitSha?: string;
    gitTag?: string;
}
export interface ReleaseListOptions {
    status?: ReleaseManifest['status'];
    limit?: number;
    offset?: number;
}
/** Task record shape needed for release operations. */
export interface ReleaseTaskRecord {
    id: string;
    title: string;
    status: string;
    parentId?: string;
    completedAt?: string | null;
    labels?: string[];
    /** Structured task type — 'epic' | 'task' | 'subtask'. Used for changelog filtering and categorization. */
    type?: string;
    /** Task description. Used to enrich changelog entries when meaningfully different from the title. */
    description?: string;
}
/**
 * Prepare a release (create a release manifest entry).
 * @task T4788
 */
export declare function prepareRelease(version: string, tasks: string[] | undefined, notes: string | undefined, loadTasksFn: () => Promise<ReleaseTaskRecord[]>, cwd?: string): Promise<{
    version: string;
    status: string;
    tasks: string[];
    taskCount: number;
}>;
/**
 * Generate changelog for a release.
 * @task T4788
 */
export declare function generateReleaseChangelog(version: string, loadTasksFn: () => Promise<ReleaseTaskRecord[]>, cwd?: string): Promise<{
    version: string;
    changelog: string;
    taskCount: number;
    sections: Record<string, number>;
}>;
/**
 * List all releases.
 * @task T4788
 */
export declare function listManifestReleases(optionsOrCwd?: ReleaseListOptions | string, cwd?: string): Promise<{
    releases: Array<{
        version: string;
        status: string;
        createdAt: string;
        taskCount: number;
    }>;
    total: number;
    filtered: number;
    latest?: string;
    page: ReturnType<typeof createPage>;
}>;
/**
 * Show release details.
 * @task T4788
 */
export declare function showManifestRelease(version: string, cwd?: string): Promise<ReleaseManifest>;
/**
 * Mark release as committed (metadata only).
 * @task T4788
 */
export declare function commitRelease(version: string, cwd?: string): Promise<{
    version: string;
    status: string;
    committedAt: string;
}>;
/**
 * Mark release as tagged (metadata only).
 * @task T4788
 */
export declare function tagRelease(version: string, cwd?: string): Promise<{
    version: string;
    status: string;
    taggedAt: string;
}>;
/**
 * Run release validation gates.
 * @task T4788
 * @task T5586
 */
export declare function runReleaseGates(version: string, loadTasksFn: () => Promise<ReleaseTaskRecord[]>, cwd?: string, opts?: {
    dryRun?: boolean;
}): Promise<{
    version: string;
    allPassed: boolean;
    gates: Array<{
        name: string;
        status: 'passed' | 'failed';
        message: string;
    }>;
    passedCount: number;
    failedCount: number;
    metadata: ReleaseGateMetadata;
}>;
/**
 * Cancel and remove a release in draft or prepared state.
 * Only releases that have not yet been committed to git can be cancelled.
 * For committed/tagged/pushed releases, use rollbackRelease() instead.
 *
 * @task T5602
 */
export declare function cancelRelease(version: string, projectRoot?: string): Promise<{
    success: boolean;
    message: string;
    version: string;
}>;
/**
 * Rollback a release.
 * @task T4788
 */
export declare function rollbackRelease(version: string, reason?: string, cwd?: string): Promise<{
    version: string;
    previousStatus: string;
    status: string;
    reason: string;
}>;
/**
 * Metadata captured during gate evaluation, returned alongside gate results.
 * Downstream (engine layer) uses this to determine PR vs direct push.
 */
export interface ReleaseGateMetadata {
    /** npm dist-tag channel resolved from the current branch. */
    channel: ReleaseChannel;
    /** Whether the target branch requires a PR (branch protection detected or mode='pr'). */
    requiresPR: boolean;
    /** Branch that should be targeted for this release type. */
    targetBranch: string;
    /** Branch the repo is currently on. */
    currentBranch: string;
}
/** Push policy configuration from config.release.push. */
export interface PushPolicy {
    enabled?: boolean;
    remote?: string;
    requireCleanTree?: boolean;
    allowedBranches?: string[];
    /** Push mode override: 'direct' | 'pr' | 'auto' (default: 'direct'). */
    mode?: PushMode;
    /** Override PR target branch (default: auto-detected from GitFlow config). */
    prBase?: string;
}
/**
 * Push release to remote via git.
 *
 * Respects config.release.push policy:
 * - remote: override default remote (fallback to 'origin')
 * - requireCleanTree: verify git working tree is clean before push
 * - allowedBranches: verify current branch is in the allowed list
 * - enabled: if false and no explicit push flag, caller should skip
 *
 * @task T4788
 * @task T4276
 */
export declare function pushRelease(version: string, remote?: string, cwd?: string, opts?: {
    explicitPush?: boolean;
    mode?: PushMode;
    prBase?: string;
    epicId?: string;
    guided?: boolean;
}): Promise<{
    version: string;
    status: string;
    remote: string;
    pushedAt: string;
    requiresPR?: boolean;
}>;
/**
 * Update release status after push, with optional provenance fields.
 * @task T4788
 * @task T5580
 */
export declare function markReleasePushed(version: string, pushedAt: string, cwd?: string, provenance?: {
    commitSha?: string;
    gitTag?: string;
}): Promise<void>;
/**
 * One-time migration: read .cleo/releases.json and insert each release into
 * the release_manifests table. Renames the file to releases.json.migrated on success.
 *
 * @task T5580
 */
export declare function migrateReleasesJsonToSqlite(projectRoot?: string): Promise<{
    migrated: number;
}>;
//# sourceMappingURL=release-manifest.d.ts.map