import type { GitShipAction, GitShipActionKind, GitShipResult, GitShipState } from "@kenkaiiii/gg-protocol"; /** How much diff text the commit-message writer sees. */ export declare const MESSAGE_DIFF_LIMIT = 40000; export type ShipStage = "branch" | "commit" | "push" | "pr" | "pull"; /** A ship step git (or gh) refused. `done` lists what already happened. */ export declare class GitShipError extends Error { readonly stage: ShipStage; readonly detail: string; readonly done: readonly string[]; name: string; constructor(stage: ShipStage, detail: string, done: readonly string[]); } /** Runs `gh` in `cwd`; rejects with its last lines. Injectable for tests. */ export type GhRunner = (args: readonly string[], cwd: string) => Promise; export declare const runGh: GhRunner; /** Everything the ship button decides from. Throws when `dir` isn't a repo. */ /** Files `add -A` would stage. Throws when `dir` isn't a repo. */ export declare function changeCount(dir: string): Promise; export declare function readShipState(dir: string, gh?: GhRunner): Promise; /** The ship button's one action for `state` (see the table in the plan). */ export declare function resolveShipAction(state: GitShipState): GitShipAction; /** What the commit-message writer reads: the stat, untracked names, and a capped diff. */ export declare function shipDiffForMessage(dir: string): Promise; /** "gg/fix-login-redirect" from a commit subject, unique among `taken`. */ export declare function branchNameFor(subject: string, taken: ReadonlySet): string; export interface ShipRequest { dir: string; state: GitShipState; kind: GitShipActionKind; /** The full commit message (subject, blank line, body); commit kinds only. */ message: string; /** Create this branch first and open a PR from it ("Open a PR instead"). */ newBranch?: string | null; worktreesRoot: string; gh?: GhRunner; } /** Run the ship action. Throws `GitShipError` with git's own words when a step fails. */ export declare function ship(req: ShipRequest): Promise; /** What the agent is told after the user shipped from the Git panel. */ export declare function shipNote(result: GitShipResult, message: string): string; /** The agent note for a ship that stopped part way. */ export declare function partialShipNote(error: GitShipError): string;