@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
63 lines • 3.4 kB
TypeScript
import type { NOOPAccessor } from '../../../../accessor/base.ts';
import { type PathSpec } from '../../../../types.ts';
import type { CommandFnResult, Context } from '../../../config.ts';
import { type Repo } from './repo.ts';
import { type TreeEntry } from './tree.ts';
import type { IndexEntry, RepoLocation } from './types.ts';
import type { Files } from '../../../../workspace/files.ts';
/** The index read as a tree: every path with its mode and blob id. */
export declare function indexTree(entries: ReadonlyMap<string, IndexEntry>): Map<string, TreeEntry>;
/**
* Every path a `--source` names, commit-ish or tree-ish.
*
* git takes any tree-ish here, so a raw tree id
* (`--source=$(git rev-parse HEAD^{tree})`) is as good as a branch. A
* commit-ish is tried first because it is what the option is normally spelled
* with and it is the only form carrying ancestry suffixes; a revision neither
* reading resolves is unresolvable.
*/
export declare function sourceTree(repo: Repo, revision: string): Promise<[string, Map<string, TreeEntry>]>;
/**
* Put paths back to what a source records.
*
* Two targets and one source, git's own model. `--staged` restores the index
* and `--worktree` the working tree; the default is the working tree alone. The
* source is the index for the working tree and HEAD for the index unless
* `--source` names a tree, in which case a selected path the source does not
* hold is removed from whichever target is being restored, since that is what
* "make it match the source" means for it. Pinned against git 2.50.1.
*/
export declare function restore(_accessor: NOOPAccessor, paths: PathSpec[], texts: string[], ctx: Context): Promise<CommandFnResult>;
/**
* Ask the running command's rules about everything the working-tree pass writes
* or removes, before anything is: each entry restored or dropped, a
* non-directory standing in a restored entry's way, and every name under a
* directory a restored file replaces.
*
* @param vfs the session's files
* @param location the discovered repository
* @param replacing the entries written
* @param dropped the entries removed
* @throws PolicyDenied a rule refuses one of them
*/
export declare function refuseRuled(vfs: Files, location: RepoLocation, replacing: readonly string[], dropped: readonly string[]): Promise<void>;
/**
* Put selected paths back to what a source records: the work `restore` and
* `checkout`'s path form share.
*
* Under `overlay`, which is checkout's reading, a pathspec has to match the
* source and a path the index holds that the source does not is left as it
* is; without it, restore's own reading, such a path is removed.
*
* @param ctx the line's context, whose files git writes
* @param repo the opened repository
* @param operands the pathspecs as typed
* @param start the directory the line runs in
* @param source the tree to restore from, null for the index
* @param staged put the index back
* @param worktree put the working tree back
* @param overlay checkout's reading of the pathspecs
* @returns the warnings git prints, and how many working-tree files changed
*/
export declare function restorePaths(ctx: Context, repo: Repo, operands: readonly string[], start: string, source: Map<string, TreeEntry> | null, staged: boolean, worktree: boolean, overlay: boolean): Promise<[string[], number]>;
//# sourceMappingURL=restore.d.ts.map