@scolladon/tsgit 1.3.0 → 2.0.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.
Files changed (134) hide show
  1. package/README.md +3 -2
  2. package/dist/cjs/adapters/browser/index.cjs +1 -1
  3. package/dist/cjs/adapters/memory/index.cjs +1 -1
  4. package/dist/cjs/adapters/memory/index.cjs.map +1 -1
  5. package/dist/cjs/adapters/node/index.cjs +1 -1
  6. package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs +2 -0
  7. package/dist/cjs/chunks/adapter-detect-CD_LcgaH.cjs.map +1 -0
  8. package/dist/cjs/chunks/{browser-http-transport-D4NH-8oJ.cjs → browser-http-transport-CiMRqtDS.cjs} +2 -2
  9. package/dist/cjs/chunks/browser-http-transport-CiMRqtDS.cjs.map +1 -0
  10. package/dist/cjs/chunks/error-CfjFO3x_.cjs +2 -0
  11. package/dist/cjs/chunks/error-CfjFO3x_.cjs.map +1 -0
  12. package/dist/cjs/chunks/index-BWCq_5BJ.cjs +2 -0
  13. package/dist/cjs/chunks/index-BWCq_5BJ.cjs.map +1 -0
  14. package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs +2 -0
  15. package/dist/cjs/chunks/memory-http-transport-BVL6VgB-.cjs.map +1 -0
  16. package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs +2 -0
  17. package/dist/cjs/chunks/node-http-transport-BvfVcf02.cjs.map +1 -0
  18. package/dist/cjs/chunks/{progress-Bj2w-90A.cjs → progress-CxU62NC1.cjs} +2 -2
  19. package/dist/cjs/chunks/{progress-Bj2w-90A.cjs.map → progress-CxU62NC1.cjs.map} +1 -1
  20. package/dist/cjs/chunks/repository-BEg2zNtx.cjs +2 -0
  21. package/dist/cjs/chunks/repository-BEg2zNtx.cjs.map +1 -0
  22. package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs +2 -0
  23. package/dist/cjs/chunks/walk-submodules-D2Sp7JEB.cjs.map +1 -0
  24. package/dist/cjs/commands/index.cjs +1 -1
  25. package/dist/cjs/index.browser.cjs +1 -1
  26. package/dist/cjs/index.browser.cjs.map +1 -1
  27. package/dist/cjs/index.cjs +1 -1
  28. package/dist/cjs/index.cjs.map +1 -1
  29. package/dist/cjs/index.default.cjs +1 -1
  30. package/dist/cjs/index.default.cjs.map +1 -1
  31. package/dist/cjs/index.node.cjs +1 -1
  32. package/dist/cjs/index.node.cjs.map +1 -1
  33. package/dist/cjs/primitives/index.cjs +1 -1
  34. package/dist/cjs/primitives/index.cjs.map +1 -1
  35. package/dist/esm/adapters/browser/index.js +1 -1
  36. package/dist/esm/adapters/memory/index.js +1 -1
  37. package/dist/esm/adapters/memory/index.js.map +1 -1
  38. package/dist/esm/adapters/node/index.js +1 -1
  39. package/dist/esm/adapters/node/index.js.map +1 -1
  40. package/dist/esm/chunks/adapter-detect-DkZhhUhd.js +2 -0
  41. package/dist/esm/chunks/adapter-detect-DkZhhUhd.js.map +1 -0
  42. package/dist/esm/chunks/{browser-http-transport-DL8bkNdg.js → browser-http-transport-4rJkHcQu.js} +2 -2
  43. package/dist/esm/chunks/browser-http-transport-4rJkHcQu.js.map +1 -0
  44. package/dist/esm/chunks/error-Dc-SRSJK.js +2 -0
  45. package/dist/esm/chunks/error-Dc-SRSJK.js.map +1 -0
  46. package/dist/esm/chunks/index-jH0UMhh-.js +2 -0
  47. package/dist/esm/chunks/index-jH0UMhh-.js.map +1 -0
  48. package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js +2 -0
  49. package/dist/esm/chunks/memory-http-transport-CA1WxWBp.js.map +1 -0
  50. package/dist/esm/chunks/node-http-transport-DPa2lK3T.js +2 -0
  51. package/dist/esm/chunks/node-http-transport-DPa2lK3T.js.map +1 -0
  52. package/dist/esm/chunks/progress-BZobfl7p.js +2 -0
  53. package/dist/esm/chunks/{progress-NePjO3Kd.js.map → progress-BZobfl7p.js.map} +1 -1
  54. package/dist/esm/chunks/repository-DF6ePd1x.js +2 -0
  55. package/dist/esm/chunks/repository-DF6ePd1x.js.map +1 -0
  56. package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js +2 -0
  57. package/dist/esm/chunks/walk-submodules-Dq9oGwP8.js.map +1 -0
  58. package/dist/esm/commands/index.js +1 -1
  59. package/dist/esm/index.browser.js +1 -1
  60. package/dist/esm/index.browser.js.map +1 -1
  61. package/dist/esm/index.default.js +1 -1
  62. package/dist/esm/index.default.js.map +1 -1
  63. package/dist/esm/index.js +1 -1
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/index.node.js +1 -1
  66. package/dist/esm/index.node.js.map +1 -1
  67. package/dist/esm/primitives/index.js +1 -1
  68. package/dist/esm/primitives/index.js.map +1 -1
  69. package/dist/types/adapters/browser/index.d.cts +5 -2
  70. package/dist/types/adapters/browser/index.d.ts +5 -2
  71. package/dist/types/adapters/memory/index.d.cts +17 -2
  72. package/dist/types/adapters/memory/index.d.ts +17 -2
  73. package/dist/types/adapters/node/index.d.cts +5 -2
  74. package/dist/types/adapters/node/index.d.ts +5 -2
  75. package/dist/types/chunks/{context-BORy7yXb.d.ts → context-CCL0_F8R.d.ts} +65 -39
  76. package/dist/types/chunks/{context-CMrHCVwK.d.cts → context-YDw6qicq.d.cts} +65 -39
  77. package/dist/types/chunks/{http-transport-DirKfK2S.d.cts → http-transport--_NdQOiw.d.cts} +1 -1
  78. package/dist/types/chunks/{http-transport-DirKfK2S.d.ts → http-transport--_NdQOiw.d.ts} +1 -1
  79. package/dist/types/chunks/index-entry-DtEbVpOG.d.cts +47 -0
  80. package/dist/types/chunks/index-entry-UD4dvtKh.d.ts +47 -0
  81. package/dist/types/chunks/progress-7KKiXXfX.d.ts +405 -0
  82. package/dist/types/chunks/progress-By8yFaUE.d.cts +405 -0
  83. package/dist/types/chunks/{reflog-entry-C2Hsdobk.d.ts → reflog-entry-BbNnXCTC.d.cts} +17 -3
  84. package/dist/types/chunks/{reflog-entry-DNvSz7S5.d.cts → reflog-entry-CSzjnZd4.d.ts} +17 -3
  85. package/dist/types/chunks/{repository-DCR_3RVt.d.cts → repository-BeifCqp0.d.cts} +48 -8
  86. package/dist/types/chunks/{repository-DFxFeYi3.d.ts → repository-FoS_Laoy.d.ts} +48 -8
  87. package/dist/types/chunks/{write-tree-CuhpWKFo.d.cts → write-tree-C3oNxOlX.d.cts} +78 -46
  88. package/dist/types/chunks/{write-tree-Dn1LtIh7.d.ts → write-tree-DRI-LzSr.d.ts} +78 -46
  89. package/dist/types/commands/index.d.cts +826 -95
  90. package/dist/types/commands/index.d.ts +826 -95
  91. package/dist/types/index.browser.d.cts +7 -6
  92. package/dist/types/index.browser.d.ts +7 -6
  93. package/dist/types/index.d.cts +278 -53
  94. package/dist/types/index.d.ts +278 -53
  95. package/dist/types/index.default.d.cts +7 -6
  96. package/dist/types/index.default.d.ts +7 -6
  97. package/dist/types/index.node.d.cts +7 -6
  98. package/dist/types/index.node.d.ts +7 -6
  99. package/dist/types/primitives/index.d.cts +260 -12
  100. package/dist/types/primitives/index.d.ts +260 -12
  101. package/dist/types/transport/index.d.cts +1 -1
  102. package/dist/types/transport/index.d.ts +1 -1
  103. package/package.json +25 -18
  104. package/dist/cjs/chunks/browser-http-transport-D4NH-8oJ.cjs.map +0 -1
  105. package/dist/cjs/chunks/error-CDLOBdNU.cjs +0 -2
  106. package/dist/cjs/chunks/error-CDLOBdNU.cjs.map +0 -1
  107. package/dist/cjs/chunks/index-BVArBKuk.cjs +0 -2
  108. package/dist/cjs/chunks/index-BVArBKuk.cjs.map +0 -1
  109. package/dist/cjs/chunks/index-DE9HSiWf.cjs +0 -2
  110. package/dist/cjs/chunks/index-DE9HSiWf.cjs.map +0 -1
  111. package/dist/cjs/chunks/logger-CVG0zcPH.cjs +0 -2
  112. package/dist/cjs/chunks/logger-CVG0zcPH.cjs.map +0 -1
  113. package/dist/cjs/chunks/memory-http-transport-DXwDGKtR.cjs +0 -2
  114. package/dist/cjs/chunks/memory-http-transport-DXwDGKtR.cjs.map +0 -1
  115. package/dist/cjs/chunks/node-http-transport-vrbnNEDb.cjs +0 -2
  116. package/dist/cjs/chunks/node-http-transport-vrbnNEDb.cjs.map +0 -1
  117. package/dist/cjs/chunks/repository-BJwTSiGf.cjs +0 -2
  118. package/dist/cjs/chunks/repository-BJwTSiGf.cjs.map +0 -1
  119. package/dist/esm/chunks/browser-http-transport-DL8bkNdg.js.map +0 -1
  120. package/dist/esm/chunks/error-MOmSzp9Z.js +0 -2
  121. package/dist/esm/chunks/error-MOmSzp9Z.js.map +0 -1
  122. package/dist/esm/chunks/index-BjmofbKE.js +0 -2
  123. package/dist/esm/chunks/index-BjmofbKE.js.map +0 -1
  124. package/dist/esm/chunks/index-Jh5R-UmU.js +0 -2
  125. package/dist/esm/chunks/index-Jh5R-UmU.js.map +0 -1
  126. package/dist/esm/chunks/logger-DP2cCpvL.js +0 -2
  127. package/dist/esm/chunks/logger-DP2cCpvL.js.map +0 -1
  128. package/dist/esm/chunks/memory-http-transport-COJU6VOL.js +0 -2
  129. package/dist/esm/chunks/memory-http-transport-COJU6VOL.js.map +0 -1
  130. package/dist/esm/chunks/node-http-transport-DYCFIJbc.js +0 -2
  131. package/dist/esm/chunks/node-http-transport-DYCFIJbc.js.map +0 -1
  132. package/dist/esm/chunks/progress-NePjO3Kd.js +0 -2
  133. package/dist/esm/chunks/repository-Cs-dbHqO.js +0 -2
  134. package/dist/esm/chunks/repository-Cs-dbHqO.js.map +0 -1
@@ -1,68 +1,293 @@
1
- import { f as FileSystem, H as HashService, C as Compressor, P as ProgressReporter } from './chunks/context-BORy7yXb.js';
2
- export { A as AuthStrategy, a as AuthorIdentity, b as Context, c as CreateContextParts, D as DirEntry, e as FileStat, g as Hasher, h as HookName, i as HookRequest, j as HookResult, k as HookRunner, L as Logger, l as PromisorFetchOutcome, m as PromisorRemote, n as RepositoryConfig, o as RepositoryLayout, p as createContext, q as noopLogger, w as wrapLoggerSanitizer } from './chunks/context-BORy7yXb.js';
3
- import { b as HttpTransport } from './chunks/http-transport-DirKfK2S.js';
4
- export { H as HttpRequest, a as HttpResponse } from './chunks/http-transport-DirKfK2S.js';
5
- export { AddOptions, AddResult, BranchAction, BranchInfo, BranchResult, CatFileInput, CatFileResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CloneOptions, CloneResult, CommitOptions, CommitResult, DiffOptions, FetchMissingOptions, FetchMissingResult, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, PushOptions, PushResult, ReflogAction, ReflogResult, ReflogShowEntry, ResetMode, ResetOptions, ResetResult, RmOptions, RmResult, SparseCheckoutAction, SparseCheckoutResult, StatusResult, SubmodulesAction, SubmodulesResult, TagAction, TagInfo, TagResult, add, branch, catFile, checkout, clone, commit, createPromisorRemote, diff, fetch, fetchMissing, init, log, merge, push, reflog, reset, revParse, rm, sparseCheckout, status, submodules, tag } from './commands/index.js';
6
- export { C as CatFileBatchEntry, S as SubmoduleEntry } from './chunks/reflog-entry-C2Hsdobk.js';
7
-
8
- /**
9
- * The four adapter ports the facade plumbs into the Context. Each runtime
10
- * shim (`index.node.ts`, `index.browser.ts`, `index.default.ts` — wired in
11
- * Step 5) provides a `detectAdapter(): AdapterSet` that returns the runtime-
12
- * appropriate set.
13
- */
14
- interface AdapterSet {
15
- readonly fs: FileSystem;
16
- readonly hash: HashService;
17
- readonly compressor: Compressor;
18
- readonly transport: HttpTransport;
1
+ import { I as IndexResolver, b as Snapshot, e as IndexEntry, f as SnapshotEntry, T as TreeResolver, g as TreeEntry } from './chunks/progress-7KKiXXfX.js';
2
+ export { A as AdapterSet, h as IndexSnapshot, R as ResolveOptions, S as SnapshotFactory, j as SnapshotFactoryDeps, k as SnapshotOptions, l as StashSnapshot, m as TreeSnapshot, W as WalkIgnorePredicate, o as WorkdirEntry, p as WorkdirEnumOptions, q as WorkdirEnumerator, r as WorkdirSnapshot, s as WorkdirSnapshotDeps, t as WorkdirSnapshotOptions, c as consoleProgress, u as createSnapshotFactory, v as createStashSnapshot, w as createWorkdirSnapshot, d as detectRuntime, i as isBrowser, a as isNode, n as noopProgress } from './chunks/progress-7KKiXXfX.js';
3
+ export { AbortMergeResult, AddOptions, AddResult, BranchCreateInput, BranchCreateResult, BranchDeleteInput, BranchDeleteResult, BranchInfo, BranchListResult, BranchNamespace, BranchRenameInput, BranchRenameResult, CatFileInput, CatFileResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CherryPickAbortResult, CherryPickConflict, CherryPickContinueInput, CherryPickNamespace, CherryPickResult, CherryPickRunInput, CherryPickedCommit, CloneOptions, CloneResult, CommitOptions, CommitResult, ConfigEntryView, ConfigGetAllInput, ConfigGetAllResult, ConfigGetInput, ConfigGetRegexpInput, ConfigGetRegexpResult, ConfigGetResult, ConfigListInput, ConfigListResult, ConfigNamespace, ConfigRemoveSectionInput, ConfigRemoveSectionResult, ConfigRenameSectionInput, ConfigRenameSectionResult, ConfigSetInput, ConfigSetResult, ConfigUnsetAllInput, ConfigUnsetAllResult, ConfigUnsetInput, ConfigUnsetResult, ContinueMergeOptions, ContinueMergeResult, DiffFormat, DiffOptions, DiffResult, FetchMissingOptions, FetchMissingResult, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, MvMove, MvOptions, MvResult, MvSkipReason, MvSkipped, PatchResult, PullOptions, PullResult, PushOptions, PushResult, RebaseAbortResult, RebaseConflict, RebaseInstruction, RebaseInteractiveAction, RebaseNamespace, RebaseResult, RebaseRunInput, RebasedCommit, ReflogAction, ReflogResult, ReflogShowEntry, RemoteAddInput, RemoteAddResult, RemoteInfo, RemoteListResult, RemoteNamespace, RemoteRemoveInput, RemoteRemoveResult, RemoteRenameInput, RemoteRenameResult, RemoteSetUrlInput, RemoteSetUrlResult, RemoteShow, RemoteShowInput, RemoteShowResult, ResetMode, ResetOptions, ResetResult, RevertAbortResult, RevertConflict, RevertNamespace, RevertResult, RevertRunInput, RevertedCommit, RmOptions, RmResult, SparseCheckoutAddInput, SparseCheckoutAppliedResult, SparseCheckoutDisableInput, SparseCheckoutListResult, SparseCheckoutNamespace, SparseCheckoutReapplyInput, SparseCheckoutSetInput, StashApplyInput, StashApplyResult, StashConflict, StashDropInput, StashDropResult, StashListEntry, StashListResult, StashNamespace, StashPopResult, StashPushInput, StashPushResult, StatusResult, SubmodulesAction, SubmodulesResult, TagCreateInput, TagCreateResult, TagDeleteInput, TagDeleteResult, TagInfo, TagListResult, TagNamespace, abortMerge, add, bindBranchNamespace, bindCherryPickNamespace, bindConfigNamespace, bindRebaseNamespace, bindRemoteNamespace, bindRevertNamespace, bindSparseCheckoutNamespace, bindStashNamespace, bindTagNamespace, branchCreate, branchDelete, branchList, branchRename, catFile, checkout, cherryPickAbort, cherryPickContinue, cherryPickRun, cherryPickSkip, clone, commit, configGet, configGetAll, configGetRegexp, configList, configRemoveSection, configRenameSection, configSet, configUnset, configUnsetAll, continueMerge, createPromisorRemote, diff, fetch, fetchMissing, init, log, merge, mv, pull, push, rebaseAbort, rebaseContinue, rebaseRun, rebaseSkip, reflog, remoteAdd, remoteList, remoteRemove, remoteRename, remoteSetUrl, remoteShow, reset, revParse, revertAbort, revertContinue, revertRun, revertSkip, rm, sparseCheckoutAdd, sparseCheckoutDisable, sparseCheckoutList, sparseCheckoutReapply, sparseCheckoutSet, stashApply, stashDrop, stashList, stashPop, stashPush, status, submodules, tagCreate, tagDelete, tagList } from './commands/index.js';
4
+ import { c as FilePath, b as Context, O as ObjectId } from './chunks/context-CCL0_F8R.js';
5
+ export { A as AuthStrategy, k as AuthorIdentity, C as Compressor, l as CreateContextParts, D as DirEntry, d as FileStat, F as FileSystem, H as HashService, f as Hasher, g as HookName, i as HookRequest, h as HookResult, a as HookRunner, L as Logger, P as ProgressReporter, m as PromisorFetchOutcome, n as PromisorRemote, R as RepositoryConfig, o as RepositoryLayout, p as createContext, q as noopLogger, w as wrapLoggerSanitizer } from './chunks/context-CCL0_F8R.js';
6
+ export { a as HttpRequest, b as HttpResponse, H as HttpTransport } from './chunks/http-transport--_NdQOiw.js';
7
+ export { C as CatFileBatchEntry, S as SubmoduleEntry } from './chunks/reflog-entry-CSzjnZd4.js';
8
+ import './chunks/index-entry-UD4dvtKh.js';
9
+
10
+ /**
11
+ * Extracts the entry shape `E` from a `Snapshot<E>` constraint. Used by
12
+ * the join row types to project each slot's entry shape onto the merged
13
+ * row.
14
+ */
15
+ type EntryOf<X> = X extends {
16
+ entries(opts?: unknown): AsyncIterable<infer E>;
17
+ } ? E : never;
18
+ /**
19
+ * Outer-join row — `path` is mandatory, every named slot is OPTIONAL.
20
+ * A slot is `undefined` for rows where that source did not contribute
21
+ * an entry at the given path.
22
+ */
23
+ type OuterJoinRow<S> = {
24
+ readonly path: FilePath;
25
+ } & {
26
+ readonly [K in keyof S]?: EntryOf<S[K]>;
27
+ };
28
+ /**
29
+ * Inner-join row — `path` is mandatory and every named slot is REQUIRED
30
+ * (no `?`). Only rows where every source contributed an entry at the
31
+ * given path are emitted.
32
+ */
33
+ type InnerJoinRow<S> = {
34
+ readonly path: FilePath;
35
+ } & {
36
+ readonly [K in keyof S]: EntryOf<S[K]>;
37
+ };
38
+
39
+ /**
40
+ * Discriminator for write-target categories used across the CQS port triple
41
+ * — `WriteEventEmitter` (command), `WriteEventStream` (subscribe), and
42
+ * `GenerationView` (query). See ADR-157 for the rationale of splitting
43
+ * those three concerns across separate port files; `WriteScope` lives in
44
+ * its own file so none of the three ports needs to import another's
45
+ * declaration, preserving the CQS split at the import-graph level.
46
+ */
47
+ type WriteScope = 'index' | 'refs' | 'objects';
48
+
49
+ /**
50
+ * Query side of the write-event triple (ADR-157). Read primitives depend on
51
+ * this interface only — they query the current generation per scope but
52
+ * cannot emit or subscribe.
53
+ *
54
+ * `current(scope)` is monotonic per scope: each successful `WriteEventEmitter.emit(scope)`
55
+ * increments the corresponding counter exactly once. Scopes are independent
56
+ * — `emit('index')` does not affect `current('refs')` or `current('objects')`.
57
+ */
58
+ interface GenerationView {
59
+ current(scope: WriteScope): number;
60
+ }
61
+
62
+ /**
63
+ * Command side of the write-event triple (ADR-157). Write-boundary primitives
64
+ * depend on this interface only — they cannot observe events, only emit them.
65
+ *
66
+ * Implementations MUST be called AFTER a successful write but BEFORE
67
+ * releasing any acquired lock. See `docs/understand/caching.md` for the
68
+ * lock-ordering protocol; in-process readers rely on the
69
+ * emit-before-release ordering to avoid TOCTOU windows.
70
+ */
71
+ interface WriteEventEmitter {
72
+ emit(scope: WriteScope): void;
73
+ }
74
+
75
+ /**
76
+ * Disposable handle returned from `WriteEventStream.subscribe`. Matches the
77
+ * shape of TC39 Explicit Resource Management's `Disposable` so callers can
78
+ * use `using` syntax once the project's TS target supports it.
79
+ */
80
+ interface Disposable {
81
+ dispose(): void;
82
+ }
83
+ /**
84
+ * Subscribe side of the write-event triple (ADR-157). Cache adapters depend
85
+ * on this interface only — they observe events but cannot emit them.
86
+ *
87
+ * Subscribers receive identical event sequences regardless of subscription
88
+ * order. Disposing a subscription removes the listener; the next event is
89
+ * not delivered to that listener.
90
+ */
91
+ interface WriteEventStream {
92
+ subscribe(listener: (scope: WriteScope) => void): Disposable;
93
+ }
94
+
95
+ /**
96
+ * Emits a deprecation warning at most once per `callsite`. The set-based
97
+ * dedup keeps long-running daemons (e.g. an editor LSP) from spamming the
98
+ * log when the same deprecated path is hit thousands of times.
99
+ *
100
+ * Output is suppressed entirely when the `TSGIT_SUPPRESS_DEPRECATIONS=1`
101
+ * environment variable is set (per ADR-160). Defensive against browser
102
+ * contexts where `process` is undefined — the lookup never throws.
103
+ *
104
+ * See `docs/use/snapshots.md` for the deprecation policy that drives
105
+ * Wave 8 (legacy walker removal in tsgit 2.0).
106
+ */
107
+ declare const warnDeprecated: (callsite: string, message: string) => void;
108
+
109
+ interface IndexSnapshotDeps {
110
+ readonly ctx: Context;
111
+ readonly indexResolver: IndexResolver;
112
+ }
113
+ /**
114
+ * Lazily evaluates `.git/index` via `IndexResolver`. The parsed `GitIndex`
115
+ * is captured on the first iteration and reused across subsequent
116
+ * iterations of the same handle (design §8.0 iteration stability):
117
+ *
118
+ * - First `entries()` call → resolver.resolve(ctx) → captured reference
119
+ * - All subsequent `entries()` calls → stream from captured reference,
120
+ * bypassing the resolver entirely; `emit('index')` events on the bus
121
+ * never disturb an in-flight iteration.
122
+ * - A fresh `repo.snapshot.index()` returns a new handle whose own first
123
+ * iteration sees the resolver's post-invalidation state.
124
+ *
125
+ * `bypassCache` forwards to the resolver only for the *first* resolve on
126
+ * this handle; once captured, subsequent calls use the captured reference.
127
+ */
128
+ declare const createIndexSnapshot: (deps: IndexSnapshotDeps) => Snapshot<IndexEntry>;
129
+
130
+ type SnapshotMap = {
131
+ readonly [k: string]: Snapshot<SnapshotEntry>;
132
+ };
133
+ interface JoinOptions {
134
+ readonly concurrency?: number;
135
+ readonly signal?: AbortSignal;
136
+ }
137
+ /**
138
+ * Outer-join over an arbitrary record of snapshots, keyed by path. Every
139
+ * row carries the path plus one or more populated slot entries (a slot
140
+ * is `undefined` when that source had no entry at the path).
141
+ *
142
+ * Single-source joins take the short-circuit path (one alloc per row);
143
+ * multi-source joins delegate to the k-way merge in `path-merge.ts`.
144
+ */
145
+ declare const join: <S extends SnapshotMap>(sources: S, opts?: JoinOptions) => AsyncIterable<OuterJoinRow<S>>;
146
+ /**
147
+ * Inner-join — yields rows only when every named slot has an entry at
148
+ * the given path. Useful for "files present in both X and Y" queries
149
+ * (e.g. unmerged paths in both index and workdir).
150
+ */
151
+ declare const innerJoin: <S extends SnapshotMap>(sources: S, opts?: JoinOptions) => AsyncIterable<InnerJoinRow<S>>;
152
+
153
+ /**
154
+ * Unwrap a `Promise<T | null>` from a compound-state snapshot factory
155
+ * (`mergeHead`, `cherryPickHead`, `revertHead`, `fetchHead`, `stashEntry`).
156
+ *
157
+ * Calls that require the state to exist (e.g. `abortMerge` when no merge
158
+ * is in progress) use this helper to fail loudly with a `SNAPSHOT_REQUIRED`
159
+ * code carrying the caller's reason. Calls that tolerate absence keep the
160
+ * null-check in their own flow.
161
+ *
162
+ * Example:
163
+ *
164
+ * ```ts
165
+ * const theirs = await requireSnapshot(
166
+ * repo.snapshot.mergeHead(),
167
+ * 'no merge in progress',
168
+ * );
169
+ * ```
170
+ */
171
+ declare const requireSnapshot: <T>(promise: Promise<T | null>, reason: string) => Promise<T>;
172
+
173
+ interface TreeSnapshotDeps {
174
+ readonly ctx: Context;
175
+ readonly treeResolver: TreeResolver;
19
176
  }
20
177
  /**
21
- * Prototype-pollution-safe runtime check. Returns true only when `process` is
22
- * an object that owns BOTH `versions` and `versions.node` as own properties —
23
- * an attacker who pollutes `Object.prototype.versions` cannot make this
24
- * return true.
178
+ * Lazily evaluates a tree by its oid via `TreeResolver`. The root tree is
179
+ * resolved on the first iteration and reused across subsequent iterations
180
+ * for stability. Trees are content-addressed, so the captured reference
181
+ * is independent of any external cache invalidation.
25
182
  *
26
- * Used as a manual fallback only; the primary detection mechanism is
27
- * `package.json` conditional exports (resolved at bundle time, immune to
28
- * runtime pollution).
183
+ * Only leaf entries (files, symlinks, gitlinks/submodules) are yielded.
184
+ * Directories are descended into but never yielded as their own row —
185
+ * `kind` is therefore narrowed to `'file' | 'symlink' | 'submodule'`.
186
+ */
187
+ declare const createTreeSnapshot: (deps: TreeSnapshotDeps, treeId: ObjectId) => Snapshot<TreeEntry>;
188
+
189
+ interface DirGroup<R> {
190
+ readonly path: FilePath;
191
+ readonly rows: ReadonlyArray<R>;
192
+ }
193
+ /**
194
+ * Groups consecutive rows by their parent directory. Because the row
195
+ * stream is sorted by path (`assertOrdered` enforced upstream), entries
196
+ * sharing a directory always arrive contiguously — no buffering of
197
+ * unrelated rows is required.
29
198
  */
30
- declare const isNode: () => boolean;
199
+ declare const groupByDir: <R extends {
200
+ readonly path: FilePath;
201
+ }>() => (source: AsyncIterable<R>) => AsyncIterable<DirGroup<R>>;
202
+
203
+ interface HashSlotOptions {
204
+ readonly concurrency?: number;
205
+ readonly signal?: AbortSignal;
206
+ }
207
+ type SlotKeyedRow$2 = {
208
+ readonly path: FilePath;
209
+ };
31
210
  /**
32
- * Returns true when both `window` and `navigator` exist AS OWN globals on
33
- * `globalThis` AND have non-undefined values. Two-stage check:
34
- * - `hasOwn` rejects properties inherited from a polluted `Object.prototype`.
35
- * - `typeof` rejects own properties that have been assigned `undefined`
36
- * (e.g., test harnesses that stub the global to undefined).
211
+ * Generic slot-hashing operator. For each row whose named slot has an
212
+ * entry exposing `hash()`, invokes the method to warm the entry's
213
+ * hash (most relevant for WorkdirEntry, where `hash()` reads the file
214
+ * and computes the git blob hash).
215
+ *
216
+ * Row typing is intentionally loose (`R extends { path: FilePath }`):
217
+ * the operator is a pure pipeline stage and does not constrain the
218
+ * shape of slot entries beyond an optional `hash()` method. Concrete
219
+ * join callers narrow at the type-projection boundary.
37
220
  */
38
- declare const isBrowser: () => boolean;
221
+ declare const hashSlot: <R extends SlotKeyedRow$2>(slot: string, opts?: HashSlotOptions) => (source: AsyncIterable<R>) => AsyncIterable<R>;
39
222
  /**
40
- * Three-way runtime classification used by manual call sites. Node takes
41
- * precedence over browser when both look present (e.g., test environments
42
- * with jsdom + a real Node process).
223
+ * Conventional wrapper for the 95% case (slot named `workdir`).
224
+ * See design §12.1.
43
225
  */
44
- declare const detectRuntime: () => "node" | "browser" | "memory";
226
+ declare const hashWorkdir: <R extends SlotKeyedRow$2>(opts?: HashSlotOptions) => ((source: AsyncIterable<R>) => AsyncIterable<R>);
45
227
 
46
- /** No-op reporter — default when the caller does not provide one. */
47
- declare const noopProgress: ProgressReporter;
228
+ interface LoadBlobOptions {
229
+ readonly concurrency?: number;
230
+ readonly maxInflightBytes?: number;
231
+ readonly signal?: AbortSignal;
232
+ }
233
+ type SlotKeyedRow$1 = {
234
+ readonly path: FilePath;
235
+ };
48
236
  /**
49
- * Built-in reporter that emits one line per call to a user-supplied `sink`.
237
+ * Reads the blob bytes for a named slot, with a bounded in-flight byte
238
+ * budget. The operator preserves order and forwards rows verbatim;
239
+ * downstream consumers can rely on the `read()` cache being warm.
50
240
  *
51
- * Format:
52
- * start(op) → "<safeOp>: start"
53
- * start(op, total) → "<safeOp>: start/<total>"
54
- * update(op, c) → "<safeOp>: <c>"
55
- * update(op, c, t) → "<safeOp>: <c>/<t>"
56
- * update(op, c, t, txt) "<safeOp>: <c>/<t> <safeText>"
57
- * end(op) → "<safeOp>: done"
241
+ * `maxInflightBytes` (default: 64 MiB) caps the total size of in-flight
242
+ * reads. When the budget is exhausted, oldest reads are awaited before
243
+ * issuing new ones. This protects against memory blow-up on repos with
244
+ * occasional multi-GiB blobs.
245
+ */
246
+ declare const loadBlob: <R extends SlotKeyedRow$1>(slot: string, opts?: LoadBlobOptions) => (source: AsyncIterable<R>) => AsyncIterable<R>;
247
+
248
+ interface TerminalOptions {
249
+ readonly signal?: AbortSignal;
250
+ }
251
+ declare const count: <T>(source: AsyncIterable<T>, opts?: TerminalOptions) => Promise<number>;
252
+ declare const toArray: <T>(source: AsyncIterable<T>, opts?: TerminalOptions) => Promise<ReadonlyArray<T>>;
253
+ declare const first: <T>(source: AsyncIterable<T>, opts?: TerminalOptions) => Promise<T | null>;
254
+
255
+ type VerifyRaceAction = 'throw' | 'skip' | 'emit';
256
+ interface VerifyOptions {
257
+ readonly onRace?: VerifyRaceAction;
258
+ readonly signal?: AbortSignal;
259
+ }
260
+ type SlotKeyedRow = {
261
+ readonly path: FilePath;
262
+ };
263
+ /**
264
+ * Marker added to a row by `verifyWorkdir({ onRace: 'emit' })` when the
265
+ * per-row `verify()` rejects. Consumers narrow with `'_raced' in row` to
266
+ * branch on race status without an unsafe cast.
267
+ */
268
+ interface RacedRow {
269
+ readonly _raced: true;
270
+ }
271
+ /**
272
+ * Output row type for `verifyWorkdir`. In `'throw'` and `'skip'` modes
273
+ * the operator only ever yields the original `R`. In `'emit'` mode it
274
+ * may additionally yield `R & RacedRow` for rows whose `verify()`
275
+ * rejected.
276
+ */
277
+ type VerifyOutput<R> = R | (R & RacedRow);
278
+ /**
279
+ * Re-lstats workdir entries during iteration via `WorkdirEntry.verify()`.
58
280
  *
59
- * `op` is sanitized identically to `text` (defense-in-depth: a programming bug
60
- * that wires a sideband-derived string into `op` cannot inject control characters).
281
+ * - `'throw'` (default) propagate the `WORKDIR_RACE` error.
282
+ * - `'skip'` silently drop racy rows.
283
+ * - `'emit'` — yield the row unchanged plus a `_raced: true` marker;
284
+ * consumers narrow with `'_raced' in row` to branch on race status.
61
285
  *
62
- * A throwing `sink` cannot crash the reporter every call is wrapped in
63
- * try/catch.
286
+ * Workdir snapshot remains race-prone by design (ADR-153); this operator
287
+ * is the opt-in guard for "no race tolerated" workflows like
288
+ * `add -p` and `checkout --detect-races`.
64
289
  */
65
- declare const consoleProgress: (sink: (line: string) => void) => ProgressReporter;
290
+ declare const verifyWorkdir: <R extends SlotKeyedRow>(opts?: VerifyOptions) => (source: AsyncIterable<R>) => AsyncIterable<VerifyOutput<R>>;
66
291
 
67
- export { Compressor, FileSystem, HashService, HttpTransport, ProgressReporter, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress };
68
- export type { AdapterSet };
292
+ export { Context, IndexEntry, IndexResolver, Snapshot, SnapshotEntry, TreeEntry, TreeResolver, count, createIndexSnapshot, createTreeSnapshot, first, groupByDir, hashSlot, hashWorkdir, innerJoin, join, loadBlob, requireSnapshot, toArray, verifyWorkdir, warnDeprecated };
293
+ export type { DirGroup, Disposable, GenerationView, HashSlotOptions, IndexSnapshotDeps, JoinOptions, LoadBlobOptions, TerminalOptions, TreeSnapshotDeps, VerifyOptions, VerifyRaceAction, WriteEventEmitter, WriteEventStream, WriteScope };
@@ -1,10 +1,11 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DCR_3RVt.cjs';
2
- export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
- export { P as ProgressReporter } from './chunks/context-CMrHCVwK.cjs';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BeifCqp0.cjs';
2
+ export { A as AdapterSet, c as consoleProgress, d as detectRuntime, i as isBrowser, a as isNode, n as noopProgress } from './chunks/progress-By8yFaUE.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-YDw6qicq.cjs';
4
4
  import './commands/index.cjs';
5
- import './chunks/reflog-entry-DNvSz7S5.cjs';
6
- import './chunks/write-tree-CuhpWKFo.cjs';
7
- import './chunks/http-transport-DirKfK2S.cjs';
5
+ import './chunks/reflog-entry-BbNnXCTC.cjs';
6
+ import './chunks/write-tree-C3oNxOlX.cjs';
7
+ import './chunks/index-entry-DtEbVpOG.cjs';
8
+ import './chunks/http-transport--_NdQOiw.cjs';
8
9
 
9
10
  /**
10
11
  * Memory-runtime entry point. Selected by `package.json` `"exports"` for
@@ -1,10 +1,11 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DFxFeYi3.js';
2
- export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
- export { P as ProgressReporter } from './chunks/context-BORy7yXb.js';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-FoS_Laoy.js';
2
+ export { A as AdapterSet, c as consoleProgress, d as detectRuntime, i as isBrowser, a as isNode, n as noopProgress } from './chunks/progress-7KKiXXfX.js';
3
+ export { P as ProgressReporter } from './chunks/context-CCL0_F8R.js';
4
4
  import './commands/index.js';
5
- import './chunks/reflog-entry-C2Hsdobk.js';
6
- import './chunks/write-tree-Dn1LtIh7.js';
7
- import './chunks/http-transport-DirKfK2S.js';
5
+ import './chunks/reflog-entry-CSzjnZd4.js';
6
+ import './chunks/write-tree-DRI-LzSr.js';
7
+ import './chunks/index-entry-UD4dvtKh.js';
8
+ import './chunks/http-transport--_NdQOiw.js';
8
9
 
9
10
  /**
10
11
  * Memory-runtime entry point. Selected by `package.json` `"exports"` for
@@ -1,10 +1,11 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DCR_3RVt.cjs';
2
- export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
- export { P as ProgressReporter } from './chunks/context-CMrHCVwK.cjs';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BeifCqp0.cjs';
2
+ export { A as AdapterSet, c as consoleProgress, d as detectRuntime, i as isBrowser, a as isNode, n as noopProgress } from './chunks/progress-By8yFaUE.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-YDw6qicq.cjs';
4
4
  import './commands/index.cjs';
5
- import './chunks/reflog-entry-DNvSz7S5.cjs';
6
- import './chunks/write-tree-CuhpWKFo.cjs';
7
- import './chunks/http-transport-DirKfK2S.cjs';
5
+ import './chunks/reflog-entry-BbNnXCTC.cjs';
6
+ import './chunks/write-tree-C3oNxOlX.cjs';
7
+ import './chunks/index-entry-DtEbVpOG.cjs';
8
+ import './chunks/http-transport--_NdQOiw.cjs';
8
9
 
9
10
  /**
10
11
  * Node-runtime extension to `OpenRepositoryOptions`. Adds `allowInsecureHttp`
@@ -1,10 +1,11 @@
1
- import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-DFxFeYi3.js';
2
- export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
- export { P as ProgressReporter } from './chunks/context-BORy7yXb.js';
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-FoS_Laoy.js';
2
+ export { A as AdapterSet, c as consoleProgress, d as detectRuntime, i as isBrowser, a as isNode, n as noopProgress } from './chunks/progress-7KKiXXfX.js';
3
+ export { P as ProgressReporter } from './chunks/context-CCL0_F8R.js';
4
4
  import './commands/index.js';
5
- import './chunks/reflog-entry-C2Hsdobk.js';
6
- import './chunks/write-tree-Dn1LtIh7.js';
7
- import './chunks/http-transport-DirKfK2S.js';
5
+ import './chunks/reflog-entry-CSzjnZd4.js';
6
+ import './chunks/write-tree-DRI-LzSr.js';
7
+ import './chunks/index-entry-UD4dvtKh.js';
8
+ import './chunks/http-transport--_NdQOiw.js';
8
9
 
9
10
  /**
10
11
  * Node-runtime extension to `OpenRepositoryOptions`. Adds `allowInsecureHttp`