UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

75 lines • 4.2 kB
import type { GitHubAccount } from '../../../../accessor/github.ts'; import { type RepoRef } from '../../../../core/github/repo.ts'; import type { FlagView } from '../../../spec/flag_view.ts'; import type { FlagValue } from '../../../spec/types.ts'; import type { CommandFnResult, Context } from '../../../config.ts'; /** * Refuse a repository on a host this install cannot reach. Real gh sends the * request to whatever host a repository argument names; this one answers * github.com, whose subdomains go-gh reads as github.com, and the host its * `baseUrl` names. Any other host is one it cannot connect to, and it says so * in gh's words (pinned against gh 2.85.0) rather than asking its own host for * a repository of the same name. */ export declare function checkHost(accessor: GitHubAccount, host: string | null): void; /** * The origin the install's GitHub serves its pages and git from: github.com * for GitHub's own API, else the API host's own origin, as a GitHub Enterprise * server and a local stand-in serve them. Throws `Invalid URL` unless the API * base is an http(s) URL with a host. */ export declare function webOrigin(accessor: GitHubAccount): string; /** * The repository a line is about: the operand if it named one, the * install's own otherwise. gh resolves this from the current git remote, * which a workspace has no equivalent of, so the config carries it. */ export declare function ghRepo(accessor: GitHubAccount, spec: string | undefined): RepoRef; /** * `--json` output as gh writes it where stdout is not a terminal, which in a * workspace it never is: one compact line. */ export declare function jsonOut(value: unknown): CommandFnResult; export declare function textOut(text: string): CommandFnResult; /** Whether a gh boolean flag is on: given bare, or as `=true`. */ export declare function ghBool(fl: FlagView, name: string): boolean; /** * A list verb's `--limit`, refused below 1 the way gh refuses it: gh answers a * limit under 1 with a flag error before any request, and `release list` * takes any value. An explicit zero is never the fallback. Mirrors Python's * `list_limit`. */ export declare function listLimit(fl: FlagView, fallback: number, refusal?: string | null): number; export declare function repoFor(accessor: GitHubAccount, fl: FlagView): RepoRef; export declare function repoNumber(accessor: GitHubAccount, fl: FlagView, value: string | undefined, label: string, urlKind: 'issues' | 'pull'): [RepoRef, number]; export declare function csvValues(values: readonly string[]): string[]; export declare function readCliFile(ctx: Context, raw: FlagValue, option: string): Promise<Uint8Array>; export declare function bodyValue(ctx: Context, fl: FlagView, opts?: { value?: string; file?: string; required?: boolean; }): Promise<string | undefined>; export declare function camel(value: unknown): unknown; export declare function textValue(value: unknown): string; /** * The `--json` fields a line asked for, null without `--json`. * * Checked before any request, as gh checks them: a field gh does not export * is refused with gh's own message and every field it does, sorted, exit 1. */ export declare function jsonFields(fl: FlagView, allowed: readonly string[]): string[] | null; /** * The lines `--jq` prints for each value in turn, the way go-gh's jq * evaluates them. `halt`, and `halt_error` on null, end that value's output * there. An error, or any other `halt_error`, fails the command after the * lines printed before it (see jqFailure): a StreamRefusal carries them. * * The program runs in mirage-rs's jq_eval, a bounded number of steps at a * time, so one that never ends still yields and the signal stops it. * `input` finds no more input, `$ENV` is the command's environment, and what * `debug` and `stderr` write is not printed. Throws JqCompileError for a * program jq refuses. */ export declare function jqLines(values: readonly unknown[], program: string, ctx: Context): Promise<string>; export declare function typedOut(value: unknown, fl: FlagView, human: string, allowed: readonly string[], ctx: Context): Promise<CommandFnResult>; //# sourceMappingURL=accessor.d.ts.map