@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,6 +1,26 @@
1
- import { d as FilePath, b as Context, R as RefName, O as ObjectId, m as PromisorRemote } from '../chunks/context-BORy7yXb.js';
2
- import { C as CatFileBatchEntry, A as AuthorIdentity, s as TreeDiff, q as ReflogEntry, S as SubmoduleEntry } from '../chunks/reflog-entry-C2Hsdobk.js';
3
- import '../chunks/http-transport-DirKfK2S.js';
1
+ import { O as ObjectId, j as RefName, b as Context, c as FilePath, n as PromisorRemote } from '../chunks/context-CCL0_F8R.js';
2
+ import { C as CatFileBatchEntry, A as AuthorIdentity, c as ConfigKey, b as ConfigScope, T as TreeDiff, R as ReflogEntry, S as SubmoduleEntry } from '../chunks/reflog-entry-CSzjnZd4.js';
3
+ import '../chunks/http-transport--_NdQOiw.js';
4
+
5
+ interface AbortMergeResult {
6
+ /** The commit `ORIG_HEAD` recorded; HEAD now points at this id. */
7
+ readonly origHead: ObjectId;
8
+ /** The branch HEAD is on (always defined — detached merges are rejected upstream). */
9
+ readonly branch: RefName;
10
+ }
11
+ /**
12
+ * Abort a conflicting merge. Restores the working tree, index, and branch
13
+ * ref to `ORIG_HEAD`, then clears `MERGE_HEAD` and `MERGE_MSG`. `ORIG_HEAD`
14
+ * is preserved on disk as a cross-operation recovery aid (ADR-173).
15
+ *
16
+ * Refuses when no merge is in progress (`MERGE_HEAD` absent) or when the
17
+ * merge state is incomplete (`ORIG_HEAD` absent — corrupt half-state).
18
+ *
19
+ * The hard-reset machinery is inlined rather than delegated to `reset` so
20
+ * the call can bypass `assertNoPendingOperation` (which would itself
21
+ * fire on the very `MERGE_HEAD` we're about to clear). See ADR-170.
22
+ */
23
+ declare const abortMerge: (ctx: Context) => Promise<AbortMergeResult>;
4
24
 
5
25
  interface AddOptions {
6
26
  readonly force?: boolean;
@@ -27,47 +47,51 @@ interface AddResult {
27
47
  */
28
48
  declare const add: (ctx: Context, paths: ReadonlyArray<string>, opts?: AddOptions) => Promise<AddResult>;
29
49
 
30
- type BranchAction = {
31
- readonly kind: 'list';
32
- } | {
33
- readonly kind: 'create';
34
- readonly name: string;
35
- readonly startPoint?: string;
36
- readonly force?: boolean;
37
- } | {
38
- readonly kind: 'delete';
39
- readonly name: string;
40
- readonly force?: boolean;
41
- } | {
42
- readonly kind: 'rename';
43
- readonly from: string;
44
- readonly to: string;
45
- readonly force?: boolean;
46
- };
47
50
  interface BranchInfo {
48
51
  readonly name: RefName;
49
52
  readonly id: ObjectId;
50
53
  readonly current: boolean;
51
54
  }
52
- type BranchResult = {
53
- readonly kind: 'list';
55
+ interface BranchListResult {
54
56
  readonly branches: ReadonlyArray<BranchInfo>;
55
- } | {
56
- readonly kind: 'create';
57
+ }
58
+ interface BranchCreateInput {
59
+ readonly name: string;
60
+ readonly startPoint?: string;
61
+ readonly force?: boolean;
62
+ }
63
+ interface BranchCreateResult {
57
64
  readonly name: RefName;
58
65
  readonly id: ObjectId;
59
- } | {
60
- readonly kind: 'delete';
66
+ }
67
+ interface BranchDeleteInput {
68
+ readonly name: string;
69
+ readonly force?: boolean;
70
+ }
71
+ interface BranchDeleteResult {
61
72
  readonly name: RefName;
62
- } | {
63
- readonly kind: 'rename';
73
+ }
74
+ interface BranchRenameInput {
75
+ readonly from: string;
76
+ readonly to: string;
77
+ readonly force?: boolean;
78
+ }
79
+ interface BranchRenameResult {
64
80
  readonly from: RefName;
65
81
  readonly to: RefName;
66
- };
67
- declare const branch: (ctx: Context, action: BranchAction) => Promise<BranchResult>;
82
+ }
83
+ declare const branchList: (ctx: Context) => Promise<BranchListResult>;
84
+ declare const branchCreate: (ctx: Context, input: BranchCreateInput) => Promise<BranchCreateResult>;
85
+ declare const branchDelete: (ctx: Context, input: BranchDeleteInput) => Promise<BranchDeleteResult>;
86
+ declare const branchRename: (ctx: Context, input: BranchRenameInput) => Promise<BranchRenameResult>;
68
87
 
69
88
  type ConflictType = 'content' | 'add-add' | 'modify-delete' | 'type-change' | 'rename-rename' | 'gitlink' | 'binary';
70
89
 
90
+ interface PatchPathPrefix {
91
+ readonly old: string;
92
+ readonly new: string;
93
+ }
94
+
71
95
  /**
72
96
  * Tier-1 `catFile` command — wraps the streaming `catFileBatch` primitive in
73
97
  * a request/response shape matching the other v2 commands (`submodules`,
@@ -108,6 +132,69 @@ interface CheckoutResult {
108
132
  }
109
133
  declare const checkout: (ctx: Context, opts: CheckoutOptions) => Promise<CheckoutResult>;
110
134
 
135
+ interface CherryPickRunInput {
136
+ /** Revisions to pick, in argument order — a commit-ish or an `A..B` range each. */
137
+ readonly commits: ReadonlyArray<string>;
138
+ /** -x: append `(cherry picked from commit <oid>)` to each commit message. */
139
+ readonly recordOrigin?: boolean;
140
+ /** --allow-empty: a redundant pick creates an empty commit instead of stopping. */
141
+ readonly allowEmpty?: boolean;
142
+ /** -n / --no-commit: apply each pick to the index + working tree only; never
143
+ * commit, never persist CHERRY_PICK_HEAD / sequencer state. */
144
+ readonly noCommit?: boolean;
145
+ }
146
+ interface CherryPickedCommit {
147
+ readonly source: ObjectId;
148
+ readonly created: ObjectId;
149
+ }
150
+ interface CherryPickConflict {
151
+ readonly path: FilePath;
152
+ readonly type: ConflictType;
153
+ }
154
+ type CherryPickResult = {
155
+ readonly kind: 'picked';
156
+ readonly commits: ReadonlyArray<CherryPickedCommit>;
157
+ } | {
158
+ readonly kind: 'no-commit';
159
+ readonly sources: ReadonlyArray<ObjectId>;
160
+ } | {
161
+ readonly kind: 'conflict';
162
+ readonly commit: ObjectId;
163
+ readonly conflicts: ReadonlyArray<CherryPickConflict>;
164
+ readonly remaining: number;
165
+ } | {
166
+ readonly kind: 'empty';
167
+ readonly commit: ObjectId;
168
+ readonly remaining: number;
169
+ };
170
+ declare const cherryPickRun: (ctx: Context, input: CherryPickRunInput) => Promise<CherryPickResult>;
171
+ interface CherryPickContinueInput {
172
+ /** --allow-empty: finalise a resolution that yields no change as an empty commit. */
173
+ readonly allowEmpty?: boolean;
174
+ }
175
+ /**
176
+ * Finalise the in-progress conflicted pick as a single-parent commit from the
177
+ * resolved index, then resume any remaining sequencer picks. Refuses when nothing
178
+ * is in progress or the index is unmerged. A no-change resolution re-stops empty.
179
+ */
180
+ declare const cherryPickContinue: (ctx: Context, input?: CherryPickContinueInput) => Promise<CherryPickResult>;
181
+ interface CherryPickAbortResult {
182
+ readonly head: ObjectId;
183
+ readonly branch: RefName;
184
+ }
185
+ /**
186
+ * Drop the in-progress pick: hard-reset to HEAD (discarding its half-applied
187
+ * state), then resume the remaining sequencer picks (if any).
188
+ */
189
+ declare const cherryPickSkip: (ctx: Context, input?: CherryPickContinueInput) => Promise<CherryPickResult>;
190
+ /**
191
+ * Abort the cherry-pick: hard-reset the working tree, index, and branch to the
192
+ * pre-sequence HEAD (sequencer `head`, or the current HEAD for a lone pick), and
193
+ * clear all state. The branch update records git's faithful
194
+ * `reset: moving to <oid>` reflog. Refuses when nothing is in progress.
195
+ */
196
+ declare const cherryPickAbort: (ctx: Context) => Promise<CherryPickAbortResult>;
197
+
111
198
  /** Pluggable DNS resolver. Returns the addresses for `host`, in order. */
112
199
  type DnsResolver = (host: string) => Promise<ReadonlyArray<string>>;
113
200
 
@@ -167,18 +254,174 @@ interface CommitResult {
167
254
  */
168
255
  declare const commit: (ctx: Context, opts: CommitOptions) => Promise<CommitResult>;
169
256
 
257
+ /**
258
+ * `repo.config.*` porcelain — nested-namespace shape per ADR-181. The methods
259
+ * exported here are the Context-aware functions the namespace dispatcher in
260
+ * `repository.ts` binds; `repo.config.get(input)` is roughly
261
+ * `configGet(repo.ctx, input)`.
262
+ *
263
+ * Each command:
264
+ * 1. asserts the context targets a repository,
265
+ * 2. parses + validates inputs at the command boundary,
266
+ * 3. composes the slice-7 readers / slice-8/9 writers,
267
+ * 4. returns a typed result envelope (per-action shape, no discriminator).
268
+ */
269
+
270
+ interface ConfigGetInput {
271
+ readonly key: string;
272
+ readonly scope?: ConfigScope;
273
+ }
274
+ type ConfigGetResult = {
275
+ readonly key: ConfigKey;
276
+ readonly value: string;
277
+ readonly scope: ConfigScope;
278
+ } | {
279
+ readonly key: ConfigKey;
280
+ readonly value: undefined;
281
+ };
282
+ declare const configGet: (ctx: Context, input: ConfigGetInput) => Promise<ConfigGetResult>;
283
+ interface ConfigGetAllInput {
284
+ readonly key: string;
285
+ readonly scope?: ConfigScope;
286
+ }
287
+ interface ConfigGetAllResult {
288
+ readonly key: ConfigKey;
289
+ readonly values: ReadonlyArray<{
290
+ readonly value: string;
291
+ readonly scope: ConfigScope;
292
+ }>;
293
+ }
294
+ declare const configGetAll: (ctx: Context, input: ConfigGetAllInput) => Promise<ConfigGetAllResult>;
295
+ interface ConfigGetRegexpInput {
296
+ readonly keyPattern: RegExp;
297
+ readonly valuePattern?: RegExp;
298
+ readonly scope?: ConfigScope;
299
+ }
300
+ interface ConfigEntryView {
301
+ readonly key: ConfigKey;
302
+ readonly value: string;
303
+ readonly scope: ConfigScope;
304
+ }
305
+ interface ConfigGetRegexpResult {
306
+ readonly entries: ReadonlyArray<ConfigEntryView>;
307
+ }
308
+ declare const configGetRegexp: (ctx: Context, input: ConfigGetRegexpInput) => Promise<ConfigGetRegexpResult>;
309
+ interface ConfigListInput {
310
+ readonly scope?: ConfigScope;
311
+ }
312
+ interface ConfigListResult {
313
+ readonly entries: ReadonlyArray<ConfigEntryView>;
314
+ }
315
+ declare const configList: (ctx: Context, input?: ConfigListInput) => Promise<ConfigListResult>;
316
+ interface ConfigSetInput {
317
+ readonly key: string;
318
+ readonly value: string;
319
+ readonly scope?: ConfigScope;
320
+ }
321
+ interface ConfigSetResult {
322
+ readonly key: ConfigKey;
323
+ readonly value: string;
324
+ readonly scope: ConfigScope;
325
+ }
326
+ declare const configSet: (ctx: Context, input: ConfigSetInput) => Promise<ConfigSetResult>;
327
+ interface ConfigUnsetInput {
328
+ readonly key: string;
329
+ readonly scope?: ConfigScope;
330
+ }
331
+ type ConfigUnsetResult = {
332
+ readonly key: ConfigKey;
333
+ readonly scope: ConfigScope;
334
+ readonly removed: true;
335
+ readonly previousValue: string;
336
+ } | {
337
+ readonly key: ConfigKey;
338
+ readonly scope: ConfigScope;
339
+ readonly removed: false;
340
+ };
341
+ declare const configUnset: (ctx: Context, input: ConfigUnsetInput) => Promise<ConfigUnsetResult>;
342
+ interface ConfigUnsetAllInput {
343
+ readonly key: string;
344
+ readonly scope?: ConfigScope;
345
+ }
346
+ interface ConfigUnsetAllResult {
347
+ readonly key: ConfigKey;
348
+ readonly scope: ConfigScope;
349
+ readonly removed: number;
350
+ }
351
+ declare const configUnsetAll: (ctx: Context, input: ConfigUnsetAllInput) => Promise<ConfigUnsetAllResult>;
352
+ interface ConfigRenameSectionInput {
353
+ readonly oldName: string;
354
+ readonly newName: string;
355
+ readonly scope?: ConfigScope;
356
+ }
357
+ interface ConfigRenameSectionResult {
358
+ readonly oldName: string;
359
+ readonly newName: string;
360
+ readonly scope: ConfigScope;
361
+ }
362
+ declare const configRenameSection: (ctx: Context, input: ConfigRenameSectionInput) => Promise<ConfigRenameSectionResult>;
363
+ interface ConfigRemoveSectionInput {
364
+ readonly name: string;
365
+ readonly scope?: ConfigScope;
366
+ }
367
+ interface ConfigRemoveSectionResult {
368
+ readonly name: string;
369
+ readonly scope: ConfigScope;
370
+ }
371
+ declare const configRemoveSection: (ctx: Context, input: ConfigRemoveSectionInput) => Promise<ConfigRemoveSectionResult>;
372
+
373
+ interface ContinueMergeOptions {
374
+ /** Override `MERGE_MSG`. Empty/undefined falls back to the draft. */
375
+ readonly message?: string;
376
+ /** Forwarded to commit. */
377
+ readonly author?: AuthorIdentity;
378
+ readonly committer?: AuthorIdentity;
379
+ /** Skip the `pre-commit` and `commit-msg` hooks (git's `--no-verify`). */
380
+ readonly noVerify?: boolean;
381
+ }
382
+ type ContinueMergeResult = CommitResult;
383
+ /**
384
+ * Finalise a conflicting merge as a merge commit. Asserts a merge is in
385
+ * progress, then delegates to `commit` — which already reads
386
+ * `MERGE_HEAD` for the second parent, falls back to `MERGE_MSG` when the
387
+ * message is empty, runs hooks, and clears merge state on success
388
+ * (ADR-174).
389
+ *
390
+ * Refuses when no merge is in progress (`MERGE_HEAD` absent). Refuses
391
+ * (via `commit`) when the index still has stage-1/2/3 entries.
392
+ */
393
+ declare const continueMerge: (ctx: Context, opts?: ContinueMergeOptions) => Promise<ContinueMergeResult>;
394
+
395
+ type DiffFormat = 'tree' | 'patch';
170
396
  interface DiffOptions {
171
397
  /** Resolve to a tree. Accepts ref name, oid, or 'HEAD'. */
172
398
  readonly from?: string;
173
399
  readonly to?: string;
174
400
  readonly detectRenames?: boolean;
401
+ /** Output format. Default `'tree'` for backward compatibility. */
402
+ readonly format?: DiffFormat;
403
+ /** Lines of equal context bracketing each hunk. Default `3`. Patch-only. */
404
+ readonly contextLines?: number;
405
+ /** Path prefixes on `diff --git`, `--- a/`, `+++ b/` lines. Default `{ old: 'a/', new: 'b/' }`. */
406
+ readonly pathPrefix?: PatchPathPrefix;
407
+ }
408
+ interface PatchResult {
409
+ readonly format: 'patch';
410
+ readonly text: string;
411
+ readonly diff: TreeDiff;
175
412
  }
413
+ type DiffResult = TreeDiff | PatchResult;
176
414
  /**
177
- * Diff two tree-like targets and return the resulting `TreeDiff`. When `from`
178
- * is omitted, defaults to HEAD's tree; when `to` is omitted, defaults to
179
- * `undefined` (interpreted by `diffTrees` as the empty tree).
415
+ * Diff two tree-like targets. Returns a structured `TreeDiff` by default;
416
+ * pass `format: 'patch'` for a canonical unified-diff text plus the
417
+ * structured view bundled together.
180
418
  */
181
- declare const diff: (ctx: Context, opts?: DiffOptions) => Promise<TreeDiff>;
419
+ declare function diff(ctx: Context, opts?: DiffOptions & {
420
+ format?: 'tree';
421
+ }): Promise<TreeDiff>;
422
+ declare function diff(ctx: Context, opts: DiffOptions & {
423
+ format: 'patch';
424
+ }): Promise<PatchResult>;
182
425
 
183
426
  interface FetchOptions {
184
427
  readonly remote?: string;
@@ -249,6 +492,485 @@ interface InitResult {
249
492
  */
250
493
  declare const init: (ctx: Context, opts?: InitOptions) => Promise<InitResult>;
251
494
 
495
+ /**
496
+ * The nested-namespace surface for `repo.branch.*`. Each method runs the
497
+ * caller-supplied `guard()` first (so a disposed repository throws before any
498
+ * work) and then forwards to the corresponding context-aware command in
499
+ * `commands/branch.ts`.
500
+ */
501
+ interface BranchNamespace {
502
+ readonly list: () => Promise<BranchListResult>;
503
+ readonly create: (input: BranchCreateInput) => Promise<BranchCreateResult>;
504
+ readonly delete: (input: BranchDeleteInput) => Promise<BranchDeleteResult>;
505
+ readonly rename: (input: BranchRenameInput) => Promise<BranchRenameResult>;
506
+ }
507
+ /**
508
+ * Bind the `repo.branch.*` nested-namespace dispatcher. `guard()` is the
509
+ * lifecycle gate (typically the disposed/closed check from `openRepository`);
510
+ * it is invoked before every method forwards to its underlying command.
511
+ *
512
+ * The returned object is frozen — callers cannot monkey-patch methods onto
513
+ * the namespace at runtime.
514
+ */
515
+ declare const bindBranchNamespace: (ctx: Context, guard: () => void) => BranchNamespace;
516
+
517
+ /**
518
+ * The nested-namespace surface for `repo.cherryPick.*` (ADR-181/192/210). Each
519
+ * method runs the caller-supplied `guard()` first (so a disposed repository
520
+ * throws before any work) and forwards to the Context-aware command. Frozen.
521
+ */
522
+ interface CherryPickNamespace {
523
+ readonly run: (input: CherryPickRunInput) => Promise<CherryPickResult>;
524
+ readonly continue: (input?: CherryPickContinueInput) => Promise<CherryPickResult>;
525
+ readonly skip: (input?: CherryPickContinueInput) => Promise<CherryPickResult>;
526
+ readonly abort: () => Promise<CherryPickAbortResult>;
527
+ }
528
+ declare const bindCherryPickNamespace: (ctx: Context, guard: () => void) => CherryPickNamespace;
529
+
530
+ /**
531
+ * The nested-namespace surface for `repo.config.*` (ADR-181). Each method
532
+ * runs the caller-supplied `guard()` first (so a disposed repository throws
533
+ * before any work) and then forwards to the corresponding context-aware
534
+ * command in `commands/config.ts`.
535
+ */
536
+ interface ConfigNamespace {
537
+ readonly get: (input: ConfigGetInput) => Promise<ConfigGetResult>;
538
+ readonly getAll: (input: ConfigGetAllInput) => Promise<ConfigGetAllResult>;
539
+ readonly getRegexp: (input: ConfigGetRegexpInput) => Promise<ConfigGetRegexpResult>;
540
+ readonly list: (input?: ConfigListInput) => Promise<ConfigListResult>;
541
+ readonly set: (input: ConfigSetInput) => Promise<ConfigSetResult>;
542
+ readonly unset: (input: ConfigUnsetInput) => Promise<ConfigUnsetResult>;
543
+ readonly unsetAll: (input: ConfigUnsetAllInput) => Promise<ConfigUnsetAllResult>;
544
+ readonly renameSection: (input: ConfigRenameSectionInput) => Promise<ConfigRenameSectionResult>;
545
+ readonly removeSection: (input: ConfigRemoveSectionInput) => Promise<ConfigRemoveSectionResult>;
546
+ }
547
+ /**
548
+ * Bind the `repo.config.*` nested-namespace dispatcher. `guard()` is the
549
+ * lifecycle gate (typically the disposed/closed check from `openRepository`);
550
+ * it is invoked before every method forwards to its underlying command.
551
+ *
552
+ * The returned object is frozen — callers cannot monkey-patch methods onto
553
+ * the namespace at runtime.
554
+ */
555
+ declare const bindConfigNamespace: (ctx: Context, guard: () => void) => ConfigNamespace;
556
+
557
+ type RebaseTodoAction = 'pick' | 'reword' | 'edit' | 'squash' | 'fixup' | 'drop';
558
+
559
+ /** The interactive instruction verbs (`git rebase -i`). */
560
+ type RebaseInteractiveAction = RebaseTodoAction;
561
+ /** One post-`$EDITOR` interactive instruction — the edited-todo line as data. */
562
+ interface RebaseInstruction {
563
+ readonly action: RebaseInteractiveAction;
564
+ /** A commit-ish in the `onto..HEAD` range. */
565
+ readonly oid: string;
566
+ /** reword: the new message (required). squash: the combined message
567
+ * (optional — defaults to git's combination template). Ignored otherwise. */
568
+ readonly message?: string;
569
+ }
570
+ interface RebaseRunInput {
571
+ /** The fork-point side — a commit-ish (`git rebase <upstream>`). */
572
+ readonly upstream: string;
573
+ /** `--onto <newbase>`: replay onto this base instead of `upstream`. */
574
+ readonly onto?: string;
575
+ /** Present → interactive: the post-`$EDITOR` instruction list (`git rebase -i`). */
576
+ readonly interactive?: ReadonlyArray<RebaseInstruction>;
577
+ }
578
+ interface RebasedCommit {
579
+ readonly source: ObjectId;
580
+ readonly created: ObjectId;
581
+ }
582
+ interface RebaseConflict {
583
+ readonly path: FilePath;
584
+ readonly type: ConflictType;
585
+ }
586
+ type RebaseResult = {
587
+ readonly kind: 'rebased';
588
+ readonly commits: ReadonlyArray<RebasedCommit>;
589
+ } | {
590
+ readonly kind: 'up-to-date';
591
+ } | {
592
+ readonly kind: 'conflict';
593
+ readonly commit: ObjectId;
594
+ readonly conflicts: ReadonlyArray<RebaseConflict>;
595
+ readonly remaining: number;
596
+ } | {
597
+ readonly kind: 'stopped';
598
+ readonly commit: ObjectId;
599
+ readonly remaining: number;
600
+ };
601
+ declare const rebaseRun: (ctx: Context, input: RebaseRunInput) => Promise<RebaseResult>;
602
+ interface RebaseAbortResult {
603
+ readonly head: ObjectId;
604
+ readonly headName: string;
605
+ }
606
+ /**
607
+ * Resume the rebase after the conflicted commit was resolved: commit the resolved
608
+ * index as the stopped commit (preserved author from `author-script`, current
609
+ * committer, `rebase (continue)` reflog), then replay the remaining todo.
610
+ */
611
+ declare const rebaseContinue: (ctx: Context) => Promise<RebaseResult>;
612
+ /** Drop the conflicted commit (hard-reset to the last good pick) and replay the rest. */
613
+ declare const rebaseSkip: (ctx: Context) => Promise<RebaseResult>;
614
+ /**
615
+ * Abort the rebase: hard-reset the working tree + index to the pre-rebase tip,
616
+ * reattach `head-name`, record git's `rebase (abort): returning to <name>` reflog
617
+ * (the branch never moved during the replay, so it gets no entry), clear state.
618
+ */
619
+ declare const rebaseAbort: (ctx: Context) => Promise<RebaseAbortResult>;
620
+
621
+ /**
622
+ * The nested-namespace surface for `repo.rebase.*` (ADR-181/192/230). Each method
623
+ * runs the caller-supplied `guard()` first (so a disposed repository throws before
624
+ * any work) and forwards to the Context-aware command. Frozen.
625
+ */
626
+ interface RebaseNamespace {
627
+ readonly run: (input: RebaseRunInput) => Promise<RebaseResult>;
628
+ readonly continue: () => Promise<RebaseResult>;
629
+ readonly skip: () => Promise<RebaseResult>;
630
+ readonly abort: () => Promise<RebaseAbortResult>;
631
+ }
632
+ declare const bindRebaseNamespace: (ctx: Context, guard: () => void) => RebaseNamespace;
633
+
634
+ /** Compact view of a remote pulled from `.git/config`. */
635
+ interface RemoteInfo {
636
+ readonly name: string;
637
+ readonly url: string;
638
+ readonly pushUrl: string | undefined;
639
+ readonly fetchRefspecs: ReadonlyArray<string>;
640
+ }
641
+ /** Local-only `show` payload: config view + tracking refs + tracking branches. */
642
+ interface RemoteShow extends RemoteInfo {
643
+ readonly trackingRefs: ReadonlyMap<RefName, ObjectId>;
644
+ readonly trackedBy: ReadonlyArray<{
645
+ readonly branch: RefName;
646
+ readonly merge: string | undefined;
647
+ }>;
648
+ }
649
+ interface RemoteListResult {
650
+ readonly remotes: ReadonlyArray<RemoteInfo>;
651
+ }
652
+ interface RemoteAddInput {
653
+ readonly name: string;
654
+ readonly url: string;
655
+ readonly fetch?: string;
656
+ }
657
+ interface RemoteAddResult {
658
+ readonly remote: RemoteInfo;
659
+ }
660
+ interface RemoteRemoveInput {
661
+ readonly name: string;
662
+ }
663
+ interface RemoteRemoveResult {
664
+ readonly name: string;
665
+ readonly removedTrackingRefs: ReadonlyArray<RefName>;
666
+ readonly clearedBranches: ReadonlyArray<RefName>;
667
+ }
668
+ interface RemoteRenameInput {
669
+ readonly from: string;
670
+ readonly to: string;
671
+ }
672
+ interface RemoteRenameResult {
673
+ readonly from: string;
674
+ readonly to: string;
675
+ readonly movedTrackingRefs: ReadonlyArray<RefName>;
676
+ readonly rewrittenBranches: ReadonlyArray<RefName>;
677
+ }
678
+ interface RemoteSetUrlInput {
679
+ readonly name: string;
680
+ readonly url: string;
681
+ readonly push?: boolean;
682
+ }
683
+ interface RemoteSetUrlResult {
684
+ readonly remote: RemoteInfo;
685
+ }
686
+ interface RemoteShowInput {
687
+ readonly name: string;
688
+ }
689
+ interface RemoteShowResult {
690
+ readonly remote: RemoteShow;
691
+ }
692
+ declare const remoteList: (ctx: Context) => Promise<RemoteListResult>;
693
+ declare const remoteAdd: (ctx: Context, input: RemoteAddInput) => Promise<RemoteAddResult>;
694
+ declare const remoteRemove: (ctx: Context, input: RemoteRemoveInput) => Promise<RemoteRemoveResult>;
695
+ declare const remoteRename: (ctx: Context, input: RemoteRenameInput) => Promise<RemoteRenameResult>;
696
+ declare const remoteSetUrl: (ctx: Context, input: RemoteSetUrlInput) => Promise<RemoteSetUrlResult>;
697
+ declare const remoteShow: (ctx: Context, input: RemoteShowInput) => Promise<RemoteShowResult>;
698
+
699
+ /**
700
+ * The nested-namespace surface for `repo.remote.*`. Each method runs the
701
+ * caller-supplied `guard()` first (so a disposed repository throws before any
702
+ * work) and then forwards to the corresponding context-aware command in
703
+ * `commands/remote.ts`.
704
+ */
705
+ interface RemoteNamespace {
706
+ readonly list: () => Promise<RemoteListResult>;
707
+ readonly add: (input: RemoteAddInput) => Promise<RemoteAddResult>;
708
+ readonly remove: (input: RemoteRemoveInput) => Promise<RemoteRemoveResult>;
709
+ readonly rename: (input: RemoteRenameInput) => Promise<RemoteRenameResult>;
710
+ readonly setUrl: (input: RemoteSetUrlInput) => Promise<RemoteSetUrlResult>;
711
+ readonly show: (input: RemoteShowInput) => Promise<RemoteShowResult>;
712
+ }
713
+ /**
714
+ * Bind the `repo.remote.*` nested-namespace dispatcher. `guard()` is the
715
+ * lifecycle gate (typically the disposed/closed check from `openRepository`);
716
+ * it is invoked before every method forwards to its underlying command.
717
+ *
718
+ * The returned object is frozen — callers cannot monkey-patch methods onto
719
+ * the namespace at runtime.
720
+ */
721
+ declare const bindRemoteNamespace: (ctx: Context, guard: () => void) => RemoteNamespace;
722
+
723
+ interface RevertRunInput {
724
+ /** Revisions to revert, in argument order — a commit-ish each. */
725
+ readonly commits: ReadonlyArray<string>;
726
+ /** -n / --no-commit: apply each reverse change to the index + working tree
727
+ * only; never commit, never persist REVERT_HEAD / sequencer state. */
728
+ readonly noCommit?: boolean;
729
+ }
730
+ interface RevertedCommit {
731
+ readonly source: ObjectId;
732
+ readonly created: ObjectId;
733
+ }
734
+ interface RevertConflict {
735
+ readonly path: FilePath;
736
+ readonly type: ConflictType;
737
+ }
738
+ type RevertResult = {
739
+ readonly kind: 'reverted';
740
+ readonly commits: ReadonlyArray<RevertedCommit>;
741
+ } | {
742
+ readonly kind: 'no-commit';
743
+ readonly sources: ReadonlyArray<ObjectId>;
744
+ } | {
745
+ readonly kind: 'conflict';
746
+ readonly commit: ObjectId;
747
+ readonly conflicts: ReadonlyArray<RevertConflict>;
748
+ readonly remaining: number;
749
+ } | {
750
+ readonly kind: 'empty';
751
+ readonly commit: ObjectId;
752
+ readonly remaining: number;
753
+ };
754
+ declare const revertRun: (ctx: Context, input: RevertRunInput) => Promise<RevertResult>;
755
+ /**
756
+ * Finalise the in-progress conflicted revert (if any) as a single-parent commit,
757
+ * then resume the remaining sequencer reverts. Refuses when nothing is in progress
758
+ * or the index is unmerged; a resolution that yields no change re-stops empty.
759
+ */
760
+ declare const revertContinue: (ctx: Context) => Promise<RevertResult>;
761
+ interface RevertAbortResult {
762
+ readonly head: ObjectId;
763
+ readonly branch: RefName;
764
+ }
765
+ /**
766
+ * Drop the in-progress revert: hard-reset to HEAD (discarding its half-applied
767
+ * state), then resume the remaining sequencer reverts (if any).
768
+ */
769
+ declare const revertSkip: (ctx: Context) => Promise<RevertResult>;
770
+ /**
771
+ * Abort the revert: hard-reset the working tree, index, and branch to the
772
+ * pre-sequence HEAD (sequencer `head`, or the current HEAD for a lone revert),
773
+ * and clear all state. The branch update records git's faithful
774
+ * `reset: moving to <oid>` reflog. Refuses when nothing is in progress.
775
+ */
776
+ declare const revertAbort: (ctx: Context) => Promise<RevertAbortResult>;
777
+
778
+ /**
779
+ * The nested-namespace surface for `repo.revert.*` (ADR-181/192/210/217 lineage).
780
+ * Each method runs the caller-supplied `guard()` first (so a disposed repository
781
+ * throws before any work) and forwards to the Context-aware command. Frozen.
782
+ * `continue` / `skip` take no arguments — revert has no resume-time options.
783
+ */
784
+ interface RevertNamespace {
785
+ readonly run: (input: RevertRunInput) => Promise<RevertResult>;
786
+ readonly continue: () => Promise<RevertResult>;
787
+ readonly skip: () => Promise<RevertResult>;
788
+ readonly abort: () => Promise<RevertAbortResult>;
789
+ }
790
+ declare const bindRevertNamespace: (ctx: Context, guard: () => void) => RevertNamespace;
791
+
792
+ interface SparseCheckoutListResult {
793
+ readonly cone: boolean;
794
+ readonly patterns: ReadonlyArray<string>;
795
+ }
796
+ interface SparseCheckoutAppliedResult {
797
+ readonly cone: boolean;
798
+ readonly materialized: number;
799
+ readonly removed: number;
800
+ readonly retained: ReadonlyArray<FilePath>;
801
+ }
802
+ interface SparseCheckoutSetInput {
803
+ readonly patterns: ReadonlyArray<string>;
804
+ readonly cone?: boolean;
805
+ readonly force?: boolean;
806
+ }
807
+ interface SparseCheckoutAddInput {
808
+ readonly patterns: ReadonlyArray<string>;
809
+ readonly force?: boolean;
810
+ }
811
+ interface SparseCheckoutReapplyInput {
812
+ readonly force?: boolean;
813
+ }
814
+ interface SparseCheckoutDisableInput {
815
+ readonly force?: boolean;
816
+ }
817
+ declare const sparseCheckoutList: (ctx: Context) => Promise<SparseCheckoutListResult>;
818
+ declare const sparseCheckoutSet: (ctx: Context, input: SparseCheckoutSetInput) => Promise<SparseCheckoutAppliedResult>;
819
+ declare const sparseCheckoutAdd: (ctx: Context, input: SparseCheckoutAddInput) => Promise<SparseCheckoutAppliedResult>;
820
+ declare const sparseCheckoutReapply: (ctx: Context, input?: SparseCheckoutReapplyInput) => Promise<SparseCheckoutAppliedResult>;
821
+ declare const sparseCheckoutDisable: (ctx: Context, input?: SparseCheckoutDisableInput) => Promise<SparseCheckoutAppliedResult>;
822
+
823
+ /**
824
+ * The nested-namespace surface for `repo.sparseCheckout.*`. Each method runs
825
+ * the caller-supplied `guard()` first (so a disposed repository throws before
826
+ * any work) and then forwards to the corresponding context-aware command in
827
+ * `commands/sparse-checkout.ts`.
828
+ */
829
+ interface SparseCheckoutNamespace {
830
+ readonly list: () => Promise<SparseCheckoutListResult>;
831
+ readonly set: (input: SparseCheckoutSetInput) => Promise<SparseCheckoutAppliedResult>;
832
+ readonly add: (input: SparseCheckoutAddInput) => Promise<SparseCheckoutAppliedResult>;
833
+ readonly reapply: (input?: SparseCheckoutReapplyInput) => Promise<SparseCheckoutAppliedResult>;
834
+ readonly disable: (input?: SparseCheckoutDisableInput) => Promise<SparseCheckoutAppliedResult>;
835
+ }
836
+ /**
837
+ * Bind the `repo.sparseCheckout.*` nested-namespace dispatcher. `guard()` is
838
+ * the lifecycle gate (typically the disposed/closed check from
839
+ * `openRepository`); it is invoked before every method forwards to its
840
+ * underlying command.
841
+ *
842
+ * The returned object is frozen — callers cannot monkey-patch methods onto
843
+ * the namespace at runtime.
844
+ */
845
+ declare const bindSparseCheckoutNamespace: (ctx: Context, guard: () => void) => SparseCheckoutNamespace;
846
+
847
+ /** One entry of the stash stack, newest-first (`stash@{0}` = index 0). */
848
+ interface StashStackEntry {
849
+ readonly index: number;
850
+ readonly selector: string;
851
+ readonly stash: ObjectId;
852
+ readonly message: string;
853
+ }
854
+ interface StashDropResult {
855
+ readonly dropped: ObjectId;
856
+ readonly remaining: number;
857
+ }
858
+
859
+ interface StashPushInput {
860
+ readonly message?: string;
861
+ readonly includeUntracked?: boolean;
862
+ readonly keepIndex?: boolean;
863
+ }
864
+ type StashPushResult = {
865
+ readonly kind: 'saved';
866
+ readonly stash: ObjectId;
867
+ readonly message: string;
868
+ } | {
869
+ readonly kind: 'no-local-changes';
870
+ };
871
+ declare const stashPush: (ctx: Context, opts?: StashPushInput) => Promise<StashPushResult>;
872
+
873
+ type StashListEntry = StashStackEntry;
874
+ interface StashListResult {
875
+ readonly entries: ReadonlyArray<StashListEntry>;
876
+ }
877
+ /** List the stash stack, newest-first (`stash@{0}` first). */
878
+ declare const stashList: (ctx: Context) => Promise<StashListResult>;
879
+ interface StashDropInput {
880
+ readonly index?: number;
881
+ }
882
+ /** Drop `stash@{index}` (default newest) from the stack. */
883
+ declare const stashDrop: (ctx: Context, input?: StashDropInput) => Promise<StashDropResult>;
884
+ interface StashApplyInput {
885
+ readonly index?: number;
886
+ readonly restoreIndex?: boolean;
887
+ }
888
+ interface StashConflict {
889
+ readonly path: FilePath;
890
+ readonly type: ConflictType;
891
+ }
892
+ type StashApplyResult = {
893
+ readonly kind: 'applied';
894
+ readonly stash: ObjectId;
895
+ } | {
896
+ readonly kind: 'conflict';
897
+ readonly conflicts: ReadonlyArray<StashConflict>;
898
+ };
899
+ /** Apply `stash@{index}` (default newest) onto the working tree via a 3-way merge. */
900
+ declare const stashApply: (ctx: Context, input?: StashApplyInput) => Promise<StashApplyResult>;
901
+ type StashPopResult = {
902
+ readonly kind: 'applied';
903
+ readonly stash: ObjectId;
904
+ readonly dropped: ObjectId;
905
+ } | {
906
+ readonly kind: 'conflict';
907
+ readonly conflicts: ReadonlyArray<StashConflict>;
908
+ };
909
+ /** Apply `stash@{index}` then drop it; on conflict the stash is retained. */
910
+ declare const stashPop: (ctx: Context, input?: StashApplyInput) => Promise<StashPopResult>;
911
+
912
+ /**
913
+ * The nested-namespace surface for `repo.stash.*` (ADR-181 / ADR-192). Each
914
+ * method runs the caller-supplied `guard()` first (so a disposed repository
915
+ * throws before any work) and then forwards to the corresponding Context-aware
916
+ * command in `commands/stash.ts`. The returned object is frozen.
917
+ */
918
+ interface StashNamespace {
919
+ readonly push: (input?: StashPushInput) => Promise<StashPushResult>;
920
+ readonly list: () => Promise<StashListResult>;
921
+ readonly apply: (input?: StashApplyInput) => Promise<StashApplyResult>;
922
+ readonly pop: (input?: StashApplyInput) => Promise<StashPopResult>;
923
+ readonly drop: (input?: StashDropInput) => Promise<StashDropResult>;
924
+ }
925
+ declare const bindStashNamespace: (ctx: Context, guard: () => void) => StashNamespace;
926
+
927
+ interface TagInfo {
928
+ readonly name: RefName;
929
+ readonly id: ObjectId;
930
+ }
931
+ interface TagListResult {
932
+ readonly tags: ReadonlyArray<TagInfo>;
933
+ }
934
+ interface TagCreateInput {
935
+ readonly name: string;
936
+ readonly target?: string;
937
+ readonly force?: boolean;
938
+ }
939
+ interface TagCreateResult {
940
+ readonly name: RefName;
941
+ readonly id: ObjectId;
942
+ }
943
+ interface TagDeleteInput {
944
+ readonly name: string;
945
+ }
946
+ interface TagDeleteResult {
947
+ readonly name: RefName;
948
+ }
949
+ declare const tagList: (ctx: Context) => Promise<TagListResult>;
950
+ declare const tagCreate: (ctx: Context, input: TagCreateInput) => Promise<TagCreateResult>;
951
+ declare const tagDelete: (ctx: Context, input: TagDeleteInput) => Promise<TagDeleteResult>;
952
+
953
+ /**
954
+ * The nested-namespace surface for `repo.tag.*`. Each method runs the
955
+ * caller-supplied `guard()` first (so a disposed repository throws before any
956
+ * work) and then forwards to the corresponding context-aware command in
957
+ * `commands/tag.ts`.
958
+ */
959
+ interface TagNamespace {
960
+ readonly list: () => Promise<TagListResult>;
961
+ readonly create: (input: TagCreateInput) => Promise<TagCreateResult>;
962
+ readonly delete: (input: TagDeleteInput) => Promise<TagDeleteResult>;
963
+ }
964
+ /**
965
+ * Bind the `repo.tag.*` nested-namespace dispatcher. `guard()` is the
966
+ * lifecycle gate (typically the disposed/closed check from `openRepository`);
967
+ * it is invoked before every method forwards to its underlying command.
968
+ *
969
+ * The returned object is frozen — callers cannot monkey-patch methods onto
970
+ * the namespace at runtime.
971
+ */
972
+ declare const bindTagNamespace: (ctx: Context, guard: () => void) => TagNamespace;
973
+
252
974
  interface LogOptions {
253
975
  readonly from?: string;
254
976
  readonly limit?: number;
@@ -277,6 +999,12 @@ interface MergeOptions {
277
999
  readonly noFastForward?: boolean;
278
1000
  readonly author?: AuthorIdentity;
279
1001
  readonly committer?: AuthorIdentity;
1002
+ /**
1003
+ * Reflog action prefix, mirroring git's GIT_REFLOG_ACTION. Replaces the
1004
+ * default `merge <target>` prefix in the fast-forward and merge-commit reflog
1005
+ * messages (e.g. `pull` → `pull: Fast-forward`). Defaults to `merge <target>`.
1006
+ */
1007
+ readonly reflogLabel?: string;
280
1008
  }
281
1009
  interface MergeConflictDescriptor {
282
1010
  readonly path: FilePath;
@@ -315,6 +1043,66 @@ type MergeResult = {
315
1043
  */
316
1044
  declare const merge: (ctx: Context, opts: MergeOptions) => Promise<MergeResult>;
317
1045
 
1046
+ interface MvOptions {
1047
+ /** Overwrite an existing destination (a file source only). `-f`. */
1048
+ readonly force?: boolean;
1049
+ /** Validate and report the plan without touching index or working tree. `-n`. */
1050
+ readonly dryRun?: boolean;
1051
+ /** Skip refused (source → target) pairs instead of aborting the whole call. `-k`. */
1052
+ readonly skipErrors?: boolean;
1053
+ /** Break a stale `index.lock` older than N ms (same contract as rm/add). */
1054
+ readonly breakStaleLockMs?: number;
1055
+ }
1056
+ interface MvMove {
1057
+ readonly from: FilePath;
1058
+ readonly to: FilePath;
1059
+ }
1060
+ /** Per-source refusals that `skipErrors` collects rather than throwing. */
1061
+ type MvSkipReason = 'source-not-tracked' | 'bad-source' | 'destination-exists' | 'into-self';
1062
+ interface MvSkipped {
1063
+ readonly source: FilePath;
1064
+ readonly reason: MvSkipReason;
1065
+ }
1066
+ interface MvResult {
1067
+ readonly moved: ReadonlyArray<MvMove>;
1068
+ readonly skipped: ReadonlyArray<MvSkipped>;
1069
+ }
1070
+ /**
1071
+ * Move/rename tracked paths in the index and the working tree, faithful to
1072
+ * `git mv`. Each (source → target) pair is validated up front; on any refusal
1073
+ * nothing is moved (unless `skipErrors`). Blob ids and modes are copied from the
1074
+ * source's index entry — the working file is renamed as-is, never re-hashed.
1075
+ */
1076
+ declare const mv: (ctx: Context, sources: ReadonlyArray<string>, destination: string, opts?: MvOptions) => Promise<MvResult>;
1077
+
1078
+ interface PullOptions {
1079
+ /** Remote to pull from. Default: `branch.<current>.remote` ?? `'origin'`. */
1080
+ readonly remote?: string;
1081
+ /**
1082
+ * Short branch name to merge. Default: short form of `branch.<current>.merge`.
1083
+ * When neither is resolvable, pull throws `NO_UPSTREAM_CONFIGURED`.
1084
+ */
1085
+ readonly branch?: string;
1086
+ /** Reject the pull when a true merge would be required. */
1087
+ readonly fastForwardOnly?: boolean;
1088
+ /** Always create a merge commit, even when a fast-forward is possible. */
1089
+ readonly noFastForward?: boolean;
1090
+ /** Prune deleted remote-tracking refs during the fetch step. */
1091
+ readonly prune?: boolean;
1092
+ /** Shallow fetch depth, forwarded to fetch. */
1093
+ readonly depth?: number;
1094
+ /** Override the generated merge commit message / MERGE_MSG. */
1095
+ readonly message?: string;
1096
+ /** Identity for the merge commit (true-merge path only). */
1097
+ readonly author?: AuthorIdentity;
1098
+ readonly committer?: AuthorIdentity;
1099
+ }
1100
+ interface PullResult {
1101
+ readonly fetch: FetchResult;
1102
+ readonly merge: MergeResult;
1103
+ }
1104
+ declare const pull: (ctx: Context, opts?: PullOptions) => Promise<PullResult>;
1105
+
318
1106
  interface PushOptions {
319
1107
  readonly remote?: string;
320
1108
  readonly refspecs?: ReadonlyArray<string>;
@@ -410,6 +1198,8 @@ declare const revParse: (ctx: Context, expression: string) => Promise<ObjectId>;
410
1198
 
411
1199
  interface RmOptions {
412
1200
  readonly cached?: boolean;
1201
+ /** Override the safety valve (`-f`) — remove even staged / locally-modified paths. */
1202
+ readonly force?: boolean;
413
1203
  readonly breakStaleLockMs?: number;
414
1204
  }
415
1205
  interface RmResult {
@@ -421,37 +1211,6 @@ interface RmResult {
421
1211
  */
422
1212
  declare const rm: (ctx: Context, paths: ReadonlyArray<string>, opts?: RmOptions) => Promise<RmResult>;
423
1213
 
424
- type SparseCheckoutAction = {
425
- readonly action: 'list';
426
- } | {
427
- readonly action: 'set';
428
- readonly patterns: ReadonlyArray<string>;
429
- readonly cone?: boolean;
430
- readonly force?: boolean;
431
- } | {
432
- readonly action: 'add';
433
- readonly patterns: ReadonlyArray<string>;
434
- readonly force?: boolean;
435
- } | {
436
- readonly action: 'reapply';
437
- readonly force?: boolean;
438
- } | {
439
- readonly action: 'disable';
440
- readonly force?: boolean;
441
- };
442
- type SparseCheckoutResult = {
443
- readonly kind: 'list';
444
- readonly cone: boolean;
445
- readonly patterns: ReadonlyArray<string>;
446
- } | {
447
- readonly kind: 'applied';
448
- readonly cone: boolean;
449
- readonly materialized: number;
450
- readonly removed: number;
451
- readonly retained: ReadonlyArray<FilePath>;
452
- };
453
- declare const sparseCheckout: (ctx: Context, opts: SparseCheckoutAction) => Promise<SparseCheckoutResult>;
454
-
455
1214
  type ChangeKind = 'modified' | 'added' | 'deleted' | 'untracked';
456
1215
  interface ChangeEntry {
457
1216
  readonly kind: ChangeKind;
@@ -496,33 +1255,5 @@ type SubmodulesResult = {
496
1255
  };
497
1256
  declare const submodules: (ctx: Context, opts?: SubmodulesAction) => Promise<SubmodulesResult>;
498
1257
 
499
- type TagAction = {
500
- readonly kind: 'list';
501
- } | {
502
- readonly kind: 'create';
503
- readonly name: string;
504
- readonly target?: string;
505
- readonly force?: boolean;
506
- } | {
507
- readonly kind: 'delete';
508
- readonly name: string;
509
- };
510
- interface TagInfo {
511
- readonly name: RefName;
512
- readonly id: ObjectId;
513
- }
514
- type TagResult = {
515
- readonly kind: 'list';
516
- readonly tags: ReadonlyArray<TagInfo>;
517
- } | {
518
- readonly kind: 'create';
519
- readonly name: RefName;
520
- readonly id: ObjectId;
521
- } | {
522
- readonly kind: 'delete';
523
- readonly name: RefName;
524
- };
525
- declare const tag: (ctx: Context, action: TagAction) => Promise<TagResult>;
526
-
527
- export { CatFileBatchEntry, SubmoduleEntry, add, branch, catFile, checkout, clone, commit, createPromisorRemote, diff, fetch, fetchMissing, init, log, merge, push, reflog, reset, revParse, rm, sparseCheckout, status, submodules, tag };
528
- export type { 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 };
1258
+ export { CatFileBatchEntry, SubmoduleEntry, 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 };
1259
+ export type { 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 };