UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

69 lines • 3.95 kB
import { type GitHubTransport } from './client.ts'; export interface RepoRef { owner: string; repo: string; } /** The host a repository argument names, null for `OWNER/REPO`. */ export declare function repoHost(spec: string): string | null; /** * The repository a word names, as gh reads it: a URL (`https://HOST/OWNER/REPO`, * `git@HOST:OWNER/REPO.git`) or `[HOST/]OWNER/REPO`. The host is optional and * leading, so the owner and the repository are always the last two segments. * Taking the first two instead read `github.com/acme/tools` as owner * `github.com`, repo `acme` -- a different repository, reported as success. * * Args: * spec (string): the repository as the line spelled it. * * Returns: * RepoRef: the owner and repository names. */ export declare function parseRepo(spec: string): RepoRef; export declare function login(transport: GitHubTransport): Promise<string>; export declare function viewRepo(transport: GitHubTransport, ref: RepoRef): Promise<unknown>; /** * Run one GraphQL query and return its data, refusing the way gh does. * * gh names each error with the path of the field that raised it and joins * them: `GraphQL: Could not resolve to a Repository with the name 'o/r'. * (repository)`. */ export declare function graphqlData(transport: GitHubTransport, query: string, variables: Record<string, unknown>): Promise<Record<string, unknown>>; /** * The selected fields of one repository, over GraphQL, as gh reads them for * `repo view --json`: one query naming only what was asked for. * * Args: * transport (GitHubTransport): the API client. * ref (RepoRef): the repository. * selection (string): the GraphQL selection inside `repository { }`. */ export declare function repositoryFields(transport: GitHubTransport, ref: RepoRef, selection: string): Promise<Record<string, unknown>>; /** * The selected fields of an owner's repositories, over GraphQL, as gh reads * them for `repo list --json`: the owner's own, most recently pushed first, a * page of up to 100 at a time until `limit`. No owner means the viewer. * * Args: * transport (GitHubTransport): the API client. * owner (string | undefined): the user or organization, or the viewer. * limit (number): how many repositories at most. * selection (string): the GraphQL selection for each repository. */ export declare function listRepositoryFields(transport: GitHubTransport, owner: string | undefined, limit: number, selection: string): Promise<Record<string, unknown>[]>; /** * The repository's README as text, or null when it has none. */ export declare function readReadme(transport: GitHubTransport, ref: RepoRef): Promise<string | null>; /** Fork a repository: `body` carries the request's `name`, `organization` and `default_branch_only`. */ export declare function forkRepo(transport: GitHubTransport, ref: RepoRef, body?: Record<string, unknown>): Promise<unknown>; /** Change a repository's settings: the one `PATCH` `gh repo edit` sends. */ export declare function editRepo(transport: GitHubTransport, ref: RepoRef, body: Record<string, unknown>): Promise<unknown>; /** A repository's topics, which GitHub keeps and replaces as one list. */ export declare function repoTopics(transport: GitHubTransport, ref: RepoRef): Promise<string[]>; export declare function setRepoTopics(transport: GitHubTransport, ref: RepoRef, names: readonly string[]): Promise<unknown>; export declare function deleteRepo(transport: GitHubTransport, ref: RepoRef): Promise<unknown>; export declare function renameRepo(transport: GitHubTransport, ref: RepoRef, name: string): Promise<unknown>; export declare function listRepos(transport: GitHubTransport, owner: string | undefined, limit: number): Promise<Record<string, unknown>[]>; export declare function createRepo(transport: GitHubTransport, owner: string | undefined, body: Record<string, unknown>): Promise<unknown>; //# sourceMappingURL=repo.d.ts.map