@scolladon/tsgit 0.9.0 → 1.1.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.
Files changed (143) hide show
  1. package/README.md +116 -1
  2. package/dist/cjs/adapters/browser/index.cjs +1 -1
  3. package/dist/cjs/adapters/browser/index.cjs.map +1 -1
  4. package/dist/cjs/adapters/memory/index.cjs +1 -1
  5. package/dist/cjs/adapters/memory/index.cjs.map +1 -1
  6. package/dist/cjs/adapters/node/index.cjs +1 -1
  7. package/dist/cjs/adapters/node/index.cjs.map +1 -1
  8. package/dist/cjs/chunks/{browser-http-transport-BBF8uw-f.cjs → browser-http-transport-DcG05jw3.cjs} +2 -2
  9. package/dist/cjs/chunks/{browser-http-transport-BBF8uw-f.cjs.map → browser-http-transport-DcG05jw3.cjs.map} +1 -1
  10. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +1 -1
  11. package/dist/cjs/chunks/error-CqLvhejR.cjs +2 -0
  12. package/dist/cjs/chunks/error-CqLvhejR.cjs.map +1 -0
  13. package/dist/cjs/chunks/index-BcxdLkNe.cjs +2 -0
  14. package/dist/cjs/chunks/index-BcxdLkNe.cjs.map +1 -0
  15. package/dist/cjs/chunks/index-D5Nd-Mks.cjs +2 -0
  16. package/dist/cjs/chunks/index-D5Nd-Mks.cjs.map +1 -0
  17. package/dist/cjs/chunks/{logger-Cz9r6yt5.cjs → logger-C8Z5BfFF.cjs} +2 -2
  18. package/dist/cjs/chunks/{logger-Cz9r6yt5.cjs.map → logger-C8Z5BfFF.cjs.map} +1 -1
  19. package/dist/cjs/chunks/memory-http-transport-Pjyme5KN.cjs +2 -0
  20. package/dist/cjs/chunks/memory-http-transport-Pjyme5KN.cjs.map +1 -0
  21. package/dist/cjs/chunks/node-http-transport-UkW5eEm3.cjs +2 -0
  22. package/dist/cjs/chunks/node-http-transport-UkW5eEm3.cjs.map +1 -0
  23. package/dist/cjs/chunks/{progress-CK7CT9vU.cjs → progress-CntEbiuo.cjs} +2 -2
  24. package/dist/cjs/chunks/{progress-CK7CT9vU.cjs.map → progress-CntEbiuo.cjs.map} +1 -1
  25. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +2 -0
  26. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +1 -0
  27. package/dist/cjs/chunks/repository-B_jx2AKW.cjs +2 -0
  28. package/dist/cjs/chunks/repository-B_jx2AKW.cjs.map +1 -0
  29. package/dist/cjs/commands/index.cjs +1 -1
  30. package/dist/cjs/index.browser.cjs +1 -1
  31. package/dist/cjs/index.browser.cjs.map +1 -1
  32. package/dist/cjs/index.cjs +1 -1
  33. package/dist/cjs/index.default.cjs +1 -1
  34. package/dist/cjs/index.default.cjs.map +1 -1
  35. package/dist/cjs/index.node.cjs +1 -1
  36. package/dist/cjs/index.node.cjs.map +1 -1
  37. package/dist/cjs/operators/index.cjs +1 -1
  38. package/dist/cjs/operators/index.cjs.map +1 -1
  39. package/dist/cjs/primitives/index.cjs +1 -1
  40. package/dist/cjs/primitives/index.cjs.map +1 -1
  41. package/dist/cjs/transport/index.cjs.map +1 -1
  42. package/dist/esm/adapters/browser/index.js +1 -1
  43. package/dist/esm/adapters/browser/index.js.map +1 -1
  44. package/dist/esm/adapters/memory/index.js +1 -1
  45. package/dist/esm/adapters/memory/index.js.map +1 -1
  46. package/dist/esm/adapters/node/index.js +1 -1
  47. package/dist/esm/adapters/node/index.js.map +1 -1
  48. package/dist/esm/chunks/{browser-http-transport-CRPPmib5.js → browser-http-transport-COFgnEyq.js} +2 -2
  49. package/dist/esm/chunks/{browser-http-transport-CRPPmib5.js.map → browser-http-transport-COFgnEyq.js.map} +1 -1
  50. package/dist/esm/chunks/context-CumKOV7K.js.map +1 -1
  51. package/dist/esm/chunks/error-BN9rdQ33.js +2 -0
  52. package/dist/esm/chunks/error-BN9rdQ33.js.map +1 -0
  53. package/dist/esm/chunks/index-BdV37p4e.js +2 -0
  54. package/dist/esm/chunks/index-BdV37p4e.js.map +1 -0
  55. package/dist/esm/chunks/index-BkRJ9-Im.js +2 -0
  56. package/dist/esm/chunks/index-BkRJ9-Im.js.map +1 -0
  57. package/dist/esm/chunks/{logger-Cg7fUh8D.js → logger-BLZbLzva.js} +2 -2
  58. package/dist/esm/chunks/{logger-Cg7fUh8D.js.map → logger-BLZbLzva.js.map} +1 -1
  59. package/dist/esm/chunks/memory-http-transport-DRYdYgiE.js +2 -0
  60. package/dist/esm/chunks/memory-http-transport-DRYdYgiE.js.map +1 -0
  61. package/dist/esm/chunks/node-http-transport-Bp5cFZCt.js +2 -0
  62. package/dist/esm/chunks/node-http-transport-Bp5cFZCt.js.map +1 -0
  63. package/dist/esm/chunks/progress-DJU_f66N.js +2 -0
  64. package/dist/esm/chunks/{progress-OxUHmDV4.js.map → progress-DJU_f66N.js.map} +1 -1
  65. package/dist/esm/chunks/readable-stream-CGuf8k1J.js +2 -0
  66. package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +1 -0
  67. package/dist/esm/chunks/repository-DiagDiT_.js +2 -0
  68. package/dist/esm/chunks/repository-DiagDiT_.js.map +1 -0
  69. package/dist/esm/commands/index.js +1 -1
  70. package/dist/esm/index.browser.js +1 -1
  71. package/dist/esm/index.browser.js.map +1 -1
  72. package/dist/esm/index.default.js +1 -1
  73. package/dist/esm/index.default.js.map +1 -1
  74. package/dist/esm/index.js +1 -1
  75. package/dist/esm/index.node.js +1 -1
  76. package/dist/esm/index.node.js.map +1 -1
  77. package/dist/esm/operators/index.js +1 -1
  78. package/dist/esm/operators/index.js.map +1 -1
  79. package/dist/esm/primitives/index.js +1 -1
  80. package/dist/esm/primitives/index.js.map +1 -1
  81. package/dist/esm/transport/index.js.map +1 -1
  82. package/dist/types/adapters/browser/index.d.cts +2 -2
  83. package/dist/types/adapters/browser/index.d.ts +2 -2
  84. package/dist/types/adapters/memory/index.d.cts +4 -2
  85. package/dist/types/adapters/memory/index.d.ts +4 -2
  86. package/dist/types/adapters/node/index.d.cts +117 -3
  87. package/dist/types/adapters/node/index.d.ts +117 -3
  88. package/dist/types/chunks/{context-Ku1aP8Ie.d.cts → context-D84z1i5F.d.cts} +39 -21
  89. package/dist/types/chunks/{context-C6df52Qs.d.ts → context-o5TPfMB2.d.ts} +39 -21
  90. package/dist/types/chunks/{diff-change-BwO75AgS.d.cts → diff-change-Bm1zvVsC.d.cts} +1 -1
  91. package/dist/types/chunks/{diff-change-CUWN3OSK.d.ts → diff-change-alGRzD_j.d.ts} +1 -1
  92. package/dist/types/chunks/{http-transport--_NdQOiw.d.cts → http-transport-DirKfK2S.d.cts} +1 -1
  93. package/dist/types/chunks/{http-transport--_NdQOiw.d.ts → http-transport-DirKfK2S.d.ts} +1 -1
  94. package/dist/types/chunks/{repository-Cv4Y0T9t.d.cts → repository-23evW2h-.d.cts} +5 -4
  95. package/dist/types/chunks/{repository-BBKJnr8a.d.ts → repository-BT7Xq1kJ.d.ts} +5 -4
  96. package/dist/types/chunks/write-tree-DNjhjS3t.d.ts +282 -0
  97. package/dist/types/chunks/write-tree-DVp0RJ_r.d.cts +282 -0
  98. package/dist/types/commands/index.d.cts +82 -36
  99. package/dist/types/commands/index.d.ts +82 -36
  100. package/dist/types/index.browser.d.cts +5 -5
  101. package/dist/types/index.browser.d.ts +5 -5
  102. package/dist/types/index.d.cts +5 -5
  103. package/dist/types/index.d.ts +5 -5
  104. package/dist/types/index.default.d.cts +5 -5
  105. package/dist/types/index.default.d.ts +5 -5
  106. package/dist/types/index.node.d.cts +5 -5
  107. package/dist/types/index.node.d.ts +5 -5
  108. package/dist/types/operators/index.d.cts +17 -1
  109. package/dist/types/operators/index.d.ts +17 -1
  110. package/dist/types/primitives/index.d.cts +223 -186
  111. package/dist/types/primitives/index.d.ts +223 -186
  112. package/dist/types/transport/index.d.cts +1 -1
  113. package/dist/types/transport/index.d.ts +1 -1
  114. package/package.json +70 -23
  115. package/dist/cjs/chunks/error-DL4SHCBJ.cjs +0 -2
  116. package/dist/cjs/chunks/error-DL4SHCBJ.cjs.map +0 -1
  117. package/dist/cjs/chunks/error-DN8Vnwr4.cjs +0 -2
  118. package/dist/cjs/chunks/error-DN8Vnwr4.cjs.map +0 -1
  119. package/dist/cjs/chunks/index-iUd-bwwm.cjs +0 -2
  120. package/dist/cjs/chunks/index-iUd-bwwm.cjs.map +0 -1
  121. package/dist/cjs/chunks/memory-http-transport-DGll7Af4.cjs +0 -2
  122. package/dist/cjs/chunks/memory-http-transport-DGll7Af4.cjs.map +0 -1
  123. package/dist/cjs/chunks/merge-base-DlGWnkxP.cjs +0 -2
  124. package/dist/cjs/chunks/merge-base-DlGWnkxP.cjs.map +0 -1
  125. package/dist/cjs/chunks/node-http-transport-CuOgJlws.cjs +0 -2
  126. package/dist/cjs/chunks/node-http-transport-CuOgJlws.cjs.map +0 -1
  127. package/dist/cjs/chunks/repository-Cbzk-Qwz.cjs +0 -2
  128. package/dist/cjs/chunks/repository-Cbzk-Qwz.cjs.map +0 -1
  129. package/dist/esm/chunks/error-CAlAXhN3.js +0 -2
  130. package/dist/esm/chunks/error-CAlAXhN3.js.map +0 -1
  131. package/dist/esm/chunks/error-DVZkS_ub.js +0 -2
  132. package/dist/esm/chunks/error-DVZkS_ub.js.map +0 -1
  133. package/dist/esm/chunks/index-gUdap5AF.js +0 -2
  134. package/dist/esm/chunks/index-gUdap5AF.js.map +0 -1
  135. package/dist/esm/chunks/memory-http-transport-Cv1sbkCX.js +0 -2
  136. package/dist/esm/chunks/memory-http-transport-Cv1sbkCX.js.map +0 -1
  137. package/dist/esm/chunks/merge-base-opORz-S1.js +0 -2
  138. package/dist/esm/chunks/merge-base-opORz-S1.js.map +0 -1
  139. package/dist/esm/chunks/node-http-transport-CuXVJf0s.js +0 -2
  140. package/dist/esm/chunks/node-http-transport-CuXVJf0s.js.map +0 -1
  141. package/dist/esm/chunks/progress-OxUHmDV4.js +0 -2
  142. package/dist/esm/chunks/repository-BaEhU6zt.js +0 -2
  143. package/dist/esm/chunks/repository-BaEhU6zt.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { H as HttpTransport } from './http-transport--_NdQOiw.js';
1
+ import { b as HttpTransport } from './http-transport-DirKfK2S.js';
2
2
 
3
3
  interface InflateStreamResult {
4
4
  /** The fully-inflated output bytes. */
@@ -83,16 +83,16 @@ interface FileSystem {
83
83
  /**
84
84
  * Write bytes to file. Fails with FILE_EXISTS if the file already exists (exclusive create).
85
85
  *
86
- * Contract obligations (Phase 7 §14.17):
86
+ * Contract obligations:
87
87
  * - **Parent-directory creation:** the adapter MUST ensure parent directories exist before the
88
- * exclusive write. Equivalent to `mkdir -p dirname(path)` before `open(path, O_EXCL)`. If the
89
- * parent is removed between the implicit mkdir and the open (e.g. concurrent `git gc` prunes
90
- * the fanout), the adapter retries once: re-create the parent, re-attempt the open. On a second
91
- * ENOENT the error propagates as FILE_NOT_FOUND.
88
+ * exclusive write. Equivalent to `mkdir -p dirname(path)` before `open(path, O_EXCL)`. If the
89
+ * parent is removed between the implicit mkdir and the open (e.g. concurrent `git gc` prunes
90
+ * the fanout), the adapter retries once: re-create the parent, re-attempt the open. On a second
91
+ * ENOENT the error propagates as FILE_NOT_FOUND.
92
92
  * - **Symlink-safe ancestor check:** the adapter MUST reject writes where any ancestor directory
93
- * of `path` is a symbolic link whose resolved target is outside the containment root. This
94
- * closes the attack where an attacker replaces `objects/xx/` with a symlink pointing elsewhere.
95
- * Implementation: lstat-walk the ancestor chain, or use `openat`-style relative opens.
93
+ * of `path` is a symbolic link whose resolved target is outside the containment root. This
94
+ * closes the attack where an attacker replaces `objects/xx/` with a symlink pointing elsewhere.
95
+ * Implementation: lstat-walk the ancestor chain, or use `openat`-style relative opens.
96
96
  */
97
97
  readonly writeExclusive: (path: string, data: Uint8Array) => Promise<void>;
98
98
  /** Write UTF-8 string to file, creating parent directories as needed. */
@@ -140,7 +140,7 @@ interface FileSystem {
140
140
  * - Node: `fs.open(path, O_NOFOLLOW | (mode === 'write' ? O_WRONLY : O_RDONLY))`.
141
141
  * - Memory: rejects with `PERMISSION_DENIED` when the leaf is a memory symlink entry.
142
142
  * - Browser OPFS: throws `UNSUPPORTED_OPERATION` (OPFS has no symlinks; callers can
143
- * fall back to a plain `read`/`write` because the no-follow guarantee holds vacuously).
143
+ * fall back to a plain `read`/`write` because the no-follow guarantee holds vacuously).
144
144
  *
145
145
  * Throws `FILE_NOT_FOUND` if the leaf does not exist (in `read` mode).
146
146
  * Throws `PERMISSION_DENIED` if the leaf is a symlink.
@@ -212,7 +212,7 @@ interface LruCache<V> {
212
212
  * `Logger` in `transport/types.ts`, which is event-based and HTTP-shaped.
213
213
  *
214
214
  * The facade wraps user-supplied loggers with sanitization at construction time
215
- * (see Phase 10 design §8.5). Implementations should be tolerant of high call
215
+ * . Implementations should be tolerant of high call
216
216
  * frequency and MUST NOT throw — a throwing logger crashes nothing.
217
217
  */
218
218
  interface Logger {
@@ -225,8 +225,8 @@ interface Logger {
225
225
  declare const noopLogger: Logger;
226
226
  /**
227
227
  * Wrap a user-supplied logger so every `message` + every string value in the
228
- * `context` object passes through `sanitize()` (Phase 9 §4.7) before reaching
229
- * the sink. Per design §8.5 the facade applies this at construction time so no
228
+ * `context` object passes through `sanitize()` before reaching
229
+ * the sink. the facade applies this at construction time so no
230
230
  * downstream caller ever feeds raw control bytes to a user-controlled sink.
231
231
  *
232
232
  * Methods that the user did not supply are absent on the wrapper (preserves
@@ -237,7 +237,7 @@ declare const wrapLoggerSanitizer: (logger: Logger) => Logger;
237
237
 
238
238
  /**
239
239
  * Progress reporter shape consumed by long-running commands. The facade
240
- * (Phase 10) accepts a user-supplied implementation via
240
+ * accepts a user-supplied implementation via
241
241
  * `OpenRepositoryOptions.progress` and plumbs it onto `Context.progress`.
242
242
  *
243
243
  * Reporters are synchronous and fire-and-forget. The facade wraps every call
@@ -261,20 +261,28 @@ interface ProgressReporter {
261
261
  }
262
262
 
263
263
  /**
264
- * Repository physical layout — where the working tree and .git directory live.
265
- * Renamed in Phase 10 from the previous `RepositoryConfig` (port-tier) to free that
264
+ * Repository physical layout — where the working tree and.git directory live.
265
+ * Renamed in from the previous `RepositoryConfig` (port-tier) to free that
266
266
  * name for the facade-tier `RepositoryConfig` shape (auth/parallelism/etc.).
267
267
  */
268
268
  interface RepositoryLayout {
269
269
  /** Absolute path to the repository root (working tree). */
270
270
  readonly workDir: string;
271
- /** Absolute path to the .git directory (usually `${workDir}/.git`, but may differ for bare repos or worktrees). */
271
+ /** Absolute path to the.git directory (usually `${workDir}/.git`, but may differ for bare repos or worktrees). */
272
272
  readonly gitDir: string;
273
273
  /** Whether this is a bare repository. */
274
274
  readonly bare: boolean;
275
+ /**
276
+ * Home directory for `~`-expansion in config-driven paths (e.g.
277
+ * `core.excludesFile = ~/.config/git/ignore`). Populated by the node
278
+ * shim from `os.homedir()`; memory adapter accepts an option; browser
279
+ * leaves it `undefined`. When `undefined`, loaders that need home
280
+ * expansion treat the source as missing.
281
+ */
282
+ readonly homeDir?: string;
275
283
  }
276
284
  /**
277
- * Author / committer identity — Phase 9 §4.7 shape.
285
+ * Author / committer identity shape.
278
286
  */
279
287
  interface AuthorIdentity {
280
288
  readonly name: string;
@@ -292,7 +300,7 @@ type AuthStrategy = {
292
300
  readonly password: string;
293
301
  };
294
302
  /**
295
- * Facade-tier configuration. Phase 10 introduces this shape; it carries the
303
+ * Facade-tier configuration. introduces this shape; it carries the
296
304
  * auth/parallelism/SSRF/network options the facade plumbs into network-pipeline.
297
305
  * All fields are optional — primitives and commands consult only the keys they need.
298
306
  */
@@ -304,7 +312,17 @@ interface RepositoryConfig {
304
312
  readonly upstreamRef?: RefName;
305
313
  readonly allowInsecure?: boolean;
306
314
  readonly allowPrivateNetworks?: boolean;
315
+ /**
316
+ * Hard cap (bytes) on a single pack body buffered in memory by `fetchPack`.
317
+ * Server-controlled byte counts above this raise `PACK_TOO_LARGE`. Default
318
+ * 512 MiB. Lower it for hardened deployments that clone only small repos.
319
+ */
307
320
  readonly maxResponseBytes?: number;
321
+ /**
322
+ * Hard cap on the entry-count field declared in a received pack header.
323
+ * Server-controlled `uint32` values above this raise `PACK_TOO_LARGE` before
324
+ * `fetchPack` allocates per-entry state. Default 50_000_000.
325
+ */
308
326
  readonly maxObjectsPerPack?: number;
309
327
  readonly detectRenames?: boolean;
310
328
  readonly breakStaleLockMs?: number;
@@ -350,5 +368,5 @@ interface CreateContextParts {
350
368
  /** Assemble a frozen Context from its constituent ports + layout. */
351
369
  declare function createContext(parts: CreateContextParts): Context;
352
370
 
353
- export { ObjectId as O, FilePath as b, createContext as i, RefName as j, noopLogger as n, wrapLoggerSanitizer as w };
354
- export type { AuthStrategy as A, Compressor as C, DirEntry as D, FileSystem as F, HashService as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, RepositoryConfig as R, Context as a, FileStat as c, FileHandle as d, Hasher as e, AuthorIdentity as f, CreateContextParts as g, RepositoryLayout as h };
371
+ export { ObjectId as O, RefName as R, FilePath as d, createContext as j, noopLogger as n, wrapLoggerSanitizer as w };
372
+ export type { AuthStrategy as A, Compressor as C, DirEntry as D, FileHandle as F, HashService as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, AuthorIdentity as a, Context as b, CreateContextParts as c, FileStat as e, FileSystem as f, Hasher as g, RepositoryConfig as h, RepositoryLayout as i };
@@ -1,4 +1,4 @@
1
- import { b as FilePath, O as ObjectId } from './context-Ku1aP8Ie.cjs';
1
+ import { d as FilePath, O as ObjectId } from './context-D84z1i5F.cjs';
2
2
 
3
3
  interface AuthorIdentity {
4
4
  readonly name: string;
@@ -1,4 +1,4 @@
1
- import { b as FilePath, O as ObjectId } from './context-C6df52Qs.js';
1
+ import { d as FilePath, O as ObjectId } from './context-o5TPfMB2.js';
2
2
 
3
3
  interface AuthorIdentity {
4
4
  readonly name: string;
@@ -17,4 +17,4 @@ interface HttpTransport {
17
17
  readonly request: (req: HttpRequest) => Promise<HttpResponse>;
18
18
  }
19
19
 
20
- export type { HttpTransport as H, HttpRequest as a, HttpResponse as b };
20
+ export type { HttpRequest as H, HttpResponse as a, HttpTransport as b };
@@ -17,4 +17,4 @@ interface HttpTransport {
17
17
  readonly request: (req: HttpRequest) => Promise<HttpResponse>;
18
18
  }
19
19
 
20
- export type { HttpTransport as H, HttpRequest as a, HttpResponse as b };
20
+ export type { HttpRequest as H, HttpResponse as a, HttpTransport as b };
@@ -1,7 +1,7 @@
1
1
  import { add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from '../commands/index.cjs';
2
- import { createCommit, diffTrees, getRepoRoot, mergeBase, readBlob, readIndex, readObject, readTree, resolveRef, updateRef, walkCommits, walkTree, writeObject, writeSymbolicRef, writeTree } from '../primitives/index.cjs';
3
- import { F as FileSystem, H as HashService, C as Compressor, R as RepositoryConfig, L as Logger, P as ProgressReporter, a as Context } from './context-Ku1aP8Ie.cjs';
4
- import { H as HttpTransport } from './http-transport--_NdQOiw.cjs';
2
+ import { f as FileSystem, H as HashService, C as Compressor, h as RepositoryConfig, L as Logger, P as ProgressReporter, b as Context } from './context-D84z1i5F.cjs';
3
+ import { q as createCommit, r as diffTrees, s as getRepoRoot, t as mergeBase, u as readBlob, v as readIndex, w as readObject, x as readTree, y as resolveRef, z as updateRef, A as walkCommits, B as walkTree, E as walkWorkingTree, F as writeObject, H as writeSymbolicRef, J as writeTree } from './write-tree-DVp0RJ_r.cjs';
4
+ import { b as HttpTransport } from './http-transport-DirKfK2S.cjs';
5
5
 
6
6
  /**
7
7
  * Helper that strips the leading `Context` parameter from a function type so
@@ -12,7 +12,7 @@ type BindCtx<F> = F extends (ctx: Context, ...rest: infer A) => infer R ? (...ar
12
12
  * User-facing options passed to `openRepository`. Subset of the design's
13
13
  * `OpenRepositoryOptions` that this Step 3 implementation honors. Every field
14
14
  * is optional; the facade fills sensible defaults. Field-level validation runs
15
- * eagerly before the Repository is returned (Phase 10 §8.1).
15
+ * eagerly before the Repository is returned.
16
16
  */
17
17
  interface OpenRepositoryOptions {
18
18
  /** Working directory. Default: `process.cwd()` on Node, `'/'` on browser/memory. */
@@ -72,6 +72,7 @@ interface Repository {
72
72
  readonly updateRef: BindCtx<typeof updateRef>;
73
73
  readonly walkCommits: BindCtx<typeof walkCommits>;
74
74
  readonly walkTree: BindCtx<typeof walkTree>;
75
+ readonly walkWorkingTree: BindCtx<typeof walkWorkingTree>;
75
76
  readonly writeObject: BindCtx<typeof writeObject>;
76
77
  readonly writeSymbolicRef: BindCtx<typeof writeSymbolicRef>;
77
78
  readonly writeTree: BindCtx<typeof writeTree>;
@@ -1,7 +1,7 @@
1
1
  import { add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from '../commands/index.js';
2
- import { createCommit, diffTrees, getRepoRoot, mergeBase, readBlob, readIndex, readObject, readTree, resolveRef, updateRef, walkCommits, walkTree, writeObject, writeSymbolicRef, writeTree } from '../primitives/index.js';
3
- import { F as FileSystem, H as HashService, C as Compressor, R as RepositoryConfig, L as Logger, P as ProgressReporter, a as Context } from './context-C6df52Qs.js';
4
- import { H as HttpTransport } from './http-transport--_NdQOiw.js';
2
+ import { f as FileSystem, H as HashService, C as Compressor, h as RepositoryConfig, L as Logger, P as ProgressReporter, b as Context } from './context-o5TPfMB2.js';
3
+ import { q as createCommit, r as diffTrees, s as getRepoRoot, t as mergeBase, u as readBlob, v as readIndex, w as readObject, x as readTree, y as resolveRef, z as updateRef, A as walkCommits, B as walkTree, E as walkWorkingTree, F as writeObject, H as writeSymbolicRef, J as writeTree } from './write-tree-DNjhjS3t.js';
4
+ import { b as HttpTransport } from './http-transport-DirKfK2S.js';
5
5
 
6
6
  /**
7
7
  * Helper that strips the leading `Context` parameter from a function type so
@@ -12,7 +12,7 @@ type BindCtx<F> = F extends (ctx: Context, ...rest: infer A) => infer R ? (...ar
12
12
  * User-facing options passed to `openRepository`. Subset of the design's
13
13
  * `OpenRepositoryOptions` that this Step 3 implementation honors. Every field
14
14
  * is optional; the facade fills sensible defaults. Field-level validation runs
15
- * eagerly before the Repository is returned (Phase 10 §8.1).
15
+ * eagerly before the Repository is returned.
16
16
  */
17
17
  interface OpenRepositoryOptions {
18
18
  /** Working directory. Default: `process.cwd()` on Node, `'/'` on browser/memory. */
@@ -72,6 +72,7 @@ interface Repository {
72
72
  readonly updateRef: BindCtx<typeof updateRef>;
73
73
  readonly walkCommits: BindCtx<typeof walkCommits>;
74
74
  readonly walkTree: BindCtx<typeof walkTree>;
75
+ readonly walkWorkingTree: BindCtx<typeof walkWorkingTree>;
75
76
  readonly writeObject: BindCtx<typeof writeObject>;
76
77
  readonly writeSymbolicRef: BindCtx<typeof writeSymbolicRef>;
77
78
  readonly writeTree: BindCtx<typeof writeTree>;
@@ -0,0 +1,282 @@
1
+ import { O as ObjectId, d as FilePath, e as FileStat, b as Context, R as RefName } from './context-o5TPfMB2.js';
2
+ import { A as AuthorIdentity, F as FileMode, T as TreeDiff } from './diff-change-alGRzD_j.js';
3
+
4
+ interface Blob {
5
+ readonly type: 'blob';
6
+ readonly id: ObjectId;
7
+ readonly content: Uint8Array;
8
+ }
9
+
10
+ interface ExtraHeader {
11
+ readonly key: string;
12
+ readonly value: string;
13
+ }
14
+ interface CommitData {
15
+ readonly tree: ObjectId;
16
+ readonly parents: ReadonlyArray<ObjectId>;
17
+ readonly author: AuthorIdentity;
18
+ readonly committer: AuthorIdentity;
19
+ readonly message: string;
20
+ readonly gpgSignature?: string;
21
+ readonly extraHeaders: ReadonlyArray<ExtraHeader>;
22
+ }
23
+ interface Commit {
24
+ readonly type: 'commit';
25
+ readonly id: ObjectId;
26
+ readonly data: CommitData;
27
+ }
28
+
29
+ type ObjectType = 'blob' | 'tree' | 'commit' | 'tag';
30
+
31
+ interface TagData {
32
+ readonly object: ObjectId;
33
+ readonly objectType: ObjectType;
34
+ readonly tagName: string;
35
+ readonly tagger?: AuthorIdentity;
36
+ readonly message: string;
37
+ readonly gpgSignature?: string;
38
+ readonly extraHeaders: ReadonlyArray<ExtraHeader>;
39
+ }
40
+ interface Tag {
41
+ readonly type: 'tag';
42
+ readonly id: ObjectId;
43
+ readonly data: TagData;
44
+ }
45
+
46
+ interface TreeEntry {
47
+ readonly mode: FileMode;
48
+ readonly name: string;
49
+ readonly id: ObjectId;
50
+ }
51
+ interface Tree {
52
+ readonly type: 'tree';
53
+ readonly id: ObjectId;
54
+ readonly entries: ReadonlyArray<TreeEntry>;
55
+ }
56
+
57
+ type GitObject = Blob | Tree | Commit | Tag;
58
+
59
+ interface IndexEntryFlags {
60
+ readonly assumeValid: boolean;
61
+ readonly extended: boolean;
62
+ readonly stage: 0 | 1 | 2 | 3;
63
+ }
64
+ interface IndexEntry {
65
+ readonly ctimeSeconds: number;
66
+ readonly ctimeNanoseconds: number;
67
+ readonly mtimeSeconds: number;
68
+ readonly mtimeNanoseconds: number;
69
+ readonly dev: number;
70
+ readonly ino: number;
71
+ readonly mode: FileMode;
72
+ readonly uid: number;
73
+ readonly gid: number;
74
+ readonly fileSize: number;
75
+ readonly id: ObjectId;
76
+ readonly flags: IndexEntryFlags;
77
+ readonly path: FilePath;
78
+ }
79
+ interface IndexExtension {
80
+ readonly signature: string;
81
+ readonly data: Uint8Array;
82
+ }
83
+ interface GitIndex {
84
+ readonly version: 2;
85
+ readonly entries: ReadonlyArray<IndexEntry>;
86
+ readonly extensions: ReadonlyArray<IndexExtension>;
87
+ }
88
+
89
+ interface RenameDetectOptions {
90
+ readonly limit?: number;
91
+ readonly maxSameIdDeletes?: number;
92
+ }
93
+
94
+ /**
95
+ * Primitive option shapes, walker value types, and shared constants.
96
+ * Defined in one location to avoid circular imports between primitive modules.
97
+ */
98
+
99
+ /** Max symbolic-ref dereferences resolveRef will follow. */
100
+ declare const MAX_SYMBOLIC_REF_DEPTH = 5;
101
+ /** Max tag-peel hops resolveRef / readTree will follow when peeling. */
102
+ declare const MAX_PEEL_DEPTH = 5;
103
+ /** Max seeds walkCommits.from can contain. */
104
+ declare const MAX_WALK_SEEDS = 1024;
105
+ /** Hard cap on walkCommits' pending queue size to prevent unbounded heap growth. */
106
+ declare const MAX_WALK_QUEUE_SIZE: number;
107
+ /** Max.git/index file size readIndex will accept. */
108
+ declare const MAX_INDEX_BYTES: number;
109
+ /** Max commit message byte length createCommit will accept. */
110
+ declare const MAX_COMMIT_MESSAGE_BYTES: number;
111
+ /**
112
+ * Per-file size cap enforced by `add --all` before reading working-tree
113
+ * bytes into memory. Mirrors `MAX_CONFLICT_OUTPUT_BYTES` (256 MiB) so the
114
+ * write-side memory ceiling matches the read-side ceiling.
115
+ * See `docs/adr/032-add-all-large-file-guard.md`.
116
+ */
117
+ declare const MAX_WORKING_TREE_BLOB_BYTES: number;
118
+ /**
119
+ * Per-file cap on `.gitignore`, `.git/info/exclude`, and the global
120
+ * excludesFile. 1 MiB leaves a 20× margin over real-world max-size
121
+ * gitignore corpora. See `docs/adr/036-gitignore-bounded-read.md`.
122
+ */
123
+ declare const MAX_GITIGNORE_BYTES: number;
124
+ interface ReadObjectOptions {
125
+ readonly verifyHash?: boolean;
126
+ /**
127
+ * Reject objects whose serialised payload exceeds this byte count, before
128
+ * inflating the full content into memory. Counts the raw object content
129
+ * (post-inflate, pre-loose-header). When unset, no cap applies.
130
+ *
131
+ * Used by `merge`'s content merger to bound peak memory when an adversarial
132
+ * remote ships pathologically large blobs. See `docs/design/phase-13-8-
133
+ * bounded-object-reads.md`.
134
+ */
135
+ readonly maxBytes?: number;
136
+ }
137
+ interface ResolveRefOptions {
138
+ readonly peel?: boolean;
139
+ readonly maxSymbolicDepth?: number;
140
+ readonly maxPeelDepth?: number;
141
+ }
142
+ interface UpdateRefOptions {
143
+ readonly expected?: ObjectId | 'absent';
144
+ readonly delete?: boolean;
145
+ }
146
+ interface WalkCommitsOptions {
147
+ readonly from: ReadonlyArray<ObjectId>;
148
+ readonly until?: ReadonlyArray<ObjectId>;
149
+ readonly order?: 'topo' | 'first-parent';
150
+ readonly ignoreMissing?: boolean;
151
+ readonly verifyHash?: boolean;
152
+ /**
153
+ * Commits whose parents must NOT be enqueued. Used for shallow boundaries
154
+ * . The commit itself is still yielded — only its parents are
155
+ * skipped. Callers that want to also skip the boundary commit pass it in
156
+ * `until`.
157
+ */
158
+ readonly shallow?: ReadonlySet<ObjectId>;
159
+ }
160
+ /** Maximum `have` lines a single-round fetch will send. */
161
+ declare const MAX_HAVES = 256;
162
+ /** Hard cap on objects enumerated for a single push. design */
163
+ declare const MAX_PUSH_OBJECTS = 1000000;
164
+ interface WalkTreeEntry {
165
+ readonly path: FilePath;
166
+ readonly id: ObjectId;
167
+ readonly mode: FileMode;
168
+ }
169
+ interface WalkTreeOptions {
170
+ readonly recursive?: boolean;
171
+ readonly maxDepth?: number;
172
+ readonly maxEntries?: number;
173
+ }
174
+ interface WalkWorkingTreeEntry {
175
+ readonly path: FilePath;
176
+ readonly stat: FileStat;
177
+ }
178
+ type WalkIgnorePredicate = (path: FilePath, isDirectory: boolean) => boolean | Promise<boolean>;
179
+ interface WalkWorkingTreeOptions {
180
+ readonly maxDepth?: number;
181
+ readonly maxEntries?: number;
182
+ /**
183
+ * predicate. Invoked on every directory BEFORE descent
184
+ * (returning `true` prunes the entire subtree, skipping its `lstat`
185
+ * cost) and on every leaf BEFORE yielding (returning `true` drops
186
+ * the leaf). May be sync or async.
187
+ */
188
+ readonly ignore?: WalkIgnorePredicate;
189
+ }
190
+ interface CreateCommitInput {
191
+ readonly tree: ObjectId;
192
+ readonly parents: ReadonlyArray<ObjectId>;
193
+ readonly author: AuthorIdentity;
194
+ readonly committer: AuthorIdentity;
195
+ readonly message: string;
196
+ readonly gpgSignature?: string;
197
+ readonly extraHeaders?: ReadonlyArray<ExtraHeader>;
198
+ }
199
+ type DiffTreesInput = Tree | ObjectId | undefined;
200
+ interface DiffTreesOptions {
201
+ readonly detectRenames?: boolean;
202
+ readonly renameOptions?: RenameDetectOptions;
203
+ }
204
+
205
+ declare function createCommit(ctx: Context, input: CreateCommitInput): Promise<ObjectId>;
206
+
207
+ declare function diffTrees(ctx: Context, a: DiffTreesInput, b: DiffTreesInput, options?: DiffTreesOptions): Promise<TreeDiff>;
208
+
209
+ /**
210
+ * Compute a merge base — the first commit reachable from BOTH `a` and `b`.
211
+ *
212
+ * Algorithm: bidirectional BFS with two visited sets. After each layer
213
+ * advance, check the intersection. When non-empty, return the
214
+ * lexicographically smallest oid (deterministic tie-breaker).
215
+ *
216
+ * Returns `undefined` for unrelated histories. Documented limitation: cherry-picks
217
+ * and criss-cross merges may yield non-optimal bases — `recursive`-strategy
218
+ * multi-base resolution is v2.
219
+ */
220
+ declare const mergeBase: (ctx: Context, a: ObjectId, b: ObjectId) => Promise<ObjectId | undefined>;
221
+
222
+ /**
223
+ * Pure path helpers composing `ctx.layout.gitDir` with known sub-paths.
224
+ * No I/O. No port access. Primitive step 3.
225
+ */
226
+
227
+ /**
228
+ * Repository working-tree root. Returns the workDir from the current context;
229
+ * facade-tier code is responsible for discovery / realpath pinning
230
+ * at construction time. Primitives consume the already-resolved path.
231
+ */
232
+ declare const getRepoRoot: (ctx: Context) => FilePath;
233
+
234
+ declare function readBlob(ctx: Context, id: ObjectId, options?: ReadObjectOptions): Promise<Blob>;
235
+
236
+ declare function readIndex(ctx: Context): Promise<GitIndex>;
237
+
238
+ declare function readObject(ctx: Context, id: ObjectId, options?: ReadObjectOptions): Promise<GitObject>;
239
+
240
+ declare function readTree(ctx: Context, ref: RefName | ObjectId): Promise<Tree>;
241
+
242
+ declare function resolveRef(ctx: Context, name: RefName | 'HEAD', options?: ResolveRefOptions): Promise<ObjectId>;
243
+
244
+ declare function updateRef(ctx: Context, name: RefName, newId: ObjectId, options?: UpdateRefOptions): Promise<void>;
245
+
246
+ declare function walkCommits(ctx: Context, options: WalkCommitsOptions): AsyncIterable<Commit>;
247
+
248
+ declare function walkTree(ctx: Context, treeIdOrObject: ObjectId | Tree, options?: WalkTreeOptions): AsyncIterable<WalkTreeEntry>;
249
+
250
+ /**
251
+ * Depth-first walk of the working tree starting at `ctx.layout.workDir`.
252
+ *
253
+ * Yields leaf entries (files and symlinks) as `{ path, stat }`. Directories
254
+ * are descended into, not yielded. `.git` at any level is skipped
255
+ * (case-insensitive, NTFS-trimmed). Embedded repositories (directories
256
+ * containing a `.git` child) are skipped entirely — yields nothing under
257
+ * them. Symlinks are surfaced via `lstat` (no follow); a symlink to a
258
+ * directory is yielded as a leaf, not descended into.
259
+ *
260
+ * The host repository's own `.git` is NOT treated as an embedded-repo
261
+ * marker — at the workDir root we only skip the `.git` entry itself, not
262
+ * the workDir.
263
+ */
264
+ declare function walkWorkingTree(ctx: Context, options?: WalkWorkingTreeOptions): AsyncIterable<WalkWorkingTreeEntry>;
265
+
266
+ declare function writeObject(ctx: Context, object: GitObject): Promise<ObjectId>;
267
+
268
+ /**
269
+ * Write a symbolic ref atomically. Used for HEAD updates that point at a
270
+ * branch, branch renames affecting the current HEAD, and `clone`/`init`
271
+ * to set the initial HEAD.
272
+ *
273
+ * Single-level only in v1: target MUST be a direct ref name (no chained
274
+ * symrefs). Validation runs through `validateRefName` for both `name` and
275
+ * `target` — invalid inputs throw INVALID_REF before any I/O.
276
+ */
277
+ declare const writeSymbolicRef: (ctx: Context, name: RefName, target: RefName) => Promise<void>;
278
+
279
+ declare function writeTree(ctx: Context, entries: ReadonlyArray<TreeEntry>): Promise<ObjectId>;
280
+
281
+ export { walkCommits as A, walkTree as B, walkWorkingTree as E, writeObject as F, writeSymbolicRef as H, writeTree as J, MAX_COMMIT_MESSAGE_BYTES as M, MAX_GITIGNORE_BYTES as b, MAX_HAVES as c, MAX_INDEX_BYTES as d, MAX_PEEL_DEPTH as e, MAX_PUSH_OBJECTS as f, MAX_SYMBOLIC_REF_DEPTH as g, MAX_WALK_QUEUE_SIZE as h, MAX_WALK_SEEDS as i, MAX_WORKING_TREE_BLOB_BYTES as j, createCommit as q, diffTrees as r, getRepoRoot as s, mergeBase as t, readBlob as u, readIndex as v, readObject as w, readTree as x, resolveRef as y, updateRef as z };
282
+ export type { CreateCommitInput as C, DiffTreesInput as D, GitIndex as G, IndexEntry as I, ReadObjectOptions as R, UpdateRefOptions as U, WalkCommitsOptions as W, DiffTreesOptions as a, ResolveRefOptions as k, WalkIgnorePredicate as l, WalkTreeEntry as m, WalkTreeOptions as n, WalkWorkingTreeEntry as o, WalkWorkingTreeOptions as p };