type-git 0.3.0-alpha.3 → 0.4.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.
- package/README.md +43 -12
- package/dist/adapters/bun/index.cjs +6332 -0
- package/dist/adapters/bun/index.cjs.map +1 -1
- package/dist/adapters/bun/index.d.cts +11 -6
- package/dist/adapters/bun/index.d.ts +11 -6
- package/dist/adapters/bun/index.js +6321 -0
- package/dist/adapters/bun/index.js.map +1 -1
- package/dist/adapters/deno/index.cjs +6332 -0
- package/dist/adapters/deno/index.cjs.map +1 -1
- package/dist/adapters/deno/index.d.cts +11 -6
- package/dist/adapters/deno/index.d.ts +11 -6
- package/dist/adapters/deno/index.js +6321 -0
- package/dist/adapters/deno/index.js.map +1 -1
- package/dist/adapters/node/index.cjs +1212 -1085
- package/dist/adapters/node/index.cjs.map +1 -1
- package/dist/adapters/node/index.d.cts +8 -4268
- package/dist/adapters/node/index.d.ts +8 -4268
- package/dist/adapters/node/index.js +1212 -1085
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/client-DAAbUvgo.d.cts +5291 -0
- package/dist/client-DAAbUvgo.d.ts +5291 -0
- package/dist/index.cjs +1199 -1088
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1199 -1088
- package/dist/index.js.map +1 -1
- package/docs/migrations/0.4.0.md +93 -0
- package/package.json +6 -4
- package/dist/adapters-CZ8wj9Kr.d.cts +0 -850
- package/dist/adapters-CZ8wj9Kr.d.ts +0 -850
|
@@ -1,4140 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* stdout parsing utilities for Git output
|
|
5
|
-
*
|
|
6
|
-
* This module provides:
|
|
7
|
-
* - parseLines: Parse newline-separated output
|
|
8
|
-
* - parseRecords: Parse delimited records (NUL-terminated or custom)
|
|
9
|
-
* - parseJson: Parse JSON output
|
|
10
|
-
* - parseKeyValue: Parse key-value pairs
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Parse newline-separated output into lines
|
|
14
|
-
*
|
|
15
|
-
* @param stdout - Raw stdout string
|
|
16
|
-
* @param options - Parse options
|
|
17
|
-
* @returns Array of non-empty lines
|
|
18
|
-
*/
|
|
19
|
-
declare function parseLines(stdout: string, options?: {
|
|
20
|
-
/** Keep empty lines (default: false) */
|
|
21
|
-
keepEmpty?: boolean;
|
|
22
|
-
/** Trim each line (default: true) */
|
|
23
|
-
trim?: boolean;
|
|
24
|
-
}): string[];
|
|
25
|
-
/**
|
|
26
|
-
* Parse delimited records (e.g., NUL-terminated for --format with %x00)
|
|
27
|
-
*
|
|
28
|
-
* @param stdout - Raw stdout string
|
|
29
|
-
* @param delimiter - Record delimiter (default: '\0')
|
|
30
|
-
* @returns Array of records
|
|
31
|
-
*/
|
|
32
|
-
declare function parseRecords(stdout: string, delimiter?: string): string[];
|
|
33
|
-
/**
|
|
34
|
-
* Parse JSON output from git commands
|
|
35
|
-
*
|
|
36
|
-
* @param stdout - Raw stdout string (single JSON object or NDJSON)
|
|
37
|
-
* @param options - Parse options
|
|
38
|
-
* @returns Parsed JSON value(s)
|
|
39
|
-
*/
|
|
40
|
-
declare function parseJson<T = unknown>(stdout: string, options?: {
|
|
41
|
-
/** Parse as newline-delimited JSON (NDJSON) */
|
|
42
|
-
ndjson?: boolean;
|
|
43
|
-
}): T | T[];
|
|
44
|
-
/**
|
|
45
|
-
* Parse key-value pairs from git output
|
|
46
|
-
*
|
|
47
|
-
* Used for parsing config output, show --format output, etc.
|
|
48
|
-
*
|
|
49
|
-
* @param stdout - Raw stdout string
|
|
50
|
-
* @param options - Parse options
|
|
51
|
-
* @returns Map of key-value pairs
|
|
52
|
-
*/
|
|
53
|
-
declare function parseKeyValue(stdout: string, options?: {
|
|
54
|
-
/** Key-value separator (default: '=') */
|
|
55
|
-
separator?: string;
|
|
56
|
-
/** Record delimiter (default: '\n') */
|
|
57
|
-
delimiter?: string;
|
|
58
|
-
}): Map<string, string>;
|
|
59
|
-
/**
|
|
60
|
-
* Parse porcelain v2 status output
|
|
61
|
-
*
|
|
62
|
-
* @param stdout - Raw stdout from `git status --porcelain=v2`
|
|
63
|
-
* @returns Parsed status entries
|
|
64
|
-
*/
|
|
65
|
-
type PorcelainV2Entry = {
|
|
66
|
-
type: 'changed';
|
|
67
|
-
xy: string;
|
|
68
|
-
sub: string;
|
|
69
|
-
mH: string;
|
|
70
|
-
mI: string;
|
|
71
|
-
mW: string;
|
|
72
|
-
hH: string;
|
|
73
|
-
hI: string;
|
|
74
|
-
path: string;
|
|
75
|
-
origPath?: string;
|
|
76
|
-
} | {
|
|
77
|
-
type: 'untracked';
|
|
78
|
-
path: string;
|
|
79
|
-
} | {
|
|
80
|
-
type: 'ignored';
|
|
81
|
-
path: string;
|
|
82
|
-
} | {
|
|
83
|
-
type: 'unmerged';
|
|
84
|
-
xy: string;
|
|
85
|
-
sub: string;
|
|
86
|
-
m1: string;
|
|
87
|
-
m2: string;
|
|
88
|
-
m3: string;
|
|
89
|
-
mW: string;
|
|
90
|
-
h1: string;
|
|
91
|
-
h2: string;
|
|
92
|
-
h3: string;
|
|
93
|
-
path: string;
|
|
94
|
-
};
|
|
95
|
-
declare function parsePorcelainV2(stdout: string): PorcelainV2Entry[];
|
|
96
|
-
/**
|
|
97
|
-
* Parse git progress output from stderr
|
|
98
|
-
*
|
|
99
|
-
* Parses lines like:
|
|
100
|
-
* - "Counting objects: 100% (10/10), done."
|
|
101
|
-
* - "Compressing objects: 50% (4/8)"
|
|
102
|
-
* - "Receiving objects: 10% (1/10)"
|
|
103
|
-
*
|
|
104
|
-
* @param line - Single line from stderr
|
|
105
|
-
* @returns Parsed progress or null if not a progress line
|
|
106
|
-
*/
|
|
107
|
-
type GitProgressInfo = {
|
|
108
|
-
phase: string;
|
|
109
|
-
current: number;
|
|
110
|
-
total: number | null;
|
|
111
|
-
percent: number | null;
|
|
112
|
-
done: boolean;
|
|
113
|
-
};
|
|
114
|
-
declare function parseGitProgress(line: string): GitProgressInfo | null;
|
|
115
|
-
/**
|
|
116
|
-
* Parse LFS progress file line
|
|
117
|
-
*
|
|
118
|
-
* Format: <direction> <oid> <bytes_so_far>/<bytes_total> <bytes_transferred>
|
|
119
|
-
*
|
|
120
|
-
* @param line - Single line from GIT_LFS_PROGRESS file
|
|
121
|
-
* @returns Parsed LFS progress or null if invalid
|
|
122
|
-
*/
|
|
123
|
-
type LfsProgressInfo = {
|
|
124
|
-
direction: 'download' | 'upload' | 'checkout';
|
|
125
|
-
oid: string;
|
|
126
|
-
bytesSoFar: number;
|
|
127
|
-
bytesTotal: number;
|
|
128
|
-
bytesTransferred: number;
|
|
129
|
-
};
|
|
130
|
-
declare function parseLfsProgress(line: string): LfsProgressInfo | null;
|
|
131
|
-
/**
|
|
132
|
-
* Parse git ls-remote output
|
|
133
|
-
*
|
|
134
|
-
* Format: <hash>\t<refname>
|
|
135
|
-
*
|
|
136
|
-
* @param stdout - Raw stdout from `git ls-remote`
|
|
137
|
-
* @returns Parsed refs
|
|
138
|
-
*/
|
|
139
|
-
type LsRemoteRef = {
|
|
140
|
-
hash: string;
|
|
141
|
-
name: string;
|
|
142
|
-
};
|
|
143
|
-
declare function parseLsRemote(stdout: string): LsRemoteRef[];
|
|
144
|
-
/**
|
|
145
|
-
* Object type in a tree
|
|
146
|
-
*/
|
|
147
|
-
type LsTreeObjectType$1 = 'blob' | 'tree' | 'commit';
|
|
148
|
-
/**
|
|
149
|
-
* Entry from git ls-tree output
|
|
150
|
-
*/
|
|
151
|
-
type ParsedLsTreeEntry = {
|
|
152
|
-
/** File mode (e.g., '100644' for regular file, '040000' for directory) */
|
|
153
|
-
mode: string;
|
|
154
|
-
/** Object type: blob (file), tree (directory), or commit (submodule) */
|
|
155
|
-
type: LsTreeObjectType$1;
|
|
156
|
-
/** Object hash (SHA-1 or SHA-256) */
|
|
157
|
-
hash: string;
|
|
158
|
-
/** File path relative to repository root */
|
|
159
|
-
path: string;
|
|
160
|
-
/** Object size in bytes (only for blobs when using --long option) */
|
|
161
|
-
size?: number;
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* Parse git ls-tree output
|
|
165
|
-
*
|
|
166
|
-
* Supports multiple output formats:
|
|
167
|
-
* - Default: <mode> <type> <hash>\t<path>
|
|
168
|
-
* - With --long: <mode> <type> <hash> <size>\t<path>
|
|
169
|
-
* - With --name-only: <path>
|
|
170
|
-
* - With --object-only: <hash>
|
|
171
|
-
*
|
|
172
|
-
* @param stdout - Raw stdout from `git ls-tree`
|
|
173
|
-
* @param opts - Parser options to handle different output modes
|
|
174
|
-
* @returns Parsed tree entries
|
|
175
|
-
*/
|
|
176
|
-
declare function parseLsTree(stdout: string, opts?: {
|
|
177
|
-
nameOnly?: boolean;
|
|
178
|
-
objectOnly?: boolean;
|
|
179
|
-
long?: boolean;
|
|
180
|
-
}): ParsedLsTreeEntry[];
|
|
181
|
-
/**
|
|
182
|
-
* Commit information from git log
|
|
183
|
-
*/
|
|
184
|
-
type ParsedCommit = {
|
|
185
|
-
hash: string;
|
|
186
|
-
abbrevHash: string;
|
|
187
|
-
parents: string[];
|
|
188
|
-
authorName: string;
|
|
189
|
-
authorEmail: string;
|
|
190
|
-
authorTimestamp: number;
|
|
191
|
-
committerName: string;
|
|
192
|
-
committerEmail: string;
|
|
193
|
-
committerTimestamp: number;
|
|
194
|
-
subject: string;
|
|
195
|
-
body: string;
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* The format string used for git log parsing
|
|
199
|
-
*
|
|
200
|
-
* Uses %x00 (NUL) as field separator and %x01 as record separator
|
|
201
|
-
*/
|
|
202
|
-
declare const GIT_LOG_FORMAT = "%H%x00%h%x00%P%x00%an%x00%ae%x00%at%x00%cn%x00%ce%x00%ct%x00%s%x00%b%x01";
|
|
203
|
-
/**
|
|
204
|
-
* Parse git log output with our custom format
|
|
205
|
-
*
|
|
206
|
-
* @param stdout - Raw stdout from `git log --format=<GIT_LOG_FORMAT>`
|
|
207
|
-
* @returns Parsed commits
|
|
208
|
-
*/
|
|
209
|
-
declare function parseGitLog(stdout: string): ParsedCommit[];
|
|
210
|
-
/**
|
|
211
|
-
* Worktree information from git worktree list --porcelain
|
|
212
|
-
*/
|
|
213
|
-
type ParsedWorktree = {
|
|
214
|
-
path: string;
|
|
215
|
-
head: string;
|
|
216
|
-
branch?: string;
|
|
217
|
-
locked: boolean;
|
|
218
|
-
prunable: boolean;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Parse git worktree list --porcelain output
|
|
222
|
-
*
|
|
223
|
-
* Format:
|
|
224
|
-
* worktree /path/to/worktree
|
|
225
|
-
* HEAD <sha>
|
|
226
|
-
* branch refs/heads/main
|
|
227
|
-
* [locked [reason]]
|
|
228
|
-
* [prunable]
|
|
229
|
-
*
|
|
230
|
-
* @param stdout - Raw stdout from `git worktree list --porcelain`
|
|
231
|
-
* @returns Parsed worktrees
|
|
232
|
-
*/
|
|
233
|
-
declare function parseWorktreeList(stdout: string): ParsedWorktree[];
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Detect error category from stderr content (§13.3)
|
|
237
|
-
*
|
|
238
|
-
* @param stderr - stderr content from git command
|
|
239
|
-
* @returns Detected error category
|
|
240
|
-
*/
|
|
241
|
-
declare function detectErrorCategory(stderr: string): GitErrorCategory;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Repository interfaces - operations that require a repository context
|
|
245
|
-
*/
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Base repository interface
|
|
249
|
-
*/
|
|
250
|
-
interface RepoBase {
|
|
251
|
-
/**
|
|
252
|
-
* Execute a raw git command in this repository context
|
|
253
|
-
*
|
|
254
|
-
* Wraps: `git <argv...>`
|
|
255
|
-
*/
|
|
256
|
-
raw(argv: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
257
|
-
/**
|
|
258
|
-
* Check if this repository is a worktree repository (has working directory)
|
|
259
|
-
*
|
|
260
|
-
* Wraps: `git rev-parse --is-inside-work-tree`
|
|
261
|
-
*
|
|
262
|
-
* This is a runtime check that queries git to determine the repository type.
|
|
263
|
-
* Note: TypeScript cannot automatically narrow the type based on this check
|
|
264
|
-
* since it returns `Promise<boolean>`. Use type assertions after checking.
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* ```typescript
|
|
268
|
-
* const repo = await git.openRaw('/path/to/repo');
|
|
269
|
-
* if (await repo.isWorktree()) {
|
|
270
|
-
* // Use type assertion to access WorktreeRepo methods
|
|
271
|
-
* const status = await (repo as WorktreeRepo).status();
|
|
272
|
-
* }
|
|
273
|
-
* ```
|
|
274
|
-
*/
|
|
275
|
-
isWorktree(): Promise<boolean>;
|
|
276
|
-
/**
|
|
277
|
-
* Check if this repository is a bare repository (no working directory)
|
|
278
|
-
*
|
|
279
|
-
* Wraps: `git rev-parse --is-bare-repository`
|
|
280
|
-
*
|
|
281
|
-
* This is a runtime check that queries git to determine the repository type.
|
|
282
|
-
* Note: TypeScript cannot automatically narrow the type based on this check
|
|
283
|
-
* since it returns `Promise<boolean>`. Use type assertions after checking.
|
|
284
|
-
*
|
|
285
|
-
* @example
|
|
286
|
-
* ```typescript
|
|
287
|
-
* const repo = await git.openRaw('/path/to/repo');
|
|
288
|
-
* if (await repo.isBare()) {
|
|
289
|
-
* // Use type assertion to access BareRepo methods
|
|
290
|
-
* await (repo as BareRepo).fetch({ remote: 'origin' });
|
|
291
|
-
* }
|
|
292
|
-
* ```
|
|
293
|
-
*/
|
|
294
|
-
isBare(): Promise<boolean>;
|
|
295
|
-
/**
|
|
296
|
-
* List references in a remote repository
|
|
297
|
-
*
|
|
298
|
-
* Wraps: `git ls-remote <remote> [refs...]`
|
|
299
|
-
*
|
|
300
|
-
* Unlike the global `git.lsRemote(url)`, this method operates in the context
|
|
301
|
-
* of a repository and accepts a remote name (e.g., 'origin') instead of a URL.
|
|
302
|
-
*
|
|
303
|
-
* @example
|
|
304
|
-
* ```typescript
|
|
305
|
-
* // List all refs from origin
|
|
306
|
-
* const result = await repo.lsRemote('origin');
|
|
307
|
-
*
|
|
308
|
-
* // List specific branch
|
|
309
|
-
* const result = await repo.lsRemote('origin', { refs: ['main'] });
|
|
310
|
-
*
|
|
311
|
-
* // List only tags
|
|
312
|
-
* const result = await repo.lsRemote('origin', { tags: true });
|
|
313
|
-
* ```
|
|
314
|
-
*/
|
|
315
|
-
lsRemote(remote: string, opts?: RepoLsRemoteOpts & ExecOpts): Promise<RepoLsRemoteResult>;
|
|
316
|
-
/**
|
|
317
|
-
* List contents of a tree object
|
|
318
|
-
*
|
|
319
|
-
* Wraps: `git ls-tree <tree-ish> [<path>...]`
|
|
320
|
-
*
|
|
321
|
-
* Lists the contents of a given tree object (commit, tag, or tree hash).
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* ```typescript
|
|
325
|
-
* // List all files in HEAD
|
|
326
|
-
* const entries = await repo.lsTree('HEAD');
|
|
327
|
-
*
|
|
328
|
-
* // List files recursively with names only
|
|
329
|
-
* const names = await repo.lsTree('HEAD', { recursive: true, nameOnly: true });
|
|
330
|
-
*
|
|
331
|
-
* // List files in a specific directory
|
|
332
|
-
* const entries = await repo.lsTree('main', { paths: ['src/'] });
|
|
333
|
-
*
|
|
334
|
-
* // Get file sizes
|
|
335
|
-
* const entries = await repo.lsTree('HEAD', { long: true });
|
|
336
|
-
* ```
|
|
337
|
-
*/
|
|
338
|
-
lsTree(treeish: string, opts?: LsTreeOpts & ExecOpts): Promise<LsTreeEntry[]>;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Options for repository-scoped git ls-remote
|
|
342
|
-
*/
|
|
343
|
-
type RepoLsRemoteOpts = {
|
|
344
|
-
/** Limit to refs/heads (branches) */
|
|
345
|
-
heads?: boolean;
|
|
346
|
-
/** Limit to refs/tags */
|
|
347
|
-
tags?: boolean;
|
|
348
|
-
/** Show only actual refs (not peeled tags) */
|
|
349
|
-
refsOnly?: boolean;
|
|
350
|
-
/** Show remote URL instead of listing refs */
|
|
351
|
-
getUrl?: boolean;
|
|
352
|
-
/** Sort refs by the given key (e.g., 'version:refname') */
|
|
353
|
-
sort?: string;
|
|
354
|
-
/** Show symbolic refs in addition to object refs */
|
|
355
|
-
symref?: boolean;
|
|
356
|
-
/** Specific refs to query (branch names, tag names, or full ref paths) */
|
|
357
|
-
refs?: string[];
|
|
358
|
-
};
|
|
359
|
-
/**
|
|
360
|
-
* Result from repository-scoped git ls-remote
|
|
361
|
-
*/
|
|
362
|
-
type RepoLsRemoteResult = {
|
|
363
|
-
refs: LsRemoteRef[];
|
|
364
|
-
};
|
|
365
|
-
/**
|
|
366
|
-
* Object type in a tree
|
|
367
|
-
*/
|
|
368
|
-
type LsTreeObjectType = 'blob' | 'tree' | 'commit';
|
|
369
|
-
/**
|
|
370
|
-
* Entry from git ls-tree output
|
|
371
|
-
*/
|
|
372
|
-
type LsTreeEntry = {
|
|
373
|
-
/** File mode (e.g., '100644' for regular file, '040000' for directory) */
|
|
374
|
-
mode: string;
|
|
375
|
-
/** Object type: blob (file), tree (directory), or commit (submodule) */
|
|
376
|
-
type: LsTreeObjectType;
|
|
377
|
-
/** Object hash (SHA-1 or SHA-256) */
|
|
378
|
-
hash: string;
|
|
379
|
-
/** File path relative to repository root */
|
|
380
|
-
path: string;
|
|
381
|
-
/** Object size in bytes (only for blobs when using --long option) */
|
|
382
|
-
size?: number;
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
* Options for git ls-tree
|
|
386
|
-
*/
|
|
387
|
-
type LsTreeOpts = {
|
|
388
|
-
/** Recurse into sub-trees (-r) */
|
|
389
|
-
recursive?: boolean;
|
|
390
|
-
/** Show only the named tree entry itself, not its children (-d) */
|
|
391
|
-
treeOnly?: boolean;
|
|
392
|
-
/** Show tree entries even when recursing (-t) */
|
|
393
|
-
showTrees?: boolean;
|
|
394
|
-
/** Show object size of blob entries (--long / -l) */
|
|
395
|
-
long?: boolean;
|
|
396
|
-
/** List only filenames (--name-only) */
|
|
397
|
-
nameOnly?: boolean;
|
|
398
|
-
/** List only object names/hashes (--object-only) */
|
|
399
|
-
objectOnly?: boolean;
|
|
400
|
-
/** Show full path names (--full-name) */
|
|
401
|
-
fullName?: boolean;
|
|
402
|
-
/** Do not limit listing to current working directory (--full-tree) */
|
|
403
|
-
fullTree?: boolean;
|
|
404
|
-
/** Abbreviate object names to at least n hexdigits (--abbrev) */
|
|
405
|
-
abbrev?: number | boolean;
|
|
406
|
-
/** Paths to filter (optional patterns to match) */
|
|
407
|
-
paths?: string[];
|
|
408
|
-
};
|
|
409
|
-
/**
|
|
410
|
-
* Status file entry
|
|
411
|
-
*/
|
|
412
|
-
type StatusEntry = {
|
|
413
|
-
path: string;
|
|
414
|
-
index: string;
|
|
415
|
-
workdir: string;
|
|
416
|
-
originalPath?: string;
|
|
417
|
-
};
|
|
418
|
-
/**
|
|
419
|
-
* Result from git status --porcelain
|
|
420
|
-
*/
|
|
421
|
-
type StatusPorcelain = {
|
|
422
|
-
entries: StatusEntry[];
|
|
423
|
-
branch?: string;
|
|
424
|
-
upstream?: string;
|
|
425
|
-
ahead?: number;
|
|
426
|
-
behind?: number;
|
|
427
|
-
};
|
|
428
|
-
/**
|
|
429
|
-
* Options for git status
|
|
430
|
-
*/
|
|
431
|
-
type StatusOpts = {
|
|
432
|
-
/** Porcelain output format version (1 or 2) */
|
|
433
|
-
porcelain?: 1 | 2;
|
|
434
|
-
/** How to show untracked files */
|
|
435
|
-
untracked?: 'no' | 'normal' | 'all';
|
|
436
|
-
/** Give the output in verbose format */
|
|
437
|
-
verbose?: boolean;
|
|
438
|
-
/** Show stash information */
|
|
439
|
-
showStash?: boolean;
|
|
440
|
-
/** Compute ahead/behind counts for the branch */
|
|
441
|
-
aheadBehind?: boolean;
|
|
442
|
-
/** Use NUL as line terminator */
|
|
443
|
-
nullTerminated?: boolean;
|
|
444
|
-
/** How to show ignored files */
|
|
445
|
-
ignored?: 'traditional' | 'no' | 'matching';
|
|
446
|
-
/** How to handle submodules */
|
|
447
|
-
ignoreSubmodules?: 'none' | 'untracked' | 'dirty' | 'all';
|
|
448
|
-
/** Do not detect renames */
|
|
449
|
-
noRenames?: boolean;
|
|
450
|
-
/** Detect renames (optionally with similarity threshold) */
|
|
451
|
-
findRenames?: boolean | number;
|
|
452
|
-
};
|
|
453
|
-
/**
|
|
454
|
-
* Commit information
|
|
455
|
-
*/
|
|
456
|
-
type Commit = {
|
|
457
|
-
hash: string;
|
|
458
|
-
abbrevHash: string;
|
|
459
|
-
parents: string[];
|
|
460
|
-
author: {
|
|
461
|
-
name: string;
|
|
462
|
-
email: string;
|
|
463
|
-
timestamp: number;
|
|
464
|
-
};
|
|
465
|
-
committer: {
|
|
466
|
-
name: string;
|
|
467
|
-
email: string;
|
|
468
|
-
timestamp: number;
|
|
469
|
-
};
|
|
470
|
-
subject: string;
|
|
471
|
-
body: string;
|
|
472
|
-
};
|
|
473
|
-
/**
|
|
474
|
-
* Options for git log
|
|
475
|
-
*/
|
|
476
|
-
type LogOpts = {
|
|
477
|
-
/** Limit the number of commits to output */
|
|
478
|
-
maxCount?: number;
|
|
479
|
-
/** Skip number of commits before starting to show the output */
|
|
480
|
-
skip?: number;
|
|
481
|
-
/** Show commits more recent than a specific date */
|
|
482
|
-
since?: string | Date;
|
|
483
|
-
/** Show commits older than a specific date */
|
|
484
|
-
until?: string | Date;
|
|
485
|
-
/** Limit commits to those by a specific author */
|
|
486
|
-
author?: string;
|
|
487
|
-
/** Limit commits to those with log message matching the pattern */
|
|
488
|
-
grep?: string;
|
|
489
|
-
/** Pretend as if all refs are listed on the command line */
|
|
490
|
-
all?: boolean;
|
|
491
|
-
/** Follow only the first parent commit upon seeing a merge commit */
|
|
492
|
-
firstParent?: boolean;
|
|
493
|
-
/** Print out the ref name given on the command line by which each commit was reached */
|
|
494
|
-
source?: boolean;
|
|
495
|
-
/** Use mailmap file to map author names */
|
|
496
|
-
useMailmap?: boolean;
|
|
497
|
-
/** If no --decorate-refs is given, pretend as if all refs were included */
|
|
498
|
-
decorateRefs?: string;
|
|
499
|
-
/** Do not include refs matching the pattern */
|
|
500
|
-
decorateRefsExclude?: string;
|
|
501
|
-
/** Print out the ref names of any commits that are shown */
|
|
502
|
-
decorate?: 'short' | 'full' | 'auto' | 'no';
|
|
503
|
-
/** Generate a diffstat */
|
|
504
|
-
stat?: boolean;
|
|
505
|
-
/** Output only the last line of the stat */
|
|
506
|
-
shortstat?: boolean;
|
|
507
|
-
/** Show only names of changed files */
|
|
508
|
-
nameOnly?: boolean;
|
|
509
|
-
/** Show only names and status of changed files */
|
|
510
|
-
nameStatus?: boolean;
|
|
511
|
-
/** Show only merge commits */
|
|
512
|
-
merges?: boolean;
|
|
513
|
-
/** Do not show merge commits */
|
|
514
|
-
noMerges?: boolean;
|
|
515
|
-
/** Only display commits that are ancestors of the specified commit */
|
|
516
|
-
ancestryPath?: boolean;
|
|
517
|
-
/** Output commits in reverse order */
|
|
518
|
-
reverse?: boolean;
|
|
519
|
-
/** Alias for since */
|
|
520
|
-
after?: string | Date;
|
|
521
|
-
/** Alias for until */
|
|
522
|
-
before?: string | Date;
|
|
523
|
-
/** Revision or revision range to show (e.g., 'main', 'HEAD~5..HEAD', 'v1.0.0') */
|
|
524
|
-
ref?: string;
|
|
525
|
-
};
|
|
526
|
-
/**
|
|
527
|
-
* Options for git fetch
|
|
528
|
-
*/
|
|
529
|
-
type FetchOpts = {
|
|
530
|
-
/** Remote name to fetch from */
|
|
531
|
-
remote?: string;
|
|
532
|
-
/** Refspec(s) to fetch */
|
|
533
|
-
refspec?: string | string[];
|
|
534
|
-
/** Remove remote-tracking refs that no longer exist on the remote */
|
|
535
|
-
prune?: boolean;
|
|
536
|
-
/** Fetch all tags from the remote */
|
|
537
|
-
tags?: boolean;
|
|
538
|
-
/** Limit fetching to the specified number of commits */
|
|
539
|
-
depth?: number;
|
|
540
|
-
/** Be more verbose */
|
|
541
|
-
verbose?: boolean;
|
|
542
|
-
/** Operate quietly (suppress progress reporting) */
|
|
543
|
-
quiet?: boolean;
|
|
544
|
-
/** Fetch from all remotes */
|
|
545
|
-
all?: boolean;
|
|
546
|
-
/** Set upstream tracking for the fetched branches */
|
|
547
|
-
setUpstream?: boolean;
|
|
548
|
-
/** Append ref names and object names of fetched refs to .git/FETCH_HEAD */
|
|
549
|
-
append?: boolean;
|
|
550
|
-
/** Use atomic transaction to update refs */
|
|
551
|
-
atomic?: boolean;
|
|
552
|
-
/** Force update of local branches */
|
|
553
|
-
force?: boolean;
|
|
554
|
-
/** Allow fetching from multiple remotes */
|
|
555
|
-
multiple?: boolean;
|
|
556
|
-
/** Do not fetch any tags */
|
|
557
|
-
noTags?: boolean;
|
|
558
|
-
/** Number of parallel children for fetching submodules */
|
|
559
|
-
jobs?: number;
|
|
560
|
-
/** Modify the configured refspec to place all refs into refs/prefetch/ */
|
|
561
|
-
prefetch?: boolean;
|
|
562
|
-
/** Also prune tags that are no longer on the remote */
|
|
563
|
-
pruneTags?: boolean;
|
|
564
|
-
/** Fetch submodules recursively */
|
|
565
|
-
recurseSubmodules?: boolean | 'yes' | 'on-demand' | 'no';
|
|
566
|
-
/** Dry run - show what would be done without making changes */
|
|
567
|
-
dryRun?: boolean;
|
|
568
|
-
/** Allow updating FETCH_HEAD */
|
|
569
|
-
writeFetchHead?: boolean;
|
|
570
|
-
/** Keep downloaded pack */
|
|
571
|
-
keep?: boolean;
|
|
572
|
-
/** Allow updating the current branch head */
|
|
573
|
-
updateHeadOk?: boolean;
|
|
574
|
-
/** Deepen a shallow repository by date */
|
|
575
|
-
shallowSince?: string | Date;
|
|
576
|
-
/** Deepen a shallow repository excluding specified revision */
|
|
577
|
-
shallowExclude?: string | string[];
|
|
578
|
-
/** Deepen a shallow repository by specified number of commits */
|
|
579
|
-
deepen?: number;
|
|
580
|
-
/** Convert a shallow repository to a complete one */
|
|
581
|
-
unshallow?: boolean;
|
|
582
|
-
/** Re-fetch all objects even if we already have them */
|
|
583
|
-
refetch?: boolean;
|
|
584
|
-
/** Update shallow boundary if new refs need it */
|
|
585
|
-
updateShallow?: boolean;
|
|
586
|
-
/** Override the default refspec */
|
|
587
|
-
refmap?: string;
|
|
588
|
-
/** Use IPv4 addresses only */
|
|
589
|
-
ipv4?: boolean;
|
|
590
|
-
/** Use IPv6 addresses only */
|
|
591
|
-
ipv6?: boolean;
|
|
592
|
-
/** Partial clone filter specification */
|
|
593
|
-
filter?: string;
|
|
594
|
-
/** Check for forced updates */
|
|
595
|
-
showForcedUpdates?: boolean;
|
|
596
|
-
/** Write commit graph after fetching */
|
|
597
|
-
writeCommitGraph?: boolean;
|
|
598
|
-
};
|
|
599
|
-
/**
|
|
600
|
-
* Force with lease options for git push
|
|
601
|
-
*/
|
|
602
|
-
type ForceWithLeaseOpts = {
|
|
603
|
-
/** Reference name to check (e.g., 'refs/heads/main') */
|
|
604
|
-
refname: string;
|
|
605
|
-
/** Expected value of the ref (commit hash) */
|
|
606
|
-
expect?: string;
|
|
607
|
-
};
|
|
608
|
-
/**
|
|
609
|
-
* Options for git push
|
|
610
|
-
*/
|
|
611
|
-
type PushOpts = {
|
|
612
|
-
/** Remote name to push to */
|
|
613
|
-
remote?: string;
|
|
614
|
-
/** Refspec(s) to push */
|
|
615
|
-
refspec?: string | string[];
|
|
616
|
-
/** Force updates even if they are not fast-forward */
|
|
617
|
-
force?: boolean;
|
|
618
|
-
/**
|
|
619
|
-
* Force with lease - safer force push that fails if remote has been updated
|
|
620
|
-
* - true: use default behavior (check current remote ref)
|
|
621
|
-
* - ForceWithLeaseOpts: specify refname and optional expected value
|
|
622
|
-
*/
|
|
623
|
-
forceWithLease?: boolean | ForceWithLeaseOpts;
|
|
624
|
-
/** Push all tags */
|
|
625
|
-
tags?: boolean;
|
|
626
|
-
/** Set upstream tracking for the pushed branches */
|
|
627
|
-
setUpstream?: boolean;
|
|
628
|
-
/** Bypass pre-push hook */
|
|
629
|
-
noVerify?: boolean;
|
|
630
|
-
/**
|
|
631
|
-
* GPG-sign the push (for signed pushes)
|
|
632
|
-
* - true: sign with default key
|
|
633
|
-
* - 'if-asked': sign only if server supports and requests it
|
|
634
|
-
*/
|
|
635
|
-
signed?: boolean | 'if-asked';
|
|
636
|
-
/** Be more verbose */
|
|
637
|
-
verbose?: boolean;
|
|
638
|
-
/** Operate quietly (suppress progress reporting) */
|
|
639
|
-
quiet?: boolean;
|
|
640
|
-
/** Override the default repository */
|
|
641
|
-
repo?: string;
|
|
642
|
-
/** Push all branches */
|
|
643
|
-
all?: boolean;
|
|
644
|
-
/** Push all branches (alias for all) */
|
|
645
|
-
branches?: boolean;
|
|
646
|
-
/** Mirror mode - push all refs */
|
|
647
|
-
mirror?: boolean;
|
|
648
|
-
/** Delete the specified refs from the remote */
|
|
649
|
-
deleteRefs?: boolean;
|
|
650
|
-
/** Dry run - show what would be pushed without pushing */
|
|
651
|
-
dryRun?: boolean;
|
|
652
|
-
/** Force only if the remote tip is included in local history */
|
|
653
|
-
forceIfIncludes?: boolean;
|
|
654
|
-
/** Push submodules recursively */
|
|
655
|
-
recurseSubmodules?: 'check' | 'on-demand' | 'only' | 'no';
|
|
656
|
-
/** Use thin pack transfer */
|
|
657
|
-
thin?: boolean;
|
|
658
|
-
/** Prune remote-tracking branches that are deleted locally */
|
|
659
|
-
prune?: boolean;
|
|
660
|
-
/** Push all refs under refs/tags with the commits */
|
|
661
|
-
followTags?: boolean;
|
|
662
|
-
/** Use atomic transaction to update refs */
|
|
663
|
-
atomic?: boolean;
|
|
664
|
-
/** Transmit push options to the server */
|
|
665
|
-
pushOption?: string | string[];
|
|
666
|
-
/** Use IPv4 addresses only */
|
|
667
|
-
ipv4?: boolean;
|
|
668
|
-
/** Use IPv6 addresses only */
|
|
669
|
-
ipv6?: boolean;
|
|
670
|
-
};
|
|
671
|
-
/**
|
|
672
|
-
* Options for git add
|
|
673
|
-
*/
|
|
674
|
-
type AddOpts = {
|
|
675
|
-
/** Add all files (including untracked) */
|
|
676
|
-
all?: boolean;
|
|
677
|
-
/** Dry run - show what would be added */
|
|
678
|
-
dryRun?: boolean;
|
|
679
|
-
/** Add modified and deleted files, but not untracked */
|
|
680
|
-
update?: boolean;
|
|
681
|
-
/** Force add of ignored files */
|
|
682
|
-
force?: boolean;
|
|
683
|
-
/** Add changes interactively (not supported - use raw) */
|
|
684
|
-
interactive?: never;
|
|
685
|
-
/** Add changes in patch mode (not supported - use raw) */
|
|
686
|
-
patch?: never;
|
|
687
|
-
/** Be verbose */
|
|
688
|
-
verbose?: boolean;
|
|
689
|
-
/** Record only the fact that the path will be added later */
|
|
690
|
-
intentToAdd?: boolean;
|
|
691
|
-
/** Apply the clean process freshly to all tracked files */
|
|
692
|
-
renormalize?: boolean;
|
|
693
|
-
/** Ignore removal of files from working tree */
|
|
694
|
-
ignoreRemoval?: boolean;
|
|
695
|
-
/** Don't add files, just refresh their stat info in the index */
|
|
696
|
-
refresh?: boolean;
|
|
697
|
-
/** If some files could not be added, continue adding others */
|
|
698
|
-
ignoreErrors?: boolean;
|
|
699
|
-
/** Don't report missing files (with --dry-run) */
|
|
700
|
-
ignoreMissing?: boolean;
|
|
701
|
-
/** Allow updating index entries outside of sparse-checkout cone */
|
|
702
|
-
sparse?: boolean;
|
|
703
|
-
/** Override the executable bit of the listed files */
|
|
704
|
-
chmod?: '+x' | '-x';
|
|
705
|
-
/** Read pathspecs from file instead of command line */
|
|
706
|
-
pathspecFromFile?: string;
|
|
707
|
-
};
|
|
708
|
-
/**
|
|
709
|
-
* Branch information
|
|
710
|
-
*/
|
|
711
|
-
type BranchInfo = {
|
|
712
|
-
name: string;
|
|
713
|
-
current: boolean;
|
|
714
|
-
commit: string;
|
|
715
|
-
upstream?: string;
|
|
716
|
-
gone?: boolean;
|
|
717
|
-
};
|
|
718
|
-
/**
|
|
719
|
-
* Options for git branch
|
|
720
|
-
*/
|
|
721
|
-
type BranchOpts = {
|
|
722
|
-
/** List all branches (including remote) */
|
|
723
|
-
all?: boolean;
|
|
724
|
-
/** List remote branches only */
|
|
725
|
-
remotes?: boolean;
|
|
726
|
-
/** Show verbose info */
|
|
727
|
-
verbose?: boolean;
|
|
728
|
-
/** Suppress informational messages */
|
|
729
|
-
quiet?: boolean;
|
|
730
|
-
/** Only list branches that contain the specified commit */
|
|
731
|
-
contains?: string;
|
|
732
|
-
/** Only list branches that don't contain the specified commit */
|
|
733
|
-
noContains?: string;
|
|
734
|
-
/** Abbreviate object names to specified length */
|
|
735
|
-
abbrev?: number;
|
|
736
|
-
/** Only list branches whose tips are reachable from the specified commit */
|
|
737
|
-
merged?: string;
|
|
738
|
-
/** Only list branches whose tips are not reachable from the specified commit */
|
|
739
|
-
noMerged?: string;
|
|
740
|
-
/** Sorting key (e.g., -committerdate, refname) */
|
|
741
|
-
sort?: string;
|
|
742
|
-
/** Only list branches that point at the specified object */
|
|
743
|
-
pointsAt?: string;
|
|
744
|
-
/** Sorting and filtering are case insensitive */
|
|
745
|
-
ignoreCase?: boolean;
|
|
746
|
-
};
|
|
747
|
-
/**
|
|
748
|
-
* Options for creating a branch
|
|
749
|
-
*/
|
|
750
|
-
type BranchCreateOpts = {
|
|
751
|
-
/** Start point (commit, branch, or tag) */
|
|
752
|
-
startPoint?: string;
|
|
753
|
-
/** Force creation (overwrite existing) */
|
|
754
|
-
force?: boolean;
|
|
755
|
-
/** Set up tracking */
|
|
756
|
-
track?: boolean;
|
|
757
|
-
/** Set up upstream configuration for the new branch */
|
|
758
|
-
setUpstreamTo?: string;
|
|
759
|
-
/** Create the branch's reflog */
|
|
760
|
-
createReflog?: boolean;
|
|
761
|
-
/** Also update submodules */
|
|
762
|
-
recurseSubmodules?: boolean;
|
|
763
|
-
};
|
|
764
|
-
/**
|
|
765
|
-
* Options for deleting a branch
|
|
766
|
-
*/
|
|
767
|
-
type BranchDeleteOpts = {
|
|
768
|
-
/** Force delete (even if not merged) */
|
|
769
|
-
force?: boolean;
|
|
770
|
-
/** Delete remote-tracking branch */
|
|
771
|
-
remote?: boolean;
|
|
772
|
-
};
|
|
773
|
-
/**
|
|
774
|
-
* Options for git checkout (branch switching mode)
|
|
775
|
-
*
|
|
776
|
-
* Used for: `git checkout <branch>`
|
|
777
|
-
*/
|
|
778
|
-
type CheckoutBranchOpts = {
|
|
779
|
-
/** Force checkout (discard local changes) */
|
|
780
|
-
force?: boolean;
|
|
781
|
-
/** Create new branch */
|
|
782
|
-
createBranch?: boolean;
|
|
783
|
-
/** Start point for new branch */
|
|
784
|
-
startPoint?: string;
|
|
785
|
-
/** Track remote branch */
|
|
786
|
-
track?: boolean;
|
|
787
|
-
/** Create or reset and checkout branch (like -b but forces) */
|
|
788
|
-
forceCreateBranch?: boolean;
|
|
789
|
-
/** Create reflog for new branch */
|
|
790
|
-
createReflog?: boolean;
|
|
791
|
-
/** Try to guess remote tracking branch if target not found */
|
|
792
|
-
guess?: boolean;
|
|
793
|
-
/** Suppress progress reporting */
|
|
794
|
-
quiet?: boolean;
|
|
795
|
-
/** Update submodules */
|
|
796
|
-
recurseSubmodules?: boolean;
|
|
797
|
-
/** Merge local modifications with the new branch */
|
|
798
|
-
merge?: boolean;
|
|
799
|
-
/** Conflict style for merge conflicts */
|
|
800
|
-
conflict?: 'merge' | 'diff3' | 'zdiff3';
|
|
801
|
-
/** Detach HEAD at specified commit */
|
|
802
|
-
detach?: boolean;
|
|
803
|
-
/** Create new orphan branch */
|
|
804
|
-
orphan?: boolean;
|
|
805
|
-
/** Silently overwrite ignored files */
|
|
806
|
-
overwriteIgnore?: boolean;
|
|
807
|
-
/** Ignore if branch is checked out in other worktrees */
|
|
808
|
-
ignoreOtherWorktrees?: boolean;
|
|
809
|
-
};
|
|
810
|
-
/**
|
|
811
|
-
* Options for git checkout (pathspec mode)
|
|
812
|
-
*
|
|
813
|
-
* Used for: `git checkout [<tree-ish>] -- <pathspec>...`
|
|
814
|
-
*/
|
|
815
|
-
type CheckoutPathOpts = {
|
|
816
|
-
/** Force checkout (discard local changes) */
|
|
817
|
-
force?: boolean;
|
|
818
|
-
/** Source tree-ish to checkout from (default: index) */
|
|
819
|
-
source?: string;
|
|
820
|
-
/** Suppress progress reporting */
|
|
821
|
-
quiet?: boolean;
|
|
822
|
-
/** Allow overlapping paths when checking out from tree-ish */
|
|
823
|
-
overlay?: boolean;
|
|
824
|
-
/** Check out 'our' version for unmerged files */
|
|
825
|
-
ours?: boolean;
|
|
826
|
-
/** Check out 'their' version for unmerged files */
|
|
827
|
-
theirs?: boolean;
|
|
828
|
-
/** Read pathspecs from file instead of command line */
|
|
829
|
-
pathspecFromFile?: string;
|
|
830
|
-
};
|
|
831
|
-
/**
|
|
832
|
-
* Options for git checkout (legacy combined type)
|
|
833
|
-
* @deprecated Use CheckoutBranchOpts or CheckoutPathOpts for type safety
|
|
834
|
-
*/
|
|
835
|
-
type CheckoutOpts = CheckoutBranchOpts & CheckoutPathOpts;
|
|
836
|
-
/**
|
|
837
|
-
* Options for git commit
|
|
838
|
-
*/
|
|
839
|
-
type CommitOpts = {
|
|
840
|
-
/** Commit message */
|
|
841
|
-
message?: string;
|
|
842
|
-
/** Allow empty commit */
|
|
843
|
-
allowEmpty?: boolean;
|
|
844
|
-
/** Amend previous commit */
|
|
845
|
-
amend?: boolean;
|
|
846
|
-
/** Add all tracked modified files */
|
|
847
|
-
all?: boolean;
|
|
848
|
-
/** Author name and email */
|
|
849
|
-
author?: string;
|
|
850
|
-
/** Override commit date */
|
|
851
|
-
date?: string | Date;
|
|
852
|
-
/** Do not create commit, just update message */
|
|
853
|
-
dryRun?: boolean;
|
|
854
|
-
/** Bypass pre-commit and commit-msg hooks */
|
|
855
|
-
noVerify?: boolean;
|
|
856
|
-
/** GPG-sign the commit with the default key */
|
|
857
|
-
gpgSign?: boolean;
|
|
858
|
-
/** Do not GPG-sign the commit (override commit.gpgSign config) */
|
|
859
|
-
noGpgSign?: boolean;
|
|
860
|
-
/** Suppress commit summary message */
|
|
861
|
-
quiet?: boolean;
|
|
862
|
-
/** Show unified diff between HEAD and working tree */
|
|
863
|
-
verbose?: boolean;
|
|
864
|
-
/** Read commit message from file */
|
|
865
|
-
file?: string;
|
|
866
|
-
/** Take existing commit message and re-edit it */
|
|
867
|
-
reeditMessage?: string;
|
|
868
|
-
/** Take existing commit message and reuse it */
|
|
869
|
-
reuseMessage?: string;
|
|
870
|
-
/** Create a fixup commit for the specified commit */
|
|
871
|
-
fixup?: string;
|
|
872
|
-
/** Create a squash commit for the specified commit */
|
|
873
|
-
squash?: string;
|
|
874
|
-
/** Override author date and ignore cached author identity */
|
|
875
|
-
resetAuthor?: boolean;
|
|
876
|
-
/** Add trailers to the commit message */
|
|
877
|
-
trailer?: string | string[];
|
|
878
|
-
/** Add Signed-off-by trailer */
|
|
879
|
-
signoff?: boolean;
|
|
880
|
-
/** How to clean up the commit message */
|
|
881
|
-
cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
|
|
882
|
-
/** Before committing, also stage specified paths */
|
|
883
|
-
include?: boolean;
|
|
884
|
-
/** Commit only specified paths, ignoring staged changes */
|
|
885
|
-
only?: boolean;
|
|
886
|
-
/** Bypass post-rewrite hook */
|
|
887
|
-
noPostRewrite?: boolean;
|
|
888
|
-
/** How to show untracked files */
|
|
889
|
-
untrackedFiles?: 'no' | 'normal' | 'all';
|
|
890
|
-
/** Read pathspecs from file instead of command line */
|
|
891
|
-
pathspecFromFile?: string;
|
|
892
|
-
/** Allow commit with empty message */
|
|
893
|
-
allowEmptyMessage?: boolean;
|
|
894
|
-
};
|
|
895
|
-
/**
|
|
896
|
-
* Commit result
|
|
897
|
-
*/
|
|
898
|
-
type CommitResult = {
|
|
899
|
-
/** Commit hash */
|
|
900
|
-
hash: string;
|
|
901
|
-
/** Branch name */
|
|
902
|
-
branch: string;
|
|
903
|
-
/** Commit message summary */
|
|
904
|
-
summary: string;
|
|
905
|
-
/** Files changed */
|
|
906
|
-
filesChanged: number;
|
|
907
|
-
/** Insertions */
|
|
908
|
-
insertions: number;
|
|
909
|
-
/** Deletions */
|
|
910
|
-
deletions: number;
|
|
911
|
-
};
|
|
912
|
-
/**
|
|
913
|
-
* Options for git diff
|
|
914
|
-
*/
|
|
915
|
-
type DiffOpts = {
|
|
916
|
-
/** Compare staged changes */
|
|
917
|
-
staged?: boolean;
|
|
918
|
-
/** Show stat only */
|
|
919
|
-
stat?: boolean;
|
|
920
|
-
/** Show name only */
|
|
921
|
-
nameOnly?: boolean;
|
|
922
|
-
/** Show name and status */
|
|
923
|
-
nameStatus?: boolean;
|
|
924
|
-
/** Number of context lines */
|
|
925
|
-
context?: number;
|
|
926
|
-
/** Ignore whitespace changes */
|
|
927
|
-
ignoreWhitespace?: boolean;
|
|
928
|
-
/** Pathspecs to filter */
|
|
929
|
-
paths?: string[];
|
|
930
|
-
/** Use NUL as line terminator */
|
|
931
|
-
nullTerminated?: boolean;
|
|
932
|
-
/** Generate patch output */
|
|
933
|
-
patch?: boolean;
|
|
934
|
-
/** Generate patch and raw format together */
|
|
935
|
-
patchWithRaw?: boolean;
|
|
936
|
-
/** Show number of added/deleted lines in decimal notation */
|
|
937
|
-
numstat?: boolean;
|
|
938
|
-
/** Generate patch and diffstat together */
|
|
939
|
-
patchWithStat?: boolean;
|
|
940
|
-
/** Show full 40-byte hexadecimal object name in diff */
|
|
941
|
-
fullIndex?: boolean;
|
|
942
|
-
/** Abbreviate object names to specified length */
|
|
943
|
-
abbrev?: number;
|
|
944
|
-
/** Swap two inputs (show reverse diff) */
|
|
945
|
-
reverse?: boolean;
|
|
946
|
-
/** Detect rewrites (optionally with threshold like '50%') */
|
|
947
|
-
detectRewrites?: boolean | string;
|
|
948
|
-
/** Detect renames (optionally with threshold like '50%') */
|
|
949
|
-
detectRenames?: boolean | string;
|
|
950
|
-
/** Detect copies (optionally with threshold like '50%') */
|
|
951
|
-
detectCopies?: boolean | string;
|
|
952
|
-
/** Find copies harder (inspects unmodified files as source) */
|
|
953
|
-
findCopiesHarder?: boolean;
|
|
954
|
-
/** Rename limit threshold */
|
|
955
|
-
renameLimit?: number;
|
|
956
|
-
/** Look for string added/removed in a change (pickaxe) */
|
|
957
|
-
pickaxe?: string;
|
|
958
|
-
/** Show all files that changed, not just those with pickaxe match */
|
|
959
|
-
pickaxeAll?: boolean;
|
|
960
|
-
/** Treat all files as text */
|
|
961
|
-
text?: boolean;
|
|
962
|
-
/** Show changes relative to a merge base */
|
|
963
|
-
mergeBase?: string;
|
|
964
|
-
/** Compare two paths on filesystem (not in repository) */
|
|
965
|
-
noIndex?: boolean;
|
|
966
|
-
/** Show word diff */
|
|
967
|
-
wordDiff?: 'color' | 'plain' | 'porcelain' | 'none';
|
|
968
|
-
};
|
|
969
|
-
/**
|
|
970
|
-
* Diff file entry
|
|
971
|
-
*/
|
|
972
|
-
type DiffEntry = {
|
|
973
|
-
path: string;
|
|
974
|
-
status: 'A' | 'D' | 'M' | 'R' | 'C' | 'T' | 'U' | 'X';
|
|
975
|
-
oldPath?: string;
|
|
976
|
-
additions?: number;
|
|
977
|
-
deletions?: number;
|
|
978
|
-
};
|
|
979
|
-
/**
|
|
980
|
-
* Diff result
|
|
981
|
-
*/
|
|
982
|
-
type DiffResult = {
|
|
983
|
-
files: DiffEntry[];
|
|
984
|
-
raw?: string;
|
|
985
|
-
};
|
|
986
|
-
/**
|
|
987
|
-
* Options for git merge
|
|
988
|
-
*/
|
|
989
|
-
type MergeOpts = {
|
|
990
|
-
/** Merge message */
|
|
991
|
-
message?: string;
|
|
992
|
-
/** Fast-forward behavior */
|
|
993
|
-
ff?: 'only' | 'no' | boolean;
|
|
994
|
-
/** Squash merge */
|
|
995
|
-
squash?: boolean;
|
|
996
|
-
/** No commit after merge */
|
|
997
|
-
noCommit?: boolean;
|
|
998
|
-
/** Strategy to use */
|
|
999
|
-
strategy?: string;
|
|
1000
|
-
/** Strategy options */
|
|
1001
|
-
strategyOption?: string | string[];
|
|
1002
|
-
/** Abort merge */
|
|
1003
|
-
abort?: boolean;
|
|
1004
|
-
/** Continue merge */
|
|
1005
|
-
continue?: boolean;
|
|
1006
|
-
/** Bypass pre-merge-commit hook */
|
|
1007
|
-
noVerify?: boolean;
|
|
1008
|
-
/** Do not show diffstat at end of merge */
|
|
1009
|
-
noDiffstat?: boolean;
|
|
1010
|
-
/** Show diffstat at end of merge */
|
|
1011
|
-
stat?: boolean;
|
|
1012
|
-
/** Show compact summary of changed files */
|
|
1013
|
-
compactSummary?: boolean;
|
|
1014
|
-
/** Add log of commits being merged (optionally with count) */
|
|
1015
|
-
log?: boolean | number;
|
|
1016
|
-
/** How to clean up the commit message */
|
|
1017
|
-
cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
|
|
1018
|
-
/** Automatically update rerere state */
|
|
1019
|
-
rerereAutoupdate?: boolean;
|
|
1020
|
-
/** Verify that commit is signed with a valid key */
|
|
1021
|
-
verifySignatures?: boolean;
|
|
1022
|
-
/** Be verbose */
|
|
1023
|
-
verbose?: boolean;
|
|
1024
|
-
/** Be quiet */
|
|
1025
|
-
quiet?: boolean;
|
|
1026
|
-
/** Quit the current in-progress merge without cleanup */
|
|
1027
|
-
quit?: boolean;
|
|
1028
|
-
/** Allow merging histories that do not share a common ancestor */
|
|
1029
|
-
allowUnrelatedHistories?: boolean;
|
|
1030
|
-
/** GPG-sign the merge commit (optionally with key id) */
|
|
1031
|
-
gpgSign?: boolean | string;
|
|
1032
|
-
/** Automatically stash before merge and unstash after */
|
|
1033
|
-
autostash?: boolean;
|
|
1034
|
-
/** Silently overwrite ignored files */
|
|
1035
|
-
overwriteIgnore?: boolean;
|
|
1036
|
-
/** Add Signed-off-by trailer */
|
|
1037
|
-
signoff?: boolean;
|
|
1038
|
-
/** Use custom branch name in merge commit message */
|
|
1039
|
-
intoName?: string;
|
|
1040
|
-
};
|
|
1041
|
-
/**
|
|
1042
|
-
* Merge result
|
|
1043
|
-
*/
|
|
1044
|
-
type MergeResult = {
|
|
1045
|
-
success: boolean;
|
|
1046
|
-
hash?: string;
|
|
1047
|
-
conflicts?: string[];
|
|
1048
|
-
fastForward?: boolean;
|
|
1049
|
-
};
|
|
1050
|
-
/**
|
|
1051
|
-
* Options for git pull
|
|
1052
|
-
*/
|
|
1053
|
-
type PullOpts = {
|
|
1054
|
-
/** Remote name */
|
|
1055
|
-
remote?: string;
|
|
1056
|
-
/** Branch to pull */
|
|
1057
|
-
branch?: string;
|
|
1058
|
-
/** Rebase instead of merge */
|
|
1059
|
-
rebase?: boolean | 'merges' | 'interactive';
|
|
1060
|
-
/** Fast-forward behavior */
|
|
1061
|
-
ff?: 'only' | 'no' | boolean;
|
|
1062
|
-
/** Fetch tags */
|
|
1063
|
-
tags?: boolean;
|
|
1064
|
-
/** Prune remote-tracking refs */
|
|
1065
|
-
prune?: boolean;
|
|
1066
|
-
/** Progress callback */
|
|
1067
|
-
onProgress?: (progress: GitProgress) => void;
|
|
1068
|
-
/** Be verbose */
|
|
1069
|
-
verbose?: boolean;
|
|
1070
|
-
/** Be quiet */
|
|
1071
|
-
quiet?: boolean;
|
|
1072
|
-
/** Fetch submodules recursively */
|
|
1073
|
-
recurseSubmodules?: boolean | 'yes' | 'on-demand' | 'no';
|
|
1074
|
-
/** Do not show diffstat at end of merge */
|
|
1075
|
-
noStat?: boolean;
|
|
1076
|
-
/** Show diffstat at end of merge */
|
|
1077
|
-
stat?: boolean;
|
|
1078
|
-
/** Show compact summary of changed files */
|
|
1079
|
-
compactSummary?: boolean;
|
|
1080
|
-
/** Add log of commits being merged (optionally with count) */
|
|
1081
|
-
log?: boolean | number;
|
|
1082
|
-
/** Add Signed-off-by trailer */
|
|
1083
|
-
signoff?: boolean;
|
|
1084
|
-
/** Squash merge */
|
|
1085
|
-
squash?: boolean;
|
|
1086
|
-
/** Perform merge and commit (or not) */
|
|
1087
|
-
commit?: boolean;
|
|
1088
|
-
/** How to clean up the commit message */
|
|
1089
|
-
cleanup?: string;
|
|
1090
|
-
/** Run hooks or not */
|
|
1091
|
-
verify?: boolean;
|
|
1092
|
-
/** Verify that commit is signed with a valid key */
|
|
1093
|
-
verifySignatures?: boolean;
|
|
1094
|
-
/** Automatically stash before pull and unstash after */
|
|
1095
|
-
autostash?: boolean;
|
|
1096
|
-
/** Merge strategy to use */
|
|
1097
|
-
strategy?: string;
|
|
1098
|
-
/** Strategy options */
|
|
1099
|
-
strategyOption?: string | string[];
|
|
1100
|
-
/** GPG-sign the merge commit (optionally with key id) */
|
|
1101
|
-
gpgSign?: boolean | string;
|
|
1102
|
-
/** Allow merging histories that do not share a common ancestor */
|
|
1103
|
-
allowUnrelatedHistories?: boolean;
|
|
1104
|
-
/** Fetch from all remotes */
|
|
1105
|
-
all?: boolean;
|
|
1106
|
-
/** Append ref names and object names to FETCH_HEAD */
|
|
1107
|
-
append?: boolean;
|
|
1108
|
-
/** Force update of local branches */
|
|
1109
|
-
force?: boolean;
|
|
1110
|
-
/** Number of parallel children for fetching submodules */
|
|
1111
|
-
jobs?: number;
|
|
1112
|
-
/** Dry run */
|
|
1113
|
-
dryRun?: boolean;
|
|
1114
|
-
/** Keep downloaded pack */
|
|
1115
|
-
keep?: boolean;
|
|
1116
|
-
/** Limit fetching depth */
|
|
1117
|
-
depth?: number;
|
|
1118
|
-
/** Deepen shallow clone since date */
|
|
1119
|
-
shallowSince?: string | Date;
|
|
1120
|
-
/** Deepen shallow clone excluding revision */
|
|
1121
|
-
shallowExclude?: string | string[];
|
|
1122
|
-
/** Deepen shallow clone by specified commits */
|
|
1123
|
-
deepen?: number;
|
|
1124
|
-
/** Convert shallow repository to complete one */
|
|
1125
|
-
unshallow?: boolean;
|
|
1126
|
-
/** Update shallow boundary if new refs need it */
|
|
1127
|
-
updateShallow?: boolean;
|
|
1128
|
-
/** Use IPv4 addresses only */
|
|
1129
|
-
ipv4?: boolean;
|
|
1130
|
-
/** Use IPv6 addresses only */
|
|
1131
|
-
ipv6?: boolean;
|
|
1132
|
-
/** Set upstream tracking for the current branch */
|
|
1133
|
-
setUpstream?: boolean;
|
|
1134
|
-
};
|
|
1135
|
-
/**
|
|
1136
|
-
* Options for git reset
|
|
1137
|
-
*/
|
|
1138
|
-
type ResetOpts = {
|
|
1139
|
-
/** Reset mode */
|
|
1140
|
-
mode?: 'soft' | 'mixed' | 'hard' | 'merge' | 'keep';
|
|
1141
|
-
/** Be quiet (report only errors) */
|
|
1142
|
-
quiet?: boolean;
|
|
1143
|
-
/** Skip refreshing the index after reset */
|
|
1144
|
-
noRefresh?: boolean;
|
|
1145
|
-
/** Reset submodules */
|
|
1146
|
-
recurseSubmodules?: boolean;
|
|
1147
|
-
/** Record intention to add unstaged files */
|
|
1148
|
-
intentToAdd?: boolean;
|
|
1149
|
-
/** Read pathspecs from file instead of command line */
|
|
1150
|
-
pathspecFromFile?: string;
|
|
1151
|
-
};
|
|
1152
|
-
/**
|
|
1153
|
-
* Options for git rm
|
|
1154
|
-
*/
|
|
1155
|
-
type RmOpts = {
|
|
1156
|
-
/** Force removal */
|
|
1157
|
-
force?: boolean;
|
|
1158
|
-
/** Remove from index only (keep in working tree) */
|
|
1159
|
-
cached?: boolean;
|
|
1160
|
-
/** Allow recursive removal */
|
|
1161
|
-
recursive?: boolean;
|
|
1162
|
-
/** Dry run */
|
|
1163
|
-
dryRun?: boolean;
|
|
1164
|
-
/** Suppress output */
|
|
1165
|
-
quiet?: boolean;
|
|
1166
|
-
/** Exit with zero status even if no files matched */
|
|
1167
|
-
ignoreUnmatch?: boolean;
|
|
1168
|
-
/** Allow removing files outside of sparse-checkout cone */
|
|
1169
|
-
sparse?: boolean;
|
|
1170
|
-
/** Read pathspecs from file instead of command line */
|
|
1171
|
-
pathspecFromFile?: string;
|
|
1172
|
-
};
|
|
1173
|
-
/**
|
|
1174
|
-
* Stash entry
|
|
1175
|
-
*/
|
|
1176
|
-
type StashEntry = {
|
|
1177
|
-
index: number;
|
|
1178
|
-
message: string;
|
|
1179
|
-
branch?: string;
|
|
1180
|
-
commit: string;
|
|
1181
|
-
};
|
|
1182
|
-
/**
|
|
1183
|
-
* Options for git stash push
|
|
1184
|
-
*/
|
|
1185
|
-
type StashPushOpts = {
|
|
1186
|
-
/** Stash message */
|
|
1187
|
-
message?: string;
|
|
1188
|
-
/** Include untracked files */
|
|
1189
|
-
includeUntracked?: boolean;
|
|
1190
|
-
/** Keep index */
|
|
1191
|
-
keepIndex?: boolean;
|
|
1192
|
-
/** Specific paths to stash */
|
|
1193
|
-
paths?: string[];
|
|
1194
|
-
/** Stash only staged changes */
|
|
1195
|
-
staged?: boolean;
|
|
1196
|
-
/** Suppress output */
|
|
1197
|
-
quiet?: boolean;
|
|
1198
|
-
/** Stash all files including untracked and ignored */
|
|
1199
|
-
all?: boolean;
|
|
1200
|
-
/** Read pathspecs from file instead of command line */
|
|
1201
|
-
pathspecFromFile?: string;
|
|
1202
|
-
};
|
|
1203
|
-
/**
|
|
1204
|
-
* Options for git stash pop/apply
|
|
1205
|
-
*/
|
|
1206
|
-
type StashApplyOpts = {
|
|
1207
|
-
/** Stash index to apply */
|
|
1208
|
-
index?: number;
|
|
1209
|
-
/** Try to reinstate index */
|
|
1210
|
-
reinstateIndex?: boolean;
|
|
1211
|
-
};
|
|
1212
|
-
/**
|
|
1213
|
-
* Options for git switch
|
|
1214
|
-
*/
|
|
1215
|
-
type SwitchOpts = {
|
|
1216
|
-
/** Create new branch */
|
|
1217
|
-
create?: boolean;
|
|
1218
|
-
/** Force create (overwrite existing) */
|
|
1219
|
-
forceCreate?: boolean;
|
|
1220
|
-
/** Discard local changes */
|
|
1221
|
-
discard?: boolean;
|
|
1222
|
-
/** Start point for new branch */
|
|
1223
|
-
startPoint?: string;
|
|
1224
|
-
/** Track remote branch */
|
|
1225
|
-
track?: boolean;
|
|
1226
|
-
/** Detach HEAD */
|
|
1227
|
-
detach?: boolean;
|
|
1228
|
-
/** Try to guess remote tracking branch if target not found */
|
|
1229
|
-
guess?: boolean;
|
|
1230
|
-
/** Suppress progress reporting */
|
|
1231
|
-
quiet?: boolean;
|
|
1232
|
-
/** Update submodules */
|
|
1233
|
-
recurseSubmodules?: boolean;
|
|
1234
|
-
/** Merge local modifications with the new branch */
|
|
1235
|
-
merge?: boolean;
|
|
1236
|
-
/** Conflict style for merge conflicts */
|
|
1237
|
-
conflict?: 'merge' | 'diff3' | 'zdiff3';
|
|
1238
|
-
/** Force switch (throw away local modifications) */
|
|
1239
|
-
force?: boolean;
|
|
1240
|
-
/** Create new orphan branch */
|
|
1241
|
-
orphan?: boolean;
|
|
1242
|
-
/** Silently overwrite ignored files */
|
|
1243
|
-
overwriteIgnore?: boolean;
|
|
1244
|
-
/** Ignore if branch is checked out in other worktrees */
|
|
1245
|
-
ignoreOtherWorktrees?: boolean;
|
|
1246
|
-
};
|
|
1247
|
-
/**
|
|
1248
|
-
* Tag information
|
|
1249
|
-
*/
|
|
1250
|
-
type TagInfo = {
|
|
1251
|
-
name: string;
|
|
1252
|
-
commit: string;
|
|
1253
|
-
message?: string;
|
|
1254
|
-
tagger?: {
|
|
1255
|
-
name: string;
|
|
1256
|
-
email: string;
|
|
1257
|
-
date: Date;
|
|
1258
|
-
};
|
|
1259
|
-
annotated: boolean;
|
|
1260
|
-
};
|
|
1261
|
-
/**
|
|
1262
|
-
* Options for git tag (list)
|
|
1263
|
-
*/
|
|
1264
|
-
type TagListOpts = {
|
|
1265
|
-
/** List pattern */
|
|
1266
|
-
pattern?: string;
|
|
1267
|
-
/** Sort by */
|
|
1268
|
-
sort?: string;
|
|
1269
|
-
/** Print n lines of tag message */
|
|
1270
|
-
lines?: number;
|
|
1271
|
-
/** Only list tags that contain the specified commit */
|
|
1272
|
-
contains?: string;
|
|
1273
|
-
/** Only list tags that don't contain the specified commit */
|
|
1274
|
-
noContains?: string;
|
|
1275
|
-
/** Only list tags whose tips are reachable from the specified commit */
|
|
1276
|
-
merged?: string;
|
|
1277
|
-
/** Only list tags whose tips are not reachable from the specified commit */
|
|
1278
|
-
noMerged?: string;
|
|
1279
|
-
/** Only list tags that point at the specified object */
|
|
1280
|
-
pointsAt?: string;
|
|
1281
|
-
/** Sorting and filtering are case insensitive */
|
|
1282
|
-
ignoreCase?: boolean;
|
|
1283
|
-
};
|
|
1284
|
-
/**
|
|
1285
|
-
* Options for creating a tag
|
|
1286
|
-
*/
|
|
1287
|
-
type TagCreateOpts = {
|
|
1288
|
-
/** Tag message (creates annotated tag) */
|
|
1289
|
-
message?: string;
|
|
1290
|
-
/** Force (overwrite existing tag) */
|
|
1291
|
-
force?: boolean;
|
|
1292
|
-
/** Commit to tag */
|
|
1293
|
-
commit?: string;
|
|
1294
|
-
/** GPG-sign the tag with the default key */
|
|
1295
|
-
sign?: boolean;
|
|
1296
|
-
/** Read tag message from file */
|
|
1297
|
-
file?: string;
|
|
1298
|
-
/** Add trailers to the tag message */
|
|
1299
|
-
trailer?: string | string[];
|
|
1300
|
-
/** How to clean up the tag message */
|
|
1301
|
-
cleanup?: string;
|
|
1302
|
-
/** Key to use for GPG signing */
|
|
1303
|
-
localUser?: string;
|
|
1304
|
-
/** Create the tag's reflog */
|
|
1305
|
-
createReflog?: boolean;
|
|
1306
|
-
};
|
|
1307
|
-
/**
|
|
1308
|
-
* Options for git cherry-pick
|
|
1309
|
-
*/
|
|
1310
|
-
type CherryPickOpts = {
|
|
1311
|
-
/** Edit commit message */
|
|
1312
|
-
edit?: boolean;
|
|
1313
|
-
/** No commit after cherry-pick */
|
|
1314
|
-
noCommit?: boolean;
|
|
1315
|
-
/** Add signoff */
|
|
1316
|
-
signoff?: boolean;
|
|
1317
|
-
/** Mainline parent number for merge commits */
|
|
1318
|
-
mainline?: number;
|
|
1319
|
-
/** Strategy to use */
|
|
1320
|
-
strategy?: string;
|
|
1321
|
-
/** Abort cherry-pick */
|
|
1322
|
-
abort?: boolean;
|
|
1323
|
-
/** Continue cherry-pick */
|
|
1324
|
-
continue?: boolean;
|
|
1325
|
-
/** Skip current commit */
|
|
1326
|
-
skip?: boolean;
|
|
1327
|
-
/** Bypass pre-commit hook */
|
|
1328
|
-
noVerify?: boolean;
|
|
1329
|
-
/** How to clean up the commit message */
|
|
1330
|
-
cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
|
|
1331
|
-
/** Automatically update rerere state */
|
|
1332
|
-
rerereAutoupdate?: boolean;
|
|
1333
|
-
/** Strategy options */
|
|
1334
|
-
strategyOption?: string | string[];
|
|
1335
|
-
/** GPG-sign the commit (optionally with key id) */
|
|
1336
|
-
gpgSign?: boolean | string;
|
|
1337
|
-
/** Append (cherry picked from ...) line to original message */
|
|
1338
|
-
appendCommitName?: boolean;
|
|
1339
|
-
/** Fast-forward if possible */
|
|
1340
|
-
ff?: boolean;
|
|
1341
|
-
/** Allow recording empty commits */
|
|
1342
|
-
allowEmpty?: boolean;
|
|
1343
|
-
/** Allow empty commit messages */
|
|
1344
|
-
allowEmptyMessage?: boolean;
|
|
1345
|
-
/** How to handle originally empty commits */
|
|
1346
|
-
empty?: 'drop' | 'keep' | 'stop';
|
|
1347
|
-
};
|
|
1348
|
-
/**
|
|
1349
|
-
* Options for git clean
|
|
1350
|
-
*/
|
|
1351
|
-
type CleanOpts = {
|
|
1352
|
-
/** Force clean */
|
|
1353
|
-
force?: boolean;
|
|
1354
|
-
/** Remove directories too */
|
|
1355
|
-
directories?: boolean;
|
|
1356
|
-
/** Remove ignored files too */
|
|
1357
|
-
ignored?: boolean;
|
|
1358
|
-
/** Only remove ignored files */
|
|
1359
|
-
onlyIgnored?: boolean;
|
|
1360
|
-
/** Dry run */
|
|
1361
|
-
dryRun?: boolean;
|
|
1362
|
-
/** Paths to clean */
|
|
1363
|
-
paths?: string[];
|
|
1364
|
-
/** Suppress output */
|
|
1365
|
-
quiet?: boolean;
|
|
1366
|
-
/** Exclude files matching pattern */
|
|
1367
|
-
exclude?: string | string[];
|
|
1368
|
-
};
|
|
1369
|
-
/**
|
|
1370
|
-
* Options for git mv
|
|
1371
|
-
*/
|
|
1372
|
-
type MvOpts = {
|
|
1373
|
-
/** Force move */
|
|
1374
|
-
force?: boolean;
|
|
1375
|
-
/** Dry run */
|
|
1376
|
-
dryRun?: boolean;
|
|
1377
|
-
/** Be verbose */
|
|
1378
|
-
verbose?: boolean;
|
|
1379
|
-
/** Skip errors */
|
|
1380
|
-
skipErrors?: boolean;
|
|
1381
|
-
/** Allow moving files outside of sparse-checkout cone */
|
|
1382
|
-
sparse?: boolean;
|
|
1383
|
-
};
|
|
1384
|
-
/**
|
|
1385
|
-
* Options for git rebase
|
|
1386
|
-
*/
|
|
1387
|
-
type RebaseOpts = {
|
|
1388
|
-
/** Upstream branch */
|
|
1389
|
-
upstream?: string;
|
|
1390
|
-
/** Onto target */
|
|
1391
|
-
onto?: string;
|
|
1392
|
-
/** Interactive rebase (not supported - use raw) */
|
|
1393
|
-
interactive?: never;
|
|
1394
|
-
/** Preserve merges */
|
|
1395
|
-
rebaseMerges?: boolean;
|
|
1396
|
-
/** Abort rebase */
|
|
1397
|
-
abort?: boolean;
|
|
1398
|
-
/** Continue rebase */
|
|
1399
|
-
continue?: boolean;
|
|
1400
|
-
/** Skip current commit */
|
|
1401
|
-
skip?: boolean;
|
|
1402
|
-
/** Bypass pre-rebase hook */
|
|
1403
|
-
noVerify?: boolean;
|
|
1404
|
-
/** Keep the commits at the base unchanged */
|
|
1405
|
-
keepBase?: boolean;
|
|
1406
|
-
/** Be quiet */
|
|
1407
|
-
quiet?: boolean;
|
|
1408
|
-
/** Be verbose */
|
|
1409
|
-
verbose?: boolean;
|
|
1410
|
-
/** Add signoff */
|
|
1411
|
-
signoff?: boolean;
|
|
1412
|
-
/** Set committer date to author date */
|
|
1413
|
-
committerDateIsAuthorDate?: boolean;
|
|
1414
|
-
/** Set author date to committer date */
|
|
1415
|
-
resetAuthorDate?: boolean;
|
|
1416
|
-
/** Ignore whitespace differences */
|
|
1417
|
-
ignoreWhitespace?: boolean;
|
|
1418
|
-
/** Whitespace handling mode */
|
|
1419
|
-
whitespace?: string;
|
|
1420
|
-
/** Force rebase even if already up-to-date */
|
|
1421
|
-
forceRebase?: boolean;
|
|
1422
|
-
/** Create merge commit instead of rebasing */
|
|
1423
|
-
noFf?: boolean;
|
|
1424
|
-
/** Use apply strategy */
|
|
1425
|
-
apply?: boolean;
|
|
1426
|
-
/** Automatically update rerere state */
|
|
1427
|
-
rerereAutoupdate?: boolean;
|
|
1428
|
-
/** How to handle empty commits */
|
|
1429
|
-
empty?: 'drop' | 'keep' | 'ask';
|
|
1430
|
-
/** Automatically squash fixup commits */
|
|
1431
|
-
autosquash?: boolean;
|
|
1432
|
-
/** Update refs that point to rebased commits */
|
|
1433
|
-
updateRefs?: boolean;
|
|
1434
|
-
/** GPG-sign commits */
|
|
1435
|
-
gpgSign?: boolean | string;
|
|
1436
|
-
/** Automatically stash/unstash */
|
|
1437
|
-
autostash?: boolean;
|
|
1438
|
-
/** Execute command after each commit */
|
|
1439
|
-
exec?: string;
|
|
1440
|
-
/** Use fork point for base */
|
|
1441
|
-
forkPoint?: boolean;
|
|
1442
|
-
/** Merge strategy */
|
|
1443
|
-
strategy?: string;
|
|
1444
|
-
/** Strategy options */
|
|
1445
|
-
strategyOption?: string | string[];
|
|
1446
|
-
/** Rebase from root commit */
|
|
1447
|
-
root?: boolean;
|
|
1448
|
-
/** Reschedule failed exec commands */
|
|
1449
|
-
rescheduleFailedExec?: boolean;
|
|
1450
|
-
/** Reapply cherry-picks */
|
|
1451
|
-
reapplyCherryPicks?: boolean;
|
|
1452
|
-
};
|
|
1453
|
-
/**
|
|
1454
|
-
* Options for git restore
|
|
1455
|
-
*/
|
|
1456
|
-
type RestoreOpts = {
|
|
1457
|
-
/** Restore staged files */
|
|
1458
|
-
staged?: boolean;
|
|
1459
|
-
/** Restore working tree files */
|
|
1460
|
-
worktree?: boolean;
|
|
1461
|
-
/** Source to restore from */
|
|
1462
|
-
source?: string;
|
|
1463
|
-
/** Ours or theirs for conflicts */
|
|
1464
|
-
ours?: boolean;
|
|
1465
|
-
theirs?: boolean;
|
|
1466
|
-
/** Ignore unmerged entries */
|
|
1467
|
-
ignoreUnmerged?: boolean;
|
|
1468
|
-
/** Allow overlay mode (default is no-overlay) */
|
|
1469
|
-
overlay?: boolean;
|
|
1470
|
-
/** Suppress output */
|
|
1471
|
-
quiet?: boolean;
|
|
1472
|
-
/** Recurse into submodules */
|
|
1473
|
-
recurseSubmodules?: boolean;
|
|
1474
|
-
/** Show progress */
|
|
1475
|
-
progress?: boolean;
|
|
1476
|
-
/** Attempt to recreate merge conflicts */
|
|
1477
|
-
merge?: boolean;
|
|
1478
|
-
/** Conflict style for merge conflicts */
|
|
1479
|
-
conflict?: 'merge' | 'diff3' | 'zdiff3';
|
|
1480
|
-
/** Ignore skip-worktree bits */
|
|
1481
|
-
ignoreSkipWorktreeBits?: boolean;
|
|
1482
|
-
/** Read pathspecs from file */
|
|
1483
|
-
pathspecFromFile?: string;
|
|
1484
|
-
};
|
|
1485
|
-
/**
|
|
1486
|
-
* Options for git revert
|
|
1487
|
-
*/
|
|
1488
|
-
type RevertOpts = {
|
|
1489
|
-
/** Edit commit message */
|
|
1490
|
-
edit?: boolean;
|
|
1491
|
-
/** No commit after revert */
|
|
1492
|
-
noCommit?: boolean;
|
|
1493
|
-
/** Mainline parent number for merge commits */
|
|
1494
|
-
mainline?: number;
|
|
1495
|
-
/** Abort revert */
|
|
1496
|
-
abort?: boolean;
|
|
1497
|
-
/** Continue revert */
|
|
1498
|
-
continue?: boolean;
|
|
1499
|
-
/** Skip current commit */
|
|
1500
|
-
skip?: boolean;
|
|
1501
|
-
/** Bypass pre-commit hook */
|
|
1502
|
-
noVerify?: boolean;
|
|
1503
|
-
/** How to clean up the commit message */
|
|
1504
|
-
cleanup?: 'strip' | 'whitespace' | 'verbatim' | 'scissors' | 'default';
|
|
1505
|
-
/** Add signoff */
|
|
1506
|
-
signoff?: boolean;
|
|
1507
|
-
/** Automatically update rerere state */
|
|
1508
|
-
rerereAutoupdate?: boolean;
|
|
1509
|
-
/** Merge strategy */
|
|
1510
|
-
strategy?: string;
|
|
1511
|
-
/** Strategy options */
|
|
1512
|
-
strategyOption?: string | string[];
|
|
1513
|
-
/** GPG-sign the commit */
|
|
1514
|
-
gpgSign?: boolean | string;
|
|
1515
|
-
/** Add reference to reverted commit */
|
|
1516
|
-
reference?: boolean;
|
|
1517
|
-
};
|
|
1518
|
-
/**
|
|
1519
|
-
* Options for git show
|
|
1520
|
-
*/
|
|
1521
|
-
type ShowOpts = {
|
|
1522
|
-
/** Show stat only */
|
|
1523
|
-
stat?: boolean;
|
|
1524
|
-
/** Show name only */
|
|
1525
|
-
nameOnly?: boolean;
|
|
1526
|
-
/** Show name and status */
|
|
1527
|
-
nameStatus?: boolean;
|
|
1528
|
-
/** Format string */
|
|
1529
|
-
format?: string;
|
|
1530
|
-
/** Suppress output */
|
|
1531
|
-
quiet?: boolean;
|
|
1532
|
-
/** Show source ref for each commit */
|
|
1533
|
-
source?: boolean;
|
|
1534
|
-
/** Use mailmap for author/committer names */
|
|
1535
|
-
useMailmap?: boolean;
|
|
1536
|
-
/** Only decorate refs matching pattern */
|
|
1537
|
-
decorateRefs?: string;
|
|
1538
|
-
/** Exclude refs matching pattern from decoration */
|
|
1539
|
-
decorateRefsExclude?: string;
|
|
1540
|
-
/** Decorate style */
|
|
1541
|
-
decorate?: 'short' | 'full' | 'auto' | 'no';
|
|
1542
|
-
};
|
|
1543
|
-
/**
|
|
1544
|
-
* Options that return a single path from rev-parse
|
|
1545
|
-
*
|
|
1546
|
-
* These options are mutually exclusive - only one can be specified at a time.
|
|
1547
|
-
*/
|
|
1548
|
-
type RevParsePathQuery = {
|
|
1549
|
-
gitDir: true;
|
|
1550
|
-
} | {
|
|
1551
|
-
absoluteGitDir: true;
|
|
1552
|
-
} | {
|
|
1553
|
-
gitCommonDir: true;
|
|
1554
|
-
} | {
|
|
1555
|
-
showToplevel: true;
|
|
1556
|
-
} | {
|
|
1557
|
-
showCdup: true;
|
|
1558
|
-
} | {
|
|
1559
|
-
showPrefix: true;
|
|
1560
|
-
} | {
|
|
1561
|
-
showSuperprojectWorkingTree: true;
|
|
1562
|
-
} | {
|
|
1563
|
-
sharedIndexPath: true;
|
|
1564
|
-
} | {
|
|
1565
|
-
gitPath: string;
|
|
1566
|
-
} | {
|
|
1567
|
-
resolveGitDir: string;
|
|
1568
|
-
};
|
|
1569
|
-
/**
|
|
1570
|
-
* Options that return a boolean from rev-parse
|
|
1571
|
-
*
|
|
1572
|
-
* These options are mutually exclusive - only one can be specified at a time.
|
|
1573
|
-
*/
|
|
1574
|
-
type RevParseBooleanQuery = {
|
|
1575
|
-
isInsideGitDir: true;
|
|
1576
|
-
} | {
|
|
1577
|
-
isInsideWorkTree: true;
|
|
1578
|
-
} | {
|
|
1579
|
-
isBareRepository: true;
|
|
1580
|
-
} | {
|
|
1581
|
-
isShallowRepository: true;
|
|
1582
|
-
};
|
|
1583
|
-
/**
|
|
1584
|
-
* Common options for list queries
|
|
1585
|
-
*/
|
|
1586
|
-
type RevParseListOpts = {
|
|
1587
|
-
/** Exclude refs matching pattern */
|
|
1588
|
-
exclude?: string;
|
|
1589
|
-
/**
|
|
1590
|
-
* Exclude refs that would be hidden by the specified operation.
|
|
1591
|
-
* - 'fetch': hidden by `transfer.hideRefs` for fetch
|
|
1592
|
-
* - 'receive': hidden by `receive.hideRefs`
|
|
1593
|
-
* - 'uploadpack': hidden by `uploadpack.hideRefs`
|
|
1594
|
-
*/
|
|
1595
|
-
excludeHidden?: 'fetch' | 'receive' | 'uploadpack';
|
|
1596
|
-
};
|
|
1597
|
-
/**
|
|
1598
|
-
* Options that return a list of refs from rev-parse
|
|
1599
|
-
*
|
|
1600
|
-
* These options are mutually exclusive - only one can be specified at a time.
|
|
1601
|
-
* For branches/tags/remotes, you can pass `true` to list all, or a pattern string to filter.
|
|
1602
|
-
*/
|
|
1603
|
-
type RevParseListQuery = ({
|
|
1604
|
-
all: true;
|
|
1605
|
-
} & RevParseListOpts) | ({
|
|
1606
|
-
branches: true | string;
|
|
1607
|
-
} & RevParseListOpts) | ({
|
|
1608
|
-
tags: true | string;
|
|
1609
|
-
} & RevParseListOpts) | ({
|
|
1610
|
-
remotes: true | string;
|
|
1611
|
-
} & RevParseListOpts) | ({
|
|
1612
|
-
glob: string;
|
|
1613
|
-
} & RevParseListOpts) | {
|
|
1614
|
-
disambiguate: string;
|
|
1615
|
-
};
|
|
1616
|
-
/**
|
|
1617
|
-
* Options that modify how a ref is resolved
|
|
1618
|
-
*/
|
|
1619
|
-
type RevParseRefOpts = {
|
|
1620
|
-
/** Verify that the parameter can be turned into a raw SHA-1 (stricter parsing) */
|
|
1621
|
-
verify?: boolean;
|
|
1622
|
-
/** Shorten to unique prefix (true for default length, number for specific length) */
|
|
1623
|
-
short?: boolean | number;
|
|
1624
|
-
/** Output abbreviated ref name (e.g., "main" instead of SHA) */
|
|
1625
|
-
abbrevRef?: boolean | 'strict' | 'loose';
|
|
1626
|
-
/** Output in a form as close to the original input as possible */
|
|
1627
|
-
symbolic?: boolean;
|
|
1628
|
-
/** Output full refname (e.g., "refs/heads/main" instead of "main") */
|
|
1629
|
-
symbolicFullName?: boolean;
|
|
1630
|
-
/**
|
|
1631
|
-
* In --verify mode, exit silently with non-zero status on invalid input
|
|
1632
|
-
* instead of outputting an error message. Only works with --verify.
|
|
1633
|
-
*/
|
|
1634
|
-
quiet?: boolean;
|
|
1635
|
-
};
|
|
1636
|
-
/**
|
|
1637
|
-
* Options that return other information from rev-parse
|
|
1638
|
-
*/
|
|
1639
|
-
type RevParseOtherQuery = {
|
|
1640
|
-
showObjectFormat: true | 'storage' | 'input' | 'output';
|
|
1641
|
-
} | {
|
|
1642
|
-
showRefFormat: true;
|
|
1643
|
-
} | {
|
|
1644
|
-
localEnvVars: true;
|
|
1645
|
-
};
|
|
1646
|
-
/**
|
|
1647
|
-
* Path format option for path queries
|
|
1648
|
-
*/
|
|
1649
|
-
type RevParsePathFormat = 'absolute' | 'relative';
|
|
1650
|
-
/**
|
|
1651
|
-
* Additional options for path queries
|
|
1652
|
-
*/
|
|
1653
|
-
type RevParsePathOpts = {
|
|
1654
|
-
/** Control whether paths are output as absolute or relative */
|
|
1655
|
-
pathFormat?: RevParsePathFormat;
|
|
1656
|
-
};
|
|
1657
|
-
/**
|
|
1658
|
-
* Options for git submodule
|
|
1659
|
-
*/
|
|
1660
|
-
type SubmoduleOpts = {
|
|
1661
|
-
/** Recursive operation */
|
|
1662
|
-
recursive?: boolean;
|
|
1663
|
-
/** Initialize submodules */
|
|
1664
|
-
init?: boolean;
|
|
1665
|
-
/** Remote tracking branch */
|
|
1666
|
-
remote?: boolean;
|
|
1667
|
-
/** Force update */
|
|
1668
|
-
force?: boolean;
|
|
1669
|
-
/** Do not fetch from remotes */
|
|
1670
|
-
noFetch?: boolean;
|
|
1671
|
-
/** Checkout the superproject's recorded commit */
|
|
1672
|
-
checkout?: boolean;
|
|
1673
|
-
/** Merge the commit into the current branch */
|
|
1674
|
-
merge?: boolean;
|
|
1675
|
-
/** Rebase the current branch onto the commit */
|
|
1676
|
-
rebase?: boolean;
|
|
1677
|
-
/** Use recommended shallow clone depth */
|
|
1678
|
-
recommendShallow?: boolean;
|
|
1679
|
-
/** Reference repository for shared clone */
|
|
1680
|
-
reference?: string;
|
|
1681
|
-
/** Clone only one branch */
|
|
1682
|
-
singleBranch?: boolean;
|
|
1683
|
-
/** Partial clone filter specification */
|
|
1684
|
-
filter?: string;
|
|
1685
|
-
};
|
|
1686
|
-
/**
|
|
1687
|
-
* Options for adding a submodule
|
|
1688
|
-
*/
|
|
1689
|
-
type SubmoduleAddOpts = {
|
|
1690
|
-
/** Branch to track */
|
|
1691
|
-
branch?: string;
|
|
1692
|
-
/** Force addition */
|
|
1693
|
-
force?: boolean;
|
|
1694
|
-
/** Submodule name (if different from path) */
|
|
1695
|
-
name?: string;
|
|
1696
|
-
/** Reference repository */
|
|
1697
|
-
reference?: string;
|
|
1698
|
-
/** Depth for shallow clone */
|
|
1699
|
-
depth?: number;
|
|
1700
|
-
};
|
|
1701
|
-
/**
|
|
1702
|
-
* Options for deinitializing a submodule
|
|
1703
|
-
*/
|
|
1704
|
-
type SubmoduleDeinitOpts = {
|
|
1705
|
-
/** Force deinitialization */
|
|
1706
|
-
force?: boolean;
|
|
1707
|
-
/** Deinitialize all submodules */
|
|
1708
|
-
all?: boolean;
|
|
1709
|
-
};
|
|
1710
|
-
/**
|
|
1711
|
-
* Options for submodule status
|
|
1712
|
-
*/
|
|
1713
|
-
type SubmoduleStatusOpts = {
|
|
1714
|
-
/** Check submodules recursively */
|
|
1715
|
-
recursive?: boolean;
|
|
1716
|
-
};
|
|
1717
|
-
/**
|
|
1718
|
-
* Options for submodule summary
|
|
1719
|
-
*/
|
|
1720
|
-
type SubmoduleSummaryOpts = {
|
|
1721
|
-
/** Limit to the specified number of commits */
|
|
1722
|
-
limit?: number;
|
|
1723
|
-
/** Show files in the summary */
|
|
1724
|
-
files?: boolean;
|
|
1725
|
-
};
|
|
1726
|
-
/**
|
|
1727
|
-
* Options for submodule foreach
|
|
1728
|
-
*/
|
|
1729
|
-
type SubmoduleForeachOpts = {
|
|
1730
|
-
/** Run the command recursively in nested submodules */
|
|
1731
|
-
recursive?: boolean;
|
|
1732
|
-
};
|
|
1733
|
-
/**
|
|
1734
|
-
* Options for submodule sync
|
|
1735
|
-
*/
|
|
1736
|
-
type SubmoduleSyncOpts = {
|
|
1737
|
-
/** Sync recursively in nested submodules */
|
|
1738
|
-
recursive?: boolean;
|
|
1739
|
-
};
|
|
1740
|
-
/**
|
|
1741
|
-
* Options for submodule set-branch
|
|
1742
|
-
*/
|
|
1743
|
-
type SubmoduleSetBranchOpts = {
|
|
1744
|
-
/** Set the default tracking branch */
|
|
1745
|
-
default?: boolean;
|
|
1746
|
-
};
|
|
1747
|
-
/**
|
|
1748
|
-
* Submodule information
|
|
1749
|
-
*/
|
|
1750
|
-
type SubmoduleInfo = {
|
|
1751
|
-
name: string;
|
|
1752
|
-
path: string;
|
|
1753
|
-
url: string;
|
|
1754
|
-
branch?: string;
|
|
1755
|
-
commit: string;
|
|
1756
|
-
};
|
|
1757
|
-
/**
|
|
1758
|
-
* LFS status information
|
|
1759
|
-
*/
|
|
1760
|
-
type LfsStatus = {
|
|
1761
|
-
files: Array<{
|
|
1762
|
-
name: string;
|
|
1763
|
-
size: number;
|
|
1764
|
-
status: 'checkout' | 'download' | 'upload' | 'unknown';
|
|
1765
|
-
}>;
|
|
1766
|
-
};
|
|
1767
|
-
/**
|
|
1768
|
-
* Options for LFS pull
|
|
1769
|
-
*/
|
|
1770
|
-
type LfsPullOpts = {
|
|
1771
|
-
remote?: string;
|
|
1772
|
-
ref?: string;
|
|
1773
|
-
include?: string[];
|
|
1774
|
-
exclude?: string[];
|
|
1775
|
-
};
|
|
1776
|
-
/**
|
|
1777
|
-
* Options for LFS push
|
|
1778
|
-
*/
|
|
1779
|
-
type LfsPushOpts = {
|
|
1780
|
-
remote?: string;
|
|
1781
|
-
ref?: string;
|
|
1782
|
-
/** Dry run - show what would be pushed without actually pushing */
|
|
1783
|
-
dryRun?: boolean;
|
|
1784
|
-
/** Push specified object IDs (OID hashes) instead of all objects. Empty arrays require stdin: true. */
|
|
1785
|
-
objectId?: string | string[];
|
|
1786
|
-
/** Send objectId values (or ref) as newline-delimited standard input. Requires objectId or ref. */
|
|
1787
|
-
stdin?: boolean;
|
|
1788
|
-
};
|
|
1789
|
-
/**
|
|
1790
|
-
* Options for LFS status
|
|
1791
|
-
*/
|
|
1792
|
-
type LfsStatusOpts = {
|
|
1793
|
-
json?: boolean;
|
|
1794
|
-
/** Machine-readable output */
|
|
1795
|
-
porcelain?: boolean;
|
|
1796
|
-
};
|
|
1797
|
-
/**
|
|
1798
|
-
* Options for LFS prune
|
|
1799
|
-
*/
|
|
1800
|
-
type LfsPruneOpts = {
|
|
1801
|
-
/** Force prune (remove unreferenced objects immediately) */
|
|
1802
|
-
force?: boolean;
|
|
1803
|
-
/** Dry run - show what would be pruned without actually pruning */
|
|
1804
|
-
dryRun?: boolean;
|
|
1805
|
-
/** Verify remote copies before pruning */
|
|
1806
|
-
verifyRemote?: boolean;
|
|
1807
|
-
/** Verify unreferenced copies */
|
|
1808
|
-
verifyUnreferenced?: boolean;
|
|
1809
|
-
/** Only prune objects not accessed recently */
|
|
1810
|
-
recent?: boolean;
|
|
1811
|
-
/** Show verbose output */
|
|
1812
|
-
verbose?: boolean;
|
|
1813
|
-
/** When unverified behavior: panic or ignore */
|
|
1814
|
-
whenUnverified?: 'panic' | 'ignore';
|
|
1815
|
-
};
|
|
1816
|
-
/**
|
|
1817
|
-
* Options for LFS fetch
|
|
1818
|
-
*/
|
|
1819
|
-
type LfsFetchOpts = {
|
|
1820
|
-
/** Fetch all LFS objects for all refs */
|
|
1821
|
-
all?: boolean;
|
|
1822
|
-
/** Include patterns */
|
|
1823
|
-
include?: string | string[];
|
|
1824
|
-
/** Exclude patterns */
|
|
1825
|
-
exclude?: string | string[];
|
|
1826
|
-
/** Only fetch recent objects */
|
|
1827
|
-
recent?: boolean;
|
|
1828
|
-
/** Prune old objects after fetch */
|
|
1829
|
-
prune?: boolean;
|
|
1830
|
-
/** Refetch objects even if already local */
|
|
1831
|
-
refetch?: boolean;
|
|
1832
|
-
/** Dry run - show what would be fetched */
|
|
1833
|
-
dryRun?: boolean;
|
|
1834
|
-
/** Output in JSON format */
|
|
1835
|
-
json?: boolean;
|
|
1836
|
-
/** Remote to fetch from */
|
|
1837
|
-
remote?: string;
|
|
1838
|
-
/** Refs to fetch */
|
|
1839
|
-
refs?: string | string[];
|
|
1840
|
-
};
|
|
1841
|
-
/**
|
|
1842
|
-
* Options for repository-level LFS install
|
|
1843
|
-
*
|
|
1844
|
-
* Used with `repo.lfs.install()` for repository-local LFS configuration.
|
|
1845
|
-
*
|
|
1846
|
-
* @remarks
|
|
1847
|
-
* Internally runs `git lfs install --local` by default, which writes to
|
|
1848
|
-
* the repository's .git/config file. This ensures LFS configuration is
|
|
1849
|
-
* scoped to the current repository only.
|
|
1850
|
-
*
|
|
1851
|
-
* For global (user-level) or system-wide installation, use `git.lfs.install()` instead.
|
|
1852
|
-
*/
|
|
1853
|
-
type RepoLfsInstallOpts = {
|
|
1854
|
-
/** Overwrite existing hooks */
|
|
1855
|
-
force?: boolean;
|
|
1856
|
-
/**
|
|
1857
|
-
* Install for worktree only (instead of repository)
|
|
1858
|
-
*
|
|
1859
|
-
* @remarks
|
|
1860
|
-
* Internally uses `--worktree` flag instead of `--local`.
|
|
1861
|
-
* Requires Git 2.20.0+ with worktreeConfig extension enabled.
|
|
1862
|
-
*/
|
|
1863
|
-
worktree?: boolean;
|
|
1864
|
-
/** Skip smudge filter (don't download during checkout) */
|
|
1865
|
-
skipSmudge?: boolean;
|
|
1866
|
-
};
|
|
1867
|
-
/**
|
|
1868
|
-
* Options for repository-level LFS uninstall
|
|
1869
|
-
*
|
|
1870
|
-
* Used with `repo.lfs.uninstall()` for repository-local LFS configuration removal.
|
|
1871
|
-
*
|
|
1872
|
-
* @remarks
|
|
1873
|
-
* Internally runs `git lfs uninstall --local` by default, which modifies
|
|
1874
|
-
* the repository's .git/config file only.
|
|
1875
|
-
*
|
|
1876
|
-
* For global or system-wide uninstallation, use `git.lfs.uninstall()` instead.
|
|
1877
|
-
*/
|
|
1878
|
-
type RepoLfsUninstallOpts = {
|
|
1879
|
-
/**
|
|
1880
|
-
* Uninstall for worktree only (instead of repository)
|
|
1881
|
-
*
|
|
1882
|
-
* @remarks
|
|
1883
|
-
* Internally uses `--worktree` flag instead of `--local`.
|
|
1884
|
-
* Requires Git 2.20.0+ with worktreeConfig extension enabled.
|
|
1885
|
-
*/
|
|
1886
|
-
worktree?: boolean;
|
|
1887
|
-
};
|
|
1888
|
-
/**
|
|
1889
|
-
* LFS file entry
|
|
1890
|
-
*/
|
|
1891
|
-
type LfsFileEntry = {
|
|
1892
|
-
/** File path */
|
|
1893
|
-
path: string;
|
|
1894
|
-
/** Object ID (SHA-256) */
|
|
1895
|
-
oid: string;
|
|
1896
|
-
/** File size in bytes */
|
|
1897
|
-
size?: number;
|
|
1898
|
-
/** Checkout status */
|
|
1899
|
-
status: 'checked-out' | 'not-checked-out';
|
|
1900
|
-
};
|
|
1901
|
-
/**
|
|
1902
|
-
* Options for LFS ls-files
|
|
1903
|
-
*/
|
|
1904
|
-
type LfsLsFilesOpts = {
|
|
1905
|
-
/** Show full OID (not abbreviated) */
|
|
1906
|
-
long?: boolean;
|
|
1907
|
-
/** Show file sizes */
|
|
1908
|
-
size?: boolean;
|
|
1909
|
-
/** Show debug information */
|
|
1910
|
-
debug?: boolean;
|
|
1911
|
-
/** Show all LFS files (not just current ref) */
|
|
1912
|
-
all?: boolean;
|
|
1913
|
-
/** Show deleted files */
|
|
1914
|
-
deleted?: boolean;
|
|
1915
|
-
/** Include patterns */
|
|
1916
|
-
include?: string | string[];
|
|
1917
|
-
/** Exclude patterns */
|
|
1918
|
-
exclude?: string | string[];
|
|
1919
|
-
/** Show filenames only */
|
|
1920
|
-
nameOnly?: boolean;
|
|
1921
|
-
/** Output in JSON format */
|
|
1922
|
-
json?: boolean;
|
|
1923
|
-
/** Ref to list files for */
|
|
1924
|
-
ref?: string;
|
|
1925
|
-
};
|
|
1926
|
-
/**
|
|
1927
|
-
* LFS track entry
|
|
1928
|
-
*/
|
|
1929
|
-
type LfsTrackEntry = {
|
|
1930
|
-
/** Pattern being tracked */
|
|
1931
|
-
pattern: string;
|
|
1932
|
-
/** Source file (e.g., .gitattributes) */
|
|
1933
|
-
source: string;
|
|
1934
|
-
/** Whether files matching pattern are lockable */
|
|
1935
|
-
lockable: boolean;
|
|
1936
|
-
};
|
|
1937
|
-
/**
|
|
1938
|
-
* Options for LFS track
|
|
1939
|
-
*/
|
|
1940
|
-
type LfsTrackOpts = {
|
|
1941
|
-
/** Show verbose output */
|
|
1942
|
-
verbose?: boolean;
|
|
1943
|
-
/** Dry run - show what would be tracked */
|
|
1944
|
-
dryRun?: boolean;
|
|
1945
|
-
/** Treat pattern as filename, not glob */
|
|
1946
|
-
filename?: boolean;
|
|
1947
|
-
/** Make files lockable */
|
|
1948
|
-
lockable?: boolean;
|
|
1949
|
-
/** Make files not lockable */
|
|
1950
|
-
notLockable?: boolean;
|
|
1951
|
-
/** Don't exclude from export */
|
|
1952
|
-
noExcluded?: boolean;
|
|
1953
|
-
/** Don't modify .gitattributes */
|
|
1954
|
-
noModifyAttrs?: boolean;
|
|
1955
|
-
};
|
|
1956
|
-
/**
|
|
1957
|
-
* LFS lock entry
|
|
1958
|
-
*/
|
|
1959
|
-
type LfsLockEntry = {
|
|
1960
|
-
/** Lock ID */
|
|
1961
|
-
id: string;
|
|
1962
|
-
/** Locked file path */
|
|
1963
|
-
path: string;
|
|
1964
|
-
/** Lock owner */
|
|
1965
|
-
owner: {
|
|
1966
|
-
name: string;
|
|
1967
|
-
};
|
|
1968
|
-
/** Lock timestamp */
|
|
1969
|
-
lockedAt: Date;
|
|
1970
|
-
};
|
|
1971
|
-
/**
|
|
1972
|
-
* Options for LFS lock
|
|
1973
|
-
*/
|
|
1974
|
-
type LfsLockOpts = {
|
|
1975
|
-
/** Remote name */
|
|
1976
|
-
remote?: string;
|
|
1977
|
-
/** Output in JSON format */
|
|
1978
|
-
json?: boolean;
|
|
1979
|
-
};
|
|
1980
|
-
/**
|
|
1981
|
-
* Options for LFS unlock
|
|
1982
|
-
*/
|
|
1983
|
-
type LfsUnlockOpts = {
|
|
1984
|
-
/** Remote name */
|
|
1985
|
-
remote?: string;
|
|
1986
|
-
/** Force unlock (even if owned by another user) */
|
|
1987
|
-
force?: boolean;
|
|
1988
|
-
/** Unlock by ID instead of path */
|
|
1989
|
-
id?: string;
|
|
1990
|
-
/** Output in JSON format */
|
|
1991
|
-
json?: boolean;
|
|
1992
|
-
};
|
|
1993
|
-
/**
|
|
1994
|
-
* Options for LFS locks
|
|
1995
|
-
*/
|
|
1996
|
-
type LfsLocksOpts = {
|
|
1997
|
-
/** Remote name */
|
|
1998
|
-
remote?: string;
|
|
1999
|
-
/** Filter by lock ID */
|
|
2000
|
-
id?: string;
|
|
2001
|
-
/** Filter by path */
|
|
2002
|
-
path?: string;
|
|
2003
|
-
/** Show local cache only */
|
|
2004
|
-
local?: boolean;
|
|
2005
|
-
/** Show cached locks */
|
|
2006
|
-
cached?: boolean;
|
|
2007
|
-
/** Verify locks with server */
|
|
2008
|
-
verify?: boolean;
|
|
2009
|
-
/** Limit number of results */
|
|
2010
|
-
limit?: number;
|
|
2011
|
-
/** Output in JSON format */
|
|
2012
|
-
json?: boolean;
|
|
2013
|
-
};
|
|
2014
|
-
/**
|
|
2015
|
-
* Options for LFS checkout
|
|
2016
|
-
*/
|
|
2017
|
-
type LfsCheckoutOpts = {
|
|
2018
|
-
/** Use base version for conflicts */
|
|
2019
|
-
base?: boolean;
|
|
2020
|
-
/** Use ours version for conflicts */
|
|
2021
|
-
ours?: boolean;
|
|
2022
|
-
/** Use theirs version for conflicts */
|
|
2023
|
-
theirs?: boolean;
|
|
2024
|
-
/** Write to file instead of working tree */
|
|
2025
|
-
to?: string;
|
|
2026
|
-
/** Include patterns */
|
|
2027
|
-
include?: string | string[];
|
|
2028
|
-
/** Exclude patterns */
|
|
2029
|
-
exclude?: string | string[];
|
|
2030
|
-
};
|
|
2031
|
-
/**
|
|
2032
|
-
* Options for LFS migrate info
|
|
2033
|
-
*/
|
|
2034
|
-
type LfsMigrateInfoOpts = {
|
|
2035
|
-
/** Only show files above this size */
|
|
2036
|
-
above?: string | number;
|
|
2037
|
-
/** Show top N files */
|
|
2038
|
-
top?: number;
|
|
2039
|
-
/** Size unit (b, kb, mb, gb) */
|
|
2040
|
-
unit?: 'b' | 'kb' | 'mb' | 'gb';
|
|
2041
|
-
/** Show pointer files */
|
|
2042
|
-
pointers?: 'follow' | 'no-follow' | 'ignore';
|
|
2043
|
-
/** Fix up tracking patterns */
|
|
2044
|
-
fixup?: boolean;
|
|
2045
|
-
/** Include patterns */
|
|
2046
|
-
include?: string | string[];
|
|
2047
|
-
/** Exclude patterns */
|
|
2048
|
-
exclude?: string | string[];
|
|
2049
|
-
/** Include refs */
|
|
2050
|
-
includeRef?: string | string[];
|
|
2051
|
-
/** Exclude refs */
|
|
2052
|
-
excludeRef?: string | string[];
|
|
2053
|
-
/** Skip fetching from remote */
|
|
2054
|
-
skipFetch?: boolean;
|
|
2055
|
-
/** Operate on all refs */
|
|
2056
|
-
everything?: boolean;
|
|
2057
|
-
/** Confirm destructive operation */
|
|
2058
|
-
yesReally?: boolean;
|
|
2059
|
-
};
|
|
2060
|
-
/**
|
|
2061
|
-
* Options for LFS migrate import
|
|
2062
|
-
*/
|
|
2063
|
-
type LfsMigrateImportOpts = LfsMigrateInfoOpts & {
|
|
2064
|
-
/** Show verbose output */
|
|
2065
|
-
verbose?: boolean;
|
|
2066
|
-
/** Write object map file */
|
|
2067
|
-
objectMap?: string;
|
|
2068
|
-
/** Don't rewrite history */
|
|
2069
|
-
noRewrite?: boolean;
|
|
2070
|
-
/** Commit message for fixup */
|
|
2071
|
-
message?: string;
|
|
2072
|
-
/** Object IDs to import */
|
|
2073
|
-
object?: string | string[];
|
|
2074
|
-
};
|
|
2075
|
-
/**
|
|
2076
|
-
* Options for LFS migrate export
|
|
2077
|
-
*/
|
|
2078
|
-
type LfsMigrateExportOpts = LfsMigrateInfoOpts & {
|
|
2079
|
-
/** Show verbose output */
|
|
2080
|
-
verbose?: boolean;
|
|
2081
|
-
/** Write object map file */
|
|
2082
|
-
objectMap?: string;
|
|
2083
|
-
/** Remote name */
|
|
2084
|
-
remote?: string;
|
|
2085
|
-
};
|
|
2086
|
-
/**
|
|
2087
|
-
* LFS environment info
|
|
2088
|
-
*/
|
|
2089
|
-
type LfsEnvInfo = {
|
|
2090
|
-
/** LFS version */
|
|
2091
|
-
lfsVersion: string;
|
|
2092
|
-
/** Git version */
|
|
2093
|
-
gitVersion: string;
|
|
2094
|
-
/** Endpoint URL */
|
|
2095
|
-
endpoint: string;
|
|
2096
|
-
/** SSH endpoint */
|
|
2097
|
-
sshEndpoint?: string;
|
|
2098
|
-
/** Local working directory */
|
|
2099
|
-
localWorkingDir?: string;
|
|
2100
|
-
/** Local git directory */
|
|
2101
|
-
localGitDir?: string;
|
|
2102
|
-
/** Local git storage directory */
|
|
2103
|
-
localGitStorageDir?: string;
|
|
2104
|
-
/** Local media directory */
|
|
2105
|
-
localMediaDir?: string;
|
|
2106
|
-
/** Local reference directories */
|
|
2107
|
-
localReferenceDirs?: string;
|
|
2108
|
-
/** Temp directory */
|
|
2109
|
-
tempDir?: string;
|
|
2110
|
-
/** Concurrent transfers */
|
|
2111
|
-
concurrentTransfers?: number;
|
|
2112
|
-
/** TUS transfers enabled */
|
|
2113
|
-
tusTransfers?: boolean;
|
|
2114
|
-
/** Basic transfers only */
|
|
2115
|
-
basicTransfersOnly?: boolean;
|
|
2116
|
-
/** Skip download errors */
|
|
2117
|
-
skipDownloadErrors?: boolean;
|
|
2118
|
-
/** Fetch recent always */
|
|
2119
|
-
fetchRecentAlways?: boolean;
|
|
2120
|
-
/** Fetch recent refs days */
|
|
2121
|
-
fetchRecentRefsDays?: number;
|
|
2122
|
-
/** Fetch recent commits days */
|
|
2123
|
-
fetchRecentCommitsDays?: number;
|
|
2124
|
-
/** Fetch recent refs include remotes */
|
|
2125
|
-
fetchRecentRefsIncludeRemotes?: boolean;
|
|
2126
|
-
/** Prune offset days */
|
|
2127
|
-
pruneOffsetDays?: number;
|
|
2128
|
-
/** Prune verify remote always */
|
|
2129
|
-
pruneVerifyRemoteAlways?: boolean;
|
|
2130
|
-
/** Prune remote name */
|
|
2131
|
-
pruneRemoteName?: string;
|
|
2132
|
-
/** Access mode for downloads */
|
|
2133
|
-
accessDownload?: string;
|
|
2134
|
-
/** Access mode for uploads */
|
|
2135
|
-
accessUpload?: string;
|
|
2136
|
-
};
|
|
2137
|
-
/**
|
|
2138
|
-
* Options for LFS pre-upload (§10.3)
|
|
2139
|
-
*
|
|
2140
|
-
* Pre-upload allows pushing LFS objects before the refs push,
|
|
2141
|
-
* enabling 2-phase commit patterns for improved reliability.
|
|
2142
|
-
*/
|
|
2143
|
-
type LfsPreUploadOpts = {
|
|
2144
|
-
/** Object IDs to upload (if omitted, auto-detect pending objects) */
|
|
2145
|
-
oids?: string[];
|
|
2146
|
-
/**
|
|
2147
|
-
* Number of OIDs per `git lfs push --object-id` invocation (default: 200).
|
|
2148
|
-
*
|
|
2149
|
-
* Each batch is one spawned process, so the batch size is bounded by the
|
|
2150
|
-
* OS command-line length limit. Git is spawned without a shell, so the
|
|
2151
|
-
* binding limit is the Windows CreateProcess limit (32,767 characters);
|
|
2152
|
-
* the default stays around 40% of it.
|
|
2153
|
-
*/
|
|
2154
|
-
batchSize?: number;
|
|
2155
|
-
/**
|
|
2156
|
-
* Maximum number of batches uploaded concurrently (default: 4).
|
|
2157
|
-
*
|
|
2158
|
-
* Each `git lfs push` invocation pays a fixed cost (process spawn,
|
|
2159
|
-
* credential lookup, LFS batch API round-trip) before any bytes are
|
|
2160
|
-
* transferred; concurrent batches overlap that cost with other batches'
|
|
2161
|
-
* transfers. The first batch always runs alone and the remaining batches
|
|
2162
|
-
* start only after it succeeds, so a failure common to all batches (e.g.
|
|
2163
|
-
* an unreachable remote) costs a single round-trip. Once a batch fails, no
|
|
2164
|
-
* new batch is started; in-flight batches are awaited and the remaining
|
|
2165
|
-
* objects are reported in `skippedCount`. Set to 1 for strictly serial
|
|
2166
|
-
* uploads.
|
|
2167
|
-
*
|
|
2168
|
-
* Note: each `git lfs push` process transfers multiple objects in parallel
|
|
2169
|
-
* on its own (`lfs.concurrenttransfers`, default 8), so the peak transfer
|
|
2170
|
-
* parallelism is `concurrency` times that value. With `concurrency` > 1,
|
|
2171
|
-
* progress callbacks from different batches may interleave.
|
|
2172
|
-
*/
|
|
2173
|
-
concurrency?: number;
|
|
2174
|
-
/** Remote name (default: 'origin') */
|
|
2175
|
-
remote?: string;
|
|
2176
|
-
};
|
|
2177
|
-
/**
|
|
2178
|
-
* Result from LFS pre-upload
|
|
2179
|
-
*/
|
|
2180
|
-
type LfsPreUploadResult = {
|
|
2181
|
-
/** Number of objects uploaded */
|
|
2182
|
-
uploadedCount: number;
|
|
2183
|
-
/** Total bytes uploaded */
|
|
2184
|
-
uploadedBytes: number;
|
|
2185
|
-
/**
|
|
2186
|
-
* Number of objects not uploaded: the objects of the batch that failed or
|
|
2187
|
-
* was aborted, plus those of the batches never started after that failure.
|
|
2188
|
-
* `uploadedCount + skippedCount` always equals the number of objects.
|
|
2189
|
-
*/
|
|
2190
|
-
skippedCount: number;
|
|
2191
|
-
};
|
|
2192
|
-
/**
|
|
2193
|
-
* Options for LFS pre-download (§10.3)
|
|
2194
|
-
*
|
|
2195
|
-
* Pre-download allows fetching LFS objects before checkout,
|
|
2196
|
-
* useful for controlled large file management.
|
|
2197
|
-
*/
|
|
2198
|
-
type LfsPreDownloadOpts = {
|
|
2199
|
-
/** Object IDs to download (if omitted, auto-detect from ref) */
|
|
2200
|
-
oids?: string[];
|
|
2201
|
-
/** Git ref to get LFS objects for (branch, tag, or commit) */
|
|
2202
|
-
ref?: string;
|
|
2203
|
-
/** Batch size for download (default: 50) */
|
|
2204
|
-
batchSize?: number;
|
|
2205
|
-
/** Remote name (default: 'origin') */
|
|
2206
|
-
remote?: string;
|
|
2207
|
-
};
|
|
2208
|
-
/**
|
|
2209
|
-
* Result from LFS pre-download
|
|
2210
|
-
*/
|
|
2211
|
-
type LfsPreDownloadResult = {
|
|
2212
|
-
/** Number of objects downloaded */
|
|
2213
|
-
downloadedCount: number;
|
|
2214
|
-
/** Total bytes downloaded */
|
|
2215
|
-
downloadedBytes: number;
|
|
2216
|
-
/** Number of objects skipped (already local) */
|
|
2217
|
-
skippedCount: number;
|
|
2218
|
-
};
|
|
2219
|
-
/**
|
|
2220
|
-
* Worktree information (§7.4)
|
|
2221
|
-
*
|
|
2222
|
-
* Parsed from `git worktree list --porcelain` output.
|
|
2223
|
-
*/
|
|
2224
|
-
type Worktree = {
|
|
2225
|
-
/** Worktree path */
|
|
2226
|
-
path: string;
|
|
2227
|
-
/** HEAD commit hash */
|
|
2228
|
-
head: string;
|
|
2229
|
-
/** Branch name (if checked out) */
|
|
2230
|
-
branch?: string;
|
|
2231
|
-
/** Whether the worktree is locked */
|
|
2232
|
-
locked: boolean;
|
|
2233
|
-
/** Whether the worktree is prunable */
|
|
2234
|
-
prunable: boolean;
|
|
2235
|
-
};
|
|
2236
|
-
/**
|
|
2237
|
-
* Options for adding a worktree
|
|
2238
|
-
*/
|
|
2239
|
-
type WorktreeAddOpts = {
|
|
2240
|
-
/**
|
|
2241
|
-
* Commit-ish to checkout (branch, tag, or commit hash)
|
|
2242
|
-
*
|
|
2243
|
-
* @example
|
|
2244
|
-
* ```typescript
|
|
2245
|
-
* // Checkout a specific commit in detached mode
|
|
2246
|
-
* await repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'abc1234' });
|
|
2247
|
-
*
|
|
2248
|
-
* // Checkout a tag
|
|
2249
|
-
* await repo.worktree.add('/tmp/worktree', { detach: true, commitish: 'v1.0.0' });
|
|
2250
|
-
*
|
|
2251
|
-
* // Checkout a branch
|
|
2252
|
-
* await repo.worktree.add('/tmp/worktree', { commitish: 'feature-branch' });
|
|
2253
|
-
* ```
|
|
2254
|
-
*/
|
|
2255
|
-
commitish?: string;
|
|
2256
|
-
/** Branch name to create (-b flag) */
|
|
2257
|
-
branch?: string;
|
|
2258
|
-
/** Create detached HEAD */
|
|
2259
|
-
detach?: boolean;
|
|
2260
|
-
/** Track remote branch */
|
|
2261
|
-
track?: boolean;
|
|
2262
|
-
/** Force creation even if branch is already checked out */
|
|
2263
|
-
force?: boolean;
|
|
2264
|
-
/** Checkout the worktree (true) or not (false) */
|
|
2265
|
-
checkout?: boolean;
|
|
2266
|
-
/** Keep the worktree locked after creation */
|
|
2267
|
-
lock?: boolean;
|
|
2268
|
-
/** Create worktree with orphan branch */
|
|
2269
|
-
orphan?: boolean;
|
|
2270
|
-
};
|
|
2271
|
-
/**
|
|
2272
|
-
* Options for removing a worktree
|
|
2273
|
-
*/
|
|
2274
|
-
type WorktreeRemoveOpts = {
|
|
2275
|
-
/** Force removal even if dirty */
|
|
2276
|
-
force?: boolean;
|
|
2277
|
-
};
|
|
2278
|
-
/**
|
|
2279
|
-
* Options for pruning worktrees
|
|
2280
|
-
*/
|
|
2281
|
-
type WorktreePruneOpts = {
|
|
2282
|
-
/** Show what would be pruned without actually pruning */
|
|
2283
|
-
dryRun?: boolean;
|
|
2284
|
-
/** Show more details */
|
|
2285
|
-
verbose?: boolean;
|
|
2286
|
-
/** Expire worktrees older than the given time */
|
|
2287
|
-
expire?: string;
|
|
2288
|
-
};
|
|
2289
|
-
/**
|
|
2290
|
-
* Options for worktree move
|
|
2291
|
-
*/
|
|
2292
|
-
type WorktreeMoveOpts = {
|
|
2293
|
-
/** Force move even if destination exists */
|
|
2294
|
-
force?: boolean;
|
|
2295
|
-
};
|
|
2296
|
-
/**
|
|
2297
|
-
* Options for worktree repair
|
|
2298
|
-
*/
|
|
2299
|
-
type WorktreeRepairOpts = {};
|
|
2300
|
-
/**
|
|
2301
|
-
* Options for locking a worktree
|
|
2302
|
-
*/
|
|
2303
|
-
type WorktreeLockOpts = {
|
|
2304
|
-
/** Reason for locking */
|
|
2305
|
-
reason?: string;
|
|
2306
|
-
};
|
|
2307
|
-
/**
|
|
2308
|
-
* Worktree operations
|
|
2309
|
-
*
|
|
2310
|
-
* Wraps: `git worktree` subcommands
|
|
2311
|
-
*/
|
|
2312
|
-
interface WorktreeOperations {
|
|
2313
|
-
/**
|
|
2314
|
-
* List all worktrees
|
|
2315
|
-
*
|
|
2316
|
-
* Wraps: `git worktree list --porcelain`
|
|
2317
|
-
*/
|
|
2318
|
-
list(opts?: ExecOpts): Promise<Worktree[]>;
|
|
2319
|
-
/**
|
|
2320
|
-
* Add a new worktree and return a repository object for it
|
|
2321
|
-
*
|
|
2322
|
-
* Wraps: `git worktree add <path>`
|
|
2323
|
-
*
|
|
2324
|
-
* @returns A WorktreeRepo instance for the newly created worktree
|
|
2325
|
-
*/
|
|
2326
|
-
add(path: string, opts?: WorktreeAddOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
2327
|
-
/**
|
|
2328
|
-
* Remove a worktree
|
|
2329
|
-
*
|
|
2330
|
-
* Wraps: `git worktree remove <path>`
|
|
2331
|
-
*/
|
|
2332
|
-
remove(path: string, opts?: WorktreeRemoveOpts & ExecOpts): Promise<void>;
|
|
2333
|
-
/**
|
|
2334
|
-
* Prune stale worktree references
|
|
2335
|
-
*
|
|
2336
|
-
* Wraps: `git worktree prune`
|
|
2337
|
-
*/
|
|
2338
|
-
prune(opts?: WorktreePruneOpts & ExecOpts): Promise<string[]>;
|
|
2339
|
-
/**
|
|
2340
|
-
* Lock a worktree
|
|
2341
|
-
*
|
|
2342
|
-
* Wraps: `git worktree lock <path>`
|
|
2343
|
-
*/
|
|
2344
|
-
lock(path: string, opts?: WorktreeLockOpts & ExecOpts): Promise<void>;
|
|
2345
|
-
/**
|
|
2346
|
-
* Unlock a worktree
|
|
2347
|
-
*
|
|
2348
|
-
* Wraps: `git worktree unlock <path>`
|
|
2349
|
-
*/
|
|
2350
|
-
unlock(path: string, opts?: ExecOpts): Promise<void>;
|
|
2351
|
-
/**
|
|
2352
|
-
* Move a worktree to a new location and return a repository object for it
|
|
2353
|
-
*
|
|
2354
|
-
* Wraps: `git worktree move <src> <dst>`
|
|
2355
|
-
*
|
|
2356
|
-
* @returns A WorktreeRepo instance for the worktree at the new location
|
|
2357
|
-
*/
|
|
2358
|
-
move(src: string, dst: string, opts?: WorktreeMoveOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
2359
|
-
/**
|
|
2360
|
-
* Repair worktree administrative files
|
|
2361
|
-
*
|
|
2362
|
-
* Wraps: `git worktree repair`
|
|
2363
|
-
*/
|
|
2364
|
-
repair(paths?: string[], opts?: ExecOpts): Promise<void>;
|
|
2365
|
-
}
|
|
2366
|
-
/**
|
|
2367
|
-
* LFS operations
|
|
2368
|
-
*
|
|
2369
|
-
* Wraps: `git lfs` subcommands
|
|
2370
|
-
*/
|
|
2371
|
-
interface LfsOperations {
|
|
2372
|
-
/**
|
|
2373
|
-
* Pull LFS objects
|
|
2374
|
-
*
|
|
2375
|
-
* Wraps: `git lfs pull`
|
|
2376
|
-
*/
|
|
2377
|
-
pull(opts?: LfsPullOpts & ExecOpts): Promise<void>;
|
|
2378
|
-
/**
|
|
2379
|
-
* Push LFS objects
|
|
2380
|
-
*
|
|
2381
|
-
* Wraps: `git lfs push`
|
|
2382
|
-
*/
|
|
2383
|
-
push(opts?: LfsPushOpts & ExecOpts): Promise<void>;
|
|
2384
|
-
/**
|
|
2385
|
-
* Get LFS status
|
|
2386
|
-
*
|
|
2387
|
-
* Wraps: `git lfs status`
|
|
2388
|
-
*/
|
|
2389
|
-
status(opts?: LfsStatusOpts & ExecOpts): Promise<LfsStatus>;
|
|
2390
|
-
/**
|
|
2391
|
-
* Prune old and unreferenced LFS objects from local storage
|
|
2392
|
-
*
|
|
2393
|
-
* Wraps: `git lfs prune`
|
|
2394
|
-
*/
|
|
2395
|
-
prune(opts?: LfsPruneOpts & ExecOpts): Promise<void>;
|
|
2396
|
-
/**
|
|
2397
|
-
* Fetch LFS objects from remote
|
|
2398
|
-
*
|
|
2399
|
-
* Wraps: `git lfs fetch`
|
|
2400
|
-
*/
|
|
2401
|
-
fetch(opts?: LfsFetchOpts & ExecOpts): Promise<void>;
|
|
2402
|
-
/**
|
|
2403
|
-
* Install Git LFS hooks for this repository
|
|
2404
|
-
*
|
|
2405
|
-
* Wraps: `git lfs install --local`
|
|
2406
|
-
*
|
|
2407
|
-
* Installs LFS hooks to the repository's .git/config file.
|
|
2408
|
-
* This ensures LFS configuration is scoped to this repository only.
|
|
2409
|
-
*
|
|
2410
|
-
* @remarks
|
|
2411
|
-
* Internally always adds `--local` flag (or `--worktree` if specified).
|
|
2412
|
-
* For global or system-wide installation, use `git.lfs.install()` instead.
|
|
2413
|
-
*
|
|
2414
|
-
* @example
|
|
2415
|
-
* ```typescript
|
|
2416
|
-
* // Install LFS locally for this repository
|
|
2417
|
-
* await repo.lfs.install();
|
|
2418
|
-
*
|
|
2419
|
-
* // Install for worktree only (Git 2.20.0+)
|
|
2420
|
-
* await repo.lfs.install({ worktree: true });
|
|
2421
|
-
* ```
|
|
2422
|
-
*/
|
|
2423
|
-
install(opts?: RepoLfsInstallOpts & ExecOpts): Promise<void>;
|
|
2424
|
-
/**
|
|
2425
|
-
* Uninstall Git LFS hooks from this repository
|
|
2426
|
-
*
|
|
2427
|
-
* Wraps: `git lfs uninstall --local`
|
|
2428
|
-
*
|
|
2429
|
-
* Removes LFS hooks from the repository's .git/config file.
|
|
2430
|
-
*
|
|
2431
|
-
* @remarks
|
|
2432
|
-
* Internally always adds `--local` flag (or `--worktree` if specified).
|
|
2433
|
-
* For global or system-wide uninstallation, use `git.lfs.uninstall()` instead.
|
|
2434
|
-
*
|
|
2435
|
-
* @example
|
|
2436
|
-
* ```typescript
|
|
2437
|
-
* // Uninstall LFS from this repository
|
|
2438
|
-
* await repo.lfs.uninstall();
|
|
2439
|
-
* ```
|
|
2440
|
-
*/
|
|
2441
|
-
uninstall(opts?: RepoLfsUninstallOpts & ExecOpts): Promise<void>;
|
|
2442
|
-
/**
|
|
2443
|
-
* List LFS files in the repository
|
|
2444
|
-
*
|
|
2445
|
-
* Wraps: `git lfs ls-files`
|
|
2446
|
-
*/
|
|
2447
|
-
lsFiles(opts?: LfsLsFilesOpts & ExecOpts): Promise<LfsFileEntry[]>;
|
|
2448
|
-
/**
|
|
2449
|
-
* Track files with LFS
|
|
2450
|
-
*
|
|
2451
|
-
* Wraps: `git lfs track <pattern>...`
|
|
2452
|
-
*/
|
|
2453
|
-
track(patterns: string | string[], opts?: LfsTrackOpts & ExecOpts): Promise<void>;
|
|
2454
|
-
/**
|
|
2455
|
-
* List tracked patterns
|
|
2456
|
-
*
|
|
2457
|
-
* Wraps: `git lfs track` (without arguments)
|
|
2458
|
-
*/
|
|
2459
|
-
trackList(opts?: ExecOpts): Promise<LfsTrackEntry[]>;
|
|
2460
|
-
/**
|
|
2461
|
-
* Untrack files from LFS
|
|
2462
|
-
*
|
|
2463
|
-
* Wraps: `git lfs untrack <pattern>...`
|
|
2464
|
-
*/
|
|
2465
|
-
untrack(patterns: string | string[], opts?: ExecOpts): Promise<void>;
|
|
2466
|
-
/**
|
|
2467
|
-
* Lock a file
|
|
2468
|
-
*
|
|
2469
|
-
* Wraps: `git lfs lock <path>`
|
|
2470
|
-
*/
|
|
2471
|
-
lock(path: string, opts?: LfsLockOpts & ExecOpts): Promise<LfsLockEntry>;
|
|
2472
|
-
/**
|
|
2473
|
-
* Unlock a file
|
|
2474
|
-
*
|
|
2475
|
-
* Wraps: `git lfs unlock <path>`
|
|
2476
|
-
*/
|
|
2477
|
-
unlock(pathOrId: string, opts?: LfsUnlockOpts & ExecOpts): Promise<void>;
|
|
2478
|
-
/**
|
|
2479
|
-
* List locked files
|
|
2480
|
-
*
|
|
2481
|
-
* Wraps: `git lfs locks`
|
|
2482
|
-
*/
|
|
2483
|
-
locks(opts?: LfsLocksOpts & ExecOpts): Promise<LfsLockEntry[]>;
|
|
2484
|
-
/**
|
|
2485
|
-
* Checkout LFS files (replace pointer files with actual content)
|
|
2486
|
-
*
|
|
2487
|
-
* Wraps: `git lfs checkout`
|
|
2488
|
-
*/
|
|
2489
|
-
checkout(patterns?: string | string[], opts?: LfsCheckoutOpts & ExecOpts): Promise<void>;
|
|
2490
|
-
/**
|
|
2491
|
-
* Show information about LFS files that would be migrated
|
|
2492
|
-
*
|
|
2493
|
-
* Wraps: `git lfs migrate info`
|
|
2494
|
-
*/
|
|
2495
|
-
migrateInfo(opts?: LfsMigrateInfoOpts & ExecOpts): Promise<string>;
|
|
2496
|
-
/**
|
|
2497
|
-
* Import files into LFS
|
|
2498
|
-
*
|
|
2499
|
-
* Wraps: `git lfs migrate import`
|
|
2500
|
-
*/
|
|
2501
|
-
migrateImport(opts?: LfsMigrateImportOpts & ExecOpts): Promise<void>;
|
|
2502
|
-
/**
|
|
2503
|
-
* Export files from LFS
|
|
2504
|
-
*
|
|
2505
|
-
* Wraps: `git lfs migrate export`
|
|
2506
|
-
*/
|
|
2507
|
-
migrateExport(opts?: LfsMigrateExportOpts & ExecOpts): Promise<void>;
|
|
2508
|
-
/**
|
|
2509
|
-
* Get LFS environment information
|
|
2510
|
-
*
|
|
2511
|
-
* Wraps: `git lfs env`
|
|
2512
|
-
*/
|
|
2513
|
-
env(opts?: ExecOpts): Promise<LfsEnvInfo>;
|
|
2514
|
-
/**
|
|
2515
|
-
* Get Git LFS version
|
|
2516
|
-
*
|
|
2517
|
-
* Wraps: `git lfs version`
|
|
2518
|
-
*/
|
|
2519
|
-
version(opts?: ExecOpts): Promise<string>;
|
|
2520
|
-
}
|
|
2521
|
-
/**
|
|
2522
|
-
* LFS Extra operations interface (inspired by fs-extra)
|
|
2523
|
-
*
|
|
2524
|
-
* Additional LFS utilities not part of the core LFS commands.
|
|
2525
|
-
* These enable advanced patterns like 2-phase commit/fetch.
|
|
2526
|
-
*/
|
|
2527
|
-
interface LfsExtraOperations {
|
|
2528
|
-
/**
|
|
2529
|
-
* Pre-upload LFS objects before refs push (§10.3)
|
|
2530
|
-
*
|
|
2531
|
-
* Enables 2-phase commit pattern for improved reliability with large files.
|
|
2532
|
-
* Objects are uploaded in batches to handle Windows command line limits.
|
|
2533
|
-
*
|
|
2534
|
-
* @example
|
|
2535
|
-
* ```typescript
|
|
2536
|
-
* // Phase 1: Upload LFS objects first
|
|
2537
|
-
* await repo.lfsExtra.preUpload({ onProgress: handleProgress });
|
|
2538
|
-
*
|
|
2539
|
-
* // Phase 2: Create commit
|
|
2540
|
-
* await repo.commit({ message: 'Add large files' });
|
|
2541
|
-
*
|
|
2542
|
-
* // Phase 3: Push refs (LFS already uploaded, so this is fast)
|
|
2543
|
-
* await repo.push();
|
|
2544
|
-
* ```
|
|
2545
|
-
*/
|
|
2546
|
-
preUpload(opts?: LfsPreUploadOpts & ExecOpts): Promise<LfsPreUploadResult>;
|
|
2547
|
-
/**
|
|
2548
|
-
* Pre-download LFS objects before checkout (§10.3)
|
|
2549
|
-
*
|
|
2550
|
-
* Enables controlled download of large files before checkout.
|
|
2551
|
-
* Useful when you need to verify available space or report progress separately.
|
|
2552
|
-
*/
|
|
2553
|
-
preDownload(opts?: LfsPreDownloadOpts & ExecOpts): Promise<LfsPreDownloadResult>;
|
|
2554
|
-
}
|
|
2555
|
-
/**
|
|
2556
|
-
* Branch operations
|
|
2557
|
-
*
|
|
2558
|
-
* Wraps: `git branch` subcommands
|
|
2559
|
-
*/
|
|
2560
|
-
interface BranchOperations {
|
|
2561
|
-
/**
|
|
2562
|
-
* List branches
|
|
2563
|
-
*
|
|
2564
|
-
* Wraps: `git branch --list`
|
|
2565
|
-
*/
|
|
2566
|
-
list(opts?: BranchOpts & ExecOpts): Promise<BranchInfo[]>;
|
|
2567
|
-
/**
|
|
2568
|
-
* Get current branch name
|
|
2569
|
-
*
|
|
2570
|
-
* Wraps: `git branch --show-current`
|
|
2571
|
-
*/
|
|
2572
|
-
current(opts?: ExecOpts): Promise<string | null>;
|
|
2573
|
-
/**
|
|
2574
|
-
* Create a new branch
|
|
2575
|
-
*
|
|
2576
|
-
* Wraps: `git branch <name>`
|
|
2577
|
-
*/
|
|
2578
|
-
create(name: string, opts?: BranchCreateOpts & ExecOpts): Promise<void>;
|
|
2579
|
-
/**
|
|
2580
|
-
* Delete a branch
|
|
2581
|
-
*
|
|
2582
|
-
* Wraps: `git branch -d|-D <name>`
|
|
2583
|
-
*/
|
|
2584
|
-
delete(name: string, opts?: BranchDeleteOpts & ExecOpts): Promise<void>;
|
|
2585
|
-
/**
|
|
2586
|
-
* Rename a branch
|
|
2587
|
-
*
|
|
2588
|
-
* Wraps: `git branch -m <old> <new>`
|
|
2589
|
-
*/
|
|
2590
|
-
rename(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
|
|
2591
|
-
}
|
|
2592
|
-
/**
|
|
2593
|
-
* Stash operations
|
|
2594
|
-
*
|
|
2595
|
-
* Wraps: `git stash` subcommands
|
|
2596
|
-
*/
|
|
2597
|
-
interface StashOperations {
|
|
2598
|
-
/**
|
|
2599
|
-
* List stash entries
|
|
2600
|
-
*
|
|
2601
|
-
* Wraps: `git stash list`
|
|
2602
|
-
*/
|
|
2603
|
-
list(opts?: ExecOpts): Promise<StashEntry[]>;
|
|
2604
|
-
/**
|
|
2605
|
-
* Push changes to stash
|
|
2606
|
-
*
|
|
2607
|
-
* Wraps: `git stash push`
|
|
2608
|
-
*/
|
|
2609
|
-
push(opts?: StashPushOpts & ExecOpts): Promise<void>;
|
|
2610
|
-
/**
|
|
2611
|
-
* Pop stash entry
|
|
2612
|
-
*
|
|
2613
|
-
* Wraps: `git stash pop`
|
|
2614
|
-
*/
|
|
2615
|
-
pop(opts?: StashApplyOpts & ExecOpts): Promise<void>;
|
|
2616
|
-
/**
|
|
2617
|
-
* Apply stash entry (without removing from stash)
|
|
2618
|
-
*
|
|
2619
|
-
* Wraps: `git stash apply`
|
|
2620
|
-
*/
|
|
2621
|
-
apply(opts?: StashApplyOpts & ExecOpts): Promise<void>;
|
|
2622
|
-
/**
|
|
2623
|
-
* Drop a stash entry
|
|
2624
|
-
*
|
|
2625
|
-
* Wraps: `git stash drop`
|
|
2626
|
-
*/
|
|
2627
|
-
drop(index?: number, opts?: ExecOpts): Promise<void>;
|
|
2628
|
-
/**
|
|
2629
|
-
* Clear all stash entries
|
|
2630
|
-
*
|
|
2631
|
-
* Wraps: `git stash clear`
|
|
2632
|
-
*/
|
|
2633
|
-
clear(opts?: ExecOpts): Promise<void>;
|
|
2634
|
-
}
|
|
2635
|
-
/**
|
|
2636
|
-
* Tag operations
|
|
2637
|
-
*
|
|
2638
|
-
* Wraps: `git tag` subcommands
|
|
2639
|
-
*/
|
|
2640
|
-
interface TagOperations {
|
|
2641
|
-
/**
|
|
2642
|
-
* List tags
|
|
2643
|
-
*
|
|
2644
|
-
* Wraps: `git tag --list`
|
|
2645
|
-
*/
|
|
2646
|
-
list(opts?: TagListOpts & ExecOpts): Promise<string[]>;
|
|
2647
|
-
/**
|
|
2648
|
-
* Create a tag
|
|
2649
|
-
*
|
|
2650
|
-
* Wraps: `git tag <name>`
|
|
2651
|
-
*/
|
|
2652
|
-
create(name: string, opts?: TagCreateOpts & ExecOpts): Promise<void>;
|
|
2653
|
-
/**
|
|
2654
|
-
* Delete a tag
|
|
2655
|
-
*
|
|
2656
|
-
* Wraps: `git tag -d <name>`
|
|
2657
|
-
*/
|
|
2658
|
-
delete(name: string, opts?: ExecOpts): Promise<void>;
|
|
2659
|
-
/**
|
|
2660
|
-
* Get tag info
|
|
2661
|
-
*
|
|
2662
|
-
* Wraps: `git tag -v <name>` / `git show <tag>`
|
|
2663
|
-
*/
|
|
2664
|
-
show(name: string, opts?: ExecOpts): Promise<TagInfo>;
|
|
2665
|
-
}
|
|
2666
|
-
/**
|
|
2667
|
-
* Remote information
|
|
2668
|
-
*/
|
|
2669
|
-
type RemoteInfo = {
|
|
2670
|
-
/** Remote name */
|
|
2671
|
-
name: string;
|
|
2672
|
-
/** Fetch URL */
|
|
2673
|
-
fetchUrl: string;
|
|
2674
|
-
/** Push URL (may differ from fetchUrl) */
|
|
2675
|
-
pushUrl: string;
|
|
2676
|
-
};
|
|
2677
|
-
/**
|
|
2678
|
-
* Options for adding a remote
|
|
2679
|
-
*/
|
|
2680
|
-
type RemoteAddOpts = {
|
|
2681
|
-
/** Set up tracking for default branch */
|
|
2682
|
-
track?: string;
|
|
2683
|
-
/** Only fetch specified branches */
|
|
2684
|
-
fetch?: boolean;
|
|
2685
|
-
/** Set up as mirror */
|
|
2686
|
-
mirror?: 'fetch' | 'push';
|
|
2687
|
-
/** Import tags from remote (true) or not (false) */
|
|
2688
|
-
tags?: boolean;
|
|
2689
|
-
};
|
|
2690
|
-
/**
|
|
2691
|
-
* Options for remote set-head
|
|
2692
|
-
*/
|
|
2693
|
-
type RemoteSetHeadOpts = {
|
|
2694
|
-
/** Automatically determine remote HEAD */
|
|
2695
|
-
auto?: boolean;
|
|
2696
|
-
/** Delete the symbolic-ref for remote HEAD */
|
|
2697
|
-
delete?: boolean;
|
|
2698
|
-
};
|
|
2699
|
-
/**
|
|
2700
|
-
* Options for remote show
|
|
2701
|
-
*/
|
|
2702
|
-
type RemoteShowOpts = {
|
|
2703
|
-
/** Do not query remote heads */
|
|
2704
|
-
noQuery?: boolean;
|
|
2705
|
-
};
|
|
2706
|
-
/**
|
|
2707
|
-
* Options for remote prune
|
|
2708
|
-
*/
|
|
2709
|
-
type RemotePruneOpts = {
|
|
2710
|
-
/** Dry run - show what would be pruned */
|
|
2711
|
-
dryRun?: boolean;
|
|
2712
|
-
};
|
|
2713
|
-
/**
|
|
2714
|
-
* Options for remote update
|
|
2715
|
-
*/
|
|
2716
|
-
type RemoteUpdateOpts = {
|
|
2717
|
-
/** Prune remote-tracking branches */
|
|
2718
|
-
prune?: boolean;
|
|
2719
|
-
};
|
|
2720
|
-
/**
|
|
2721
|
-
* Options for remote set-branches
|
|
2722
|
-
*/
|
|
2723
|
-
type RemoteSetBranchesOpts = {
|
|
2724
|
-
/** Add branches instead of replacing */
|
|
2725
|
-
add?: boolean;
|
|
2726
|
-
};
|
|
2727
|
-
/**
|
|
2728
|
-
* Options for getting/setting remote URL
|
|
2729
|
-
*/
|
|
2730
|
-
type RemoteUrlOpts = {
|
|
2731
|
-
/** Target push URL instead of fetch URL */
|
|
2732
|
-
push?: boolean;
|
|
2733
|
-
};
|
|
2734
|
-
/**
|
|
2735
|
-
* Remote operations
|
|
2736
|
-
*
|
|
2737
|
-
* Wraps: `git remote` subcommands
|
|
2738
|
-
*/
|
|
2739
|
-
interface RemoteOperations {
|
|
2740
|
-
/**
|
|
2741
|
-
* List remotes
|
|
2742
|
-
*
|
|
2743
|
-
* Wraps: `git remote -v`
|
|
2744
|
-
*/
|
|
2745
|
-
list(opts?: ExecOpts): Promise<RemoteInfo[]>;
|
|
2746
|
-
/**
|
|
2747
|
-
* Add a remote
|
|
2748
|
-
*
|
|
2749
|
-
* Wraps: `git remote add <name> <url>`
|
|
2750
|
-
*/
|
|
2751
|
-
add(name: string, url: string, opts?: RemoteAddOpts & ExecOpts): Promise<void>;
|
|
2752
|
-
/**
|
|
2753
|
-
* Remove a remote
|
|
2754
|
-
*
|
|
2755
|
-
* Wraps: `git remote remove <name>`
|
|
2756
|
-
*/
|
|
2757
|
-
remove(name: string, opts?: ExecOpts): Promise<void>;
|
|
2758
|
-
/**
|
|
2759
|
-
* Rename a remote
|
|
2760
|
-
*
|
|
2761
|
-
* Wraps: `git remote rename <old> <new>`
|
|
2762
|
-
*/
|
|
2763
|
-
rename(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
|
|
2764
|
-
/**
|
|
2765
|
-
* Get remote URL
|
|
2766
|
-
*
|
|
2767
|
-
* Wraps: `git remote get-url <name>`
|
|
2768
|
-
*/
|
|
2769
|
-
getUrl(name: string, opts?: RemoteUrlOpts & ExecOpts): Promise<string>;
|
|
2770
|
-
/**
|
|
2771
|
-
* Set remote URL
|
|
2772
|
-
*
|
|
2773
|
-
* Wraps: `git remote set-url <name> <url>`
|
|
2774
|
-
*/
|
|
2775
|
-
setUrl(name: string, url: string, opts?: RemoteUrlOpts & ExecOpts): Promise<void>;
|
|
2776
|
-
/**
|
|
2777
|
-
* Set remote HEAD
|
|
2778
|
-
*
|
|
2779
|
-
* Wraps: `git remote set-head <remote> <branch>`
|
|
2780
|
-
*/
|
|
2781
|
-
setHead(remote: string, branch?: string, opts?: RemoteSetHeadOpts & ExecOpts): Promise<void>;
|
|
2782
|
-
/**
|
|
2783
|
-
* Show information about a remote
|
|
2784
|
-
*
|
|
2785
|
-
* Wraps: `git remote show <remote>`
|
|
2786
|
-
*/
|
|
2787
|
-
show(remote: string, opts?: RemoteShowOpts & ExecOpts): Promise<string>;
|
|
2788
|
-
/**
|
|
2789
|
-
* Prune stale remote-tracking branches
|
|
2790
|
-
*
|
|
2791
|
-
* Wraps: `git remote prune <remote>`
|
|
2792
|
-
*/
|
|
2793
|
-
prune(remote: string, opts?: RemotePruneOpts & ExecOpts): Promise<string[]>;
|
|
2794
|
-
/**
|
|
2795
|
-
* Update remotes
|
|
2796
|
-
*
|
|
2797
|
-
* Wraps: `git remote update`
|
|
2798
|
-
*/
|
|
2799
|
-
update(remotes?: string[], opts?: RemoteUpdateOpts & ExecOpts): Promise<void>;
|
|
2800
|
-
/**
|
|
2801
|
-
* Set tracked branches for a remote
|
|
2802
|
-
*
|
|
2803
|
-
* Wraps: `git remote set-branches <remote> <branch>...`
|
|
2804
|
-
*/
|
|
2805
|
-
setBranches(remote: string, branches: string[], opts?: RemoteSetBranchesOpts & ExecOpts): Promise<void>;
|
|
2806
|
-
}
|
|
2807
|
-
/**
|
|
2808
|
-
* Config entry
|
|
2809
|
-
*/
|
|
2810
|
-
type ConfigEntry = {
|
|
2811
|
-
/** Config key (e.g., 'user.name') */
|
|
2812
|
-
key: string;
|
|
2813
|
-
/** Config value */
|
|
2814
|
-
value: string;
|
|
2815
|
-
};
|
|
2816
|
-
/**
|
|
2817
|
-
* Options for config get
|
|
2818
|
-
*/
|
|
2819
|
-
type ConfigGetOpts = {
|
|
2820
|
-
/** Get all values for multi-valued key */
|
|
2821
|
-
all?: boolean;
|
|
2822
|
-
/** Type to interpret the value as */
|
|
2823
|
-
type?: 'bool' | 'int' | 'bool-or-int' | 'path' | 'expiry-date' | 'color';
|
|
2824
|
-
/** Default value to use if the key is not set */
|
|
2825
|
-
default?: string;
|
|
2826
|
-
};
|
|
2827
|
-
/**
|
|
2828
|
-
* Options for config set
|
|
2829
|
-
*/
|
|
2830
|
-
type ConfigSetOpts = {
|
|
2831
|
-
/** Add value to multi-valued key instead of replacing */
|
|
2832
|
-
add?: boolean;
|
|
2833
|
-
};
|
|
2834
|
-
/**
|
|
2835
|
-
* Options for config list
|
|
2836
|
-
*/
|
|
2837
|
-
type ConfigListOpts = {
|
|
2838
|
-
/** Show origin of each value */
|
|
2839
|
-
showOrigin?: boolean;
|
|
2840
|
-
/** Show scope of each value */
|
|
2841
|
-
showScope?: boolean;
|
|
2842
|
-
/** Respect include directives */
|
|
2843
|
-
includes?: boolean;
|
|
2844
|
-
/** Only show config key names */
|
|
2845
|
-
nameOnly?: boolean;
|
|
2846
|
-
};
|
|
2847
|
-
/**
|
|
2848
|
-
* Well-known git config keys with their expected value types
|
|
2849
|
-
*
|
|
2850
|
-
* This provides type safety for common config operations.
|
|
2851
|
-
* For arbitrary keys, use getRaw/setRaw.
|
|
2852
|
-
*/
|
|
2853
|
-
type ConfigSchema = {
|
|
2854
|
-
'user.name': string;
|
|
2855
|
-
'user.email': string;
|
|
2856
|
-
'user.signingkey': string;
|
|
2857
|
-
'core.autocrlf': 'true' | 'false' | 'input';
|
|
2858
|
-
'core.filemode': 'true' | 'false';
|
|
2859
|
-
'core.ignorecase': 'true' | 'false';
|
|
2860
|
-
'core.bare': 'true' | 'false';
|
|
2861
|
-
'core.logallrefupdates': 'true' | 'false' | 'always';
|
|
2862
|
-
'core.repositoryformatversion': string;
|
|
2863
|
-
'core.quotepath': 'true' | 'false';
|
|
2864
|
-
'core.editor': string;
|
|
2865
|
-
'core.pager': string;
|
|
2866
|
-
'core.excludesfile': string;
|
|
2867
|
-
'core.attributesfile': string;
|
|
2868
|
-
'core.hooksPath': string;
|
|
2869
|
-
'core.sshCommand': string;
|
|
2870
|
-
'init.defaultBranch': string;
|
|
2871
|
-
'commit.gpgsign': 'true' | 'false';
|
|
2872
|
-
'commit.template': string;
|
|
2873
|
-
'tag.gpgsign': 'true' | 'false';
|
|
2874
|
-
'tag.forcesignannotated': 'true' | 'false';
|
|
2875
|
-
'push.default': 'nothing' | 'current' | 'upstream' | 'tracking' | 'simple' | 'matching';
|
|
2876
|
-
'push.followTags': 'true' | 'false';
|
|
2877
|
-
'push.autoSetupRemote': 'true' | 'false';
|
|
2878
|
-
'push.gpgSign': 'true' | 'false' | 'if-asked';
|
|
2879
|
-
'pull.rebase': 'true' | 'false' | 'merges' | 'interactive';
|
|
2880
|
-
'pull.ff': 'true' | 'false' | 'only';
|
|
2881
|
-
'fetch.prune': 'true' | 'false';
|
|
2882
|
-
'fetch.pruneTags': 'true' | 'false';
|
|
2883
|
-
'merge.ff': 'true' | 'false' | 'only';
|
|
2884
|
-
'merge.conflictstyle': 'merge' | 'diff3' | 'zdiff3';
|
|
2885
|
-
'rebase.autoStash': 'true' | 'false';
|
|
2886
|
-
'rebase.autoSquash': 'true' | 'false';
|
|
2887
|
-
'rebase.updateRefs': 'true' | 'false';
|
|
2888
|
-
'diff.algorithm': 'default' | 'minimal' | 'patience' | 'histogram';
|
|
2889
|
-
'diff.colorMoved': 'no' | 'default' | 'plain' | 'blocks' | 'zebra' | 'dimmed-zebra';
|
|
2890
|
-
'color.ui': 'auto' | 'always' | 'never' | 'true' | 'false';
|
|
2891
|
-
'credential.helper': string;
|
|
2892
|
-
'gpg.format': 'openpgp' | 'x509' | 'ssh';
|
|
2893
|
-
'gpg.program': string;
|
|
2894
|
-
'gpg.ssh.program': string;
|
|
2895
|
-
'gpg.ssh.allowedSignersFile': string;
|
|
2896
|
-
'http.proxy': string;
|
|
2897
|
-
'http.sslVerify': 'true' | 'false';
|
|
2898
|
-
'lfs.fetchexclude': string;
|
|
2899
|
-
'lfs.fetchinclude': string;
|
|
2900
|
-
'safe.directory': string;
|
|
2901
|
-
};
|
|
2902
|
-
/**
|
|
2903
|
-
* Known config key names
|
|
2904
|
-
*/
|
|
2905
|
-
type ConfigKey = keyof ConfigSchema;
|
|
2906
|
-
/**
|
|
2907
|
-
* Config operations (repository-level)
|
|
2908
|
-
*
|
|
2909
|
-
* Wraps: `git config` subcommands
|
|
2910
|
-
*/
|
|
2911
|
-
interface ConfigOperations {
|
|
2912
|
-
/**
|
|
2913
|
-
* Get a typed config value
|
|
2914
|
-
*
|
|
2915
|
-
* Wraps: `git config --get <key>`
|
|
2916
|
-
*
|
|
2917
|
-
* @returns Config value or undefined if not set
|
|
2918
|
-
*/
|
|
2919
|
-
get<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K] | undefined>;
|
|
2920
|
-
/**
|
|
2921
|
-
* Get all values for a multi-valued config key
|
|
2922
|
-
*
|
|
2923
|
-
* Wraps: `git config --get-all <key>`
|
|
2924
|
-
*/
|
|
2925
|
-
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K][]>;
|
|
2926
|
-
/**
|
|
2927
|
-
* Set a typed config value
|
|
2928
|
-
*
|
|
2929
|
-
* Wraps: `git config <key> <value>`
|
|
2930
|
-
*/
|
|
2931
|
-
set<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
2932
|
-
/**
|
|
2933
|
-
* Add a value to a multi-valued config key
|
|
2934
|
-
*
|
|
2935
|
-
* Wraps: `git config --add <key> <value>`
|
|
2936
|
-
*/
|
|
2937
|
-
add<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
2938
|
-
/**
|
|
2939
|
-
* Unset a typed config value
|
|
2940
|
-
*
|
|
2941
|
-
* Wraps: `git config --unset <key>`
|
|
2942
|
-
*/
|
|
2943
|
-
unset<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<void>;
|
|
2944
|
-
/**
|
|
2945
|
-
* Get a raw config value (for arbitrary keys)
|
|
2946
|
-
*
|
|
2947
|
-
* Wraps: `git config --get <key>`
|
|
2948
|
-
*
|
|
2949
|
-
* @returns Config value or undefined if not set
|
|
2950
|
-
*/
|
|
2951
|
-
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | string[] | undefined>;
|
|
2952
|
-
/**
|
|
2953
|
-
* Set a raw config value (for arbitrary keys)
|
|
2954
|
-
*
|
|
2955
|
-
* Wraps: `git config <key> <value>`
|
|
2956
|
-
*/
|
|
2957
|
-
setRaw(key: string, value: string, opts?: ConfigSetOpts & ExecOpts): Promise<void>;
|
|
2958
|
-
/**
|
|
2959
|
-
* Unset a raw config value (for arbitrary keys)
|
|
2960
|
-
*
|
|
2961
|
-
* Wraps: `git config --unset <key>`
|
|
2962
|
-
*/
|
|
2963
|
-
unsetRaw(key: string, opts?: ExecOpts): Promise<void>;
|
|
2964
|
-
/**
|
|
2965
|
-
* List all config values
|
|
2966
|
-
*
|
|
2967
|
-
* Wraps: `git config --list`
|
|
2968
|
-
*/
|
|
2969
|
-
list(opts?: ConfigListOpts & ExecOpts): Promise<ConfigEntry[]>;
|
|
2970
|
-
/**
|
|
2971
|
-
* Rename a config section
|
|
2972
|
-
*
|
|
2973
|
-
* Wraps: `git config --rename-section <old> <new>`
|
|
2974
|
-
*/
|
|
2975
|
-
renameSection(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
|
|
2976
|
-
/**
|
|
2977
|
-
* Remove a config section
|
|
2978
|
-
*
|
|
2979
|
-
* Wraps: `git config --remove-section <name>`
|
|
2980
|
-
*/
|
|
2981
|
-
removeSection(name: string, opts?: ExecOpts): Promise<void>;
|
|
2982
|
-
}
|
|
2983
|
-
/**
|
|
2984
|
-
* Submodule operations
|
|
2985
|
-
*
|
|
2986
|
-
* Wraps: `git submodule` subcommands
|
|
2987
|
-
*/
|
|
2988
|
-
interface SubmoduleOperations {
|
|
2989
|
-
/**
|
|
2990
|
-
* List submodules
|
|
2991
|
-
*
|
|
2992
|
-
* Wraps: `git submodule status`
|
|
2993
|
-
*/
|
|
2994
|
-
list(opts?: ExecOpts): Promise<SubmoduleInfo[]>;
|
|
2995
|
-
/**
|
|
2996
|
-
* Initialize submodules
|
|
2997
|
-
*
|
|
2998
|
-
* Wraps: `git submodule init`
|
|
2999
|
-
*/
|
|
3000
|
-
init(paths?: string[], opts?: ExecOpts): Promise<void>;
|
|
3001
|
-
/**
|
|
3002
|
-
* Update submodules
|
|
3003
|
-
*
|
|
3004
|
-
* Wraps: `git submodule update`
|
|
3005
|
-
*/
|
|
3006
|
-
update(opts?: SubmoduleOpts & ExecOpts): Promise<void>;
|
|
3007
|
-
/**
|
|
3008
|
-
* Add a submodule
|
|
3009
|
-
*
|
|
3010
|
-
* Wraps: `git submodule add <url> <path>`
|
|
3011
|
-
*/
|
|
3012
|
-
add(url: string, path: string, opts?: SubmoduleAddOpts & ExecOpts): Promise<void>;
|
|
3013
|
-
/**
|
|
3014
|
-
* Deinitialize a submodule
|
|
3015
|
-
*
|
|
3016
|
-
* Wraps: `git submodule deinit <path>`
|
|
3017
|
-
*/
|
|
3018
|
-
deinit(path: string, opts?: SubmoduleDeinitOpts & ExecOpts): Promise<void>;
|
|
3019
|
-
/**
|
|
3020
|
-
* Get submodule status
|
|
3021
|
-
*
|
|
3022
|
-
* Wraps: `git submodule status`
|
|
3023
|
-
*/
|
|
3024
|
-
status(paths?: string[], opts?: SubmoduleStatusOpts & ExecOpts): Promise<string>;
|
|
3025
|
-
/**
|
|
3026
|
-
* Get submodule summary
|
|
3027
|
-
*
|
|
3028
|
-
* Wraps: `git submodule summary`
|
|
3029
|
-
*/
|
|
3030
|
-
summary(opts?: SubmoduleSummaryOpts & ExecOpts): Promise<string>;
|
|
3031
|
-
/**
|
|
3032
|
-
* Run a command in each submodule
|
|
3033
|
-
*
|
|
3034
|
-
* Wraps: `git submodule foreach <command>`
|
|
3035
|
-
*/
|
|
3036
|
-
foreach(command: string, opts?: SubmoduleForeachOpts & ExecOpts): Promise<string>;
|
|
3037
|
-
/**
|
|
3038
|
-
* Sync submodule URL configuration
|
|
3039
|
-
*
|
|
3040
|
-
* Wraps: `git submodule sync`
|
|
3041
|
-
*/
|
|
3042
|
-
sync(paths?: string[], opts?: SubmoduleSyncOpts & ExecOpts): Promise<void>;
|
|
3043
|
-
/**
|
|
3044
|
-
* Absorb git directories of submodules into the superproject
|
|
3045
|
-
*
|
|
3046
|
-
* Wraps: `git submodule absorbgitdirs`
|
|
3047
|
-
*/
|
|
3048
|
-
absorbGitDirs(opts?: ExecOpts): Promise<void>;
|
|
3049
|
-
/**
|
|
3050
|
-
* Set the branch for a submodule
|
|
3051
|
-
*
|
|
3052
|
-
* Wraps: `git submodule set-branch --branch <branch> -- <path>`
|
|
3053
|
-
*/
|
|
3054
|
-
setBranch(path: string, branch: string, opts?: SubmoduleSetBranchOpts & ExecOpts): Promise<void>;
|
|
3055
|
-
/**
|
|
3056
|
-
* Set the URL for a submodule
|
|
3057
|
-
*
|
|
3058
|
-
* Wraps: `git submodule set-url -- <path> <url>`
|
|
3059
|
-
*/
|
|
3060
|
-
setUrl(path: string, url: string, opts?: ExecOpts): Promise<void>;
|
|
3061
|
-
}
|
|
3062
|
-
/**
|
|
3063
|
-
* Repository with working directory
|
|
3064
|
-
*
|
|
3065
|
-
* Provides type-safe wrappers for Git commands that operate on repositories
|
|
3066
|
-
* with a working tree. Each method corresponds to a specific Git CLI command
|
|
3067
|
-
* or subcommand.
|
|
3068
|
-
*/
|
|
3069
|
-
interface WorktreeRepo extends RepoBase {
|
|
3070
|
-
/** Path to the working directory */
|
|
3071
|
-
readonly workdir: string;
|
|
3072
|
-
/**
|
|
3073
|
-
* Get repository status
|
|
3074
|
-
*
|
|
3075
|
-
* Wraps: `git status`
|
|
3076
|
-
*
|
|
3077
|
-
* @example
|
|
3078
|
-
* ```typescript
|
|
3079
|
-
* const status = await repo.status();
|
|
3080
|
-
* console.log(status.entries); // Changed files
|
|
3081
|
-
* console.log(status.branch); // Current branch
|
|
3082
|
-
* ```
|
|
3083
|
-
*/
|
|
3084
|
-
status(opts?: StatusOpts & ExecOpts): Promise<StatusPorcelain>;
|
|
3085
|
-
/**
|
|
3086
|
-
* Get commit log
|
|
3087
|
-
*
|
|
3088
|
-
* Wraps: `git log`
|
|
3089
|
-
*
|
|
3090
|
-
* @example
|
|
3091
|
-
* ```typescript
|
|
3092
|
-
* const commits = await repo.log({ maxCount: 10 });
|
|
3093
|
-
* ```
|
|
3094
|
-
*/
|
|
3095
|
-
log(opts?: LogOpts & ExecOpts): Promise<Commit[]>;
|
|
3096
|
-
/**
|
|
3097
|
-
* Fetch from remote
|
|
3098
|
-
*
|
|
3099
|
-
* Wraps: `git fetch`
|
|
3100
|
-
*
|
|
3101
|
-
* @example
|
|
3102
|
-
* ```typescript
|
|
3103
|
-
* await repo.fetch({ remote: 'origin', prune: true });
|
|
3104
|
-
* ```
|
|
3105
|
-
*/
|
|
3106
|
-
fetch(opts?: FetchOpts & ExecOpts): Promise<void>;
|
|
3107
|
-
/**
|
|
3108
|
-
* Push to remote
|
|
3109
|
-
*
|
|
3110
|
-
* Wraps: `git push`
|
|
3111
|
-
*
|
|
3112
|
-
* @example
|
|
3113
|
-
* ```typescript
|
|
3114
|
-
* await repo.push({ remote: 'origin', refspec: 'main' });
|
|
3115
|
-
* ```
|
|
3116
|
-
*/
|
|
3117
|
-
push(opts?: PushOpts & ExecOpts): Promise<void>;
|
|
3118
|
-
/**
|
|
3119
|
-
* Git LFS operations
|
|
3120
|
-
*
|
|
3121
|
-
* Wraps: `git lfs *` commands
|
|
3122
|
-
*/
|
|
3123
|
-
lfs: LfsOperations;
|
|
3124
|
-
/**
|
|
3125
|
-
* Git LFS extra operations (inspired by fs-extra)
|
|
3126
|
-
*
|
|
3127
|
-
* Additional utilities for advanced LFS patterns like 2-phase commit/fetch.
|
|
3128
|
-
*/
|
|
3129
|
-
lfsExtra: LfsExtraOperations;
|
|
3130
|
-
/**
|
|
3131
|
-
* Git worktree operations
|
|
3132
|
-
*
|
|
3133
|
-
* Wraps: `git worktree *` commands
|
|
3134
|
-
*/
|
|
3135
|
-
worktree: WorktreeOperations;
|
|
3136
|
-
/**
|
|
3137
|
-
* Configure LFS mode for this repository
|
|
3138
|
-
*/
|
|
3139
|
-
setLfsMode(mode: LfsMode): void;
|
|
3140
|
-
/**
|
|
3141
|
-
* Add files to the index
|
|
3142
|
-
*
|
|
3143
|
-
* Wraps: `git add`
|
|
3144
|
-
*
|
|
3145
|
-
* @example
|
|
3146
|
-
* ```typescript
|
|
3147
|
-
* await repo.add(['file1.txt', 'file2.txt']);
|
|
3148
|
-
* await repo.add('.', { all: true });
|
|
3149
|
-
* ```
|
|
3150
|
-
*/
|
|
3151
|
-
add(paths: string | string[], opts?: AddOpts & ExecOpts): Promise<void>;
|
|
3152
|
-
/**
|
|
3153
|
-
* Git branch operations
|
|
3154
|
-
*
|
|
3155
|
-
* Wraps: `git branch *` commands
|
|
3156
|
-
*/
|
|
3157
|
-
branch: BranchOperations;
|
|
3158
|
-
/**
|
|
3159
|
-
* Checkout a branch, tag, or commit (branch switching mode)
|
|
3160
|
-
*
|
|
3161
|
-
* Wraps: `git checkout <branch>`
|
|
3162
|
-
*
|
|
3163
|
-
* @example
|
|
3164
|
-
* ```typescript
|
|
3165
|
-
* await repo.checkout('main');
|
|
3166
|
-
* await repo.checkout('feature', { createBranch: true });
|
|
3167
|
-
* await repo.checkout('feature', { createBranch: true, startPoint: 'origin/main' });
|
|
3168
|
-
* ```
|
|
3169
|
-
*/
|
|
3170
|
-
checkout(target: string, opts?: CheckoutBranchOpts & ExecOpts): Promise<void>;
|
|
3171
|
-
/**
|
|
3172
|
-
* Checkout specific files from a tree-ish (pathspec mode)
|
|
3173
|
-
*
|
|
3174
|
-
* Wraps: `git checkout [<tree-ish>] -- <pathspec>...`
|
|
3175
|
-
*
|
|
3176
|
-
* @example
|
|
3177
|
-
* ```typescript
|
|
3178
|
-
* // Restore file from index (discard working tree changes)
|
|
3179
|
-
* await repo.checkout(['file.txt']);
|
|
3180
|
-
*
|
|
3181
|
-
* // Restore file from HEAD
|
|
3182
|
-
* await repo.checkout(['file.txt'], { source: 'HEAD' });
|
|
3183
|
-
*
|
|
3184
|
-
* // Restore file from specific commit
|
|
3185
|
-
* await repo.checkout(['src/'], { source: 'abc123' });
|
|
3186
|
-
*
|
|
3187
|
-
* // Resolve conflict with ours/theirs
|
|
3188
|
-
* await repo.checkout(['conflicted.txt'], { ours: true });
|
|
3189
|
-
* ```
|
|
3190
|
-
*/
|
|
3191
|
-
checkout(paths: string[], opts?: CheckoutPathOpts & ExecOpts): Promise<void>;
|
|
3192
|
-
/**
|
|
3193
|
-
* Create a commit
|
|
3194
|
-
*
|
|
3195
|
-
* Wraps: `git commit`
|
|
3196
|
-
*
|
|
3197
|
-
* @example
|
|
3198
|
-
* ```typescript
|
|
3199
|
-
* const result = await repo.commit({ message: 'feat: add new feature' });
|
|
3200
|
-
* console.log(result.hash);
|
|
3201
|
-
* ```
|
|
3202
|
-
*/
|
|
3203
|
-
commit(opts?: CommitOpts & ExecOpts): Promise<CommitResult>;
|
|
3204
|
-
/**
|
|
3205
|
-
* Show changes between commits, commit and working tree, etc.
|
|
3206
|
-
*
|
|
3207
|
-
* Wraps: `git diff`
|
|
3208
|
-
*
|
|
3209
|
-
* @example
|
|
3210
|
-
* ```typescript
|
|
3211
|
-
* const diff = await repo.diff('HEAD~1');
|
|
3212
|
-
* const staged = await repo.diff({ staged: true });
|
|
3213
|
-
* ```
|
|
3214
|
-
*/
|
|
3215
|
-
diff(target?: string, opts?: DiffOpts & ExecOpts): Promise<DiffResult>;
|
|
3216
|
-
/**
|
|
3217
|
-
* Merge branches
|
|
3218
|
-
*
|
|
3219
|
-
* Wraps: `git merge`
|
|
3220
|
-
*
|
|
3221
|
-
* @example
|
|
3222
|
-
* ```typescript
|
|
3223
|
-
* const result = await repo.merge('feature-branch');
|
|
3224
|
-
* ```
|
|
3225
|
-
*/
|
|
3226
|
-
merge(branch: string, opts?: MergeOpts & ExecOpts): Promise<MergeResult>;
|
|
3227
|
-
/**
|
|
3228
|
-
* Pull from remote (fetch + merge/rebase)
|
|
3229
|
-
*
|
|
3230
|
-
* Wraps: `git pull`
|
|
3231
|
-
*
|
|
3232
|
-
* @example
|
|
3233
|
-
* ```typescript
|
|
3234
|
-
* await repo.pull({ remote: 'origin', rebase: true });
|
|
3235
|
-
* ```
|
|
3236
|
-
*/
|
|
3237
|
-
pull(opts?: PullOpts & ExecOpts): Promise<void>;
|
|
3238
|
-
/**
|
|
3239
|
-
* Reset current HEAD to the specified state
|
|
3240
|
-
*
|
|
3241
|
-
* Wraps: `git reset`
|
|
3242
|
-
*
|
|
3243
|
-
* @example
|
|
3244
|
-
* ```typescript
|
|
3245
|
-
* await repo.reset('HEAD~1', { hard: true });
|
|
3246
|
-
* await repo.reset({ soft: true });
|
|
3247
|
-
* ```
|
|
3248
|
-
*/
|
|
3249
|
-
reset(target?: string, opts?: ResetOpts & ExecOpts): Promise<void>;
|
|
3250
|
-
/**
|
|
3251
|
-
* Remove files from the working tree and from the index
|
|
3252
|
-
*
|
|
3253
|
-
* Wraps: `git rm`
|
|
3254
|
-
*
|
|
3255
|
-
* @example
|
|
3256
|
-
* ```typescript
|
|
3257
|
-
* await repo.rm('file.txt');
|
|
3258
|
-
* await repo.rm('dir/', { recursive: true });
|
|
3259
|
-
* ```
|
|
3260
|
-
*/
|
|
3261
|
-
rm(paths: string | string[], opts?: RmOpts & ExecOpts): Promise<void>;
|
|
3262
|
-
/**
|
|
3263
|
-
* Git stash operations
|
|
3264
|
-
*
|
|
3265
|
-
* Wraps: `git stash *` commands
|
|
3266
|
-
*/
|
|
3267
|
-
stash: StashOperations;
|
|
3268
|
-
/**
|
|
3269
|
-
* Switch branches
|
|
3270
|
-
*
|
|
3271
|
-
* Wraps: `git switch`
|
|
3272
|
-
*
|
|
3273
|
-
* @example
|
|
3274
|
-
* ```typescript
|
|
3275
|
-
* await repo.switch('main');
|
|
3276
|
-
* await repo.switch('new-branch', { create: true });
|
|
3277
|
-
* ```
|
|
3278
|
-
*/
|
|
3279
|
-
switch(branch: string, opts?: SwitchOpts & ExecOpts): Promise<void>;
|
|
3280
|
-
/**
|
|
3281
|
-
* Git tag operations
|
|
3282
|
-
*
|
|
3283
|
-
* Wraps: `git tag *` commands
|
|
3284
|
-
*/
|
|
3285
|
-
tag: TagOperations;
|
|
3286
|
-
/**
|
|
3287
|
-
* Apply changes from existing commits
|
|
3288
|
-
*
|
|
3289
|
-
* Wraps: `git cherry-pick`
|
|
3290
|
-
*
|
|
3291
|
-
* @example
|
|
3292
|
-
* ```typescript
|
|
3293
|
-
* await repo.cherryPick('abc123');
|
|
3294
|
-
* await repo.cherryPick(['abc123', 'def456']);
|
|
3295
|
-
* ```
|
|
3296
|
-
*/
|
|
3297
|
-
cherryPick(commits: string | string[], opts?: CherryPickOpts & ExecOpts): Promise<void>;
|
|
3298
|
-
/**
|
|
3299
|
-
* Remove untracked files from the working tree
|
|
3300
|
-
*
|
|
3301
|
-
* Wraps: `git clean`
|
|
3302
|
-
*
|
|
3303
|
-
* @example
|
|
3304
|
-
* ```typescript
|
|
3305
|
-
* const removed = await repo.clean({ force: true, directories: true });
|
|
3306
|
-
* ```
|
|
3307
|
-
*/
|
|
3308
|
-
clean(opts?: CleanOpts & ExecOpts): Promise<string[]>;
|
|
3309
|
-
/**
|
|
3310
|
-
* Move or rename files
|
|
3311
|
-
*
|
|
3312
|
-
* Wraps: `git mv`
|
|
3313
|
-
*
|
|
3314
|
-
* @example
|
|
3315
|
-
* ```typescript
|
|
3316
|
-
* await repo.mv('old-name.txt', 'new-name.txt');
|
|
3317
|
-
* ```
|
|
3318
|
-
*/
|
|
3319
|
-
mv(source: string, destination: string, opts?: MvOpts & ExecOpts): Promise<void>;
|
|
3320
|
-
/**
|
|
3321
|
-
* Reapply commits on top of another base
|
|
3322
|
-
*
|
|
3323
|
-
* Wraps: `git rebase`
|
|
3324
|
-
*
|
|
3325
|
-
* @example
|
|
3326
|
-
* ```typescript
|
|
3327
|
-
* await repo.rebase({ onto: 'main' });
|
|
3328
|
-
* await repo.rebase({ abort: true });
|
|
3329
|
-
* ```
|
|
3330
|
-
*/
|
|
3331
|
-
rebase(opts?: RebaseOpts & ExecOpts): Promise<void>;
|
|
3332
|
-
/**
|
|
3333
|
-
* Restore working tree files
|
|
3334
|
-
*
|
|
3335
|
-
* Wraps: `git restore`
|
|
3336
|
-
*
|
|
3337
|
-
* @example
|
|
3338
|
-
* ```typescript
|
|
3339
|
-
* await repo.restore(['file.txt'], { staged: true });
|
|
3340
|
-
* await repo.restore(['.'], { source: 'HEAD' });
|
|
3341
|
-
* ```
|
|
3342
|
-
*/
|
|
3343
|
-
restore(paths: string | string[], opts?: RestoreOpts & ExecOpts): Promise<void>;
|
|
3344
|
-
/**
|
|
3345
|
-
* Revert existing commits
|
|
3346
|
-
*
|
|
3347
|
-
* Wraps: `git revert`
|
|
3348
|
-
*
|
|
3349
|
-
* @example
|
|
3350
|
-
* ```typescript
|
|
3351
|
-
* await repo.revert('abc123');
|
|
3352
|
-
* await repo.revert(['abc123', 'def456'], { noCommit: true });
|
|
3353
|
-
* ```
|
|
3354
|
-
*/
|
|
3355
|
-
revert(commits: string | string[], opts?: RevertOpts & ExecOpts): Promise<void>;
|
|
3356
|
-
/**
|
|
3357
|
-
* Show various types of objects
|
|
3358
|
-
*
|
|
3359
|
-
* Wraps: `git show`
|
|
3360
|
-
*
|
|
3361
|
-
* @example
|
|
3362
|
-
* ```typescript
|
|
3363
|
-
* const content = await repo.show('HEAD:README.md');
|
|
3364
|
-
* const commitInfo = await repo.show('abc123');
|
|
3365
|
-
* ```
|
|
3366
|
-
*/
|
|
3367
|
-
show(object: string, opts?: ShowOpts & ExecOpts): Promise<string>;
|
|
3368
|
-
/**
|
|
3369
|
-
* Parse revision specification and return information about the repository
|
|
3370
|
-
*
|
|
3371
|
-
* Wraps: `git rev-parse`
|
|
3372
|
-
*
|
|
3373
|
-
* This is a versatile command with multiple use cases based on the options provided:
|
|
3374
|
-
*
|
|
3375
|
-
* **Resolve ref to SHA:**
|
|
3376
|
-
* ```typescript
|
|
3377
|
-
* const sha = await repo.revParse('HEAD');
|
|
3378
|
-
* const parentSha = await repo.revParse('HEAD~1');
|
|
3379
|
-
* const short = await repo.revParse('HEAD', { short: true });
|
|
3380
|
-
* const branch = await repo.revParse('HEAD', { abbrevRef: true });
|
|
3381
|
-
* ```
|
|
3382
|
-
*
|
|
3383
|
-
* **Query paths:**
|
|
3384
|
-
* ```typescript
|
|
3385
|
-
* const gitDir = await repo.revParse({ gitDir: true });
|
|
3386
|
-
* const toplevel = await repo.revParse({ showToplevel: true });
|
|
3387
|
-
* ```
|
|
3388
|
-
*
|
|
3389
|
-
* **Query repository state:**
|
|
3390
|
-
* ```typescript
|
|
3391
|
-
* const isShallow = await repo.revParse({ isShallowRepository: true });
|
|
3392
|
-
* const isBare = await repo.revParse({ isBareRepository: true });
|
|
3393
|
-
* ```
|
|
3394
|
-
*
|
|
3395
|
-
* **List refs:**
|
|
3396
|
-
* ```typescript
|
|
3397
|
-
* const allRefs = await repo.revParse({ all: true });
|
|
3398
|
-
* const branches = await repo.revParse({ branches: true });
|
|
3399
|
-
* const featureBranches = await repo.revParse({ branches: 'feature/*' });
|
|
3400
|
-
* ```
|
|
3401
|
-
*/
|
|
3402
|
-
revParse(ref: string, opts?: RevParseRefOpts & ExecOpts): Promise<string>;
|
|
3403
|
-
revParse(opts: RevParsePathQuery & RevParsePathOpts & ExecOpts): Promise<string>;
|
|
3404
|
-
revParse(opts: RevParseBooleanQuery & ExecOpts): Promise<boolean>;
|
|
3405
|
-
revParse(opts: RevParseListQuery & ExecOpts): Promise<string[]>;
|
|
3406
|
-
revParse(opts: {
|
|
3407
|
-
showObjectFormat: true | 'storage' | 'input' | 'output';
|
|
3408
|
-
} & ExecOpts): Promise<string>;
|
|
3409
|
-
revParse(opts: {
|
|
3410
|
-
showRefFormat: true;
|
|
3411
|
-
} & ExecOpts): Promise<string>;
|
|
3412
|
-
revParse(opts: {
|
|
3413
|
-
localEnvVars: true;
|
|
3414
|
-
} & ExecOpts): Promise<string[]>;
|
|
3415
|
-
/**
|
|
3416
|
-
* Count the number of commits reachable from a ref
|
|
3417
|
-
*
|
|
3418
|
-
* Wraps: `git rev-list --count`
|
|
3419
|
-
*
|
|
3420
|
-
* @example
|
|
3421
|
-
* ```typescript
|
|
3422
|
-
* const count = await repo.revListCount('HEAD');
|
|
3423
|
-
* const featureCommits = await repo.revListCount('main..feature');
|
|
3424
|
-
* ```
|
|
3425
|
-
*/
|
|
3426
|
-
revListCount(ref?: string, opts?: ExecOpts): Promise<number>;
|
|
3427
|
-
/**
|
|
3428
|
-
* Read or modify symbolic refs
|
|
3429
|
-
*
|
|
3430
|
-
* Wraps: `git symbolic-ref`
|
|
3431
|
-
*
|
|
3432
|
-
* Without newRef: reads the symbolic ref (e.g., get what HEAD points to)
|
|
3433
|
-
* With newRef: sets the symbolic ref to point to newRef
|
|
3434
|
-
*
|
|
3435
|
-
* @example
|
|
3436
|
-
* ```typescript
|
|
3437
|
-
* // Read what HEAD points to
|
|
3438
|
-
* const branch = await repo.symbolicRef('HEAD');
|
|
3439
|
-
*
|
|
3440
|
-
* // Set HEAD to point to a branch
|
|
3441
|
-
* await repo.symbolicRef('HEAD', 'refs/heads/main');
|
|
3442
|
-
* ```
|
|
3443
|
-
*/
|
|
3444
|
-
symbolicRef(name: string, newRef?: string, opts?: ExecOpts): Promise<string | undefined>;
|
|
3445
|
-
/**
|
|
3446
|
-
* Git submodule operations
|
|
3447
|
-
*
|
|
3448
|
-
* Wraps: `git submodule *` commands
|
|
3449
|
-
*/
|
|
3450
|
-
submodule: SubmoduleOperations;
|
|
3451
|
-
/**
|
|
3452
|
-
* Git remote operations
|
|
3453
|
-
*
|
|
3454
|
-
* Wraps: `git remote *` commands
|
|
3455
|
-
*/
|
|
3456
|
-
remote: RemoteOperations;
|
|
3457
|
-
/**
|
|
3458
|
-
* Git config operations (repository-level)
|
|
3459
|
-
*
|
|
3460
|
-
* Wraps: `git config` (without --global)
|
|
3461
|
-
*/
|
|
3462
|
-
config: ConfigOperations;
|
|
3463
|
-
}
|
|
3464
|
-
/**
|
|
3465
|
-
* Bare repository (no working directory)
|
|
3466
|
-
*
|
|
3467
|
-
* A bare repository contains only the Git data without a working tree.
|
|
3468
|
-
* Typically used for shared/server repositories.
|
|
3469
|
-
*/
|
|
3470
|
-
interface BareRepo extends RepoBase {
|
|
3471
|
-
/** Path to the git directory */
|
|
3472
|
-
readonly gitDir: string;
|
|
3473
|
-
/**
|
|
3474
|
-
* Fetch from remote
|
|
3475
|
-
*
|
|
3476
|
-
* Wraps: `git fetch`
|
|
3477
|
-
*/
|
|
3478
|
-
fetch(opts?: FetchOpts & ExecOpts): Promise<void>;
|
|
3479
|
-
/**
|
|
3480
|
-
* Push to remote
|
|
3481
|
-
*
|
|
3482
|
-
* Wraps: `git push`
|
|
3483
|
-
*/
|
|
3484
|
-
push(opts?: PushOpts & ExecOpts): Promise<void>;
|
|
3485
|
-
/**
|
|
3486
|
-
* Remote operations
|
|
3487
|
-
*
|
|
3488
|
-
* Wraps: `git remote` subcommands
|
|
3489
|
-
*/
|
|
3490
|
-
remote: RemoteOperations;
|
|
3491
|
-
/**
|
|
3492
|
-
* Config operations (repository-level)
|
|
3493
|
-
*
|
|
3494
|
-
* Wraps: `git config` subcommands
|
|
3495
|
-
*/
|
|
3496
|
-
config: ConfigOperations;
|
|
3497
|
-
/**
|
|
3498
|
-
* Parse revision specification and return information about the repository
|
|
3499
|
-
*
|
|
3500
|
-
* Wraps: `git rev-parse`
|
|
3501
|
-
*
|
|
3502
|
-
* @example
|
|
3503
|
-
* ```typescript
|
|
3504
|
-
* const sha = await repo.revParse('HEAD');
|
|
3505
|
-
* const gitDir = await repo.revParse({ gitDir: true });
|
|
3506
|
-
* const isShallow = await repo.revParse({ isShallowRepository: true });
|
|
3507
|
-
* ```
|
|
3508
|
-
*/
|
|
3509
|
-
revParse(ref: string, opts?: RevParseRefOpts & ExecOpts): Promise<string>;
|
|
3510
|
-
revParse(opts: RevParsePathQuery & RevParsePathOpts & ExecOpts): Promise<string>;
|
|
3511
|
-
revParse(opts: RevParseBooleanQuery & ExecOpts): Promise<boolean>;
|
|
3512
|
-
revParse(opts: RevParseListQuery & ExecOpts): Promise<string[]>;
|
|
3513
|
-
revParse(opts: {
|
|
3514
|
-
showObjectFormat: true | 'storage' | 'input' | 'output';
|
|
3515
|
-
} & ExecOpts): Promise<string>;
|
|
3516
|
-
revParse(opts: {
|
|
3517
|
-
showRefFormat: true;
|
|
3518
|
-
} & ExecOpts): Promise<string>;
|
|
3519
|
-
revParse(opts: {
|
|
3520
|
-
localEnvVars: true;
|
|
3521
|
-
} & ExecOpts): Promise<string[]>;
|
|
3522
|
-
}
|
|
3523
|
-
|
|
3524
|
-
/**
|
|
3525
|
-
* Core Git interface - repository-agnostic operations
|
|
3526
|
-
*/
|
|
3527
|
-
|
|
3528
|
-
/**
|
|
3529
|
-
* Options for git clone
|
|
3530
|
-
*/
|
|
3531
|
-
type CloneOpts = {
|
|
3532
|
-
bare?: boolean;
|
|
3533
|
-
depth?: number;
|
|
3534
|
-
branch?: string;
|
|
3535
|
-
singleBranch?: boolean;
|
|
3536
|
-
mirror?: boolean;
|
|
3537
|
-
noCheckout?: boolean;
|
|
3538
|
-
recurseSubmodules?: boolean;
|
|
3539
|
-
/** Store .git directory at specified path instead of inside the repository */
|
|
3540
|
-
separateGitDir?: string;
|
|
3541
|
-
/**
|
|
3542
|
-
* Whether to clean up the target directory if the operation is aborted.
|
|
3543
|
-
* @default true
|
|
3544
|
-
*/
|
|
3545
|
-
cleanupOnAbort?: boolean;
|
|
3546
|
-
/** Be more verbose */
|
|
3547
|
-
verbose?: boolean;
|
|
3548
|
-
/** Operate quietly (suppress progress reporting) */
|
|
3549
|
-
quiet?: boolean;
|
|
3550
|
-
/** Reject cloning a shallow repository */
|
|
3551
|
-
rejectShallow?: boolean;
|
|
3552
|
-
/** Clone from a local repository (use hard links) */
|
|
3553
|
-
local?: boolean;
|
|
3554
|
-
/** Don't use hard links for local clone */
|
|
3555
|
-
noHardlinks?: boolean;
|
|
3556
|
-
/** Share objects with a reference repository */
|
|
3557
|
-
shared?: boolean;
|
|
3558
|
-
/** Number of submodules to clone in parallel */
|
|
3559
|
-
jobs?: number;
|
|
3560
|
-
/** Directory with templates for the new repository */
|
|
3561
|
-
template?: string;
|
|
3562
|
-
/** Reference repository for object sharing */
|
|
3563
|
-
reference?: string;
|
|
3564
|
-
/** Reference repository if available (no error if not) */
|
|
3565
|
-
referenceIfAble?: string;
|
|
3566
|
-
/** Disconnect from reference repository after clone */
|
|
3567
|
-
dissociate?: boolean;
|
|
3568
|
-
/** Name of the remote (default: origin) */
|
|
3569
|
-
origin?: string;
|
|
3570
|
-
/** Create a shallow clone with commits since the specified date */
|
|
3571
|
-
shallowSince?: string | Date;
|
|
3572
|
-
/** Create a shallow clone excluding commits reachable from specified revision */
|
|
3573
|
-
shallowExclude?: string | string[];
|
|
3574
|
-
/** Don't clone any tags, and make later fetches not follow them */
|
|
3575
|
-
noTags?: boolean;
|
|
3576
|
-
/** Also clone submodules shallowly */
|
|
3577
|
-
shallowSubmodules?: boolean;
|
|
3578
|
-
/** Set config options for the new repository */
|
|
3579
|
-
config?: Record<string, string>;
|
|
3580
|
-
/** Use IPv4 addresses only */
|
|
3581
|
-
ipv4?: boolean;
|
|
3582
|
-
/** Use IPv6 addresses only */
|
|
3583
|
-
ipv6?: boolean;
|
|
3584
|
-
/** A partial clone filter specification (e.g., 'blob:none') */
|
|
3585
|
-
filter?: string;
|
|
3586
|
-
/** Also apply the partial clone filter to submodules */
|
|
3587
|
-
alsoFilterSubmodules?: boolean;
|
|
3588
|
-
/** Clone submodules from their remote tracking branch */
|
|
3589
|
-
remoteSubmodules?: boolean;
|
|
3590
|
-
/** Initialize sparse-checkout (clone only root files initially) */
|
|
3591
|
-
sparse?: boolean;
|
|
3592
|
-
};
|
|
3593
|
-
/**
|
|
3594
|
-
* Options for git init
|
|
3595
|
-
*/
|
|
3596
|
-
type InitOpts = {
|
|
3597
|
-
bare?: boolean;
|
|
3598
|
-
initialBranch?: string;
|
|
3599
|
-
/** Store .git directory at specified path instead of inside the repository */
|
|
3600
|
-
separateGitDir?: string;
|
|
3601
|
-
/**
|
|
3602
|
-
* Whether to clean up the target directory if the operation is aborted.
|
|
3603
|
-
* @default true
|
|
3604
|
-
*/
|
|
3605
|
-
cleanupOnAbort?: boolean;
|
|
3606
|
-
/** Directory with templates for the new repository */
|
|
3607
|
-
template?: string;
|
|
3608
|
-
/**
|
|
3609
|
-
* Set repository sharing level
|
|
3610
|
-
* - 'group': Group writable
|
|
3611
|
-
* - 'all'/'world'/'everybody': World readable
|
|
3612
|
-
* - number: Octal permissions
|
|
3613
|
-
*/
|
|
3614
|
-
shared?: boolean | 'group' | 'all' | 'world' | 'everybody' | number;
|
|
3615
|
-
/** Operate quietly (suppress output) */
|
|
3616
|
-
quiet?: boolean;
|
|
3617
|
-
/** Specify the hash algorithm to use (sha1 or sha256) */
|
|
3618
|
-
objectFormat?: 'sha1' | 'sha256';
|
|
3619
|
-
};
|
|
3620
|
-
/**
|
|
3621
|
-
* Options for git ls-remote
|
|
3622
|
-
*/
|
|
3623
|
-
type LsRemoteOpts = {
|
|
3624
|
-
/** Limit to refs/heads (branches) */
|
|
3625
|
-
heads?: boolean;
|
|
3626
|
-
/** Limit to refs/tags */
|
|
3627
|
-
tags?: boolean;
|
|
3628
|
-
/** Show only actual refs (not peeled tags) */
|
|
3629
|
-
refs?: boolean;
|
|
3630
|
-
/** Show remote URL instead of listing refs */
|
|
3631
|
-
getUrl?: boolean;
|
|
3632
|
-
/** Sort refs by the given key (e.g., 'version:refname') */
|
|
3633
|
-
sort?: string;
|
|
3634
|
-
/** Show symbolic refs in addition to object refs */
|
|
3635
|
-
symref?: boolean;
|
|
3636
|
-
};
|
|
3637
|
-
/**
|
|
3638
|
-
* Result from git ls-remote
|
|
3639
|
-
*/
|
|
3640
|
-
type LsRemoteResult = {
|
|
3641
|
-
refs: Array<{
|
|
3642
|
-
hash: string;
|
|
3643
|
-
name: string;
|
|
3644
|
-
}>;
|
|
3645
|
-
};
|
|
3646
|
-
/**
|
|
3647
|
-
* Options for global LFS install
|
|
3648
|
-
*
|
|
3649
|
-
* Used with `git.lfs.install()` for user-level (~/.gitconfig) or
|
|
3650
|
-
* system-level (/etc/gitconfig) LFS configuration.
|
|
3651
|
-
*
|
|
3652
|
-
* @remarks
|
|
3653
|
-
* Internally runs `git lfs install` without `--local` flag.
|
|
3654
|
-
* For repository-level installation, use `repo.lfs.install()` instead.
|
|
3655
|
-
*/
|
|
3656
|
-
type GlobalLfsInstallOpts = {
|
|
3657
|
-
/** Overwrite existing hooks */
|
|
3658
|
-
force?: boolean;
|
|
3659
|
-
/**
|
|
3660
|
-
* Install for all users (system-wide)
|
|
3661
|
-
*
|
|
3662
|
-
* @remarks
|
|
3663
|
-
* Internally adds `--system` flag to install to /etc/gitconfig
|
|
3664
|
-
* instead of ~/.gitconfig. Requires appropriate permissions.
|
|
3665
|
-
*/
|
|
3666
|
-
system?: boolean;
|
|
3667
|
-
/** Skip smudge filter (don't download during checkout) */
|
|
3668
|
-
skipSmudge?: boolean;
|
|
3669
|
-
/** Skip repository setup (only install filters) */
|
|
3670
|
-
skipRepo?: boolean;
|
|
3671
|
-
/** Print commands instead of executing */
|
|
3672
|
-
manual?: boolean;
|
|
3673
|
-
};
|
|
3674
|
-
/**
|
|
3675
|
-
* Options for global LFS uninstall
|
|
3676
|
-
*
|
|
3677
|
-
* Used with `git.lfs.uninstall()` for user-level or system-level
|
|
3678
|
-
* LFS configuration removal.
|
|
3679
|
-
*
|
|
3680
|
-
* @remarks
|
|
3681
|
-
* Internally runs `git lfs uninstall` without `--local` flag.
|
|
3682
|
-
* For repository-level uninstallation, use `repo.lfs.uninstall()` instead.
|
|
3683
|
-
*/
|
|
3684
|
-
type GlobalLfsUninstallOpts = {
|
|
3685
|
-
/**
|
|
3686
|
-
* Uninstall for all users (system-wide)
|
|
3687
|
-
*
|
|
3688
|
-
* @remarks
|
|
3689
|
-
* Internally adds `--system` flag to modify /etc/gitconfig
|
|
3690
|
-
* instead of ~/.gitconfig. Requires appropriate permissions.
|
|
3691
|
-
*/
|
|
3692
|
-
system?: boolean;
|
|
3693
|
-
/** Skip repository cleanup */
|
|
3694
|
-
skipRepo?: boolean;
|
|
3695
|
-
};
|
|
3696
|
-
/**
|
|
3697
|
-
* Global LFS operations
|
|
3698
|
-
*
|
|
3699
|
-
* Wraps: `git lfs` subcommands for user-level configuration
|
|
3700
|
-
*
|
|
3701
|
-
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3702
|
-
* For repository-level LFS operations, use repo.lfs instead.
|
|
3703
|
-
*/
|
|
3704
|
-
interface GlobalLfsOperations {
|
|
3705
|
-
/**
|
|
3706
|
-
* Install Git LFS hooks globally
|
|
3707
|
-
*
|
|
3708
|
-
* Wraps: `git lfs install`
|
|
3709
|
-
*
|
|
3710
|
-
* Sets up the clean and smudge filters under the name "lfs" in the
|
|
3711
|
-
* global Git config (~/.gitconfig) or system config (/etc/gitconfig).
|
|
3712
|
-
*
|
|
3713
|
-
* @example
|
|
3714
|
-
* ```typescript
|
|
3715
|
-
* // Install globally (to ~/.gitconfig)
|
|
3716
|
-
* await git.lfs.install();
|
|
3717
|
-
*
|
|
3718
|
-
* // Install system-wide (to /etc/gitconfig)
|
|
3719
|
-
* await git.lfs.install({ system: true });
|
|
3720
|
-
*
|
|
3721
|
-
* // Install with skip-smudge (manual LFS pull required)
|
|
3722
|
-
* await git.lfs.install({ skipSmudge: true });
|
|
3723
|
-
* ```
|
|
3724
|
-
*/
|
|
3725
|
-
install(opts?: GlobalLfsInstallOpts & ExecOpts): Promise<void>;
|
|
3726
|
-
/**
|
|
3727
|
-
* Uninstall Git LFS hooks globally
|
|
3728
|
-
*
|
|
3729
|
-
* Wraps: `git lfs uninstall`
|
|
3730
|
-
*
|
|
3731
|
-
* Removes the clean and smudge filters from global or system config.
|
|
3732
|
-
*
|
|
3733
|
-
* @example
|
|
3734
|
-
* ```typescript
|
|
3735
|
-
* // Uninstall from global config
|
|
3736
|
-
* await git.lfs.uninstall();
|
|
3737
|
-
*
|
|
3738
|
-
* // Uninstall from system config
|
|
3739
|
-
* await git.lfs.uninstall({ system: true });
|
|
3740
|
-
* ```
|
|
3741
|
-
*/
|
|
3742
|
-
uninstall(opts?: GlobalLfsUninstallOpts & ExecOpts): Promise<void>;
|
|
3743
|
-
/**
|
|
3744
|
-
* Get Git LFS version
|
|
3745
|
-
*
|
|
3746
|
-
* Wraps: `git lfs version`
|
|
3747
|
-
*
|
|
3748
|
-
* @returns LFS version string (e.g., "git-lfs/3.4.0")
|
|
3749
|
-
*/
|
|
3750
|
-
version(opts?: ExecOpts): Promise<string>;
|
|
3751
|
-
}
|
|
3752
|
-
/**
|
|
3753
|
-
* Options for global config list
|
|
3754
|
-
*/
|
|
3755
|
-
type GlobalConfigListOpts = {
|
|
3756
|
-
/** Show origin of each value */
|
|
3757
|
-
showOrigin?: boolean;
|
|
3758
|
-
/** Show scope of each value */
|
|
3759
|
-
showScope?: boolean;
|
|
3760
|
-
};
|
|
3761
|
-
/**
|
|
3762
|
-
* Global config operations
|
|
3763
|
-
*
|
|
3764
|
-
* Wraps: `git config --global` subcommands
|
|
3765
|
-
*
|
|
3766
|
-
* Operates on ~/.gitconfig (user-level configuration).
|
|
3767
|
-
* Uses the same typed ConfigSchema as repository-level config.
|
|
3768
|
-
*/
|
|
3769
|
-
interface GlobalConfigOperations {
|
|
3770
|
-
/**
|
|
3771
|
-
* Get a typed global config value
|
|
3772
|
-
*
|
|
3773
|
-
* Wraps: `git config --global --get <key>`
|
|
3774
|
-
*
|
|
3775
|
-
* @returns Config value or undefined if not set
|
|
3776
|
-
*/
|
|
3777
|
-
get<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K] | undefined>;
|
|
3778
|
-
/**
|
|
3779
|
-
* Get all values for a typed multi-valued global config key
|
|
3780
|
-
*
|
|
3781
|
-
* Wraps: `git config --global --get-all <key>`
|
|
3782
|
-
*/
|
|
3783
|
-
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K][]>;
|
|
3784
|
-
/**
|
|
3785
|
-
* Set a typed global config value
|
|
3786
|
-
*
|
|
3787
|
-
* Wraps: `git config --global <key> <value>`
|
|
3788
|
-
*/
|
|
3789
|
-
set<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
3790
|
-
/**
|
|
3791
|
-
* Add a value to a typed multi-valued global config key
|
|
3792
|
-
*
|
|
3793
|
-
* Wraps: `git config --global --add <key> <value>`
|
|
3794
|
-
*/
|
|
3795
|
-
add<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
3796
|
-
/**
|
|
3797
|
-
* Unset a typed global config value
|
|
3798
|
-
*
|
|
3799
|
-
* Wraps: `git config --global --unset <key>`
|
|
3800
|
-
*/
|
|
3801
|
-
unset<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<void>;
|
|
3802
|
-
/**
|
|
3803
|
-
* Get a raw global config value (for arbitrary keys)
|
|
3804
|
-
*
|
|
3805
|
-
* Wraps: `git config --global --get <key>`
|
|
3806
|
-
*
|
|
3807
|
-
* @returns Config value or undefined if not set
|
|
3808
|
-
*/
|
|
3809
|
-
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | string[] | undefined>;
|
|
3810
|
-
/**
|
|
3811
|
-
* Set a raw global config value (for arbitrary keys)
|
|
3812
|
-
*
|
|
3813
|
-
* Wraps: `git config --global <key> <value>`
|
|
3814
|
-
*/
|
|
3815
|
-
setRaw(key: string, value: string, opts?: ConfigSetOpts & ExecOpts): Promise<void>;
|
|
3816
|
-
/**
|
|
3817
|
-
* Unset a raw global config value (for arbitrary keys)
|
|
3818
|
-
*
|
|
3819
|
-
* Wraps: `git config --global --unset <key>`
|
|
3820
|
-
*/
|
|
3821
|
-
unsetRaw(key: string, opts?: ExecOpts): Promise<void>;
|
|
3822
|
-
/**
|
|
3823
|
-
* List all global config values
|
|
3824
|
-
*
|
|
3825
|
-
* Wraps: `git config --global --list`
|
|
3826
|
-
*/
|
|
3827
|
-
list(opts?: GlobalConfigListOpts & ExecOpts): Promise<ConfigEntry[]>;
|
|
3828
|
-
}
|
|
3829
|
-
/**
|
|
3830
|
-
* Main Git interface for repository-agnostic operations
|
|
3831
|
-
*
|
|
3832
|
-
* Provides type-safe wrappers for Git commands that don't require a repository context.
|
|
3833
|
-
* Each method corresponds to a specific Git CLI command.
|
|
3834
|
-
*/
|
|
3835
|
-
interface Git {
|
|
3836
|
-
/**
|
|
3837
|
-
* Open an existing worktree repository
|
|
3838
|
-
*
|
|
3839
|
-
* This is the most common use case. Throws GitError if the repository is bare.
|
|
3840
|
-
*
|
|
3841
|
-
* @param path - Path to the repository working directory
|
|
3842
|
-
* @param opts - Environment isolation and credential options
|
|
3843
|
-
* @returns WorktreeRepo
|
|
3844
|
-
* @throws GitError with kind 'NotWorktreeRepo' if the repository is bare
|
|
3845
|
-
*/
|
|
3846
|
-
open(path: string, opts?: GitOpenOptions): Promise<WorktreeRepo>;
|
|
3847
|
-
/**
|
|
3848
|
-
* Open an existing bare repository
|
|
3849
|
-
*
|
|
3850
|
-
* Throws GitError if the repository is not bare.
|
|
3851
|
-
*
|
|
3852
|
-
* @param path - Path to the bare repository (git-dir)
|
|
3853
|
-
* @param opts - Environment isolation and credential options
|
|
3854
|
-
* @returns BareRepo
|
|
3855
|
-
* @throws GitError with kind 'NotBareRepo' if the repository is not bare
|
|
3856
|
-
*/
|
|
3857
|
-
openBare(path: string, opts?: GitOpenOptions): Promise<BareRepo>;
|
|
3858
|
-
/**
|
|
3859
|
-
* Open an existing repository without type guarantee
|
|
3860
|
-
*
|
|
3861
|
-
* Returns either WorktreeRepo or BareRepo depending on the repository type.
|
|
3862
|
-
* Use this when you don't know the repository type at compile time.
|
|
3863
|
-
* You can use `isWorktree()` or `isBare()` methods for runtime type checking.
|
|
3864
|
-
*
|
|
3865
|
-
* @param path - Path to the repository (workdir or git-dir)
|
|
3866
|
-
* @param opts - Environment isolation and credential options
|
|
3867
|
-
* @returns WorktreeRepo or BareRepo depending on repository type
|
|
3868
|
-
*
|
|
3869
|
-
* @example
|
|
3870
|
-
* ```typescript
|
|
3871
|
-
* const repo = await git.openRaw('/path/to/repo');
|
|
3872
|
-
* if (await repo.isWorktree()) {
|
|
3873
|
-
* // repo is WorktreeRepo at runtime
|
|
3874
|
-
* const status = await (repo as WorktreeRepo).status();
|
|
3875
|
-
* } else if (await repo.isBare()) {
|
|
3876
|
-
* // repo is BareRepo at runtime
|
|
3877
|
-
* await (repo as BareRepo).fetch({ remote: 'origin' });
|
|
3878
|
-
* }
|
|
3879
|
-
* ```
|
|
3880
|
-
*/
|
|
3881
|
-
openRaw(path: string, opts?: GitOpenOptions): Promise<WorktreeRepo | BareRepo>;
|
|
3882
|
-
/**
|
|
3883
|
-
* Clone a repository
|
|
3884
|
-
*
|
|
3885
|
-
* Wraps: `git clone <url> <path>`
|
|
3886
|
-
*
|
|
3887
|
-
* The return type depends on the `bare` or `mirror` option:
|
|
3888
|
-
* - `{ bare: true }` or `{ mirror: true }` → `BareRepo`
|
|
3889
|
-
* - Otherwise → `WorktreeRepo`
|
|
3890
|
-
*/
|
|
3891
|
-
clone(url: string, path: string, opts: CloneOpts & {
|
|
3892
|
-
bare: true;
|
|
3893
|
-
} & ExecOpts): Promise<BareRepo>;
|
|
3894
|
-
clone(url: string, path: string, opts: CloneOpts & {
|
|
3895
|
-
mirror: true;
|
|
3896
|
-
} & ExecOpts): Promise<BareRepo>;
|
|
3897
|
-
clone(url: string, path: string, opts?: CloneOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3898
|
-
/**
|
|
3899
|
-
* Initialize a new repository
|
|
3900
|
-
*
|
|
3901
|
-
* Wraps: `git init <path>`
|
|
3902
|
-
*
|
|
3903
|
-
* The return type depends on the `bare` option:
|
|
3904
|
-
* - `{ bare: true }` → `BareRepo`
|
|
3905
|
-
* - Otherwise → `WorktreeRepo`
|
|
3906
|
-
*/
|
|
3907
|
-
init(path: string, opts: InitOpts & {
|
|
3908
|
-
bare: true;
|
|
3909
|
-
} & ExecOpts): Promise<BareRepo>;
|
|
3910
|
-
init(path: string, opts?: InitOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3911
|
-
/**
|
|
3912
|
-
* List references in a remote repository
|
|
3913
|
-
*
|
|
3914
|
-
* Wraps: `git ls-remote <url>`
|
|
3915
|
-
*/
|
|
3916
|
-
lsRemote(url: string, opts?: LsRemoteOpts & ExecOpts): Promise<LsRemoteResult>;
|
|
3917
|
-
/**
|
|
3918
|
-
* Get git version
|
|
3919
|
-
*
|
|
3920
|
-
* Wraps: `git --version`
|
|
3921
|
-
*/
|
|
3922
|
-
version(opts?: ExecOpts): Promise<string>;
|
|
3923
|
-
/**
|
|
3924
|
-
* Execute a raw git command (repository-agnostic)
|
|
3925
|
-
*
|
|
3926
|
-
* Wraps: `git <argv...>`
|
|
3927
|
-
*/
|
|
3928
|
-
raw(argv: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
3929
|
-
/**
|
|
3930
|
-
* Global config operations
|
|
3931
|
-
*
|
|
3932
|
-
* Wraps: `git config --global` subcommands
|
|
3933
|
-
*
|
|
3934
|
-
* Operates on ~/.gitconfig (user-level configuration).
|
|
3935
|
-
* For repository-level config, use repo.config instead.
|
|
3936
|
-
*/
|
|
3937
|
-
config: GlobalConfigOperations;
|
|
3938
|
-
/**
|
|
3939
|
-
* Global LFS operations
|
|
3940
|
-
*
|
|
3941
|
-
* Wraps: `git lfs` subcommands for user-level configuration
|
|
3942
|
-
*
|
|
3943
|
-
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3944
|
-
* For repository-level LFS operations, use repo.lfs instead.
|
|
3945
|
-
*/
|
|
3946
|
-
lfs: GlobalLfsOperations;
|
|
3947
|
-
}
|
|
3948
|
-
|
|
3949
|
-
/**
|
|
3950
|
-
* CLI Runner - Core execution engine for Git commands
|
|
3951
|
-
*
|
|
3952
|
-
* This module provides:
|
|
3953
|
-
* - CliRunner: Executes Git commands with progress tracking and abort support
|
|
3954
|
-
* - Progress collection from stderr (Git and LFS)
|
|
3955
|
-
* - Error mapping from Git exit codes
|
|
3956
|
-
*/
|
|
3957
|
-
|
|
3958
|
-
/**
|
|
3959
|
-
* Credential helper configuration
|
|
3960
|
-
*/
|
|
3961
|
-
type CredentialHelperConfig = {
|
|
3962
|
-
/** Helper name (e.g., 'store', 'cache', 'manager-core', or custom name) */
|
|
3963
|
-
helper?: string;
|
|
3964
|
-
/** Path to custom helper binary */
|
|
3965
|
-
helperPath?: string;
|
|
3966
|
-
};
|
|
3967
|
-
/**
|
|
3968
|
-
* Options for CliRunner
|
|
3969
|
-
*/
|
|
3970
|
-
type CliRunnerOptions = {
|
|
3971
|
-
/** Git binary path (default: 'git') */
|
|
3972
|
-
gitBinary?: string;
|
|
3973
|
-
/** Additional environment variables */
|
|
3974
|
-
env?: Record<string, string>;
|
|
3975
|
-
/**
|
|
3976
|
-
* Controls how the parent process environment is inherited by spawned Git commands.
|
|
3977
|
-
*
|
|
3978
|
-
* By default, only a curated allowlist of variables that Git needs to operate is
|
|
3979
|
-
* inherited (environment variable traversal prevention); the full parent environment is
|
|
3980
|
-
* NOT forwarded. See {@link EnvInheritance} for all options.
|
|
3981
|
-
*
|
|
3982
|
-
* @default undefined (inherit the default allowlist)
|
|
3983
|
-
*/
|
|
3984
|
-
inheritEnv?: EnvInheritance;
|
|
3985
|
-
/** Directories to prepend to PATH */
|
|
3986
|
-
pathPrefix?: string[];
|
|
3987
|
-
/** Custom HOME directory for git config isolation */
|
|
3988
|
-
home?: string;
|
|
3989
|
-
/** Credential helper configuration */
|
|
3990
|
-
credential?: CredentialHelperConfig;
|
|
3991
|
-
/** Audit configuration for command tracking and tracing */
|
|
3992
|
-
audit?: AuditConfig;
|
|
3993
|
-
};
|
|
3994
|
-
/**
|
|
3995
|
-
* Per-call options for {@link CliRunner.run} / {@link CliRunner.runOrThrow}.
|
|
3996
|
-
*
|
|
3997
|
-
* Extends {@link ExecOpts} with an `env` overlay so callers (e.g. the repository
|
|
3998
|
-
* implementations) can inject command-specific environment variables — such as
|
|
3999
|
-
* `GIT_LFS_SKIP_SMUDGE` for an LFS skip-smudge mode. This keeps `env` out of the
|
|
4000
|
-
* public `ExecOpts` / repository operation option types, scoping it to the
|
|
4001
|
-
* runner's own `run` / `runOrThrow` entry points.
|
|
4002
|
-
*/
|
|
4003
|
-
type RunOptions = ExecOpts & {
|
|
4004
|
-
/** UTF-8 text to write to standard input, then close it. */
|
|
4005
|
-
stdin?: string;
|
|
4006
|
-
/**
|
|
4007
|
-
* Extra environment variables merged on top of the resolved environment for
|
|
4008
|
-
* this single command. Values here take precedence over the configured
|
|
4009
|
-
* environment but do not persist across calls.
|
|
4010
|
-
*/
|
|
4011
|
-
env?: Record<string, string>;
|
|
4012
|
-
};
|
|
4013
|
-
/**
|
|
4014
|
-
* CLI Runner for executing Git commands
|
|
4015
|
-
*
|
|
4016
|
-
* Handles:
|
|
4017
|
-
* - Command construction based on execution context
|
|
4018
|
-
* - Progress tracking from stderr (Git and LFS)
|
|
4019
|
-
* - Abort signal handling
|
|
4020
|
-
* - Error mapping
|
|
4021
|
-
*/
|
|
4022
|
-
declare class CliRunner {
|
|
4023
|
-
private readonly exec;
|
|
4024
|
-
private readonly gitBinary;
|
|
4025
|
-
private readonly baseEnv;
|
|
4026
|
-
private readonly inheritEnv;
|
|
4027
|
-
private readonly pathPrefix;
|
|
4028
|
-
private readonly home;
|
|
4029
|
-
private readonly credential;
|
|
4030
|
-
private readonly audit;
|
|
4031
|
-
constructor(adapters: RuntimeAdapters, options?: CliRunnerOptions);
|
|
4032
|
-
/**
|
|
4033
|
-
* Create a new CliRunner with additional options merged
|
|
4034
|
-
*
|
|
4035
|
-
* Used to create a runner for a specific repository with custom environment
|
|
4036
|
-
*/
|
|
4037
|
-
withOptions(options: CliRunnerOptions): CliRunner;
|
|
4038
|
-
/**
|
|
4039
|
-
* Build command argv based on execution context
|
|
4040
|
-
*/
|
|
4041
|
-
private buildArgv;
|
|
4042
|
-
/**
|
|
4043
|
-
* Build the effective environment for command execution
|
|
4044
|
-
*
|
|
4045
|
-
* Seeds the environment from the inherited (allowlisted) parent variables, then layers
|
|
4046
|
-
* the configured `env`, home directory, and PATH prefix overrides on top. The parent
|
|
4047
|
-
* process environment is never forwarded wholesale unless `inheritEnv: true` is set
|
|
4048
|
-
* (environment variable traversal prevention).
|
|
4049
|
-
*/
|
|
4050
|
-
private buildEnv;
|
|
4051
|
-
/**
|
|
4052
|
-
* Extract directory from a file path
|
|
4053
|
-
*/
|
|
4054
|
-
private extractDirectory;
|
|
4055
|
-
/**
|
|
4056
|
-
* Run a Git command
|
|
4057
|
-
*/
|
|
4058
|
-
run(context: ExecutionContext, args: string[], opts?: RunOptions): Promise<RawResult>;
|
|
4059
|
-
/**
|
|
4060
|
-
* Process a single line from stderr for progress and trace callbacks
|
|
4061
|
-
*/
|
|
4062
|
-
private processStderrLine;
|
|
4063
|
-
/**
|
|
4064
|
-
* Map Git result to GitError if needed
|
|
4065
|
-
*/
|
|
4066
|
-
mapError(result: RawResult, context: ExecutionContext, argv: string[]): GitError | null;
|
|
4067
|
-
/**
|
|
4068
|
-
* Classify error type based on stderr content
|
|
4069
|
-
*/
|
|
4070
|
-
private classifyError;
|
|
4071
|
-
/**
|
|
4072
|
-
* Extract user-friendly error message from stderr
|
|
4073
|
-
*/
|
|
4074
|
-
private extractErrorMessage;
|
|
4075
|
-
/**
|
|
4076
|
-
* Run a command and throw on error
|
|
4077
|
-
*/
|
|
4078
|
-
runOrThrow(context: ExecutionContext, args: string[], opts?: RunOptions): Promise<RawResult>;
|
|
4079
|
-
}
|
|
4080
|
-
|
|
4081
|
-
/**
|
|
4082
|
-
* Git implementation - repository-agnostic operations
|
|
4083
|
-
*/
|
|
4084
|
-
|
|
4085
|
-
/**
|
|
4086
|
-
* Default minimum supported Git version.
|
|
4087
|
-
*
|
|
4088
|
-
* This is the minimum version required when `useLegacyVersion` is false (the default).
|
|
4089
|
-
* Use `useLegacyVersion: true` to allow older Git versions (2.25.0+).
|
|
4090
|
-
*/
|
|
4091
|
-
declare const MIN_GIT_VERSION = "2.30.0";
|
|
4092
|
-
/**
|
|
4093
|
-
* Legacy minimum Git version
|
|
4094
|
-
*
|
|
4095
|
-
* When `useLegacyVersion: true` is set, this version is used as the minimum.
|
|
4096
|
-
* Git 2.25.0 is the default version on Ubuntu 20.04 LTS.
|
|
4097
|
-
*/
|
|
4098
|
-
declare const LEGACY_GIT_VERSION = "2.25.0";
|
|
4099
|
-
/**
|
|
4100
|
-
* Options for creating a Git instance
|
|
4101
|
-
*/
|
|
4102
|
-
type CreateGitOptions = CliRunnerOptions & {
|
|
4103
|
-
/** Runtime adapters (exec, fs) */
|
|
4104
|
-
adapters: RuntimeAdapters;
|
|
4105
|
-
/**
|
|
4106
|
-
* Controls whether to perform a Git version check during initialization.
|
|
4107
|
-
* When true, skips the Git version check. When false (default), throws
|
|
4108
|
-
* GitError if Git version is below the minimum required version.
|
|
4109
|
-
* @default false
|
|
4110
|
-
*/
|
|
4111
|
-
skipVersionCheck?: boolean;
|
|
4112
|
-
/**
|
|
4113
|
-
* Allow legacy Git versions (2.25.0+) instead of requiring 2.30.0+.
|
|
4114
|
-
*
|
|
4115
|
-
* Use this for environments with older Git installations such as
|
|
4116
|
-
* Ubuntu 20.04 LTS which ships with Git 2.25.1 by default.
|
|
4117
|
-
*
|
|
4118
|
-
* @default false
|
|
4119
|
-
*/
|
|
4120
|
-
useLegacyVersion?: boolean;
|
|
4121
|
-
};
|
|
4122
|
-
/**
|
|
4123
|
-
* Create a new Git instance (synchronous, no version check)
|
|
4124
|
-
*
|
|
4125
|
-
* @param options - Creation options including runtime adapters
|
|
4126
|
-
* @returns Git instance
|
|
4127
|
-
* @deprecated Use createGit instead for version checking
|
|
4128
|
-
*/
|
|
4129
|
-
declare function createGitSync(options: CreateGitOptions): Git;
|
|
4130
|
-
/**
|
|
4131
|
-
* Create a new Git instance with optional version check
|
|
4132
|
-
*
|
|
4133
|
-
* @param options - Creation options including runtime adapters
|
|
4134
|
-
* @returns Git instance
|
|
4135
|
-
* @throws GitError with kind 'UnsupportedGitVersion' if Git version is below minimum
|
|
4136
|
-
*/
|
|
4137
|
-
declare function createGit(options: CreateGitOptions): Promise<Git>;
|
|
1
|
+
import { E as ExecAdapter, C as Capabilities, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, e as CreateGitOptions, G as GitClient, f as Git } from '../../client-DAAbUvgo.js';
|
|
4138
2
|
|
|
4139
3
|
/**
|
|
4140
4
|
* Node.js ExecAdapter implementation
|
|
@@ -4164,142 +28,18 @@ declare class NodeFsAdapter implements FsAdapter {
|
|
|
4164
28
|
}): TailHandle;
|
|
4165
29
|
}
|
|
4166
30
|
|
|
4167
|
-
/**
|
|
4168
|
-
* Node.js adapter exports
|
|
4169
|
-
*/
|
|
4170
|
-
|
|
4171
31
|
/**
|
|
4172
32
|
* Create Node.js runtime adapters
|
|
4173
33
|
*/
|
|
4174
34
|
declare function createNodeAdapters(): RuntimeAdapters;
|
|
4175
|
-
/**
|
|
4176
|
-
* Options for creating a TypeGit instance (Node.js)
|
|
4177
|
-
* Excludes adapters as they are automatically configured
|
|
4178
|
-
*/
|
|
4179
35
|
type TypeGitOptions = Omit<CreateGitOptions, 'adapters'>;
|
|
4180
|
-
/**
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
* @example
|
|
4186
|
-
* ```typescript
|
|
4187
|
-
* import { TypeGit } from 'type-git/node';
|
|
4188
|
-
*
|
|
4189
|
-
* // Recommended: Use create() for version check
|
|
4190
|
-
* const git = await TypeGit.create();
|
|
4191
|
-
*
|
|
4192
|
-
* // Skip version check (not recommended)
|
|
4193
|
-
* const git = await TypeGit.create({ skipVersionCheck: true });
|
|
4194
|
-
*
|
|
4195
|
-
* // Legacy: constructor (no version check, deprecated)
|
|
4196
|
-
* const git = new TypeGit();
|
|
4197
|
-
*
|
|
4198
|
-
* const repo = await git.open('/path/to/repo');
|
|
4199
|
-
* ```
|
|
4200
|
-
*/
|
|
4201
|
-
declare class TypeGit {
|
|
4202
|
-
private readonly git;
|
|
4203
|
-
/**
|
|
4204
|
-
* Create a TypeGit instance with Git version check
|
|
4205
|
-
*
|
|
4206
|
-
* @param createOpts - Options including skipVersionCheck
|
|
4207
|
-
* @returns TypeGit instance
|
|
4208
|
-
* @throws GitError with kind 'UnsupportedGitVersion' if Git version is below minimum
|
|
4209
|
-
*/
|
|
4210
|
-
static create(createOpts?: TypeGitOptions): Promise<TypeGit>;
|
|
4211
|
-
/**
|
|
4212
|
-
* @deprecated Use TypeGit.create() instead for version checking
|
|
4213
|
-
*/
|
|
4214
|
-
constructor(constructorOpts?: TypeGitOptions);
|
|
36
|
+
/** Git client preconfigured for Node. */
|
|
37
|
+
declare class TypeGit extends GitClient {
|
|
38
|
+
static create(options?: TypeGitOptions): Promise<TypeGit>;
|
|
39
|
+
/** @deprecated Use TypeGit.create() to check Git compatibility. */
|
|
40
|
+
constructor(constructorOptions?: TypeGitOptions);
|
|
4215
41
|
/** @internal */
|
|
4216
|
-
constructor(
|
|
4217
|
-
/**
|
|
4218
|
-
* Open an existing worktree repository
|
|
4219
|
-
*
|
|
4220
|
-
* This is the most common use case. Throws GitError if the repository is bare.
|
|
4221
|
-
*
|
|
4222
|
-
* @throws GitError with kind 'NotWorktreeRepo' if the repository is bare
|
|
4223
|
-
*/
|
|
4224
|
-
get open(): (path: string, opts?: GitOpenOptions) => Promise<WorktreeRepo>;
|
|
4225
|
-
/**
|
|
4226
|
-
* Open an existing bare repository
|
|
4227
|
-
*
|
|
4228
|
-
* Throws GitError if the repository is not bare.
|
|
4229
|
-
*
|
|
4230
|
-
* @throws GitError with kind 'NotBareRepo' if the repository is not bare
|
|
4231
|
-
*/
|
|
4232
|
-
get openBare(): (path: string, opts?: GitOpenOptions) => Promise<BareRepo>;
|
|
4233
|
-
/**
|
|
4234
|
-
* Open an existing repository without type guarantee
|
|
4235
|
-
*
|
|
4236
|
-
* Returns either WorktreeRepo or BareRepo depending on the repository type.
|
|
4237
|
-
* Use this when you don't know the repository type at compile time.
|
|
4238
|
-
*/
|
|
4239
|
-
get openRaw(): (path: string, opts?: GitOpenOptions) => Promise<WorktreeRepo | BareRepo>;
|
|
4240
|
-
/**
|
|
4241
|
-
* Clone a repository
|
|
4242
|
-
*
|
|
4243
|
-
* The return type depends on the `bare` or `mirror` option:
|
|
4244
|
-
* - `{ bare: true }` or `{ mirror: true }` → `BareRepo`
|
|
4245
|
-
* - Otherwise → `WorktreeRepo`
|
|
4246
|
-
*/
|
|
4247
|
-
clone(url: string, path: string, opts: CloneOpts & {
|
|
4248
|
-
bare: true;
|
|
4249
|
-
} & ExecOpts): Promise<BareRepo>;
|
|
4250
|
-
clone(url: string, path: string, opts: CloneOpts & {
|
|
4251
|
-
mirror: true;
|
|
4252
|
-
} & ExecOpts): Promise<BareRepo>;
|
|
4253
|
-
clone(url: string, path: string, opts?: CloneOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
4254
|
-
/**
|
|
4255
|
-
* Initialize a new repository
|
|
4256
|
-
*
|
|
4257
|
-
* The return type depends on the `bare` option:
|
|
4258
|
-
* - `{ bare: true }` → `BareRepo`
|
|
4259
|
-
* - Otherwise → `WorktreeRepo`
|
|
4260
|
-
*/
|
|
4261
|
-
init(path: string, opts: InitOpts & {
|
|
4262
|
-
bare: true;
|
|
4263
|
-
} & ExecOpts): Promise<BareRepo>;
|
|
4264
|
-
init(path: string, opts?: InitOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
4265
|
-
/**
|
|
4266
|
-
* List references in a remote repository
|
|
4267
|
-
*/
|
|
4268
|
-
get lsRemote(): (url: string, opts?: LsRemoteOpts & ExecOpts) => Promise<LsRemoteResult>;
|
|
4269
|
-
/**
|
|
4270
|
-
* Get git version
|
|
4271
|
-
*/
|
|
4272
|
-
get version(): (opts?: ExecOpts) => Promise<string>;
|
|
4273
|
-
/**
|
|
4274
|
-
* Execute a raw git command (repository-agnostic)
|
|
4275
|
-
*/
|
|
4276
|
-
get raw(): (argv: string[], opts?: ExecOpts) => Promise<RawResult>;
|
|
4277
|
-
/**
|
|
4278
|
-
* Global config operations
|
|
4279
|
-
*
|
|
4280
|
-
* Operates on ~/.gitconfig (user-level configuration).
|
|
4281
|
-
* For repository-level config, use repo.config instead.
|
|
4282
|
-
*/
|
|
4283
|
-
get config(): GlobalConfigOperations;
|
|
4284
|
-
/**
|
|
4285
|
-
* Global LFS operations
|
|
4286
|
-
*
|
|
4287
|
-
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
4288
|
-
* For repository-level LFS operations, use repo.lfs instead.
|
|
4289
|
-
*
|
|
4290
|
-
* @example
|
|
4291
|
-
* ```typescript
|
|
4292
|
-
* // Install LFS globally
|
|
4293
|
-
* await git.lfs.install();
|
|
4294
|
-
*
|
|
4295
|
-
* // Install system-wide
|
|
4296
|
-
* await git.lfs.install({ system: true });
|
|
4297
|
-
*
|
|
4298
|
-
* // Get LFS version
|
|
4299
|
-
* const version = await git.lfs.version();
|
|
4300
|
-
* ```
|
|
4301
|
-
*/
|
|
4302
|
-
get lfs(): GlobalLfsOperations;
|
|
42
|
+
constructor(git: Git);
|
|
4303
43
|
}
|
|
4304
44
|
|
|
4305
|
-
export {
|
|
45
|
+
export { NodeExecAdapter, NodeFsAdapter, TypeGit, type TypeGitOptions, createNodeAdapters };
|