@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
45 lines • 2.28 kB
TypeScript
import type { NOOPAccessor } from '../../../../accessor/base.ts';
import type { SessionView } from '../../../../view/types.ts';
import type { PathSpec } from '../../../../types.ts';
import type { CommandFnResult, Context } from '../../../config.ts';
import { FlagView } from '../../../spec/flag_view.ts';
/** An author string split into the two halves git records separately. */
export interface Identity {
readonly name: string;
readonly email: string;
/** The `Name <email>` spelling, which is what a reflog line carries. */
readonly line: string;
}
/**
* Who to record as author and committer.
*
* Three sources, in git's own order: `--author` outranks the environment, and
* the environment outranks the fallback. git reads `GIT_AUTHOR_NAME` and
* `GIT_AUTHOR_EMAIL`, with `EMAIL` as the fallback address, all pinned against
* git 2.50.
*
* Two deliberate divergences, both because a config file is not reachable from
* a mount. `user.name`/`user.email` are never consulted, so the environment is
* the only place a real identity can come from; and where git refuses to commit
* with no identity at all, mirage records a stated default rather than a guess
* at the operator's name. The committer is the author here, where git tracks
* `GIT_COMMITTER_*` separately.
*
* Read through the session view rather than the frozen `ctx.env`
* snapshot, so a hidden name reads as unset exactly as it does in the shell.
*/
export declare function identity(fl: FlagView, session: SessionView | undefined): Identity;
/**
* Record the index as a new commit on the current branch.
*
* The message must come from `-m`: git would otherwise open an editor, which a
* mount has no way to offer, and inventing a message would put an unreviewed one
* into history.
*
* `-a` restages every tracked path first, as `add -u` would, and the index keeps
* that staging only once the commit is written. git's `-a` also resolves
* conflicted paths and records a merge commit from `MERGE_HEAD`; this build
* writes no merge commits, so an unmerged index is refused with or without `-a`.
*/
export declare function commit(_accessor: NOOPAccessor, paths: PathSpec[], texts: string[], ctx: Context): Promise<CommandFnResult>;
//# sourceMappingURL=commit.d.ts.map