type-git 0.0.2 → 0.1.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 +33 -4
- package/dist/adapters/bun/index.cjs +421 -0
- package/dist/adapters/bun/index.cjs.map +1 -0
- package/dist/adapters/bun/index.d.cts +44 -0
- package/dist/adapters/bun/index.d.ts +38 -5
- package/dist/adapters/bun/index.js +388 -13
- package/dist/adapters/bun/index.js.map +1 -1
- package/dist/adapters/deno/index.cjs +472 -0
- package/dist/adapters/deno/index.cjs.map +1 -0
- package/dist/adapters/deno/index.d.cts +46 -0
- package/dist/adapters/deno/index.d.ts +40 -5
- package/dist/adapters/deno/index.js +439 -13
- package/dist/adapters/deno/index.js.map +1 -1
- package/dist/adapters/node/index.cjs +6254 -0
- package/dist/adapters/node/index.cjs.map +1 -0
- package/dist/{core/repo.d.ts → adapters/node/index.d.cts} +1452 -184
- package/dist/adapters/node/index.d.ts +4123 -13
- package/dist/adapters/node/index.js +6210 -119
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/{core/types.d.ts → adapters-DehG3CsV.d.cts} +223 -29
- package/dist/adapters-DehG3CsV.d.ts +574 -0
- package/dist/index.cjs +6383 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -9
- package/dist/index.js +6320 -13
- package/dist/index.js.map +1 -1
- package/package.json +13 -7
- package/dist/adapters/bun/exec.d.ts +0 -13
- package/dist/adapters/bun/exec.d.ts.map +0 -1
- package/dist/adapters/bun/exec.js +0 -242
- package/dist/adapters/bun/exec.js.map +0 -1
- package/dist/adapters/bun/fs.d.ts +0 -20
- package/dist/adapters/bun/fs.d.ts.map +0 -1
- package/dist/adapters/bun/fs.js +0 -148
- package/dist/adapters/bun/fs.js.map +0 -1
- package/dist/adapters/bun/index.d.ts.map +0 -1
- package/dist/adapters/deno/exec.d.ts +0 -14
- package/dist/adapters/deno/exec.d.ts.map +0 -1
- package/dist/adapters/deno/exec.js +0 -266
- package/dist/adapters/deno/exec.js.map +0 -1
- package/dist/adapters/deno/fs.d.ts +0 -21
- package/dist/adapters/deno/fs.d.ts.map +0 -1
- package/dist/adapters/deno/fs.js +0 -191
- package/dist/adapters/deno/fs.js.map +0 -1
- package/dist/adapters/deno/index.d.ts.map +0 -1
- package/dist/adapters/node/exec.d.ts +0 -11
- package/dist/adapters/node/exec.d.ts.map +0 -1
- package/dist/adapters/node/exec.js +0 -161
- package/dist/adapters/node/exec.js.map +0 -1
- package/dist/adapters/node/fs.d.ts +0 -18
- package/dist/adapters/node/fs.d.ts.map +0 -1
- package/dist/adapters/node/fs.js +0 -164
- package/dist/adapters/node/fs.js.map +0 -1
- package/dist/adapters/node/index.d.ts.map +0 -1
- package/dist/core/adapters.d.ts +0 -192
- package/dist/core/adapters.d.ts.map +0 -1
- package/dist/core/adapters.js +0 -10
- package/dist/core/adapters.js.map +0 -1
- package/dist/core/git.d.ts +0 -426
- package/dist/core/git.d.ts.map +0 -1
- package/dist/core/git.js +0 -5
- package/dist/core/git.js.map +0 -1
- package/dist/core/index.d.ts +0 -8
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -8
- package/dist/core/index.js.map +0 -1
- package/dist/core/repo.d.ts.map +0 -1
- package/dist/core/repo.js +0 -5
- package/dist/core/repo.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -100
- package/dist/core/types.js.map +0 -1
- package/dist/impl/bare-repo-impl.d.ts +0 -91
- package/dist/impl/bare-repo-impl.d.ts.map +0 -1
- package/dist/impl/bare-repo-impl.js +0 -446
- package/dist/impl/bare-repo-impl.js.map +0 -1
- package/dist/impl/git-impl.d.ts +0 -125
- package/dist/impl/git-impl.d.ts.map +0 -1
- package/dist/impl/git-impl.js +0 -554
- package/dist/impl/git-impl.js.map +0 -1
- package/dist/impl/index.d.ts +0 -7
- package/dist/impl/index.d.ts.map +0 -1
- package/dist/impl/index.js +0 -7
- package/dist/impl/index.js.map +0 -1
- package/dist/impl/worktree-repo-impl.d.ts +0 -226
- package/dist/impl/worktree-repo-impl.d.ts.map +0 -1
- package/dist/impl/worktree-repo-impl.js +0 -3887
- package/dist/impl/worktree-repo-impl.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/parsers/index.d.ts +0 -230
- package/dist/parsers/index.d.ts.map +0 -1
- package/dist/parsers/index.js +0 -529
- package/dist/parsers/index.js.map +0 -1
- package/dist/runner/cli-runner.d.ts +0 -94
- package/dist/runner/cli-runner.d.ts.map +0 -1
- package/dist/runner/cli-runner.js +0 -315
- package/dist/runner/cli-runner.js.map +0 -1
- package/dist/runner/index.d.ts +0 -5
- package/dist/runner/index.d.ts.map +0 -1
- package/dist/runner/index.js +0 -5
- package/dist/runner/index.js.map +0 -1
|
@@ -1,17 +1,259 @@
|
|
|
1
|
+
import { G as GitErrorCategory, e as ExecOpts, f as RawResult, L as LfsMode, g as GitProgress, h as GitOpenOptions, R as RuntimeAdapters, i as ExecutionContext, j as GitError, 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 } from '../../adapters-DehG3CsV.cjs';
|
|
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
|
+
|
|
1
243
|
/**
|
|
2
244
|
* Repository interfaces - operations that require a repository context
|
|
3
245
|
*/
|
|
4
|
-
|
|
246
|
+
|
|
5
247
|
/**
|
|
6
248
|
* Base repository interface
|
|
7
249
|
*/
|
|
8
|
-
|
|
250
|
+
interface RepoBase {
|
|
9
251
|
/**
|
|
10
252
|
* Execute a raw git command in this repository context
|
|
11
253
|
*
|
|
12
254
|
* Wraps: `git <argv...>`
|
|
13
255
|
*/
|
|
14
|
-
raw(argv:
|
|
256
|
+
raw(argv: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
15
257
|
/**
|
|
16
258
|
* Check if this repository is a worktree repository (has working directory)
|
|
17
259
|
*
|
|
@@ -50,11 +292,124 @@ export interface RepoBase {
|
|
|
50
292
|
* ```
|
|
51
293
|
*/
|
|
52
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[]>;
|
|
53
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
|
+
};
|
|
54
409
|
/**
|
|
55
410
|
* Status file entry
|
|
56
411
|
*/
|
|
57
|
-
|
|
412
|
+
type StatusEntry = {
|
|
58
413
|
path: string;
|
|
59
414
|
index: string;
|
|
60
415
|
workdir: string;
|
|
@@ -63,8 +418,8 @@ export type StatusEntry = {
|
|
|
63
418
|
/**
|
|
64
419
|
* Result from git status --porcelain
|
|
65
420
|
*/
|
|
66
|
-
|
|
67
|
-
entries:
|
|
421
|
+
type StatusPorcelain = {
|
|
422
|
+
entries: StatusEntry[];
|
|
68
423
|
branch?: string;
|
|
69
424
|
upstream?: string;
|
|
70
425
|
ahead?: number;
|
|
@@ -73,7 +428,7 @@ export type StatusPorcelain = {
|
|
|
73
428
|
/**
|
|
74
429
|
* Options for git status
|
|
75
430
|
*/
|
|
76
|
-
|
|
431
|
+
type StatusOpts = {
|
|
77
432
|
/** Porcelain output format version (1 or 2) */
|
|
78
433
|
porcelain?: 1 | 2;
|
|
79
434
|
/** How to show untracked files */
|
|
@@ -98,10 +453,10 @@ export type StatusOpts = {
|
|
|
98
453
|
/**
|
|
99
454
|
* Commit information
|
|
100
455
|
*/
|
|
101
|
-
|
|
456
|
+
type Commit = {
|
|
102
457
|
hash: string;
|
|
103
458
|
abbrevHash: string;
|
|
104
|
-
parents:
|
|
459
|
+
parents: string[];
|
|
105
460
|
author: {
|
|
106
461
|
name: string;
|
|
107
462
|
email: string;
|
|
@@ -118,7 +473,7 @@ export type Commit = {
|
|
|
118
473
|
/**
|
|
119
474
|
* Options for git log
|
|
120
475
|
*/
|
|
121
|
-
|
|
476
|
+
type LogOpts = {
|
|
122
477
|
/** Limit the number of commits to output */
|
|
123
478
|
maxCount?: number;
|
|
124
479
|
/** Skip number of commits before starting to show the output */
|
|
@@ -171,11 +526,11 @@ export type LogOpts = {
|
|
|
171
526
|
/**
|
|
172
527
|
* Options for git fetch
|
|
173
528
|
*/
|
|
174
|
-
|
|
529
|
+
type FetchOpts = {
|
|
175
530
|
/** Remote name to fetch from */
|
|
176
531
|
remote?: string;
|
|
177
532
|
/** Refspec(s) to fetch */
|
|
178
|
-
refspec?: string |
|
|
533
|
+
refspec?: string | string[];
|
|
179
534
|
/** Remove remote-tracking refs that no longer exist on the remote */
|
|
180
535
|
prune?: boolean;
|
|
181
536
|
/** Fetch all tags from the remote */
|
|
@@ -219,7 +574,7 @@ export type FetchOpts = {
|
|
|
219
574
|
/** Deepen a shallow repository by date */
|
|
220
575
|
shallowSince?: string | Date;
|
|
221
576
|
/** Deepen a shallow repository excluding specified revision */
|
|
222
|
-
shallowExclude?: string |
|
|
577
|
+
shallowExclude?: string | string[];
|
|
223
578
|
/** Deepen a shallow repository by specified number of commits */
|
|
224
579
|
deepen?: number;
|
|
225
580
|
/** Convert a shallow repository to a complete one */
|
|
@@ -244,7 +599,7 @@ export type FetchOpts = {
|
|
|
244
599
|
/**
|
|
245
600
|
* Force with lease options for git push
|
|
246
601
|
*/
|
|
247
|
-
|
|
602
|
+
type ForceWithLeaseOpts = {
|
|
248
603
|
/** Reference name to check (e.g., 'refs/heads/main') */
|
|
249
604
|
refname: string;
|
|
250
605
|
/** Expected value of the ref (commit hash) */
|
|
@@ -253,11 +608,11 @@ export type ForceWithLeaseOpts = {
|
|
|
253
608
|
/**
|
|
254
609
|
* Options for git push
|
|
255
610
|
*/
|
|
256
|
-
|
|
611
|
+
type PushOpts = {
|
|
257
612
|
/** Remote name to push to */
|
|
258
613
|
remote?: string;
|
|
259
614
|
/** Refspec(s) to push */
|
|
260
|
-
refspec?: string |
|
|
615
|
+
refspec?: string | string[];
|
|
261
616
|
/** Force updates even if they are not fast-forward */
|
|
262
617
|
force?: boolean;
|
|
263
618
|
/**
|
|
@@ -307,7 +662,7 @@ export type PushOpts = {
|
|
|
307
662
|
/** Use atomic transaction to update refs */
|
|
308
663
|
atomic?: boolean;
|
|
309
664
|
/** Transmit push options to the server */
|
|
310
|
-
pushOption?: string |
|
|
665
|
+
pushOption?: string | string[];
|
|
311
666
|
/** Use IPv4 addresses only */
|
|
312
667
|
ipv4?: boolean;
|
|
313
668
|
/** Use IPv6 addresses only */
|
|
@@ -316,7 +671,7 @@ export type PushOpts = {
|
|
|
316
671
|
/**
|
|
317
672
|
* Options for git add
|
|
318
673
|
*/
|
|
319
|
-
|
|
674
|
+
type AddOpts = {
|
|
320
675
|
/** Add all files (including untracked) */
|
|
321
676
|
all?: boolean;
|
|
322
677
|
/** Dry run - show what would be added */
|
|
@@ -353,7 +708,7 @@ export type AddOpts = {
|
|
|
353
708
|
/**
|
|
354
709
|
* Branch information
|
|
355
710
|
*/
|
|
356
|
-
|
|
711
|
+
type BranchInfo = {
|
|
357
712
|
name: string;
|
|
358
713
|
current: boolean;
|
|
359
714
|
commit: string;
|
|
@@ -363,7 +718,7 @@ export type BranchInfo = {
|
|
|
363
718
|
/**
|
|
364
719
|
* Options for git branch
|
|
365
720
|
*/
|
|
366
|
-
|
|
721
|
+
type BranchOpts = {
|
|
367
722
|
/** List all branches (including remote) */
|
|
368
723
|
all?: boolean;
|
|
369
724
|
/** List remote branches only */
|
|
@@ -392,7 +747,7 @@ export type BranchOpts = {
|
|
|
392
747
|
/**
|
|
393
748
|
* Options for creating a branch
|
|
394
749
|
*/
|
|
395
|
-
|
|
750
|
+
type BranchCreateOpts = {
|
|
396
751
|
/** Start point (commit, branch, or tag) */
|
|
397
752
|
startPoint?: string;
|
|
398
753
|
/** Force creation (overwrite existing) */
|
|
@@ -409,7 +764,7 @@ export type BranchCreateOpts = {
|
|
|
409
764
|
/**
|
|
410
765
|
* Options for deleting a branch
|
|
411
766
|
*/
|
|
412
|
-
|
|
767
|
+
type BranchDeleteOpts = {
|
|
413
768
|
/** Force delete (even if not merged) */
|
|
414
769
|
force?: boolean;
|
|
415
770
|
/** Delete remote-tracking branch */
|
|
@@ -420,7 +775,7 @@ export type BranchDeleteOpts = {
|
|
|
420
775
|
*
|
|
421
776
|
* Used for: `git checkout <branch>`
|
|
422
777
|
*/
|
|
423
|
-
|
|
778
|
+
type CheckoutBranchOpts = {
|
|
424
779
|
/** Force checkout (discard local changes) */
|
|
425
780
|
force?: boolean;
|
|
426
781
|
/** Create new branch */
|
|
@@ -457,7 +812,7 @@ export type CheckoutBranchOpts = {
|
|
|
457
812
|
*
|
|
458
813
|
* Used for: `git checkout [<tree-ish>] -- <pathspec>...`
|
|
459
814
|
*/
|
|
460
|
-
|
|
815
|
+
type CheckoutPathOpts = {
|
|
461
816
|
/** Force checkout (discard local changes) */
|
|
462
817
|
force?: boolean;
|
|
463
818
|
/** Source tree-ish to checkout from (default: index) */
|
|
@@ -477,11 +832,11 @@ export type CheckoutPathOpts = {
|
|
|
477
832
|
* Options for git checkout (legacy combined type)
|
|
478
833
|
* @deprecated Use CheckoutBranchOpts or CheckoutPathOpts for type safety
|
|
479
834
|
*/
|
|
480
|
-
|
|
835
|
+
type CheckoutOpts = CheckoutBranchOpts & CheckoutPathOpts;
|
|
481
836
|
/**
|
|
482
837
|
* Options for git commit
|
|
483
838
|
*/
|
|
484
|
-
|
|
839
|
+
type CommitOpts = {
|
|
485
840
|
/** Commit message */
|
|
486
841
|
message?: string;
|
|
487
842
|
/** Allow empty commit */
|
|
@@ -519,7 +874,7 @@ export type CommitOpts = {
|
|
|
519
874
|
/** Override author date and ignore cached author identity */
|
|
520
875
|
resetAuthor?: boolean;
|
|
521
876
|
/** Add trailers to the commit message */
|
|
522
|
-
trailer?: string |
|
|
877
|
+
trailer?: string | string[];
|
|
523
878
|
/** Add Signed-off-by trailer */
|
|
524
879
|
signoff?: boolean;
|
|
525
880
|
/** How to clean up the commit message */
|
|
@@ -540,7 +895,7 @@ export type CommitOpts = {
|
|
|
540
895
|
/**
|
|
541
896
|
* Commit result
|
|
542
897
|
*/
|
|
543
|
-
|
|
898
|
+
type CommitResult = {
|
|
544
899
|
/** Commit hash */
|
|
545
900
|
hash: string;
|
|
546
901
|
/** Branch name */
|
|
@@ -557,7 +912,7 @@ export type CommitResult = {
|
|
|
557
912
|
/**
|
|
558
913
|
* Options for git diff
|
|
559
914
|
*/
|
|
560
|
-
|
|
915
|
+
type DiffOpts = {
|
|
561
916
|
/** Compare staged changes */
|
|
562
917
|
staged?: boolean;
|
|
563
918
|
/** Show stat only */
|
|
@@ -571,7 +926,7 @@ export type DiffOpts = {
|
|
|
571
926
|
/** Ignore whitespace changes */
|
|
572
927
|
ignoreWhitespace?: boolean;
|
|
573
928
|
/** Pathspecs to filter */
|
|
574
|
-
paths?:
|
|
929
|
+
paths?: string[];
|
|
575
930
|
/** Use NUL as line terminator */
|
|
576
931
|
nullTerminated?: boolean;
|
|
577
932
|
/** Generate patch output */
|
|
@@ -614,7 +969,7 @@ export type DiffOpts = {
|
|
|
614
969
|
/**
|
|
615
970
|
* Diff file entry
|
|
616
971
|
*/
|
|
617
|
-
|
|
972
|
+
type DiffEntry = {
|
|
618
973
|
path: string;
|
|
619
974
|
status: 'A' | 'D' | 'M' | 'R' | 'C' | 'T' | 'U' | 'X';
|
|
620
975
|
oldPath?: string;
|
|
@@ -624,14 +979,14 @@ export type DiffEntry = {
|
|
|
624
979
|
/**
|
|
625
980
|
* Diff result
|
|
626
981
|
*/
|
|
627
|
-
|
|
628
|
-
files:
|
|
982
|
+
type DiffResult = {
|
|
983
|
+
files: DiffEntry[];
|
|
629
984
|
raw?: string;
|
|
630
985
|
};
|
|
631
986
|
/**
|
|
632
987
|
* Options for git merge
|
|
633
988
|
*/
|
|
634
|
-
|
|
989
|
+
type MergeOpts = {
|
|
635
990
|
/** Merge message */
|
|
636
991
|
message?: string;
|
|
637
992
|
/** Fast-forward behavior */
|
|
@@ -643,7 +998,7 @@ export type MergeOpts = {
|
|
|
643
998
|
/** Strategy to use */
|
|
644
999
|
strategy?: string;
|
|
645
1000
|
/** Strategy options */
|
|
646
|
-
strategyOption?: string |
|
|
1001
|
+
strategyOption?: string | string[];
|
|
647
1002
|
/** Abort merge */
|
|
648
1003
|
abort?: boolean;
|
|
649
1004
|
/** Continue merge */
|
|
@@ -686,16 +1041,16 @@ export type MergeOpts = {
|
|
|
686
1041
|
/**
|
|
687
1042
|
* Merge result
|
|
688
1043
|
*/
|
|
689
|
-
|
|
1044
|
+
type MergeResult = {
|
|
690
1045
|
success: boolean;
|
|
691
1046
|
hash?: string;
|
|
692
|
-
conflicts?:
|
|
1047
|
+
conflicts?: string[];
|
|
693
1048
|
fastForward?: boolean;
|
|
694
1049
|
};
|
|
695
1050
|
/**
|
|
696
1051
|
* Options for git pull
|
|
697
1052
|
*/
|
|
698
|
-
|
|
1053
|
+
type PullOpts = {
|
|
699
1054
|
/** Remote name */
|
|
700
1055
|
remote?: string;
|
|
701
1056
|
/** Branch to pull */
|
|
@@ -741,7 +1096,7 @@ export type PullOpts = {
|
|
|
741
1096
|
/** Merge strategy to use */
|
|
742
1097
|
strategy?: string;
|
|
743
1098
|
/** Strategy options */
|
|
744
|
-
strategyOption?: string |
|
|
1099
|
+
strategyOption?: string | string[];
|
|
745
1100
|
/** GPG-sign the merge commit (optionally with key id) */
|
|
746
1101
|
gpgSign?: boolean | string;
|
|
747
1102
|
/** Allow merging histories that do not share a common ancestor */
|
|
@@ -763,7 +1118,7 @@ export type PullOpts = {
|
|
|
763
1118
|
/** Deepen shallow clone since date */
|
|
764
1119
|
shallowSince?: string | Date;
|
|
765
1120
|
/** Deepen shallow clone excluding revision */
|
|
766
|
-
shallowExclude?: string |
|
|
1121
|
+
shallowExclude?: string | string[];
|
|
767
1122
|
/** Deepen shallow clone by specified commits */
|
|
768
1123
|
deepen?: number;
|
|
769
1124
|
/** Convert shallow repository to complete one */
|
|
@@ -780,7 +1135,7 @@ export type PullOpts = {
|
|
|
780
1135
|
/**
|
|
781
1136
|
* Options for git reset
|
|
782
1137
|
*/
|
|
783
|
-
|
|
1138
|
+
type ResetOpts = {
|
|
784
1139
|
/** Reset mode */
|
|
785
1140
|
mode?: 'soft' | 'mixed' | 'hard' | 'merge' | 'keep';
|
|
786
1141
|
/** Be quiet (report only errors) */
|
|
@@ -797,7 +1152,7 @@ export type ResetOpts = {
|
|
|
797
1152
|
/**
|
|
798
1153
|
* Options for git rm
|
|
799
1154
|
*/
|
|
800
|
-
|
|
1155
|
+
type RmOpts = {
|
|
801
1156
|
/** Force removal */
|
|
802
1157
|
force?: boolean;
|
|
803
1158
|
/** Remove from index only (keep in working tree) */
|
|
@@ -818,7 +1173,7 @@ export type RmOpts = {
|
|
|
818
1173
|
/**
|
|
819
1174
|
* Stash entry
|
|
820
1175
|
*/
|
|
821
|
-
|
|
1176
|
+
type StashEntry = {
|
|
822
1177
|
index: number;
|
|
823
1178
|
message: string;
|
|
824
1179
|
branch?: string;
|
|
@@ -827,7 +1182,7 @@ export type StashEntry = {
|
|
|
827
1182
|
/**
|
|
828
1183
|
* Options for git stash push
|
|
829
1184
|
*/
|
|
830
|
-
|
|
1185
|
+
type StashPushOpts = {
|
|
831
1186
|
/** Stash message */
|
|
832
1187
|
message?: string;
|
|
833
1188
|
/** Include untracked files */
|
|
@@ -835,7 +1190,7 @@ export type StashPushOpts = {
|
|
|
835
1190
|
/** Keep index */
|
|
836
1191
|
keepIndex?: boolean;
|
|
837
1192
|
/** Specific paths to stash */
|
|
838
|
-
paths?:
|
|
1193
|
+
paths?: string[];
|
|
839
1194
|
/** Stash only staged changes */
|
|
840
1195
|
staged?: boolean;
|
|
841
1196
|
/** Suppress output */
|
|
@@ -848,7 +1203,7 @@ export type StashPushOpts = {
|
|
|
848
1203
|
/**
|
|
849
1204
|
* Options for git stash pop/apply
|
|
850
1205
|
*/
|
|
851
|
-
|
|
1206
|
+
type StashApplyOpts = {
|
|
852
1207
|
/** Stash index to apply */
|
|
853
1208
|
index?: number;
|
|
854
1209
|
/** Try to reinstate index */
|
|
@@ -857,7 +1212,7 @@ export type StashApplyOpts = {
|
|
|
857
1212
|
/**
|
|
858
1213
|
* Options for git switch
|
|
859
1214
|
*/
|
|
860
|
-
|
|
1215
|
+
type SwitchOpts = {
|
|
861
1216
|
/** Create new branch */
|
|
862
1217
|
create?: boolean;
|
|
863
1218
|
/** Force create (overwrite existing) */
|
|
@@ -892,7 +1247,7 @@ export type SwitchOpts = {
|
|
|
892
1247
|
/**
|
|
893
1248
|
* Tag information
|
|
894
1249
|
*/
|
|
895
|
-
|
|
1250
|
+
type TagInfo = {
|
|
896
1251
|
name: string;
|
|
897
1252
|
commit: string;
|
|
898
1253
|
message?: string;
|
|
@@ -906,7 +1261,7 @@ export type TagInfo = {
|
|
|
906
1261
|
/**
|
|
907
1262
|
* Options for git tag (list)
|
|
908
1263
|
*/
|
|
909
|
-
|
|
1264
|
+
type TagListOpts = {
|
|
910
1265
|
/** List pattern */
|
|
911
1266
|
pattern?: string;
|
|
912
1267
|
/** Sort by */
|
|
@@ -929,7 +1284,7 @@ export type TagListOpts = {
|
|
|
929
1284
|
/**
|
|
930
1285
|
* Options for creating a tag
|
|
931
1286
|
*/
|
|
932
|
-
|
|
1287
|
+
type TagCreateOpts = {
|
|
933
1288
|
/** Tag message (creates annotated tag) */
|
|
934
1289
|
message?: string;
|
|
935
1290
|
/** Force (overwrite existing tag) */
|
|
@@ -941,7 +1296,7 @@ export type TagCreateOpts = {
|
|
|
941
1296
|
/** Read tag message from file */
|
|
942
1297
|
file?: string;
|
|
943
1298
|
/** Add trailers to the tag message */
|
|
944
|
-
trailer?: string |
|
|
1299
|
+
trailer?: string | string[];
|
|
945
1300
|
/** How to clean up the tag message */
|
|
946
1301
|
cleanup?: string;
|
|
947
1302
|
/** Key to use for GPG signing */
|
|
@@ -952,7 +1307,7 @@ export type TagCreateOpts = {
|
|
|
952
1307
|
/**
|
|
953
1308
|
* Options for git cherry-pick
|
|
954
1309
|
*/
|
|
955
|
-
|
|
1310
|
+
type CherryPickOpts = {
|
|
956
1311
|
/** Edit commit message */
|
|
957
1312
|
edit?: boolean;
|
|
958
1313
|
/** No commit after cherry-pick */
|
|
@@ -976,7 +1331,7 @@ export type CherryPickOpts = {
|
|
|
976
1331
|
/** Automatically update rerere state */
|
|
977
1332
|
rerereAutoupdate?: boolean;
|
|
978
1333
|
/** Strategy options */
|
|
979
|
-
strategyOption?: string |
|
|
1334
|
+
strategyOption?: string | string[];
|
|
980
1335
|
/** GPG-sign the commit (optionally with key id) */
|
|
981
1336
|
gpgSign?: boolean | string;
|
|
982
1337
|
/** Append (cherry picked from ...) line to original message */
|
|
@@ -993,7 +1348,7 @@ export type CherryPickOpts = {
|
|
|
993
1348
|
/**
|
|
994
1349
|
* Options for git clean
|
|
995
1350
|
*/
|
|
996
|
-
|
|
1351
|
+
type CleanOpts = {
|
|
997
1352
|
/** Force clean */
|
|
998
1353
|
force?: boolean;
|
|
999
1354
|
/** Remove directories too */
|
|
@@ -1005,16 +1360,16 @@ export type CleanOpts = {
|
|
|
1005
1360
|
/** Dry run */
|
|
1006
1361
|
dryRun?: boolean;
|
|
1007
1362
|
/** Paths to clean */
|
|
1008
|
-
paths?:
|
|
1363
|
+
paths?: string[];
|
|
1009
1364
|
/** Suppress output */
|
|
1010
1365
|
quiet?: boolean;
|
|
1011
1366
|
/** Exclude files matching pattern */
|
|
1012
|
-
exclude?: string |
|
|
1367
|
+
exclude?: string | string[];
|
|
1013
1368
|
};
|
|
1014
1369
|
/**
|
|
1015
1370
|
* Options for git mv
|
|
1016
1371
|
*/
|
|
1017
|
-
|
|
1372
|
+
type MvOpts = {
|
|
1018
1373
|
/** Force move */
|
|
1019
1374
|
force?: boolean;
|
|
1020
1375
|
/** Dry run */
|
|
@@ -1029,7 +1384,7 @@ export type MvOpts = {
|
|
|
1029
1384
|
/**
|
|
1030
1385
|
* Options for git rebase
|
|
1031
1386
|
*/
|
|
1032
|
-
|
|
1387
|
+
type RebaseOpts = {
|
|
1033
1388
|
/** Upstream branch */
|
|
1034
1389
|
upstream?: string;
|
|
1035
1390
|
/** Onto target */
|
|
@@ -1087,7 +1442,7 @@ export type RebaseOpts = {
|
|
|
1087
1442
|
/** Merge strategy */
|
|
1088
1443
|
strategy?: string;
|
|
1089
1444
|
/** Strategy options */
|
|
1090
|
-
strategyOption?: string |
|
|
1445
|
+
strategyOption?: string | string[];
|
|
1091
1446
|
/** Rebase from root commit */
|
|
1092
1447
|
root?: boolean;
|
|
1093
1448
|
/** Reschedule failed exec commands */
|
|
@@ -1098,7 +1453,7 @@ export type RebaseOpts = {
|
|
|
1098
1453
|
/**
|
|
1099
1454
|
* Options for git restore
|
|
1100
1455
|
*/
|
|
1101
|
-
|
|
1456
|
+
type RestoreOpts = {
|
|
1102
1457
|
/** Restore staged files */
|
|
1103
1458
|
staged?: boolean;
|
|
1104
1459
|
/** Restore working tree files */
|
|
@@ -1130,7 +1485,7 @@ export type RestoreOpts = {
|
|
|
1130
1485
|
/**
|
|
1131
1486
|
* Options for git revert
|
|
1132
1487
|
*/
|
|
1133
|
-
|
|
1488
|
+
type RevertOpts = {
|
|
1134
1489
|
/** Edit commit message */
|
|
1135
1490
|
edit?: boolean;
|
|
1136
1491
|
/** No commit after revert */
|
|
@@ -1154,7 +1509,7 @@ export type RevertOpts = {
|
|
|
1154
1509
|
/** Merge strategy */
|
|
1155
1510
|
strategy?: string;
|
|
1156
1511
|
/** Strategy options */
|
|
1157
|
-
strategyOption?: string |
|
|
1512
|
+
strategyOption?: string | string[];
|
|
1158
1513
|
/** GPG-sign the commit */
|
|
1159
1514
|
gpgSign?: boolean | string;
|
|
1160
1515
|
/** Add reference to reverted commit */
|
|
@@ -1163,7 +1518,7 @@ export type RevertOpts = {
|
|
|
1163
1518
|
/**
|
|
1164
1519
|
* Options for git show
|
|
1165
1520
|
*/
|
|
1166
|
-
|
|
1521
|
+
type ShowOpts = {
|
|
1167
1522
|
/** Show stat only */
|
|
1168
1523
|
stat?: boolean;
|
|
1169
1524
|
/** Show name only */
|
|
@@ -1185,10 +1540,124 @@ export type ShowOpts = {
|
|
|
1185
1540
|
/** Decorate style */
|
|
1186
1541
|
decorate?: 'short' | 'full' | 'auto' | 'no';
|
|
1187
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
|
+
};
|
|
1188
1657
|
/**
|
|
1189
1658
|
* Options for git submodule
|
|
1190
1659
|
*/
|
|
1191
|
-
|
|
1660
|
+
type SubmoduleOpts = {
|
|
1192
1661
|
/** Recursive operation */
|
|
1193
1662
|
recursive?: boolean;
|
|
1194
1663
|
/** Initialize submodules */
|
|
@@ -1217,7 +1686,7 @@ export type SubmoduleOpts = {
|
|
|
1217
1686
|
/**
|
|
1218
1687
|
* Options for adding a submodule
|
|
1219
1688
|
*/
|
|
1220
|
-
|
|
1689
|
+
type SubmoduleAddOpts = {
|
|
1221
1690
|
/** Branch to track */
|
|
1222
1691
|
branch?: string;
|
|
1223
1692
|
/** Force addition */
|
|
@@ -1232,7 +1701,7 @@ export type SubmoduleAddOpts = {
|
|
|
1232
1701
|
/**
|
|
1233
1702
|
* Options for deinitializing a submodule
|
|
1234
1703
|
*/
|
|
1235
|
-
|
|
1704
|
+
type SubmoduleDeinitOpts = {
|
|
1236
1705
|
/** Force deinitialization */
|
|
1237
1706
|
force?: boolean;
|
|
1238
1707
|
/** Deinitialize all submodules */
|
|
@@ -1241,14 +1710,14 @@ export type SubmoduleDeinitOpts = {
|
|
|
1241
1710
|
/**
|
|
1242
1711
|
* Options for submodule status
|
|
1243
1712
|
*/
|
|
1244
|
-
|
|
1713
|
+
type SubmoduleStatusOpts = {
|
|
1245
1714
|
/** Check submodules recursively */
|
|
1246
1715
|
recursive?: boolean;
|
|
1247
1716
|
};
|
|
1248
1717
|
/**
|
|
1249
1718
|
* Options for submodule summary
|
|
1250
1719
|
*/
|
|
1251
|
-
|
|
1720
|
+
type SubmoduleSummaryOpts = {
|
|
1252
1721
|
/** Limit to the specified number of commits */
|
|
1253
1722
|
limit?: number;
|
|
1254
1723
|
/** Show files in the summary */
|
|
@@ -1257,28 +1726,28 @@ export type SubmoduleSummaryOpts = {
|
|
|
1257
1726
|
/**
|
|
1258
1727
|
* Options for submodule foreach
|
|
1259
1728
|
*/
|
|
1260
|
-
|
|
1729
|
+
type SubmoduleForeachOpts = {
|
|
1261
1730
|
/** Run the command recursively in nested submodules */
|
|
1262
1731
|
recursive?: boolean;
|
|
1263
1732
|
};
|
|
1264
1733
|
/**
|
|
1265
1734
|
* Options for submodule sync
|
|
1266
1735
|
*/
|
|
1267
|
-
|
|
1736
|
+
type SubmoduleSyncOpts = {
|
|
1268
1737
|
/** Sync recursively in nested submodules */
|
|
1269
1738
|
recursive?: boolean;
|
|
1270
1739
|
};
|
|
1271
1740
|
/**
|
|
1272
1741
|
* Options for submodule set-branch
|
|
1273
1742
|
*/
|
|
1274
|
-
|
|
1743
|
+
type SubmoduleSetBranchOpts = {
|
|
1275
1744
|
/** Set the default tracking branch */
|
|
1276
1745
|
default?: boolean;
|
|
1277
1746
|
};
|
|
1278
1747
|
/**
|
|
1279
1748
|
* Submodule information
|
|
1280
1749
|
*/
|
|
1281
|
-
|
|
1750
|
+
type SubmoduleInfo = {
|
|
1282
1751
|
name: string;
|
|
1283
1752
|
path: string;
|
|
1284
1753
|
url: string;
|
|
@@ -1288,7 +1757,7 @@ export type SubmoduleInfo = {
|
|
|
1288
1757
|
/**
|
|
1289
1758
|
* LFS status information
|
|
1290
1759
|
*/
|
|
1291
|
-
|
|
1760
|
+
type LfsStatus = {
|
|
1292
1761
|
files: Array<{
|
|
1293
1762
|
name: string;
|
|
1294
1763
|
size: number;
|
|
@@ -1298,27 +1767,27 @@ export type LfsStatus = {
|
|
|
1298
1767
|
/**
|
|
1299
1768
|
* Options for LFS pull
|
|
1300
1769
|
*/
|
|
1301
|
-
|
|
1770
|
+
type LfsPullOpts = {
|
|
1302
1771
|
remote?: string;
|
|
1303
1772
|
ref?: string;
|
|
1304
|
-
include?:
|
|
1305
|
-
exclude?:
|
|
1773
|
+
include?: string[];
|
|
1774
|
+
exclude?: string[];
|
|
1306
1775
|
};
|
|
1307
1776
|
/**
|
|
1308
1777
|
* Options for LFS push
|
|
1309
1778
|
*/
|
|
1310
|
-
|
|
1779
|
+
type LfsPushOpts = {
|
|
1311
1780
|
remote?: string;
|
|
1312
1781
|
ref?: string;
|
|
1313
1782
|
/** Dry run - show what would be pushed without actually pushing */
|
|
1314
1783
|
dryRun?: boolean;
|
|
1315
|
-
/** Push specified object IDs */
|
|
1316
|
-
objectId?:
|
|
1784
|
+
/** Push specified object IDs (OID hashes) instead of all objects */
|
|
1785
|
+
objectId?: string | string[];
|
|
1317
1786
|
};
|
|
1318
1787
|
/**
|
|
1319
1788
|
* Options for LFS status
|
|
1320
1789
|
*/
|
|
1321
|
-
|
|
1790
|
+
type LfsStatusOpts = {
|
|
1322
1791
|
json?: boolean;
|
|
1323
1792
|
/** Machine-readable output */
|
|
1324
1793
|
porcelain?: boolean;
|
|
@@ -1326,7 +1795,7 @@ export type LfsStatusOpts = {
|
|
|
1326
1795
|
/**
|
|
1327
1796
|
* Options for LFS prune
|
|
1328
1797
|
*/
|
|
1329
|
-
|
|
1798
|
+
type LfsPruneOpts = {
|
|
1330
1799
|
/** Force prune (remove unreferenced objects immediately) */
|
|
1331
1800
|
force?: boolean;
|
|
1332
1801
|
/** Dry run - show what would be pruned without actually pruning */
|
|
@@ -1345,13 +1814,13 @@ export type LfsPruneOpts = {
|
|
|
1345
1814
|
/**
|
|
1346
1815
|
* Options for LFS fetch
|
|
1347
1816
|
*/
|
|
1348
|
-
|
|
1817
|
+
type LfsFetchOpts = {
|
|
1349
1818
|
/** Fetch all LFS objects for all refs */
|
|
1350
1819
|
all?: boolean;
|
|
1351
1820
|
/** Include patterns */
|
|
1352
|
-
include?: string |
|
|
1821
|
+
include?: string | string[];
|
|
1353
1822
|
/** Exclude patterns */
|
|
1354
|
-
exclude?: string |
|
|
1823
|
+
exclude?: string | string[];
|
|
1355
1824
|
/** Only fetch recent objects */
|
|
1356
1825
|
recent?: boolean;
|
|
1357
1826
|
/** Prune old objects after fetch */
|
|
@@ -1365,7 +1834,7 @@ export type LfsFetchOpts = {
|
|
|
1365
1834
|
/** Remote to fetch from */
|
|
1366
1835
|
remote?: string;
|
|
1367
1836
|
/** Refs to fetch */
|
|
1368
|
-
refs?: string |
|
|
1837
|
+
refs?: string | string[];
|
|
1369
1838
|
};
|
|
1370
1839
|
/**
|
|
1371
1840
|
* Options for repository-level LFS install
|
|
@@ -1379,7 +1848,7 @@ export type LfsFetchOpts = {
|
|
|
1379
1848
|
*
|
|
1380
1849
|
* For global (user-level) or system-wide installation, use `git.lfs.install()` instead.
|
|
1381
1850
|
*/
|
|
1382
|
-
|
|
1851
|
+
type RepoLfsInstallOpts = {
|
|
1383
1852
|
/** Overwrite existing hooks */
|
|
1384
1853
|
force?: boolean;
|
|
1385
1854
|
/**
|
|
@@ -1404,7 +1873,7 @@ export type RepoLfsInstallOpts = {
|
|
|
1404
1873
|
*
|
|
1405
1874
|
* For global or system-wide uninstallation, use `git.lfs.uninstall()` instead.
|
|
1406
1875
|
*/
|
|
1407
|
-
|
|
1876
|
+
type RepoLfsUninstallOpts = {
|
|
1408
1877
|
/**
|
|
1409
1878
|
* Uninstall for worktree only (instead of repository)
|
|
1410
1879
|
*
|
|
@@ -1417,7 +1886,7 @@ export type RepoLfsUninstallOpts = {
|
|
|
1417
1886
|
/**
|
|
1418
1887
|
* LFS file entry
|
|
1419
1888
|
*/
|
|
1420
|
-
|
|
1889
|
+
type LfsFileEntry = {
|
|
1421
1890
|
/** File path */
|
|
1422
1891
|
path: string;
|
|
1423
1892
|
/** Object ID (SHA-256) */
|
|
@@ -1430,7 +1899,7 @@ export type LfsFileEntry = {
|
|
|
1430
1899
|
/**
|
|
1431
1900
|
* Options for LFS ls-files
|
|
1432
1901
|
*/
|
|
1433
|
-
|
|
1902
|
+
type LfsLsFilesOpts = {
|
|
1434
1903
|
/** Show full OID (not abbreviated) */
|
|
1435
1904
|
long?: boolean;
|
|
1436
1905
|
/** Show file sizes */
|
|
@@ -1442,9 +1911,9 @@ export type LfsLsFilesOpts = {
|
|
|
1442
1911
|
/** Show deleted files */
|
|
1443
1912
|
deleted?: boolean;
|
|
1444
1913
|
/** Include patterns */
|
|
1445
|
-
include?: string |
|
|
1914
|
+
include?: string | string[];
|
|
1446
1915
|
/** Exclude patterns */
|
|
1447
|
-
exclude?: string |
|
|
1916
|
+
exclude?: string | string[];
|
|
1448
1917
|
/** Show filenames only */
|
|
1449
1918
|
nameOnly?: boolean;
|
|
1450
1919
|
/** Output in JSON format */
|
|
@@ -1455,7 +1924,7 @@ export type LfsLsFilesOpts = {
|
|
|
1455
1924
|
/**
|
|
1456
1925
|
* LFS track entry
|
|
1457
1926
|
*/
|
|
1458
|
-
|
|
1927
|
+
type LfsTrackEntry = {
|
|
1459
1928
|
/** Pattern being tracked */
|
|
1460
1929
|
pattern: string;
|
|
1461
1930
|
/** Source file (e.g., .gitattributes) */
|
|
@@ -1466,7 +1935,7 @@ export type LfsTrackEntry = {
|
|
|
1466
1935
|
/**
|
|
1467
1936
|
* Options for LFS track
|
|
1468
1937
|
*/
|
|
1469
|
-
|
|
1938
|
+
type LfsTrackOpts = {
|
|
1470
1939
|
/** Show verbose output */
|
|
1471
1940
|
verbose?: boolean;
|
|
1472
1941
|
/** Dry run - show what would be tracked */
|
|
@@ -1485,7 +1954,7 @@ export type LfsTrackOpts = {
|
|
|
1485
1954
|
/**
|
|
1486
1955
|
* LFS lock entry
|
|
1487
1956
|
*/
|
|
1488
|
-
|
|
1957
|
+
type LfsLockEntry = {
|
|
1489
1958
|
/** Lock ID */
|
|
1490
1959
|
id: string;
|
|
1491
1960
|
/** Locked file path */
|
|
@@ -1500,7 +1969,7 @@ export type LfsLockEntry = {
|
|
|
1500
1969
|
/**
|
|
1501
1970
|
* Options for LFS lock
|
|
1502
1971
|
*/
|
|
1503
|
-
|
|
1972
|
+
type LfsLockOpts = {
|
|
1504
1973
|
/** Remote name */
|
|
1505
1974
|
remote?: string;
|
|
1506
1975
|
/** Output in JSON format */
|
|
@@ -1509,7 +1978,7 @@ export type LfsLockOpts = {
|
|
|
1509
1978
|
/**
|
|
1510
1979
|
* Options for LFS unlock
|
|
1511
1980
|
*/
|
|
1512
|
-
|
|
1981
|
+
type LfsUnlockOpts = {
|
|
1513
1982
|
/** Remote name */
|
|
1514
1983
|
remote?: string;
|
|
1515
1984
|
/** Force unlock (even if owned by another user) */
|
|
@@ -1522,7 +1991,7 @@ export type LfsUnlockOpts = {
|
|
|
1522
1991
|
/**
|
|
1523
1992
|
* Options for LFS locks
|
|
1524
1993
|
*/
|
|
1525
|
-
|
|
1994
|
+
type LfsLocksOpts = {
|
|
1526
1995
|
/** Remote name */
|
|
1527
1996
|
remote?: string;
|
|
1528
1997
|
/** Filter by lock ID */
|
|
@@ -1543,7 +2012,7 @@ export type LfsLocksOpts = {
|
|
|
1543
2012
|
/**
|
|
1544
2013
|
* Options for LFS checkout
|
|
1545
2014
|
*/
|
|
1546
|
-
|
|
2015
|
+
type LfsCheckoutOpts = {
|
|
1547
2016
|
/** Use base version for conflicts */
|
|
1548
2017
|
base?: boolean;
|
|
1549
2018
|
/** Use ours version for conflicts */
|
|
@@ -1553,14 +2022,14 @@ export type LfsCheckoutOpts = {
|
|
|
1553
2022
|
/** Write to file instead of working tree */
|
|
1554
2023
|
to?: string;
|
|
1555
2024
|
/** Include patterns */
|
|
1556
|
-
include?: string |
|
|
2025
|
+
include?: string | string[];
|
|
1557
2026
|
/** Exclude patterns */
|
|
1558
|
-
exclude?: string |
|
|
2027
|
+
exclude?: string | string[];
|
|
1559
2028
|
};
|
|
1560
2029
|
/**
|
|
1561
2030
|
* Options for LFS migrate info
|
|
1562
2031
|
*/
|
|
1563
|
-
|
|
2032
|
+
type LfsMigrateInfoOpts = {
|
|
1564
2033
|
/** Only show files above this size */
|
|
1565
2034
|
above?: string | number;
|
|
1566
2035
|
/** Show top N files */
|
|
@@ -1572,13 +2041,13 @@ export type LfsMigrateInfoOpts = {
|
|
|
1572
2041
|
/** Fix up tracking patterns */
|
|
1573
2042
|
fixup?: boolean;
|
|
1574
2043
|
/** Include patterns */
|
|
1575
|
-
include?: string |
|
|
2044
|
+
include?: string | string[];
|
|
1576
2045
|
/** Exclude patterns */
|
|
1577
|
-
exclude?: string |
|
|
2046
|
+
exclude?: string | string[];
|
|
1578
2047
|
/** Include refs */
|
|
1579
|
-
includeRef?: string |
|
|
2048
|
+
includeRef?: string | string[];
|
|
1580
2049
|
/** Exclude refs */
|
|
1581
|
-
excludeRef?: string |
|
|
2050
|
+
excludeRef?: string | string[];
|
|
1582
2051
|
/** Skip fetching from remote */
|
|
1583
2052
|
skipFetch?: boolean;
|
|
1584
2053
|
/** Operate on all refs */
|
|
@@ -1589,7 +2058,7 @@ export type LfsMigrateInfoOpts = {
|
|
|
1589
2058
|
/**
|
|
1590
2059
|
* Options for LFS migrate import
|
|
1591
2060
|
*/
|
|
1592
|
-
|
|
2061
|
+
type LfsMigrateImportOpts = LfsMigrateInfoOpts & {
|
|
1593
2062
|
/** Show verbose output */
|
|
1594
2063
|
verbose?: boolean;
|
|
1595
2064
|
/** Write object map file */
|
|
@@ -1599,12 +2068,12 @@ export type LfsMigrateImportOpts = LfsMigrateInfoOpts & {
|
|
|
1599
2068
|
/** Commit message for fixup */
|
|
1600
2069
|
message?: string;
|
|
1601
2070
|
/** Object IDs to import */
|
|
1602
|
-
object?: string |
|
|
2071
|
+
object?: string | string[];
|
|
1603
2072
|
};
|
|
1604
2073
|
/**
|
|
1605
2074
|
* Options for LFS migrate export
|
|
1606
2075
|
*/
|
|
1607
|
-
|
|
2076
|
+
type LfsMigrateExportOpts = LfsMigrateInfoOpts & {
|
|
1608
2077
|
/** Show verbose output */
|
|
1609
2078
|
verbose?: boolean;
|
|
1610
2079
|
/** Write object map file */
|
|
@@ -1615,7 +2084,7 @@ export type LfsMigrateExportOpts = LfsMigrateInfoOpts & {
|
|
|
1615
2084
|
/**
|
|
1616
2085
|
* LFS environment info
|
|
1617
2086
|
*/
|
|
1618
|
-
|
|
2087
|
+
type LfsEnvInfo = {
|
|
1619
2088
|
/** LFS version */
|
|
1620
2089
|
lfsVersion: string;
|
|
1621
2090
|
/** Git version */
|
|
@@ -1669,9 +2138,9 @@ export type LfsEnvInfo = {
|
|
|
1669
2138
|
* Pre-upload allows pushing LFS objects before the refs push,
|
|
1670
2139
|
* enabling 2-phase commit patterns for improved reliability.
|
|
1671
2140
|
*/
|
|
1672
|
-
|
|
2141
|
+
type LfsPreUploadOpts = {
|
|
1673
2142
|
/** Object IDs to upload (if omitted, auto-detect pending objects) */
|
|
1674
|
-
oids?:
|
|
2143
|
+
oids?: string[];
|
|
1675
2144
|
/** Batch size for upload (default: 50, considers Windows 8KB limit) */
|
|
1676
2145
|
batchSize?: number;
|
|
1677
2146
|
/** Remote name (default: 'origin') */
|
|
@@ -1680,7 +2149,7 @@ export type LfsPreUploadOpts = {
|
|
|
1680
2149
|
/**
|
|
1681
2150
|
* Result from LFS pre-upload
|
|
1682
2151
|
*/
|
|
1683
|
-
|
|
2152
|
+
type LfsPreUploadResult = {
|
|
1684
2153
|
/** Number of objects uploaded */
|
|
1685
2154
|
uploadedCount: number;
|
|
1686
2155
|
/** Total bytes uploaded */
|
|
@@ -1694,9 +2163,9 @@ export type LfsPreUploadResult = {
|
|
|
1694
2163
|
* Pre-download allows fetching LFS objects before checkout,
|
|
1695
2164
|
* useful for controlled large file management.
|
|
1696
2165
|
*/
|
|
1697
|
-
|
|
2166
|
+
type LfsPreDownloadOpts = {
|
|
1698
2167
|
/** Object IDs to download (if omitted, auto-detect from ref) */
|
|
1699
|
-
oids?:
|
|
2168
|
+
oids?: string[];
|
|
1700
2169
|
/** Git ref to get LFS objects for (branch, tag, or commit) */
|
|
1701
2170
|
ref?: string;
|
|
1702
2171
|
/** Batch size for download (default: 50) */
|
|
@@ -1707,7 +2176,7 @@ export type LfsPreDownloadOpts = {
|
|
|
1707
2176
|
/**
|
|
1708
2177
|
* Result from LFS pre-download
|
|
1709
2178
|
*/
|
|
1710
|
-
|
|
2179
|
+
type LfsPreDownloadResult = {
|
|
1711
2180
|
/** Number of objects downloaded */
|
|
1712
2181
|
downloadedCount: number;
|
|
1713
2182
|
/** Total bytes downloaded */
|
|
@@ -1720,7 +2189,7 @@ export type LfsPreDownloadResult = {
|
|
|
1720
2189
|
*
|
|
1721
2190
|
* Parsed from `git worktree list --porcelain` output.
|
|
1722
2191
|
*/
|
|
1723
|
-
|
|
2192
|
+
type Worktree = {
|
|
1724
2193
|
/** Worktree path */
|
|
1725
2194
|
path: string;
|
|
1726
2195
|
/** HEAD commit hash */
|
|
@@ -1735,7 +2204,7 @@ export type Worktree = {
|
|
|
1735
2204
|
/**
|
|
1736
2205
|
* Options for adding a worktree
|
|
1737
2206
|
*/
|
|
1738
|
-
|
|
2207
|
+
type WorktreeAddOpts = {
|
|
1739
2208
|
/**
|
|
1740
2209
|
* Commit-ish to checkout (branch, tag, or commit hash)
|
|
1741
2210
|
*
|
|
@@ -1770,14 +2239,14 @@ export type WorktreeAddOpts = {
|
|
|
1770
2239
|
/**
|
|
1771
2240
|
* Options for removing a worktree
|
|
1772
2241
|
*/
|
|
1773
|
-
|
|
2242
|
+
type WorktreeRemoveOpts = {
|
|
1774
2243
|
/** Force removal even if dirty */
|
|
1775
2244
|
force?: boolean;
|
|
1776
2245
|
};
|
|
1777
2246
|
/**
|
|
1778
2247
|
* Options for pruning worktrees
|
|
1779
2248
|
*/
|
|
1780
|
-
|
|
2249
|
+
type WorktreePruneOpts = {
|
|
1781
2250
|
/** Show what would be pruned without actually pruning */
|
|
1782
2251
|
dryRun?: boolean;
|
|
1783
2252
|
/** Show more details */
|
|
@@ -1788,18 +2257,18 @@ export type WorktreePruneOpts = {
|
|
|
1788
2257
|
/**
|
|
1789
2258
|
* Options for worktree move
|
|
1790
2259
|
*/
|
|
1791
|
-
|
|
2260
|
+
type WorktreeMoveOpts = {
|
|
1792
2261
|
/** Force move even if destination exists */
|
|
1793
2262
|
force?: boolean;
|
|
1794
2263
|
};
|
|
1795
2264
|
/**
|
|
1796
2265
|
* Options for worktree repair
|
|
1797
2266
|
*/
|
|
1798
|
-
|
|
2267
|
+
type WorktreeRepairOpts = {};
|
|
1799
2268
|
/**
|
|
1800
2269
|
* Options for locking a worktree
|
|
1801
2270
|
*/
|
|
1802
|
-
|
|
2271
|
+
type WorktreeLockOpts = {
|
|
1803
2272
|
/** Reason for locking */
|
|
1804
2273
|
reason?: string;
|
|
1805
2274
|
};
|
|
@@ -1808,13 +2277,13 @@ export type WorktreeLockOpts = {
|
|
|
1808
2277
|
*
|
|
1809
2278
|
* Wraps: `git worktree` subcommands
|
|
1810
2279
|
*/
|
|
1811
|
-
|
|
2280
|
+
interface WorktreeOperations {
|
|
1812
2281
|
/**
|
|
1813
2282
|
* List all worktrees
|
|
1814
2283
|
*
|
|
1815
2284
|
* Wraps: `git worktree list --porcelain`
|
|
1816
2285
|
*/
|
|
1817
|
-
list(opts?: ExecOpts): Promise<
|
|
2286
|
+
list(opts?: ExecOpts): Promise<Worktree[]>;
|
|
1818
2287
|
/**
|
|
1819
2288
|
* Add a new worktree and return a repository object for it
|
|
1820
2289
|
*
|
|
@@ -1834,7 +2303,7 @@ export interface WorktreeOperations {
|
|
|
1834
2303
|
*
|
|
1835
2304
|
* Wraps: `git worktree prune`
|
|
1836
2305
|
*/
|
|
1837
|
-
prune(opts?: WorktreePruneOpts & ExecOpts): Promise<
|
|
2306
|
+
prune(opts?: WorktreePruneOpts & ExecOpts): Promise<string[]>;
|
|
1838
2307
|
/**
|
|
1839
2308
|
* Lock a worktree
|
|
1840
2309
|
*
|
|
@@ -1860,14 +2329,14 @@ export interface WorktreeOperations {
|
|
|
1860
2329
|
*
|
|
1861
2330
|
* Wraps: `git worktree repair`
|
|
1862
2331
|
*/
|
|
1863
|
-
repair(paths?:
|
|
2332
|
+
repair(paths?: string[], opts?: ExecOpts): Promise<void>;
|
|
1864
2333
|
}
|
|
1865
2334
|
/**
|
|
1866
2335
|
* LFS operations
|
|
1867
2336
|
*
|
|
1868
2337
|
* Wraps: `git lfs` subcommands
|
|
1869
2338
|
*/
|
|
1870
|
-
|
|
2339
|
+
interface LfsOperations {
|
|
1871
2340
|
/**
|
|
1872
2341
|
* Pull LFS objects
|
|
1873
2342
|
*
|
|
@@ -1943,25 +2412,25 @@ export interface LfsOperations {
|
|
|
1943
2412
|
*
|
|
1944
2413
|
* Wraps: `git lfs ls-files`
|
|
1945
2414
|
*/
|
|
1946
|
-
lsFiles(opts?: LfsLsFilesOpts & ExecOpts): Promise<
|
|
2415
|
+
lsFiles(opts?: LfsLsFilesOpts & ExecOpts): Promise<LfsFileEntry[]>;
|
|
1947
2416
|
/**
|
|
1948
2417
|
* Track files with LFS
|
|
1949
2418
|
*
|
|
1950
2419
|
* Wraps: `git lfs track <pattern>...`
|
|
1951
2420
|
*/
|
|
1952
|
-
track(patterns: string |
|
|
2421
|
+
track(patterns: string | string[], opts?: LfsTrackOpts & ExecOpts): Promise<void>;
|
|
1953
2422
|
/**
|
|
1954
2423
|
* List tracked patterns
|
|
1955
2424
|
*
|
|
1956
2425
|
* Wraps: `git lfs track` (without arguments)
|
|
1957
2426
|
*/
|
|
1958
|
-
trackList(opts?: ExecOpts): Promise<
|
|
2427
|
+
trackList(opts?: ExecOpts): Promise<LfsTrackEntry[]>;
|
|
1959
2428
|
/**
|
|
1960
2429
|
* Untrack files from LFS
|
|
1961
2430
|
*
|
|
1962
2431
|
* Wraps: `git lfs untrack <pattern>...`
|
|
1963
2432
|
*/
|
|
1964
|
-
untrack(patterns: string |
|
|
2433
|
+
untrack(patterns: string | string[], opts?: ExecOpts): Promise<void>;
|
|
1965
2434
|
/**
|
|
1966
2435
|
* Lock a file
|
|
1967
2436
|
*
|
|
@@ -1979,13 +2448,13 @@ export interface LfsOperations {
|
|
|
1979
2448
|
*
|
|
1980
2449
|
* Wraps: `git lfs locks`
|
|
1981
2450
|
*/
|
|
1982
|
-
locks(opts?: LfsLocksOpts & ExecOpts): Promise<
|
|
2451
|
+
locks(opts?: LfsLocksOpts & ExecOpts): Promise<LfsLockEntry[]>;
|
|
1983
2452
|
/**
|
|
1984
2453
|
* Checkout LFS files (replace pointer files with actual content)
|
|
1985
2454
|
*
|
|
1986
2455
|
* Wraps: `git lfs checkout`
|
|
1987
2456
|
*/
|
|
1988
|
-
checkout(patterns?: string |
|
|
2457
|
+
checkout(patterns?: string | string[], opts?: LfsCheckoutOpts & ExecOpts): Promise<void>;
|
|
1989
2458
|
/**
|
|
1990
2459
|
* Show information about LFS files that would be migrated
|
|
1991
2460
|
*
|
|
@@ -2023,7 +2492,7 @@ export interface LfsOperations {
|
|
|
2023
2492
|
* Additional LFS utilities not part of the core LFS commands.
|
|
2024
2493
|
* These enable advanced patterns like 2-phase commit/fetch.
|
|
2025
2494
|
*/
|
|
2026
|
-
|
|
2495
|
+
interface LfsExtraOperations {
|
|
2027
2496
|
/**
|
|
2028
2497
|
* Pre-upload LFS objects before refs push (§10.3)
|
|
2029
2498
|
*
|
|
@@ -2056,13 +2525,13 @@ export interface LfsExtraOperations {
|
|
|
2056
2525
|
*
|
|
2057
2526
|
* Wraps: `git branch` subcommands
|
|
2058
2527
|
*/
|
|
2059
|
-
|
|
2528
|
+
interface BranchOperations {
|
|
2060
2529
|
/**
|
|
2061
2530
|
* List branches
|
|
2062
2531
|
*
|
|
2063
2532
|
* Wraps: `git branch --list`
|
|
2064
2533
|
*/
|
|
2065
|
-
list(opts?: BranchOpts & ExecOpts): Promise<
|
|
2534
|
+
list(opts?: BranchOpts & ExecOpts): Promise<BranchInfo[]>;
|
|
2066
2535
|
/**
|
|
2067
2536
|
* Get current branch name
|
|
2068
2537
|
*
|
|
@@ -2093,13 +2562,13 @@ export interface BranchOperations {
|
|
|
2093
2562
|
*
|
|
2094
2563
|
* Wraps: `git stash` subcommands
|
|
2095
2564
|
*/
|
|
2096
|
-
|
|
2565
|
+
interface StashOperations {
|
|
2097
2566
|
/**
|
|
2098
2567
|
* List stash entries
|
|
2099
2568
|
*
|
|
2100
2569
|
* Wraps: `git stash list`
|
|
2101
2570
|
*/
|
|
2102
|
-
list(opts?: ExecOpts): Promise<
|
|
2571
|
+
list(opts?: ExecOpts): Promise<StashEntry[]>;
|
|
2103
2572
|
/**
|
|
2104
2573
|
* Push changes to stash
|
|
2105
2574
|
*
|
|
@@ -2136,13 +2605,13 @@ export interface StashOperations {
|
|
|
2136
2605
|
*
|
|
2137
2606
|
* Wraps: `git tag` subcommands
|
|
2138
2607
|
*/
|
|
2139
|
-
|
|
2608
|
+
interface TagOperations {
|
|
2140
2609
|
/**
|
|
2141
2610
|
* List tags
|
|
2142
2611
|
*
|
|
2143
2612
|
* Wraps: `git tag --list`
|
|
2144
2613
|
*/
|
|
2145
|
-
list(opts?: TagListOpts & ExecOpts): Promise<
|
|
2614
|
+
list(opts?: TagListOpts & ExecOpts): Promise<string[]>;
|
|
2146
2615
|
/**
|
|
2147
2616
|
* Create a tag
|
|
2148
2617
|
*
|
|
@@ -2165,7 +2634,7 @@ export interface TagOperations {
|
|
|
2165
2634
|
/**
|
|
2166
2635
|
* Remote information
|
|
2167
2636
|
*/
|
|
2168
|
-
|
|
2637
|
+
type RemoteInfo = {
|
|
2169
2638
|
/** Remote name */
|
|
2170
2639
|
name: string;
|
|
2171
2640
|
/** Fetch URL */
|
|
@@ -2176,7 +2645,7 @@ export type RemoteInfo = {
|
|
|
2176
2645
|
/**
|
|
2177
2646
|
* Options for adding a remote
|
|
2178
2647
|
*/
|
|
2179
|
-
|
|
2648
|
+
type RemoteAddOpts = {
|
|
2180
2649
|
/** Set up tracking for default branch */
|
|
2181
2650
|
track?: string;
|
|
2182
2651
|
/** Only fetch specified branches */
|
|
@@ -2189,7 +2658,7 @@ export type RemoteAddOpts = {
|
|
|
2189
2658
|
/**
|
|
2190
2659
|
* Options for remote set-head
|
|
2191
2660
|
*/
|
|
2192
|
-
|
|
2661
|
+
type RemoteSetHeadOpts = {
|
|
2193
2662
|
/** Automatically determine remote HEAD */
|
|
2194
2663
|
auto?: boolean;
|
|
2195
2664
|
/** Delete the symbolic-ref for remote HEAD */
|
|
@@ -2198,35 +2667,35 @@ export type RemoteSetHeadOpts = {
|
|
|
2198
2667
|
/**
|
|
2199
2668
|
* Options for remote show
|
|
2200
2669
|
*/
|
|
2201
|
-
|
|
2670
|
+
type RemoteShowOpts = {
|
|
2202
2671
|
/** Do not query remote heads */
|
|
2203
2672
|
noQuery?: boolean;
|
|
2204
2673
|
};
|
|
2205
2674
|
/**
|
|
2206
2675
|
* Options for remote prune
|
|
2207
2676
|
*/
|
|
2208
|
-
|
|
2677
|
+
type RemotePruneOpts = {
|
|
2209
2678
|
/** Dry run - show what would be pruned */
|
|
2210
2679
|
dryRun?: boolean;
|
|
2211
2680
|
};
|
|
2212
2681
|
/**
|
|
2213
2682
|
* Options for remote update
|
|
2214
2683
|
*/
|
|
2215
|
-
|
|
2684
|
+
type RemoteUpdateOpts = {
|
|
2216
2685
|
/** Prune remote-tracking branches */
|
|
2217
2686
|
prune?: boolean;
|
|
2218
2687
|
};
|
|
2219
2688
|
/**
|
|
2220
2689
|
* Options for remote set-branches
|
|
2221
2690
|
*/
|
|
2222
|
-
|
|
2691
|
+
type RemoteSetBranchesOpts = {
|
|
2223
2692
|
/** Add branches instead of replacing */
|
|
2224
2693
|
add?: boolean;
|
|
2225
2694
|
};
|
|
2226
2695
|
/**
|
|
2227
2696
|
* Options for getting/setting remote URL
|
|
2228
2697
|
*/
|
|
2229
|
-
|
|
2698
|
+
type RemoteUrlOpts = {
|
|
2230
2699
|
/** Target push URL instead of fetch URL */
|
|
2231
2700
|
push?: boolean;
|
|
2232
2701
|
};
|
|
@@ -2235,13 +2704,13 @@ export type RemoteUrlOpts = {
|
|
|
2235
2704
|
*
|
|
2236
2705
|
* Wraps: `git remote` subcommands
|
|
2237
2706
|
*/
|
|
2238
|
-
|
|
2707
|
+
interface RemoteOperations {
|
|
2239
2708
|
/**
|
|
2240
2709
|
* List remotes
|
|
2241
2710
|
*
|
|
2242
2711
|
* Wraps: `git remote -v`
|
|
2243
2712
|
*/
|
|
2244
|
-
list(opts?: ExecOpts): Promise<
|
|
2713
|
+
list(opts?: ExecOpts): Promise<RemoteInfo[]>;
|
|
2245
2714
|
/**
|
|
2246
2715
|
* Add a remote
|
|
2247
2716
|
*
|
|
@@ -2289,24 +2758,24 @@ export interface RemoteOperations {
|
|
|
2289
2758
|
*
|
|
2290
2759
|
* Wraps: `git remote prune <remote>`
|
|
2291
2760
|
*/
|
|
2292
|
-
prune(remote: string, opts?: RemotePruneOpts & ExecOpts): Promise<
|
|
2761
|
+
prune(remote: string, opts?: RemotePruneOpts & ExecOpts): Promise<string[]>;
|
|
2293
2762
|
/**
|
|
2294
2763
|
* Update remotes
|
|
2295
2764
|
*
|
|
2296
2765
|
* Wraps: `git remote update`
|
|
2297
2766
|
*/
|
|
2298
|
-
update(remotes?:
|
|
2767
|
+
update(remotes?: string[], opts?: RemoteUpdateOpts & ExecOpts): Promise<void>;
|
|
2299
2768
|
/**
|
|
2300
2769
|
* Set tracked branches for a remote
|
|
2301
2770
|
*
|
|
2302
2771
|
* Wraps: `git remote set-branches <remote> <branch>...`
|
|
2303
2772
|
*/
|
|
2304
|
-
setBranches(remote: string, branches:
|
|
2773
|
+
setBranches(remote: string, branches: string[], opts?: RemoteSetBranchesOpts & ExecOpts): Promise<void>;
|
|
2305
2774
|
}
|
|
2306
2775
|
/**
|
|
2307
2776
|
* Config entry
|
|
2308
2777
|
*/
|
|
2309
|
-
|
|
2778
|
+
type ConfigEntry = {
|
|
2310
2779
|
/** Config key (e.g., 'user.name') */
|
|
2311
2780
|
key: string;
|
|
2312
2781
|
/** Config value */
|
|
@@ -2315,7 +2784,7 @@ export type ConfigEntry = {
|
|
|
2315
2784
|
/**
|
|
2316
2785
|
* Options for config get
|
|
2317
2786
|
*/
|
|
2318
|
-
|
|
2787
|
+
type ConfigGetOpts = {
|
|
2319
2788
|
/** Get all values for multi-valued key */
|
|
2320
2789
|
all?: boolean;
|
|
2321
2790
|
/** Type to interpret the value as */
|
|
@@ -2326,14 +2795,14 @@ export type ConfigGetOpts = {
|
|
|
2326
2795
|
/**
|
|
2327
2796
|
* Options for config set
|
|
2328
2797
|
*/
|
|
2329
|
-
|
|
2798
|
+
type ConfigSetOpts = {
|
|
2330
2799
|
/** Add value to multi-valued key instead of replacing */
|
|
2331
2800
|
add?: boolean;
|
|
2332
2801
|
};
|
|
2333
2802
|
/**
|
|
2334
2803
|
* Options for config list
|
|
2335
2804
|
*/
|
|
2336
|
-
|
|
2805
|
+
type ConfigListOpts = {
|
|
2337
2806
|
/** Show origin of each value */
|
|
2338
2807
|
showOrigin?: boolean;
|
|
2339
2808
|
/** Show scope of each value */
|
|
@@ -2349,7 +2818,7 @@ export type ConfigListOpts = {
|
|
|
2349
2818
|
* This provides type safety for common config operations.
|
|
2350
2819
|
* For arbitrary keys, use getRaw/setRaw.
|
|
2351
2820
|
*/
|
|
2352
|
-
|
|
2821
|
+
type ConfigSchema = {
|
|
2353
2822
|
'user.name': string;
|
|
2354
2823
|
'user.email': string;
|
|
2355
2824
|
'user.signingkey': string;
|
|
@@ -2401,13 +2870,13 @@ export type ConfigSchema = {
|
|
|
2401
2870
|
/**
|
|
2402
2871
|
* Known config key names
|
|
2403
2872
|
*/
|
|
2404
|
-
|
|
2873
|
+
type ConfigKey = keyof ConfigSchema;
|
|
2405
2874
|
/**
|
|
2406
2875
|
* Config operations (repository-level)
|
|
2407
2876
|
*
|
|
2408
2877
|
* Wraps: `git config` subcommands
|
|
2409
2878
|
*/
|
|
2410
|
-
|
|
2879
|
+
interface ConfigOperations {
|
|
2411
2880
|
/**
|
|
2412
2881
|
* Get a typed config value
|
|
2413
2882
|
*
|
|
@@ -2421,7 +2890,7 @@ export interface ConfigOperations {
|
|
|
2421
2890
|
*
|
|
2422
2891
|
* Wraps: `git config --get-all <key>`
|
|
2423
2892
|
*/
|
|
2424
|
-
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<
|
|
2893
|
+
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K][]>;
|
|
2425
2894
|
/**
|
|
2426
2895
|
* Set a typed config value
|
|
2427
2896
|
*
|
|
@@ -2447,7 +2916,7 @@ export interface ConfigOperations {
|
|
|
2447
2916
|
*
|
|
2448
2917
|
* @returns Config value or undefined if not set
|
|
2449
2918
|
*/
|
|
2450
|
-
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string |
|
|
2919
|
+
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | string[] | undefined>;
|
|
2451
2920
|
/**
|
|
2452
2921
|
* Set a raw config value (for arbitrary keys)
|
|
2453
2922
|
*
|
|
@@ -2465,7 +2934,7 @@ export interface ConfigOperations {
|
|
|
2465
2934
|
*
|
|
2466
2935
|
* Wraps: `git config --list`
|
|
2467
2936
|
*/
|
|
2468
|
-
list(opts?: ConfigListOpts & ExecOpts): Promise<
|
|
2937
|
+
list(opts?: ConfigListOpts & ExecOpts): Promise<ConfigEntry[]>;
|
|
2469
2938
|
/**
|
|
2470
2939
|
* Rename a config section
|
|
2471
2940
|
*
|
|
@@ -2484,19 +2953,19 @@ export interface ConfigOperations {
|
|
|
2484
2953
|
*
|
|
2485
2954
|
* Wraps: `git submodule` subcommands
|
|
2486
2955
|
*/
|
|
2487
|
-
|
|
2956
|
+
interface SubmoduleOperations {
|
|
2488
2957
|
/**
|
|
2489
2958
|
* List submodules
|
|
2490
2959
|
*
|
|
2491
2960
|
* Wraps: `git submodule status`
|
|
2492
2961
|
*/
|
|
2493
|
-
list(opts?: ExecOpts): Promise<
|
|
2962
|
+
list(opts?: ExecOpts): Promise<SubmoduleInfo[]>;
|
|
2494
2963
|
/**
|
|
2495
2964
|
* Initialize submodules
|
|
2496
2965
|
*
|
|
2497
2966
|
* Wraps: `git submodule init`
|
|
2498
2967
|
*/
|
|
2499
|
-
init(paths?:
|
|
2968
|
+
init(paths?: string[], opts?: ExecOpts): Promise<void>;
|
|
2500
2969
|
/**
|
|
2501
2970
|
* Update submodules
|
|
2502
2971
|
*
|
|
@@ -2520,7 +2989,7 @@ export interface SubmoduleOperations {
|
|
|
2520
2989
|
*
|
|
2521
2990
|
* Wraps: `git submodule status`
|
|
2522
2991
|
*/
|
|
2523
|
-
status(paths?:
|
|
2992
|
+
status(paths?: string[], opts?: SubmoduleStatusOpts & ExecOpts): Promise<string>;
|
|
2524
2993
|
/**
|
|
2525
2994
|
* Get submodule summary
|
|
2526
2995
|
*
|
|
@@ -2538,7 +3007,7 @@ export interface SubmoduleOperations {
|
|
|
2538
3007
|
*
|
|
2539
3008
|
* Wraps: `git submodule sync`
|
|
2540
3009
|
*/
|
|
2541
|
-
sync(paths?:
|
|
3010
|
+
sync(paths?: string[], opts?: SubmoduleSyncOpts & ExecOpts): Promise<void>;
|
|
2542
3011
|
/**
|
|
2543
3012
|
* Absorb git directories of submodules into the superproject
|
|
2544
3013
|
*
|
|
@@ -2565,7 +3034,7 @@ export interface SubmoduleOperations {
|
|
|
2565
3034
|
* with a working tree. Each method corresponds to a specific Git CLI command
|
|
2566
3035
|
* or subcommand.
|
|
2567
3036
|
*/
|
|
2568
|
-
|
|
3037
|
+
interface WorktreeRepo extends RepoBase {
|
|
2569
3038
|
/** Path to the working directory */
|
|
2570
3039
|
readonly workdir: string;
|
|
2571
3040
|
/**
|
|
@@ -2591,7 +3060,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2591
3060
|
* const commits = await repo.log({ maxCount: 10 });
|
|
2592
3061
|
* ```
|
|
2593
3062
|
*/
|
|
2594
|
-
log(opts?: LogOpts & ExecOpts): Promise<
|
|
3063
|
+
log(opts?: LogOpts & ExecOpts): Promise<Commit[]>;
|
|
2595
3064
|
/**
|
|
2596
3065
|
* Fetch from remote
|
|
2597
3066
|
*
|
|
@@ -2647,7 +3116,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2647
3116
|
* await repo.add('.', { all: true });
|
|
2648
3117
|
* ```
|
|
2649
3118
|
*/
|
|
2650
|
-
add(paths: string |
|
|
3119
|
+
add(paths: string | string[], opts?: AddOpts & ExecOpts): Promise<void>;
|
|
2651
3120
|
/**
|
|
2652
3121
|
* Git branch operations
|
|
2653
3122
|
*
|
|
@@ -2687,7 +3156,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2687
3156
|
* await repo.checkout(['conflicted.txt'], { ours: true });
|
|
2688
3157
|
* ```
|
|
2689
3158
|
*/
|
|
2690
|
-
checkout(paths:
|
|
3159
|
+
checkout(paths: string[], opts?: CheckoutPathOpts & ExecOpts): Promise<void>;
|
|
2691
3160
|
/**
|
|
2692
3161
|
* Create a commit
|
|
2693
3162
|
*
|
|
@@ -2757,7 +3226,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2757
3226
|
* await repo.rm('dir/', { recursive: true });
|
|
2758
3227
|
* ```
|
|
2759
3228
|
*/
|
|
2760
|
-
rm(paths: string |
|
|
3229
|
+
rm(paths: string | string[], opts?: RmOpts & ExecOpts): Promise<void>;
|
|
2761
3230
|
/**
|
|
2762
3231
|
* Git stash operations
|
|
2763
3232
|
*
|
|
@@ -2793,7 +3262,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2793
3262
|
* await repo.cherryPick(['abc123', 'def456']);
|
|
2794
3263
|
* ```
|
|
2795
3264
|
*/
|
|
2796
|
-
cherryPick(commits: string |
|
|
3265
|
+
cherryPick(commits: string | string[], opts?: CherryPickOpts & ExecOpts): Promise<void>;
|
|
2797
3266
|
/**
|
|
2798
3267
|
* Remove untracked files from the working tree
|
|
2799
3268
|
*
|
|
@@ -2804,7 +3273,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2804
3273
|
* const removed = await repo.clean({ force: true, directories: true });
|
|
2805
3274
|
* ```
|
|
2806
3275
|
*/
|
|
2807
|
-
clean(opts?: CleanOpts & ExecOpts): Promise<
|
|
3276
|
+
clean(opts?: CleanOpts & ExecOpts): Promise<string[]>;
|
|
2808
3277
|
/**
|
|
2809
3278
|
* Move or rename files
|
|
2810
3279
|
*
|
|
@@ -2839,7 +3308,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2839
3308
|
* await repo.restore(['.'], { source: 'HEAD' });
|
|
2840
3309
|
* ```
|
|
2841
3310
|
*/
|
|
2842
|
-
restore(paths: string |
|
|
3311
|
+
restore(paths: string | string[], opts?: RestoreOpts & ExecOpts): Promise<void>;
|
|
2843
3312
|
/**
|
|
2844
3313
|
* Revert existing commits
|
|
2845
3314
|
*
|
|
@@ -2851,7 +3320,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2851
3320
|
* await repo.revert(['abc123', 'def456'], { noCommit: true });
|
|
2852
3321
|
* ```
|
|
2853
3322
|
*/
|
|
2854
|
-
revert(commits: string |
|
|
3323
|
+
revert(commits: string | string[], opts?: RevertOpts & ExecOpts): Promise<void>;
|
|
2855
3324
|
/**
|
|
2856
3325
|
* Show various types of objects
|
|
2857
3326
|
*
|
|
@@ -2865,20 +3334,52 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2865
3334
|
*/
|
|
2866
3335
|
show(object: string, opts?: ShowOpts & ExecOpts): Promise<string>;
|
|
2867
3336
|
/**
|
|
2868
|
-
* Parse revision specification and return
|
|
3337
|
+
* Parse revision specification and return information about the repository
|
|
2869
3338
|
*
|
|
2870
3339
|
* Wraps: `git rev-parse`
|
|
2871
3340
|
*
|
|
2872
|
-
*
|
|
3341
|
+
* This is a versatile command with multiple use cases based on the options provided:
|
|
2873
3342
|
*
|
|
2874
|
-
*
|
|
3343
|
+
* **Resolve ref to SHA:**
|
|
2875
3344
|
* ```typescript
|
|
2876
3345
|
* const sha = await repo.revParse('HEAD');
|
|
2877
3346
|
* const parentSha = await repo.revParse('HEAD~1');
|
|
2878
|
-
* const
|
|
3347
|
+
* const short = await repo.revParse('HEAD', { short: true });
|
|
3348
|
+
* const branch = await repo.revParse('HEAD', { abbrevRef: true });
|
|
3349
|
+
* ```
|
|
3350
|
+
*
|
|
3351
|
+
* **Query paths:**
|
|
3352
|
+
* ```typescript
|
|
3353
|
+
* const gitDir = await repo.revParse({ gitDir: true });
|
|
3354
|
+
* const toplevel = await repo.revParse({ showToplevel: true });
|
|
3355
|
+
* ```
|
|
3356
|
+
*
|
|
3357
|
+
* **Query repository state:**
|
|
3358
|
+
* ```typescript
|
|
3359
|
+
* const isShallow = await repo.revParse({ isShallowRepository: true });
|
|
3360
|
+
* const isBare = await repo.revParse({ isBareRepository: true });
|
|
3361
|
+
* ```
|
|
3362
|
+
*
|
|
3363
|
+
* **List refs:**
|
|
3364
|
+
* ```typescript
|
|
3365
|
+
* const allRefs = await repo.revParse({ all: true });
|
|
3366
|
+
* const branches = await repo.revParse({ branches: true });
|
|
3367
|
+
* const featureBranches = await repo.revParse({ branches: 'feature/*' });
|
|
2879
3368
|
* ```
|
|
2880
3369
|
*/
|
|
2881
|
-
revParse(ref: string, opts?: ExecOpts): Promise<string>;
|
|
3370
|
+
revParse(ref: string, opts?: RevParseRefOpts & ExecOpts): Promise<string>;
|
|
3371
|
+
revParse(opts: RevParsePathQuery & RevParsePathOpts & ExecOpts): Promise<string>;
|
|
3372
|
+
revParse(opts: RevParseBooleanQuery & ExecOpts): Promise<boolean>;
|
|
3373
|
+
revParse(opts: RevParseListQuery & ExecOpts): Promise<string[]>;
|
|
3374
|
+
revParse(opts: {
|
|
3375
|
+
showObjectFormat: true | 'storage' | 'input' | 'output';
|
|
3376
|
+
} & ExecOpts): Promise<string>;
|
|
3377
|
+
revParse(opts: {
|
|
3378
|
+
showRefFormat: true;
|
|
3379
|
+
} & ExecOpts): Promise<string>;
|
|
3380
|
+
revParse(opts: {
|
|
3381
|
+
localEnvVars: true;
|
|
3382
|
+
} & ExecOpts): Promise<string[]>;
|
|
2882
3383
|
/**
|
|
2883
3384
|
* Count the number of commits reachable from a ref
|
|
2884
3385
|
*
|
|
@@ -2934,7 +3435,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2934
3435
|
* A bare repository contains only the Git data without a working tree.
|
|
2935
3436
|
* Typically used for shared/server repositories.
|
|
2936
3437
|
*/
|
|
2937
|
-
|
|
3438
|
+
interface BareRepo extends RepoBase {
|
|
2938
3439
|
/** Path to the git directory */
|
|
2939
3440
|
readonly gitDir: string;
|
|
2940
3441
|
/**
|
|
@@ -2961,5 +3462,772 @@ export interface BareRepo extends RepoBase {
|
|
|
2961
3462
|
* Wraps: `git config` subcommands
|
|
2962
3463
|
*/
|
|
2963
3464
|
config: ConfigOperations;
|
|
3465
|
+
/**
|
|
3466
|
+
* Parse revision specification and return information about the repository
|
|
3467
|
+
*
|
|
3468
|
+
* Wraps: `git rev-parse`
|
|
3469
|
+
*
|
|
3470
|
+
* @example
|
|
3471
|
+
* ```typescript
|
|
3472
|
+
* const sha = await repo.revParse('HEAD');
|
|
3473
|
+
* const gitDir = await repo.revParse({ gitDir: true });
|
|
3474
|
+
* const isShallow = await repo.revParse({ isShallowRepository: true });
|
|
3475
|
+
* ```
|
|
3476
|
+
*/
|
|
3477
|
+
revParse(ref: string, opts?: RevParseRefOpts & ExecOpts): Promise<string>;
|
|
3478
|
+
revParse(opts: RevParsePathQuery & RevParsePathOpts & ExecOpts): Promise<string>;
|
|
3479
|
+
revParse(opts: RevParseBooleanQuery & ExecOpts): Promise<boolean>;
|
|
3480
|
+
revParse(opts: RevParseListQuery & ExecOpts): Promise<string[]>;
|
|
3481
|
+
revParse(opts: {
|
|
3482
|
+
showObjectFormat: true | 'storage' | 'input' | 'output';
|
|
3483
|
+
} & ExecOpts): Promise<string>;
|
|
3484
|
+
revParse(opts: {
|
|
3485
|
+
showRefFormat: true;
|
|
3486
|
+
} & ExecOpts): Promise<string>;
|
|
3487
|
+
revParse(opts: {
|
|
3488
|
+
localEnvVars: true;
|
|
3489
|
+
} & ExecOpts): Promise<string[]>;
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
/**
|
|
3493
|
+
* Core Git interface - repository-agnostic operations
|
|
3494
|
+
*/
|
|
3495
|
+
|
|
3496
|
+
/**
|
|
3497
|
+
* Options for git clone
|
|
3498
|
+
*/
|
|
3499
|
+
type CloneOpts = {
|
|
3500
|
+
bare?: boolean;
|
|
3501
|
+
depth?: number;
|
|
3502
|
+
branch?: string;
|
|
3503
|
+
singleBranch?: boolean;
|
|
3504
|
+
mirror?: boolean;
|
|
3505
|
+
noCheckout?: boolean;
|
|
3506
|
+
recurseSubmodules?: boolean;
|
|
3507
|
+
/** Store .git directory at specified path instead of inside the repository */
|
|
3508
|
+
separateGitDir?: string;
|
|
3509
|
+
/**
|
|
3510
|
+
* Whether to clean up the target directory if the operation is aborted.
|
|
3511
|
+
* @default true
|
|
3512
|
+
*/
|
|
3513
|
+
cleanupOnAbort?: boolean;
|
|
3514
|
+
/** Be more verbose */
|
|
3515
|
+
verbose?: boolean;
|
|
3516
|
+
/** Operate quietly (suppress progress reporting) */
|
|
3517
|
+
quiet?: boolean;
|
|
3518
|
+
/** Reject cloning a shallow repository */
|
|
3519
|
+
rejectShallow?: boolean;
|
|
3520
|
+
/** Clone from a local repository (use hard links) */
|
|
3521
|
+
local?: boolean;
|
|
3522
|
+
/** Don't use hard links for local clone */
|
|
3523
|
+
noHardlinks?: boolean;
|
|
3524
|
+
/** Share objects with a reference repository */
|
|
3525
|
+
shared?: boolean;
|
|
3526
|
+
/** Number of submodules to clone in parallel */
|
|
3527
|
+
jobs?: number;
|
|
3528
|
+
/** Directory with templates for the new repository */
|
|
3529
|
+
template?: string;
|
|
3530
|
+
/** Reference repository for object sharing */
|
|
3531
|
+
reference?: string;
|
|
3532
|
+
/** Reference repository if available (no error if not) */
|
|
3533
|
+
referenceIfAble?: string;
|
|
3534
|
+
/** Disconnect from reference repository after clone */
|
|
3535
|
+
dissociate?: boolean;
|
|
3536
|
+
/** Name of the remote (default: origin) */
|
|
3537
|
+
origin?: string;
|
|
3538
|
+
/** Create a shallow clone with commits since the specified date */
|
|
3539
|
+
shallowSince?: string | Date;
|
|
3540
|
+
/** Create a shallow clone excluding commits reachable from specified revision */
|
|
3541
|
+
shallowExclude?: string | string[];
|
|
3542
|
+
/** Don't clone any tags, and make later fetches not follow them */
|
|
3543
|
+
noTags?: boolean;
|
|
3544
|
+
/** Also clone submodules shallowly */
|
|
3545
|
+
shallowSubmodules?: boolean;
|
|
3546
|
+
/** Set config options for the new repository */
|
|
3547
|
+
config?: Record<string, string>;
|
|
3548
|
+
/** Use IPv4 addresses only */
|
|
3549
|
+
ipv4?: boolean;
|
|
3550
|
+
/** Use IPv6 addresses only */
|
|
3551
|
+
ipv6?: boolean;
|
|
3552
|
+
/** A partial clone filter specification (e.g., 'blob:none') */
|
|
3553
|
+
filter?: string;
|
|
3554
|
+
/** Also apply the partial clone filter to submodules */
|
|
3555
|
+
alsoFilterSubmodules?: boolean;
|
|
3556
|
+
/** Clone submodules from their remote tracking branch */
|
|
3557
|
+
remoteSubmodules?: boolean;
|
|
3558
|
+
/** Initialize sparse-checkout (clone only root files initially) */
|
|
3559
|
+
sparse?: boolean;
|
|
3560
|
+
};
|
|
3561
|
+
/**
|
|
3562
|
+
* Options for git init
|
|
3563
|
+
*/
|
|
3564
|
+
type InitOpts = {
|
|
3565
|
+
bare?: boolean;
|
|
3566
|
+
initialBranch?: string;
|
|
3567
|
+
/** Store .git directory at specified path instead of inside the repository */
|
|
3568
|
+
separateGitDir?: string;
|
|
3569
|
+
/**
|
|
3570
|
+
* Whether to clean up the target directory if the operation is aborted.
|
|
3571
|
+
* @default true
|
|
3572
|
+
*/
|
|
3573
|
+
cleanupOnAbort?: boolean;
|
|
3574
|
+
/** Directory with templates for the new repository */
|
|
3575
|
+
template?: string;
|
|
3576
|
+
/**
|
|
3577
|
+
* Set repository sharing level
|
|
3578
|
+
* - 'group': Group writable
|
|
3579
|
+
* - 'all'/'world'/'everybody': World readable
|
|
3580
|
+
* - number: Octal permissions
|
|
3581
|
+
*/
|
|
3582
|
+
shared?: boolean | 'group' | 'all' | 'world' | 'everybody' | number;
|
|
3583
|
+
/** Operate quietly (suppress output) */
|
|
3584
|
+
quiet?: boolean;
|
|
3585
|
+
/** Specify the hash algorithm to use (sha1 or sha256) */
|
|
3586
|
+
objectFormat?: 'sha1' | 'sha256';
|
|
3587
|
+
};
|
|
3588
|
+
/**
|
|
3589
|
+
* Options for git ls-remote
|
|
3590
|
+
*/
|
|
3591
|
+
type LsRemoteOpts = {
|
|
3592
|
+
/** Limit to refs/heads (branches) */
|
|
3593
|
+
heads?: boolean;
|
|
3594
|
+
/** Limit to refs/tags */
|
|
3595
|
+
tags?: boolean;
|
|
3596
|
+
/** Show only actual refs (not peeled tags) */
|
|
3597
|
+
refs?: boolean;
|
|
3598
|
+
/** Show remote URL instead of listing refs */
|
|
3599
|
+
getUrl?: boolean;
|
|
3600
|
+
/** Sort refs by the given key (e.g., 'version:refname') */
|
|
3601
|
+
sort?: string;
|
|
3602
|
+
/** Show symbolic refs in addition to object refs */
|
|
3603
|
+
symref?: boolean;
|
|
3604
|
+
};
|
|
3605
|
+
/**
|
|
3606
|
+
* Result from git ls-remote
|
|
3607
|
+
*/
|
|
3608
|
+
type LsRemoteResult = {
|
|
3609
|
+
refs: Array<{
|
|
3610
|
+
hash: string;
|
|
3611
|
+
name: string;
|
|
3612
|
+
}>;
|
|
3613
|
+
};
|
|
3614
|
+
/**
|
|
3615
|
+
* Options for global LFS install
|
|
3616
|
+
*
|
|
3617
|
+
* Used with `git.lfs.install()` for user-level (~/.gitconfig) or
|
|
3618
|
+
* system-level (/etc/gitconfig) LFS configuration.
|
|
3619
|
+
*
|
|
3620
|
+
* @remarks
|
|
3621
|
+
* Internally runs `git lfs install` without `--local` flag.
|
|
3622
|
+
* For repository-level installation, use `repo.lfs.install()` instead.
|
|
3623
|
+
*/
|
|
3624
|
+
type GlobalLfsInstallOpts = {
|
|
3625
|
+
/** Overwrite existing hooks */
|
|
3626
|
+
force?: boolean;
|
|
3627
|
+
/**
|
|
3628
|
+
* Install for all users (system-wide)
|
|
3629
|
+
*
|
|
3630
|
+
* @remarks
|
|
3631
|
+
* Internally adds `--system` flag to install to /etc/gitconfig
|
|
3632
|
+
* instead of ~/.gitconfig. Requires appropriate permissions.
|
|
3633
|
+
*/
|
|
3634
|
+
system?: boolean;
|
|
3635
|
+
/** Skip smudge filter (don't download during checkout) */
|
|
3636
|
+
skipSmudge?: boolean;
|
|
3637
|
+
/** Skip repository setup (only install filters) */
|
|
3638
|
+
skipRepo?: boolean;
|
|
3639
|
+
/** Print commands instead of executing */
|
|
3640
|
+
manual?: boolean;
|
|
3641
|
+
};
|
|
3642
|
+
/**
|
|
3643
|
+
* Options for global LFS uninstall
|
|
3644
|
+
*
|
|
3645
|
+
* Used with `git.lfs.uninstall()` for user-level or system-level
|
|
3646
|
+
* LFS configuration removal.
|
|
3647
|
+
*
|
|
3648
|
+
* @remarks
|
|
3649
|
+
* Internally runs `git lfs uninstall` without `--local` flag.
|
|
3650
|
+
* For repository-level uninstallation, use `repo.lfs.uninstall()` instead.
|
|
3651
|
+
*/
|
|
3652
|
+
type GlobalLfsUninstallOpts = {
|
|
3653
|
+
/**
|
|
3654
|
+
* Uninstall for all users (system-wide)
|
|
3655
|
+
*
|
|
3656
|
+
* @remarks
|
|
3657
|
+
* Internally adds `--system` flag to modify /etc/gitconfig
|
|
3658
|
+
* instead of ~/.gitconfig. Requires appropriate permissions.
|
|
3659
|
+
*/
|
|
3660
|
+
system?: boolean;
|
|
3661
|
+
/** Skip repository cleanup */
|
|
3662
|
+
skipRepo?: boolean;
|
|
3663
|
+
};
|
|
3664
|
+
/**
|
|
3665
|
+
* Global LFS operations
|
|
3666
|
+
*
|
|
3667
|
+
* Wraps: `git lfs` subcommands for user-level configuration
|
|
3668
|
+
*
|
|
3669
|
+
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3670
|
+
* For repository-level LFS operations, use repo.lfs instead.
|
|
3671
|
+
*/
|
|
3672
|
+
interface GlobalLfsOperations {
|
|
3673
|
+
/**
|
|
3674
|
+
* Install Git LFS hooks globally
|
|
3675
|
+
*
|
|
3676
|
+
* Wraps: `git lfs install`
|
|
3677
|
+
*
|
|
3678
|
+
* Sets up the clean and smudge filters under the name "lfs" in the
|
|
3679
|
+
* global Git config (~/.gitconfig) or system config (/etc/gitconfig).
|
|
3680
|
+
*
|
|
3681
|
+
* @example
|
|
3682
|
+
* ```typescript
|
|
3683
|
+
* // Install globally (to ~/.gitconfig)
|
|
3684
|
+
* await git.lfs.install();
|
|
3685
|
+
*
|
|
3686
|
+
* // Install system-wide (to /etc/gitconfig)
|
|
3687
|
+
* await git.lfs.install({ system: true });
|
|
3688
|
+
*
|
|
3689
|
+
* // Install with skip-smudge (manual LFS pull required)
|
|
3690
|
+
* await git.lfs.install({ skipSmudge: true });
|
|
3691
|
+
* ```
|
|
3692
|
+
*/
|
|
3693
|
+
install(opts?: GlobalLfsInstallOpts & ExecOpts): Promise<void>;
|
|
3694
|
+
/**
|
|
3695
|
+
* Uninstall Git LFS hooks globally
|
|
3696
|
+
*
|
|
3697
|
+
* Wraps: `git lfs uninstall`
|
|
3698
|
+
*
|
|
3699
|
+
* Removes the clean and smudge filters from global or system config.
|
|
3700
|
+
*
|
|
3701
|
+
* @example
|
|
3702
|
+
* ```typescript
|
|
3703
|
+
* // Uninstall from global config
|
|
3704
|
+
* await git.lfs.uninstall();
|
|
3705
|
+
*
|
|
3706
|
+
* // Uninstall from system config
|
|
3707
|
+
* await git.lfs.uninstall({ system: true });
|
|
3708
|
+
* ```
|
|
3709
|
+
*/
|
|
3710
|
+
uninstall(opts?: GlobalLfsUninstallOpts & ExecOpts): Promise<void>;
|
|
3711
|
+
/**
|
|
3712
|
+
* Get Git LFS version
|
|
3713
|
+
*
|
|
3714
|
+
* Wraps: `git lfs version`
|
|
3715
|
+
*
|
|
3716
|
+
* @returns LFS version string (e.g., "git-lfs/3.4.0")
|
|
3717
|
+
*/
|
|
3718
|
+
version(opts?: ExecOpts): Promise<string>;
|
|
3719
|
+
}
|
|
3720
|
+
/**
|
|
3721
|
+
* Options for global config list
|
|
3722
|
+
*/
|
|
3723
|
+
type GlobalConfigListOpts = {
|
|
3724
|
+
/** Show origin of each value */
|
|
3725
|
+
showOrigin?: boolean;
|
|
3726
|
+
/** Show scope of each value */
|
|
3727
|
+
showScope?: boolean;
|
|
3728
|
+
};
|
|
3729
|
+
/**
|
|
3730
|
+
* Global config operations
|
|
3731
|
+
*
|
|
3732
|
+
* Wraps: `git config --global` subcommands
|
|
3733
|
+
*
|
|
3734
|
+
* Operates on ~/.gitconfig (user-level configuration).
|
|
3735
|
+
* Uses the same typed ConfigSchema as repository-level config.
|
|
3736
|
+
*/
|
|
3737
|
+
interface GlobalConfigOperations {
|
|
3738
|
+
/**
|
|
3739
|
+
* Get a typed global config value
|
|
3740
|
+
*
|
|
3741
|
+
* Wraps: `git config --global --get <key>`
|
|
3742
|
+
*
|
|
3743
|
+
* @returns Config value or undefined if not set
|
|
3744
|
+
*/
|
|
3745
|
+
get<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K] | undefined>;
|
|
3746
|
+
/**
|
|
3747
|
+
* Get all values for a typed multi-valued global config key
|
|
3748
|
+
*
|
|
3749
|
+
* Wraps: `git config --global --get-all <key>`
|
|
3750
|
+
*/
|
|
3751
|
+
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K][]>;
|
|
3752
|
+
/**
|
|
3753
|
+
* Set a typed global config value
|
|
3754
|
+
*
|
|
3755
|
+
* Wraps: `git config --global <key> <value>`
|
|
3756
|
+
*/
|
|
3757
|
+
set<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
3758
|
+
/**
|
|
3759
|
+
* Add a value to a typed multi-valued global config key
|
|
3760
|
+
*
|
|
3761
|
+
* Wraps: `git config --global --add <key> <value>`
|
|
3762
|
+
*/
|
|
3763
|
+
add<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
3764
|
+
/**
|
|
3765
|
+
* Unset a typed global config value
|
|
3766
|
+
*
|
|
3767
|
+
* Wraps: `git config --global --unset <key>`
|
|
3768
|
+
*/
|
|
3769
|
+
unset<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<void>;
|
|
3770
|
+
/**
|
|
3771
|
+
* Get a raw global config value (for arbitrary keys)
|
|
3772
|
+
*
|
|
3773
|
+
* Wraps: `git config --global --get <key>`
|
|
3774
|
+
*
|
|
3775
|
+
* @returns Config value or undefined if not set
|
|
3776
|
+
*/
|
|
3777
|
+
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | string[] | undefined>;
|
|
3778
|
+
/**
|
|
3779
|
+
* Set a raw global config value (for arbitrary keys)
|
|
3780
|
+
*
|
|
3781
|
+
* Wraps: `git config --global <key> <value>`
|
|
3782
|
+
*/
|
|
3783
|
+
setRaw(key: string, value: string, opts?: ConfigSetOpts & ExecOpts): Promise<void>;
|
|
3784
|
+
/**
|
|
3785
|
+
* Unset a raw global config value (for arbitrary keys)
|
|
3786
|
+
*
|
|
3787
|
+
* Wraps: `git config --global --unset <key>`
|
|
3788
|
+
*/
|
|
3789
|
+
unsetRaw(key: string, opts?: ExecOpts): Promise<void>;
|
|
3790
|
+
/**
|
|
3791
|
+
* List all global config values
|
|
3792
|
+
*
|
|
3793
|
+
* Wraps: `git config --global --list`
|
|
3794
|
+
*/
|
|
3795
|
+
list(opts?: GlobalConfigListOpts & ExecOpts): Promise<ConfigEntry[]>;
|
|
3796
|
+
}
|
|
3797
|
+
/**
|
|
3798
|
+
* Main Git interface for repository-agnostic operations
|
|
3799
|
+
*
|
|
3800
|
+
* Provides type-safe wrappers for Git commands that don't require a repository context.
|
|
3801
|
+
* Each method corresponds to a specific Git CLI command.
|
|
3802
|
+
*/
|
|
3803
|
+
interface Git {
|
|
3804
|
+
/**
|
|
3805
|
+
* Open an existing worktree repository
|
|
3806
|
+
*
|
|
3807
|
+
* This is the most common use case. Throws GitError if the repository is bare.
|
|
3808
|
+
*
|
|
3809
|
+
* @param path - Path to the repository working directory
|
|
3810
|
+
* @param opts - Environment isolation and credential options
|
|
3811
|
+
* @returns WorktreeRepo
|
|
3812
|
+
* @throws GitError with kind 'NotWorktreeRepo' if the repository is bare
|
|
3813
|
+
*/
|
|
3814
|
+
open(path: string, opts?: GitOpenOptions): Promise<WorktreeRepo>;
|
|
3815
|
+
/**
|
|
3816
|
+
* Open an existing bare repository
|
|
3817
|
+
*
|
|
3818
|
+
* Throws GitError if the repository is not bare.
|
|
3819
|
+
*
|
|
3820
|
+
* @param path - Path to the bare repository (git-dir)
|
|
3821
|
+
* @param opts - Environment isolation and credential options
|
|
3822
|
+
* @returns BareRepo
|
|
3823
|
+
* @throws GitError with kind 'NotBareRepo' if the repository is not bare
|
|
3824
|
+
*/
|
|
3825
|
+
openBare(path: string, opts?: GitOpenOptions): Promise<BareRepo>;
|
|
3826
|
+
/**
|
|
3827
|
+
* Open an existing repository without type guarantee
|
|
3828
|
+
*
|
|
3829
|
+
* Returns either WorktreeRepo or BareRepo depending on the repository type.
|
|
3830
|
+
* Use this when you don't know the repository type at compile time.
|
|
3831
|
+
* You can use `isWorktree()` or `isBare()` methods for runtime type checking.
|
|
3832
|
+
*
|
|
3833
|
+
* @param path - Path to the repository (workdir or git-dir)
|
|
3834
|
+
* @param opts - Environment isolation and credential options
|
|
3835
|
+
* @returns WorktreeRepo or BareRepo depending on repository type
|
|
3836
|
+
*
|
|
3837
|
+
* @example
|
|
3838
|
+
* ```typescript
|
|
3839
|
+
* const repo = await git.openRaw('/path/to/repo');
|
|
3840
|
+
* if (await repo.isWorktree()) {
|
|
3841
|
+
* // repo is WorktreeRepo at runtime
|
|
3842
|
+
* const status = await (repo as WorktreeRepo).status();
|
|
3843
|
+
* } else if (await repo.isBare()) {
|
|
3844
|
+
* // repo is BareRepo at runtime
|
|
3845
|
+
* await (repo as BareRepo).fetch({ remote: 'origin' });
|
|
3846
|
+
* }
|
|
3847
|
+
* ```
|
|
3848
|
+
*/
|
|
3849
|
+
openRaw(path: string, opts?: GitOpenOptions): Promise<WorktreeRepo | BareRepo>;
|
|
3850
|
+
/**
|
|
3851
|
+
* Clone a repository
|
|
3852
|
+
*
|
|
3853
|
+
* Wraps: `git clone <url> <path>`
|
|
3854
|
+
*
|
|
3855
|
+
* The return type depends on the `bare` or `mirror` option:
|
|
3856
|
+
* - `{ bare: true }` or `{ mirror: true }` → `BareRepo`
|
|
3857
|
+
* - Otherwise → `WorktreeRepo`
|
|
3858
|
+
*/
|
|
3859
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
3860
|
+
bare: true;
|
|
3861
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3862
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
3863
|
+
mirror: true;
|
|
3864
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3865
|
+
clone(url: string, path: string, opts?: CloneOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3866
|
+
/**
|
|
3867
|
+
* Initialize a new repository
|
|
3868
|
+
*
|
|
3869
|
+
* Wraps: `git init <path>`
|
|
3870
|
+
*
|
|
3871
|
+
* The return type depends on the `bare` option:
|
|
3872
|
+
* - `{ bare: true }` → `BareRepo`
|
|
3873
|
+
* - Otherwise → `WorktreeRepo`
|
|
3874
|
+
*/
|
|
3875
|
+
init(path: string, opts: InitOpts & {
|
|
3876
|
+
bare: true;
|
|
3877
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3878
|
+
init(path: string, opts?: InitOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3879
|
+
/**
|
|
3880
|
+
* List references in a remote repository
|
|
3881
|
+
*
|
|
3882
|
+
* Wraps: `git ls-remote <url>`
|
|
3883
|
+
*/
|
|
3884
|
+
lsRemote(url: string, opts?: LsRemoteOpts & ExecOpts): Promise<LsRemoteResult>;
|
|
3885
|
+
/**
|
|
3886
|
+
* Get git version
|
|
3887
|
+
*
|
|
3888
|
+
* Wraps: `git --version`
|
|
3889
|
+
*/
|
|
3890
|
+
version(opts?: ExecOpts): Promise<string>;
|
|
3891
|
+
/**
|
|
3892
|
+
* Execute a raw git command (repository-agnostic)
|
|
3893
|
+
*
|
|
3894
|
+
* Wraps: `git <argv...>`
|
|
3895
|
+
*/
|
|
3896
|
+
raw(argv: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
3897
|
+
/**
|
|
3898
|
+
* Global config operations
|
|
3899
|
+
*
|
|
3900
|
+
* Wraps: `git config --global` subcommands
|
|
3901
|
+
*
|
|
3902
|
+
* Operates on ~/.gitconfig (user-level configuration).
|
|
3903
|
+
* For repository-level config, use repo.config instead.
|
|
3904
|
+
*/
|
|
3905
|
+
config: GlobalConfigOperations;
|
|
3906
|
+
/**
|
|
3907
|
+
* Global LFS operations
|
|
3908
|
+
*
|
|
3909
|
+
* Wraps: `git lfs` subcommands for user-level configuration
|
|
3910
|
+
*
|
|
3911
|
+
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3912
|
+
* For repository-level LFS operations, use repo.lfs instead.
|
|
3913
|
+
*/
|
|
3914
|
+
lfs: GlobalLfsOperations;
|
|
3915
|
+
}
|
|
3916
|
+
|
|
3917
|
+
/**
|
|
3918
|
+
* CLI Runner - Core execution engine for Git commands
|
|
3919
|
+
*
|
|
3920
|
+
* This module provides:
|
|
3921
|
+
* - CliRunner: Executes Git commands with progress tracking and abort support
|
|
3922
|
+
* - Progress collection from stderr (Git and LFS)
|
|
3923
|
+
* - Error mapping from Git exit codes
|
|
3924
|
+
*/
|
|
3925
|
+
|
|
3926
|
+
/**
|
|
3927
|
+
* Credential helper configuration
|
|
3928
|
+
*/
|
|
3929
|
+
type CredentialHelperConfig = {
|
|
3930
|
+
/** Helper name (e.g., 'store', 'cache', 'manager-core', or custom name) */
|
|
3931
|
+
helper?: string;
|
|
3932
|
+
/** Path to custom helper binary */
|
|
3933
|
+
helperPath?: string;
|
|
3934
|
+
};
|
|
3935
|
+
/**
|
|
3936
|
+
* Options for CliRunner
|
|
3937
|
+
*/
|
|
3938
|
+
type CliRunnerOptions = {
|
|
3939
|
+
/** Git binary path (default: 'git') */
|
|
3940
|
+
gitBinary?: string;
|
|
3941
|
+
/** Additional environment variables */
|
|
3942
|
+
env?: Record<string, string>;
|
|
3943
|
+
/** Directories to prepend to PATH */
|
|
3944
|
+
pathPrefix?: string[];
|
|
3945
|
+
/** Custom HOME directory for git config isolation */
|
|
3946
|
+
home?: string;
|
|
3947
|
+
/** Credential helper configuration */
|
|
3948
|
+
credential?: CredentialHelperConfig;
|
|
3949
|
+
};
|
|
3950
|
+
/**
|
|
3951
|
+
* CLI Runner for executing Git commands
|
|
3952
|
+
*
|
|
3953
|
+
* Handles:
|
|
3954
|
+
* - Command construction based on execution context
|
|
3955
|
+
* - Progress tracking from stderr (Git and LFS)
|
|
3956
|
+
* - Abort signal handling
|
|
3957
|
+
* - Error mapping
|
|
3958
|
+
*/
|
|
3959
|
+
declare class CliRunner {
|
|
3960
|
+
private readonly exec;
|
|
3961
|
+
private readonly gitBinary;
|
|
3962
|
+
private readonly baseEnv;
|
|
3963
|
+
private readonly pathPrefix;
|
|
3964
|
+
private readonly home;
|
|
3965
|
+
private readonly credential;
|
|
3966
|
+
constructor(adapters: RuntimeAdapters, options?: CliRunnerOptions);
|
|
3967
|
+
/**
|
|
3968
|
+
* Create a new CliRunner with additional options merged
|
|
3969
|
+
*
|
|
3970
|
+
* Used to create a runner for a specific repository with custom environment
|
|
3971
|
+
*/
|
|
3972
|
+
withOptions(options: CliRunnerOptions): CliRunner;
|
|
3973
|
+
/**
|
|
3974
|
+
* Build command argv based on execution context
|
|
3975
|
+
*/
|
|
3976
|
+
private buildArgv;
|
|
3977
|
+
/**
|
|
3978
|
+
* Build the effective environment for command execution
|
|
3979
|
+
*
|
|
3980
|
+
* Applies home directory and PATH prefix overrides
|
|
3981
|
+
*/
|
|
3982
|
+
private buildEnv;
|
|
3983
|
+
/**
|
|
3984
|
+
* Extract directory from a file path
|
|
3985
|
+
*/
|
|
3986
|
+
private extractDirectory;
|
|
3987
|
+
/**
|
|
3988
|
+
* Run a Git command
|
|
3989
|
+
*/
|
|
3990
|
+
run(context: ExecutionContext, args: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
3991
|
+
/**
|
|
3992
|
+
* Map Git result to GitError if needed
|
|
3993
|
+
*/
|
|
3994
|
+
mapError(result: RawResult, context: ExecutionContext, argv: string[]): GitError | null;
|
|
3995
|
+
/**
|
|
3996
|
+
* Classify error type based on stderr content
|
|
3997
|
+
*/
|
|
3998
|
+
private classifyError;
|
|
3999
|
+
/**
|
|
4000
|
+
* Extract user-friendly error message from stderr
|
|
4001
|
+
*/
|
|
4002
|
+
private extractErrorMessage;
|
|
4003
|
+
/**
|
|
4004
|
+
* Run a command and throw on error
|
|
4005
|
+
*/
|
|
4006
|
+
runOrThrow(context: ExecutionContext, args: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
/**
|
|
4010
|
+
* Git implementation - repository-agnostic operations
|
|
4011
|
+
*/
|
|
4012
|
+
|
|
4013
|
+
/**
|
|
4014
|
+
* Default minimum supported Git version.
|
|
4015
|
+
*
|
|
4016
|
+
* This is the minimum version required when `useLegacyVersion` is false (the default).
|
|
4017
|
+
* Use `useLegacyVersion: true` to allow older Git versions (2.25.0+).
|
|
4018
|
+
*/
|
|
4019
|
+
declare const MIN_GIT_VERSION = "2.30.0";
|
|
4020
|
+
/**
|
|
4021
|
+
* Legacy minimum Git version
|
|
4022
|
+
*
|
|
4023
|
+
* When `useLegacyVersion: true` is set, this version is used as the minimum.
|
|
4024
|
+
* Git 2.25.0 is the default version on Ubuntu 20.04 LTS.
|
|
4025
|
+
*/
|
|
4026
|
+
declare const LEGACY_GIT_VERSION = "2.25.0";
|
|
4027
|
+
/**
|
|
4028
|
+
* Options for creating a Git instance
|
|
4029
|
+
*/
|
|
4030
|
+
type CreateGitOptions = CliRunnerOptions & {
|
|
4031
|
+
/** Runtime adapters (exec, fs) */
|
|
4032
|
+
adapters: RuntimeAdapters;
|
|
4033
|
+
/**
|
|
4034
|
+
* Controls whether to perform a Git version check during initialization.
|
|
4035
|
+
* When true, skips the Git version check. When false (default), throws
|
|
4036
|
+
* GitError if Git version is below the minimum required version.
|
|
4037
|
+
* @default false
|
|
4038
|
+
*/
|
|
4039
|
+
skipVersionCheck?: boolean;
|
|
4040
|
+
/**
|
|
4041
|
+
* Allow legacy Git versions (2.25.0+) instead of requiring 2.30.0+.
|
|
4042
|
+
*
|
|
4043
|
+
* Use this for environments with older Git installations such as
|
|
4044
|
+
* Ubuntu 20.04 LTS which ships with Git 2.25.1 by default.
|
|
4045
|
+
*
|
|
4046
|
+
* @default false
|
|
4047
|
+
*/
|
|
4048
|
+
useLegacyVersion?: boolean;
|
|
4049
|
+
};
|
|
4050
|
+
/**
|
|
4051
|
+
* Create a new Git instance (synchronous, no version check)
|
|
4052
|
+
*
|
|
4053
|
+
* @param options - Creation options including runtime adapters
|
|
4054
|
+
* @returns Git instance
|
|
4055
|
+
* @deprecated Use createGit instead for version checking
|
|
4056
|
+
*/
|
|
4057
|
+
declare function createGitSync(options: CreateGitOptions): Git;
|
|
4058
|
+
/**
|
|
4059
|
+
* Create a new Git instance with optional version check
|
|
4060
|
+
*
|
|
4061
|
+
* @param options - Creation options including runtime adapters
|
|
4062
|
+
* @returns Git instance
|
|
4063
|
+
* @throws GitError with kind 'UnsupportedGitVersion' if Git version is below minimum
|
|
4064
|
+
*/
|
|
4065
|
+
declare function createGit(options: CreateGitOptions): Promise<Git>;
|
|
4066
|
+
|
|
4067
|
+
/**
|
|
4068
|
+
* Node.js ExecAdapter implementation
|
|
4069
|
+
*/
|
|
4070
|
+
|
|
4071
|
+
declare class NodeExecAdapter implements ExecAdapter {
|
|
4072
|
+
getCapabilities(): Capabilities;
|
|
4073
|
+
spawn(options: SpawnOptions, handlers?: StreamHandler): Promise<SpawnResult>;
|
|
4074
|
+
spawnStreaming(options: SpawnOptions): SpawnHandle;
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
/**
|
|
4078
|
+
* Node.js FsAdapter implementation
|
|
4079
|
+
*/
|
|
4080
|
+
|
|
4081
|
+
declare class NodeFsAdapter implements FsAdapter {
|
|
4082
|
+
createTempFile(prefix?: string): Promise<string>;
|
|
4083
|
+
tail(options: TailOptions): Promise<void>;
|
|
4084
|
+
deleteFile(filePath: string): Promise<void>;
|
|
4085
|
+
deleteDirectory(dirPath: string): Promise<void>;
|
|
4086
|
+
exists(filePath: string): Promise<boolean>;
|
|
4087
|
+
readFile(filePath: string): Promise<string>;
|
|
4088
|
+
writeFile(filePath: string, contents: string): Promise<void>;
|
|
4089
|
+
tailStreaming(filePath: string, options?: {
|
|
4090
|
+
signal?: AbortSignal;
|
|
4091
|
+
pollInterval?: number;
|
|
4092
|
+
}): TailHandle;
|
|
4093
|
+
}
|
|
4094
|
+
|
|
4095
|
+
/**
|
|
4096
|
+
* Node.js adapter exports
|
|
4097
|
+
*/
|
|
4098
|
+
|
|
4099
|
+
/**
|
|
4100
|
+
* Create Node.js runtime adapters
|
|
4101
|
+
*/
|
|
4102
|
+
declare function createNodeAdapters(): RuntimeAdapters;
|
|
4103
|
+
/**
|
|
4104
|
+
* Options for creating a TypeGit instance (Node.js)
|
|
4105
|
+
* Excludes adapters as they are automatically configured
|
|
4106
|
+
*/
|
|
4107
|
+
type TypeGitOptions = Omit<CreateGitOptions, 'adapters'>;
|
|
4108
|
+
/**
|
|
4109
|
+
* Pre-configured Git client for Node.js
|
|
4110
|
+
*
|
|
4111
|
+
* This is a convenience class that automatically configures Node.js adapters.
|
|
4112
|
+
*
|
|
4113
|
+
* @example
|
|
4114
|
+
* ```typescript
|
|
4115
|
+
* import { TypeGit } from 'type-git/node';
|
|
4116
|
+
*
|
|
4117
|
+
* // Recommended: Use create() for version check
|
|
4118
|
+
* const git = await TypeGit.create();
|
|
4119
|
+
*
|
|
4120
|
+
* // Skip version check (not recommended)
|
|
4121
|
+
* const git = await TypeGit.create({ skipVersionCheck: true });
|
|
4122
|
+
*
|
|
4123
|
+
* // Legacy: constructor (no version check, deprecated)
|
|
4124
|
+
* const git = new TypeGit();
|
|
4125
|
+
*
|
|
4126
|
+
* const repo = await git.open('/path/to/repo');
|
|
4127
|
+
* ```
|
|
4128
|
+
*/
|
|
4129
|
+
declare class TypeGit {
|
|
4130
|
+
private readonly git;
|
|
4131
|
+
/**
|
|
4132
|
+
* Create a TypeGit instance with Git version check
|
|
4133
|
+
*
|
|
4134
|
+
* @param createOpts - Options including skipVersionCheck
|
|
4135
|
+
* @returns TypeGit instance
|
|
4136
|
+
* @throws GitError with kind 'UnsupportedGitVersion' if Git version is below minimum
|
|
4137
|
+
*/
|
|
4138
|
+
static create(createOpts?: TypeGitOptions): Promise<TypeGit>;
|
|
4139
|
+
/**
|
|
4140
|
+
* @deprecated Use TypeGit.create() instead for version checking
|
|
4141
|
+
*/
|
|
4142
|
+
constructor(constructorOpts?: TypeGitOptions);
|
|
4143
|
+
/** @internal */
|
|
4144
|
+
constructor(existingGit: Git);
|
|
4145
|
+
/**
|
|
4146
|
+
* Open an existing worktree repository
|
|
4147
|
+
*
|
|
4148
|
+
* This is the most common use case. Throws GitError if the repository is bare.
|
|
4149
|
+
*
|
|
4150
|
+
* @throws GitError with kind 'NotWorktreeRepo' if the repository is bare
|
|
4151
|
+
*/
|
|
4152
|
+
get open(): (path: string, opts?: GitOpenOptions) => Promise<WorktreeRepo>;
|
|
4153
|
+
/**
|
|
4154
|
+
* Open an existing bare repository
|
|
4155
|
+
*
|
|
4156
|
+
* Throws GitError if the repository is not bare.
|
|
4157
|
+
*
|
|
4158
|
+
* @throws GitError with kind 'NotBareRepo' if the repository is not bare
|
|
4159
|
+
*/
|
|
4160
|
+
get openBare(): (path: string, opts?: GitOpenOptions) => Promise<BareRepo>;
|
|
4161
|
+
/**
|
|
4162
|
+
* Open an existing repository without type guarantee
|
|
4163
|
+
*
|
|
4164
|
+
* Returns either WorktreeRepo or BareRepo depending on the repository type.
|
|
4165
|
+
* Use this when you don't know the repository type at compile time.
|
|
4166
|
+
*/
|
|
4167
|
+
get openRaw(): (path: string, opts?: GitOpenOptions) => Promise<WorktreeRepo | BareRepo>;
|
|
4168
|
+
/**
|
|
4169
|
+
* Clone a repository
|
|
4170
|
+
*
|
|
4171
|
+
* The return type depends on the `bare` or `mirror` option:
|
|
4172
|
+
* - `{ bare: true }` or `{ mirror: true }` → `BareRepo`
|
|
4173
|
+
* - Otherwise → `WorktreeRepo`
|
|
4174
|
+
*/
|
|
4175
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
4176
|
+
bare: true;
|
|
4177
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
4178
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
4179
|
+
mirror: true;
|
|
4180
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
4181
|
+
clone(url: string, path: string, opts?: CloneOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
4182
|
+
/**
|
|
4183
|
+
* Initialize a new repository
|
|
4184
|
+
*
|
|
4185
|
+
* The return type depends on the `bare` option:
|
|
4186
|
+
* - `{ bare: true }` → `BareRepo`
|
|
4187
|
+
* - Otherwise → `WorktreeRepo`
|
|
4188
|
+
*/
|
|
4189
|
+
init(path: string, opts: InitOpts & {
|
|
4190
|
+
bare: true;
|
|
4191
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
4192
|
+
init(path: string, opts?: InitOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
4193
|
+
/**
|
|
4194
|
+
* List references in a remote repository
|
|
4195
|
+
*/
|
|
4196
|
+
get lsRemote(): (url: string, opts?: LsRemoteOpts & ExecOpts) => Promise<LsRemoteResult>;
|
|
4197
|
+
/**
|
|
4198
|
+
* Get git version
|
|
4199
|
+
*/
|
|
4200
|
+
get version(): (opts?: ExecOpts) => Promise<string>;
|
|
4201
|
+
/**
|
|
4202
|
+
* Execute a raw git command (repository-agnostic)
|
|
4203
|
+
*/
|
|
4204
|
+
get raw(): (argv: string[], opts?: ExecOpts) => Promise<RawResult>;
|
|
4205
|
+
/**
|
|
4206
|
+
* Global config operations
|
|
4207
|
+
*
|
|
4208
|
+
* Operates on ~/.gitconfig (user-level configuration).
|
|
4209
|
+
* For repository-level config, use repo.config instead.
|
|
4210
|
+
*/
|
|
4211
|
+
get config(): GlobalConfigOperations;
|
|
4212
|
+
/**
|
|
4213
|
+
* Global LFS operations
|
|
4214
|
+
*
|
|
4215
|
+
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
4216
|
+
* For repository-level LFS operations, use repo.lfs instead.
|
|
4217
|
+
*
|
|
4218
|
+
* @example
|
|
4219
|
+
* ```typescript
|
|
4220
|
+
* // Install LFS globally
|
|
4221
|
+
* await git.lfs.install();
|
|
4222
|
+
*
|
|
4223
|
+
* // Install system-wide
|
|
4224
|
+
* await git.lfs.install({ system: true });
|
|
4225
|
+
*
|
|
4226
|
+
* // Get LFS version
|
|
4227
|
+
* const version = await git.lfs.version();
|
|
4228
|
+
* ```
|
|
4229
|
+
*/
|
|
4230
|
+
get lfs(): GlobalLfsOperations;
|
|
2964
4231
|
}
|
|
2965
|
-
|
|
4232
|
+
|
|
4233
|
+
export { type BranchOpts as $, type GlobalLfsInstallOpts as A, type GlobalLfsUninstallOpts as B, type CreateGitOptions as C, type GlobalLfsOperations as D, type GlobalConfigListOpts as E, type GlobalConfigOperations as F, GIT_LOG_FORMAT as G, type Git as H, type InitOpts as I, type RepoLsRemoteOpts as J, type RepoLsRemoteResult as K, LEGACY_GIT_VERSION as L, MIN_GIT_VERSION as M, type LsTreeEntry as N, NodeExecAdapter, NodeFsAdapter, type LsTreeOpts as O, type ParsedCommit as P, type StatusPorcelain as Q, type RepoBase as R, type StatusEntry as S, type StatusOpts as T, TypeGit, type TypeGitOptions, type Commit as U, type LogOpts as V, type FetchOpts as W, type ForceWithLeaseOpts as X, type PushOpts as Y, type AddOpts as Z, type BranchInfo as _, createGitSync as a, type LfsMigrateInfoOpts as a$, type BranchCreateOpts as a0, type BranchDeleteOpts as a1, type CheckoutBranchOpts as a2, type CheckoutPathOpts as a3, type CheckoutOpts as a4, type CommitOpts as a5, type CommitResult as a6, type DiffOpts as a7, type DiffEntry as a8, type DiffResult as a9, type RevParsePathOpts as aA, type SubmoduleOpts as aB, type SubmoduleAddOpts as aC, type SubmoduleDeinitOpts as aD, type SubmoduleStatusOpts as aE, type SubmoduleSummaryOpts as aF, type SubmoduleForeachOpts as aG, type SubmoduleSyncOpts as aH, type SubmoduleSetBranchOpts as aI, type SubmoduleInfo as aJ, type LfsStatus as aK, type LfsPullOpts as aL, type LfsPushOpts as aM, type LfsStatusOpts as aN, type LfsPruneOpts as aO, type LfsFetchOpts as aP, type RepoLfsInstallOpts as aQ, type RepoLfsUninstallOpts as aR, type LfsFileEntry as aS, type LfsLsFilesOpts as aT, type LfsTrackEntry as aU, type LfsTrackOpts as aV, type LfsLockEntry as aW, type LfsLockOpts as aX, type LfsUnlockOpts as aY, type LfsLocksOpts as aZ, type LfsCheckoutOpts as a_, type MergeOpts as aa, type MergeResult as ab, type PullOpts as ac, type ResetOpts as ad, type RmOpts as ae, type StashEntry as af, type StashPushOpts as ag, type StashApplyOpts as ah, type SwitchOpts as ai, type TagInfo as aj, type TagListOpts as ak, type TagCreateOpts as al, type CherryPickOpts as am, type CleanOpts as an, type MvOpts as ao, type RebaseOpts as ap, type RestoreOpts as aq, type RevertOpts as ar, type ShowOpts as as, type RevParsePathQuery as at, type RevParseBooleanQuery as au, type RevParseListOpts as av, type RevParseListQuery as aw, type RevParseRefOpts as ax, type RevParseOtherQuery as ay, type RevParsePathFormat as az, type GitProgressInfo as b, type LfsMigrateImportOpts as b0, type LfsMigrateExportOpts as b1, type LfsEnvInfo as b2, type LfsPreUploadOpts as b3, type LfsPreUploadResult as b4, type LfsPreDownloadOpts as b5, type LfsPreDownloadResult as b6, type Worktree as b7, type WorktreeAddOpts as b8, type WorktreeRemoveOpts as b9, type SubmoduleOperations as bA, type WorktreeRepo as bB, type BareRepo as bC, type WorktreePruneOpts as ba, type WorktreeMoveOpts as bb, type WorktreeRepairOpts as bc, type WorktreeLockOpts as bd, type WorktreeOperations as be, type LfsOperations as bf, type LfsExtraOperations as bg, type BranchOperations as bh, type StashOperations as bi, type TagOperations as bj, type RemoteInfo as bk, type RemoteAddOpts as bl, type RemoteSetHeadOpts as bm, type RemoteShowOpts as bn, type RemotePruneOpts as bo, type RemoteUpdateOpts as bp, type RemoteSetBranchesOpts as bq, type RemoteUrlOpts as br, type RemoteOperations as bs, type ConfigEntry as bt, type ConfigGetOpts as bu, type ConfigSetOpts as bv, type ConfigListOpts as bw, type ConfigSchema as bx, type ConfigKey as by, type ConfigOperations as bz, createGit as c, createNodeAdapters, detectErrorCategory as d, type LfsProgressInfo as e, type LsRemoteRef as f, type LsTreeObjectType$1 as g, type ParsedLsTreeEntry as h, type ParsedWorktree as i, type PorcelainV2Entry as j, parseGitProgress as k, parseJson as l, parseKeyValue as m, parseLfsProgress as n, parseLines as o, parseGitLog as p, parseLsRemote as q, parseLsTree as r, parsePorcelainV2 as s, parseRecords as t, parseWorktreeList as u, CliRunner as v, type CliRunnerOptions as w, type CloneOpts as x, type LsRemoteOpts as y, type LsRemoteResult as z };
|