@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
31 lines • 1.64 kB
TypeScript
import { FlagView } from '../../spec/flag_view.ts';
import type { FlagValue } from '../../spec/types.ts';
import { IOResult } from '../../../io/types.ts';
import { LineFacts, PathSpec, type FileStat } from '../../../types.ts';
import type { CommandFnResult, Context } from '../../config.ts';
export interface TreeFlags {
readonly maxDepth: number | null;
readonly showHidden: boolean;
readonly ignorePattern: string | null;
readonly dirsOnly: boolean;
readonly matchPattern: string | null;
readonly oneFileSystem: boolean;
}
/**
* tree's options, -L read by mirage-rs before any operand is resolved: the
* flags, or tree's refusal of a level. Mirrors Python's `parse_flags`.
*/
export declare function parseFlags(bag: Record<string, FlagValue>): TreeFlags | IOResult;
/**
* Run tree over resolved operands. `unbounded` is the walk to take when no
* `-L` bounds it (one the mount answers whole), else `readdir` and `stat`.
* Mirrors Python's `tree_generic`; `parsed` holds the options, read before
* the operands were.
*/
export declare function treeGeneric(parsed: TreeFlags, paths: PathSpec[], ctx: Context, readdir: (p: PathSpec, nofollow?: boolean, limit?: number) => Promise<string[]>, stat: (p: PathSpec) => Promise<FileStat>, unbounded?: [(p: PathSpec) => Promise<string[]>, (p: PathSpec) => Promise<FileStat>]): Promise<CommandFnResult>;
/**
* A tree line reads below every path it names and walks into the mounts below
* unless `-x`. Mirrors Python's `facts`.
*/
export declare function facts(fl: FlagView, _operands: readonly (string | PathSpec)[]): LineFacts;
//# sourceMappingURL=tree.d.ts.map