UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

47 lines • 2.35 kB
import { type Repo } from './repo.ts'; import type { GitObject } from './types.ts'; export declare const TREE_MODE = "040000"; /** One tree entry, flattened to a repository-relative path. */ export interface TreeEntry { readonly oid: string; /** git's own octal spelling, e.g. `100644`. */ readonly mode: string; } /** One entry of one tree object, not descended into. */ export interface TreeItem { readonly path: string; readonly oid: string; /** git's own octal spelling, e.g. `100644`; a subtree reads `040000`. */ readonly mode: string; } /** * The entries of one tree object, read from its raw bytes. * * Parsed here rather than through isomorphic-git's readTree, which decodes each * name as UTF-8 and turns a byte that is not into U+FFFD. A name keeps every * byte, a byte UTF-8 cannot read carried as its surrogate escape, so the name * quotes and prints the way git's does. A subtree's `40000` is spelled * `040000`, as isomorphic-git spells it. */ export declare function treeItems(repo: Repo, treeOid: string): Promise<TreeItem[]>; /** * Every blob a tree holds, keyed by repository-relative path. * * Flattened rather than walked per directory because every caller here compares * two whole trees; git's own diff does the same on the paths it has already * expanded. A submodule (`160000`) is carried through as an entry rather than * descended into: it names a commit in another repository. */ export declare function treeEntries(repo: Repo, treeOid: string, prefix?: string): Promise<Map<string, TreeEntry>>; /** * Every blob a commit's tree holds, or an empty map for no commit at all. * * An empty map is what an unborn HEAD means: nothing is committed yet, so every * staged path reads as an addition. */ export declare function commitEntries(repo: Repo, commitOid: string | null): Promise<Map<string, TreeEntry>>; /** Resolve a tree-ish through tags and commits. */ export declare function resolveTree(repo: Repo, name: string, resolved?: GitObject): Promise<string>; /** Literal tree prefixes; a trailing slash descends even without -r. */ export declare function listedTree(repo: Repo, tree: string, patterns: readonly string[], recursive: boolean, trees: boolean, directories: boolean, prefix?: string): Promise<[string, string, string][]>; //# sourceMappingURL=tree.d.ts.map