UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

40 lines • 2.38 kB
import type { AirtableAccessor } from '../../../../accessor/airtable.ts'; import type { AirtableConfig } from '../../../../core/airtable/config.ts'; import type { Row } from '../../../../core/airtable/normalize.ts'; import { type ByteSource } from '../../../../io/types.ts'; import type { CommandFnResult, Context } from '../../../config.ts'; import { FlagView } from '../../../spec/flag_view.ts'; import type { CLIVerbFn } from '../../types.ts'; export type Verb = (accessor: AirtableAccessor, texts: string[], ctx: Context, fl: FlagView) => Promise<CommandFnResult>; /** Refuse an operand on a verb that takes none. */ export declare function noOperands(texts: readonly string[]): void; /** The one operand a verb requires, named as its usage line names it. */ export declare function oneOperand(texts: readonly string[], name: string): string; /** The operand a verb may take once, null when the line has none. */ export declare function optionalOperand(texts: readonly string[]): string | null; /** * The base a line addresses, refused (EACCES) when `baseIds` excludes it. * Refused here, before any request, so a base the install was not given is * never reached: the scope the mount enforces on reads. The executor * prefixes the refusal with the words the line was typed under, `<head> base * get: <base-id>: Permission denied`, exit 1. */ export declare function scopedBase(config: AirtableConfig, baseId: string): string; /** * The schema table a line names, by id first and then by name. Airtable * takes either spelling in a path, and an id can never be another table's * name, so the id match wins. */ export declare function findTable(tables: readonly Row[], ref: string): Row | undefined; /** A flag's value decoded as a JSON object. */ export declare function jsonObject(flag: string, text: string): Record<string, unknown>; /** Piped input as text, a leading byte order mark dropped. */ export declare function stdinText(stdin: ByteSource): Promise<string>; /** * Run one verb on the install's accessor, which outlives the line: the * workspace closes it with the install. A verb never names itself: the CLI * may be installed under any head word, so a refusal is left to the executor, * which prefixes it with the words the line was typed under. */ export declare function run(verb: Verb): CLIVerbFn<AirtableAccessor>; //# sourceMappingURL=util.d.ts.map