UNPKG

run402-mcp

Version:

MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.

88 lines • 5.6 kB
/** * `appRepos` namespace — plain git repositories owned by a project and * written by its app (`/projects/v1/:project_id/app-repos`). * * An app repo is NOT a KyGit vault (`r.repos`): it is unencrypted, one linear * `main`, stored in the project's content-addressed storage and billed as * project storage. Every project has a `default` repo that needs no creation; * other repos are created explicitly and never by a read, commit, or push. * Functions read and commit through `repo` / `repos` from `@run402/functions`; * people and agents also clone and push with plain git (`run402 app-repos * clone`). The SDK has no clone method: cloning writes a working tree and * hands git a credential, so it is CLI-only. * * Exposed unscoped (`r.appRepos.list(projectId)`) and project-scoped * (`r.project(id).appRepos.list()`). Every call sends your principal (grant * key, wallet, or sign-in session) when the credential provider has one, * otherwise the project's locally cached service key. Reads need * `project.app_repos.read` (viewer); create, delete, commit, and revert need * `project.app_repos.write` (developer, or a grant with `deploy`). */ import type { Client } from "../kernel.js"; import type { AppRepo, AppRepoCommitOptions, AppRepoCommitResult, AppRepoCreateOptions, AppRepoDeleteOptions, AppRepoDeleteResult, AppRepoDiff, AppRepoFile, AppRepoList, AppRepoLogOptions, AppRepoLogPage, AppRepoReadOptions, AppRepoRevertOptions, AppRepoGitCredential, AppRepoToken, AppRepoTokenOptions, AppRepoTokenRevocation, AppRepoTree } from "./app-repos.types.js"; export declare class AppRepos { private readonly client; constructor(client: Client); /** Every app repo of the project; `default` is always listed (`GET …/app-repos`). */ list(projectId: string): Promise<AppRepoList>; /** * Create a repo, optionally from another repo of the same project (its head * and history are copied and its objects shared). A taken name is * `409 APP_REPO_EXISTS`. */ create(projectId: string, opts: AppRepoCreateOptions): Promise<AppRepo>; /** One repo, with its head and `clone_url` (`GET …/app-repos/:repo_name`). */ get(projectId: string, repoName: string): Promise<AppRepo>; /** * Delete a repo. `confirm` must equal the repo name; `default` cannot be * deleted (`403 APP_REPO_DEFAULT_UNDELETABLE`). Its objects become * collectable once no other repo of the project references them. */ delete(projectId: string, repoName: string, opts: AppRepoDeleteOptions): Promise<AppRepoDeleteResult>; /** The commits on `main`, newest first, optionally only those that changed `path`. */ log(projectId: string, repoName: string, opts?: AppRepoLogOptions): Promise<AppRepoLogPage>; /** * One file's bytes at the head, or at `opts.at`. Returns `null` when the * file is absent (`APP_REPO_PATH_NOT_FOUND`), including in an empty repo; * any other failure throws. */ readFile(projectId: string, repoName: string, path: string, opts?: AppRepoReadOptions): Promise<AppRepoFile | null>; /** A directory listing at the head, or at `opts.at`; the repo root when `path` is omitted. */ tree(projectId: string, repoName: string, path?: string, opts?: AppRepoReadOptions): Promise<AppRepoTree>; /** The paths that changed between two commits. */ diff(projectId: string, repoName: string, from: string, to: string): Promise<AppRepoDiff>; /** * Commit files to `main`. A `string` is UTF-8 text, a `Uint8Array` bytes, * `null` deletes, and `{ json }` is written canonically. Without `parent`, * the commit lands on a newer head when none of its paths changed since * `base`; otherwise `409 APP_REPO_CONFLICT` names `conflicting_paths`. A * commit that changes nothing returns `{ committed: false, head }`. */ commit(projectId: string, repoName: string, opts: AppRepoCommitOptions): Promise<AppRepoCommitResult>; /** * Commit the inverse of `commit`'s changes (undo is a new commit; history is * never rewritten). It lands on the head unless a path it restores changed * after `commit` (`409 APP_REPO_CONFLICT`). */ revert(projectId: string, repoName: string, commit: string, opts?: AppRepoRevertOptions): Promise<AppRepoCommitResult>; /** * The credential git sends for one app repo, by the same resolution as every * project call (project-credential-cache-client-surface, "Auth Resolution Is * Deterministic"): a grant key named in the environment, else the selected * wallet's fresh `SIGN-IN-WITH-X` signature for the repo's git URL, else the * cached service key only on a machine with no principal (or when the client * asked for it with `projectAuth: "service_key"`). A sign-in session is not * a git password, so a session-only machine falls to the cached key. Null * when nothing applies. The CLI's git credential helper prints it and keeps * no order of its own. */ gitCredential(projectId: string, repoName: string): Promise<AppRepoGitCredential | null>; /** * Mint a credential for one repo: the git password, and a Bearer on its read * and commit routes, that expires by itself. `token` is returned only here. */ createToken(projectId: string, repoName: string, opts: AppRepoTokenOptions): Promise<AppRepoToken>; /** Stop a token at once; repeating it answers the same. */ revokeToken(projectId: string, repoName: string, tokenId: string): Promise<AppRepoTokenRevocation>; } //# sourceMappingURL=app-repos.d.ts.map