import type { NativePortableState } from './native-portable-types.js'; import type { NativeChangeState, NativeProjectPaths } from './native-types.js'; import type { NativeWorkspaceFinish, NativeWorkspaceIdentityV3 } from './native-workspace.js'; import type { WorkflowNativePullRequestFinishConfig } from '../workflow-contract/types.js'; import { type NativePullRequestFinishOutcome } from './native-pull-request-finish.js'; export interface NativeWorkspaceFinishPlan { commitMessage?: string; mergeMessage?: string | null; finish: NativeWorkspaceFinish; changeRoot: string; primaryRoot: string; changeBranch: string; targetBranch: string; targetRoot: string | null; remote: string | null; isolation: 'current' | 'branch' | 'worktree'; pullRequestFinish: WorkflowNativePullRequestFinishConfig | null; } export interface NativeWorkspaceFinishResult { action: NativeWorkspaceFinish; status: 'completed' | 'kept' | 'blocked'; commit: string | null; remote: string | null; pushed: boolean; pullRequestUrl: string | null; pullRequest: NativePullRequestFinishOutcome | null; merged: boolean; targetRoot: string | null; cleanup: { performed: boolean; reason: string | null; }; blockedPaths: string[]; message: string | null; diagnosticArgs: string[] | null; recoveryArgs: string[] | null; } export declare const NATIVE_WORKSPACE_FINISH_JOURNAL_SCHEMA: "comet.native.workspace-finish.v1"; export interface NativeWorkspaceFinishJournal { schema: typeof NATIVE_WORKSPACE_FINISH_JOURNAL_SCHEMA; name: string; transactionId: string; archiveDir: string | null; status: 'pending' | 'blocked'; result: NativeWorkspaceFinishResult | null; updatedAt: string; createdAt?: string; plan?: NativeWorkspaceFinishPlan; commit?: { parent: string; paths: string[]; entries: string[]; sha: string | null; }; merge?: { target: string; source: string; sha: string | null; }; } export interface NativeWorkspaceFinishJournalReadOptions { /** * Status discovery is best-effort across every worktree. A malformed * journal in one workspace must become a visible diagnostic instead of * aborting discovery for all other changes. Mutating callers omit this * callback so invalid data still fails closed before a mutation. */ onError?: (name: string, message: string) => void; } export declare function validateNativeWorkspaceFinishMessage(message: string, flag: string): void; export declare function readNativeWorkspaceFinishJournal(paths: Pick, name: string, options?: NativeWorkspaceFinishJournalReadOptions): Promise; export declare function listNativeWorkspaceFinishJournals(paths: Pick, options?: NativeWorkspaceFinishJournalReadOptions): Promise; /** * Preserve a corrupt finish journal for forensics while removing it from the * active transaction namespace. This is intentionally an explicit doctor * repair operation; normal status/archive reads never discard recovery data. */ export declare function quarantineNativeWorkspaceFinishJournal(paths: Pick, name: string): Promise; export declare function writeNativeWorkspaceFinishJournal(paths: Pick, journal: NativeWorkspaceFinishJournal): Promise; export declare function clearNativeWorkspaceFinishJournal(paths: Pick, name: string): Promise; export declare function prepareNativeWorkspaceFinishMessages(options: { name: string; plan: NativeWorkspaceFinishPlan; journal?: NativeWorkspaceFinishJournal | null; commitMessage?: string; mergeMessage?: string; }): Promise; export declare function readNativeWorkspaceFinishArchive(paths: NativeProjectPaths, journal: NativeWorkspaceFinishJournal): Promise; /** Read-only reconciliation: Doctor never creates a commit, push, or merge. */ export declare function inspectNativeWorkspaceFinishCompletion(paths: NativeProjectPaths, journal: NativeWorkspaceFinishJournal): Promise; export declare class NativeWorkspaceFinishError extends Error { readonly result: NativeWorkspaceFinishResult; constructor(result: NativeWorkspaceFinishResult); } /** * Raised before Archive mutates anything when the Git working tree contains * paths outside the change-owned finish scope. Keeping the paths on the * error lets the CLI return a complete, machine-readable blocker list. */ export declare class NativeWorkspaceFinishPreparationError extends Error { readonly paths: string[]; readonly workspaceRoot: string; constructor(paths: string[], workspaceRoot: string, messagePrefix?: string); } type NativeWorkspaceFinishState = Pick | Pick; export declare function prepareNativeWorkspaceFinish(options: { paths: NativeProjectPaths; state: NativeChangeState; workspace: NativeWorkspaceIdentityV3; pullRequestFinish?: WorkflowNativePullRequestFinishConfig; }): Promise; /** * Prepare Git finishing directly from the portable YAML binding. * * Unlike the legacy workspace identity this deliberately does not create or * compare root hashes. The current Git worktree registration and branch are * the only local facts needed before the user-authorized finish action. */ export declare function prepareNativePortableWorkspaceFinish(options: { paths: NativeProjectPaths; state: NativePortableState; archiveDir?: string; appliedSpecChanges?: readonly { capability: string; }[]; pullRequestFinish?: WorkflowNativePullRequestFinishConfig; }): Promise; export declare function finishArchivedNativeWorkspace(options: { paths: NativeProjectPaths; state: NativeWorkspaceFinishState; name: string; archiveDir: string; transactionId: string; plan: NativeWorkspaceFinishPlan; }): Promise; export {}; //# sourceMappingURL=native-workspace-finish.d.ts.map