@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
50 lines • 2.4 kB
TypeScript
import type { RepoLocation } from './types.ts';
import type { Files } from '../../../../workspace/files.ts';
/** The fields of one line of isomorphic-git's parsed config that a raw read needs. */
export interface ConfigLine {
readonly path: string;
readonly name: string | null;
readonly value: string | null;
}
/**
* The variables of one config file's text, in file order, as isomorphic-git
* parses them: `path` is the dotted key, section and name folded, and `value`
* the raw string git prints. Read from text rather than a git directory
* because `--global` names files that are not called `config`.
*
* @param text the file's contents
*/
export declare function configLines(text: string): Promise<readonly ConfigLine[]>;
/**
* A `PromiseFsClient` whose bytes come from a mirage mount.
*
* isomorphic-git reaches a repository through nothing but this object, so a
* repository on S3, in RAM or over SSH is the same repository to it. That is
* the whole bridge, and it is why the TypeScript side needs no counterpart to
* Python's `objects.py`/`lazyfile.py`: dulwich's object store is synchronous, so
* Python has to hand-build a lazy store and marshal every read onto the
* workspace loop, while isomorphic-git is async to begin with and reads
* packfiles, loose objects and the index itself.
*
* Symlinks are refused rather than faked. mirage keeps links in the namespace
* rather than in any backend, so a `readlink` here would have to consult a
* different layer than every other call, and no verb mirrored so far writes or
* follows one inside a `.git` directory.
*/
export declare function gitFs(source: Files, location?: RepoLocation): {
promises: Record<string, (...args: never[]) => Promise<unknown>>;
};
/**
* Every value a variable takes in the repository's config, as written.
*
* Read below `git.getConfig`, which casts `core.bare` and a few other keys
* itself, and only when they are spelled in lowercase and hold a word:
* `[Core] Bare = true` came back a string and `bare = 1` threw. A linked
* worktree's config is its repository's.
*
* @param vfs the session's files
* @param location the discovered repository
* @param path the variable, e.g. `core.bare`; its section and name in any case
*/
export declare function configValues(vfs: Files, location: RepoLocation, path: string): Promise<string[]>;
//# sourceMappingURL=fs.d.ts.map