/** * Bare-path diff helper for `qfg push`. * * When the user's local dir is NOT a clone of the cloud repo (no `.git/`, or * a mismatched origin) we still need to show a Guard 3 diff summary BEFORE * asking them to confirm the push. The clone-path implementation uses * `git log origin/main..HEAD` — that doesn't work here because there is no * origin in the local dir. * * Strategy: probe-clone the cloud repo into an OS tmpdir, then walk both * trees file-by-file and classify each as added / modified / deleted. * * The caller owns cleanup of `scratchDir`. The real caller (buildRealDeps in * `commands/push.ts`) stashes the scratch clone path on a closure so it can * delete it in a finally-block after runPush resolves — matching the bare * path's existing scratch-clone lifecycle in `run-push.ts`. * * Intentional non-goals: * - No token handling. Caller passes a fully-authenticated `remoteUrl`. * - No filtering to "known" workspace dirs (configs/, feature-flags/, ...). * We exclude dotfiles/dotdirs (`.git`, `.DS_Store`, `.quonfig-*`) so the * scratch clone's own `.git/` does not leak into the diff, but otherwise * diff whatever is on disk. This keeps the diff surface consistent with * `copyDirMirror` in `commands/push.ts`, which mirrors every non-dotfile * into the real push clone. */ import { FileDelta } from './diff-summary.js'; export interface BarePathDiffResult { deltas: FileDelta[]; /** * The probe clone's HEAD sha — the workspace's current tip on the cloud * repo. Threaded into `configs.push` as `expectedSha` so the server-side * optimistic lock (qfg-gj3i) accepts bare-path pushes instead of rejecting * them with a forced-upgrade 426. */ remoteHeadSha: string; /** Tmp dir holding the probe clone. Caller must rm -rf in a finally block. */ scratchDir: string; /** Total file count in the scratch clone (under the same prefix rules as `deltas`). */ totalRemoteFiles: number; } /** * Clone `remoteUrl` into an OS tmp dir, then diff the working tree of `localDir` * against the scratch clone's working tree. Returns `FileDelta[]` plus the * scratch clone's file count. */ export declare function computeBarePathDiff(localDir: string, remoteUrl: string): Promise;