@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
40 lines • 2.01 kB
TypeScript
import { type CommandSpec } from './types.ts';
/** The `--version` answer of a command. */
export declare function versionLine(name: string): string;
/** The `--pcre2-version` answer: mirage translates PCRE2 patterns and has no JIT. */
export declare function pcre2Line(): string;
/**
* The `--help` page of a command.
*
* The page lists `--help` and `--version` as well. Only the builtin itself
* gets GNU's synopsis line; a mount command that borrows the name keeps the
* line its own spec renders.
*/
export declare function helpPage(name: string, spec: CommandSpec): string;
/** Whether the registration answers `--help` for this spec. */
export declare function hasInjectedHelp(spec: CommandSpec | null): boolean;
/** Whether the registration answers `--version` for this spec. */
export declare function hasInjectedVersion(spec: CommandSpec | null): boolean;
/**
* The `--help` page or version line that `argv` asks for, or null to run the
* command as usual.
*
* The executor asks before routing, since neither answer belongs to a
* backend: `rm --version /ro/x` must not meet the read-only refusal, and
* `mv --help /ram/a /disk/b` must not move the file. The rules are GNU's
* getopt loop (coreutils 9.7):
*
* - the standard option the parser reaches first answers, so
* `cat --help --version` prints the help page;
* - an option error ahead of it wins, so `cat --bogus --version` is a usage
* error, while `cat --version --bogus` prints the version;
* - a word counts only if the parser reads it as the option, so
* `grep -e --version` searches for `--version`.
*
* Builtins in STANDARD_BEFORE_SCAN answer ahead of every option, and those in
* STANDARD_AFTER_SCAN only when the whole line parses, with the option
* `loopAnswer` picks. ripgrep's --pcre2-version is one of its standard
* options (EXTRA_STANDARD).
*/
export declare function standardRequest(name: string, spec: CommandSpec | null, argv: string[]): Uint8Array | null;
//# sourceMappingURL=standard.d.ts.map