import { EventEmitter } from "node:events"; //#region ../dofs/dist/types.d.ts interface SQLCursorLike> { toArray(): Row[]; } interface SQLStorageLike { exec(query: string, ...bindings: unknown[]): SQLCursorLike; } interface DurableObjectStorageLike { sql: SQLStorageLike; transaction?(closure: () => T | Promise): T | Promise; transactionSync?(closure: () => T): T; } //#endregion //#region ../dofs/dist/storage.d.ts declare class Database { #private; readonly sql: SQLStorageLike; readonly transactionSync: (closure: () => T) => T; constructor(storage: DurableObjectStorageLike); get inTransaction(): boolean; run(query: string, ...bindings: unknown[]): void; all(query: string, ...bindings: unknown[]): Row[]; one(query: string, ...bindings: unknown[]): Row | undefined; scalar(query: string, ...bindings: unknown[]): T | undefined; } //#endregion //#region ../dofs/dist/fs/mkdir.d.ts interface MkdirOptions { recursive?: boolean; mode?: number; } //#endregion //#region ../dofs/dist/fs/writeFile.d.ts type WriteFileContent = string | Uint8Array | ReadableStream; interface WriteFileOptions { mode?: number; /** Fail with EEXIST when the target already exists. */ exclusive?: boolean; } interface WriteFileRange { start: number; end: number; } //#endregion //#region ../dofs/dist/fs/watch.d.ts interface WatchOptions { recursive?: boolean; signal?: AbortSignal; interval?: number; } interface WatchEvent { eventType: "rename" | "change"; filename: string; } interface WatchHandle extends EventEmitter { close(): void; } //#endregion //#region ../dofs/dist/provider.d.ts interface SQLiteWorkspaceProviderOptions { now?: () => number; watchIntervalMs?: number; } interface VirtualStatsLike { dev: number; mode: number; nlink: number; uid: number; gid: number; rdev: number; blksize: number; ino: number; size: number; blocks: number; atimeMs: number; mtimeMs: number; ctimeMs: number; birthtimeMs: number; atime: Date; mtime: Date; ctime: Date; birthtime: Date; isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; isBlockDevice(): boolean; isCharacterDevice(): boolean; isFIFO(): boolean; isSocket(): boolean; } interface VirtualDirentLike { name: string; parentPath: string; path: string; isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; isBlockDevice(): boolean; isCharacterDevice(): boolean; isFIFO(): boolean; isSocket(): boolean; } declare class SQLiteWorkspaceProvider { #private; readonly db: Database; readonly now: () => number; readonly readonly = false; readonly supportsSymlinks = true; readonly supportsWatch = true; readonly watchIntervalMs: number; constructor(db: Database, options?: SQLiteWorkspaceProviderOptions); open(path: string, flags?: string, mode?: number): Promise; openSync(path: string, flags?: string, _mode?: number): number; stat(path: string, options?: { bigint?: boolean; }): Promise; statSync(path: string, _options?: { bigint?: boolean; }): VirtualStatsLike; lstat(path: string, options?: { bigint?: boolean; }): Promise; lstatSync(path: string, _options?: { bigint?: boolean; }): VirtualStatsLike; readdir(path: string, options?: { withFileTypes?: boolean; }): Promise; readdirSync(path: string, options?: { withFileTypes?: boolean; }): string[] | VirtualDirentLike[]; mkdir(path: string, options?: MkdirOptions): Promise; mkdirSync(path: string, options?: MkdirOptions): string | undefined; rmdir(path: string): Promise; rmdirSync(path: string): void; unlink(path: string): Promise; unlinkSync(path: string): void; link(existingPath: string, newPath: string): Promise; linkSync(existingPath: string, newPath: string): void; rename(oldPath: string, newPath: string): Promise; renameSync(oldPath: string, newPath: string): void; readFile(path: string, options?: BufferEncoding | { encoding?: BufferEncoding | null; } | null): Promise; readFileSync(path: string, options?: BufferEncoding | { encoding?: BufferEncoding | null; } | null): Buffer | string; writeFile(path: string, data: string | Buffer, options?: { encoding?: BufferEncoding; mode?: number; } | BufferEncoding): Promise; writeFileSync(path: string, data: string | Buffer, options?: { encoding?: BufferEncoding; mode?: number; } | BufferEncoding): void; writeFileRangesSync(path: string, data: string | Buffer, ranges: WriteFileRange[], options?: { encoding?: BufferEncoding; mode?: number; } | BufferEncoding): void; createFileSync(path: string, options?: { mode?: number; }): void; writeRangeSync(path: string, data: string | Buffer | Uint8Array, offset: number, options?: { encoding?: BufferEncoding; mode?: number; } | BufferEncoding): number; truncateFileSync(path: string, len: number): void; openWriteBufferSync(path: string): void; openWriteBufferForCreateSync(path: string, options?: { mode?: number; }): void; releaseWriteBufferSync(path: string): void; chmodSync(path: string, mode: number): void; appendFile(_path: string, _data: string | Buffer, _options?: { encoding?: BufferEncoding; mode?: number; } | BufferEncoding): Promise; appendFileSync(_path: string, _data: string | Buffer, _options?: { encoding?: BufferEncoding; mode?: number; } | BufferEncoding): void; exists(path: string): Promise; existsSync(path: string): boolean; copyFile(_src: string, _dest: string, _mode?: number): Promise; copyFileSync(_src: string, _dest: string, _mode?: number): void; internalModuleStat(_path: string): number; realpath(path: string, _options?: { encoding?: BufferEncoding; }): Promise; realpathSync(path: string, _options?: { encoding?: BufferEncoding; }): string; access(path: string, _mode?: number): Promise; accessSync(path: string, _mode?: number): void; closeSync(fd: number): void; readSync(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, position: number | null): number; readRangeSync(path: string, offset: number, length: number): Buffer; writeSync(fd: number, buffer: Buffer | Uint8Array, offset?: number, length?: number, position?: number | null): number; fstatSync(fd: number, _options?: { bigint?: boolean; }): VirtualStatsLike; truncateSync(path: string, len: number): void; ftruncateSync(fd: number, len: number): void; readlink(path: string, _options?: { encoding?: BufferEncoding; }): Promise; readlinkSync(path: string, _options?: { encoding?: BufferEncoding; }): string; symlink(target: string, path: string, _type?: string): Promise; symlinkSync(target: string, path: string, _type?: string): void; watch(path: string, options?: WatchOptions): WatchHandle; watchAsync(path: string, options?: WatchOptions): AsyncIterable; watchFile(_path: string, _options?: unknown, _listener?: (curr: VirtualStatsLike, prev: VirtualStatsLike) => void): unknown; unwatchFile(_path: string, _listener?: (curr: VirtualStatsLike, prev: VirtualStatsLike) => void): void; } //#endregion //#region src/git/adapter.d.ts /** * The shape isomorphic-git wants as its `fs` argument: an object * whose `.promises` is an own, enumerable property and implements * the `node:fs/promises` subset listed in `PromiseFsClient`. * * `promises` is typed as `object` rather than enumerating every * method @platformatic/vfs forwards. The full surface is wider * than this package consumes and pinning it here would either * leak @platformatic/vfs into our public types or force tedious * structural shadowing. Callers that want a typed file API can * cast `client.promises` to `import('@platformatic/vfs').VirtualFileSystem['promises']`. */ interface IsomorphicGitFSClient { promises: object; } //#endregion //#region src/git/cli.d.ts interface GitCliInput { /** Argv as seen by the shell command. `argv[0]` is the subcommand. */ argv: string[]; /** * Working directory inside the workspace VFS. Subcommands that * accept a `dir` flag default to this when the flag is absent. * Defaults to `/` if omitted. */ cwd?: string; /** Environment variables. Identity defaulting reads from here. */ env?: Record; /** Stdin, decoded to UTF-8. Currently unused; reserved for `commit -F -`. */ stdin?: string; } interface GitCliResult { stdout: string; stderr: string; exitCode: number; } //#endregion //#region src/git/clone.d.ts type ProgressCallback$1 = (e: { phase: string; loaded: number; total?: number; }) => void; type MessageCallback$1 = (msg: string) => void; interface GitCloneOptions { /** Repository URL. HTTPS only — isomorphic-git has no SSH transport. */ url: string; /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** Branch, tag, or commit. Defaults to the remote's default branch. */ ref?: string; /** * If set, only these paths are written into the working tree. * `.git/` is fully populated regardless (subject to `depth`). * Globs are not supported; pass directory or file paths. */ paths?: string[]; /** * Shallow-clone depth. Defaults to full history. Pass a positive * number for a shallow clone, which is faster but cannot be pushed * elsewhere without losing the commits it did not fetch. `0` and * `Infinity` both mean full history. Even at depth 1, every blob * reachable from the tip tree is fetched — see the package README * for why. */ depth?: number; /** Fetch only the requested ref's branch. Default: true. */ singleBranch?: boolean; /** Skip tags. Default: true. */ noTags?: boolean; /** Extra HTTP headers, e.g. `Authorization` for a private repo. */ headers?: Record; /** CORS proxy URL. Usually unneeded inside a Worker. */ corsProxy?: string; /** Progress callback. Forwarded to isomorphic-git. */ onProgress?: ProgressCallback$1; /** Sideband message callback. Forwarded to isomorphic-git. */ onMessage?: MessageCallback$1; } //#endregion //#region src/git/commit.d.ts interface GitCommitOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** Commit message. Required. */ message: string; /** Override the author pulled from env / defaultIdentity. */ author?: { name: string; email: string; }; /** Override the committer. Defaults to the resolved author. */ committer?: { name: string; email: string; }; /** Amend HEAD rather than creating a new commit. Default `false`. */ amend?: boolean; /** * Env to read GIT_AUTHOR_* / GIT_COMMITTER_* from. Surfaced as * an option (not pulled from `process.env`) so the package * stays portable across runtimes. */ env?: Record; } interface CommitResult { /** SHA-1 of the new (or amended) commit. */ oid: string; } //#endregion //#region src/git/status.d.ts type StatusMatrixRow = [filepath: string, headStatus: number, workdirStatus: number, stageStatus: number]; interface GitStatusOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; } /** * One entry per non-clean path. `index` describes the staged * delta against HEAD; `worktree` describes the working-tree * delta against the staged version. Both are single-char codes * matching git's XY convention: * * ' ' (space) unmodified * 'A' added * 'M' modified * 'D' deleted * '?' untracked (Y only) */ interface StatusEntry { path: string; index: " " | "A" | "M" | "D"; worktree: " " | "A" | "M" | "D" | "?"; } //#endregion //#region src/git/diff.d.ts /** * Status-matrix row as emitted by isomorphic-git's `statusMatrix`: * `[filepath, headStatus, workdirStatus, stageStatus]`. * - 0 = absent * - 1 = same as HEAD * - 2 = differs from HEAD * - 3 = differs from HEAD and stage (rarely meaningful here) */ type StatusRow = StatusMatrixRow; interface GitDiffOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** * Ref to diff against. Defaults to `HEAD`. When `to` is also * set, this is the "from" side of a ref-to-ref diff. */ ref?: string; /** * Second ref. When set, diff is `ref` -> `to` (both committed * states), not `ref` -> working tree. Useful for `git diff * ..` semantics without spinning up a working-tree * round-trip. */ to?: string; /** * Restrict the diff to these working-tree paths. When omitted, * every path that changed between the two endpoints is * included. */ paths?: string[]; } /** Per-file change summary for `--stat` / `--name-status`. */ interface DiffSummaryEntry { path: string; status: "A" | "M" | "D"; insertions: number; deletions: number; } //#endregion //#region src/git/init.d.ts interface GitInitOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** Default branch name. Defaults to `main`. */ defaultBranch?: string; /** * Create a bare repository (no working tree). Default `false`. * Bare repositories live in `dir` directly rather than under * `dir/.git`. */ bare?: boolean; } //#endregion //#region src/git/network.d.ts /** Shape isomorphic-git accepts for HTTP basic / bearer auth. */ interface GitAuth { username?: string; password?: string; headers?: Record; } /** Auth callback signature shared by every network operation. */ type AuthCallback = (url: string, auth: GitAuth) => GitAuth | undefined | undefined | Promise; /** Progress callback shared with clone (see clone.ts). */ type ProgressCallback = (e: { phase: string; loaded: number; total?: number; }) => void; /** Sideband message callback shared with clone. */ type MessageCallback = (msg: string) => void; /** Per-ref status emitted by `push`. */ interface RefUpdateStatus { ok: boolean; error?: string; } interface PushResult { ok: boolean; error: string | null; refs: Record; } interface GitFetchOptions { dir?: string; /** Remote name (e.g. "origin"). Mutually exclusive with `url`. */ remote?: string; /** Remote URL. Mutually exclusive with `remote`. */ url?: string; /** Local ref to update. */ ref?: string; /** Remote ref to read. */ remoteRef?: string; depth?: number; singleBranch?: boolean; tags?: boolean; prune?: boolean; headers?: Record; onAuth?: AuthCallback; onProgress?: ProgressCallback; onMessage?: MessageCallback; } interface FetchResult { defaultBranch: string | null; fetchHead: string | null; } interface GitPushOptions { dir?: string; remote?: string; url?: string; ref?: string; remoteRef?: string; force?: boolean; /** Delete the remote ref rather than push to it. */ delete?: boolean; headers?: Record; onAuth?: AuthCallback; onProgress?: ProgressCallback; onMessage?: MessageCallback; } interface GitPullOptions { dir?: string; remote?: string; url?: string; ref?: string; remoteRef?: string; fastForward?: boolean; fastForwardOnly?: boolean; singleBranch?: boolean; headers?: Record; onAuth?: AuthCallback; onProgress?: ProgressCallback; onMessage?: MessageCallback; /** Identity for the merge commit pull may create. */ author?: { name: string; email: string; }; committer?: { name: string; email: string; }; /** * Env to read GIT_AUTHOR_* / GIT_COMMITTER_* from when pull * needs to materialize a merge commit. Same precedence as * commit: explicit -> env -> defaultIdentity. */ env?: Record; } interface GitMergeOptions { dir?: string; /** Source branch to merge in. */ theirs: string; /** Target branch. Defaults to the current branch (HEAD). */ ours?: string; fastForward?: boolean; fastForwardOnly?: boolean; message?: string; /** Identity for the merge commit (when a fast-forward isn't possible). */ author?: { name: string; email: string; }; committer?: { name: string; email: string; }; env?: Record; } interface MergeResult { oid?: string; alreadyMerged?: boolean; fastForward?: boolean; } interface GitRemoteAddOptions { dir?: string; name: string; url: string; /** Overwrite an existing remote with the same name. */ force?: boolean; } interface GitRemoteRemoveOptions { dir?: string; name: string; } interface GitRemoteListOptions { dir?: string; } interface RemoteView { name: string; url: string; } //#endregion //#region src/git/plumbing.d.ts /** The four object types git stores, as `cat-file -t` names them. */ type GitObjectType = "blob" | "tree" | "commit" | "tag"; interface GitHashObjectOptions { dir?: string; /** Raw bytes to hash. */ content: Uint8Array | string; /** Write the resulting blob into the object store. Defaults to `false`. */ write?: boolean; } interface GitCatFileOptions { dir?: string; /** Object id to read. */ oid: string; /** * Sub-path inside a tree. Only valid for tree-shaped oids; * matches real git's `git cat-file -p :` shape. */ filepath?: string; } interface CatFileResult { oid: string; /** Raw object bytes. */ bytes: Uint8Array; /** * Object type, as `git cat-file -t` reports it. Present when the * object was read through `readObject`; a blob read by the fast path * is always `"blob"`. */ type?: GitObjectType; } interface GitUpdateRefOptions { dir?: string; /** Ref to update, e.g. "refs/heads/main" or a short name. */ ref: string; /** Oid the ref should point at. */ value: string; /** Allow overwriting a non-fast-forward update. Defaults to `false`. */ force?: boolean; /** * Write a symbolic ref (e.g. HEAD -> refs/heads/main) rather * than a direct oid. Defaults to `false`. */ symbolic?: boolean; } interface GitConfigGetOptions { dir?: string; /** Config key, e.g. "user.email". */ path: string; /** Return every value for a multi-valued key. Defaults to `false`. */ all?: boolean; } interface GitConfigSetOptions { dir?: string; path: string; /** * Value to write. `undefined` unsets the key, matching * `git config --unset`. */ value: string | boolean | number | undefined; /** Append to a multi-valued key rather than replacing. */ append?: boolean; } //#endregion //#region src/git/reads.d.ts interface GitPerson { name: string; email: string; /** Seconds since epoch. */ timestamp: number; /** Minutes east of UTC. */ timezoneOffset: number; } interface CommitView { oid: string; message: string; tree: string; parent: string[]; author: GitPerson; committer: GitPerson; } interface TreeEntryView { /** 6-digit hex mode as isomorphic-git emits it ('100644', '040000', ...). */ mode: string; /** Entry name (no leading path). */ path: string; oid: string; type: "blob" | "tree" | "commit"; } interface BaseReadOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; } interface GitLogOptions extends BaseReadOptions { /** Ref to start the walk at. Defaults to HEAD. */ ref?: string; /** Max commits to return. Defaults to unbounded. */ depth?: number; } interface GitShowOptions extends BaseReadOptions { /** Object to show. Today: a commit oid or a ref that resolves to one. */ ref: string; } interface GitRevParseOptions extends BaseReadOptions { /** Ref to resolve. */ ref: string; } interface GitRepoRootOptions extends BaseReadOptions {} interface GitCurrentBranchOptions extends BaseReadOptions { /** Return refs/heads/ instead of . */ fullname?: boolean; } interface GitLsFilesOptions extends BaseReadOptions { /** List files in this ref's tree instead of the index. */ ref?: string; } interface GitLsTreeOptions extends BaseReadOptions { /** Tree-ish to list. */ ref: string; /** Sub-path within the tree. Defaults to the root. */ path?: string; } //#endregion //#region src/git/refs.d.ts interface GitBranchOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** Branch name to create. */ name: string; /** Commit-ish the branch points at. Defaults to HEAD. */ startPoint?: string; /** Move HEAD to the new branch. Defaults to `false`. */ checkout?: boolean; /** Overwrite an existing branch with the same name. */ force?: boolean; } interface GitBranchDeleteOptions { dir?: string; name: string; } interface GitBranchListOptions { dir?: string; } interface GitTagOptions { dir?: string; /** Tag name. */ name: string; /** Commit-ish to tag. Defaults to HEAD. */ object?: string; /** Overwrite an existing tag. */ force?: boolean; } interface GitTagDeleteOptions { dir?: string; name: string; } interface GitTagListOptions { dir?: string; } interface GitCheckoutOptions { dir?: string; /** Branch, tag, or commit to check out. */ ref: string; /** * Restrict the checkout to these paths. When set, HEAD does * not move (matching `git checkout -- `); the * working tree is updated to match `ref` for those paths only. */ paths?: string[]; /** Discard local changes that would conflict with the checkout. */ force?: boolean; } //#endregion //#region src/git/staging.d.ts interface GitAddOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** * Paths to stage, relative to `dir`. Empty array is a no-op * (matching `git add` with no arguments — which exits 0 with a * usage message; the CLI catches the no-arg case before * calling). Absolute or `..`-bearing paths are rejected at the * call site. */ paths: string[]; /** * Stage even paths that match `.gitignore`. isomorphic-git's * `add` honours ignore patterns by default; pass `true` to * override. */ force?: boolean; /** * Stage every change under the repository — new, modified, and * deleted tracked files — the way `git add -A` / `--all` does. * When set, `paths` is ignored. Deletions are staged through * `remove`, which `add` alone cannot express. */ all?: boolean; /** * Restrict `all` mode to paths already tracked in HEAD — the * `git commit -a` semantics, which stage modifications and * deletions but never add untracked files. Ignored unless * `all` is set. */ trackedOnly?: boolean; } interface GitRmOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; /** Paths to unstage, relative to `dir`. */ paths: string[]; } //#endregion //#region src/git/worktree.d.ts interface BaseWorktreeOptions { /** Working-tree directory inside the VFS. Defaults to `/`. */ dir?: string; } interface StashPushOptions extends BaseWorktreeOptions { /** Optional stash message. */ message?: string; } interface StashPopOptions extends BaseWorktreeOptions { /** Stash index to pop. Defaults to the latest (0). */ index?: number; } interface ResetOptions extends BaseWorktreeOptions { /** * Paths to unstage against `ref`. Mutually exclusive with * `hard`; when set, the index entries for these paths are reset * to `ref` (default HEAD) and the working tree is left alone. */ paths?: string[]; /** * Discard staged and working-tree changes, restoring tracked * files to `ref`. Equivalent to `git reset --hard`. */ hard?: boolean; /** Commit-ish to reset to. Defaults to HEAD. */ ref?: string; } interface CleanOptions extends BaseWorktreeOptions { /** Remove untracked directories too (`-d`). */ directories?: boolean; /** List what would be removed without removing it (`--dry-run`). */ dryRun?: boolean; } //#endregion //#region src/git/errors.d.ts /** * Base class for every workspace-git error. The `code` field is * the contract: CLI dispatchers and external callers branch on * it. Subclass instances also pin `name` to a stable string so * `Error.prototype.toString()` reads sensibly. */ declare class GitError extends Error { readonly code: string; constructor(code: string, message: string, options?: { cause?: unknown; }); } /** * Raised when an operation needs a git repository at `dir` and * none exists. CLI exit code: 128. */ declare class NotARepositoryError extends GitError { constructor(dir: string, options?: { cause?: unknown; }); } /** * Raised when an operation needs a working repository at `dir` * and `dir` already contains a `.git` directory. CLI exit code: * 128. */ declare class AlreadyInitializedError extends GitError { constructor(dir: string, options?: { cause?: unknown; }); } /** * Raised when a commit-producing operation can't resolve an * author / committer identity from any source (call-site * options, `GIT_AUTHOR_*` / `GIT_COMMITTER_*` env vars, or the * client's `defaultIdentity`). CLI exit code: 128. */ declare class MissingIdentityError extends GitError { constructor(options?: { cause?: unknown; }); } /** * Raised when a path argument falls outside the working tree * root. CLI exit code: 128. */ declare class PathOutsideRepoError extends GitError { constructor(path: string, dir: string, options?: { cause?: unknown; }); } /** * Raised when an op operates on paths and none of them resolve. * Real git exits 128 with `pathspec '' did not match any files`; * we do the same. */ declare class PathspecNotFoundError extends GitError { constructor(pathspec: string, options?: { cause?: unknown; }); } //#endregion //#region src/git/index.d.ts /** Duck-typed workspace handle. Only `.provider()` is required. */ interface WorkspaceLike { provider(): SQLiteWorkspaceProvider; } /** * Identity used as the author/committer fallback when a commit- * producing subcommand (`commit`, `pull`, `merge`) isn't passed * one explicitly. The precedence is explicit options → * `GIT_AUTHOR_*` / `GIT_COMMITTER_*` env → this fallback. If * none of the three yields a name and email, * `MissingIdentityError` fires. */ interface GitIdentity { name: string; email: string; } /** Methods returned by `createGitClient`. */ interface GitClient { /** Shallow-clone a remote into the bound workspace. */ clone(options: GitCloneOptions): Promise; /** Unified diff between a ref (default HEAD) and the working tree. */ diff(options?: GitDiffOptions): Promise; /** Per-file change summary backing `--stat` / `--name-only` / `--name-status`. */ diffSummary(options?: GitDiffOptions): Promise; /** Initialise a new repository in the bound workspace. */ init(options?: GitInitOptions): Promise; /** Describe the working-tree / index / HEAD delta. */ status(options?: GitStatusOptions): Promise; /** Stage paths into the index. */ add(options: GitAddOptions): Promise; /** Unstage paths from the index. */ rm(options: GitRmOptions): Promise; /** Write the current index to a new commit on HEAD. */ commit(options: GitCommitOptions): Promise; /** Walk commits from `ref` (default HEAD) backwards through history. */ log(options?: GitLogOptions): Promise; /** Read a single commit by ref or oid. */ show(options: GitShowOptions): Promise; /** Resolve a ref to its SHA-1 oid. */ revParse(options: GitRevParseOptions): Promise; /** Find the repository root by walking up from `dir`. */ repoRoot(options?: GitRepoRootOptions): Promise; /** Current branch name, or undefined on detached HEAD. */ currentBranch(options?: GitCurrentBranchOptions): Promise; /** List files in the index (or at a given ref). */ lsFiles(options?: GitLsFilesOptions): Promise; /** List one level of a tree (or sub-tree). */ lsTree(options: GitLsTreeOptions): Promise; /** Create a branch. */ branch(options: GitBranchOptions): Promise; /** Delete a branch. */ branchDelete(options: GitBranchDeleteOptions): Promise; /** List local branches. */ branchList(options?: GitBranchListOptions): Promise; /** Create a lightweight tag. */ tag(options: GitTagOptions): Promise; /** Delete a tag. */ tagDelete(options: GitTagDeleteOptions): Promise; /** List tags. */ tagList(options?: GitTagListOptions): Promise; /** Move HEAD to a ref, or update working-tree paths to a ref. */ checkout(options: GitCheckoutOptions): Promise; /** Fetch refs from a remote. */ fetch(options?: GitFetchOptions): Promise; /** Push local refs to a remote. */ push(options?: GitPushOptions): Promise; /** Fetch and merge in one step. */ pull(options?: GitPullOptions): Promise; /** Merge a ref into the current branch (or `ours`). */ merge(options: GitMergeOptions): Promise; /** Add a named remote pointing at a URL. */ remoteAdd(options: GitRemoteAddOptions): Promise; /** Remove a named remote. */ remoteRemove(options: GitRemoteRemoveOptions): Promise; /** List configured remotes. */ remoteList(options?: GitRemoteListOptions): Promise; /** Hash bytes as a blob; optionally write into the object store. */ hashObject(options: GitHashObjectOptions): Promise; /** Read raw bytes for an object by oid. */ catFile(options: GitCatFileOptions): Promise; /** Write a ref directly. */ updateRef(options: GitUpdateRefOptions): Promise; /** Read a single config key. */ configGet(options: GitConfigGetOptions): Promise; /** Write a single config key. */ configSet(options: GitConfigSetOptions): Promise; /** Stash tracked working-tree changes. */ stashPush(options?: StashPushOptions): Promise; /** List stash entries, newest first. */ stashList(options?: BaseWorktreeOptions): Promise; /** Restore the latest stash entry. */ stashPop(options?: StashPopOptions): Promise; /** Unstage paths or hard-reset tracked files to a ref. */ reset(options?: ResetOptions): Promise; /** Remove untracked files (and directories with `directories`). */ clean(options?: CleanOptions): Promise; /** * Argv-driven entry point. The worker-backend's `git` custom * command dispatches through this; in-process callers can use * it too when they want CLI-shaped output. */ cli(input: GitCliInput): Promise; } interface WorkspaceGitClientOptions { /** Workspace whose provider backs the git operations. */ ws: WorkspaceLike; /** * Default identity used by commit-producing subcommands * (`commit`, `pull`, `merge`) when the caller hasn't passed * one explicitly and the relevant `GIT_AUTHOR_*` / * `GIT_COMMITTER_*` env vars are absent. */ defaultIdentity?: GitIdentity; } interface CreateGitClientOptions { /** * Test seam for substituting the @platformatic/vfs adapter. * Production callers do not pass this. */ adapter?: (provider: SQLiteWorkspaceProvider) => Promise; } type GitClientFactory = (options: WorkspaceGitClientOptions) => GitClient; /** * Build a git client bound to a workspace. * * The FsClient is constructed lazily on first use and reused * across subsequent calls — `@platformatic/vfs.create()` is cheap * but not free, and the workspace provider is stable for the * lifetime of the client. * * An isomorphic-git pack/index cache is also created per client * and threaded into every isogit call. Without this, each * `readBlob` / `statusMatrix` / `walk` re-parses the packfile * from the SQLite-backed VFS — fine for tiny repos, catastrophic * for anything with a real history (the difference between a * sub-second `diff` and one that hangs for minutes). * * The dynamic imports for `isomorphic-git`, its HTTP transport, * and the `diff` package are memoised on the client too. The * first method call pays the cost; every subsequent call (typed * or CLI) reuses the resolved modules. */ declare function createGitClient({ adapter }?: CreateGitClientOptions): GitClientFactory; //#endregion export { MergeResult as $, GitLogOptions as A, GitConfigSetOptions as B, GitBranchOptions as C, GitTagOptions as D, GitTagListOptions as E, GitShowOptions as F, GitAuth as G, GitUpdateRefOptions as H, TreeEntryView as I, GitPullOptions as J, GitFetchOptions as K, CatFileResult as L, GitLsTreeOptions as M, GitRepoRootOptions as N, CommitView as O, GitRevParseOptions as P, GitRemoteRemoveOptions as Q, GitCatFileOptions as R, GitBranchListOptions as S, DurableObjectStorageLike as St, GitTagDeleteOptions as T, AuthCallback as U, GitHashObjectOptions as V, FetchResult as W, GitRemoteAddOptions as X, GitPushOptions as Y, GitRemoteListOptions as Z, StashPopOptions as _, SQLiteWorkspaceProviderOptions as _t, WorkspaceGitClientOptions as a, GitDiffOptions as at, GitRmOptions as b, MkdirOptions as bt, AlreadyInitializedError as c, StatusEntry as ct, NotARepositoryError as d, GitCloneOptions as dt, PushResult as et, PathOutsideRepoError as f, MessageCallback$1 as ft, ResetOptions as g, SQLiteWorkspaceProvider as gt, CleanOptions as h, GitCliResult as ht, GitIdentity as i, DiffSummaryEntry as it, GitLsFilesOptions as j, GitCurrentBranchOptions as k, GitError as l, CommitResult as lt, BaseWorktreeOptions as m, GitCliInput as mt, GitClient as n, RemoteView as nt, WorkspaceLike as o, StatusRow as ot, PathspecNotFoundError as p, ProgressCallback$1 as pt, GitMergeOptions as q, GitClientFactory as r, GitInitOptions as rt, createGitClient as s, GitStatusOptions as st, CreateGitClientOptions as t, RefUpdateStatus as tt, MissingIdentityError as u, GitCommitOptions as ut, StashPushOptions as v, WriteFileContent as vt, GitCheckoutOptions as w, GitBranchDeleteOptions as x, Database as xt, GitAddOptions as y, WriteFileOptions as yt, GitConfigGetOptions as z }; //# sourceMappingURL=shared-BTtKnEVB.d.ts.map