just-git 1.5.13 → 1.6.0
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 +17 -4
- package/dist/{hooks-B50z7ycn.d.ts → hooks-pZgz2y6k.d.ts} +2 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.js +359 -361
- package/dist/merge-ort-BYMritNd.d.ts +40 -0
- package/dist/repo/index.d.ts +30 -67
- package/dist/repo/index.js +12 -12
- package/dist/server/index.d.ts +85 -22
- package/dist/server/index.js +37 -37
- package/dist/{writing-BYrXF-yM.d.ts → writing-O7uuLVT_.d.ts} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/blindmansion/just-git/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/just-git)
|
|
5
|
-
[](https://bundlejs.com/?q=just-git)
|
|
6
|
+
[](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,7 +62,14 @@ 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
|
|
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
|
|
|
@@ -117,7 +125,12 @@ await server.gc("my-repo");
|
|
|
117
125
|
Bun.serve({ fetch: server.fetch });
|
|
118
126
|
```
|
|
119
127
|
|
|
120
|
-
|
|
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
|
|
|
@@ -208,8 +208,10 @@ interface RefStore {
|
|
|
208
208
|
*/
|
|
209
209
|
interface ObjectStore {
|
|
210
210
|
read(hash: ObjectId): Promise<RawObject>;
|
|
211
|
+
readMany?(hashes: ReadonlyArray<ObjectId>): Promise<Map<ObjectId, RawObject>>;
|
|
211
212
|
write(type: ObjectType, content: Uint8Array): Promise<ObjectId>;
|
|
212
213
|
exists(hash: ObjectId): Promise<boolean>;
|
|
214
|
+
existsMany?(hashes: ReadonlyArray<ObjectId>): Promise<Set<ObjectId>>;
|
|
213
215
|
ingestPack(packData: Uint8Array): Promise<number>;
|
|
214
216
|
/**
|
|
215
217
|
* Ingest pre-resolved objects from a streaming source.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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-
|
|
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-
|
|
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-pZgz2y6k.js';
|
|
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-pZgz2y6k.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 };
|