@pierre/storage 0.1.4 → 0.2.1

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
@@ -201,6 +201,34 @@ builder throws a `RefUpdateError` containing the status, reason, and ref details
201
201
  > the source branch and omit `expectedHeadSha` so the service clones that tip before applying your
202
202
  > changes.
203
203
 
204
+ ### Apply a pre-generated diff
205
+
206
+ If you already have a patch (for example, the output of `git diff --binary`) you can stream it to
207
+ the gateway with a single call. The SDK handles chunking and NDJSON streaming just like it does for
208
+ regular commits:
209
+
210
+ ```ts
211
+ const fs = await import('node:fs/promises');
212
+
213
+ const patch = await fs.readFile('build/generated.patch', 'utf8');
214
+
215
+ const diffResult = await repo.createCommitFromDiff({
216
+ targetBranch: 'feature/apply-diff',
217
+ expectedHeadSha: 'abc123def4567890abc123def4567890abc12345',
218
+ commitMessage: 'Apply generated API changes',
219
+ author: { name: 'Diff Bot', email: 'diff@example.com' },
220
+ diff: patch,
221
+ });
222
+
223
+ console.log(diffResult.commitSha);
224
+ console.log(diffResult.refUpdate.newSha);
225
+ ```
226
+
227
+ The `diff` field accepts a `string`, `Uint8Array`, `ArrayBuffer`, `Blob`, `File`, `ReadableStream`,
228
+ iterable, or async iterable of byte chunks—the same sources supported by the standard commit
229
+ builder. `createCommitFromDiff` returns a `Promise<CommitResult>` and throws a `RefUpdateError` when
230
+ the server rejects the diff (for example, if the branch tip changed).
231
+
204
232
  ### Streaming Large Files
205
233
 
206
234
  The commit builder accepts any async iterable of bytes, so you can stream large assets without