just-git 0.1.3 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +11 -8
  2. package/dist/index.js +210 -199
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # just-git
2
2
 
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
+ [![npm](https://img.shields.io/npm/v/just-git)](https://www.npmjs.com/package/just-git)
5
+
3
6
  Git implementation for virtual bash environments (particularly [just-bash](https://github.com/vercel-labs/just-bash)). Pure TypeScript, zero dependencies. Works in Node, Bun, Deno, and the browser. ~97 kB gzipped.
4
7
 
5
8
  ## Install
@@ -34,19 +37,19 @@ await bash.exec("git log --oneline");
34
37
 
35
38
  `createGit(options?)` accepts:
36
39
 
37
- | Option | Description |
38
- | ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
39
- | `identity` | Author/committer override. With `locked: true`, always wins over env vars and git config. Without `locked`, acts as a fallback. |
40
- | `credentials` | `(url) => HttpAuth \| null` callback for Smart HTTP transport auth. |
41
- | `disabled` | `GitCommandName[]` of subcommands to block (e.g. `["push", "rebase"]`). |
42
- | `network` | `{ allowed?: string[] }` to restrict HTTP access by hostname or URL prefix. Set to `false` to block all network access. |
40
+ | Option | Description |
41
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42
+ | `identity` | Author/committer override. With `locked: true`, always wins over env vars and git config. Without `locked`, acts as a fallback. |
43
+ | `credentials` | `(url) => HttpAuth \| null` callback for Smart HTTP transport auth. |
44
+ | `disabled` | `GitCommandName[]` of subcommands to block (e.g. `["push", "rebase"]`). |
45
+ | `network` | `{ allowed?: string[], fetch?: FetchFunction }` to restrict HTTP access and/or provide a custom `fetch` implementation. Set to `false` to block all network access. |
43
46
 
44
47
  ```ts
45
48
  const git = createGit({
46
49
  identity: { name: "Agent Bot", email: "bot@company.com", locked: true },
47
50
  credentials: async (url) => ({ type: "bearer", token: "ghp_..." }),
48
51
  disabled: ["rebase"],
49
- network: { allowed: ["github.com"] },
52
+ network: { allowed: ["github.com"], fetch: customFetch },
50
53
  });
51
54
  ```
52
55
 
@@ -233,7 +236,7 @@ Fire-and-forget events emitted on every object/ref write. Handler errors are cau
233
236
 
234
237
  High fidelity to real git (2.53.0) state and output. Tested using real git as an [oracle](test/oracle/README.md) across hundreds of randomized command traces.
235
238
 
236
- This library is not yet interoperable with real git on the same filesystem (e.g. if you're using just-bash backed by a real filesystem where real git is also used to interact with repos). Interoperability happens at the network layer — clone, fetch, and push speak the Smart HTTP protocol and exchange standard packfiles. The internal `.git` directory layout is not guaranteed to be compatible with real git.
239
+ When backed by a real filesystem (e.g. `just-bash` `ReadWriteFs`), interoperable with real git on the same repo, though less extensively tested than behavioral correctness.
237
240
 
238
241
  ## Disclaimer
239
242