UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

66 lines • 3.36 kB
import type { NOOPAccessor } from '../../../../accessor/base.ts'; import type { PathSpec } from '../../../../types.ts'; import type { CommandFnResult, Context } from '../../../config.ts'; import type { RepoLocation } from './types.ts'; import type { Files } from '../../../../workspace/files.ts'; export declare const LOGS_DIR = "logs"; export declare const ZERO: string; export declare const IDENTITY = "mirage <mirage@localhost>"; /** * One reflog line, in git's own format. * * `<old> <new> <identity> <epoch> <offset>\t<message>`, with the old id all * zeroes when there was nothing there before. The tab is load-bearing: it is * what separates the fixed fields from a message that may itself contain spaces. * An empty message leaves the tab out, as git does. * * @param before the id the ref held, zeroes when it held none * @param after the id it now holds * @param who the identity, `Name <email>` * @param when epoch seconds * @param message what happened, e.g. `commit: add delta` */ export declare function entry(before: string, after: string, who: string, when: number, message: string): Uint8Array; /** * Add one line to a reflog, creating it if it is not there. * * Read-modify-write rather than an append op, because not every backend offers * one and a reflog is small. Losing the history here would only cost the `@{n}` * syntax, but `git branch` reads it to say where a detached HEAD detached from, * so an absent log makes a perfectly good checkout read as `(no branch)`. */ export declare function append(vfs: Files, gitdir: PathSpec, path: string, line: Uint8Array): Promise<void>; /** * Whether an update to a ref is logged: always where its log already exists, * and otherwise as `core.logAllRefUpdates` says, which defaults to HEAD and the * branch, remote and notes refs outside a bare repository, and to nothing in * one. * * @param vfs the session's files * @param location the discovered repository * @param name the full ref name * @param log the path of its log */ export declare function logged(vfs: Files, location: RepoLocation, name: string, log: PathSpec): Promise<boolean>; /** * Record one move of HEAD, and of the branch it is on. * * git writes both logs on every update: `logs/HEAD` always, and the branch's own * log when HEAD is attached to one. Both carry the same line. HEAD's log belongs * to the checkout and a branch's to the repository, so a linked worktree splits * them the way git does. * * @param vfs the session's files * @param gitdir this checkout's git directory, which owns HEAD's log * @param commondir the shared git directory, which owns the branches' logs * @param ref the branch ref that also moved, null when HEAD is detached * @param before the id HEAD held, null when it held none * @param after the id it now holds * @param who the identity to record * @param when epoch seconds * @param message what happened */ export declare function record(vfs: Files, gitdir: PathSpec, commondir: PathSpec, ref: string | null, before: string | null, after: string, who: string, when: number, message: string): Promise<void>; /** Read a ref's log newest first through the dispatcher. */ export declare function reflog(_accessor: NOOPAccessor, paths: PathSpec[], texts: string[], ctx: Context): Promise<CommandFnResult>; //# sourceMappingURL=reflog.d.ts.map