/** * Git plumbing for the cross-machine presence transport (ADR 0016). * * Presence blobs travel as parentless commits (empty tree, JSON message) * force-pushed to `refs/harnery/presence/` on the host repo's own * `origin`. Non-branch refs: invisible to branch tooling, safe to force-push, * no history accumulation. The remote is the rendezvous every install already * shares, and repo access is the ACL. * * Everything here is best-effort and fail-silent by design — presence must * never break a hook or a render. Network operations (push/fetch) run either * detached (hook path: never block a turn) or synchronously (CLI path: the * user wants to see errors). */ /** The ref namespace. Hardcoded — never interpolated from config — so the * publisher is structurally unable to touch refs/heads/* (ADR 0016). */ export declare const PRESENCE_REF_PREFIX = "refs/harnery/presence/"; /** Does the repo have an `origin` remote to rendezvous on? */ export declare function hasOrigin(root: string): boolean; /** The origin remote URL, or null. Input to relay room derivation. */ export declare function originUrl(root: string): string | null; /** * The repo's root-commit SHA — the stable repo-identity input to relay room * derivation. Repos can have multiple roots (merged histories); the list is * sorted so every clone picks the same one. Null when the repo has no commits. */ export declare function rootCommitSha(root: string): string | null; /** * Sanitize a machine label into a valid single ref component: lowercase, * [a-z0-9._-] only, no leading dot, no `.lock` suffix, never empty. */ export declare function sanitizeRefComponent(label: string): string; /** Build the parentless presence commit carrying `message` (the JSON blob). * Returns the commit sha, or null on failure. Local-only, fast (~10ms). */ export declare function writePresenceCommit(root: string, message: string): string | null; /** * Force-push a presence commit to `refs/harnery/presence/`. * `sync: true` (CLI/tests) waits and reports; default is detached fire-and- * forget (hook path — a slow or credential-less push must not block a turn). */ export declare function pushPresenceRef(root: string, machine: string, sha: string, opts?: { sync?: boolean; }): { ok: boolean; error?: string; }; /** Fetch every peer presence ref from origin into the local ref namespace. */ export declare function fetchPresenceRefs(root: string, opts?: { sync?: boolean; }): { ok: boolean; error?: string; }; /** Read every locally-known presence ref → [{ref, machine, message}]. */ export declare function readPresenceRefs(root: string): Array<{ machine: string; message: string; }>; /** * Parse `for-each-ref --format='%(refname)%00%(contents)%01'` output. * Records are %01-terminated (contents may contain newlines); refname and * contents are %00-separated. Exported for unit tests. */ export declare function parseForEachRefOutput(out: string): Array<{ machine: string; message: string; }>; //# sourceMappingURL=git.d.ts.map