import { i as FileSystem } from "../interface-CjgTx0Yc.js"; import { s as Workspace } from "../filesystem-BKxpZmkl.js"; import * as git from "isomorphic-git"; import { ToolProvider } from "@cloudflare/codemode"; //#region src/git/provider.d.ts interface GitAuthOptions { username: string; password: string; } interface GitToolsOptions { /** Default directory for git operations. */ dir?: string; /** Default basic auth credentials — auto-injected into clone/fetch/pull/push. */ auth?: GitAuthOptions; /** Default auth token — auto-injected into clone/fetch/pull/push. */ token?: string; } /** Create a git ToolProvider from a Workspace. */ declare function gitTools( workspace: Workspace, options?: GitToolsOptions ): ToolProvider; /** Create a git ToolProvider from a raw FileSystem. */ declare function gitToolsFromFs( filesystem: FileSystem, options?: GitToolsOptions ): ToolProvider; //#endregion //#region src/git/index.d.ts /** Author/committer identity. */ interface GitAuthor { name: string; email: string; } /** Result from git.log */ interface GitLogEntry { oid: string; message: string; author: { name: string; email: string; timestamp: number; }; parent: string[]; } /** Result from git.status */ interface GitStatusEntry { filepath: string; /** HEAD status: 0=absent, 1=present */ head: number; /** Workdir status: 0=absent, 1=identical, 2=modified */ workdir: number; /** Stage status: 0=absent, 1=identical, 2=modified, 3=added */ stage: number; /** Human-readable status */ status: string; } /** * Create a git command set bound to a FileSystem. * All paths are relative to `dir` (default: "/"). */ declare function createGit( filesystem: FileSystem, defaultDir?: string ): { /** git clone [--depth N] [--branch ] [--single-branch] */ clone(opts: { url: string; dir?: string; depth?: number; branch?: string; singleBranch?: boolean; noCheckout?: boolean; token?: string; username?: string; password?: string; }): Promise<{ cloned: string; dir: string; }> /** git status [--short] */; status(opts?: { dir?: string; }): Promise /** git add (use "." for all) */; add(opts: { filepath: string; dir?: string }): Promise<{ added: string; }> /** git rm */; rm(opts: { filepath: string; dir?: string }): Promise<{ removed: string; }> /** git commit -m --author " " */; commit(opts: { message: string; author?: GitAuthor; dir?: string }): Promise<{ oid: string; message: string; }> /** git log [--depth N] [--ref ] */; log(opts?: { depth?: number; ref?: string; dir?: string; }): Promise /** git branch [--list] or git branch */; branch(opts?: { name?: string; list?: boolean; delete?: string; dir?: string; }): Promise< | { deleted: string; created?: undefined; branches?: undefined; current?: undefined; } | { created: string; deleted?: undefined; branches?: undefined; current?: undefined; } | { branches: string[]; current: string | void; deleted?: undefined; created?: undefined; } > /** git checkout or git checkout -b */; checkout(opts: { ref?: string; branch?: string; dir?: string; force?: boolean; }): Promise< | { branch: string; created: boolean; ref?: undefined; } | { ref: string | undefined; branch?: undefined; created?: undefined; } > /** git fetch [--remote ] [--ref ] */; fetch(opts?: { remote?: string; ref?: string; depth?: number; dir?: string; token?: string; username?: string; password?: string; }): Promise<{ fetchHead: string | null; fetchHeadDescription: string | null; }> /** git pull [--remote ] [--ref ] */; pull(opts?: { remote?: string; ref?: string; dir?: string; author?: GitAuthor; token?: string; username?: string; password?: string; }): Promise<{ pulled: boolean; }> /** git push [--remote ] [--ref ] [--force] */; push(opts?: { remote?: string; ref?: string; force?: boolean; dir?: string; token?: string; username?: string; password?: string; }): Promise<{ ok: boolean; refs: { [x: string]: git.RefUpdateStatus; }; }> /** git diff [--cached] — show changed files */; diff(opts?: { dir?: string }): Promise< { filepath: string; status: string; }[] > /** git init */; init(opts?: { dir?: string; defaultBranch?: string }): Promise<{ initialized: string; }> /** git remote — list, add, or remove remotes */; remote(opts: { list?: boolean; add?: { name: string; url: string; }; remove?: string; dir?: string; }): Promise< | { remote: string; url: string; }[] | { added: string; url: string; removed?: undefined; } | { removed: string; added?: undefined; url?: undefined; } >; }; type Git = ReturnType; //#endregion export { Git, type GitAuthOptions, GitAuthor, GitLogEntry, GitStatusEntry, type GitToolsOptions, createGit, gitTools, gitToolsFromFs }; //# sourceMappingURL=index.d.ts.map