type-git 0.0.2 → 0.0.3
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/dist/adapters/bun/index.cjs +395 -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 +362 -13
- package/dist/adapters/bun/index.js.map +1 -1
- package/dist/adapters/deno/index.cjs +443 -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 +410 -13
- package/dist/adapters/deno/index.js.map +1 -1
- package/dist/adapters/node/index.cjs +5625 -0
- package/dist/adapters/node/index.cjs.map +1 -0
- package/dist/adapters/node/index.d.cts +2 -0
- package/dist/adapters/node/index.d.ts +2 -123
- package/dist/adapters/node/index.js +5577 -115
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/{core/types.d.ts → adapters-w9tZ_Qbd.d.cts} +220 -28
- package/dist/adapters-w9tZ_Qbd.d.ts +572 -0
- package/dist/{core/repo.d.ts → index-D9acU30I.d.ts} +863 -179
- package/dist/index-DRd85eN5.d.cts +3649 -0
- package/dist/index.cjs +5744 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +208 -0
- package/dist/index.d.ts +206 -7
- package/dist/index.js +5685 -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,19 @@
|
|
|
1
|
+
import { f as ExecOpts, g as RawResult, m as LfsMode, e as GitProgress, q as GitOpenOptions, R as RuntimeAdapters, p as ExecutionContext, j as GitError, E as ExecAdapter, C as Capabilities, S as SpawnOptions, b as StreamHandler, a as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle } from './adapters-w9tZ_Qbd.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Repository interfaces - operations that require a repository context
|
|
3
5
|
*/
|
|
4
|
-
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Base repository interface
|
|
7
9
|
*/
|
|
8
|
-
|
|
10
|
+
interface RepoBase {
|
|
9
11
|
/**
|
|
10
12
|
* Execute a raw git command in this repository context
|
|
11
13
|
*
|
|
12
14
|
* Wraps: `git <argv...>`
|
|
13
15
|
*/
|
|
14
|
-
raw(argv:
|
|
16
|
+
raw(argv: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
15
17
|
/**
|
|
16
18
|
* Check if this repository is a worktree repository (has working directory)
|
|
17
19
|
*
|
|
@@ -54,7 +56,7 @@ export interface RepoBase {
|
|
|
54
56
|
/**
|
|
55
57
|
* Status file entry
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
type StatusEntry = {
|
|
58
60
|
path: string;
|
|
59
61
|
index: string;
|
|
60
62
|
workdir: string;
|
|
@@ -63,8 +65,8 @@ export type StatusEntry = {
|
|
|
63
65
|
/**
|
|
64
66
|
* Result from git status --porcelain
|
|
65
67
|
*/
|
|
66
|
-
|
|
67
|
-
entries:
|
|
68
|
+
type StatusPorcelain = {
|
|
69
|
+
entries: StatusEntry[];
|
|
68
70
|
branch?: string;
|
|
69
71
|
upstream?: string;
|
|
70
72
|
ahead?: number;
|
|
@@ -73,7 +75,7 @@ export type StatusPorcelain = {
|
|
|
73
75
|
/**
|
|
74
76
|
* Options for git status
|
|
75
77
|
*/
|
|
76
|
-
|
|
78
|
+
type StatusOpts = {
|
|
77
79
|
/** Porcelain output format version (1 or 2) */
|
|
78
80
|
porcelain?: 1 | 2;
|
|
79
81
|
/** How to show untracked files */
|
|
@@ -98,10 +100,10 @@ export type StatusOpts = {
|
|
|
98
100
|
/**
|
|
99
101
|
* Commit information
|
|
100
102
|
*/
|
|
101
|
-
|
|
103
|
+
type Commit = {
|
|
102
104
|
hash: string;
|
|
103
105
|
abbrevHash: string;
|
|
104
|
-
parents:
|
|
106
|
+
parents: string[];
|
|
105
107
|
author: {
|
|
106
108
|
name: string;
|
|
107
109
|
email: string;
|
|
@@ -118,7 +120,7 @@ export type Commit = {
|
|
|
118
120
|
/**
|
|
119
121
|
* Options for git log
|
|
120
122
|
*/
|
|
121
|
-
|
|
123
|
+
type LogOpts = {
|
|
122
124
|
/** Limit the number of commits to output */
|
|
123
125
|
maxCount?: number;
|
|
124
126
|
/** Skip number of commits before starting to show the output */
|
|
@@ -171,11 +173,11 @@ export type LogOpts = {
|
|
|
171
173
|
/**
|
|
172
174
|
* Options for git fetch
|
|
173
175
|
*/
|
|
174
|
-
|
|
176
|
+
type FetchOpts = {
|
|
175
177
|
/** Remote name to fetch from */
|
|
176
178
|
remote?: string;
|
|
177
179
|
/** Refspec(s) to fetch */
|
|
178
|
-
refspec?: string |
|
|
180
|
+
refspec?: string | string[];
|
|
179
181
|
/** Remove remote-tracking refs that no longer exist on the remote */
|
|
180
182
|
prune?: boolean;
|
|
181
183
|
/** Fetch all tags from the remote */
|
|
@@ -219,7 +221,7 @@ export type FetchOpts = {
|
|
|
219
221
|
/** Deepen a shallow repository by date */
|
|
220
222
|
shallowSince?: string | Date;
|
|
221
223
|
/** Deepen a shallow repository excluding specified revision */
|
|
222
|
-
shallowExclude?: string |
|
|
224
|
+
shallowExclude?: string | string[];
|
|
223
225
|
/** Deepen a shallow repository by specified number of commits */
|
|
224
226
|
deepen?: number;
|
|
225
227
|
/** Convert a shallow repository to a complete one */
|
|
@@ -244,7 +246,7 @@ export type FetchOpts = {
|
|
|
244
246
|
/**
|
|
245
247
|
* Force with lease options for git push
|
|
246
248
|
*/
|
|
247
|
-
|
|
249
|
+
type ForceWithLeaseOpts = {
|
|
248
250
|
/** Reference name to check (e.g., 'refs/heads/main') */
|
|
249
251
|
refname: string;
|
|
250
252
|
/** Expected value of the ref (commit hash) */
|
|
@@ -253,11 +255,11 @@ export type ForceWithLeaseOpts = {
|
|
|
253
255
|
/**
|
|
254
256
|
* Options for git push
|
|
255
257
|
*/
|
|
256
|
-
|
|
258
|
+
type PushOpts = {
|
|
257
259
|
/** Remote name to push to */
|
|
258
260
|
remote?: string;
|
|
259
261
|
/** Refspec(s) to push */
|
|
260
|
-
refspec?: string |
|
|
262
|
+
refspec?: string | string[];
|
|
261
263
|
/** Force updates even if they are not fast-forward */
|
|
262
264
|
force?: boolean;
|
|
263
265
|
/**
|
|
@@ -307,7 +309,7 @@ export type PushOpts = {
|
|
|
307
309
|
/** Use atomic transaction to update refs */
|
|
308
310
|
atomic?: boolean;
|
|
309
311
|
/** Transmit push options to the server */
|
|
310
|
-
pushOption?: string |
|
|
312
|
+
pushOption?: string | string[];
|
|
311
313
|
/** Use IPv4 addresses only */
|
|
312
314
|
ipv4?: boolean;
|
|
313
315
|
/** Use IPv6 addresses only */
|
|
@@ -316,7 +318,7 @@ export type PushOpts = {
|
|
|
316
318
|
/**
|
|
317
319
|
* Options for git add
|
|
318
320
|
*/
|
|
319
|
-
|
|
321
|
+
type AddOpts = {
|
|
320
322
|
/** Add all files (including untracked) */
|
|
321
323
|
all?: boolean;
|
|
322
324
|
/** Dry run - show what would be added */
|
|
@@ -353,7 +355,7 @@ export type AddOpts = {
|
|
|
353
355
|
/**
|
|
354
356
|
* Branch information
|
|
355
357
|
*/
|
|
356
|
-
|
|
358
|
+
type BranchInfo = {
|
|
357
359
|
name: string;
|
|
358
360
|
current: boolean;
|
|
359
361
|
commit: string;
|
|
@@ -363,7 +365,7 @@ export type BranchInfo = {
|
|
|
363
365
|
/**
|
|
364
366
|
* Options for git branch
|
|
365
367
|
*/
|
|
366
|
-
|
|
368
|
+
type BranchOpts = {
|
|
367
369
|
/** List all branches (including remote) */
|
|
368
370
|
all?: boolean;
|
|
369
371
|
/** List remote branches only */
|
|
@@ -392,7 +394,7 @@ export type BranchOpts = {
|
|
|
392
394
|
/**
|
|
393
395
|
* Options for creating a branch
|
|
394
396
|
*/
|
|
395
|
-
|
|
397
|
+
type BranchCreateOpts = {
|
|
396
398
|
/** Start point (commit, branch, or tag) */
|
|
397
399
|
startPoint?: string;
|
|
398
400
|
/** Force creation (overwrite existing) */
|
|
@@ -409,7 +411,7 @@ export type BranchCreateOpts = {
|
|
|
409
411
|
/**
|
|
410
412
|
* Options for deleting a branch
|
|
411
413
|
*/
|
|
412
|
-
|
|
414
|
+
type BranchDeleteOpts = {
|
|
413
415
|
/** Force delete (even if not merged) */
|
|
414
416
|
force?: boolean;
|
|
415
417
|
/** Delete remote-tracking branch */
|
|
@@ -420,7 +422,7 @@ export type BranchDeleteOpts = {
|
|
|
420
422
|
*
|
|
421
423
|
* Used for: `git checkout <branch>`
|
|
422
424
|
*/
|
|
423
|
-
|
|
425
|
+
type CheckoutBranchOpts = {
|
|
424
426
|
/** Force checkout (discard local changes) */
|
|
425
427
|
force?: boolean;
|
|
426
428
|
/** Create new branch */
|
|
@@ -457,7 +459,7 @@ export type CheckoutBranchOpts = {
|
|
|
457
459
|
*
|
|
458
460
|
* Used for: `git checkout [<tree-ish>] -- <pathspec>...`
|
|
459
461
|
*/
|
|
460
|
-
|
|
462
|
+
type CheckoutPathOpts = {
|
|
461
463
|
/** Force checkout (discard local changes) */
|
|
462
464
|
force?: boolean;
|
|
463
465
|
/** Source tree-ish to checkout from (default: index) */
|
|
@@ -477,11 +479,11 @@ export type CheckoutPathOpts = {
|
|
|
477
479
|
* Options for git checkout (legacy combined type)
|
|
478
480
|
* @deprecated Use CheckoutBranchOpts or CheckoutPathOpts for type safety
|
|
479
481
|
*/
|
|
480
|
-
|
|
482
|
+
type CheckoutOpts = CheckoutBranchOpts & CheckoutPathOpts;
|
|
481
483
|
/**
|
|
482
484
|
* Options for git commit
|
|
483
485
|
*/
|
|
484
|
-
|
|
486
|
+
type CommitOpts = {
|
|
485
487
|
/** Commit message */
|
|
486
488
|
message?: string;
|
|
487
489
|
/** Allow empty commit */
|
|
@@ -519,7 +521,7 @@ export type CommitOpts = {
|
|
|
519
521
|
/** Override author date and ignore cached author identity */
|
|
520
522
|
resetAuthor?: boolean;
|
|
521
523
|
/** Add trailers to the commit message */
|
|
522
|
-
trailer?: string |
|
|
524
|
+
trailer?: string | string[];
|
|
523
525
|
/** Add Signed-off-by trailer */
|
|
524
526
|
signoff?: boolean;
|
|
525
527
|
/** How to clean up the commit message */
|
|
@@ -540,7 +542,7 @@ export type CommitOpts = {
|
|
|
540
542
|
/**
|
|
541
543
|
* Commit result
|
|
542
544
|
*/
|
|
543
|
-
|
|
545
|
+
type CommitResult = {
|
|
544
546
|
/** Commit hash */
|
|
545
547
|
hash: string;
|
|
546
548
|
/** Branch name */
|
|
@@ -557,7 +559,7 @@ export type CommitResult = {
|
|
|
557
559
|
/**
|
|
558
560
|
* Options for git diff
|
|
559
561
|
*/
|
|
560
|
-
|
|
562
|
+
type DiffOpts = {
|
|
561
563
|
/** Compare staged changes */
|
|
562
564
|
staged?: boolean;
|
|
563
565
|
/** Show stat only */
|
|
@@ -571,7 +573,7 @@ export type DiffOpts = {
|
|
|
571
573
|
/** Ignore whitespace changes */
|
|
572
574
|
ignoreWhitespace?: boolean;
|
|
573
575
|
/** Pathspecs to filter */
|
|
574
|
-
paths?:
|
|
576
|
+
paths?: string[];
|
|
575
577
|
/** Use NUL as line terminator */
|
|
576
578
|
nullTerminated?: boolean;
|
|
577
579
|
/** Generate patch output */
|
|
@@ -614,7 +616,7 @@ export type DiffOpts = {
|
|
|
614
616
|
/**
|
|
615
617
|
* Diff file entry
|
|
616
618
|
*/
|
|
617
|
-
|
|
619
|
+
type DiffEntry = {
|
|
618
620
|
path: string;
|
|
619
621
|
status: 'A' | 'D' | 'M' | 'R' | 'C' | 'T' | 'U' | 'X';
|
|
620
622
|
oldPath?: string;
|
|
@@ -624,14 +626,14 @@ export type DiffEntry = {
|
|
|
624
626
|
/**
|
|
625
627
|
* Diff result
|
|
626
628
|
*/
|
|
627
|
-
|
|
628
|
-
files:
|
|
629
|
+
type DiffResult = {
|
|
630
|
+
files: DiffEntry[];
|
|
629
631
|
raw?: string;
|
|
630
632
|
};
|
|
631
633
|
/**
|
|
632
634
|
* Options for git merge
|
|
633
635
|
*/
|
|
634
|
-
|
|
636
|
+
type MergeOpts = {
|
|
635
637
|
/** Merge message */
|
|
636
638
|
message?: string;
|
|
637
639
|
/** Fast-forward behavior */
|
|
@@ -643,7 +645,7 @@ export type MergeOpts = {
|
|
|
643
645
|
/** Strategy to use */
|
|
644
646
|
strategy?: string;
|
|
645
647
|
/** Strategy options */
|
|
646
|
-
strategyOption?: string |
|
|
648
|
+
strategyOption?: string | string[];
|
|
647
649
|
/** Abort merge */
|
|
648
650
|
abort?: boolean;
|
|
649
651
|
/** Continue merge */
|
|
@@ -686,16 +688,16 @@ export type MergeOpts = {
|
|
|
686
688
|
/**
|
|
687
689
|
* Merge result
|
|
688
690
|
*/
|
|
689
|
-
|
|
691
|
+
type MergeResult = {
|
|
690
692
|
success: boolean;
|
|
691
693
|
hash?: string;
|
|
692
|
-
conflicts?:
|
|
694
|
+
conflicts?: string[];
|
|
693
695
|
fastForward?: boolean;
|
|
694
696
|
};
|
|
695
697
|
/**
|
|
696
698
|
* Options for git pull
|
|
697
699
|
*/
|
|
698
|
-
|
|
700
|
+
type PullOpts = {
|
|
699
701
|
/** Remote name */
|
|
700
702
|
remote?: string;
|
|
701
703
|
/** Branch to pull */
|
|
@@ -741,7 +743,7 @@ export type PullOpts = {
|
|
|
741
743
|
/** Merge strategy to use */
|
|
742
744
|
strategy?: string;
|
|
743
745
|
/** Strategy options */
|
|
744
|
-
strategyOption?: string |
|
|
746
|
+
strategyOption?: string | string[];
|
|
745
747
|
/** GPG-sign the merge commit (optionally with key id) */
|
|
746
748
|
gpgSign?: boolean | string;
|
|
747
749
|
/** Allow merging histories that do not share a common ancestor */
|
|
@@ -763,7 +765,7 @@ export type PullOpts = {
|
|
|
763
765
|
/** Deepen shallow clone since date */
|
|
764
766
|
shallowSince?: string | Date;
|
|
765
767
|
/** Deepen shallow clone excluding revision */
|
|
766
|
-
shallowExclude?: string |
|
|
768
|
+
shallowExclude?: string | string[];
|
|
767
769
|
/** Deepen shallow clone by specified commits */
|
|
768
770
|
deepen?: number;
|
|
769
771
|
/** Convert shallow repository to complete one */
|
|
@@ -780,7 +782,7 @@ export type PullOpts = {
|
|
|
780
782
|
/**
|
|
781
783
|
* Options for git reset
|
|
782
784
|
*/
|
|
783
|
-
|
|
785
|
+
type ResetOpts = {
|
|
784
786
|
/** Reset mode */
|
|
785
787
|
mode?: 'soft' | 'mixed' | 'hard' | 'merge' | 'keep';
|
|
786
788
|
/** Be quiet (report only errors) */
|
|
@@ -797,7 +799,7 @@ export type ResetOpts = {
|
|
|
797
799
|
/**
|
|
798
800
|
* Options for git rm
|
|
799
801
|
*/
|
|
800
|
-
|
|
802
|
+
type RmOpts = {
|
|
801
803
|
/** Force removal */
|
|
802
804
|
force?: boolean;
|
|
803
805
|
/** Remove from index only (keep in working tree) */
|
|
@@ -818,7 +820,7 @@ export type RmOpts = {
|
|
|
818
820
|
/**
|
|
819
821
|
* Stash entry
|
|
820
822
|
*/
|
|
821
|
-
|
|
823
|
+
type StashEntry = {
|
|
822
824
|
index: number;
|
|
823
825
|
message: string;
|
|
824
826
|
branch?: string;
|
|
@@ -827,7 +829,7 @@ export type StashEntry = {
|
|
|
827
829
|
/**
|
|
828
830
|
* Options for git stash push
|
|
829
831
|
*/
|
|
830
|
-
|
|
832
|
+
type StashPushOpts = {
|
|
831
833
|
/** Stash message */
|
|
832
834
|
message?: string;
|
|
833
835
|
/** Include untracked files */
|
|
@@ -835,7 +837,7 @@ export type StashPushOpts = {
|
|
|
835
837
|
/** Keep index */
|
|
836
838
|
keepIndex?: boolean;
|
|
837
839
|
/** Specific paths to stash */
|
|
838
|
-
paths?:
|
|
840
|
+
paths?: string[];
|
|
839
841
|
/** Stash only staged changes */
|
|
840
842
|
staged?: boolean;
|
|
841
843
|
/** Suppress output */
|
|
@@ -848,7 +850,7 @@ export type StashPushOpts = {
|
|
|
848
850
|
/**
|
|
849
851
|
* Options for git stash pop/apply
|
|
850
852
|
*/
|
|
851
|
-
|
|
853
|
+
type StashApplyOpts = {
|
|
852
854
|
/** Stash index to apply */
|
|
853
855
|
index?: number;
|
|
854
856
|
/** Try to reinstate index */
|
|
@@ -857,7 +859,7 @@ export type StashApplyOpts = {
|
|
|
857
859
|
/**
|
|
858
860
|
* Options for git switch
|
|
859
861
|
*/
|
|
860
|
-
|
|
862
|
+
type SwitchOpts = {
|
|
861
863
|
/** Create new branch */
|
|
862
864
|
create?: boolean;
|
|
863
865
|
/** Force create (overwrite existing) */
|
|
@@ -892,7 +894,7 @@ export type SwitchOpts = {
|
|
|
892
894
|
/**
|
|
893
895
|
* Tag information
|
|
894
896
|
*/
|
|
895
|
-
|
|
897
|
+
type TagInfo = {
|
|
896
898
|
name: string;
|
|
897
899
|
commit: string;
|
|
898
900
|
message?: string;
|
|
@@ -906,7 +908,7 @@ export type TagInfo = {
|
|
|
906
908
|
/**
|
|
907
909
|
* Options for git tag (list)
|
|
908
910
|
*/
|
|
909
|
-
|
|
911
|
+
type TagListOpts = {
|
|
910
912
|
/** List pattern */
|
|
911
913
|
pattern?: string;
|
|
912
914
|
/** Sort by */
|
|
@@ -929,7 +931,7 @@ export type TagListOpts = {
|
|
|
929
931
|
/**
|
|
930
932
|
* Options for creating a tag
|
|
931
933
|
*/
|
|
932
|
-
|
|
934
|
+
type TagCreateOpts = {
|
|
933
935
|
/** Tag message (creates annotated tag) */
|
|
934
936
|
message?: string;
|
|
935
937
|
/** Force (overwrite existing tag) */
|
|
@@ -941,7 +943,7 @@ export type TagCreateOpts = {
|
|
|
941
943
|
/** Read tag message from file */
|
|
942
944
|
file?: string;
|
|
943
945
|
/** Add trailers to the tag message */
|
|
944
|
-
trailer?: string |
|
|
946
|
+
trailer?: string | string[];
|
|
945
947
|
/** How to clean up the tag message */
|
|
946
948
|
cleanup?: string;
|
|
947
949
|
/** Key to use for GPG signing */
|
|
@@ -952,7 +954,7 @@ export type TagCreateOpts = {
|
|
|
952
954
|
/**
|
|
953
955
|
* Options for git cherry-pick
|
|
954
956
|
*/
|
|
955
|
-
|
|
957
|
+
type CherryPickOpts = {
|
|
956
958
|
/** Edit commit message */
|
|
957
959
|
edit?: boolean;
|
|
958
960
|
/** No commit after cherry-pick */
|
|
@@ -976,7 +978,7 @@ export type CherryPickOpts = {
|
|
|
976
978
|
/** Automatically update rerere state */
|
|
977
979
|
rerereAutoupdate?: boolean;
|
|
978
980
|
/** Strategy options */
|
|
979
|
-
strategyOption?: string |
|
|
981
|
+
strategyOption?: string | string[];
|
|
980
982
|
/** GPG-sign the commit (optionally with key id) */
|
|
981
983
|
gpgSign?: boolean | string;
|
|
982
984
|
/** Append (cherry picked from ...) line to original message */
|
|
@@ -993,7 +995,7 @@ export type CherryPickOpts = {
|
|
|
993
995
|
/**
|
|
994
996
|
* Options for git clean
|
|
995
997
|
*/
|
|
996
|
-
|
|
998
|
+
type CleanOpts = {
|
|
997
999
|
/** Force clean */
|
|
998
1000
|
force?: boolean;
|
|
999
1001
|
/** Remove directories too */
|
|
@@ -1005,16 +1007,16 @@ export type CleanOpts = {
|
|
|
1005
1007
|
/** Dry run */
|
|
1006
1008
|
dryRun?: boolean;
|
|
1007
1009
|
/** Paths to clean */
|
|
1008
|
-
paths?:
|
|
1010
|
+
paths?: string[];
|
|
1009
1011
|
/** Suppress output */
|
|
1010
1012
|
quiet?: boolean;
|
|
1011
1013
|
/** Exclude files matching pattern */
|
|
1012
|
-
exclude?: string |
|
|
1014
|
+
exclude?: string | string[];
|
|
1013
1015
|
};
|
|
1014
1016
|
/**
|
|
1015
1017
|
* Options for git mv
|
|
1016
1018
|
*/
|
|
1017
|
-
|
|
1019
|
+
type MvOpts = {
|
|
1018
1020
|
/** Force move */
|
|
1019
1021
|
force?: boolean;
|
|
1020
1022
|
/** Dry run */
|
|
@@ -1029,7 +1031,7 @@ export type MvOpts = {
|
|
|
1029
1031
|
/**
|
|
1030
1032
|
* Options for git rebase
|
|
1031
1033
|
*/
|
|
1032
|
-
|
|
1034
|
+
type RebaseOpts = {
|
|
1033
1035
|
/** Upstream branch */
|
|
1034
1036
|
upstream?: string;
|
|
1035
1037
|
/** Onto target */
|
|
@@ -1087,7 +1089,7 @@ export type RebaseOpts = {
|
|
|
1087
1089
|
/** Merge strategy */
|
|
1088
1090
|
strategy?: string;
|
|
1089
1091
|
/** Strategy options */
|
|
1090
|
-
strategyOption?: string |
|
|
1092
|
+
strategyOption?: string | string[];
|
|
1091
1093
|
/** Rebase from root commit */
|
|
1092
1094
|
root?: boolean;
|
|
1093
1095
|
/** Reschedule failed exec commands */
|
|
@@ -1098,7 +1100,7 @@ export type RebaseOpts = {
|
|
|
1098
1100
|
/**
|
|
1099
1101
|
* Options for git restore
|
|
1100
1102
|
*/
|
|
1101
|
-
|
|
1103
|
+
type RestoreOpts = {
|
|
1102
1104
|
/** Restore staged files */
|
|
1103
1105
|
staged?: boolean;
|
|
1104
1106
|
/** Restore working tree files */
|
|
@@ -1130,7 +1132,7 @@ export type RestoreOpts = {
|
|
|
1130
1132
|
/**
|
|
1131
1133
|
* Options for git revert
|
|
1132
1134
|
*/
|
|
1133
|
-
|
|
1135
|
+
type RevertOpts = {
|
|
1134
1136
|
/** Edit commit message */
|
|
1135
1137
|
edit?: boolean;
|
|
1136
1138
|
/** No commit after revert */
|
|
@@ -1154,7 +1156,7 @@ export type RevertOpts = {
|
|
|
1154
1156
|
/** Merge strategy */
|
|
1155
1157
|
strategy?: string;
|
|
1156
1158
|
/** Strategy options */
|
|
1157
|
-
strategyOption?: string |
|
|
1159
|
+
strategyOption?: string | string[];
|
|
1158
1160
|
/** GPG-sign the commit */
|
|
1159
1161
|
gpgSign?: boolean | string;
|
|
1160
1162
|
/** Add reference to reverted commit */
|
|
@@ -1163,7 +1165,7 @@ export type RevertOpts = {
|
|
|
1163
1165
|
/**
|
|
1164
1166
|
* Options for git show
|
|
1165
1167
|
*/
|
|
1166
|
-
|
|
1168
|
+
type ShowOpts = {
|
|
1167
1169
|
/** Show stat only */
|
|
1168
1170
|
stat?: boolean;
|
|
1169
1171
|
/** Show name only */
|
|
@@ -1188,7 +1190,7 @@ export type ShowOpts = {
|
|
|
1188
1190
|
/**
|
|
1189
1191
|
* Options for git submodule
|
|
1190
1192
|
*/
|
|
1191
|
-
|
|
1193
|
+
type SubmoduleOpts = {
|
|
1192
1194
|
/** Recursive operation */
|
|
1193
1195
|
recursive?: boolean;
|
|
1194
1196
|
/** Initialize submodules */
|
|
@@ -1217,7 +1219,7 @@ export type SubmoduleOpts = {
|
|
|
1217
1219
|
/**
|
|
1218
1220
|
* Options for adding a submodule
|
|
1219
1221
|
*/
|
|
1220
|
-
|
|
1222
|
+
type SubmoduleAddOpts = {
|
|
1221
1223
|
/** Branch to track */
|
|
1222
1224
|
branch?: string;
|
|
1223
1225
|
/** Force addition */
|
|
@@ -1232,7 +1234,7 @@ export type SubmoduleAddOpts = {
|
|
|
1232
1234
|
/**
|
|
1233
1235
|
* Options for deinitializing a submodule
|
|
1234
1236
|
*/
|
|
1235
|
-
|
|
1237
|
+
type SubmoduleDeinitOpts = {
|
|
1236
1238
|
/** Force deinitialization */
|
|
1237
1239
|
force?: boolean;
|
|
1238
1240
|
/** Deinitialize all submodules */
|
|
@@ -1241,14 +1243,14 @@ export type SubmoduleDeinitOpts = {
|
|
|
1241
1243
|
/**
|
|
1242
1244
|
* Options for submodule status
|
|
1243
1245
|
*/
|
|
1244
|
-
|
|
1246
|
+
type SubmoduleStatusOpts = {
|
|
1245
1247
|
/** Check submodules recursively */
|
|
1246
1248
|
recursive?: boolean;
|
|
1247
1249
|
};
|
|
1248
1250
|
/**
|
|
1249
1251
|
* Options for submodule summary
|
|
1250
1252
|
*/
|
|
1251
|
-
|
|
1253
|
+
type SubmoduleSummaryOpts = {
|
|
1252
1254
|
/** Limit to the specified number of commits */
|
|
1253
1255
|
limit?: number;
|
|
1254
1256
|
/** Show files in the summary */
|
|
@@ -1257,28 +1259,28 @@ export type SubmoduleSummaryOpts = {
|
|
|
1257
1259
|
/**
|
|
1258
1260
|
* Options for submodule foreach
|
|
1259
1261
|
*/
|
|
1260
|
-
|
|
1262
|
+
type SubmoduleForeachOpts = {
|
|
1261
1263
|
/** Run the command recursively in nested submodules */
|
|
1262
1264
|
recursive?: boolean;
|
|
1263
1265
|
};
|
|
1264
1266
|
/**
|
|
1265
1267
|
* Options for submodule sync
|
|
1266
1268
|
*/
|
|
1267
|
-
|
|
1269
|
+
type SubmoduleSyncOpts = {
|
|
1268
1270
|
/** Sync recursively in nested submodules */
|
|
1269
1271
|
recursive?: boolean;
|
|
1270
1272
|
};
|
|
1271
1273
|
/**
|
|
1272
1274
|
* Options for submodule set-branch
|
|
1273
1275
|
*/
|
|
1274
|
-
|
|
1276
|
+
type SubmoduleSetBranchOpts = {
|
|
1275
1277
|
/** Set the default tracking branch */
|
|
1276
1278
|
default?: boolean;
|
|
1277
1279
|
};
|
|
1278
1280
|
/**
|
|
1279
1281
|
* Submodule information
|
|
1280
1282
|
*/
|
|
1281
|
-
|
|
1283
|
+
type SubmoduleInfo = {
|
|
1282
1284
|
name: string;
|
|
1283
1285
|
path: string;
|
|
1284
1286
|
url: string;
|
|
@@ -1288,7 +1290,7 @@ export type SubmoduleInfo = {
|
|
|
1288
1290
|
/**
|
|
1289
1291
|
* LFS status information
|
|
1290
1292
|
*/
|
|
1291
|
-
|
|
1293
|
+
type LfsStatus = {
|
|
1292
1294
|
files: Array<{
|
|
1293
1295
|
name: string;
|
|
1294
1296
|
size: number;
|
|
@@ -1298,27 +1300,27 @@ export type LfsStatus = {
|
|
|
1298
1300
|
/**
|
|
1299
1301
|
* Options for LFS pull
|
|
1300
1302
|
*/
|
|
1301
|
-
|
|
1303
|
+
type LfsPullOpts = {
|
|
1302
1304
|
remote?: string;
|
|
1303
1305
|
ref?: string;
|
|
1304
|
-
include?:
|
|
1305
|
-
exclude?:
|
|
1306
|
+
include?: string[];
|
|
1307
|
+
exclude?: string[];
|
|
1306
1308
|
};
|
|
1307
1309
|
/**
|
|
1308
1310
|
* Options for LFS push
|
|
1309
1311
|
*/
|
|
1310
|
-
|
|
1312
|
+
type LfsPushOpts = {
|
|
1311
1313
|
remote?: string;
|
|
1312
1314
|
ref?: string;
|
|
1313
1315
|
/** Dry run - show what would be pushed without actually pushing */
|
|
1314
1316
|
dryRun?: boolean;
|
|
1315
|
-
/** Push specified object IDs */
|
|
1316
|
-
objectId?:
|
|
1317
|
+
/** Push specified object IDs (OID hashes) instead of all objects */
|
|
1318
|
+
objectId?: string | string[];
|
|
1317
1319
|
};
|
|
1318
1320
|
/**
|
|
1319
1321
|
* Options for LFS status
|
|
1320
1322
|
*/
|
|
1321
|
-
|
|
1323
|
+
type LfsStatusOpts = {
|
|
1322
1324
|
json?: boolean;
|
|
1323
1325
|
/** Machine-readable output */
|
|
1324
1326
|
porcelain?: boolean;
|
|
@@ -1326,7 +1328,7 @@ export type LfsStatusOpts = {
|
|
|
1326
1328
|
/**
|
|
1327
1329
|
* Options for LFS prune
|
|
1328
1330
|
*/
|
|
1329
|
-
|
|
1331
|
+
type LfsPruneOpts = {
|
|
1330
1332
|
/** Force prune (remove unreferenced objects immediately) */
|
|
1331
1333
|
force?: boolean;
|
|
1332
1334
|
/** Dry run - show what would be pruned without actually pruning */
|
|
@@ -1345,13 +1347,13 @@ export type LfsPruneOpts = {
|
|
|
1345
1347
|
/**
|
|
1346
1348
|
* Options for LFS fetch
|
|
1347
1349
|
*/
|
|
1348
|
-
|
|
1350
|
+
type LfsFetchOpts = {
|
|
1349
1351
|
/** Fetch all LFS objects for all refs */
|
|
1350
1352
|
all?: boolean;
|
|
1351
1353
|
/** Include patterns */
|
|
1352
|
-
include?: string |
|
|
1354
|
+
include?: string | string[];
|
|
1353
1355
|
/** Exclude patterns */
|
|
1354
|
-
exclude?: string |
|
|
1356
|
+
exclude?: string | string[];
|
|
1355
1357
|
/** Only fetch recent objects */
|
|
1356
1358
|
recent?: boolean;
|
|
1357
1359
|
/** Prune old objects after fetch */
|
|
@@ -1365,7 +1367,7 @@ export type LfsFetchOpts = {
|
|
|
1365
1367
|
/** Remote to fetch from */
|
|
1366
1368
|
remote?: string;
|
|
1367
1369
|
/** Refs to fetch */
|
|
1368
|
-
refs?: string |
|
|
1370
|
+
refs?: string | string[];
|
|
1369
1371
|
};
|
|
1370
1372
|
/**
|
|
1371
1373
|
* Options for repository-level LFS install
|
|
@@ -1379,7 +1381,7 @@ export type LfsFetchOpts = {
|
|
|
1379
1381
|
*
|
|
1380
1382
|
* For global (user-level) or system-wide installation, use `git.lfs.install()` instead.
|
|
1381
1383
|
*/
|
|
1382
|
-
|
|
1384
|
+
type RepoLfsInstallOpts = {
|
|
1383
1385
|
/** Overwrite existing hooks */
|
|
1384
1386
|
force?: boolean;
|
|
1385
1387
|
/**
|
|
@@ -1404,7 +1406,7 @@ export type RepoLfsInstallOpts = {
|
|
|
1404
1406
|
*
|
|
1405
1407
|
* For global or system-wide uninstallation, use `git.lfs.uninstall()` instead.
|
|
1406
1408
|
*/
|
|
1407
|
-
|
|
1409
|
+
type RepoLfsUninstallOpts = {
|
|
1408
1410
|
/**
|
|
1409
1411
|
* Uninstall for worktree only (instead of repository)
|
|
1410
1412
|
*
|
|
@@ -1417,7 +1419,7 @@ export type RepoLfsUninstallOpts = {
|
|
|
1417
1419
|
/**
|
|
1418
1420
|
* LFS file entry
|
|
1419
1421
|
*/
|
|
1420
|
-
|
|
1422
|
+
type LfsFileEntry = {
|
|
1421
1423
|
/** File path */
|
|
1422
1424
|
path: string;
|
|
1423
1425
|
/** Object ID (SHA-256) */
|
|
@@ -1430,7 +1432,7 @@ export type LfsFileEntry = {
|
|
|
1430
1432
|
/**
|
|
1431
1433
|
* Options for LFS ls-files
|
|
1432
1434
|
*/
|
|
1433
|
-
|
|
1435
|
+
type LfsLsFilesOpts = {
|
|
1434
1436
|
/** Show full OID (not abbreviated) */
|
|
1435
1437
|
long?: boolean;
|
|
1436
1438
|
/** Show file sizes */
|
|
@@ -1442,9 +1444,9 @@ export type LfsLsFilesOpts = {
|
|
|
1442
1444
|
/** Show deleted files */
|
|
1443
1445
|
deleted?: boolean;
|
|
1444
1446
|
/** Include patterns */
|
|
1445
|
-
include?: string |
|
|
1447
|
+
include?: string | string[];
|
|
1446
1448
|
/** Exclude patterns */
|
|
1447
|
-
exclude?: string |
|
|
1449
|
+
exclude?: string | string[];
|
|
1448
1450
|
/** Show filenames only */
|
|
1449
1451
|
nameOnly?: boolean;
|
|
1450
1452
|
/** Output in JSON format */
|
|
@@ -1455,7 +1457,7 @@ export type LfsLsFilesOpts = {
|
|
|
1455
1457
|
/**
|
|
1456
1458
|
* LFS track entry
|
|
1457
1459
|
*/
|
|
1458
|
-
|
|
1460
|
+
type LfsTrackEntry = {
|
|
1459
1461
|
/** Pattern being tracked */
|
|
1460
1462
|
pattern: string;
|
|
1461
1463
|
/** Source file (e.g., .gitattributes) */
|
|
@@ -1466,7 +1468,7 @@ export type LfsTrackEntry = {
|
|
|
1466
1468
|
/**
|
|
1467
1469
|
* Options for LFS track
|
|
1468
1470
|
*/
|
|
1469
|
-
|
|
1471
|
+
type LfsTrackOpts = {
|
|
1470
1472
|
/** Show verbose output */
|
|
1471
1473
|
verbose?: boolean;
|
|
1472
1474
|
/** Dry run - show what would be tracked */
|
|
@@ -1485,7 +1487,7 @@ export type LfsTrackOpts = {
|
|
|
1485
1487
|
/**
|
|
1486
1488
|
* LFS lock entry
|
|
1487
1489
|
*/
|
|
1488
|
-
|
|
1490
|
+
type LfsLockEntry = {
|
|
1489
1491
|
/** Lock ID */
|
|
1490
1492
|
id: string;
|
|
1491
1493
|
/** Locked file path */
|
|
@@ -1500,7 +1502,7 @@ export type LfsLockEntry = {
|
|
|
1500
1502
|
/**
|
|
1501
1503
|
* Options for LFS lock
|
|
1502
1504
|
*/
|
|
1503
|
-
|
|
1505
|
+
type LfsLockOpts = {
|
|
1504
1506
|
/** Remote name */
|
|
1505
1507
|
remote?: string;
|
|
1506
1508
|
/** Output in JSON format */
|
|
@@ -1509,7 +1511,7 @@ export type LfsLockOpts = {
|
|
|
1509
1511
|
/**
|
|
1510
1512
|
* Options for LFS unlock
|
|
1511
1513
|
*/
|
|
1512
|
-
|
|
1514
|
+
type LfsUnlockOpts = {
|
|
1513
1515
|
/** Remote name */
|
|
1514
1516
|
remote?: string;
|
|
1515
1517
|
/** Force unlock (even if owned by another user) */
|
|
@@ -1522,7 +1524,7 @@ export type LfsUnlockOpts = {
|
|
|
1522
1524
|
/**
|
|
1523
1525
|
* Options for LFS locks
|
|
1524
1526
|
*/
|
|
1525
|
-
|
|
1527
|
+
type LfsLocksOpts = {
|
|
1526
1528
|
/** Remote name */
|
|
1527
1529
|
remote?: string;
|
|
1528
1530
|
/** Filter by lock ID */
|
|
@@ -1543,7 +1545,7 @@ export type LfsLocksOpts = {
|
|
|
1543
1545
|
/**
|
|
1544
1546
|
* Options for LFS checkout
|
|
1545
1547
|
*/
|
|
1546
|
-
|
|
1548
|
+
type LfsCheckoutOpts = {
|
|
1547
1549
|
/** Use base version for conflicts */
|
|
1548
1550
|
base?: boolean;
|
|
1549
1551
|
/** Use ours version for conflicts */
|
|
@@ -1553,14 +1555,14 @@ export type LfsCheckoutOpts = {
|
|
|
1553
1555
|
/** Write to file instead of working tree */
|
|
1554
1556
|
to?: string;
|
|
1555
1557
|
/** Include patterns */
|
|
1556
|
-
include?: string |
|
|
1558
|
+
include?: string | string[];
|
|
1557
1559
|
/** Exclude patterns */
|
|
1558
|
-
exclude?: string |
|
|
1560
|
+
exclude?: string | string[];
|
|
1559
1561
|
};
|
|
1560
1562
|
/**
|
|
1561
1563
|
* Options for LFS migrate info
|
|
1562
1564
|
*/
|
|
1563
|
-
|
|
1565
|
+
type LfsMigrateInfoOpts = {
|
|
1564
1566
|
/** Only show files above this size */
|
|
1565
1567
|
above?: string | number;
|
|
1566
1568
|
/** Show top N files */
|
|
@@ -1572,13 +1574,13 @@ export type LfsMigrateInfoOpts = {
|
|
|
1572
1574
|
/** Fix up tracking patterns */
|
|
1573
1575
|
fixup?: boolean;
|
|
1574
1576
|
/** Include patterns */
|
|
1575
|
-
include?: string |
|
|
1577
|
+
include?: string | string[];
|
|
1576
1578
|
/** Exclude patterns */
|
|
1577
|
-
exclude?: string |
|
|
1579
|
+
exclude?: string | string[];
|
|
1578
1580
|
/** Include refs */
|
|
1579
|
-
includeRef?: string |
|
|
1581
|
+
includeRef?: string | string[];
|
|
1580
1582
|
/** Exclude refs */
|
|
1581
|
-
excludeRef?: string |
|
|
1583
|
+
excludeRef?: string | string[];
|
|
1582
1584
|
/** Skip fetching from remote */
|
|
1583
1585
|
skipFetch?: boolean;
|
|
1584
1586
|
/** Operate on all refs */
|
|
@@ -1589,7 +1591,7 @@ export type LfsMigrateInfoOpts = {
|
|
|
1589
1591
|
/**
|
|
1590
1592
|
* Options for LFS migrate import
|
|
1591
1593
|
*/
|
|
1592
|
-
|
|
1594
|
+
type LfsMigrateImportOpts = LfsMigrateInfoOpts & {
|
|
1593
1595
|
/** Show verbose output */
|
|
1594
1596
|
verbose?: boolean;
|
|
1595
1597
|
/** Write object map file */
|
|
@@ -1599,12 +1601,12 @@ export type LfsMigrateImportOpts = LfsMigrateInfoOpts & {
|
|
|
1599
1601
|
/** Commit message for fixup */
|
|
1600
1602
|
message?: string;
|
|
1601
1603
|
/** Object IDs to import */
|
|
1602
|
-
object?: string |
|
|
1604
|
+
object?: string | string[];
|
|
1603
1605
|
};
|
|
1604
1606
|
/**
|
|
1605
1607
|
* Options for LFS migrate export
|
|
1606
1608
|
*/
|
|
1607
|
-
|
|
1609
|
+
type LfsMigrateExportOpts = LfsMigrateInfoOpts & {
|
|
1608
1610
|
/** Show verbose output */
|
|
1609
1611
|
verbose?: boolean;
|
|
1610
1612
|
/** Write object map file */
|
|
@@ -1615,7 +1617,7 @@ export type LfsMigrateExportOpts = LfsMigrateInfoOpts & {
|
|
|
1615
1617
|
/**
|
|
1616
1618
|
* LFS environment info
|
|
1617
1619
|
*/
|
|
1618
|
-
|
|
1620
|
+
type LfsEnvInfo = {
|
|
1619
1621
|
/** LFS version */
|
|
1620
1622
|
lfsVersion: string;
|
|
1621
1623
|
/** Git version */
|
|
@@ -1669,9 +1671,9 @@ export type LfsEnvInfo = {
|
|
|
1669
1671
|
* Pre-upload allows pushing LFS objects before the refs push,
|
|
1670
1672
|
* enabling 2-phase commit patterns for improved reliability.
|
|
1671
1673
|
*/
|
|
1672
|
-
|
|
1674
|
+
type LfsPreUploadOpts = {
|
|
1673
1675
|
/** Object IDs to upload (if omitted, auto-detect pending objects) */
|
|
1674
|
-
oids?:
|
|
1676
|
+
oids?: string[];
|
|
1675
1677
|
/** Batch size for upload (default: 50, considers Windows 8KB limit) */
|
|
1676
1678
|
batchSize?: number;
|
|
1677
1679
|
/** Remote name (default: 'origin') */
|
|
@@ -1680,7 +1682,7 @@ export type LfsPreUploadOpts = {
|
|
|
1680
1682
|
/**
|
|
1681
1683
|
* Result from LFS pre-upload
|
|
1682
1684
|
*/
|
|
1683
|
-
|
|
1685
|
+
type LfsPreUploadResult = {
|
|
1684
1686
|
/** Number of objects uploaded */
|
|
1685
1687
|
uploadedCount: number;
|
|
1686
1688
|
/** Total bytes uploaded */
|
|
@@ -1694,9 +1696,9 @@ export type LfsPreUploadResult = {
|
|
|
1694
1696
|
* Pre-download allows fetching LFS objects before checkout,
|
|
1695
1697
|
* useful for controlled large file management.
|
|
1696
1698
|
*/
|
|
1697
|
-
|
|
1699
|
+
type LfsPreDownloadOpts = {
|
|
1698
1700
|
/** Object IDs to download (if omitted, auto-detect from ref) */
|
|
1699
|
-
oids?:
|
|
1701
|
+
oids?: string[];
|
|
1700
1702
|
/** Git ref to get LFS objects for (branch, tag, or commit) */
|
|
1701
1703
|
ref?: string;
|
|
1702
1704
|
/** Batch size for download (default: 50) */
|
|
@@ -1707,7 +1709,7 @@ export type LfsPreDownloadOpts = {
|
|
|
1707
1709
|
/**
|
|
1708
1710
|
* Result from LFS pre-download
|
|
1709
1711
|
*/
|
|
1710
|
-
|
|
1712
|
+
type LfsPreDownloadResult = {
|
|
1711
1713
|
/** Number of objects downloaded */
|
|
1712
1714
|
downloadedCount: number;
|
|
1713
1715
|
/** Total bytes downloaded */
|
|
@@ -1720,7 +1722,7 @@ export type LfsPreDownloadResult = {
|
|
|
1720
1722
|
*
|
|
1721
1723
|
* Parsed from `git worktree list --porcelain` output.
|
|
1722
1724
|
*/
|
|
1723
|
-
|
|
1725
|
+
type Worktree = {
|
|
1724
1726
|
/** Worktree path */
|
|
1725
1727
|
path: string;
|
|
1726
1728
|
/** HEAD commit hash */
|
|
@@ -1735,7 +1737,7 @@ export type Worktree = {
|
|
|
1735
1737
|
/**
|
|
1736
1738
|
* Options for adding a worktree
|
|
1737
1739
|
*/
|
|
1738
|
-
|
|
1740
|
+
type WorktreeAddOpts = {
|
|
1739
1741
|
/**
|
|
1740
1742
|
* Commit-ish to checkout (branch, tag, or commit hash)
|
|
1741
1743
|
*
|
|
@@ -1770,14 +1772,14 @@ export type WorktreeAddOpts = {
|
|
|
1770
1772
|
/**
|
|
1771
1773
|
* Options for removing a worktree
|
|
1772
1774
|
*/
|
|
1773
|
-
|
|
1775
|
+
type WorktreeRemoveOpts = {
|
|
1774
1776
|
/** Force removal even if dirty */
|
|
1775
1777
|
force?: boolean;
|
|
1776
1778
|
};
|
|
1777
1779
|
/**
|
|
1778
1780
|
* Options for pruning worktrees
|
|
1779
1781
|
*/
|
|
1780
|
-
|
|
1782
|
+
type WorktreePruneOpts = {
|
|
1781
1783
|
/** Show what would be pruned without actually pruning */
|
|
1782
1784
|
dryRun?: boolean;
|
|
1783
1785
|
/** Show more details */
|
|
@@ -1788,18 +1790,18 @@ export type WorktreePruneOpts = {
|
|
|
1788
1790
|
/**
|
|
1789
1791
|
* Options for worktree move
|
|
1790
1792
|
*/
|
|
1791
|
-
|
|
1793
|
+
type WorktreeMoveOpts = {
|
|
1792
1794
|
/** Force move even if destination exists */
|
|
1793
1795
|
force?: boolean;
|
|
1794
1796
|
};
|
|
1795
1797
|
/**
|
|
1796
1798
|
* Options for worktree repair
|
|
1797
1799
|
*/
|
|
1798
|
-
|
|
1800
|
+
type WorktreeRepairOpts = {};
|
|
1799
1801
|
/**
|
|
1800
1802
|
* Options for locking a worktree
|
|
1801
1803
|
*/
|
|
1802
|
-
|
|
1804
|
+
type WorktreeLockOpts = {
|
|
1803
1805
|
/** Reason for locking */
|
|
1804
1806
|
reason?: string;
|
|
1805
1807
|
};
|
|
@@ -1808,13 +1810,13 @@ export type WorktreeLockOpts = {
|
|
|
1808
1810
|
*
|
|
1809
1811
|
* Wraps: `git worktree` subcommands
|
|
1810
1812
|
*/
|
|
1811
|
-
|
|
1813
|
+
interface WorktreeOperations {
|
|
1812
1814
|
/**
|
|
1813
1815
|
* List all worktrees
|
|
1814
1816
|
*
|
|
1815
1817
|
* Wraps: `git worktree list --porcelain`
|
|
1816
1818
|
*/
|
|
1817
|
-
list(opts?: ExecOpts): Promise<
|
|
1819
|
+
list(opts?: ExecOpts): Promise<Worktree[]>;
|
|
1818
1820
|
/**
|
|
1819
1821
|
* Add a new worktree and return a repository object for it
|
|
1820
1822
|
*
|
|
@@ -1834,7 +1836,7 @@ export interface WorktreeOperations {
|
|
|
1834
1836
|
*
|
|
1835
1837
|
* Wraps: `git worktree prune`
|
|
1836
1838
|
*/
|
|
1837
|
-
prune(opts?: WorktreePruneOpts & ExecOpts): Promise<
|
|
1839
|
+
prune(opts?: WorktreePruneOpts & ExecOpts): Promise<string[]>;
|
|
1838
1840
|
/**
|
|
1839
1841
|
* Lock a worktree
|
|
1840
1842
|
*
|
|
@@ -1860,14 +1862,14 @@ export interface WorktreeOperations {
|
|
|
1860
1862
|
*
|
|
1861
1863
|
* Wraps: `git worktree repair`
|
|
1862
1864
|
*/
|
|
1863
|
-
repair(paths?:
|
|
1865
|
+
repair(paths?: string[], opts?: ExecOpts): Promise<void>;
|
|
1864
1866
|
}
|
|
1865
1867
|
/**
|
|
1866
1868
|
* LFS operations
|
|
1867
1869
|
*
|
|
1868
1870
|
* Wraps: `git lfs` subcommands
|
|
1869
1871
|
*/
|
|
1870
|
-
|
|
1872
|
+
interface LfsOperations {
|
|
1871
1873
|
/**
|
|
1872
1874
|
* Pull LFS objects
|
|
1873
1875
|
*
|
|
@@ -1943,25 +1945,25 @@ export interface LfsOperations {
|
|
|
1943
1945
|
*
|
|
1944
1946
|
* Wraps: `git lfs ls-files`
|
|
1945
1947
|
*/
|
|
1946
|
-
lsFiles(opts?: LfsLsFilesOpts & ExecOpts): Promise<
|
|
1948
|
+
lsFiles(opts?: LfsLsFilesOpts & ExecOpts): Promise<LfsFileEntry[]>;
|
|
1947
1949
|
/**
|
|
1948
1950
|
* Track files with LFS
|
|
1949
1951
|
*
|
|
1950
1952
|
* Wraps: `git lfs track <pattern>...`
|
|
1951
1953
|
*/
|
|
1952
|
-
track(patterns: string |
|
|
1954
|
+
track(patterns: string | string[], opts?: LfsTrackOpts & ExecOpts): Promise<void>;
|
|
1953
1955
|
/**
|
|
1954
1956
|
* List tracked patterns
|
|
1955
1957
|
*
|
|
1956
1958
|
* Wraps: `git lfs track` (without arguments)
|
|
1957
1959
|
*/
|
|
1958
|
-
trackList(opts?: ExecOpts): Promise<
|
|
1960
|
+
trackList(opts?: ExecOpts): Promise<LfsTrackEntry[]>;
|
|
1959
1961
|
/**
|
|
1960
1962
|
* Untrack files from LFS
|
|
1961
1963
|
*
|
|
1962
1964
|
* Wraps: `git lfs untrack <pattern>...`
|
|
1963
1965
|
*/
|
|
1964
|
-
untrack(patterns: string |
|
|
1966
|
+
untrack(patterns: string | string[], opts?: ExecOpts): Promise<void>;
|
|
1965
1967
|
/**
|
|
1966
1968
|
* Lock a file
|
|
1967
1969
|
*
|
|
@@ -1979,13 +1981,13 @@ export interface LfsOperations {
|
|
|
1979
1981
|
*
|
|
1980
1982
|
* Wraps: `git lfs locks`
|
|
1981
1983
|
*/
|
|
1982
|
-
locks(opts?: LfsLocksOpts & ExecOpts): Promise<
|
|
1984
|
+
locks(opts?: LfsLocksOpts & ExecOpts): Promise<LfsLockEntry[]>;
|
|
1983
1985
|
/**
|
|
1984
1986
|
* Checkout LFS files (replace pointer files with actual content)
|
|
1985
1987
|
*
|
|
1986
1988
|
* Wraps: `git lfs checkout`
|
|
1987
1989
|
*/
|
|
1988
|
-
checkout(patterns?: string |
|
|
1990
|
+
checkout(patterns?: string | string[], opts?: LfsCheckoutOpts & ExecOpts): Promise<void>;
|
|
1989
1991
|
/**
|
|
1990
1992
|
* Show information about LFS files that would be migrated
|
|
1991
1993
|
*
|
|
@@ -2023,7 +2025,7 @@ export interface LfsOperations {
|
|
|
2023
2025
|
* Additional LFS utilities not part of the core LFS commands.
|
|
2024
2026
|
* These enable advanced patterns like 2-phase commit/fetch.
|
|
2025
2027
|
*/
|
|
2026
|
-
|
|
2028
|
+
interface LfsExtraOperations {
|
|
2027
2029
|
/**
|
|
2028
2030
|
* Pre-upload LFS objects before refs push (§10.3)
|
|
2029
2031
|
*
|
|
@@ -2056,13 +2058,13 @@ export interface LfsExtraOperations {
|
|
|
2056
2058
|
*
|
|
2057
2059
|
* Wraps: `git branch` subcommands
|
|
2058
2060
|
*/
|
|
2059
|
-
|
|
2061
|
+
interface BranchOperations {
|
|
2060
2062
|
/**
|
|
2061
2063
|
* List branches
|
|
2062
2064
|
*
|
|
2063
2065
|
* Wraps: `git branch --list`
|
|
2064
2066
|
*/
|
|
2065
|
-
list(opts?: BranchOpts & ExecOpts): Promise<
|
|
2067
|
+
list(opts?: BranchOpts & ExecOpts): Promise<BranchInfo[]>;
|
|
2066
2068
|
/**
|
|
2067
2069
|
* Get current branch name
|
|
2068
2070
|
*
|
|
@@ -2093,13 +2095,13 @@ export interface BranchOperations {
|
|
|
2093
2095
|
*
|
|
2094
2096
|
* Wraps: `git stash` subcommands
|
|
2095
2097
|
*/
|
|
2096
|
-
|
|
2098
|
+
interface StashOperations {
|
|
2097
2099
|
/**
|
|
2098
2100
|
* List stash entries
|
|
2099
2101
|
*
|
|
2100
2102
|
* Wraps: `git stash list`
|
|
2101
2103
|
*/
|
|
2102
|
-
list(opts?: ExecOpts): Promise<
|
|
2104
|
+
list(opts?: ExecOpts): Promise<StashEntry[]>;
|
|
2103
2105
|
/**
|
|
2104
2106
|
* Push changes to stash
|
|
2105
2107
|
*
|
|
@@ -2136,13 +2138,13 @@ export interface StashOperations {
|
|
|
2136
2138
|
*
|
|
2137
2139
|
* Wraps: `git tag` subcommands
|
|
2138
2140
|
*/
|
|
2139
|
-
|
|
2141
|
+
interface TagOperations {
|
|
2140
2142
|
/**
|
|
2141
2143
|
* List tags
|
|
2142
2144
|
*
|
|
2143
2145
|
* Wraps: `git tag --list`
|
|
2144
2146
|
*/
|
|
2145
|
-
list(opts?: TagListOpts & ExecOpts): Promise<
|
|
2147
|
+
list(opts?: TagListOpts & ExecOpts): Promise<string[]>;
|
|
2146
2148
|
/**
|
|
2147
2149
|
* Create a tag
|
|
2148
2150
|
*
|
|
@@ -2165,7 +2167,7 @@ export interface TagOperations {
|
|
|
2165
2167
|
/**
|
|
2166
2168
|
* Remote information
|
|
2167
2169
|
*/
|
|
2168
|
-
|
|
2170
|
+
type RemoteInfo = {
|
|
2169
2171
|
/** Remote name */
|
|
2170
2172
|
name: string;
|
|
2171
2173
|
/** Fetch URL */
|
|
@@ -2176,7 +2178,7 @@ export type RemoteInfo = {
|
|
|
2176
2178
|
/**
|
|
2177
2179
|
* Options for adding a remote
|
|
2178
2180
|
*/
|
|
2179
|
-
|
|
2181
|
+
type RemoteAddOpts = {
|
|
2180
2182
|
/** Set up tracking for default branch */
|
|
2181
2183
|
track?: string;
|
|
2182
2184
|
/** Only fetch specified branches */
|
|
@@ -2189,7 +2191,7 @@ export type RemoteAddOpts = {
|
|
|
2189
2191
|
/**
|
|
2190
2192
|
* Options for remote set-head
|
|
2191
2193
|
*/
|
|
2192
|
-
|
|
2194
|
+
type RemoteSetHeadOpts = {
|
|
2193
2195
|
/** Automatically determine remote HEAD */
|
|
2194
2196
|
auto?: boolean;
|
|
2195
2197
|
/** Delete the symbolic-ref for remote HEAD */
|
|
@@ -2198,35 +2200,35 @@ export type RemoteSetHeadOpts = {
|
|
|
2198
2200
|
/**
|
|
2199
2201
|
* Options for remote show
|
|
2200
2202
|
*/
|
|
2201
|
-
|
|
2203
|
+
type RemoteShowOpts = {
|
|
2202
2204
|
/** Do not query remote heads */
|
|
2203
2205
|
noQuery?: boolean;
|
|
2204
2206
|
};
|
|
2205
2207
|
/**
|
|
2206
2208
|
* Options for remote prune
|
|
2207
2209
|
*/
|
|
2208
|
-
|
|
2210
|
+
type RemotePruneOpts = {
|
|
2209
2211
|
/** Dry run - show what would be pruned */
|
|
2210
2212
|
dryRun?: boolean;
|
|
2211
2213
|
};
|
|
2212
2214
|
/**
|
|
2213
2215
|
* Options for remote update
|
|
2214
2216
|
*/
|
|
2215
|
-
|
|
2217
|
+
type RemoteUpdateOpts = {
|
|
2216
2218
|
/** Prune remote-tracking branches */
|
|
2217
2219
|
prune?: boolean;
|
|
2218
2220
|
};
|
|
2219
2221
|
/**
|
|
2220
2222
|
* Options for remote set-branches
|
|
2221
2223
|
*/
|
|
2222
|
-
|
|
2224
|
+
type RemoteSetBranchesOpts = {
|
|
2223
2225
|
/** Add branches instead of replacing */
|
|
2224
2226
|
add?: boolean;
|
|
2225
2227
|
};
|
|
2226
2228
|
/**
|
|
2227
2229
|
* Options for getting/setting remote URL
|
|
2228
2230
|
*/
|
|
2229
|
-
|
|
2231
|
+
type RemoteUrlOpts = {
|
|
2230
2232
|
/** Target push URL instead of fetch URL */
|
|
2231
2233
|
push?: boolean;
|
|
2232
2234
|
};
|
|
@@ -2235,13 +2237,13 @@ export type RemoteUrlOpts = {
|
|
|
2235
2237
|
*
|
|
2236
2238
|
* Wraps: `git remote` subcommands
|
|
2237
2239
|
*/
|
|
2238
|
-
|
|
2240
|
+
interface RemoteOperations {
|
|
2239
2241
|
/**
|
|
2240
2242
|
* List remotes
|
|
2241
2243
|
*
|
|
2242
2244
|
* Wraps: `git remote -v`
|
|
2243
2245
|
*/
|
|
2244
|
-
list(opts?: ExecOpts): Promise<
|
|
2246
|
+
list(opts?: ExecOpts): Promise<RemoteInfo[]>;
|
|
2245
2247
|
/**
|
|
2246
2248
|
* Add a remote
|
|
2247
2249
|
*
|
|
@@ -2289,24 +2291,24 @@ export interface RemoteOperations {
|
|
|
2289
2291
|
*
|
|
2290
2292
|
* Wraps: `git remote prune <remote>`
|
|
2291
2293
|
*/
|
|
2292
|
-
prune(remote: string, opts?: RemotePruneOpts & ExecOpts): Promise<
|
|
2294
|
+
prune(remote: string, opts?: RemotePruneOpts & ExecOpts): Promise<string[]>;
|
|
2293
2295
|
/**
|
|
2294
2296
|
* Update remotes
|
|
2295
2297
|
*
|
|
2296
2298
|
* Wraps: `git remote update`
|
|
2297
2299
|
*/
|
|
2298
|
-
update(remotes?:
|
|
2300
|
+
update(remotes?: string[], opts?: RemoteUpdateOpts & ExecOpts): Promise<void>;
|
|
2299
2301
|
/**
|
|
2300
2302
|
* Set tracked branches for a remote
|
|
2301
2303
|
*
|
|
2302
2304
|
* Wraps: `git remote set-branches <remote> <branch>...`
|
|
2303
2305
|
*/
|
|
2304
|
-
setBranches(remote: string, branches:
|
|
2306
|
+
setBranches(remote: string, branches: string[], opts?: RemoteSetBranchesOpts & ExecOpts): Promise<void>;
|
|
2305
2307
|
}
|
|
2306
2308
|
/**
|
|
2307
2309
|
* Config entry
|
|
2308
2310
|
*/
|
|
2309
|
-
|
|
2311
|
+
type ConfigEntry = {
|
|
2310
2312
|
/** Config key (e.g., 'user.name') */
|
|
2311
2313
|
key: string;
|
|
2312
2314
|
/** Config value */
|
|
@@ -2315,7 +2317,7 @@ export type ConfigEntry = {
|
|
|
2315
2317
|
/**
|
|
2316
2318
|
* Options for config get
|
|
2317
2319
|
*/
|
|
2318
|
-
|
|
2320
|
+
type ConfigGetOpts = {
|
|
2319
2321
|
/** Get all values for multi-valued key */
|
|
2320
2322
|
all?: boolean;
|
|
2321
2323
|
/** Type to interpret the value as */
|
|
@@ -2326,14 +2328,14 @@ export type ConfigGetOpts = {
|
|
|
2326
2328
|
/**
|
|
2327
2329
|
* Options for config set
|
|
2328
2330
|
*/
|
|
2329
|
-
|
|
2331
|
+
type ConfigSetOpts = {
|
|
2330
2332
|
/** Add value to multi-valued key instead of replacing */
|
|
2331
2333
|
add?: boolean;
|
|
2332
2334
|
};
|
|
2333
2335
|
/**
|
|
2334
2336
|
* Options for config list
|
|
2335
2337
|
*/
|
|
2336
|
-
|
|
2338
|
+
type ConfigListOpts = {
|
|
2337
2339
|
/** Show origin of each value */
|
|
2338
2340
|
showOrigin?: boolean;
|
|
2339
2341
|
/** Show scope of each value */
|
|
@@ -2349,7 +2351,7 @@ export type ConfigListOpts = {
|
|
|
2349
2351
|
* This provides type safety for common config operations.
|
|
2350
2352
|
* For arbitrary keys, use getRaw/setRaw.
|
|
2351
2353
|
*/
|
|
2352
|
-
|
|
2354
|
+
type ConfigSchema = {
|
|
2353
2355
|
'user.name': string;
|
|
2354
2356
|
'user.email': string;
|
|
2355
2357
|
'user.signingkey': string;
|
|
@@ -2401,13 +2403,13 @@ export type ConfigSchema = {
|
|
|
2401
2403
|
/**
|
|
2402
2404
|
* Known config key names
|
|
2403
2405
|
*/
|
|
2404
|
-
|
|
2406
|
+
type ConfigKey = keyof ConfigSchema;
|
|
2405
2407
|
/**
|
|
2406
2408
|
* Config operations (repository-level)
|
|
2407
2409
|
*
|
|
2408
2410
|
* Wraps: `git config` subcommands
|
|
2409
2411
|
*/
|
|
2410
|
-
|
|
2412
|
+
interface ConfigOperations {
|
|
2411
2413
|
/**
|
|
2412
2414
|
* Get a typed config value
|
|
2413
2415
|
*
|
|
@@ -2421,7 +2423,7 @@ export interface ConfigOperations {
|
|
|
2421
2423
|
*
|
|
2422
2424
|
* Wraps: `git config --get-all <key>`
|
|
2423
2425
|
*/
|
|
2424
|
-
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<
|
|
2426
|
+
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K][]>;
|
|
2425
2427
|
/**
|
|
2426
2428
|
* Set a typed config value
|
|
2427
2429
|
*
|
|
@@ -2447,7 +2449,7 @@ export interface ConfigOperations {
|
|
|
2447
2449
|
*
|
|
2448
2450
|
* @returns Config value or undefined if not set
|
|
2449
2451
|
*/
|
|
2450
|
-
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string |
|
|
2452
|
+
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | string[] | undefined>;
|
|
2451
2453
|
/**
|
|
2452
2454
|
* Set a raw config value (for arbitrary keys)
|
|
2453
2455
|
*
|
|
@@ -2465,7 +2467,7 @@ export interface ConfigOperations {
|
|
|
2465
2467
|
*
|
|
2466
2468
|
* Wraps: `git config --list`
|
|
2467
2469
|
*/
|
|
2468
|
-
list(opts?: ConfigListOpts & ExecOpts): Promise<
|
|
2470
|
+
list(opts?: ConfigListOpts & ExecOpts): Promise<ConfigEntry[]>;
|
|
2469
2471
|
/**
|
|
2470
2472
|
* Rename a config section
|
|
2471
2473
|
*
|
|
@@ -2484,19 +2486,19 @@ export interface ConfigOperations {
|
|
|
2484
2486
|
*
|
|
2485
2487
|
* Wraps: `git submodule` subcommands
|
|
2486
2488
|
*/
|
|
2487
|
-
|
|
2489
|
+
interface SubmoduleOperations {
|
|
2488
2490
|
/**
|
|
2489
2491
|
* List submodules
|
|
2490
2492
|
*
|
|
2491
2493
|
* Wraps: `git submodule status`
|
|
2492
2494
|
*/
|
|
2493
|
-
list(opts?: ExecOpts): Promise<
|
|
2495
|
+
list(opts?: ExecOpts): Promise<SubmoduleInfo[]>;
|
|
2494
2496
|
/**
|
|
2495
2497
|
* Initialize submodules
|
|
2496
2498
|
*
|
|
2497
2499
|
* Wraps: `git submodule init`
|
|
2498
2500
|
*/
|
|
2499
|
-
init(paths?:
|
|
2501
|
+
init(paths?: string[], opts?: ExecOpts): Promise<void>;
|
|
2500
2502
|
/**
|
|
2501
2503
|
* Update submodules
|
|
2502
2504
|
*
|
|
@@ -2520,7 +2522,7 @@ export interface SubmoduleOperations {
|
|
|
2520
2522
|
*
|
|
2521
2523
|
* Wraps: `git submodule status`
|
|
2522
2524
|
*/
|
|
2523
|
-
status(paths?:
|
|
2525
|
+
status(paths?: string[], opts?: SubmoduleStatusOpts & ExecOpts): Promise<string>;
|
|
2524
2526
|
/**
|
|
2525
2527
|
* Get submodule summary
|
|
2526
2528
|
*
|
|
@@ -2538,7 +2540,7 @@ export interface SubmoduleOperations {
|
|
|
2538
2540
|
*
|
|
2539
2541
|
* Wraps: `git submodule sync`
|
|
2540
2542
|
*/
|
|
2541
|
-
sync(paths?:
|
|
2543
|
+
sync(paths?: string[], opts?: SubmoduleSyncOpts & ExecOpts): Promise<void>;
|
|
2542
2544
|
/**
|
|
2543
2545
|
* Absorb git directories of submodules into the superproject
|
|
2544
2546
|
*
|
|
@@ -2565,7 +2567,7 @@ export interface SubmoduleOperations {
|
|
|
2565
2567
|
* with a working tree. Each method corresponds to a specific Git CLI command
|
|
2566
2568
|
* or subcommand.
|
|
2567
2569
|
*/
|
|
2568
|
-
|
|
2570
|
+
interface WorktreeRepo extends RepoBase {
|
|
2569
2571
|
/** Path to the working directory */
|
|
2570
2572
|
readonly workdir: string;
|
|
2571
2573
|
/**
|
|
@@ -2591,7 +2593,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2591
2593
|
* const commits = await repo.log({ maxCount: 10 });
|
|
2592
2594
|
* ```
|
|
2593
2595
|
*/
|
|
2594
|
-
log(opts?: LogOpts & ExecOpts): Promise<
|
|
2596
|
+
log(opts?: LogOpts & ExecOpts): Promise<Commit[]>;
|
|
2595
2597
|
/**
|
|
2596
2598
|
* Fetch from remote
|
|
2597
2599
|
*
|
|
@@ -2647,7 +2649,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2647
2649
|
* await repo.add('.', { all: true });
|
|
2648
2650
|
* ```
|
|
2649
2651
|
*/
|
|
2650
|
-
add(paths: string |
|
|
2652
|
+
add(paths: string | string[], opts?: AddOpts & ExecOpts): Promise<void>;
|
|
2651
2653
|
/**
|
|
2652
2654
|
* Git branch operations
|
|
2653
2655
|
*
|
|
@@ -2687,7 +2689,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2687
2689
|
* await repo.checkout(['conflicted.txt'], { ours: true });
|
|
2688
2690
|
* ```
|
|
2689
2691
|
*/
|
|
2690
|
-
checkout(paths:
|
|
2692
|
+
checkout(paths: string[], opts?: CheckoutPathOpts & ExecOpts): Promise<void>;
|
|
2691
2693
|
/**
|
|
2692
2694
|
* Create a commit
|
|
2693
2695
|
*
|
|
@@ -2757,7 +2759,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2757
2759
|
* await repo.rm('dir/', { recursive: true });
|
|
2758
2760
|
* ```
|
|
2759
2761
|
*/
|
|
2760
|
-
rm(paths: string |
|
|
2762
|
+
rm(paths: string | string[], opts?: RmOpts & ExecOpts): Promise<void>;
|
|
2761
2763
|
/**
|
|
2762
2764
|
* Git stash operations
|
|
2763
2765
|
*
|
|
@@ -2793,7 +2795,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2793
2795
|
* await repo.cherryPick(['abc123', 'def456']);
|
|
2794
2796
|
* ```
|
|
2795
2797
|
*/
|
|
2796
|
-
cherryPick(commits: string |
|
|
2798
|
+
cherryPick(commits: string | string[], opts?: CherryPickOpts & ExecOpts): Promise<void>;
|
|
2797
2799
|
/**
|
|
2798
2800
|
* Remove untracked files from the working tree
|
|
2799
2801
|
*
|
|
@@ -2804,7 +2806,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2804
2806
|
* const removed = await repo.clean({ force: true, directories: true });
|
|
2805
2807
|
* ```
|
|
2806
2808
|
*/
|
|
2807
|
-
clean(opts?: CleanOpts & ExecOpts): Promise<
|
|
2809
|
+
clean(opts?: CleanOpts & ExecOpts): Promise<string[]>;
|
|
2808
2810
|
/**
|
|
2809
2811
|
* Move or rename files
|
|
2810
2812
|
*
|
|
@@ -2839,7 +2841,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2839
2841
|
* await repo.restore(['.'], { source: 'HEAD' });
|
|
2840
2842
|
* ```
|
|
2841
2843
|
*/
|
|
2842
|
-
restore(paths: string |
|
|
2844
|
+
restore(paths: string | string[], opts?: RestoreOpts & ExecOpts): Promise<void>;
|
|
2843
2845
|
/**
|
|
2844
2846
|
* Revert existing commits
|
|
2845
2847
|
*
|
|
@@ -2851,7 +2853,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2851
2853
|
* await repo.revert(['abc123', 'def456'], { noCommit: true });
|
|
2852
2854
|
* ```
|
|
2853
2855
|
*/
|
|
2854
|
-
revert(commits: string |
|
|
2856
|
+
revert(commits: string | string[], opts?: RevertOpts & ExecOpts): Promise<void>;
|
|
2855
2857
|
/**
|
|
2856
2858
|
* Show various types of objects
|
|
2857
2859
|
*
|
|
@@ -2934,7 +2936,7 @@ export interface WorktreeRepo extends RepoBase {
|
|
|
2934
2936
|
* A bare repository contains only the Git data without a working tree.
|
|
2935
2937
|
* Typically used for shared/server repositories.
|
|
2936
2938
|
*/
|
|
2937
|
-
|
|
2939
|
+
interface BareRepo extends RepoBase {
|
|
2938
2940
|
/** Path to the git directory */
|
|
2939
2941
|
readonly gitDir: string;
|
|
2940
2942
|
/**
|
|
@@ -2962,4 +2964,686 @@ export interface BareRepo extends RepoBase {
|
|
|
2962
2964
|
*/
|
|
2963
2965
|
config: ConfigOperations;
|
|
2964
2966
|
}
|
|
2965
|
-
|
|
2967
|
+
|
|
2968
|
+
/**
|
|
2969
|
+
* Core Git interface - repository-agnostic operations
|
|
2970
|
+
*/
|
|
2971
|
+
|
|
2972
|
+
/**
|
|
2973
|
+
* Options for git clone
|
|
2974
|
+
*/
|
|
2975
|
+
type CloneOpts = {
|
|
2976
|
+
bare?: boolean;
|
|
2977
|
+
depth?: number;
|
|
2978
|
+
branch?: string;
|
|
2979
|
+
singleBranch?: boolean;
|
|
2980
|
+
mirror?: boolean;
|
|
2981
|
+
noCheckout?: boolean;
|
|
2982
|
+
recurseSubmodules?: boolean;
|
|
2983
|
+
/** Store .git directory at specified path instead of inside the repository */
|
|
2984
|
+
separateGitDir?: string;
|
|
2985
|
+
/**
|
|
2986
|
+
* Whether to clean up the target directory if the operation is aborted.
|
|
2987
|
+
* @default true
|
|
2988
|
+
*/
|
|
2989
|
+
cleanupOnAbort?: boolean;
|
|
2990
|
+
/** Be more verbose */
|
|
2991
|
+
verbose?: boolean;
|
|
2992
|
+
/** Operate quietly (suppress progress reporting) */
|
|
2993
|
+
quiet?: boolean;
|
|
2994
|
+
/** Reject cloning a shallow repository */
|
|
2995
|
+
rejectShallow?: boolean;
|
|
2996
|
+
/** Clone from a local repository (use hard links) */
|
|
2997
|
+
local?: boolean;
|
|
2998
|
+
/** Don't use hard links for local clone */
|
|
2999
|
+
noHardlinks?: boolean;
|
|
3000
|
+
/** Share objects with a reference repository */
|
|
3001
|
+
shared?: boolean;
|
|
3002
|
+
/** Number of submodules to clone in parallel */
|
|
3003
|
+
jobs?: number;
|
|
3004
|
+
/** Directory with templates for the new repository */
|
|
3005
|
+
template?: string;
|
|
3006
|
+
/** Reference repository for object sharing */
|
|
3007
|
+
reference?: string;
|
|
3008
|
+
/** Reference repository if available (no error if not) */
|
|
3009
|
+
referenceIfAble?: string;
|
|
3010
|
+
/** Disconnect from reference repository after clone */
|
|
3011
|
+
dissociate?: boolean;
|
|
3012
|
+
/** Name of the remote (default: origin) */
|
|
3013
|
+
origin?: string;
|
|
3014
|
+
/** Create a shallow clone with commits since the specified date */
|
|
3015
|
+
shallowSince?: string | Date;
|
|
3016
|
+
/** Create a shallow clone excluding commits reachable from specified revision */
|
|
3017
|
+
shallowExclude?: string | string[];
|
|
3018
|
+
/** Don't clone any tags, and make later fetches not follow them */
|
|
3019
|
+
noTags?: boolean;
|
|
3020
|
+
/** Also clone submodules shallowly */
|
|
3021
|
+
shallowSubmodules?: boolean;
|
|
3022
|
+
/** Set config options for the new repository */
|
|
3023
|
+
config?: Record<string, string>;
|
|
3024
|
+
/** Use IPv4 addresses only */
|
|
3025
|
+
ipv4?: boolean;
|
|
3026
|
+
/** Use IPv6 addresses only */
|
|
3027
|
+
ipv6?: boolean;
|
|
3028
|
+
/** A partial clone filter specification (e.g., 'blob:none') */
|
|
3029
|
+
filter?: string;
|
|
3030
|
+
/** Also apply the partial clone filter to submodules */
|
|
3031
|
+
alsoFilterSubmodules?: boolean;
|
|
3032
|
+
/** Clone submodules from their remote tracking branch */
|
|
3033
|
+
remoteSubmodules?: boolean;
|
|
3034
|
+
/** Initialize sparse-checkout (clone only root files initially) */
|
|
3035
|
+
sparse?: boolean;
|
|
3036
|
+
};
|
|
3037
|
+
/**
|
|
3038
|
+
* Options for git init
|
|
3039
|
+
*/
|
|
3040
|
+
type InitOpts = {
|
|
3041
|
+
bare?: boolean;
|
|
3042
|
+
initialBranch?: string;
|
|
3043
|
+
/** Store .git directory at specified path instead of inside the repository */
|
|
3044
|
+
separateGitDir?: string;
|
|
3045
|
+
/**
|
|
3046
|
+
* Whether to clean up the target directory if the operation is aborted.
|
|
3047
|
+
* @default true
|
|
3048
|
+
*/
|
|
3049
|
+
cleanupOnAbort?: boolean;
|
|
3050
|
+
/** Directory with templates for the new repository */
|
|
3051
|
+
template?: string;
|
|
3052
|
+
/**
|
|
3053
|
+
* Set repository sharing level
|
|
3054
|
+
* - 'group': Group writable
|
|
3055
|
+
* - 'all'/'world'/'everybody': World readable
|
|
3056
|
+
* - number: Octal permissions
|
|
3057
|
+
*/
|
|
3058
|
+
shared?: boolean | 'group' | 'all' | 'world' | 'everybody' | number;
|
|
3059
|
+
/** Operate quietly (suppress output) */
|
|
3060
|
+
quiet?: boolean;
|
|
3061
|
+
/** Specify the hash algorithm to use (sha1 or sha256) */
|
|
3062
|
+
objectFormat?: 'sha1' | 'sha256';
|
|
3063
|
+
};
|
|
3064
|
+
/**
|
|
3065
|
+
* Options for git ls-remote
|
|
3066
|
+
*/
|
|
3067
|
+
type LsRemoteOpts = {
|
|
3068
|
+
/** Limit to refs/heads (branches) */
|
|
3069
|
+
heads?: boolean;
|
|
3070
|
+
/** Limit to refs/tags */
|
|
3071
|
+
tags?: boolean;
|
|
3072
|
+
/** Show only actual refs (not peeled tags) */
|
|
3073
|
+
refs?: boolean;
|
|
3074
|
+
/** Show remote URL instead of listing refs */
|
|
3075
|
+
getUrl?: boolean;
|
|
3076
|
+
/** Sort refs by the given key (e.g., 'version:refname') */
|
|
3077
|
+
sort?: string;
|
|
3078
|
+
/** Show symbolic refs in addition to object refs */
|
|
3079
|
+
symref?: boolean;
|
|
3080
|
+
};
|
|
3081
|
+
/**
|
|
3082
|
+
* Result from git ls-remote
|
|
3083
|
+
*/
|
|
3084
|
+
type LsRemoteResult = {
|
|
3085
|
+
refs: Array<{
|
|
3086
|
+
hash: string;
|
|
3087
|
+
name: string;
|
|
3088
|
+
}>;
|
|
3089
|
+
};
|
|
3090
|
+
/**
|
|
3091
|
+
* Options for global LFS install
|
|
3092
|
+
*
|
|
3093
|
+
* Used with `git.lfs.install()` for user-level (~/.gitconfig) or
|
|
3094
|
+
* system-level (/etc/gitconfig) LFS configuration.
|
|
3095
|
+
*
|
|
3096
|
+
* @remarks
|
|
3097
|
+
* Internally runs `git lfs install` without `--local` flag.
|
|
3098
|
+
* For repository-level installation, use `repo.lfs.install()` instead.
|
|
3099
|
+
*/
|
|
3100
|
+
type GlobalLfsInstallOpts = {
|
|
3101
|
+
/** Overwrite existing hooks */
|
|
3102
|
+
force?: boolean;
|
|
3103
|
+
/**
|
|
3104
|
+
* Install for all users (system-wide)
|
|
3105
|
+
*
|
|
3106
|
+
* @remarks
|
|
3107
|
+
* Internally adds `--system` flag to install to /etc/gitconfig
|
|
3108
|
+
* instead of ~/.gitconfig. Requires appropriate permissions.
|
|
3109
|
+
*/
|
|
3110
|
+
system?: boolean;
|
|
3111
|
+
/** Skip smudge filter (don't download during checkout) */
|
|
3112
|
+
skipSmudge?: boolean;
|
|
3113
|
+
/** Skip repository setup (only install filters) */
|
|
3114
|
+
skipRepo?: boolean;
|
|
3115
|
+
/** Print commands instead of executing */
|
|
3116
|
+
manual?: boolean;
|
|
3117
|
+
};
|
|
3118
|
+
/**
|
|
3119
|
+
* Options for global LFS uninstall
|
|
3120
|
+
*
|
|
3121
|
+
* Used with `git.lfs.uninstall()` for user-level or system-level
|
|
3122
|
+
* LFS configuration removal.
|
|
3123
|
+
*
|
|
3124
|
+
* @remarks
|
|
3125
|
+
* Internally runs `git lfs uninstall` without `--local` flag.
|
|
3126
|
+
* For repository-level uninstallation, use `repo.lfs.uninstall()` instead.
|
|
3127
|
+
*/
|
|
3128
|
+
type GlobalLfsUninstallOpts = {
|
|
3129
|
+
/**
|
|
3130
|
+
* Uninstall for all users (system-wide)
|
|
3131
|
+
*
|
|
3132
|
+
* @remarks
|
|
3133
|
+
* Internally adds `--system` flag to modify /etc/gitconfig
|
|
3134
|
+
* instead of ~/.gitconfig. Requires appropriate permissions.
|
|
3135
|
+
*/
|
|
3136
|
+
system?: boolean;
|
|
3137
|
+
/** Skip repository cleanup */
|
|
3138
|
+
skipRepo?: boolean;
|
|
3139
|
+
};
|
|
3140
|
+
/**
|
|
3141
|
+
* Global LFS operations
|
|
3142
|
+
*
|
|
3143
|
+
* Wraps: `git lfs` subcommands for user-level configuration
|
|
3144
|
+
*
|
|
3145
|
+
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3146
|
+
* For repository-level LFS operations, use repo.lfs instead.
|
|
3147
|
+
*/
|
|
3148
|
+
interface GlobalLfsOperations {
|
|
3149
|
+
/**
|
|
3150
|
+
* Install Git LFS hooks globally
|
|
3151
|
+
*
|
|
3152
|
+
* Wraps: `git lfs install`
|
|
3153
|
+
*
|
|
3154
|
+
* Sets up the clean and smudge filters under the name "lfs" in the
|
|
3155
|
+
* global Git config (~/.gitconfig) or system config (/etc/gitconfig).
|
|
3156
|
+
*
|
|
3157
|
+
* @example
|
|
3158
|
+
* ```typescript
|
|
3159
|
+
* // Install globally (to ~/.gitconfig)
|
|
3160
|
+
* await git.lfs.install();
|
|
3161
|
+
*
|
|
3162
|
+
* // Install system-wide (to /etc/gitconfig)
|
|
3163
|
+
* await git.lfs.install({ system: true });
|
|
3164
|
+
*
|
|
3165
|
+
* // Install with skip-smudge (manual LFS pull required)
|
|
3166
|
+
* await git.lfs.install({ skipSmudge: true });
|
|
3167
|
+
* ```
|
|
3168
|
+
*/
|
|
3169
|
+
install(opts?: GlobalLfsInstallOpts & ExecOpts): Promise<void>;
|
|
3170
|
+
/**
|
|
3171
|
+
* Uninstall Git LFS hooks globally
|
|
3172
|
+
*
|
|
3173
|
+
* Wraps: `git lfs uninstall`
|
|
3174
|
+
*
|
|
3175
|
+
* Removes the clean and smudge filters from global or system config.
|
|
3176
|
+
*
|
|
3177
|
+
* @example
|
|
3178
|
+
* ```typescript
|
|
3179
|
+
* // Uninstall from global config
|
|
3180
|
+
* await git.lfs.uninstall();
|
|
3181
|
+
*
|
|
3182
|
+
* // Uninstall from system config
|
|
3183
|
+
* await git.lfs.uninstall({ system: true });
|
|
3184
|
+
* ```
|
|
3185
|
+
*/
|
|
3186
|
+
uninstall(opts?: GlobalLfsUninstallOpts & ExecOpts): Promise<void>;
|
|
3187
|
+
/**
|
|
3188
|
+
* Get Git LFS version
|
|
3189
|
+
*
|
|
3190
|
+
* Wraps: `git lfs version`
|
|
3191
|
+
*
|
|
3192
|
+
* @returns LFS version string (e.g., "git-lfs/3.4.0")
|
|
3193
|
+
*/
|
|
3194
|
+
version(opts?: ExecOpts): Promise<string>;
|
|
3195
|
+
}
|
|
3196
|
+
/**
|
|
3197
|
+
* Options for global config list
|
|
3198
|
+
*/
|
|
3199
|
+
type GlobalConfigListOpts = {
|
|
3200
|
+
/** Show origin of each value */
|
|
3201
|
+
showOrigin?: boolean;
|
|
3202
|
+
/** Show scope of each value */
|
|
3203
|
+
showScope?: boolean;
|
|
3204
|
+
};
|
|
3205
|
+
/**
|
|
3206
|
+
* Global config operations
|
|
3207
|
+
*
|
|
3208
|
+
* Wraps: `git config --global` subcommands
|
|
3209
|
+
*
|
|
3210
|
+
* Operates on ~/.gitconfig (user-level configuration).
|
|
3211
|
+
* Uses the same typed ConfigSchema as repository-level config.
|
|
3212
|
+
*/
|
|
3213
|
+
interface GlobalConfigOperations {
|
|
3214
|
+
/**
|
|
3215
|
+
* Get a typed global config value
|
|
3216
|
+
*
|
|
3217
|
+
* Wraps: `git config --global --get <key>`
|
|
3218
|
+
*
|
|
3219
|
+
* @returns Config value or undefined if not set
|
|
3220
|
+
*/
|
|
3221
|
+
get<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K] | undefined>;
|
|
3222
|
+
/**
|
|
3223
|
+
* Get all values for a typed multi-valued global config key
|
|
3224
|
+
*
|
|
3225
|
+
* Wraps: `git config --global --get-all <key>`
|
|
3226
|
+
*/
|
|
3227
|
+
getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K][]>;
|
|
3228
|
+
/**
|
|
3229
|
+
* Set a typed global config value
|
|
3230
|
+
*
|
|
3231
|
+
* Wraps: `git config --global <key> <value>`
|
|
3232
|
+
*/
|
|
3233
|
+
set<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
3234
|
+
/**
|
|
3235
|
+
* Add a value to a typed multi-valued global config key
|
|
3236
|
+
*
|
|
3237
|
+
* Wraps: `git config --global --add <key> <value>`
|
|
3238
|
+
*/
|
|
3239
|
+
add<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
|
|
3240
|
+
/**
|
|
3241
|
+
* Unset a typed global config value
|
|
3242
|
+
*
|
|
3243
|
+
* Wraps: `git config --global --unset <key>`
|
|
3244
|
+
*/
|
|
3245
|
+
unset<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<void>;
|
|
3246
|
+
/**
|
|
3247
|
+
* Get a raw global config value (for arbitrary keys)
|
|
3248
|
+
*
|
|
3249
|
+
* Wraps: `git config --global --get <key>`
|
|
3250
|
+
*
|
|
3251
|
+
* @returns Config value or undefined if not set
|
|
3252
|
+
*/
|
|
3253
|
+
getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | string[] | undefined>;
|
|
3254
|
+
/**
|
|
3255
|
+
* Set a raw global config value (for arbitrary keys)
|
|
3256
|
+
*
|
|
3257
|
+
* Wraps: `git config --global <key> <value>`
|
|
3258
|
+
*/
|
|
3259
|
+
setRaw(key: string, value: string, opts?: ConfigSetOpts & ExecOpts): Promise<void>;
|
|
3260
|
+
/**
|
|
3261
|
+
* Unset a raw global config value (for arbitrary keys)
|
|
3262
|
+
*
|
|
3263
|
+
* Wraps: `git config --global --unset <key>`
|
|
3264
|
+
*/
|
|
3265
|
+
unsetRaw(key: string, opts?: ExecOpts): Promise<void>;
|
|
3266
|
+
/**
|
|
3267
|
+
* List all global config values
|
|
3268
|
+
*
|
|
3269
|
+
* Wraps: `git config --global --list`
|
|
3270
|
+
*/
|
|
3271
|
+
list(opts?: GlobalConfigListOpts & ExecOpts): Promise<ConfigEntry[]>;
|
|
3272
|
+
}
|
|
3273
|
+
/**
|
|
3274
|
+
* Main Git interface for repository-agnostic operations
|
|
3275
|
+
*
|
|
3276
|
+
* Provides type-safe wrappers for Git commands that don't require a repository context.
|
|
3277
|
+
* Each method corresponds to a specific Git CLI command.
|
|
3278
|
+
*/
|
|
3279
|
+
interface Git {
|
|
3280
|
+
/**
|
|
3281
|
+
* Open an existing worktree repository
|
|
3282
|
+
*
|
|
3283
|
+
* This is the most common use case. Throws GitError if the repository is bare.
|
|
3284
|
+
*
|
|
3285
|
+
* @param path - Path to the repository working directory
|
|
3286
|
+
* @param opts - Environment isolation and credential options
|
|
3287
|
+
* @returns WorktreeRepo
|
|
3288
|
+
* @throws GitError with kind 'NotWorktreeRepo' if the repository is bare
|
|
3289
|
+
*/
|
|
3290
|
+
open(path: string, opts?: GitOpenOptions): Promise<WorktreeRepo>;
|
|
3291
|
+
/**
|
|
3292
|
+
* Open an existing bare repository
|
|
3293
|
+
*
|
|
3294
|
+
* Throws GitError if the repository is not bare.
|
|
3295
|
+
*
|
|
3296
|
+
* @param path - Path to the bare repository (git-dir)
|
|
3297
|
+
* @param opts - Environment isolation and credential options
|
|
3298
|
+
* @returns BareRepo
|
|
3299
|
+
* @throws GitError with kind 'NotBareRepo' if the repository is not bare
|
|
3300
|
+
*/
|
|
3301
|
+
openBare(path: string, opts?: GitOpenOptions): Promise<BareRepo>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Open an existing repository without type guarantee
|
|
3304
|
+
*
|
|
3305
|
+
* Returns either WorktreeRepo or BareRepo depending on the repository type.
|
|
3306
|
+
* Use this when you don't know the repository type at compile time.
|
|
3307
|
+
* You can use `isWorktree()` or `isBare()` methods for runtime type checking.
|
|
3308
|
+
*
|
|
3309
|
+
* @param path - Path to the repository (workdir or git-dir)
|
|
3310
|
+
* @param opts - Environment isolation and credential options
|
|
3311
|
+
* @returns WorktreeRepo or BareRepo depending on repository type
|
|
3312
|
+
*
|
|
3313
|
+
* @example
|
|
3314
|
+
* ```typescript
|
|
3315
|
+
* const repo = await git.openRaw('/path/to/repo');
|
|
3316
|
+
* if (await repo.isWorktree()) {
|
|
3317
|
+
* // repo is WorktreeRepo at runtime
|
|
3318
|
+
* const status = await (repo as WorktreeRepo).status();
|
|
3319
|
+
* } else if (await repo.isBare()) {
|
|
3320
|
+
* // repo is BareRepo at runtime
|
|
3321
|
+
* await (repo as BareRepo).fetch({ remote: 'origin' });
|
|
3322
|
+
* }
|
|
3323
|
+
* ```
|
|
3324
|
+
*/
|
|
3325
|
+
openRaw(path: string, opts?: GitOpenOptions): Promise<WorktreeRepo | BareRepo>;
|
|
3326
|
+
/**
|
|
3327
|
+
* Clone a repository
|
|
3328
|
+
*
|
|
3329
|
+
* Wraps: `git clone <url> <path>`
|
|
3330
|
+
*
|
|
3331
|
+
* The return type depends on the `bare` or `mirror` option:
|
|
3332
|
+
* - `{ bare: true }` or `{ mirror: true }` → `BareRepo`
|
|
3333
|
+
* - Otherwise → `WorktreeRepo`
|
|
3334
|
+
*/
|
|
3335
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
3336
|
+
bare: true;
|
|
3337
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3338
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
3339
|
+
mirror: true;
|
|
3340
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3341
|
+
clone(url: string, path: string, opts?: CloneOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3342
|
+
/**
|
|
3343
|
+
* Initialize a new repository
|
|
3344
|
+
*
|
|
3345
|
+
* Wraps: `git init <path>`
|
|
3346
|
+
*
|
|
3347
|
+
* The return type depends on the `bare` option:
|
|
3348
|
+
* - `{ bare: true }` → `BareRepo`
|
|
3349
|
+
* - Otherwise → `WorktreeRepo`
|
|
3350
|
+
*/
|
|
3351
|
+
init(path: string, opts: InitOpts & {
|
|
3352
|
+
bare: true;
|
|
3353
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3354
|
+
init(path: string, opts?: InitOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3355
|
+
/**
|
|
3356
|
+
* List references in a remote repository
|
|
3357
|
+
*
|
|
3358
|
+
* Wraps: `git ls-remote <url>`
|
|
3359
|
+
*/
|
|
3360
|
+
lsRemote(url: string, opts?: LsRemoteOpts & ExecOpts): Promise<LsRemoteResult>;
|
|
3361
|
+
/**
|
|
3362
|
+
* Get git version
|
|
3363
|
+
*
|
|
3364
|
+
* Wraps: `git --version`
|
|
3365
|
+
*/
|
|
3366
|
+
version(opts?: ExecOpts): Promise<string>;
|
|
3367
|
+
/**
|
|
3368
|
+
* Execute a raw git command (repository-agnostic)
|
|
3369
|
+
*
|
|
3370
|
+
* Wraps: `git <argv...>`
|
|
3371
|
+
*/
|
|
3372
|
+
raw(argv: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
3373
|
+
/**
|
|
3374
|
+
* Global config operations
|
|
3375
|
+
*
|
|
3376
|
+
* Wraps: `git config --global` subcommands
|
|
3377
|
+
*
|
|
3378
|
+
* Operates on ~/.gitconfig (user-level configuration).
|
|
3379
|
+
* For repository-level config, use repo.config instead.
|
|
3380
|
+
*/
|
|
3381
|
+
config: GlobalConfigOperations;
|
|
3382
|
+
/**
|
|
3383
|
+
* Global LFS operations
|
|
3384
|
+
*
|
|
3385
|
+
* Wraps: `git lfs` subcommands for user-level configuration
|
|
3386
|
+
*
|
|
3387
|
+
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3388
|
+
* For repository-level LFS operations, use repo.lfs instead.
|
|
3389
|
+
*/
|
|
3390
|
+
lfs: GlobalLfsOperations;
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
/**
|
|
3394
|
+
* CLI Runner - Core execution engine for Git commands
|
|
3395
|
+
*
|
|
3396
|
+
* This module provides:
|
|
3397
|
+
* - CliRunner: Executes Git commands with progress tracking and abort support
|
|
3398
|
+
* - Progress collection from stderr (Git and LFS)
|
|
3399
|
+
* - Error mapping from Git exit codes
|
|
3400
|
+
*/
|
|
3401
|
+
|
|
3402
|
+
/**
|
|
3403
|
+
* Credential helper configuration
|
|
3404
|
+
*/
|
|
3405
|
+
type CredentialHelperConfig = {
|
|
3406
|
+
/** Helper name (e.g., 'store', 'cache', 'manager-core', or custom name) */
|
|
3407
|
+
helper?: string;
|
|
3408
|
+
/** Path to custom helper binary */
|
|
3409
|
+
helperPath?: string;
|
|
3410
|
+
};
|
|
3411
|
+
/**
|
|
3412
|
+
* Options for CliRunner
|
|
3413
|
+
*/
|
|
3414
|
+
type CliRunnerOptions = {
|
|
3415
|
+
/** Git binary path (default: 'git') */
|
|
3416
|
+
gitBinary?: string;
|
|
3417
|
+
/** Additional environment variables */
|
|
3418
|
+
env?: Record<string, string>;
|
|
3419
|
+
/** Directories to prepend to PATH */
|
|
3420
|
+
pathPrefix?: string[];
|
|
3421
|
+
/** Custom HOME directory for git config isolation */
|
|
3422
|
+
home?: string;
|
|
3423
|
+
/** Credential helper configuration */
|
|
3424
|
+
credential?: CredentialHelperConfig;
|
|
3425
|
+
};
|
|
3426
|
+
/**
|
|
3427
|
+
* CLI Runner for executing Git commands
|
|
3428
|
+
*
|
|
3429
|
+
* Handles:
|
|
3430
|
+
* - Command construction based on execution context
|
|
3431
|
+
* - Progress tracking from stderr (Git and LFS)
|
|
3432
|
+
* - Abort signal handling
|
|
3433
|
+
* - Error mapping
|
|
3434
|
+
*/
|
|
3435
|
+
declare class CliRunner {
|
|
3436
|
+
private readonly exec;
|
|
3437
|
+
private readonly gitBinary;
|
|
3438
|
+
private readonly baseEnv;
|
|
3439
|
+
private readonly pathPrefix;
|
|
3440
|
+
private readonly home;
|
|
3441
|
+
private readonly credential;
|
|
3442
|
+
constructor(adapters: RuntimeAdapters, options?: CliRunnerOptions);
|
|
3443
|
+
/**
|
|
3444
|
+
* Create a new CliRunner with additional options merged
|
|
3445
|
+
*
|
|
3446
|
+
* Used to create a runner for a specific repository with custom environment
|
|
3447
|
+
*/
|
|
3448
|
+
withOptions(options: CliRunnerOptions): CliRunner;
|
|
3449
|
+
/**
|
|
3450
|
+
* Build command argv based on execution context
|
|
3451
|
+
*/
|
|
3452
|
+
private buildArgv;
|
|
3453
|
+
/**
|
|
3454
|
+
* Build the effective environment for command execution
|
|
3455
|
+
*
|
|
3456
|
+
* Applies home directory and PATH prefix overrides
|
|
3457
|
+
*/
|
|
3458
|
+
private buildEnv;
|
|
3459
|
+
/**
|
|
3460
|
+
* Extract directory from a file path
|
|
3461
|
+
*/
|
|
3462
|
+
private extractDirectory;
|
|
3463
|
+
/**
|
|
3464
|
+
* Run a Git command
|
|
3465
|
+
*/
|
|
3466
|
+
run(context: ExecutionContext, args: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
3467
|
+
/**
|
|
3468
|
+
* Map Git result to GitError if needed
|
|
3469
|
+
*/
|
|
3470
|
+
mapError(result: RawResult, context: ExecutionContext, argv: string[]): GitError | null;
|
|
3471
|
+
/**
|
|
3472
|
+
* Classify error type based on stderr content
|
|
3473
|
+
*/
|
|
3474
|
+
private classifyError;
|
|
3475
|
+
/**
|
|
3476
|
+
* Extract user-friendly error message from stderr
|
|
3477
|
+
*/
|
|
3478
|
+
private extractErrorMessage;
|
|
3479
|
+
/**
|
|
3480
|
+
* Run a command and throw on error
|
|
3481
|
+
*/
|
|
3482
|
+
runOrThrow(context: ExecutionContext, args: string[], opts?: ExecOpts): Promise<RawResult>;
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
/**
|
|
3486
|
+
* Git implementation - repository-agnostic operations
|
|
3487
|
+
*/
|
|
3488
|
+
|
|
3489
|
+
/**
|
|
3490
|
+
* Options for creating a Git instance
|
|
3491
|
+
*/
|
|
3492
|
+
type CreateGitOptions = CliRunnerOptions & {
|
|
3493
|
+
/** Runtime adapters (exec, fs) */
|
|
3494
|
+
adapters: RuntimeAdapters;
|
|
3495
|
+
};
|
|
3496
|
+
/**
|
|
3497
|
+
* Create a new Git instance
|
|
3498
|
+
*
|
|
3499
|
+
* @param options - Creation options including runtime adapters
|
|
3500
|
+
* @returns Git instance
|
|
3501
|
+
*/
|
|
3502
|
+
declare function createGit(options: CreateGitOptions): Git;
|
|
3503
|
+
|
|
3504
|
+
/**
|
|
3505
|
+
* Node.js ExecAdapter implementation
|
|
3506
|
+
*/
|
|
3507
|
+
|
|
3508
|
+
declare class NodeExecAdapter implements ExecAdapter {
|
|
3509
|
+
getCapabilities(): Capabilities;
|
|
3510
|
+
spawn(options: SpawnOptions, handlers?: StreamHandler): Promise<SpawnResult>;
|
|
3511
|
+
spawnStreaming(options: SpawnOptions): SpawnHandle;
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
/**
|
|
3515
|
+
* Node.js FsAdapter implementation
|
|
3516
|
+
*/
|
|
3517
|
+
|
|
3518
|
+
declare class NodeFsAdapter implements FsAdapter {
|
|
3519
|
+
createTempFile(prefix?: string): Promise<string>;
|
|
3520
|
+
tail(options: TailOptions): Promise<void>;
|
|
3521
|
+
deleteFile(filePath: string): Promise<void>;
|
|
3522
|
+
deleteDirectory(dirPath: string): Promise<void>;
|
|
3523
|
+
exists(filePath: string): Promise<boolean>;
|
|
3524
|
+
readFile(filePath: string): Promise<string>;
|
|
3525
|
+
writeFile(filePath: string, contents: string): Promise<void>;
|
|
3526
|
+
tailStreaming(filePath: string, options?: {
|
|
3527
|
+
signal?: AbortSignal;
|
|
3528
|
+
pollInterval?: number;
|
|
3529
|
+
}): TailHandle;
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
/**
|
|
3533
|
+
* Node.js adapter exports
|
|
3534
|
+
*/
|
|
3535
|
+
|
|
3536
|
+
/**
|
|
3537
|
+
* Create Node.js runtime adapters
|
|
3538
|
+
*/
|
|
3539
|
+
declare function createNodeAdapters(): RuntimeAdapters;
|
|
3540
|
+
/**
|
|
3541
|
+
* Options for creating a TypeGit instance (Node.js)
|
|
3542
|
+
* Excludes adapters as they are automatically configured
|
|
3543
|
+
*/
|
|
3544
|
+
type TypeGitOptions = Omit<CreateGitOptions, 'adapters'>;
|
|
3545
|
+
/**
|
|
3546
|
+
* Pre-configured Git client for Node.js
|
|
3547
|
+
*
|
|
3548
|
+
* This is a convenience class that automatically configures Node.js adapters.
|
|
3549
|
+
*
|
|
3550
|
+
* @example
|
|
3551
|
+
* ```typescript
|
|
3552
|
+
* import { TypeGit } from 'type-git/node';
|
|
3553
|
+
*
|
|
3554
|
+
* const git = new TypeGit();
|
|
3555
|
+
* const repo = await git.open('/path/to/repo');
|
|
3556
|
+
* ```
|
|
3557
|
+
*/
|
|
3558
|
+
declare class TypeGit {
|
|
3559
|
+
private readonly git;
|
|
3560
|
+
constructor(options?: TypeGitOptions);
|
|
3561
|
+
/**
|
|
3562
|
+
* Open an existing worktree repository
|
|
3563
|
+
*
|
|
3564
|
+
* This is the most common use case. Throws GitError if the repository is bare.
|
|
3565
|
+
*
|
|
3566
|
+
* @throws GitError with kind 'NotWorktreeRepo' if the repository is bare
|
|
3567
|
+
*/
|
|
3568
|
+
get open(): (path: string, opts?: GitOpenOptions) => Promise<WorktreeRepo>;
|
|
3569
|
+
/**
|
|
3570
|
+
* Open an existing bare repository
|
|
3571
|
+
*
|
|
3572
|
+
* Throws GitError if the repository is not bare.
|
|
3573
|
+
*
|
|
3574
|
+
* @throws GitError with kind 'NotBareRepo' if the repository is not bare
|
|
3575
|
+
*/
|
|
3576
|
+
get openBare(): (path: string, opts?: GitOpenOptions) => Promise<BareRepo>;
|
|
3577
|
+
/**
|
|
3578
|
+
* Open an existing repository without type guarantee
|
|
3579
|
+
*
|
|
3580
|
+
* Returns either WorktreeRepo or BareRepo depending on the repository type.
|
|
3581
|
+
* Use this when you don't know the repository type at compile time.
|
|
3582
|
+
*/
|
|
3583
|
+
get openRaw(): (path: string, opts?: GitOpenOptions) => Promise<WorktreeRepo | BareRepo>;
|
|
3584
|
+
/**
|
|
3585
|
+
* Clone a repository
|
|
3586
|
+
*
|
|
3587
|
+
* The return type depends on the `bare` or `mirror` option:
|
|
3588
|
+
* - `{ bare: true }` or `{ mirror: true }` → `BareRepo`
|
|
3589
|
+
* - Otherwise → `WorktreeRepo`
|
|
3590
|
+
*/
|
|
3591
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
3592
|
+
bare: true;
|
|
3593
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3594
|
+
clone(url: string, path: string, opts: CloneOpts & {
|
|
3595
|
+
mirror: true;
|
|
3596
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3597
|
+
clone(url: string, path: string, opts?: CloneOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3598
|
+
/**
|
|
3599
|
+
* Initialize a new repository
|
|
3600
|
+
*
|
|
3601
|
+
* The return type depends on the `bare` option:
|
|
3602
|
+
* - `{ bare: true }` → `BareRepo`
|
|
3603
|
+
* - Otherwise → `WorktreeRepo`
|
|
3604
|
+
*/
|
|
3605
|
+
init(path: string, opts: InitOpts & {
|
|
3606
|
+
bare: true;
|
|
3607
|
+
} & ExecOpts): Promise<BareRepo>;
|
|
3608
|
+
init(path: string, opts?: InitOpts & ExecOpts): Promise<WorktreeRepo>;
|
|
3609
|
+
/**
|
|
3610
|
+
* List references in a remote repository
|
|
3611
|
+
*/
|
|
3612
|
+
get lsRemote(): (url: string, opts?: LsRemoteOpts & ExecOpts) => Promise<LsRemoteResult>;
|
|
3613
|
+
/**
|
|
3614
|
+
* Get git version
|
|
3615
|
+
*/
|
|
3616
|
+
get version(): (opts?: ExecOpts) => Promise<string>;
|
|
3617
|
+
/**
|
|
3618
|
+
* Execute a raw git command (repository-agnostic)
|
|
3619
|
+
*/
|
|
3620
|
+
get raw(): (argv: string[], opts?: ExecOpts) => Promise<RawResult>;
|
|
3621
|
+
/**
|
|
3622
|
+
* Global config operations
|
|
3623
|
+
*
|
|
3624
|
+
* Operates on ~/.gitconfig (user-level configuration).
|
|
3625
|
+
* For repository-level config, use repo.config instead.
|
|
3626
|
+
*/
|
|
3627
|
+
get config(): GlobalConfigOperations;
|
|
3628
|
+
/**
|
|
3629
|
+
* Global LFS operations
|
|
3630
|
+
*
|
|
3631
|
+
* Operates on ~/.gitconfig (user-level) or /etc/gitconfig (system-level).
|
|
3632
|
+
* For repository-level LFS operations, use repo.lfs instead.
|
|
3633
|
+
*
|
|
3634
|
+
* @example
|
|
3635
|
+
* ```typescript
|
|
3636
|
+
* // Install LFS globally
|
|
3637
|
+
* await git.lfs.install();
|
|
3638
|
+
*
|
|
3639
|
+
* // Install system-wide
|
|
3640
|
+
* await git.lfs.install({ system: true });
|
|
3641
|
+
*
|
|
3642
|
+
* // Get LFS version
|
|
3643
|
+
* const version = await git.lfs.version();
|
|
3644
|
+
* ```
|
|
3645
|
+
*/
|
|
3646
|
+
get lfs(): GlobalLfsOperations;
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
export { type CherryPickOpts as $, type AddOpts as A, type BranchInfo as B, type CreateGitOptions as C, type DiffOpts as D, type DiffEntry as E, type FetchOpts as F, type GlobalLfsInstallOpts as G, type DiffResult as H, type InitOpts as I, type MergeResult as J, type PullOpts as K, type LsRemoteOpts as L, type MergeOpts as M, NodeExecAdapter as N, type ResetOpts as O, type PushOpts as P, type RmOpts as Q, type RepoBase as R, type StatusEntry as S, type TypeGitOptions as T, type StashEntry as U, type StashPushOpts as V, type StashApplyOpts as W, type SwitchOpts as X, type TagInfo as Y, type TagListOpts as Z, type TagCreateOpts as _, CliRunner as a, type ConfigGetOpts as a$, type CleanOpts as a0, type MvOpts as a1, type RebaseOpts as a2, type RestoreOpts as a3, type RevertOpts as a4, type ShowOpts as a5, type SubmoduleOpts as a6, type SubmoduleAddOpts as a7, type SubmoduleDeinitOpts as a8, type SubmoduleStatusOpts as a9, type LfsPreUploadOpts as aA, type LfsPreUploadResult as aB, type LfsPreDownloadOpts as aC, type LfsPreDownloadResult as aD, type Worktree as aE, type WorktreeAddOpts as aF, type WorktreeRemoveOpts as aG, type WorktreePruneOpts as aH, type WorktreeMoveOpts as aI, type WorktreeRepairOpts as aJ, type WorktreeLockOpts as aK, type WorktreeOperations as aL, type LfsOperations as aM, type LfsExtraOperations as aN, type BranchOperations as aO, type StashOperations as aP, type TagOperations as aQ, type RemoteInfo as aR, type RemoteAddOpts as aS, type RemoteSetHeadOpts as aT, type RemoteShowOpts as aU, type RemotePruneOpts as aV, type RemoteUpdateOpts as aW, type RemoteSetBranchesOpts as aX, type RemoteUrlOpts as aY, type RemoteOperations as aZ, type ConfigEntry as a_, type SubmoduleSummaryOpts as aa, type SubmoduleForeachOpts as ab, type SubmoduleSyncOpts as ac, type SubmoduleSetBranchOpts as ad, type SubmoduleInfo as ae, type LfsStatus as af, type LfsPullOpts as ag, type LfsPushOpts as ah, type LfsStatusOpts as ai, type LfsPruneOpts as aj, type LfsFetchOpts as ak, type RepoLfsInstallOpts as al, type RepoLfsUninstallOpts as am, type LfsFileEntry as an, type LfsLsFilesOpts as ao, type LfsTrackEntry as ap, type LfsTrackOpts as aq, type LfsLockEntry as ar, type LfsLockOpts as as, type LfsUnlockOpts as at, type LfsLocksOpts as au, type LfsCheckoutOpts as av, type LfsMigrateInfoOpts as aw, type LfsMigrateImportOpts as ax, type LfsMigrateExportOpts as ay, type LfsEnvInfo as az, type CliRunnerOptions as b, type ConfigSetOpts as b0, type ConfigListOpts as b1, type ConfigSchema as b2, type ConfigKey as b3, type ConfigOperations as b4, type SubmoduleOperations as b5, type WorktreeRepo as b6, type BareRepo as b7, createGit as c, createNodeAdapters as d, TypeGit as e, NodeFsAdapter as f, type CloneOpts as g, type LsRemoteResult as h, type GlobalLfsUninstallOpts as i, type GlobalLfsOperations as j, type GlobalConfigListOpts as k, type GlobalConfigOperations as l, type Git as m, type StatusPorcelain as n, type StatusOpts as o, type Commit as p, type LogOpts as q, type ForceWithLeaseOpts as r, type BranchOpts as s, type BranchCreateOpts as t, type BranchDeleteOpts as u, type CheckoutBranchOpts as v, type CheckoutPathOpts as w, type CheckoutOpts as x, type CommitOpts as y, type CommitResult as z };
|