import type { CheckoutManifest } from "./checkoutWiki.js"; import { type AuthMode } from "./hydrateWiki.js"; export interface BuildPushZipOptions { includeSystem?: boolean; } export declare function buildZipFromLocalWiki(wikiDir: string, manifest: CheckoutManifest, opts?: BuildPushZipOptions): Promise; export interface LocalDiffOptions { baseUrl: string; apiKey: string; /** Defaults to "bearer" — a real user has a PAT, not the instance's shared key (GH #748). */ authMode?: AuthMode; fetchImpl?: typeof fetch; } export interface LocalDiffCounts { newCount: number; modifiedCount: number; unchangedCount: number; deletedCount: number; } /** * GH #762: compute the dry-run diff by hashing local files and comparing * against the cloud's compact page list (`GET /api/v1/pages?compact=true`), * which already carries a `revision` (sha256-16) per page for Postgres-backed * instances — no zip upload required. Returns `null` when the diff can't be * trusted client-side (system-file push, or a backend that doesn't expose * `revision` on the compact listing), signalling the caller to fall back to * the full zip-preview round trip so dry-run accuracy never degrades. */ export declare function computeLocalDiff(wikiDir: string, manifest: CheckoutManifest, opts: LocalDiffOptions & { includeSystem?: boolean; }): Promise; export interface StalenessCheckOptions { baseUrl: string; apiKey: string; /** Defaults to "bearer" — a real user has a PAT, not the instance's shared key (GH #748). */ authMode?: AuthMode; fetchImpl?: typeof fetch; } export interface StalenessResult { stale: boolean; changedPageCount: number; changedPages: string[]; } /** * GH #695 risk: a checkout left untouched while the cloud folder keeps * changing would silently delete those cloud-side changes on push. Detect it * by asking the cloud for anything in the checkout's folder changed since the * checkout's `exportedAt` timestamp — a non-empty result means push would * clobber content the local checkout never saw. */ export declare function checkStaleSinceCheckout(manifest: CheckoutManifest, opts: StalenessCheckOptions): Promise; export interface JobProgressInfo { processed: number; total: number; phase: string; } export interface JobResult { status: "queued" | "running" | "done" | "failed"; error?: string; progress?: JobProgressInfo; result?: Record; } export interface PushRunOptions { baseUrl: string; apiKey: string; /** Defaults to "bearer" — a real user has a PAT, not the instance's shared key (GH #748). */ authMode?: AuthMode; execute: boolean; confirmWholeWiki?: boolean; includeSystem?: boolean; fetchImpl?: typeof fetch; pollIntervalMs?: number; timeoutMs?: number; /** * GH #761: fired the moment the job id is known, before polling starts — * so a caller can print it (and how to check it later) before anything * that could kill the process client-side has a chance to. */ onJobCreated?: (jobId: string) => void; /** GH #762/#761: called on every poll tick where the job's reported progress changed, so the caller can print live progress during a long execute. */ onProgress?: (progress: JobProgressInfo) => void; } /** * GH #761: a single, non-polling status check for a job id obtained from a * prior run's onJobCreated (or from CLI output printed before a client-side * timeout/interrupt killed the process). Lets a user answer "did my push * actually land?" without re-running the whole push. */ export declare function checkPushJobStatus(jobId: string, opts: { baseUrl: string; apiKey: string; authMode?: AuthMode; fetchImpl?: typeof fetch; }): Promise; export declare function pushZipToCloud(zipBuffer: Buffer, opts: PushRunOptions): Promise>; export interface RunPushOptions { wikiDir: string; manifest: CheckoutManifest; baseUrl: string; apiKey: string; /** Defaults to "bearer" — a real user has a PAT, not the instance's shared key (GH #748). */ authMode?: AuthMode; /** Whether to actually apply changes (the CLI's --yes). False means dry-run only. */ execute: boolean; confirmWholeWiki?: boolean; includeSystem?: boolean; fetchImpl?: typeof fetch; pollIntervalMs?: number; timeoutMs?: number; onJobCreated?: (jobId: string) => void; onProgress?: (progress: JobProgressInfo) => void; } export interface RunPushResult { preview: LocalDiffCounts; /** True when the dry-run diff was computed by hashing local files against the cloud's compact page list, with no zip upload. */ usedLocalDiff: boolean; /** True when a real change set was applied to the cloud. */ executed: boolean; /** True when `execute` was requested but skipped because the diff showed nothing to do. */ skippedNoop: boolean; result?: Record; } /** * GH #762: the single entry point scripts/push-wiki.ts drives. Builds and * uploads the checkout zip **at most once** — for execute, and only when * there's something to apply — instead of the old always-upload-twice * (preview + execute) flow. The dry-run diff is computed by hashing local * files against the cloud's compact page-list revisions whenever the backend * supports it (see computeLocalDiff); a no-op push never touches the network * beyond that one cheap paginated GET. */ export declare function runPush(opts: RunPushOptions): Promise; //# sourceMappingURL=pushWiki.d.ts.map