@scolladon/tsgit 1.3.0 → 2.0.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 (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,7 +1,9 @@
1
- import { add, branch, catFile, checkout, clone, commit, diff, fetch, fetchMissing, init, log, merge, push, reflog, reset, revParse, rm, sparseCheckout, status, submodules, tag } from '../commands/index.js';
2
- import { f as FileSystem, H as HashService, C as Compressor, n as RepositoryConfig, L as Logger, P as ProgressReporter, k as HookRunner, b as Context } from './context-BORy7yXb.js';
3
- import { c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, h as recordRefUpdate, i as resolveRef, j as runHook, u as updateRef, w as walkCommits, k as walkSubmodules, l as walkTree, n as walkWorkingTree, o as writeObject, p as writeSymbolicRef, q as writeTree } from './write-tree-Dn1LtIh7.js';
4
- import { b as HttpTransport } from './http-transport-DirKfK2S.js';
1
+ import { abortMerge, add, BranchNamespace, catFile, checkout, CherryPickNamespace, clone, commit, ConfigNamespace, continueMerge, DiffOptions, PatchResult, fetch, fetchMissing, init, log, merge, mv, pull, push, RebaseNamespace, reflog, RemoteNamespace, reset, RevertNamespace, revParse, rm, SparseCheckoutNamespace, StashNamespace, status, submodules, TagNamespace } from '../commands/index.js';
2
+ import { F as FileSystem, H as HashService, C as Compressor, R as RepositoryConfig, L as Logger, P as ProgressReporter, a as HookRunner, b as Context } from './context-CCL0_F8R.js';
3
+ import { c as catFileBatch, a as createCommit, d as diffTrees, g as getRepoRoot, h as hashBlob, i as isIgnored, m as mergeBase, r as readBlob, b as readIndex, e as readObject, f as readTree, j as recordRefUpdate, k as resolveRef, l as runHook, s as setEntryFlags, n as stageEntry, u as unstageEntry, o as updateRef, w as walkCommits, p as walkSubmodules, q as walkTree, t as walkWorkingTree, v as writeObject, x as writeSymbolicRef, y as writeTree } from './write-tree-DRI-LzSr.js';
4
+ import { H as HttpTransport } from './http-transport--_NdQOiw.js';
5
+ import { T as TreeDiff } from './reflog-entry-CSzjnZd4.js';
6
+ import { S as SnapshotFactory } from './progress-7KKiXXfX.js';
5
7
 
6
8
  /**
7
9
  * Helper that strips the leading `Context` parameter from a function type so
@@ -52,32 +54,60 @@ interface OpenRepositoryOptions {
52
54
  * users never see Context except through `repo.ctx`.
53
55
  */
54
56
  interface Repository {
57
+ readonly abortMerge: BindCtx<typeof abortMerge>;
55
58
  readonly add: BindCtx<typeof add>;
56
- readonly branch: BindCtx<typeof branch>;
59
+ /** Nested `repo.branch.{list,create,delete,rename}` namespace. */
60
+ readonly branch: BranchNamespace;
57
61
  readonly catFile: BindCtx<typeof catFile>;
58
62
  readonly checkout: BindCtx<typeof checkout>;
63
+ /** Nested `repo.cherryPick.{run,continue,skip,abort}` namespace. */
64
+ readonly cherryPick: CherryPickNamespace;
59
65
  readonly clone: BindCtx<typeof clone>;
60
66
  readonly commit: BindCtx<typeof commit>;
61
- readonly diff: BindCtx<typeof diff>;
67
+ /** Nested `repo.config.{get,set,unset,unsetAll,getAll,getRegexp,list,renameSection,removeSection}` (ADR-181). */
68
+ readonly config: ConfigNamespace;
69
+ readonly continueMerge: BindCtx<typeof continueMerge>;
70
+ readonly diff: {
71
+ (opts?: DiffOptions & {
72
+ format?: 'tree';
73
+ }): Promise<TreeDiff>;
74
+ (opts: DiffOptions & {
75
+ format: 'patch';
76
+ }): Promise<PatchResult>;
77
+ };
62
78
  readonly fetch: BindCtx<typeof fetch>;
63
79
  readonly fetchMissing: BindCtx<typeof fetchMissing>;
64
80
  readonly init: BindCtx<typeof init>;
65
81
  readonly log: BindCtx<typeof log>;
66
82
  readonly merge: BindCtx<typeof merge>;
83
+ readonly mv: BindCtx<typeof mv>;
84
+ readonly pull: BindCtx<typeof pull>;
67
85
  readonly push: BindCtx<typeof push>;
86
+ /** Nested `repo.rebase.{run,continue,skip,abort}` namespace. */
87
+ readonly rebase: RebaseNamespace;
68
88
  readonly reflog: BindCtx<typeof reflog>;
89
+ /** Nested `repo.remote.{list,add,remove,rename,setUrl,show}` namespace. */
90
+ readonly remote: RemoteNamespace;
69
91
  readonly reset: BindCtx<typeof reset>;
92
+ /** Nested `repo.revert.{run,continue,skip,abort}` namespace. */
93
+ readonly revert: RevertNamespace;
70
94
  readonly revParse: BindCtx<typeof revParse>;
71
95
  readonly rm: BindCtx<typeof rm>;
72
- readonly sparseCheckout: BindCtx<typeof sparseCheckout>;
96
+ /** Nested `repo.sparseCheckout.{list,set,add,reapply,disable}` namespace. */
97
+ readonly sparseCheckout: SparseCheckoutNamespace;
98
+ /** Nested `repo.stash.{push,list,apply,pop,drop}` namespace. */
99
+ readonly stash: StashNamespace;
73
100
  readonly status: BindCtx<typeof status>;
74
101
  readonly submodules: BindCtx<typeof submodules>;
75
- readonly tag: BindCtx<typeof tag>;
102
+ /** Nested `repo.tag.{list,create,delete}` namespace. */
103
+ readonly tag: TagNamespace;
76
104
  readonly primitives: {
77
105
  readonly catFileBatch: BindCtx<typeof catFileBatch>;
78
106
  readonly createCommit: BindCtx<typeof createCommit>;
79
107
  readonly diffTrees: BindCtx<typeof diffTrees>;
80
108
  readonly getRepoRoot: BindCtx<typeof getRepoRoot>;
109
+ readonly hashBlob: BindCtx<typeof hashBlob>;
110
+ readonly isIgnored: BindCtx<typeof isIgnored>;
81
111
  readonly mergeBase: BindCtx<typeof mergeBase>;
82
112
  readonly readBlob: BindCtx<typeof readBlob>;
83
113
  readonly readIndex: BindCtx<typeof readIndex>;
@@ -86,6 +116,9 @@ interface Repository {
86
116
  readonly recordRefUpdate: BindCtx<typeof recordRefUpdate>;
87
117
  readonly resolveRef: BindCtx<typeof resolveRef>;
88
118
  readonly runHook: BindCtx<typeof runHook>;
119
+ readonly setEntryFlags: BindCtx<typeof setEntryFlags>;
120
+ readonly stageEntry: BindCtx<typeof stageEntry>;
121
+ readonly unstageEntry: BindCtx<typeof unstageEntry>;
89
122
  readonly updateRef: BindCtx<typeof updateRef>;
90
123
  readonly walkCommits: BindCtx<typeof walkCommits>;
91
124
  readonly walkSubmodules: BindCtx<typeof walkSubmodules>;
@@ -95,6 +128,13 @@ interface Repository {
95
128
  readonly writeSymbolicRef: BindCtx<typeof writeSymbolicRef>;
96
129
  readonly writeTree: BindCtx<typeof writeTree>;
97
130
  };
131
+ /**
132
+ * Lazy snapshot factory wired to the cached resolver stack (Phase 20.1).
133
+ * Each method returns a `Snapshot` handle that performs no I/O until
134
+ * iterated; in-flight iterations are isolated from concurrent writes
135
+ * via the iteration-stability invariant (design §8.0 + ADR-150).
136
+ */
137
+ readonly snapshot: SnapshotFactory;
98
138
  /** The frozen Context backing every binding. Exposed for advanced use. */
99
139
  readonly ctx: Context;
100
140
  /**
@@ -1,38 +1,6 @@
1
- import { O as ObjectId, d as FilePath, b as Context, R as RefName, h as HookName } from './context-CMrHCVwK.cjs';
2
- import { F as FileMode, a as CatFileBatchOptions, C as CatFileBatchEntry, c as CreateCommitInput, D as DiffTreesInput, d as DiffTreesOptions, s as TreeDiff, R as ReadObjectOptions, B as Blob, G as GitObject, T as Tree, r as ResolveRefOptions, U as UpdateRefOptions, W as WalkCommitsOptions, b as Commit, v as WalkSubmodulesOptions, S as SubmoduleEntry, x as WalkTreeOptions, w as WalkTreeEntry, z as WalkWorkingTreeOptions, y as WalkWorkingTreeEntry, t as TreeEntry } from './reflog-entry-DNvSz7S5.cjs';
3
-
4
- interface IndexEntryFlags {
5
- readonly assumeValid: boolean;
6
- readonly stage: 0 | 1 | 2 | 3;
7
- /** Index v3 extended flag — the path is intentionally absent from the working tree. */
8
- readonly skipWorktree: boolean;
9
- /** Index v3 extended flag — `git add -N` placeholder. Modelled for faithful round-tripping. */
10
- readonly intentToAdd: boolean;
11
- }
12
- interface IndexEntry {
13
- readonly ctimeSeconds: number;
14
- readonly ctimeNanoseconds: number;
15
- readonly mtimeSeconds: number;
16
- readonly mtimeNanoseconds: number;
17
- readonly dev: number;
18
- readonly ino: number;
19
- readonly mode: FileMode;
20
- readonly uid: number;
21
- readonly gid: number;
22
- readonly fileSize: number;
23
- readonly id: ObjectId;
24
- readonly flags: IndexEntryFlags;
25
- readonly path: FilePath;
26
- }
27
- interface IndexExtension {
28
- readonly signature: string;
29
- readonly data: Uint8Array;
30
- }
31
- interface GitIndex {
32
- readonly version: 2 | 3;
33
- readonly entries: ReadonlyArray<IndexEntry>;
34
- readonly extensions: ReadonlyArray<IndexExtension>;
35
- }
1
+ import { b as Context, O as ObjectId, c as FilePath, j as RefName, g as HookName } from './context-YDw6qicq.cjs';
2
+ import { d as CatFileBatchOptions, C as CatFileBatchEntry, e as CreateCommitInput, D as DiffTreesInput, f as DiffTreesOptions, T as TreeDiff, s as ReadObjectOptions, B as Blob, G as GitObject, a as Tree, t as ResolveRefOptions, F as FileMode, U as UpdateRefOptions, W as WalkCommitsOptions, E as Commit, v as WalkSubmodulesOptions, S as SubmoduleEntry, x as WalkTreeOptions, w as WalkTreeEntry, z as WalkWorkingTreeOptions, y as WalkWorkingTreeEntry, H as TreeEntry } from './reflog-entry-BbNnXCTC.cjs';
3
+ import { G as GitIndex, a as IndexEntryFlags, I as IndexEntry } from './index-entry-DtEbVpOG.cjs';
36
4
 
37
5
  declare function catFileBatch(ctx: Context, ids: AsyncIterable<ObjectId> | Iterable<ObjectId>, options?: CatFileBatchOptions): AsyncIterable<CatFileBatchEntry>;
38
6
 
@@ -40,18 +8,46 @@ declare function createCommit(ctx: Context, input: CreateCommitInput): Promise<O
40
8
 
41
9
  declare function diffTrees(ctx: Context, a: DiffTreesInput, b: DiffTreesInput, options?: DiffTreesOptions): Promise<TreeDiff>;
42
10
 
11
+ interface HashBlobOptions {
12
+ /** Persist the loose object under `.git/objects/<2>/<38>`. Default `false`. */
13
+ readonly write?: boolean;
14
+ }
15
+ declare const hashBlob: (ctx: Context, content: Uint8Array, opts?: HashBlobOptions) => Promise<ObjectId>;
16
+
17
+ interface IsIgnoredQuery {
18
+ readonly path: FilePath;
19
+ /** Match directory rules (`build/`). Defaults to `false`. */
20
+ readonly isDirectory?: boolean;
21
+ }
22
+ interface IsIgnoredMatchSource {
23
+ readonly kind: 'global' | 'info' | 'gitignore';
24
+ /** POSIX-relative directory whose file carried the rule. `''` for global / info / repo-root gitignore. */
25
+ readonly basedir: FilePath | '';
26
+ /** 1-based line number of the matching rule inside its file. */
27
+ readonly line: number;
28
+ /** Raw pattern text (e.g. `*.log`, `!keep.log`, `build/`). */
29
+ readonly pattern: string;
30
+ }
31
+ interface IsIgnoredMatch {
32
+ readonly path: FilePath;
33
+ readonly ignored: boolean;
34
+ /** Set only when `ignored === true`. */
35
+ readonly source?: IsIgnoredMatchSource;
36
+ }
37
+ declare const isIgnored: (ctx: Context, queries: ReadonlyArray<IsIgnoredQuery>) => Promise<ReadonlyArray<IsIgnoredMatch>>;
38
+
39
+ interface MergeBaseOptions {
40
+ readonly all?: boolean;
41
+ readonly octopus?: boolean;
42
+ }
43
43
  /**
44
- * Compute a merge base — the first commit reachable from BOTH `a` and `b`.
45
- *
46
- * Algorithm: bidirectional BFS with two visited sets. After each layer
47
- * advance, check the intersection. When non-empty, return the
48
- * lexicographically smallest oid (deterministic tie-breaker).
44
+ * Compute merge bases — the best common ancestors of the given commits.
49
45
  *
50
- * Returns `undefined` for unrelated histories. Documented limitation: cherry-picks
51
- * and criss-cross merges may yield non-optimal bases `recursive`-strategy
52
- * multi-base resolution is v2.
46
+ * `commits[0]` is `one`, the rest are the others. Returns the lexicographically
47
+ * smallest single base by default; the full reduced set with `{ all: true }`;
48
+ * the octopus fold with `{ octopus: true }`. Unrelated histories yield `[]`.
53
49
  */
54
- declare const mergeBase: (ctx: Context, a: ObjectId, b: ObjectId) => Promise<ObjectId | undefined>;
50
+ declare const mergeBase: (ctx: Context, commits: readonly ObjectId[], options?: MergeBaseOptions) => Promise<readonly ObjectId[]>;
55
51
 
56
52
  /**
57
53
  * Pure path helpers composing `ctx.layout.gitDir` with known sub-paths.
@@ -102,6 +98,42 @@ interface HookInput {
102
98
  */
103
99
  declare const runHook: (ctx: Context, name: HookName, input?: HookInput) => Promise<void>;
104
100
 
101
+ /**
102
+ * Flip flags (`assumeValid`, `skipWorktree`, `intentToAdd`) on an existing
103
+ * index entry without rehashing. Used by `stash pop`, `mv`, and other
104
+ * porcelain that need to restore flag state after a tree-level operation.
105
+ *
106
+ * The on-disk version is auto-promoted to v3 by `serializeIndex` whenever
107
+ * an extended flag flips true — nothing to manage at the primitive layer
108
+ * (ADR-164).
109
+ */
110
+
111
+ interface SetEntryFlagsOptions {
112
+ readonly breakStaleLockMs?: number;
113
+ }
114
+ declare const setEntryFlags: (ctx: Context, path: FilePath, flags: Partial<IndexEntryFlags>, opts?: SetEntryFlagsOptions) => Promise<IndexEntry>;
115
+
116
+ type StageEntrySource = {
117
+ readonly content: Uint8Array;
118
+ readonly mode?: FileMode;
119
+ } | {
120
+ readonly id: ObjectId;
121
+ readonly mode: FileMode;
122
+ };
123
+ interface StageEntryOptions {
124
+ readonly breakStaleLockMs?: number;
125
+ /** Flags overlay on top of `STAGE0_FLAGS`. Use to seed `intentToAdd` etc. */
126
+ readonly flags?: Partial<IndexEntryFlags>;
127
+ }
128
+ declare const stageEntry: (ctx: Context, path: FilePath, source: StageEntrySource, opts?: StageEntryOptions) => Promise<IndexEntry>;
129
+
130
+ interface UnstageEntryOptions {
131
+ readonly breakStaleLockMs?: number;
132
+ }
133
+ declare const unstageEntry: (ctx: Context, path: FilePath, opts?: UnstageEntryOptions) => Promise<{
134
+ readonly removed: boolean;
135
+ }>;
136
+
105
137
  declare function updateRef(ctx: Context, name: RefName, newId: ObjectId, options: UpdateRefOptions): Promise<void>;
106
138
 
107
139
  declare function walkCommits(ctx: Context, options: WalkCommitsOptions): AsyncIterable<Commit>;
@@ -160,5 +192,5 @@ declare const writeSymbolicRef: (ctx: Context, name: RefName, target: RefName) =
160
192
 
161
193
  declare function writeTree(ctx: Context, entries: ReadonlyArray<TreeEntry>): Promise<ObjectId>;
162
194
 
163
- export { createCommit as a, readIndex as b, catFileBatch as c, diffTrees as d, readObject as e, readTree as f, getRepoRoot as g, recordRefUpdate as h, resolveRef as i, runHook as j, walkSubmodules as k, walkTree as l, mergeBase as m, walkWorkingTree as n, writeObject as o, writeSymbolicRef as p, writeTree as q, readBlob as r, sparseCheckoutPath as s, updateRef as u, walkCommits as w };
164
- export type { GitIndex as G, HookInput as H, IndexEntry as I };
195
+ export { sparseCheckoutPath as E, createCommit as a, readIndex as b, catFileBatch as c, diffTrees as d, readObject as e, readTree as f, getRepoRoot as g, hashBlob as h, isIgnored as i, recordRefUpdate as j, resolveRef as k, runHook as l, mergeBase as m, stageEntry as n, updateRef as o, walkSubmodules as p, walkTree as q, readBlob as r, setEntryFlags as s, walkWorkingTree as t, unstageEntry as u, writeObject as v, walkCommits as w, writeSymbolicRef as x, writeTree as y };
196
+ export type { IsIgnoredMatchSource as A, IsIgnoredQuery as B, StageEntryOptions as C, StageEntrySource as D, HashBlobOptions as H, IsIgnoredMatch as I, SetEntryFlagsOptions as S, UnstageEntryOptions as U, HookInput as z };
@@ -1,38 +1,6 @@
1
- import { O as ObjectId, d as FilePath, b as Context, R as RefName, h as HookName } from './context-BORy7yXb.js';
2
- import { F as FileMode, a as CatFileBatchOptions, C as CatFileBatchEntry, c as CreateCommitInput, D as DiffTreesInput, d as DiffTreesOptions, s as TreeDiff, R as ReadObjectOptions, B as Blob, G as GitObject, T as Tree, r as ResolveRefOptions, U as UpdateRefOptions, W as WalkCommitsOptions, b as Commit, v as WalkSubmodulesOptions, S as SubmoduleEntry, x as WalkTreeOptions, w as WalkTreeEntry, z as WalkWorkingTreeOptions, y as WalkWorkingTreeEntry, t as TreeEntry } from './reflog-entry-C2Hsdobk.js';
3
-
4
- interface IndexEntryFlags {
5
- readonly assumeValid: boolean;
6
- readonly stage: 0 | 1 | 2 | 3;
7
- /** Index v3 extended flag — the path is intentionally absent from the working tree. */
8
- readonly skipWorktree: boolean;
9
- /** Index v3 extended flag — `git add -N` placeholder. Modelled for faithful round-tripping. */
10
- readonly intentToAdd: boolean;
11
- }
12
- interface IndexEntry {
13
- readonly ctimeSeconds: number;
14
- readonly ctimeNanoseconds: number;
15
- readonly mtimeSeconds: number;
16
- readonly mtimeNanoseconds: number;
17
- readonly dev: number;
18
- readonly ino: number;
19
- readonly mode: FileMode;
20
- readonly uid: number;
21
- readonly gid: number;
22
- readonly fileSize: number;
23
- readonly id: ObjectId;
24
- readonly flags: IndexEntryFlags;
25
- readonly path: FilePath;
26
- }
27
- interface IndexExtension {
28
- readonly signature: string;
29
- readonly data: Uint8Array;
30
- }
31
- interface GitIndex {
32
- readonly version: 2 | 3;
33
- readonly entries: ReadonlyArray<IndexEntry>;
34
- readonly extensions: ReadonlyArray<IndexExtension>;
35
- }
1
+ import { b as Context, O as ObjectId, c as FilePath, j as RefName, g as HookName } from './context-CCL0_F8R.js';
2
+ import { d as CatFileBatchOptions, C as CatFileBatchEntry, e as CreateCommitInput, D as DiffTreesInput, f as DiffTreesOptions, T as TreeDiff, s as ReadObjectOptions, B as Blob, G as GitObject, a as Tree, t as ResolveRefOptions, F as FileMode, U as UpdateRefOptions, W as WalkCommitsOptions, E as Commit, v as WalkSubmodulesOptions, S as SubmoduleEntry, x as WalkTreeOptions, w as WalkTreeEntry, z as WalkWorkingTreeOptions, y as WalkWorkingTreeEntry, H as TreeEntry } from './reflog-entry-CSzjnZd4.js';
3
+ import { G as GitIndex, a as IndexEntryFlags, I as IndexEntry } from './index-entry-UD4dvtKh.js';
36
4
 
37
5
  declare function catFileBatch(ctx: Context, ids: AsyncIterable<ObjectId> | Iterable<ObjectId>, options?: CatFileBatchOptions): AsyncIterable<CatFileBatchEntry>;
38
6
 
@@ -40,18 +8,46 @@ declare function createCommit(ctx: Context, input: CreateCommitInput): Promise<O
40
8
 
41
9
  declare function diffTrees(ctx: Context, a: DiffTreesInput, b: DiffTreesInput, options?: DiffTreesOptions): Promise<TreeDiff>;
42
10
 
11
+ interface HashBlobOptions {
12
+ /** Persist the loose object under `.git/objects/<2>/<38>`. Default `false`. */
13
+ readonly write?: boolean;
14
+ }
15
+ declare const hashBlob: (ctx: Context, content: Uint8Array, opts?: HashBlobOptions) => Promise<ObjectId>;
16
+
17
+ interface IsIgnoredQuery {
18
+ readonly path: FilePath;
19
+ /** Match directory rules (`build/`). Defaults to `false`. */
20
+ readonly isDirectory?: boolean;
21
+ }
22
+ interface IsIgnoredMatchSource {
23
+ readonly kind: 'global' | 'info' | 'gitignore';
24
+ /** POSIX-relative directory whose file carried the rule. `''` for global / info / repo-root gitignore. */
25
+ readonly basedir: FilePath | '';
26
+ /** 1-based line number of the matching rule inside its file. */
27
+ readonly line: number;
28
+ /** Raw pattern text (e.g. `*.log`, `!keep.log`, `build/`). */
29
+ readonly pattern: string;
30
+ }
31
+ interface IsIgnoredMatch {
32
+ readonly path: FilePath;
33
+ readonly ignored: boolean;
34
+ /** Set only when `ignored === true`. */
35
+ readonly source?: IsIgnoredMatchSource;
36
+ }
37
+ declare const isIgnored: (ctx: Context, queries: ReadonlyArray<IsIgnoredQuery>) => Promise<ReadonlyArray<IsIgnoredMatch>>;
38
+
39
+ interface MergeBaseOptions {
40
+ readonly all?: boolean;
41
+ readonly octopus?: boolean;
42
+ }
43
43
  /**
44
- * Compute a merge base — the first commit reachable from BOTH `a` and `b`.
45
- *
46
- * Algorithm: bidirectional BFS with two visited sets. After each layer
47
- * advance, check the intersection. When non-empty, return the
48
- * lexicographically smallest oid (deterministic tie-breaker).
44
+ * Compute merge bases — the best common ancestors of the given commits.
49
45
  *
50
- * Returns `undefined` for unrelated histories. Documented limitation: cherry-picks
51
- * and criss-cross merges may yield non-optimal bases `recursive`-strategy
52
- * multi-base resolution is v2.
46
+ * `commits[0]` is `one`, the rest are the others. Returns the lexicographically
47
+ * smallest single base by default; the full reduced set with `{ all: true }`;
48
+ * the octopus fold with `{ octopus: true }`. Unrelated histories yield `[]`.
53
49
  */
54
- declare const mergeBase: (ctx: Context, a: ObjectId, b: ObjectId) => Promise<ObjectId | undefined>;
50
+ declare const mergeBase: (ctx: Context, commits: readonly ObjectId[], options?: MergeBaseOptions) => Promise<readonly ObjectId[]>;
55
51
 
56
52
  /**
57
53
  * Pure path helpers composing `ctx.layout.gitDir` with known sub-paths.
@@ -102,6 +98,42 @@ interface HookInput {
102
98
  */
103
99
  declare const runHook: (ctx: Context, name: HookName, input?: HookInput) => Promise<void>;
104
100
 
101
+ /**
102
+ * Flip flags (`assumeValid`, `skipWorktree`, `intentToAdd`) on an existing
103
+ * index entry without rehashing. Used by `stash pop`, `mv`, and other
104
+ * porcelain that need to restore flag state after a tree-level operation.
105
+ *
106
+ * The on-disk version is auto-promoted to v3 by `serializeIndex` whenever
107
+ * an extended flag flips true — nothing to manage at the primitive layer
108
+ * (ADR-164).
109
+ */
110
+
111
+ interface SetEntryFlagsOptions {
112
+ readonly breakStaleLockMs?: number;
113
+ }
114
+ declare const setEntryFlags: (ctx: Context, path: FilePath, flags: Partial<IndexEntryFlags>, opts?: SetEntryFlagsOptions) => Promise<IndexEntry>;
115
+
116
+ type StageEntrySource = {
117
+ readonly content: Uint8Array;
118
+ readonly mode?: FileMode;
119
+ } | {
120
+ readonly id: ObjectId;
121
+ readonly mode: FileMode;
122
+ };
123
+ interface StageEntryOptions {
124
+ readonly breakStaleLockMs?: number;
125
+ /** Flags overlay on top of `STAGE0_FLAGS`. Use to seed `intentToAdd` etc. */
126
+ readonly flags?: Partial<IndexEntryFlags>;
127
+ }
128
+ declare const stageEntry: (ctx: Context, path: FilePath, source: StageEntrySource, opts?: StageEntryOptions) => Promise<IndexEntry>;
129
+
130
+ interface UnstageEntryOptions {
131
+ readonly breakStaleLockMs?: number;
132
+ }
133
+ declare const unstageEntry: (ctx: Context, path: FilePath, opts?: UnstageEntryOptions) => Promise<{
134
+ readonly removed: boolean;
135
+ }>;
136
+
105
137
  declare function updateRef(ctx: Context, name: RefName, newId: ObjectId, options: UpdateRefOptions): Promise<void>;
106
138
 
107
139
  declare function walkCommits(ctx: Context, options: WalkCommitsOptions): AsyncIterable<Commit>;
@@ -160,5 +192,5 @@ declare const writeSymbolicRef: (ctx: Context, name: RefName, target: RefName) =
160
192
 
161
193
  declare function writeTree(ctx: Context, entries: ReadonlyArray<TreeEntry>): Promise<ObjectId>;
162
194
 
163
- export { createCommit as a, readIndex as b, catFileBatch as c, diffTrees as d, readObject as e, readTree as f, getRepoRoot as g, recordRefUpdate as h, resolveRef as i, runHook as j, walkSubmodules as k, walkTree as l, mergeBase as m, walkWorkingTree as n, writeObject as o, writeSymbolicRef as p, writeTree as q, readBlob as r, sparseCheckoutPath as s, updateRef as u, walkCommits as w };
164
- export type { GitIndex as G, HookInput as H, IndexEntry as I };
195
+ export { sparseCheckoutPath as E, createCommit as a, readIndex as b, catFileBatch as c, diffTrees as d, readObject as e, readTree as f, getRepoRoot as g, hashBlob as h, isIgnored as i, recordRefUpdate as j, resolveRef as k, runHook as l, mergeBase as m, stageEntry as n, updateRef as o, walkSubmodules as p, walkTree as q, readBlob as r, setEntryFlags as s, walkWorkingTree as t, unstageEntry as u, writeObject as v, walkCommits as w, writeSymbolicRef as x, writeTree as y };
196
+ export type { IsIgnoredMatchSource as A, IsIgnoredQuery as B, StageEntryOptions as C, StageEntrySource as D, HashBlobOptions as H, IsIgnoredMatch as I, SetEntryFlagsOptions as S, UnstageEntryOptions as U, HookInput as z };