@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
54 lines • 2.88 kB
TypeScript
import type { StatusEntry, Upstream } from './types.ts';
export declare const DETACHED_AT = "HEAD detached at ";
export declare const DETACHED_FROM = "HEAD detached from ";
export declare const NO_BRANCH = "Not currently on any branch.";
/**
* Spell a path the way git spells it, quoting only when it must.
*
* git C-quotes a path holding anything that would not survive being read back: a
* quote, a backslash, a control character, or a byte outside ASCII. The
* machine-readable formats also quote a path holding a space, and the
* human-readable one does not, which is not an inconsistency: only the former is
* parsed by splitting on whitespace. Verified both ways against git 2.47.
*
* `core.quotePath=false` turns `fully` off, and a byte outside ASCII then passes
* through as itself while everything else is quoted as before (pinned against
* git 2.50). A byte that is not UTF-8 arrives as a
* surrogate escape and is quoted, or passed through, as that byte.
*
* @param path repository-relative path
* @param porcelain whether a space alone forces quoting
* @param fully whether a byte outside ASCII forces quoting
*/
export declare function quotePath(path: string, porcelain: boolean, fully?: boolean): string;
/**
* The `## ` header `--branch` prepends to the short formats.
*
* @param branch the branch HEAD names, null when detached
* @param noCommits whether HEAD resolves to nothing yet
*/
export declare function branchLine(branch: string | null, noCommits: boolean, upstream?: Upstream | null): string;
/**
* What the long status says about a branch and its upstream.
*
* Pinned against git 2.47.3 and 2.50.1.
*/
export declare function trackingLines(upstream: Upstream): string[];
/** The whole of `--short` / `--porcelain` output. */
export declare function shortFormat(rows: readonly StatusEntry[], header: string | null, fully?: boolean): string;
/**
* The default, human-readable status report.
*
* @param rows every row, already in git's order
* @param branch the branch HEAD names, null when detached
* @param commit the abbreviated commit HEAD holds, set only when detached
* @param noCommits whether HEAD resolves to nothing yet
* @param merging whether a merge is in progress
* @param hideUntracked whether `-uno` suppressed the scan
*/
export declare function longFormat(rows: readonly StatusEntry[], branch: string | null, detached: string, noCommits: boolean, merging: boolean, hideUntracked: boolean, fully?: boolean, upstream?: Upstream | null): string;
/** A repository-relative path spelled from a directory inside the work tree. */
export declare function relativePath(path: string, prefix: string): string;
/** Render status paths relative to an invocation inside the work tree. */
export declare function relativeEntries(rows: StatusEntry[], prefix: string): StatusEntry[];
//# sourceMappingURL=render.d.ts.map