@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,89 @@
1
+ import { add, branch, checkout, clone, commit, diff, fetch, init, log, merge, push, reset, revParse, rm, status, tag } from '../commands/index.cjs';
2
+ import { createCommit, diffTrees, getRepoRoot, mergeBase, readBlob, readIndex, readObject, readTree, resolveRef, updateRef, walkCommits, walkTree, writeObject, writeSymbolicRef, writeTree } from '../primitives/index.cjs';
3
+ import { F as FileSystem, H as HashService, C as Compressor, R as RepositoryConfig, L as Logger, P as ProgressReporter, a as Context } from './context-Ku1aP8Ie.cjs';
4
+ import { H as HttpTransport } from './http-transport--_NdQOiw.cjs';
5
+
6
+ /**
7
+ * Helper that strips the leading `Context` parameter from a function type so
8
+ * the bound version on `Repository` exposes the user-facing signature.
9
+ */
10
+ type BindCtx<F> = F extends (ctx: Context, ...rest: infer A) => infer R ? (...args: A) => R : never;
11
+ /**
12
+ * User-facing options passed to `openRepository`. Subset of the design's
13
+ * `OpenRepositoryOptions` that this Step 3 implementation honors. Every field
14
+ * is optional; the facade fills sensible defaults. Field-level validation runs
15
+ * eagerly before the Repository is returned (Phase 10 §8.1).
16
+ */
17
+ interface OpenRepositoryOptions {
18
+ /** Working directory. Default: `process.cwd()` on Node, `'/'` on browser/memory. */
19
+ readonly cwd?: string;
20
+ /** Adapter overrides. Each is optional; missing slots fall back to runtime detection. */
21
+ readonly fs?: FileSystem;
22
+ readonly hash?: HashService;
23
+ readonly compressor?: Compressor;
24
+ readonly transport?: HttpTransport;
25
+ /** Repository config (auth, parallelism, SSRF allowlist, etc.). Frozen via deepFreeze. */
26
+ readonly config?: RepositoryConfig;
27
+ /** Logger for diagnostics. Wrapped to prevent mutation post-construction. */
28
+ readonly logger?: Logger;
29
+ /** Progress reporter; defaults to `noopProgress`. */
30
+ readonly progress?: ProgressReporter;
31
+ /** AbortSignal threaded into every bound method's ctx.signal. */
32
+ readonly signal?: AbortSignal;
33
+ /**
34
+ * Opt OUT of adapter validator wrapping for `fs` and `transport`. NEVER set
35
+ * with adapters whose code you do not control; a raw transport receives
36
+ * `config.auth` credentials with no SSRF guard.
37
+ */
38
+ readonly unsafeRawAdapters?: boolean;
39
+ }
40
+ /**
41
+ * The frozen repository handle returned by `openRepository`. Every command
42
+ * and primitive is bound to a Context constructed at facade-creation time;
43
+ * users never see Context except through `repo.ctx`.
44
+ */
45
+ interface Repository {
46
+ readonly add: BindCtx<typeof add>;
47
+ readonly branch: BindCtx<typeof branch>;
48
+ readonly checkout: BindCtx<typeof checkout>;
49
+ readonly clone: BindCtx<typeof clone>;
50
+ readonly commit: BindCtx<typeof commit>;
51
+ readonly diff: BindCtx<typeof diff>;
52
+ readonly fetch: BindCtx<typeof fetch>;
53
+ readonly init: BindCtx<typeof init>;
54
+ readonly log: BindCtx<typeof log>;
55
+ readonly merge: BindCtx<typeof merge>;
56
+ readonly push: BindCtx<typeof push>;
57
+ readonly reset: BindCtx<typeof reset>;
58
+ readonly revParse: BindCtx<typeof revParse>;
59
+ readonly rm: BindCtx<typeof rm>;
60
+ readonly status: BindCtx<typeof status>;
61
+ readonly tag: BindCtx<typeof tag>;
62
+ readonly primitives: {
63
+ readonly createCommit: BindCtx<typeof createCommit>;
64
+ readonly diffTrees: BindCtx<typeof diffTrees>;
65
+ readonly getRepoRoot: BindCtx<typeof getRepoRoot>;
66
+ readonly mergeBase: BindCtx<typeof mergeBase>;
67
+ readonly readBlob: BindCtx<typeof readBlob>;
68
+ readonly readIndex: BindCtx<typeof readIndex>;
69
+ readonly readObject: BindCtx<typeof readObject>;
70
+ readonly readTree: BindCtx<typeof readTree>;
71
+ readonly resolveRef: BindCtx<typeof resolveRef>;
72
+ readonly updateRef: BindCtx<typeof updateRef>;
73
+ readonly walkCommits: BindCtx<typeof walkCommits>;
74
+ readonly walkTree: BindCtx<typeof walkTree>;
75
+ readonly writeObject: BindCtx<typeof writeObject>;
76
+ readonly writeSymbolicRef: BindCtx<typeof writeSymbolicRef>;
77
+ readonly writeTree: BindCtx<typeof writeTree>;
78
+ };
79
+ /** The frozen Context backing every binding. Exposed for advanced use. */
80
+ readonly ctx: Context;
81
+ /**
82
+ * Dispose the repository. Aborts `ctx.signal` synchronously, yields a
83
+ * macrotask, then runs `disposeAdapters`. Idempotent. After dispose
84
+ * resolves, every bound method throws `REPOSITORY_DISPOSED`.
85
+ */
86
+ readonly dispose: () => Promise<void>;
87
+ }
88
+
89
+ export type { OpenRepositoryOptions as O, Repository as R };
@@ -0,0 +1,336 @@
1
+ import { b as FilePath, a as Context, j as RefName, O as ObjectId } from '../chunks/context-Ku1aP8Ie.cjs';
2
+ import { A as AuthorIdentity, T as TreeDiff } from '../chunks/diff-change-BwO75AgS.cjs';
3
+ import '../chunks/http-transport--_NdQOiw.cjs';
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 };