just-git 1.5.12 → 1.5.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  [![CI](https://github.com/blindmansion/just-git/actions/workflows/ci.yml/badge.svg)](https://github.com/blindmansion/just-git/actions/workflows/ci.yml)
4
4
  [![npm](https://img.shields.io/npm/v/just-git)](https://www.npmjs.com/package/just-git)
5
- [![bundle size](https://img.shields.io/bundlejs/size/just-git)](https://bundlejs.com/?q=just-git)
5
+ [![client size](https://img.shields.io/bundlejs/size/just-git?label=client)](https://bundlejs.com/?q=just-git)
6
+ [![server size](https://img.shields.io/bundlejs/size/just-git/server?label=server)](https://bundlejs.com/?q=just-git/server)
6
7
 
7
8
  Pure TypeScript git implementation. Zero dependencies. 36 commands. Works in Node, Bun, Deno, Cloudflare Workers, and the browser. [Tested against real git](docs/TESTING.md) across more than a million randomized operations.
8
9
 
9
10
  The Git CLI, Git servers, and CI workflows are no longer just things you use to develop apps: they can be part of the apps themselves. The goal of this project is to make that practical.
10
11
 
11
- - **Virtual filesystem client** for sandboxed environments. Pairs with [just-bash](https://github.com/vercel-labs/just-bash), or use standalone.
12
+ - **[Virtual filesystem client](docs/CLIENT.md)** for sandboxed environments. Pairs with [just-bash](https://github.com/vercel-labs/just-bash), or use standalone.
12
13
  - **[Embeddable git server](docs/SERVER.md)** with pluggable storage, auth, and hooks. Supports HTTP, SSH, and in-process transport.
13
14
  - **[Repo module](docs/REPO.md)** with typed functions for commits, diffs, merges, blame, and bisect that work identically against a virtual filesystem or a database.
14
15
 
@@ -61,11 +62,18 @@ await git.exec('git commit -m "initial commit"');
61
62
 
62
63
  Both `fs` and `cwd` can be set once in `createGit` and overridden per-call. `cwd` defaults to `"/"`. Set it to the repo root so every `exec` call finds `.git` automatically.
63
64
 
64
- `createGit` also supports [command restrictions, network policies, and config overrides](docs/CLIENT.md#options) for sandboxing, a [lifecycle hooks API](docs/CLIENT.md#hooks) covering pre-commit secret scanning to push gating, and [cross-VFS remote resolution](docs/CLIENT.md#multi-agent-collaboration) for multi-agent collaboration. See [CLIENT.md](docs/CLIENT.md) for the full reference.
65
+ `createGit` also supports:
66
+
67
+ - [Command restrictions, network policies, and config overrides](docs/CLIENT.md#options) for sandboxing
68
+ - [Lifecycle hooks](docs/CLIENT.md#hooks) from pre-commit secret scanning to push gating
69
+ - [Custom merge drivers](docs/CLIENT.md#merge-driver) for programmatic conflict resolution
70
+ - [Cross-VFS remote resolution](docs/CLIENT.md#multi-agent-collaboration) for multi-agent collaboration
71
+
72
+ See [CLIENT.md](docs/CLIENT.md) for the full reference.
65
73
 
66
74
  ### Server
67
75
 
68
- Stand up a git server in two lines. Storage defaults to in-memory; swap in SQLite, PostgreSQL, or your own backend for persistence:
76
+ Stand up a git server in two lines. Storage defaults to in-memory; swap in SQLite, PostgreSQL, [Cloudflare Durable Objects](docs/SERVER.md#durableobjectsqlitestorage), or your own backend for persistence:
69
77
 
70
78
  ```ts
71
79
  import { createServer } from "just-git/server";
@@ -117,7 +125,12 @@ await server.gc("my-repo");
117
125
  Bun.serve({ fetch: server.fetch });
118
126
  ```
119
127
 
120
- Uses web-standard `Request`/`Response`. Works with Bun, Hono, Cloudflare Workers, or any fetch-compatible runtime. For Node.js, use `server.nodeHandler` with `http.createServer` and `BetterSqlite3Storage` for `better-sqlite3`. SSH is supported via `server.handleSession`. The [`Storage` interface](docs/SERVER.md#custom-storage) is small enough to plug in any datastore. See [SERVER.md](docs/SERVER.md) for the full API.
128
+ - Web-standard `Request`/`Response` works with Bun, Hono, Cloudflare Workers, Durable Objects, or any fetch-compatible runtime
129
+ - Node.js support via `server.nodeHandler` with `http.createServer` and `BetterSqlite3Storage`
130
+ - [SSH](docs/SERVER.md#ssh) via `server.handleSession`
131
+ - [`Storage` interface](docs/SERVER.md#custom-storage) small enough to plug in any datastore
132
+
133
+ See [SERVER.md](docs/SERVER.md) for the full API.
121
134
 
122
135
  ## Repo module
123
136
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { F as FileSystem, G as GitHooks, C as CredentialProvider, I as IdentityOverride, N as NetworkPolicy, R as RemoteResolver, O as ObjectStore, a as RefStore, b as ConfigOverrides, P as ProgressCallback, E as ExecResult, c as FileStat, d as GitContext } from './hooks-B50z7ycn.js';
2
2
  export { A as AfterCommandEvent, B as BeforeCommandEvent, e as Commit, f as CommitMsgEvent, D as DirectRef, g as GitRepo, H as HttpAuth, h as Identity, M as MergeMsgEvent, i as ObjectId, j as ObjectType, k as ObjectWriteEvent, l as PackObject, m as PostApplyEvent, n as PostCheckoutEvent, o as PostCherryPickEvent, p as PostCloneEvent, q as PostCommitEvent, r as PostFetchEvent, s as PostMergeEvent, t as PostPullEvent, u as PostPushEvent, v as PostResetEvent, w as PostRevertEvent, x as PreApplyEvent, y as PreCheckoutEvent, z as PreCherryPickEvent, J as PreCloneEvent, K as PreCommitEvent, L as PreFetchEvent, Q as PreMergeCommitEvent, S as PrePullEvent, T as PrePushEvent, U as PreRebaseEvent, V as PreResetEvent, W as PreRevertEvent, X as RawObject, Y as Ref, Z as RefDeleteEvent, _ as RefEntry, $ as RefUpdateEvent, a0 as Rejection, a1 as SymbolicRef, a2 as composeGitHooks, a3 as isRejection } from './hooks-B50z7ycn.js';
3
+ import { M as MergeDriver } from './merge-ort-BYMritNd.js';
4
+ export { a as MergeDriverResult } from './merge-ort-BYMritNd.js';
3
5
 
4
6
  /** Options for subcommand execution (mirrors just-bash's CommandExecOptions). */
5
7
  interface CommandExecOptions {
@@ -86,6 +88,15 @@ interface GitOptions {
86
88
  * remote — format varies by server.
87
89
  */
88
90
  onProgress?: ProgressCallback;
91
+ /**
92
+ * Custom merge driver for content conflicts. Called during
93
+ * `git merge`, `git cherry-pick`, `git revert`, `git rebase`,
94
+ * and `git pull` when both sides modify the same file.
95
+ *
96
+ * Return `{ content, conflict: false }` for a clean resolution,
97
+ * or `null` to fall back to the default diff3 algorithm.
98
+ */
99
+ mergeDriver?: MergeDriver;
89
100
  }
90
101
  /** Simplified context for {@link Git.exec}. */
91
102
  interface ExecContext {
@@ -175,4 +186,4 @@ declare class MemoryFileSystem implements FileSystem {
175
186
  */
176
187
  declare function findRepo(fs: FileSystem, startPath: string): Promise<GitContext | null>;
177
188
 
178
- export { ConfigOverrides, CredentialProvider, type ExecContext, ExecResult, FileStat, FileSystem, Git, type GitCommandName, GitContext, GitHooks, type GitOptions, IdentityOverride, MemoryFileSystem, NetworkPolicy, ObjectStore, ProgressCallback, RefStore, RemoteResolver, createGit, findRepo };
189
+ export { ConfigOverrides, CredentialProvider, type ExecContext, ExecResult, FileStat, FileSystem, Git, type GitCommandName, GitContext, GitHooks, type GitOptions, IdentityOverride, MemoryFileSystem, MergeDriver, NetworkPolicy, ObjectStore, ProgressCallback, RefStore, RemoteResolver, createGit, findRepo };