@scolladon/tsgit 2.0.1 → 3.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 (154) hide show
  1. package/README.md +14 -2
  2. package/dist/cjs/adapters/browser/index.cjs +1 -2
  3. package/dist/cjs/adapters/memory/index.cjs +1 -2
  4. package/dist/cjs/adapters/node/index.cjs +1 -2
  5. package/dist/cjs/chunks/adapter-detect-DW9fsw9d.cjs +1 -0
  6. package/dist/cjs/chunks/browser-http-transport-DGwW5YL7.cjs +1 -0
  7. package/dist/cjs/chunks/context-BcoAzPuU.cjs +0 -1
  8. package/dist/cjs/chunks/error-CfLWDui_.cjs +1 -0
  9. package/dist/cjs/chunks/index-Cy44GVR6.cjs +1 -0
  10. package/dist/cjs/chunks/inflate-CmCtM4-w.cjs +1 -0
  11. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +0 -1
  12. package/dist/cjs/chunks/memory-http-transport-CGriODcQ.cjs +1 -0
  13. package/dist/cjs/chunks/node-ssh-transport-PFu3ijfp.cjs +1 -0
  14. package/dist/cjs/chunks/{progress-CxU62NC1.cjs → progress-D8Dqbftk.cjs} +1 -2
  15. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs +0 -1
  16. package/dist/cjs/chunks/repository-Ci-BBxk0.cjs +1 -0
  17. package/dist/cjs/chunks/write-sparse-checkout-C1dsHCAD.cjs +1 -0
  18. package/dist/cjs/commands/index.cjs +1 -2
  19. package/dist/cjs/index.browser.cjs +1 -2
  20. package/dist/cjs/index.cjs +1 -2
  21. package/dist/cjs/index.default.cjs +1 -2
  22. package/dist/cjs/index.node.cjs +1 -2
  23. package/dist/cjs/operators/index.cjs +0 -1
  24. package/dist/cjs/primitives/index.cjs +1 -2
  25. package/dist/cjs/transport/index.cjs +0 -1
  26. package/dist/esm/adapters/browser/index.js +1 -2
  27. package/dist/esm/adapters/memory/index.js +1 -2
  28. package/dist/esm/adapters/node/index.js +1 -2
  29. package/dist/esm/chunks/adapter-detect-BkCMnjrI.js +1 -0
  30. package/dist/esm/chunks/browser-http-transport-CSxAte5h.js +1 -0
  31. package/dist/esm/chunks/context-CumKOV7K.js +0 -1
  32. package/dist/esm/chunks/error-BotOd-nD.js +1 -0
  33. package/dist/esm/chunks/index-DsvINN8n.js +1 -0
  34. package/dist/esm/chunks/inflate-BCIXqeeE.js +1 -0
  35. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +0 -1
  36. package/dist/esm/chunks/memory-http-transport-caqmMGR1.js +1 -0
  37. package/dist/esm/chunks/node-ssh-transport-BgSv2IhT.js +1 -0
  38. package/dist/esm/chunks/{progress-BZobfl7p.js → progress-B_AJnOHx.js} +1 -2
  39. package/dist/esm/chunks/readable-stream-CGuf8k1J.js +0 -1
  40. package/dist/esm/chunks/repository-DyxknzvE.js +1 -0
  41. package/dist/esm/chunks/write-sparse-checkout-BwHbNKNS.js +1 -0
  42. package/dist/esm/commands/index.js +1 -2
  43. package/dist/esm/index.browser.js +1 -2
  44. package/dist/esm/index.default.js +1 -2
  45. package/dist/esm/index.js +1 -2
  46. package/dist/esm/index.node.js +1 -2
  47. package/dist/esm/operators/index.js +0 -1
  48. package/dist/esm/primitives/index.js +1 -2
  49. package/dist/esm/transport/index.js +0 -1
  50. package/dist/types/adapters/browser/index.d.cts +5 -3
  51. package/dist/types/adapters/browser/index.d.ts +5 -3
  52. package/dist/types/adapters/memory/index.d.cts +31 -4
  53. package/dist/types/adapters/memory/index.d.ts +31 -4
  54. package/dist/types/adapters/node/index.d.cts +146 -40
  55. package/dist/types/adapters/node/index.d.ts +146 -40
  56. package/dist/types/chunks/{context-YDw6qicq.d.cts → context-CF1YF2S8.d.cts} +165 -6
  57. package/dist/types/chunks/{context-CCL0_F8R.d.ts → context-sIhhtk2u.d.ts} +165 -6
  58. package/dist/types/chunks/{http-transport--_NdQOiw.d.cts → http-transport-DirKfK2S.d.cts} +1 -1
  59. package/dist/types/chunks/{http-transport--_NdQOiw.d.ts → http-transport-DirKfK2S.d.ts} +1 -1
  60. package/dist/types/chunks/index-B5Dps3fg.d.ts +2468 -0
  61. package/dist/types/chunks/index-B_A8VLaf.d.ts +1221 -0
  62. package/dist/types/chunks/index-Dfh8cvEs.d.cts +2468 -0
  63. package/dist/types/chunks/index-Dqxddhav.d.cts +1221 -0
  64. package/dist/types/chunks/progress-BjAKfkam.d.ts +1217 -0
  65. package/dist/types/chunks/progress-Ldnfb8st.d.cts +1217 -0
  66. package/dist/types/chunks/reflog-entry-Cqh3QrPH.d.ts +697 -0
  67. package/dist/types/chunks/reflog-entry-Dy-O27Dd.d.cts +697 -0
  68. package/dist/types/chunks/{repository-FoS_Laoy.d.ts → repository-D8QBTkEz.d.ts} +58 -20
  69. package/dist/types/chunks/{repository-BeifCqp0.d.cts → repository-D9YrVhcH.d.cts} +58 -20
  70. package/dist/types/commands/index.d.cts +4 -1259
  71. package/dist/types/commands/index.d.ts +4 -1259
  72. package/dist/types/index.browser.d.cts +7 -8
  73. package/dist/types/index.browser.d.ts +7 -8
  74. package/dist/types/index.d.cts +61 -124
  75. package/dist/types/index.d.ts +61 -124
  76. package/dist/types/index.default.d.cts +7 -8
  77. package/dist/types/index.default.d.ts +7 -8
  78. package/dist/types/index.node.d.cts +7 -8
  79. package/dist/types/index.node.d.ts +7 -8
  80. package/dist/types/primitives/index.d.cts +4 -692
  81. package/dist/types/primitives/index.d.ts +4 -692
  82. package/dist/types/transport/index.d.cts +1 -1
  83. package/dist/types/transport/index.d.ts +1 -1
  84. package/package.json +94 -28
  85. package/dist/cjs/adapters/browser/index.cjs.map +0 -1
  86. package/dist/cjs/adapters/memory/index.cjs.map +0 -1
  87. package/dist/cjs/adapters/node/index.cjs.map +0 -1
  88. package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs +0 -2
  89. package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs.map +0 -1
  90. package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs +0 -2
  91. package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs.map +0 -1
  92. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +0 -1
  93. package/dist/cjs/chunks/error-CfjFO3x_.cjs +0 -2
  94. package/dist/cjs/chunks/error-CfjFO3x_.cjs.map +0 -1
  95. package/dist/cjs/chunks/index-BWCq_5BJ.cjs +0 -2
  96. package/dist/cjs/chunks/index-BWCq_5BJ.cjs.map +0 -1
  97. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +0 -1
  98. package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs +0 -2
  99. package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs.map +0 -1
  100. package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs +0 -2
  101. package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs.map +0 -1
  102. package/dist/cjs/chunks/progress-CxU62NC1.cjs.map +0 -1
  103. package/dist/cjs/chunks/readable-stream-MTA6D0Zh.cjs.map +0 -1
  104. package/dist/cjs/chunks/repository-BEg2zNtx.cjs +0 -2
  105. package/dist/cjs/chunks/repository-BEg2zNtx.cjs.map +0 -1
  106. package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs +0 -2
  107. package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs.map +0 -1
  108. package/dist/cjs/commands/index.cjs.map +0 -1
  109. package/dist/cjs/index.browser.cjs.map +0 -1
  110. package/dist/cjs/index.cjs.map +0 -1
  111. package/dist/cjs/index.default.cjs.map +0 -1
  112. package/dist/cjs/index.node.cjs.map +0 -1
  113. package/dist/cjs/operators/index.cjs.map +0 -1
  114. package/dist/cjs/primitives/index.cjs.map +0 -1
  115. package/dist/cjs/transport/index.cjs.map +0 -1
  116. package/dist/esm/adapters/browser/index.js.map +0 -1
  117. package/dist/esm/adapters/memory/index.js.map +0 -1
  118. package/dist/esm/adapters/node/index.js.map +0 -1
  119. package/dist/esm/chunks/adapter-detect-DkZhhUhd.js +0 -2
  120. package/dist/esm/chunks/adapter-detect-DkZhhUhd.js.map +0 -1
  121. package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js +0 -2
  122. package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js.map +0 -1
  123. package/dist/esm/chunks/context-CumKOV7K.js.map +0 -1
  124. package/dist/esm/chunks/error-Dc-SRSJK.js +0 -2
  125. package/dist/esm/chunks/error-Dc-SRSJK.js.map +0 -1
  126. package/dist/esm/chunks/index-jH0UMhh-.js +0 -2
  127. package/dist/esm/chunks/index-jH0UMhh-.js.map +0 -1
  128. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +0 -1
  129. package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js +0 -2
  130. package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js.map +0 -1
  131. package/dist/esm/chunks/node-http-transport-DPa2lK3T.js +0 -2
  132. package/dist/esm/chunks/node-http-transport-DPa2lK3T.js.map +0 -1
  133. package/dist/esm/chunks/progress-BZobfl7p.js.map +0 -1
  134. package/dist/esm/chunks/readable-stream-CGuf8k1J.js.map +0 -1
  135. package/dist/esm/chunks/repository-DF6ePd1x.js +0 -2
  136. package/dist/esm/chunks/repository-DF6ePd1x.js.map +0 -1
  137. package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js +0 -2
  138. package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js.map +0 -1
  139. package/dist/esm/commands/index.js.map +0 -1
  140. package/dist/esm/index.browser.js.map +0 -1
  141. package/dist/esm/index.default.js.map +0 -1
  142. package/dist/esm/index.js.map +0 -1
  143. package/dist/esm/index.node.js.map +0 -1
  144. package/dist/esm/operators/index.js.map +0 -1
  145. package/dist/esm/primitives/index.js.map +0 -1
  146. package/dist/esm/transport/index.js.map +0 -1
  147. package/dist/types/chunks/index-entry-DtEbVpOG.d.cts +0 -47
  148. package/dist/types/chunks/index-entry-UD4dvtKh.d.ts +0 -47
  149. package/dist/types/chunks/progress-7KKiXXfX.d.ts +0 -405
  150. package/dist/types/chunks/progress-By8yFaUE.d.cts +0 -405
  151. package/dist/types/chunks/reflog-entry-BbNnXCTC.d.cts +0 -368
  152. package/dist/types/chunks/reflog-entry-CSzjnZd4.d.ts +0 -368
  153. package/dist/types/chunks/write-tree-C3oNxOlX.d.cts +0 -196
  154. package/dist/types/chunks/write-tree-DRI-LzSr.d.ts +0 -196
@@ -1,9 +1,11 @@
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 HashConfig {
4
4
  readonly digestLength: 20 | 32;
5
5
  readonly hexLength: 40 | 64;
6
6
  }
7
+ declare const SHA1_CONFIG: HashConfig;
8
+ declare const SHA256_CONFIG: HashConfig;
7
9
 
8
10
  type ObjectId = string & {
9
11
  readonly __brand: unique symbol;
@@ -12,6 +14,13 @@ declare const ObjectId: {
12
14
  readonly from: (hex: string) => ObjectId;
13
15
  readonly fromRaw: (bytes: Uint8Array) => ObjectId;
14
16
  };
17
+ declare const ZERO_OID: ObjectId;
18
+ /**
19
+ * SHA-1 of the canonical empty tree object. Used by `merge` for unrelated-history
20
+ * three-way merges where the merge base is undefined — substituted as the
21
+ * "empty base" so mergeTrees produces the union of both sides.
22
+ */
23
+ declare const EMPTY_TREE_OID: ObjectId;
15
24
  type RefName = string & {
16
25
  readonly __brand: unique symbol;
17
26
  };
@@ -36,6 +45,55 @@ interface LruCache<V> {
36
45
  readonly entryCount: number;
37
46
  }
38
47
 
48
+ /**
49
+ * A single shell-command invocation. The port is stateless — every fact the
50
+ * adapter needs to run the command travels in this request.
51
+ */
52
+ interface CommandRequest {
53
+ /** Shell command line, executed through the platform shell (`sh -c` / `cmd /c`). */
54
+ readonly command: string;
55
+ /** Working directory for the spawned process. */
56
+ readonly cwd: string;
57
+ /** Environment additions merged onto the parent environment by the adapter. */
58
+ readonly env: Readonly<Record<string, string>>;
59
+ /** Cancels a running command — the adapter kills the child when it aborts. */
60
+ readonly signal?: AbortSignal;
61
+ /** Bytes fed to the child's stdin (clean/smudge input). When absent, stdin is not written. */
62
+ readonly stdin?: Uint8Array;
63
+ }
64
+ /**
65
+ * Outcome of a command. Two output conventions are carried by one port:
66
+ * - A merge driver communicates its result by overwriting its output file `%A`
67
+ * — only the exit code matters (`0` ⇒ success); `stdout` is ignored.
68
+ * - A textconv or clean/smudge filter driver communicates its result via stdout
69
+ * — the caller reads `result.stdout` for the transformed bytes.
70
+ */
71
+ interface CommandResult {
72
+ readonly exitCode: number;
73
+ /** Bytes captured from the child's stdout (textconv/filter output). Absent when not captured. */
74
+ readonly stdout?: Uint8Array;
75
+ }
76
+ /**
77
+ * Runs an arbitrary shell command line — the custom merge-driver / textconv /
78
+ * clean-smudge filter command. Optional on `Context`: when absent (browser /
79
+ * memory adapters cannot spawn a process), a configured external driver falls
80
+ * back to the built-in behaviour.
81
+ *
82
+ * NEVER rejects for a non-zero exit — interpreting the exit code is the
83
+ * caller's policy.
84
+ *
85
+ * Two output conventions coexist on this single port:
86
+ * - **Merge driver**: communicates via its `%A` output file; the caller
87
+ * ignores `result.stdout`. Pass no `stdin`; `stdout` will be absent.
88
+ * - **Textconv / filter driver**: communicates via stdout; the caller reads
89
+ * `result.stdout`. Pass `stdin` bytes when the driver reads from stdin
90
+ * (clean/smudge); omit `stdin` when the driver reads from a file argument
91
+ * (textconv).
92
+ */
93
+ interface CommandRunner {
94
+ readonly run: (request: CommandRequest) => Promise<CommandResult>;
95
+ }
96
+
39
97
  interface InflateStreamResult {
40
98
  /** The fully-inflated output bytes. */
41
99
  readonly output: Uint8Array;
@@ -43,8 +101,18 @@ interface InflateStreamResult {
43
101
  readonly bytesConsumed: number;
44
102
  }
45
103
  interface Compressor {
46
- /** Deflate (compress) data using zlib deflate format (RFC 1950). */
47
- readonly deflate: (data: Uint8Array) => Promise<Uint8Array>;
104
+ /**
105
+ * Deflate (compress) data using zlib deflate format (RFC 1950).
106
+ * `level` (when given and in zlib's -1..9 domain) tunes the compression
107
+ * level; adapters that cannot set a level accept and ignore it.
108
+ */
109
+ readonly deflate: (data: Uint8Array, level?: number) => Promise<Uint8Array>;
110
+ /**
111
+ * Raw DEFLATE (compress) using bare RFC 1951 bitstream — no zlib (RFC 1950)
112
+ * 2-byte header and no adler32 trailer. `level` semantics match `deflate`.
113
+ * Used by zip archive serializer (method 8). Additive — `deflate` unchanged.
114
+ */
115
+ readonly deflateRaw: (data: Uint8Array, level?: number) => Promise<Uint8Array>;
48
116
  /** Inflate (decompress) zlib-compressed data. */
49
117
  readonly inflate: (data: Uint8Array) => Promise<Uint8Array>;
50
118
  /**
@@ -66,6 +134,11 @@ interface Compressor {
66
134
  readonly createInflateStream: () => TransformStream<Uint8Array, Uint8Array>;
67
135
  }
68
136
 
137
+ interface EnvReader {
138
+ /** A single named environment variable's value, or `undefined` when unset. */
139
+ readonly get: (name: string) => string | undefined;
140
+ }
141
+
69
142
  /** Metadata returned by stat operations. */
70
143
  interface FileStat {
71
144
  readonly ctimeMs: number;
@@ -116,6 +189,8 @@ interface FileSystem {
116
189
  readonly readUtf8: (path: string) => Promise<string>;
117
190
  /** Write bytes to file, creating parent directories as needed. Overwrites if exists. */
118
191
  readonly write: (path: string, data: Uint8Array) => Promise<void>;
192
+ /** Stream bytes to file from an async source, creating parent directories as needed. Overwrites if exists. Writes bytes verbatim. */
193
+ readonly writeStream: (path: string, source: AsyncIterable<Uint8Array>) => Promise<void>;
119
194
  /**
120
195
  * Write bytes to file. Fails with FILE_EXISTS if the file already exists (exclusive create).
121
196
  *
@@ -244,7 +319,7 @@ interface HashService {
244
319
  * `HOOK_FAILED` command error reference it — a port may import domain, but
245
320
  * domain may never import a port.
246
321
  */
247
- type HookName = 'pre-commit' | 'commit-msg' | 'pre-push';
322
+ type HookName = 'pre-commit' | 'prepare-commit-msg' | 'commit-msg' | 'post-commit' | 'post-merge' | 'post-checkout' | 'pre-push' | 'pre-rebase' | 'post-rewrite';
248
323
 
249
324
  /**
250
325
  * A single hook invocation. The port is stateless — every fact the adapter
@@ -373,6 +448,43 @@ interface PromisorRemote {
373
448
  fetch(oids: ReadonlyArray<ObjectId>): Promise<PromisorFetchOutcome>;
374
449
  }
375
450
 
451
+ /**
452
+ * Request to open one SSH duplex channel. `command`/`args` are the fully
453
+ * resolved ssh program and argv (host token, `-p` flag, sq-quoted remote
454
+ * command) — the adapter performs no faithfulness logic of its own.
455
+ */
456
+ interface SshSpawnRequest {
457
+ /** Resolved ssh program (e.g. `ssh`, or a `GIT_SSH`/`core.sshCommand` override). */
458
+ readonly command: string;
459
+ /** Full argv, incl. host token and remote-command token. */
460
+ readonly args: ReadonlyArray<string>;
461
+ /** Additions merged OVER the parent process environment by the adapter. */
462
+ readonly env: Readonly<Record<string, string>>;
463
+ readonly signal?: AbortSignal;
464
+ }
465
+ /**
466
+ * One live SSH duplex channel — a thin process bridge. Stream shapes mirror
467
+ * `HttpTransport`: web streams in, web streams out.
468
+ */
469
+ interface SshChannel {
470
+ /** Request bytes written to the server. */
471
+ readonly stdin: WritableStream<Uint8Array>;
472
+ /** Advertisement + response bytes read from the server. */
473
+ readonly stdout: ReadableStream<Uint8Array>;
474
+ /** Resolves with the ssh process's exit code. */
475
+ readonly exit: Promise<number>;
476
+ /** Idempotent teardown — kills the child process. */
477
+ readonly close: () => Promise<void>;
478
+ }
479
+ /**
480
+ * Thin duplex process spawner. Knows nothing about git — argv building,
481
+ * quoting, and command resolution are pure application-tier concerns tested
482
+ * independently of this port.
483
+ */
484
+ interface SshTransport {
485
+ readonly open: (req: SshSpawnRequest) => Promise<SshChannel>;
486
+ }
487
+
376
488
  /**
377
489
  * Repository physical layout — where the working tree and.git directory live.
378
490
  * Renamed in from the previous `RepositoryConfig` (port-tier) to free that
@@ -383,6 +495,14 @@ interface RepositoryLayout {
383
495
  readonly workDir: string;
384
496
  /** Absolute path to the.git directory (usually `${workDir}/.git`, but may differ for bare repos or worktrees). */
385
497
  readonly gitDir: string;
498
+ /**
499
+ * Absolute path to the shared **common** git dir — objects, `packed-refs`,
500
+ * `config`, and shared refs/reflogs. Absent for a normal repo or the main
501
+ * worktree (it equals `gitDir`); set only for a linked worktree, whose
502
+ * `gitDir` is its own admin dir while shared state lives here. Resolve via
503
+ * `commonGitDir(ctx)` rather than reading this field directly.
504
+ */
505
+ readonly commonDir?: string;
386
506
  /** Whether this is a bare repository. */
387
507
  readonly bare: boolean;
388
508
  /**
@@ -438,6 +558,14 @@ interface RepositoryConfig {
438
558
  */
439
559
  readonly maxObjectsPerPack?: number;
440
560
  readonly detectRenames?: boolean;
561
+ /**
562
+ * Programmatic facade defaults for whitespace-diff modes. These are NOT git's
563
+ * `.git/config` settings and NOT `core.whitespace` — they are library-tier
564
+ * defaults applied by the `diff` command when no per-call option overrides them.
565
+ */
566
+ readonly ignoreWhitespace?: 'all' | 'change' | 'at-eol';
567
+ readonly ignoreCrAtEol?: boolean;
568
+ readonly ignoreBlankLines?: boolean;
441
569
  readonly breakStaleLockMs?: number;
442
570
  readonly dnsResolver?: (host: string) => Promise<ReadonlyArray<string>>;
443
571
  /** Hard cap on `dnsResolver` return-array length to bound resolver-amplification DoS. Default 64. */
@@ -453,6 +581,8 @@ interface Context {
453
581
  readonly layout: RepositoryLayout;
454
582
  /** User-supplied working directory (may be a sub-path of layout.workDir). Defaults to layout.workDir when not set by the facade. */
455
583
  readonly cwd: string;
584
+ /** The runtime this context was built for — names the adapter set in refusal messages. */
585
+ readonly runtime: 'node' | 'browser' | 'memory';
456
586
  /** Object serialization parameters (sha1 vs sha256 digest+hex sizes). */
457
587
  readonly hashConfig: HashConfig;
458
588
  /** Shared delta-base LRU cache; consumed by primitives' iterative delta walker. */
@@ -465,11 +595,36 @@ interface Context {
465
595
  readonly signal?: AbortSignal;
466
596
  /** Optional hook runner. Absent ⇒ hooks are inert (browser, or opted out). */
467
597
  readonly hooks?: HookRunner;
598
+ /**
599
+ * Optional shell-command runner. Absent ⇒ a configured external merge driver
600
+ * falls back to the built-in merge (browser / memory adapters cannot spawn a
601
+ * process).
602
+ */
603
+ readonly command?: CommandRunner;
604
+ /**
605
+ * Optional environment-variable reader. Absent ⇒ every variable is unset (browser /
606
+ * memory, where there is no process env). Notes-ref selection reads GIT_NOTES_REF through it.
607
+ */
608
+ readonly env?: EnvReader;
609
+ /**
610
+ * Optional SSH transport. Absent ⇒ ssh/scp remotes refuse — browser/memory
611
+ * cannot spawn a process.
612
+ */
613
+ readonly ssh?: SshTransport;
468
614
  /**
469
615
  * Optional promisor-remote capability. Populated by `openRepository`;
470
616
  * `readObject` consults it to lazy-fetch an object a partial clone omitted.
471
617
  */
472
618
  readonly promisor?: PromisorRemote;
619
+ /**
620
+ * Optional facade capability returning a `FileSystem` confined to one or more
621
+ * linked worktree paths AND the common dir (ADR-298). The worktree commands
622
+ * route worktree-directory I/O through it so worktrees outside `workDir` stay
623
+ * faithful without dropping containment (`move` passes both endpoints). Absent
624
+ * on sandboxed adapters (memory/browser), where worktrees are confined under
625
+ * the adapter root.
626
+ */
627
+ readonly worktreeFs?: (worktreePath: string | ReadonlyArray<string>) => FileSystem;
473
628
  }
474
629
  interface CreateContextParts {
475
630
  readonly fs: FileSystem;
@@ -479,15 +634,19 @@ interface CreateContextParts {
479
634
  readonly progress: ProgressReporter;
480
635
  readonly layout: RepositoryLayout;
481
636
  readonly cwd?: string;
637
+ readonly runtime: 'node' | 'browser' | 'memory';
482
638
  readonly hashConfig: HashConfig;
483
639
  readonly deltaCache: LruCache<Uint8Array>;
484
640
  readonly config?: RepositoryConfig;
485
641
  readonly logger?: Logger;
486
642
  readonly signal?: AbortSignal;
487
643
  readonly hooks?: HookRunner;
644
+ readonly command?: CommandRunner;
645
+ readonly env?: EnvReader;
646
+ readonly ssh?: SshTransport;
488
647
  }
489
648
  /** Assemble a frozen Context from its constituent ports + layout. */
490
649
  declare function createContext(parts: CreateContextParts): Context;
491
650
 
492
- export { ObjectId as O, FilePath as c, RefName as j, createContext as p, noopLogger as q, wrapLoggerSanitizer as w };
493
- 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, HookRunner as a, Context as b, FileStat as d, FileHandle as e, Hasher as f, HookName as g, HookResult as h, HookRequest as i, AuthorIdentity as k, CreateContextParts as l, PromisorFetchOutcome as m, PromisorRemote as n, RepositoryLayout as o };
651
+ export { EMPTY_TREE_OID as E, FilePath as F, ObjectId as O, RefName as R, SHA1_CONFIG as S, ZERO_OID as Z, SHA256_CONFIG as r, createContext as v, noopLogger as w, wrapLoggerSanitizer as x };
652
+ export type { AuthStrategy as A, CommandResult as B, CommandRunner as C, DirEntry as D, HashConfig as H, InflateStreamResult as I, Logger as L, ProgressReporter as P, Compressor as a, AuthorIdentity as b, Context as c, CreateContextParts as d, EnvReader as e, FileStat as f, FileSystem as g, HashService as h, Hasher as i, HookName as j, HookRequest as k, HookResult as l, HookRunner as m, PromisorFetchOutcome as n, PromisorRemote as o, RepositoryConfig as p, RepositoryLayout as q, SshChannel as s, SshSpawnRequest as t, SshTransport as u, FileHandle as y, CommandRequest as z };
@@ -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 };