@scolladon/tsgit 0.9.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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -0
  3. package/dist/cjs/adapters/browser/index.cjs +2 -0
  4. package/dist/cjs/adapters/browser/index.cjs.map +1 -0
  5. package/dist/cjs/adapters/memory/index.cjs +2 -0
  6. package/dist/cjs/adapters/memory/index.cjs.map +1 -0
  7. package/dist/cjs/adapters/node/index.cjs +2 -0
  8. package/dist/cjs/adapters/node/index.cjs.map +1 -0
  9. package/dist/cjs/chunks/browser-http-transport-BBF8uw-f.cjs +2 -0
  10. package/dist/cjs/chunks/browser-http-transport-BBF8uw-f.cjs.map +1 -0
  11. package/dist/cjs/chunks/context-BcoAzPuU.cjs +2 -0
  12. package/dist/cjs/chunks/context-BcoAzPuU.cjs.map +1 -0
  13. package/dist/cjs/chunks/error-DL4SHCBJ.cjs +2 -0
  14. package/dist/cjs/chunks/error-DL4SHCBJ.cjs.map +1 -0
  15. package/dist/cjs/chunks/error-DN8Vnwr4.cjs +2 -0
  16. package/dist/cjs/chunks/error-DN8Vnwr4.cjs.map +1 -0
  17. package/dist/cjs/chunks/index-iUd-bwwm.cjs +2 -0
  18. package/dist/cjs/chunks/index-iUd-bwwm.cjs.map +1 -0
  19. package/dist/cjs/chunks/logger-Cz9r6yt5.cjs +2 -0
  20. package/dist/cjs/chunks/logger-Cz9r6yt5.cjs.map +1 -0
  21. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs +2 -0
  22. package/dist/cjs/chunks/lru-cache-1OU7JhD8.cjs.map +1 -0
  23. package/dist/cjs/chunks/memory-http-transport-DGll7Af4.cjs +2 -0
  24. package/dist/cjs/chunks/memory-http-transport-DGll7Af4.cjs.map +1 -0
  25. package/dist/cjs/chunks/merge-base-DlGWnkxP.cjs +2 -0
  26. package/dist/cjs/chunks/merge-base-DlGWnkxP.cjs.map +1 -0
  27. package/dist/cjs/chunks/node-http-transport-CuOgJlws.cjs +2 -0
  28. package/dist/cjs/chunks/node-http-transport-CuOgJlws.cjs.map +1 -0
  29. package/dist/cjs/chunks/progress-CK7CT9vU.cjs +2 -0
  30. package/dist/cjs/chunks/progress-CK7CT9vU.cjs.map +1 -0
  31. package/dist/cjs/chunks/repository-Cbzk-Qwz.cjs +2 -0
  32. package/dist/cjs/chunks/repository-Cbzk-Qwz.cjs.map +1 -0
  33. package/dist/cjs/commands/index.cjs +2 -0
  34. package/dist/cjs/commands/index.cjs.map +1 -0
  35. package/dist/cjs/index.browser.cjs +2 -0
  36. package/dist/cjs/index.browser.cjs.map +1 -0
  37. package/dist/cjs/index.cjs +2 -0
  38. package/dist/cjs/index.cjs.map +1 -0
  39. package/dist/cjs/index.default.cjs +2 -0
  40. package/dist/cjs/index.default.cjs.map +1 -0
  41. package/dist/cjs/index.node.cjs +2 -0
  42. package/dist/cjs/index.node.cjs.map +1 -0
  43. package/dist/cjs/operators/index.cjs +2 -0
  44. package/dist/cjs/operators/index.cjs.map +1 -0
  45. package/dist/cjs/primitives/index.cjs +2 -0
  46. package/dist/cjs/primitives/index.cjs.map +1 -0
  47. package/dist/cjs/transport/index.cjs +2 -0
  48. package/dist/cjs/transport/index.cjs.map +1 -0
  49. package/dist/esm/adapters/browser/index.js +2 -0
  50. package/dist/esm/adapters/browser/index.js.map +1 -0
  51. package/dist/esm/adapters/memory/index.js +2 -0
  52. package/dist/esm/adapters/memory/index.js.map +1 -0
  53. package/dist/esm/adapters/node/index.js +2 -0
  54. package/dist/esm/adapters/node/index.js.map +1 -0
  55. package/dist/esm/chunks/browser-http-transport-CRPPmib5.js +2 -0
  56. package/dist/esm/chunks/browser-http-transport-CRPPmib5.js.map +1 -0
  57. package/dist/esm/chunks/context-CumKOV7K.js +2 -0
  58. package/dist/esm/chunks/context-CumKOV7K.js.map +1 -0
  59. package/dist/esm/chunks/error-CAlAXhN3.js +2 -0
  60. package/dist/esm/chunks/error-CAlAXhN3.js.map +1 -0
  61. package/dist/esm/chunks/error-DVZkS_ub.js +2 -0
  62. package/dist/esm/chunks/error-DVZkS_ub.js.map +1 -0
  63. package/dist/esm/chunks/index-gUdap5AF.js +2 -0
  64. package/dist/esm/chunks/index-gUdap5AF.js.map +1 -0
  65. package/dist/esm/chunks/logger-Cg7fUh8D.js +2 -0
  66. package/dist/esm/chunks/logger-Cg7fUh8D.js.map +1 -0
  67. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js +2 -0
  68. package/dist/esm/chunks/lru-cache-Cy7C7Lx2.js.map +1 -0
  69. package/dist/esm/chunks/memory-http-transport-Cv1sbkCX.js +2 -0
  70. package/dist/esm/chunks/memory-http-transport-Cv1sbkCX.js.map +1 -0
  71. package/dist/esm/chunks/merge-base-opORz-S1.js +2 -0
  72. package/dist/esm/chunks/merge-base-opORz-S1.js.map +1 -0
  73. package/dist/esm/chunks/node-http-transport-CuXVJf0s.js +2 -0
  74. package/dist/esm/chunks/node-http-transport-CuXVJf0s.js.map +1 -0
  75. package/dist/esm/chunks/progress-OxUHmDV4.js +2 -0
  76. package/dist/esm/chunks/progress-OxUHmDV4.js.map +1 -0
  77. package/dist/esm/chunks/repository-BaEhU6zt.js +2 -0
  78. package/dist/esm/chunks/repository-BaEhU6zt.js.map +1 -0
  79. package/dist/esm/commands/index.js +2 -0
  80. package/dist/esm/commands/index.js.map +1 -0
  81. package/dist/esm/index.browser.js +2 -0
  82. package/dist/esm/index.browser.js.map +1 -0
  83. package/dist/esm/index.default.js +2 -0
  84. package/dist/esm/index.default.js.map +1 -0
  85. package/dist/esm/index.js +2 -0
  86. package/dist/esm/index.js.map +1 -0
  87. package/dist/esm/index.node.js +2 -0
  88. package/dist/esm/index.node.js.map +1 -0
  89. package/dist/esm/operators/index.js +2 -0
  90. package/dist/esm/operators/index.js.map +1 -0
  91. package/dist/esm/primitives/index.js +2 -0
  92. package/dist/esm/primitives/index.js.map +1 -0
  93. package/dist/esm/transport/index.js +2 -0
  94. package/dist/esm/transport/index.js.map +1 -0
  95. package/dist/types/adapters/browser/index.d.cts +67 -0
  96. package/dist/types/adapters/browser/index.d.ts +67 -0
  97. package/dist/types/adapters/memory/index.d.cts +95 -0
  98. package/dist/types/adapters/memory/index.d.ts +95 -0
  99. package/dist/types/adapters/node/index.d.cts +75 -0
  100. package/dist/types/adapters/node/index.d.ts +75 -0
  101. package/dist/types/chunks/context-C6df52Qs.d.ts +354 -0
  102. package/dist/types/chunks/context-Ku1aP8Ie.d.cts +354 -0
  103. package/dist/types/chunks/diff-change-BwO75AgS.d.cts +59 -0
  104. package/dist/types/chunks/diff-change-CUWN3OSK.d.ts +59 -0
  105. package/dist/types/chunks/http-transport--_NdQOiw.d.cts +20 -0
  106. package/dist/types/chunks/http-transport--_NdQOiw.d.ts +20 -0
  107. package/dist/types/chunks/repository-BBKJnr8a.d.ts +89 -0
  108. package/dist/types/chunks/repository-Cv4Y0T9t.d.cts +89 -0
  109. package/dist/types/commands/index.d.cts +336 -0
  110. package/dist/types/commands/index.d.ts +336 -0
  111. package/dist/types/index.browser.d.cts +26 -0
  112. package/dist/types/index.browser.d.ts +26 -0
  113. package/dist/types/index.d.cts +68 -0
  114. package/dist/types/index.d.ts +68 -0
  115. package/dist/types/index.default.d.cts +35 -0
  116. package/dist/types/index.default.d.ts +35 -0
  117. package/dist/types/index.node.d.cts +23 -0
  118. package/dist/types/index.node.d.ts +23 -0
  119. package/dist/types/operators/index.d.cts +36 -0
  120. package/dist/types/operators/index.d.ts +36 -0
  121. package/dist/types/primitives/index.d.cts +217 -0
  122. package/dist/types/primitives/index.d.ts +217 -0
  123. package/dist/types/transport/index.d.cts +62 -0
  124. package/dist/types/transport/index.d.ts +62 -0
  125. package/package.json +524 -0
@@ -0,0 +1,336 @@
1
+ import { b as FilePath, a as Context, j as RefName, O as ObjectId } from '../chunks/context-C6df52Qs.js';
2
+ import { A as AuthorIdentity, T as TreeDiff } from '../chunks/diff-change-CUWN3OSK.js';
3
+ import '../chunks/http-transport--_NdQOiw.js';
4
+
5
+ interface AddOptions {
6
+ readonly force?: boolean;
7
+ readonly all?: boolean;
8
+ readonly breakStaleLockMs?: number;
9
+ }
10
+ interface AddResult {
11
+ readonly added: ReadonlyArray<FilePath>;
12
+ readonly modified: ReadonlyArray<FilePath>;
13
+ readonly removed: ReadonlyArray<FilePath>;
14
+ }
15
+ /**
16
+ * Add the given pathspecs to the index. Performs:
17
+ * 1. Repo + bare + pending-op preflight checks.
18
+ * 2. Path validation for every input (no I/O on rejection).
19
+ * 3. Read working-tree contents → write blob → produce IndexEntry.
20
+ * 4. Atomically replace `.git/index` under the index lock.
21
+ *
22
+ * Bulk mode (`all: true`) is not yet implemented — this is the literal-paths
23
+ * happy path used by `init`/`commit` integration tests.
24
+ */
25
+ declare const add: (ctx: Context, paths: ReadonlyArray<string>, opts?: AddOptions) => Promise<AddResult>;
26
+
27
+ type BranchAction = {
28
+ readonly kind: 'list';
29
+ } | {
30
+ readonly kind: 'create';
31
+ readonly name: string;
32
+ readonly startPoint?: string;
33
+ readonly force?: boolean;
34
+ } | {
35
+ readonly kind: 'delete';
36
+ readonly name: string;
37
+ readonly force?: boolean;
38
+ } | {
39
+ readonly kind: 'rename';
40
+ readonly from: string;
41
+ readonly to: string;
42
+ readonly force?: boolean;
43
+ };
44
+ interface BranchInfo {
45
+ readonly name: RefName;
46
+ readonly id: ObjectId;
47
+ readonly current: boolean;
48
+ }
49
+ type BranchResult = {
50
+ readonly kind: 'list';
51
+ readonly branches: ReadonlyArray<BranchInfo>;
52
+ } | {
53
+ readonly kind: 'create';
54
+ readonly name: RefName;
55
+ readonly id: ObjectId;
56
+ } | {
57
+ readonly kind: 'delete';
58
+ readonly name: RefName;
59
+ } | {
60
+ readonly kind: 'rename';
61
+ readonly from: RefName;
62
+ readonly to: RefName;
63
+ };
64
+ declare const branch: (ctx: Context, action: BranchAction) => Promise<BranchResult>;
65
+
66
+ interface CheckoutOptions {
67
+ readonly target: string;
68
+ readonly detach?: boolean;
69
+ readonly force?: boolean;
70
+ }
71
+ interface CheckoutResult {
72
+ readonly branch: RefName | undefined;
73
+ readonly id: ObjectId;
74
+ readonly detached: boolean;
75
+ }
76
+ declare const checkout: (ctx: Context, opts: CheckoutOptions) => Promise<CheckoutResult>;
77
+
78
+ /** Pluggable DNS resolver. Returns the addresses for `host`, in order. */
79
+ type DnsResolver = (host: string) => Promise<ReadonlyArray<string>>;
80
+
81
+ interface CloneOptions {
82
+ readonly url: string;
83
+ readonly bare?: boolean;
84
+ readonly initialBranch?: string;
85
+ readonly depth?: number;
86
+ /** DNS resolver injected by the caller; required to enforce SSRF guards. */
87
+ readonly resolver?: DnsResolver;
88
+ readonly allowInsecure?: boolean;
89
+ readonly allowPrivateNetworks?: boolean;
90
+ }
91
+ interface CloneResult {
92
+ readonly path: FilePath;
93
+ readonly head: RefName | undefined;
94
+ readonly fetchedRefs: ReadonlyArray<{
95
+ readonly name: RefName;
96
+ readonly id: ObjectId;
97
+ }>;
98
+ }
99
+ declare const clone: (ctx: Context, opts: CloneOptions) => Promise<CloneResult>;
100
+
101
+ interface CommitOptions {
102
+ readonly message: string;
103
+ readonly author?: AuthorIdentity;
104
+ readonly committer?: AuthorIdentity;
105
+ readonly allowEmpty?: boolean;
106
+ readonly allowEmptyMessage?: boolean;
107
+ }
108
+ interface CommitResult {
109
+ readonly id: ObjectId;
110
+ readonly tree: ObjectId;
111
+ readonly branch: RefName | undefined;
112
+ readonly parents: ReadonlyArray<ObjectId>;
113
+ }
114
+ /**
115
+ * Create a new commit from the current index. Resolves author/committer from
116
+ * options or `.git/config` `[user]`, writes a tree from the index, builds the
117
+ * commit object, and updates HEAD's target ref (or detached HEAD itself).
118
+ *
119
+ * Throws `NOTHING_TO_COMMIT` when the new tree matches the parent's tree and
120
+ * `allowEmpty` is not set; `EMPTY_COMMIT_MESSAGE` when the message is blank
121
+ * and `allowEmptyMessage` is not set.
122
+ */
123
+ declare const commit: (ctx: Context, opts: CommitOptions) => Promise<CommitResult>;
124
+
125
+ interface DiffOptions {
126
+ /** Resolve to a tree. Accepts ref name, oid, or 'HEAD'. */
127
+ readonly from?: string;
128
+ readonly to?: string;
129
+ readonly detectRenames?: boolean;
130
+ }
131
+ /**
132
+ * Diff two tree-like targets and return the resulting `TreeDiff`. When `from`
133
+ * is omitted, defaults to HEAD's tree; when `to` is omitted, defaults to
134
+ * `undefined` (interpreted by `diffTrees` as the empty tree).
135
+ */
136
+ declare const diff: (ctx: Context, opts?: DiffOptions) => Promise<TreeDiff>;
137
+
138
+ interface FetchOptions {
139
+ readonly remote?: string;
140
+ readonly refspecs?: ReadonlyArray<string>;
141
+ readonly prune?: boolean;
142
+ }
143
+ interface FetchResult {
144
+ readonly remote: string;
145
+ readonly url: string;
146
+ readonly updatedRefs: ReadonlyArray<{
147
+ readonly name: RefName;
148
+ readonly oldId: ObjectId | undefined;
149
+ readonly newId: ObjectId;
150
+ }>;
151
+ }
152
+ declare const fetch: (ctx: Context, opts?: FetchOptions) => Promise<FetchResult>;
153
+
154
+ interface InitOptions {
155
+ readonly initialBranch?: string;
156
+ readonly bare?: boolean;
157
+ }
158
+ interface InitResult {
159
+ readonly path: FilePath;
160
+ readonly initialBranch: RefName;
161
+ readonly bare: boolean;
162
+ }
163
+ /**
164
+ * Initialize a fresh repository at `ctx.layout.gitDir`. Throws
165
+ * `ALREADY_INITIALIZED` when the target gitDir already exists; otherwise
166
+ * delegates to `bootstrapRepository` for the standard layout.
167
+ *
168
+ * For non-bare repos, the gitDir is `<workDir>/.git`. For bare, gitDir IS the
169
+ * working dir — callers must construct a Context with `bare: true` for that
170
+ * shape (Phase 10 facade will derive this automatically).
171
+ */
172
+ declare const init: (ctx: Context, opts?: InitOptions) => Promise<InitResult>;
173
+
174
+ interface LogOptions {
175
+ readonly from?: string;
176
+ readonly limit?: number;
177
+ readonly excluding?: ReadonlyArray<string>;
178
+ readonly before?: Date;
179
+ }
180
+ interface LogEntry {
181
+ readonly id: ObjectId;
182
+ readonly tree: ObjectId;
183
+ readonly parents: ReadonlyArray<ObjectId>;
184
+ readonly author: AuthorIdentity;
185
+ readonly committer: AuthorIdentity;
186
+ readonly message: string;
187
+ }
188
+ /**
189
+ * Walk first-parent commits starting from `from` (default: HEAD), yielding
190
+ * ordered `LogEntry` records. Honors `limit`, `excluding` (oid stops), and
191
+ * `before` (only commits with `committer.timestamp < before`).
192
+ */
193
+ declare const log: (ctx: Context, opts?: LogOptions) => Promise<ReadonlyArray<LogEntry>>;
194
+
195
+ interface MergeOptions {
196
+ readonly target: string;
197
+ readonly message?: string;
198
+ readonly fastForwardOnly?: boolean;
199
+ readonly noFastForward?: boolean;
200
+ readonly author?: AuthorIdentity;
201
+ readonly committer?: AuthorIdentity;
202
+ }
203
+ type MergeResult = {
204
+ readonly kind: 'up-to-date';
205
+ readonly id: ObjectId;
206
+ } | {
207
+ readonly kind: 'fast-forward';
208
+ readonly id: ObjectId;
209
+ readonly branch: RefName;
210
+ } | {
211
+ readonly kind: 'merge';
212
+ readonly id: ObjectId;
213
+ readonly branch: RefName;
214
+ readonly parents: ReadonlyArray<ObjectId>;
215
+ };
216
+ /**
217
+ * Merge `target` into the current HEAD branch. v1 supports:
218
+ * - Up-to-date detection (target is ancestor of HEAD).
219
+ * - Fast-forward (HEAD is ancestor of target → branch advances).
220
+ * - True merge for diverged histories: writes a merge commit using HEAD's tree
221
+ * (callers must run `add` to incorporate target's content). Conflict
222
+ * resolution and three-way tree merge land in Phase 11.
223
+ */
224
+ declare const merge: (ctx: Context, opts: MergeOptions) => Promise<MergeResult>;
225
+
226
+ interface PushOptions {
227
+ readonly remote?: string;
228
+ readonly refspecs?: ReadonlyArray<string>;
229
+ readonly force?: boolean;
230
+ readonly forceWithLease?: ObjectId | 'auto';
231
+ }
232
+ interface PushResult {
233
+ readonly remote: string;
234
+ readonly url: string;
235
+ readonly pushedRefs: ReadonlyArray<{
236
+ readonly name: RefName;
237
+ readonly newId: ObjectId;
238
+ readonly status: 'ok' | 'rejected';
239
+ }>;
240
+ }
241
+ declare const push: (ctx: Context, opts?: PushOptions) => Promise<PushResult>;
242
+
243
+ type ResetMode = 'soft' | 'mixed' | 'hard';
244
+ interface ResetOptions {
245
+ readonly mode: ResetMode;
246
+ readonly target: string;
247
+ }
248
+ interface ResetResult {
249
+ readonly mode: ResetMode;
250
+ readonly id: ObjectId;
251
+ readonly branch: RefName | undefined;
252
+ }
253
+ /**
254
+ * Reset HEAD (and optionally index/working tree) to `target`.
255
+ *
256
+ * - `soft`: HEAD only.
257
+ * - `mixed`: HEAD + clears the index (Phase 9 stub: index cleared via lock release).
258
+ * - `hard`: HEAD + index + working tree (working-tree mutation deferred to Phase 11).
259
+ *
260
+ * v1 implements the HEAD-update path; index/working-tree side effects beyond
261
+ * the HEAD move land in subsequent passes once `materializeFile`/`removeFile`
262
+ * orchestration is in place.
263
+ */
264
+ declare const reset: (ctx: Context, opts: ResetOptions) => Promise<ResetResult>;
265
+
266
+ declare const revParse: (ctx: Context, expression: string) => Promise<ObjectId>;
267
+
268
+ interface RmOptions {
269
+ readonly cached?: boolean;
270
+ readonly breakStaleLockMs?: number;
271
+ }
272
+ interface RmResult {
273
+ readonly removed: ReadonlyArray<FilePath>;
274
+ }
275
+ /**
276
+ * Remove the given paths from the index (and from the working tree unless
277
+ * `cached: true`). Refuses when a path isn't tracked, matches `git rm`'s default.
278
+ */
279
+ declare const rm: (ctx: Context, paths: ReadonlyArray<string>, opts?: RmOptions) => Promise<RmResult>;
280
+
281
+ type ChangeKind = 'modified' | 'added' | 'deleted' | 'untracked';
282
+ interface ChangeEntry {
283
+ readonly kind: ChangeKind;
284
+ readonly path: FilePath;
285
+ }
286
+ interface StatusResult {
287
+ readonly branch: RefName | undefined;
288
+ readonly detached: boolean;
289
+ readonly indexChanges: ReadonlyArray<ChangeEntry>;
290
+ readonly workingTreeChanges: ReadonlyArray<ChangeEntry>;
291
+ readonly clean: boolean;
292
+ }
293
+ /**
294
+ * Summarize the state of the working tree relative to the index, and the
295
+ * branch HEAD points at. Working-tree-vs-HEAD diff (Git's "staged" column)
296
+ * is approximated via index-vs-working-tree comparisons until Phase 11
297
+ * adds the stat-cache fast path.
298
+ *
299
+ * Progress reporting (Phase 10 §6.2): emits `status:scan` start before the
300
+ * fan-out, updates at every 100 lstat completions, and end in a finally
301
+ * block so the consumer always pairs start with end. `total` is undefined
302
+ * — design choice that prevents revealing repository size to non-trusted
303
+ * progress sinks.
304
+ */
305
+ declare const status: (ctx: Context) => Promise<StatusResult>;
306
+
307
+ type TagAction = {
308
+ readonly kind: 'list';
309
+ } | {
310
+ readonly kind: 'create';
311
+ readonly name: string;
312
+ readonly target?: string;
313
+ readonly force?: boolean;
314
+ } | {
315
+ readonly kind: 'delete';
316
+ readonly name: string;
317
+ };
318
+ interface TagInfo {
319
+ readonly name: RefName;
320
+ readonly id: ObjectId;
321
+ }
322
+ type TagResult = {
323
+ readonly kind: 'list';
324
+ readonly tags: ReadonlyArray<TagInfo>;
325
+ } | {
326
+ readonly kind: 'create';
327
+ readonly name: RefName;
328
+ readonly id: ObjectId;
329
+ } | {
330
+ readonly kind: 'delete';
331
+ readonly name: RefName;
332
+ };
333
+ declare const tag: (ctx: Context, action: TagAction) => Promise<TagResult>;
334
+
335
+ export { add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag };
336
+ export type { AddOptions, AddResult, BranchAction, BranchInfo, BranchResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CloneOptions, CloneResult, CommitOptions, CommitResult, DiffOptions, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, PushOptions, PushResult, ResetMode, ResetOptions, ResetResult, RmOptions, RmResult, StatusResult, TagAction, TagInfo, TagResult };
@@ -0,0 +1,26 @@
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-Cv4Y0T9t.cjs';
2
+ export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-Ku1aP8Ie.cjs';
4
+ import './commands/index.cjs';
5
+ import './chunks/diff-change-BwO75AgS.cjs';
6
+ import './primitives/index.cjs';
7
+ import './chunks/http-transport--_NdQOiw.cjs';
8
+
9
+ /**
10
+ * Browser-runtime extension to `OpenRepositoryOptions`. The browser cannot
11
+ * derive a default `rootHandle` (no equivalent of `process.cwd()`), so the
12
+ * caller must provide it. `gitDirName` controls the in-OPFS directory name
13
+ * used for `.git` (escapes the dot when running under hosts that disallow
14
+ * dot-prefixed names).
15
+ */
16
+ interface OpenBrowserRepositoryOptions extends OpenRepositoryOptions {
17
+ readonly rootHandle: FileSystemDirectoryHandle;
18
+ readonly gitDirName?: string;
19
+ readonly bare?: boolean;
20
+ readonly deltaCacheMaxBytes?: number;
21
+ readonly deltaCacheMaxEntries?: number;
22
+ }
23
+ declare const openRepository: (opts: OpenBrowserRepositoryOptions) => Promise<Repository>;
24
+
25
+ export { OpenRepositoryOptions, Repository, openRepository };
26
+ export type { OpenBrowserRepositoryOptions };
@@ -0,0 +1,26 @@
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BBKJnr8a.js';
2
+ export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
+ export { P as ProgressReporter } from './chunks/context-C6df52Qs.js';
4
+ import './commands/index.js';
5
+ import './chunks/diff-change-CUWN3OSK.js';
6
+ import './primitives/index.js';
7
+ import './chunks/http-transport--_NdQOiw.js';
8
+
9
+ /**
10
+ * Browser-runtime extension to `OpenRepositoryOptions`. The browser cannot
11
+ * derive a default `rootHandle` (no equivalent of `process.cwd()`), so the
12
+ * caller must provide it. `gitDirName` controls the in-OPFS directory name
13
+ * used for `.git` (escapes the dot when running under hosts that disallow
14
+ * dot-prefixed names).
15
+ */
16
+ interface OpenBrowserRepositoryOptions extends OpenRepositoryOptions {
17
+ readonly rootHandle: FileSystemDirectoryHandle;
18
+ readonly gitDirName?: string;
19
+ readonly bare?: boolean;
20
+ readonly deltaCacheMaxBytes?: number;
21
+ readonly deltaCacheMaxEntries?: number;
22
+ }
23
+ declare const openRepository: (opts: OpenBrowserRepositoryOptions) => Promise<Repository>;
24
+
25
+ export { OpenRepositoryOptions, Repository, openRepository };
26
+ export type { OpenBrowserRepositoryOptions };
@@ -0,0 +1,68 @@
1
+ import { F as FileSystem, H as HashService, C as Compressor, P as ProgressReporter } from './chunks/context-Ku1aP8Ie.cjs';
2
+ export { A as AuthStrategy, f as AuthorIdentity, a as Context, g as CreateContextParts, D as DirEntry, c as FileStat, e as Hasher, L as Logger, R as RepositoryConfig, h as RepositoryLayout, i as createContext, n as noopLogger, w as wrapLoggerSanitizer } from './chunks/context-Ku1aP8Ie.cjs';
3
+ import { H as HttpTransport } from './chunks/http-transport--_NdQOiw.cjs';
4
+ export { a as HttpRequest, b as HttpResponse } from './chunks/http-transport--_NdQOiw.cjs';
5
+ export { AddOptions, AddResult, BranchAction, BranchInfo, BranchResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CloneOptions, CloneResult, CommitOptions, CommitResult, DiffOptions, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, PushOptions, PushResult, ResetMode, ResetOptions, ResetResult, RmOptions, RmResult, StatusResult, TagAction, TagInfo, TagResult, add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from './commands/index.cjs';
6
+ import './chunks/diff-change-BwO75AgS.cjs';
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;
19
+ }
20
+ /**
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.
25
+ *
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).
29
+ */
30
+ declare const isNode: () => boolean;
31
+ /**
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).
37
+ */
38
+ declare const isBrowser: () => boolean;
39
+ /**
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).
43
+ */
44
+ declare const detectRuntime: () => "node" | "browser" | "memory";
45
+
46
+ /** No-op reporter — default when the caller does not provide one. */
47
+ declare const noopProgress: ProgressReporter;
48
+ /**
49
+ * Built-in reporter that emits one line per call to a user-supplied `sink`.
50
+ *
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"
58
+ *
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).
61
+ *
62
+ * A throwing `sink` cannot crash the reporter — every call is wrapped in
63
+ * try/catch.
64
+ */
65
+ declare const consoleProgress: (sink: (line: string) => void) => ProgressReporter;
66
+
67
+ export { Compressor, FileSystem, HashService, HttpTransport, ProgressReporter, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress };
68
+ export type { AdapterSet };
@@ -0,0 +1,68 @@
1
+ import { F as FileSystem, H as HashService, C as Compressor, P as ProgressReporter } from './chunks/context-C6df52Qs.js';
2
+ export { A as AuthStrategy, f as AuthorIdentity, a as Context, g as CreateContextParts, D as DirEntry, c as FileStat, e as Hasher, L as Logger, R as RepositoryConfig, h as RepositoryLayout, i as createContext, n as noopLogger, w as wrapLoggerSanitizer } from './chunks/context-C6df52Qs.js';
3
+ import { H as HttpTransport } from './chunks/http-transport--_NdQOiw.js';
4
+ export { a as HttpRequest, b as HttpResponse } from './chunks/http-transport--_NdQOiw.js';
5
+ export { AddOptions, AddResult, BranchAction, BranchInfo, BranchResult, ChangeEntry, ChangeKind, CheckoutOptions, CheckoutResult, CloneOptions, CloneResult, CommitOptions, CommitResult, DiffOptions, FetchOptions, FetchResult, InitOptions, InitResult, LogEntry, LogOptions, MergeOptions, MergeResult, PushOptions, PushResult, ResetMode, ResetOptions, ResetResult, RmOptions, RmResult, StatusResult, TagAction, TagInfo, TagResult, add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from './commands/index.js';
6
+ import './chunks/diff-change-CUWN3OSK.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;
19
+ }
20
+ /**
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.
25
+ *
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).
29
+ */
30
+ declare const isNode: () => boolean;
31
+ /**
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).
37
+ */
38
+ declare const isBrowser: () => boolean;
39
+ /**
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).
43
+ */
44
+ declare const detectRuntime: () => "node" | "browser" | "memory";
45
+
46
+ /** No-op reporter — default when the caller does not provide one. */
47
+ declare const noopProgress: ProgressReporter;
48
+ /**
49
+ * Built-in reporter that emits one line per call to a user-supplied `sink`.
50
+ *
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"
58
+ *
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).
61
+ *
62
+ * A throwing `sink` cannot crash the reporter — every call is wrapped in
63
+ * try/catch.
64
+ */
65
+ declare const consoleProgress: (sink: (line: string) => void) => ProgressReporter;
66
+
67
+ export { Compressor, FileSystem, HashService, HttpTransport, ProgressReporter, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress };
68
+ export type { AdapterSet };
@@ -0,0 +1,35 @@
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-Cv4Y0T9t.cjs';
2
+ export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-Ku1aP8Ie.cjs';
4
+ import './commands/index.cjs';
5
+ import './chunks/diff-change-BwO75AgS.cjs';
6
+ import './primitives/index.cjs';
7
+ import './chunks/http-transport--_NdQOiw.cjs';
8
+
9
+ /**
10
+ * Memory-runtime entry point. Selected by `package.json` `"exports"` for
11
+ * non-Node, non-browser runtimes — and explicitly available at
12
+ * `tsgit/auto/memory` for tests and deterministic fixtures regardless of
13
+ * the active runtime.
14
+ *
15
+ * Builds the runtime fallback (memory adapters + a `/repo`-rooted layout)
16
+ * and forwards every `openRepository(opts)` call to the core factory with
17
+ * the fallback pre-bound.
18
+ */
19
+
20
+ /**
21
+ * Memory-runtime extension to `OpenRepositoryOptions`. Adds the deterministic-
22
+ * algorithm switch (sha1 vs sha256) and the optional initial in-memory FS
23
+ * seed used by tests and lab harnesses. Anything not listed here is
24
+ * forwarded verbatim to the core `openRepository`.
25
+ */
26
+ interface OpenMemoryRepositoryOptions extends OpenRepositoryOptions {
27
+ /** Initial in-memory FS seed. Maps absolute paths to file bytes. */
28
+ readonly files?: Readonly<Record<string, Uint8Array>>;
29
+ /** Hash algorithm used by the runtime adapter. Default 'sha1'. */
30
+ readonly algorithm?: 'sha1' | 'sha256';
31
+ }
32
+ declare const openRepository: (opts?: OpenMemoryRepositoryOptions) => Promise<Repository>;
33
+
34
+ export { OpenRepositoryOptions, Repository, openRepository };
35
+ export type { OpenMemoryRepositoryOptions };
@@ -0,0 +1,35 @@
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BBKJnr8a.js';
2
+ export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
+ export { P as ProgressReporter } from './chunks/context-C6df52Qs.js';
4
+ import './commands/index.js';
5
+ import './chunks/diff-change-CUWN3OSK.js';
6
+ import './primitives/index.js';
7
+ import './chunks/http-transport--_NdQOiw.js';
8
+
9
+ /**
10
+ * Memory-runtime entry point. Selected by `package.json` `"exports"` for
11
+ * non-Node, non-browser runtimes — and explicitly available at
12
+ * `tsgit/auto/memory` for tests and deterministic fixtures regardless of
13
+ * the active runtime.
14
+ *
15
+ * Builds the runtime fallback (memory adapters + a `/repo`-rooted layout)
16
+ * and forwards every `openRepository(opts)` call to the core factory with
17
+ * the fallback pre-bound.
18
+ */
19
+
20
+ /**
21
+ * Memory-runtime extension to `OpenRepositoryOptions`. Adds the deterministic-
22
+ * algorithm switch (sha1 vs sha256) and the optional initial in-memory FS
23
+ * seed used by tests and lab harnesses. Anything not listed here is
24
+ * forwarded verbatim to the core `openRepository`.
25
+ */
26
+ interface OpenMemoryRepositoryOptions extends OpenRepositoryOptions {
27
+ /** Initial in-memory FS seed. Maps absolute paths to file bytes. */
28
+ readonly files?: Readonly<Record<string, Uint8Array>>;
29
+ /** Hash algorithm used by the runtime adapter. Default 'sha1'. */
30
+ readonly algorithm?: 'sha1' | 'sha256';
31
+ }
32
+ declare const openRepository: (opts?: OpenMemoryRepositoryOptions) => Promise<Repository>;
33
+
34
+ export { OpenRepositoryOptions, Repository, openRepository };
35
+ export type { OpenMemoryRepositoryOptions };
@@ -0,0 +1,23 @@
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-Cv4Y0T9t.cjs';
2
+ export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.cjs';
3
+ export { P as ProgressReporter } from './chunks/context-Ku1aP8Ie.cjs';
4
+ import './commands/index.cjs';
5
+ import './chunks/diff-change-BwO75AgS.cjs';
6
+ import './primitives/index.cjs';
7
+ import './chunks/http-transport--_NdQOiw.cjs';
8
+
9
+ /**
10
+ * Node-runtime extension to `OpenRepositoryOptions`. Adds `allowInsecureHttp`
11
+ * (forwarded to the Node HTTP transport — separate from the facade-tier
12
+ * `config.allowInsecure` which controls the SSRF guard). Adds delta-cache
13
+ * tuning for callers with non-standard memory budgets.
14
+ */
15
+ interface OpenNodeRepositoryOptions extends OpenRepositoryOptions {
16
+ readonly allowInsecureHttp?: boolean;
17
+ readonly deltaCacheMaxBytes?: number;
18
+ readonly deltaCacheMaxEntries?: number;
19
+ }
20
+ declare const openRepository: (opts?: OpenNodeRepositoryOptions) => Promise<Repository>;
21
+
22
+ export { OpenRepositoryOptions, Repository, openRepository };
23
+ export type { OpenNodeRepositoryOptions };
@@ -0,0 +1,23 @@
1
+ import { O as OpenRepositoryOptions, R as Repository } from './chunks/repository-BBKJnr8a.js';
2
+ export { AdapterSet, consoleProgress, detectRuntime, isBrowser, isNode, noopProgress } from './index.js';
3
+ export { P as ProgressReporter } from './chunks/context-C6df52Qs.js';
4
+ import './commands/index.js';
5
+ import './chunks/diff-change-CUWN3OSK.js';
6
+ import './primitives/index.js';
7
+ import './chunks/http-transport--_NdQOiw.js';
8
+
9
+ /**
10
+ * Node-runtime extension to `OpenRepositoryOptions`. Adds `allowInsecureHttp`
11
+ * (forwarded to the Node HTTP transport — separate from the facade-tier
12
+ * `config.allowInsecure` which controls the SSRF guard). Adds delta-cache
13
+ * tuning for callers with non-standard memory budgets.
14
+ */
15
+ interface OpenNodeRepositoryOptions extends OpenRepositoryOptions {
16
+ readonly allowInsecureHttp?: boolean;
17
+ readonly deltaCacheMaxBytes?: number;
18
+ readonly deltaCacheMaxEntries?: number;
19
+ }
20
+ declare const openRepository: (opts?: OpenNodeRepositoryOptions) => Promise<Repository>;
21
+
22
+ export { OpenRepositoryOptions, Repository, openRepository };
23
+ export type { OpenNodeRepositoryOptions };