@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
54 lines • 3.07 kB
TypeScript
import type { FlagValue } from '../../commands/spec/types.ts';
import { LineFacts, type PathSpec } from '../../types.ts';
export declare const UNSUPPORTED_BUILTINS: ReadonlySet<string>;
export declare const NAMESPACE_COMMANDS: ReadonlySet<string>;
export declare const ROUTED_COMMANDS: ReadonlySet<string>;
export declare const WRITING_PROGRAMS: ReadonlySet<string>;
export declare const EXEC_WRAPPERS: ReadonlyMap<string, readonly [string, string]>;
export declare const INTERPRETER_NAMES: ReadonlySet<string>;
export declare const CAPTURABLE_BUILTINS: ReadonlySet<string>;
export declare const KEYWORDS: ReadonlySet<string>;
export declare const JOB_BUILTINS: ReadonlySet<string>;
export declare const SLASH_KEEPS_LAST: ReadonlySet<string>;
/**
* What a line of a builtin does, read off its parsed flags by the command's
* own facts; a wrapper does what the program it runs does. Mirrors Python's
* `facts_of`.
*/
export declare function factsOf(name: string, bag: Record<string, FlagValue>, operands: readonly (string | PathSpec)[]): LineFacts;
/**
* What a command line does, read off its words by the command's own grammar
* and facts (`factsOf`), so an abbreviation, a long spelling and an option's
* attached value read as the handler will read them: `grep --recur` and
* `grep -d recurse` walk, `grep -ephrase` does not. A command that decides
* its operand's last component itself (`SELF_RESOLVING`) follows no link.
* An operand classified as a path carries whether it is a pattern still to
* expand; `cwd` is what a path option's value (`mv -t`) resolves against.
* Mirrors Python's `line_facts`.
*/
export declare function lineFacts(name: string, words: readonly (string | PathSpec)[], cwd: string): LineFacts;
/**
* Insert POSIX's `--` after a program-carrying option's value.
*
* The handoff already has a spelling every parser honors, so the rule is
* applied by writing one down rather than by teaching the parser a new
* kind of option. The marker is inserted unconditionally, never skipped
* because the line already carries one: CPython stops parsing at -c and
* passes a later `--` through as data (`python3 -c p -- -u` gives the
* program `['-c', '--', '-u']`), so the parser must consume exactly the
* one added here and leave any typed one alone.
*
* Only the option run before the first operand is scanned. A -c after an
* operand belongs to the program (`python3 s.py -c x`), and the operand
* already ended option parsing by itself.
*
* The scan walks a short cluster letter by letter rather than matching
* the word's prefix, because the carrier need not be first: CPython
* reads `python3 -uc 'p' -v` and `python3 -uc'p' -v` the same way it
* reads the unclustered forms, handing `-v` to the program.
*/
export declare function endOptionsAfterProgram(name: string, words: string[]): string[];
export declare const BASH_BUILTINS: ReadonlySet<string>;
export declare const SHELL_ONLY_BUILTINS: ReadonlySet<string>;
export declare const SHELL_NAMES: ReadonlySet<string>;
//# sourceMappingURL=constants.d.ts.map