@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
41 lines • 2.28 kB
TypeScript
import type { NOOPAccessor } from '../../../../accessor/base.ts';
import { type FileStat, type PathSpec } from '../../../../types.ts';
import type { CommandFnResult, Context } from '../../../config.ts';
import { type StagedEntry } from './index_file.ts';
import { type Repo } from './repo.ts';
import type { IndexEntry, IndexState, WorkTree } from './types.ts';
import type { Files } from '../../../../workspace/files.ts';
/** The mode git would record for a working-tree file. */
export declare function entryMode(info: FileStat): number;
/**
* Hash the staged paths into blobs, leaving the index to the caller.
*
* Returns the entries to write and what `-v` prints, in git's order: first the
* paths the index already held whose content or mode changed, a removal among
* them, then the new paths, each group sorted. A path restaged unchanged is not
* named (pinned against git 2.50).
*/
export declare function stageChanges(repo: Repo, vfs: Files, entries: ReadonlyMap<string, IndexEntry>, found: WorkTree, stage: ReadonlySet<string>, remove: ReadonlySet<string>): Promise<[Map<string, StagedEntry>, string[]]>;
/**
* Restage every path the index holds from the working tree.
*
* What `add -u` does with no pathspec and `commit -a` does first: a modified
* file is hashed again, a deleted one leaves the index, and an untracked one
* stays untracked. `state` is updated to match; the caller writes the returned
* entries and removals with `updateIndex` once it means to keep them.
*/
export declare function stageTracked(repo: Repo, vfs: Files, state: IndexState): Promise<[Map<string, StagedEntry>, Set<string>]>;
/**
* Stage working-tree content into the index.
*
* Every path is hashed and written as a loose object, then recorded in the
* index. Staging a path that is gone records the removal instead, which is what
* makes `git add <deleted>` and `git add -A` stage a deletion without a separate
* verb.
*
* `-A` and `-u` both narrow to the pathspecs when any are given, and differ in
* what they will stage: `-A` takes untracked files too, `-u` only what the index
* already holds.
*/
export declare function add(_accessor: NOOPAccessor, paths: PathSpec[], texts: string[], ctx: Context): Promise<CommandFnResult>;
//# sourceMappingURL=add.d.ts.map