just-git 1.4.2 → 1.5.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 CHANGED
@@ -71,7 +71,7 @@ Bun.serve({ fetch: server.fetch });
71
71
  // git push http://localhost:3000/my-repo main ← repo created on first push
72
72
  ```
73
73
 
74
- Add branch protection, auth, and push hooks as needed:
74
+ Add branch protection, auth, push hooks, programmatic commits, forks, and GC:
75
75
 
76
76
  ```ts
77
77
  import { createServer, BunSqliteStorage } from "just-git/server";
@@ -96,6 +96,20 @@ const server = createServer({
96
96
  },
97
97
  });
98
98
 
99
+ // Commit files to a branch server-side (safe against concurrent writes)
100
+ await server.commit("my-repo", {
101
+ files: { "README.md": "# Hello\n" },
102
+ message: "initial commit",
103
+ author: { name: "Bot", email: "bot@example.com" },
104
+ branch: "main",
105
+ });
106
+
107
+ // Fork a repo, shares the parent's object pool
108
+ await server.forkRepo("my-repo", "user/fork");
109
+
110
+ // Garbage-collect unreachable objects
111
+ await server.gc("my-repo");
112
+
99
113
  Bun.serve({ fetch: server.fetch });
100
114
  ```
101
115