type-git 0.0.1 → 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.
Files changed (105) hide show
  1. package/README.md +3 -6
  2. package/dist/adapters/bun/index.cjs +395 -0
  3. package/dist/adapters/bun/index.cjs.map +1 -0
  4. package/dist/adapters/bun/index.d.cts +44 -0
  5. package/dist/adapters/bun/index.d.ts +38 -5
  6. package/dist/adapters/bun/index.js +362 -13
  7. package/dist/adapters/bun/index.js.map +1 -1
  8. package/dist/adapters/deno/index.cjs +443 -0
  9. package/dist/adapters/deno/index.cjs.map +1 -0
  10. package/dist/adapters/deno/index.d.cts +46 -0
  11. package/dist/adapters/deno/index.d.ts +40 -5
  12. package/dist/adapters/deno/index.js +410 -13
  13. package/dist/adapters/deno/index.js.map +1 -1
  14. package/dist/adapters/node/index.cjs +5625 -0
  15. package/dist/adapters/node/index.cjs.map +1 -0
  16. package/dist/adapters/node/index.d.cts +2 -0
  17. package/dist/adapters/node/index.d.ts +2 -61
  18. package/dist/adapters/node/index.js +5577 -68
  19. package/dist/adapters/node/index.js.map +1 -1
  20. package/dist/{core/types.d.ts → adapters-w9tZ_Qbd.d.cts} +225 -29
  21. package/dist/adapters-w9tZ_Qbd.d.ts +572 -0
  22. package/dist/index-D9acU30I.d.ts +3649 -0
  23. package/dist/index-DRd85eN5.d.cts +3649 -0
  24. package/dist/index.cjs +5744 -0
  25. package/dist/index.cjs.map +1 -0
  26. package/dist/index.d.cts +208 -0
  27. package/dist/index.d.ts +206 -7
  28. package/dist/index.js +5685 -13
  29. package/dist/index.js.map +1 -1
  30. package/package.json +19 -8
  31. package/dist/adapters/bun/exec.d.ts +0 -13
  32. package/dist/adapters/bun/exec.d.ts.map +0 -1
  33. package/dist/adapters/bun/exec.js +0 -242
  34. package/dist/adapters/bun/exec.js.map +0 -1
  35. package/dist/adapters/bun/fs.d.ts +0 -20
  36. package/dist/adapters/bun/fs.d.ts.map +0 -1
  37. package/dist/adapters/bun/fs.js +0 -148
  38. package/dist/adapters/bun/fs.js.map +0 -1
  39. package/dist/adapters/bun/index.d.ts.map +0 -1
  40. package/dist/adapters/deno/exec.d.ts +0 -14
  41. package/dist/adapters/deno/exec.d.ts.map +0 -1
  42. package/dist/adapters/deno/exec.js +0 -266
  43. package/dist/adapters/deno/exec.js.map +0 -1
  44. package/dist/adapters/deno/fs.d.ts +0 -21
  45. package/dist/adapters/deno/fs.d.ts.map +0 -1
  46. package/dist/adapters/deno/fs.js +0 -191
  47. package/dist/adapters/deno/fs.js.map +0 -1
  48. package/dist/adapters/deno/index.d.ts.map +0 -1
  49. package/dist/adapters/node/exec.d.ts +0 -11
  50. package/dist/adapters/node/exec.d.ts.map +0 -1
  51. package/dist/adapters/node/exec.js +0 -161
  52. package/dist/adapters/node/exec.js.map +0 -1
  53. package/dist/adapters/node/fs.d.ts +0 -18
  54. package/dist/adapters/node/fs.d.ts.map +0 -1
  55. package/dist/adapters/node/fs.js +0 -164
  56. package/dist/adapters/node/fs.js.map +0 -1
  57. package/dist/adapters/node/index.d.ts.map +0 -1
  58. package/dist/core/adapters.d.ts +0 -192
  59. package/dist/core/adapters.d.ts.map +0 -1
  60. package/dist/core/adapters.js +0 -10
  61. package/dist/core/adapters.js.map +0 -1
  62. package/dist/core/git.d.ts +0 -160
  63. package/dist/core/git.d.ts.map +0 -1
  64. package/dist/core/git.js +0 -5
  65. package/dist/core/git.js.map +0 -1
  66. package/dist/core/index.d.ts +0 -8
  67. package/dist/core/index.d.ts.map +0 -1
  68. package/dist/core/index.js +0 -8
  69. package/dist/core/index.js.map +0 -1
  70. package/dist/core/repo.d.ts +0 -1275
  71. package/dist/core/repo.d.ts.map +0 -1
  72. package/dist/core/repo.js +0 -5
  73. package/dist/core/repo.js.map +0 -1
  74. package/dist/core/types.d.ts.map +0 -1
  75. package/dist/core/types.js +0 -100
  76. package/dist/core/types.js.map +0 -1
  77. package/dist/impl/bare-repo-impl.d.ts +0 -72
  78. package/dist/impl/bare-repo-impl.d.ts.map +0 -1
  79. package/dist/impl/bare-repo-impl.js +0 -328
  80. package/dist/impl/bare-repo-impl.js.map +0 -1
  81. package/dist/impl/git-impl.d.ts +0 -92
  82. package/dist/impl/git-impl.d.ts.map +0 -1
  83. package/dist/impl/git-impl.js +0 -350
  84. package/dist/impl/git-impl.js.map +0 -1
  85. package/dist/impl/index.d.ts +0 -7
  86. package/dist/impl/index.d.ts.map +0 -1
  87. package/dist/impl/index.js +0 -7
  88. package/dist/impl/index.js.map +0 -1
  89. package/dist/impl/worktree-repo-impl.d.ts +0 -180
  90. package/dist/impl/worktree-repo-impl.d.ts.map +0 -1
  91. package/dist/impl/worktree-repo-impl.js +0 -1931
  92. package/dist/impl/worktree-repo-impl.js.map +0 -1
  93. package/dist/index.d.ts.map +0 -1
  94. package/dist/parsers/index.d.ts +0 -230
  95. package/dist/parsers/index.d.ts.map +0 -1
  96. package/dist/parsers/index.js +0 -529
  97. package/dist/parsers/index.js.map +0 -1
  98. package/dist/runner/cli-runner.d.ts +0 -94
  99. package/dist/runner/cli-runner.d.ts.map +0 -1
  100. package/dist/runner/cli-runner.js +0 -315
  101. package/dist/runner/cli-runner.js.map +0 -1
  102. package/dist/runner/index.d.ts +0 -5
  103. package/dist/runner/index.d.ts.map +0 -1
  104. package/dist/runner/index.js +0 -5
  105. package/dist/runner/index.js.map +0 -1
@@ -1,1275 +0,0 @@
1
- /**
2
- * Repository interfaces - operations that require a repository context
3
- */
4
- import type { ExecOpts, GitProgress, LfsMode, RawResult } from './types.js';
5
- /**
6
- * Base repository interface
7
- */
8
- export interface RepoBase {
9
- /**
10
- * Execute a raw git command in this repository context
11
- */
12
- raw(argv: Array<string>, opts?: ExecOpts): Promise<RawResult>;
13
- }
14
- /**
15
- * Status file entry
16
- */
17
- export type StatusEntry = {
18
- path: string;
19
- index: string;
20
- workdir: string;
21
- originalPath?: string;
22
- };
23
- /**
24
- * Result from git status --porcelain
25
- */
26
- export type StatusPorcelain = {
27
- entries: Array<StatusEntry>;
28
- branch?: string;
29
- upstream?: string;
30
- ahead?: number;
31
- behind?: number;
32
- };
33
- /**
34
- * Options for git status
35
- */
36
- export type StatusOpts = {
37
- porcelain?: 1 | 2;
38
- untracked?: 'no' | 'normal' | 'all';
39
- };
40
- /**
41
- * Commit information
42
- */
43
- export type Commit = {
44
- hash: string;
45
- abbrevHash: string;
46
- parents: Array<string>;
47
- author: {
48
- name: string;
49
- email: string;
50
- timestamp: number;
51
- };
52
- committer: {
53
- name: string;
54
- email: string;
55
- timestamp: number;
56
- };
57
- subject: string;
58
- body: string;
59
- };
60
- /**
61
- * Options for git log
62
- */
63
- export type LogOpts = {
64
- maxCount?: number;
65
- skip?: number;
66
- since?: string | Date;
67
- until?: string | Date;
68
- author?: string;
69
- grep?: string;
70
- all?: boolean;
71
- /** Follow only the first parent commit upon seeing a merge commit */
72
- firstParent?: boolean;
73
- };
74
- /**
75
- * Options for git fetch
76
- */
77
- export type FetchOpts = {
78
- remote?: string;
79
- refspec?: string | Array<string>;
80
- prune?: boolean;
81
- tags?: boolean;
82
- depth?: number;
83
- };
84
- /**
85
- * Force with lease options for git push
86
- */
87
- export type ForceWithLeaseOpts = {
88
- /** Reference name to check (e.g., 'refs/heads/main') */
89
- refname: string;
90
- /** Expected value of the ref (commit hash) */
91
- expect?: string;
92
- };
93
- /**
94
- * Options for git push
95
- */
96
- export type PushOpts = {
97
- remote?: string;
98
- refspec?: string | Array<string>;
99
- force?: boolean;
100
- /**
101
- * Force with lease - safer force push that fails if remote has been updated
102
- * - true: use default behavior (check current remote ref)
103
- * - ForceWithLeaseOpts: specify refname and optional expected value
104
- */
105
- forceWithLease?: boolean | ForceWithLeaseOpts;
106
- tags?: boolean;
107
- setUpstream?: boolean;
108
- /** Bypass pre-push hook */
109
- noVerify?: boolean;
110
- /**
111
- * GPG-sign the push (for signed pushes)
112
- * - true: sign with default key
113
- * - 'if-asked': sign only if server supports and requests it
114
- */
115
- signed?: boolean | 'if-asked';
116
- };
117
- /**
118
- * Options for git add
119
- */
120
- export type AddOpts = {
121
- /** Add all files (including untracked) */
122
- all?: boolean;
123
- /** Dry run - show what would be added */
124
- dryRun?: boolean;
125
- /** Add modified and deleted files, but not untracked */
126
- update?: boolean;
127
- /** Force add of ignored files */
128
- force?: boolean;
129
- /** Add changes interactively (not supported - use raw) */
130
- interactive?: never;
131
- /** Add changes in patch mode (not supported - use raw) */
132
- patch?: never;
133
- };
134
- /**
135
- * Branch information
136
- */
137
- export type BranchInfo = {
138
- name: string;
139
- current: boolean;
140
- commit: string;
141
- upstream?: string;
142
- gone?: boolean;
143
- };
144
- /**
145
- * Options for git branch
146
- */
147
- export type BranchOpts = {
148
- /** List all branches (including remote) */
149
- all?: boolean;
150
- /** List remote branches only */
151
- remotes?: boolean;
152
- /** Show verbose info */
153
- verbose?: boolean;
154
- };
155
- /**
156
- * Options for creating a branch
157
- */
158
- export type BranchCreateOpts = {
159
- /** Start point (commit, branch, or tag) */
160
- startPoint?: string;
161
- /** Force creation (overwrite existing) */
162
- force?: boolean;
163
- /** Set up tracking */
164
- track?: boolean;
165
- };
166
- /**
167
- * Options for deleting a branch
168
- */
169
- export type BranchDeleteOpts = {
170
- /** Force delete (even if not merged) */
171
- force?: boolean;
172
- /** Delete remote-tracking branch */
173
- remote?: boolean;
174
- };
175
- /**
176
- * Options for git checkout
177
- */
178
- export type CheckoutOpts = {
179
- /** Force checkout (discard local changes) */
180
- force?: boolean;
181
- /** Create new branch */
182
- createBranch?: boolean;
183
- /** Start point for new branch */
184
- startPoint?: string;
185
- /** Track remote branch */
186
- track?: boolean;
187
- };
188
- /**
189
- * Options for git commit
190
- */
191
- export type CommitOpts = {
192
- /** Commit message */
193
- message?: string;
194
- /** Allow empty commit */
195
- allowEmpty?: boolean;
196
- /** Amend previous commit */
197
- amend?: boolean;
198
- /** Add all tracked modified files */
199
- all?: boolean;
200
- /** Author name and email */
201
- author?: string;
202
- /** Override commit date */
203
- date?: string | Date;
204
- /** Do not create commit, just update message */
205
- dryRun?: boolean;
206
- /** Bypass pre-commit and commit-msg hooks */
207
- noVerify?: boolean;
208
- /** GPG-sign the commit with the default key */
209
- gpgSign?: boolean;
210
- /** Do not GPG-sign the commit (override commit.gpgSign config) */
211
- noGpgSign?: boolean;
212
- };
213
- /**
214
- * Commit result
215
- */
216
- export type CommitResult = {
217
- /** Commit hash */
218
- hash: string;
219
- /** Branch name */
220
- branch: string;
221
- /** Commit message summary */
222
- summary: string;
223
- /** Files changed */
224
- filesChanged: number;
225
- /** Insertions */
226
- insertions: number;
227
- /** Deletions */
228
- deletions: number;
229
- };
230
- /**
231
- * Options for git diff
232
- */
233
- export type DiffOpts = {
234
- /** Compare staged changes */
235
- staged?: boolean;
236
- /** Show stat only */
237
- stat?: boolean;
238
- /** Show name only */
239
- nameOnly?: boolean;
240
- /** Show name and status */
241
- nameStatus?: boolean;
242
- /** Number of context lines */
243
- context?: number;
244
- /** Ignore whitespace changes */
245
- ignoreWhitespace?: boolean;
246
- /** Pathspecs to filter */
247
- paths?: Array<string>;
248
- };
249
- /**
250
- * Diff file entry
251
- */
252
- export type DiffEntry = {
253
- path: string;
254
- status: 'A' | 'D' | 'M' | 'R' | 'C' | 'T' | 'U' | 'X';
255
- oldPath?: string;
256
- additions?: number;
257
- deletions?: number;
258
- };
259
- /**
260
- * Diff result
261
- */
262
- export type DiffResult = {
263
- files: Array<DiffEntry>;
264
- raw?: string;
265
- };
266
- /**
267
- * Options for git merge
268
- */
269
- export type MergeOpts = {
270
- /** Merge message */
271
- message?: string;
272
- /** Fast-forward behavior */
273
- ff?: 'only' | 'no' | boolean;
274
- /** Squash merge */
275
- squash?: boolean;
276
- /** No commit after merge */
277
- noCommit?: boolean;
278
- /** Strategy to use */
279
- strategy?: string;
280
- /** Strategy options */
281
- strategyOption?: string | Array<string>;
282
- /** Abort merge */
283
- abort?: boolean;
284
- /** Continue merge */
285
- continue?: boolean;
286
- /** Bypass pre-merge-commit hook */
287
- noVerify?: boolean;
288
- };
289
- /**
290
- * Merge result
291
- */
292
- export type MergeResult = {
293
- success: boolean;
294
- hash?: string;
295
- conflicts?: Array<string>;
296
- fastForward?: boolean;
297
- };
298
- /**
299
- * Options for git pull
300
- */
301
- export type PullOpts = {
302
- /** Remote name */
303
- remote?: string;
304
- /** Branch to pull */
305
- branch?: string;
306
- /** Rebase instead of merge */
307
- rebase?: boolean | 'merges' | 'interactive';
308
- /** Fast-forward behavior */
309
- ff?: 'only' | 'no' | boolean;
310
- /** Fetch tags */
311
- tags?: boolean;
312
- /** Prune remote-tracking refs */
313
- prune?: boolean;
314
- /** Progress callback */
315
- onProgress?: (progress: GitProgress) => void;
316
- };
317
- /**
318
- * Options for git reset
319
- */
320
- export type ResetOpts = {
321
- /** Reset mode */
322
- mode?: 'soft' | 'mixed' | 'hard' | 'merge' | 'keep';
323
- };
324
- /**
325
- * Options for git rm
326
- */
327
- export type RmOpts = {
328
- /** Force removal */
329
- force?: boolean;
330
- /** Remove from index only (keep in working tree) */
331
- cached?: boolean;
332
- /** Allow recursive removal */
333
- recursive?: boolean;
334
- /** Dry run */
335
- dryRun?: boolean;
336
- };
337
- /**
338
- * Stash entry
339
- */
340
- export type StashEntry = {
341
- index: number;
342
- message: string;
343
- branch?: string;
344
- commit: string;
345
- };
346
- /**
347
- * Options for git stash push
348
- */
349
- export type StashPushOpts = {
350
- /** Stash message */
351
- message?: string;
352
- /** Include untracked files */
353
- includeUntracked?: boolean;
354
- /** Keep index */
355
- keepIndex?: boolean;
356
- /** Specific paths to stash */
357
- paths?: Array<string>;
358
- };
359
- /**
360
- * Options for git stash pop/apply
361
- */
362
- export type StashApplyOpts = {
363
- /** Stash index to apply */
364
- index?: number;
365
- /** Try to reinstate index */
366
- reinstateIndex?: boolean;
367
- };
368
- /**
369
- * Options for git switch
370
- */
371
- export type SwitchOpts = {
372
- /** Create new branch */
373
- create?: boolean;
374
- /** Force create (overwrite existing) */
375
- forceCreate?: boolean;
376
- /** Discard local changes */
377
- discard?: boolean;
378
- /** Start point for new branch */
379
- startPoint?: string;
380
- /** Track remote branch */
381
- track?: boolean;
382
- /** Detach HEAD */
383
- detach?: boolean;
384
- };
385
- /**
386
- * Tag information
387
- */
388
- export type TagInfo = {
389
- name: string;
390
- commit: string;
391
- message?: string;
392
- tagger?: {
393
- name: string;
394
- email: string;
395
- date: Date;
396
- };
397
- annotated: boolean;
398
- };
399
- /**
400
- * Options for git tag (list)
401
- */
402
- export type TagListOpts = {
403
- /** List pattern */
404
- pattern?: string;
405
- /** Sort by */
406
- sort?: string;
407
- };
408
- /**
409
- * Options for creating a tag
410
- */
411
- export type TagCreateOpts = {
412
- /** Tag message (creates annotated tag) */
413
- message?: string;
414
- /** Force (overwrite existing tag) */
415
- force?: boolean;
416
- /** Commit to tag */
417
- commit?: string;
418
- /** GPG-sign the tag with the default key */
419
- sign?: boolean;
420
- };
421
- /**
422
- * Options for git cherry-pick
423
- */
424
- export type CherryPickOpts = {
425
- /** Edit commit message */
426
- edit?: boolean;
427
- /** No commit after cherry-pick */
428
- noCommit?: boolean;
429
- /** Add signoff */
430
- signoff?: boolean;
431
- /** Mainline parent number for merge commits */
432
- mainline?: number;
433
- /** Strategy to use */
434
- strategy?: string;
435
- /** Abort cherry-pick */
436
- abort?: boolean;
437
- /** Continue cherry-pick */
438
- continue?: boolean;
439
- /** Skip current commit */
440
- skip?: boolean;
441
- /** Bypass pre-commit hook */
442
- noVerify?: boolean;
443
- };
444
- /**
445
- * Options for git clean
446
- */
447
- export type CleanOpts = {
448
- /** Force clean */
449
- force?: boolean;
450
- /** Remove directories too */
451
- directories?: boolean;
452
- /** Remove ignored files too */
453
- ignored?: boolean;
454
- /** Only remove ignored files */
455
- onlyIgnored?: boolean;
456
- /** Dry run */
457
- dryRun?: boolean;
458
- /** Paths to clean */
459
- paths?: Array<string>;
460
- };
461
- /**
462
- * Options for git mv
463
- */
464
- export type MvOpts = {
465
- /** Force move */
466
- force?: boolean;
467
- /** Dry run */
468
- dryRun?: boolean;
469
- };
470
- /**
471
- * Options for git rebase
472
- */
473
- export type RebaseOpts = {
474
- /** Upstream branch */
475
- upstream?: string;
476
- /** Onto target */
477
- onto?: string;
478
- /** Interactive rebase (not supported - use raw) */
479
- interactive?: never;
480
- /** Preserve merges */
481
- rebaseMerges?: boolean;
482
- /** Abort rebase */
483
- abort?: boolean;
484
- /** Continue rebase */
485
- continue?: boolean;
486
- /** Skip current commit */
487
- skip?: boolean;
488
- /** Bypass pre-rebase hook */
489
- noVerify?: boolean;
490
- };
491
- /**
492
- * Options for git restore
493
- */
494
- export type RestoreOpts = {
495
- /** Restore staged files */
496
- staged?: boolean;
497
- /** Restore working tree files */
498
- worktree?: boolean;
499
- /** Source to restore from */
500
- source?: string;
501
- /** Ours or theirs for conflicts */
502
- ours?: boolean;
503
- theirs?: boolean;
504
- };
505
- /**
506
- * Options for git revert
507
- */
508
- export type RevertOpts = {
509
- /** Edit commit message */
510
- edit?: boolean;
511
- /** No commit after revert */
512
- noCommit?: boolean;
513
- /** Mainline parent number for merge commits */
514
- mainline?: number;
515
- /** Abort revert */
516
- abort?: boolean;
517
- /** Continue revert */
518
- continue?: boolean;
519
- /** Skip current commit */
520
- skip?: boolean;
521
- /** Bypass pre-commit hook */
522
- noVerify?: boolean;
523
- };
524
- /**
525
- * Options for git show
526
- */
527
- export type ShowOpts = {
528
- /** Show stat only */
529
- stat?: boolean;
530
- /** Show name only */
531
- nameOnly?: boolean;
532
- /** Show name and status */
533
- nameStatus?: boolean;
534
- /** Format string */
535
- format?: string;
536
- };
537
- /**
538
- * Options for git submodule
539
- */
540
- export type SubmoduleOpts = {
541
- /** Recursive operation */
542
- recursive?: boolean;
543
- /** Initialize submodules */
544
- init?: boolean;
545
- /** Remote tracking branch */
546
- remote?: boolean;
547
- /** Force update */
548
- force?: boolean;
549
- };
550
- /**
551
- * Submodule information
552
- */
553
- export type SubmoduleInfo = {
554
- name: string;
555
- path: string;
556
- url: string;
557
- branch?: string;
558
- commit: string;
559
- };
560
- /**
561
- * LFS status information
562
- */
563
- export type LfsStatus = {
564
- files: Array<{
565
- name: string;
566
- size: number;
567
- status: 'checkout' | 'download' | 'upload' | 'unknown';
568
- }>;
569
- };
570
- /**
571
- * Options for LFS pull
572
- */
573
- export type LfsPullOpts = {
574
- remote?: string;
575
- ref?: string;
576
- include?: Array<string>;
577
- exclude?: Array<string>;
578
- };
579
- /**
580
- * Options for LFS push
581
- */
582
- export type LfsPushOpts = {
583
- remote?: string;
584
- ref?: string;
585
- };
586
- /**
587
- * Options for LFS status
588
- */
589
- export type LfsStatusOpts = {
590
- json?: boolean;
591
- };
592
- /**
593
- * Options for LFS prune
594
- */
595
- export type LfsPruneOpts = {
596
- /** Force prune (remove unreferenced objects immediately) */
597
- force?: boolean;
598
- /** Dry run - show what would be pruned without actually pruning */
599
- dryRun?: boolean;
600
- /** Verify remote copies before pruning */
601
- verifyRemote?: boolean;
602
- /** Verify unreferenced copies */
603
- verifyUnreferenced?: boolean;
604
- };
605
- /**
606
- * Options for LFS pre-upload (§10.3)
607
- *
608
- * Pre-upload allows pushing LFS objects before the refs push,
609
- * enabling 2-phase commit patterns for improved reliability.
610
- */
611
- export type LfsPreUploadOpts = {
612
- /** Object IDs to upload (if omitted, auto-detect pending objects) */
613
- oids?: Array<string>;
614
- /** Batch size for upload (default: 50, considers Windows 8KB limit) */
615
- batchSize?: number;
616
- /** Remote name (default: 'origin') */
617
- remote?: string;
618
- };
619
- /**
620
- * Result from LFS pre-upload
621
- */
622
- export type LfsPreUploadResult = {
623
- /** Number of objects uploaded */
624
- uploadedCount: number;
625
- /** Total bytes uploaded */
626
- uploadedBytes: number;
627
- /** Number of objects skipped (already on remote) */
628
- skippedCount: number;
629
- };
630
- /**
631
- * Options for LFS pre-download (§10.3)
632
- *
633
- * Pre-download allows fetching LFS objects before checkout,
634
- * useful for controlled large file management.
635
- */
636
- export type LfsPreDownloadOpts = {
637
- /** Object IDs to download (if omitted, auto-detect from ref) */
638
- oids?: Array<string>;
639
- /** Git ref to get LFS objects for (branch, tag, or commit) */
640
- ref?: string;
641
- /** Batch size for download (default: 50) */
642
- batchSize?: number;
643
- /** Remote name (default: 'origin') */
644
- remote?: string;
645
- };
646
- /**
647
- * Result from LFS pre-download
648
- */
649
- export type LfsPreDownloadResult = {
650
- /** Number of objects downloaded */
651
- downloadedCount: number;
652
- /** Total bytes downloaded */
653
- downloadedBytes: number;
654
- /** Number of objects skipped (already local) */
655
- skippedCount: number;
656
- };
657
- /**
658
- * Worktree information (§7.4)
659
- *
660
- * Parsed from `git worktree list --porcelain` output.
661
- */
662
- export type Worktree = {
663
- /** Worktree path */
664
- path: string;
665
- /** HEAD commit hash */
666
- head: string;
667
- /** Branch name (if checked out) */
668
- branch?: string;
669
- /** Whether the worktree is locked */
670
- locked: boolean;
671
- /** Whether the worktree is prunable */
672
- prunable: boolean;
673
- };
674
- /**
675
- * Options for adding a worktree
676
- */
677
- export type WorktreeAddOpts = {
678
- /** Branch name to create or checkout */
679
- branch?: string;
680
- /** Create detached HEAD */
681
- detach?: boolean;
682
- /** Track remote branch */
683
- track?: boolean;
684
- };
685
- /**
686
- * Options for removing a worktree
687
- */
688
- export type WorktreeRemoveOpts = {
689
- /** Force removal even if dirty */
690
- force?: boolean;
691
- };
692
- /**
693
- * Options for pruning worktrees
694
- */
695
- export type WorktreePruneOpts = {
696
- /** Show what would be pruned without actually pruning */
697
- dryRun?: boolean;
698
- /** Show more details */
699
- verbose?: boolean;
700
- };
701
- /**
702
- * Options for locking a worktree
703
- */
704
- export type WorktreeLockOpts = {
705
- /** Reason for locking */
706
- reason?: string;
707
- };
708
- /**
709
- * Worktree operations interface (§7.4)
710
- */
711
- export interface WorktreeOperations {
712
- /**
713
- * List all worktrees (parses --porcelain output)
714
- */
715
- list(opts?: ExecOpts): Promise<Array<Worktree>>;
716
- /**
717
- * Add a new worktree
718
- */
719
- add(path: string, opts?: WorktreeAddOpts & ExecOpts): Promise<void>;
720
- /**
721
- * Remove a worktree
722
- */
723
- remove(path: string, opts?: WorktreeRemoveOpts & ExecOpts): Promise<void>;
724
- /**
725
- * Prune stale worktree references
726
- */
727
- prune(opts?: WorktreePruneOpts & ExecOpts): Promise<Array<string>>;
728
- /**
729
- * Lock a worktree
730
- */
731
- lock(path: string, opts?: WorktreeLockOpts & ExecOpts): Promise<void>;
732
- /**
733
- * Unlock a worktree
734
- */
735
- unlock(path: string, opts?: ExecOpts): Promise<void>;
736
- }
737
- /**
738
- * LFS operations interface
739
- */
740
- export interface LfsOperations {
741
- /**
742
- * Pull LFS objects
743
- */
744
- pull(opts?: LfsPullOpts & ExecOpts): Promise<void>;
745
- /**
746
- * Push LFS objects
747
- */
748
- push(opts?: LfsPushOpts & ExecOpts): Promise<void>;
749
- /**
750
- * Get LFS status
751
- */
752
- status(opts?: LfsStatusOpts & ExecOpts): Promise<LfsStatus>;
753
- /**
754
- * Prune old and unreferenced LFS objects from local storage
755
- */
756
- prune(opts?: LfsPruneOpts & ExecOpts): Promise<void>;
757
- }
758
- /**
759
- * LFS Extra operations interface (inspired by fs-extra)
760
- *
761
- * Additional LFS utilities not part of the core LFS commands.
762
- * These enable advanced patterns like 2-phase commit/fetch.
763
- */
764
- export interface LfsExtraOperations {
765
- /**
766
- * Pre-upload LFS objects before refs push (§10.3)
767
- *
768
- * Enables 2-phase commit pattern for improved reliability with large files.
769
- * Objects are uploaded in batches to handle Windows command line limits.
770
- *
771
- * @example
772
- * ```typescript
773
- * // Phase 1: Upload LFS objects first
774
- * await repo.lfsExtra.preUpload({ onProgress: handleProgress });
775
- *
776
- * // Phase 2: Create commit
777
- * await repo.commit({ message: 'Add large files' });
778
- *
779
- * // Phase 3: Push refs (LFS already uploaded, so this is fast)
780
- * await repo.push();
781
- * ```
782
- */
783
- preUpload(opts?: LfsPreUploadOpts & ExecOpts): Promise<LfsPreUploadResult>;
784
- /**
785
- * Pre-download LFS objects before checkout (§10.3)
786
- *
787
- * Enables controlled download of large files before checkout.
788
- * Useful when you need to verify available space or report progress separately.
789
- */
790
- preDownload(opts?: LfsPreDownloadOpts & ExecOpts): Promise<LfsPreDownloadResult>;
791
- }
792
- /**
793
- * Branch operations interface
794
- */
795
- export interface BranchOperations {
796
- /**
797
- * List branches
798
- */
799
- list(opts?: BranchOpts & ExecOpts): Promise<Array<BranchInfo>>;
800
- /**
801
- * Get current branch name
802
- */
803
- current(opts?: ExecOpts): Promise<string | null>;
804
- /**
805
- * Create a new branch
806
- */
807
- create(name: string, opts?: BranchCreateOpts & ExecOpts): Promise<void>;
808
- /**
809
- * Delete a branch
810
- */
811
- delete(name: string, opts?: BranchDeleteOpts & ExecOpts): Promise<void>;
812
- /**
813
- * Rename a branch
814
- */
815
- rename(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
816
- }
817
- /**
818
- * Stash operations interface
819
- */
820
- export interface StashOperations {
821
- /**
822
- * List stash entries
823
- */
824
- list(opts?: ExecOpts): Promise<Array<StashEntry>>;
825
- /**
826
- * Push changes to stash
827
- */
828
- push(opts?: StashPushOpts & ExecOpts): Promise<void>;
829
- /**
830
- * Pop stash entry
831
- */
832
- pop(opts?: StashApplyOpts & ExecOpts): Promise<void>;
833
- /**
834
- * Apply stash entry (without removing from stash)
835
- */
836
- apply(opts?: StashApplyOpts & ExecOpts): Promise<void>;
837
- /**
838
- * Drop a stash entry
839
- */
840
- drop(index?: number, opts?: ExecOpts): Promise<void>;
841
- /**
842
- * Clear all stash entries
843
- */
844
- clear(opts?: ExecOpts): Promise<void>;
845
- }
846
- /**
847
- * Tag operations interface
848
- */
849
- export interface TagOperations {
850
- /**
851
- * List tags
852
- */
853
- list(opts?: TagListOpts & ExecOpts): Promise<Array<string>>;
854
- /**
855
- * Create a tag
856
- */
857
- create(name: string, opts?: TagCreateOpts & ExecOpts): Promise<void>;
858
- /**
859
- * Delete a tag
860
- */
861
- delete(name: string, opts?: ExecOpts): Promise<void>;
862
- /**
863
- * Get tag info
864
- */
865
- show(name: string, opts?: ExecOpts): Promise<TagInfo>;
866
- }
867
- /**
868
- * Remote information
869
- */
870
- export type RemoteInfo = {
871
- /** Remote name */
872
- name: string;
873
- /** Fetch URL */
874
- fetchUrl: string;
875
- /** Push URL (may differ from fetchUrl) */
876
- pushUrl: string;
877
- };
878
- /**
879
- * Options for adding a remote
880
- */
881
- export type RemoteAddOpts = {
882
- /** Set up tracking for default branch */
883
- track?: string;
884
- /** Only fetch specified branches */
885
- fetch?: boolean;
886
- /** Set up as mirror */
887
- mirror?: 'fetch' | 'push';
888
- };
889
- /**
890
- * Options for getting/setting remote URL
891
- */
892
- export type RemoteUrlOpts = {
893
- /** Target push URL instead of fetch URL */
894
- push?: boolean;
895
- };
896
- /**
897
- * Remote operations interface
898
- */
899
- export interface RemoteOperations {
900
- /**
901
- * List remotes
902
- */
903
- list(opts?: ExecOpts): Promise<Array<RemoteInfo>>;
904
- /**
905
- * Add a remote
906
- */
907
- add(name: string, url: string, opts?: RemoteAddOpts & ExecOpts): Promise<void>;
908
- /**
909
- * Remove a remote
910
- */
911
- remove(name: string, opts?: ExecOpts): Promise<void>;
912
- /**
913
- * Rename a remote
914
- */
915
- rename(oldName: string, newName: string, opts?: ExecOpts): Promise<void>;
916
- /**
917
- * Get remote URL
918
- */
919
- getUrl(name: string, opts?: RemoteUrlOpts & ExecOpts): Promise<string>;
920
- /**
921
- * Set remote URL
922
- */
923
- setUrl(name: string, url: string, opts?: RemoteUrlOpts & ExecOpts): Promise<void>;
924
- }
925
- /**
926
- * Config entry
927
- */
928
- export type ConfigEntry = {
929
- /** Config key (e.g., 'user.name') */
930
- key: string;
931
- /** Config value */
932
- value: string;
933
- };
934
- /**
935
- * Options for config get
936
- */
937
- export type ConfigGetOpts = {
938
- /** Get all values for multi-valued key */
939
- all?: boolean;
940
- };
941
- /**
942
- * Options for config set
943
- */
944
- export type ConfigSetOpts = {
945
- /** Add value to multi-valued key instead of replacing */
946
- add?: boolean;
947
- };
948
- /**
949
- * Options for config list
950
- */
951
- export type ConfigListOpts = {
952
- /** Show origin of each value */
953
- showOrigin?: boolean;
954
- /** Show scope of each value */
955
- showScope?: boolean;
956
- };
957
- /**
958
- * Well-known git config keys with their expected value types
959
- *
960
- * This provides type safety for common config operations.
961
- * For arbitrary keys, use getRaw/setRaw.
962
- */
963
- export type ConfigSchema = {
964
- 'user.name': string;
965
- 'user.email': string;
966
- 'user.signingkey': string;
967
- 'core.autocrlf': 'true' | 'false' | 'input';
968
- 'core.filemode': 'true' | 'false';
969
- 'core.ignorecase': 'true' | 'false';
970
- 'core.bare': 'true' | 'false';
971
- 'core.logallrefupdates': 'true' | 'false' | 'always';
972
- 'core.repositoryformatversion': string;
973
- 'core.quotepath': 'true' | 'false';
974
- 'core.editor': string;
975
- 'core.pager': string;
976
- 'core.excludesfile': string;
977
- 'core.attributesfile': string;
978
- 'core.hooksPath': string;
979
- 'core.sshCommand': string;
980
- 'init.defaultBranch': string;
981
- 'commit.gpgsign': 'true' | 'false';
982
- 'commit.template': string;
983
- 'tag.gpgsign': 'true' | 'false';
984
- 'tag.forcesignannotated': 'true' | 'false';
985
- 'push.default': 'nothing' | 'current' | 'upstream' | 'tracking' | 'simple' | 'matching';
986
- 'push.followTags': 'true' | 'false';
987
- 'push.autoSetupRemote': 'true' | 'false';
988
- 'push.gpgSign': 'true' | 'false' | 'if-asked';
989
- 'pull.rebase': 'true' | 'false' | 'merges' | 'interactive';
990
- 'pull.ff': 'true' | 'false' | 'only';
991
- 'fetch.prune': 'true' | 'false';
992
- 'fetch.pruneTags': 'true' | 'false';
993
- 'merge.ff': 'true' | 'false' | 'only';
994
- 'merge.conflictstyle': 'merge' | 'diff3' | 'zdiff3';
995
- 'rebase.autoStash': 'true' | 'false';
996
- 'rebase.autoSquash': 'true' | 'false';
997
- 'rebase.updateRefs': 'true' | 'false';
998
- 'diff.algorithm': 'default' | 'minimal' | 'patience' | 'histogram';
999
- 'diff.colorMoved': 'no' | 'default' | 'plain' | 'blocks' | 'zebra' | 'dimmed-zebra';
1000
- 'color.ui': 'auto' | 'always' | 'never' | 'true' | 'false';
1001
- 'credential.helper': string;
1002
- 'gpg.format': 'openpgp' | 'x509' | 'ssh';
1003
- 'gpg.program': string;
1004
- 'gpg.ssh.program': string;
1005
- 'gpg.ssh.allowedSignersFile': string;
1006
- 'http.proxy': string;
1007
- 'http.sslVerify': 'true' | 'false';
1008
- 'lfs.fetchexclude': string;
1009
- 'lfs.fetchinclude': string;
1010
- 'safe.directory': string;
1011
- };
1012
- /**
1013
- * Known config key names
1014
- */
1015
- export type ConfigKey = keyof ConfigSchema;
1016
- /**
1017
- * Config operations interface (repository-level)
1018
- */
1019
- export interface ConfigOperations {
1020
- /**
1021
- * Get a typed config value
1022
- * Returns undefined if not set
1023
- */
1024
- get<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<ConfigSchema[K] | undefined>;
1025
- /**
1026
- * Get a typed config value with all option (for multi-valued keys)
1027
- */
1028
- getAll<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<Array<ConfigSchema[K]>>;
1029
- /**
1030
- * Set a typed config value
1031
- */
1032
- set<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
1033
- /**
1034
- * Add a value to a multi-valued config key
1035
- */
1036
- add<K extends ConfigKey>(key: K, value: ConfigSchema[K], opts?: ExecOpts): Promise<void>;
1037
- /**
1038
- * Unset a typed config value
1039
- */
1040
- unset<K extends ConfigKey>(key: K, opts?: ExecOpts): Promise<void>;
1041
- /**
1042
- * Get a raw config value (for arbitrary keys)
1043
- * Returns undefined if not set
1044
- */
1045
- getRaw(key: string, opts?: ConfigGetOpts & ExecOpts): Promise<string | Array<string> | undefined>;
1046
- /**
1047
- * Set a raw config value (for arbitrary keys)
1048
- */
1049
- setRaw(key: string, value: string, opts?: ConfigSetOpts & ExecOpts): Promise<void>;
1050
- /**
1051
- * Unset a raw config value (for arbitrary keys)
1052
- */
1053
- unsetRaw(key: string, opts?: ExecOpts): Promise<void>;
1054
- /**
1055
- * List all config values
1056
- */
1057
- list(opts?: ConfigListOpts & ExecOpts): Promise<Array<ConfigEntry>>;
1058
- }
1059
- /**
1060
- * Submodule operations interface
1061
- */
1062
- export interface SubmoduleOperations {
1063
- /**
1064
- * List submodules
1065
- */
1066
- list(opts?: ExecOpts): Promise<Array<SubmoduleInfo>>;
1067
- /**
1068
- * Initialize submodules
1069
- */
1070
- init(paths?: Array<string>, opts?: ExecOpts): Promise<void>;
1071
- /**
1072
- * Update submodules
1073
- */
1074
- update(opts?: SubmoduleOpts & ExecOpts): Promise<void>;
1075
- /**
1076
- * Add a submodule
1077
- */
1078
- add(url: string, path: string, opts?: ExecOpts): Promise<void>;
1079
- /**
1080
- * Deinitialize a submodule
1081
- */
1082
- deinit(path: string, opts?: ExecOpts): Promise<void>;
1083
- }
1084
- /**
1085
- * Worktree repository with full working directory support
1086
- */
1087
- export interface WorktreeRepo extends RepoBase {
1088
- readonly workdir: string;
1089
- /**
1090
- * Get repository status
1091
- */
1092
- status(opts?: StatusOpts & ExecOpts): Promise<StatusPorcelain>;
1093
- /**
1094
- * Get commit log
1095
- */
1096
- log(opts?: LogOpts & ExecOpts): Promise<Array<Commit>>;
1097
- /**
1098
- * Fetch from remote
1099
- */
1100
- fetch(opts?: FetchOpts & ExecOpts): Promise<void>;
1101
- /**
1102
- * Push to remote
1103
- */
1104
- push(opts?: PushOpts & ExecOpts): Promise<void>;
1105
- /**
1106
- * LFS operations
1107
- */
1108
- lfs: LfsOperations;
1109
- /**
1110
- * LFS extra operations (inspired by fs-extra)
1111
- *
1112
- * Additional utilities for advanced LFS patterns like 2-phase commit/fetch.
1113
- */
1114
- lfsExtra: LfsExtraOperations;
1115
- /**
1116
- * Worktree operations (§7.4)
1117
- */
1118
- worktree: WorktreeOperations;
1119
- /**
1120
- * Configure LFS mode for this repository
1121
- */
1122
- setLfsMode(mode: LfsMode): void;
1123
- /**
1124
- * Add files to the index
1125
- */
1126
- add(paths: string | Array<string>, opts?: AddOpts & ExecOpts): Promise<void>;
1127
- /**
1128
- * Branch operations
1129
- */
1130
- branch: BranchOperations;
1131
- /**
1132
- * Checkout a branch, tag, or commit
1133
- */
1134
- checkout(target: string, opts?: CheckoutOpts & ExecOpts): Promise<void>;
1135
- /**
1136
- * Create a commit
1137
- */
1138
- commit(opts?: CommitOpts & ExecOpts): Promise<CommitResult>;
1139
- /**
1140
- * Show changes between commits, commit and working tree, etc.
1141
- */
1142
- diff(target?: string, opts?: DiffOpts & ExecOpts): Promise<DiffResult>;
1143
- /**
1144
- * Merge branches
1145
- */
1146
- merge(branch: string, opts?: MergeOpts & ExecOpts): Promise<MergeResult>;
1147
- /**
1148
- * Pull from remote (fetch + merge/rebase)
1149
- */
1150
- pull(opts?: PullOpts & ExecOpts): Promise<void>;
1151
- /**
1152
- * Reset current HEAD to the specified state
1153
- */
1154
- reset(target?: string, opts?: ResetOpts & ExecOpts): Promise<void>;
1155
- /**
1156
- * Remove files from the working tree and from the index
1157
- */
1158
- rm(paths: string | Array<string>, opts?: RmOpts & ExecOpts): Promise<void>;
1159
- /**
1160
- * Stash operations
1161
- */
1162
- stash: StashOperations;
1163
- /**
1164
- * Switch branches
1165
- */
1166
- switch(branch: string, opts?: SwitchOpts & ExecOpts): Promise<void>;
1167
- /**
1168
- * Tag operations
1169
- */
1170
- tag: TagOperations;
1171
- /**
1172
- * Cherry-pick commits
1173
- */
1174
- cherryPick(commits: string | Array<string>, opts?: CherryPickOpts & ExecOpts): Promise<void>;
1175
- /**
1176
- * Clean untracked files
1177
- */
1178
- clean(opts?: CleanOpts & ExecOpts): Promise<Array<string>>;
1179
- /**
1180
- * Move or rename files
1181
- */
1182
- mv(source: string, destination: string, opts?: MvOpts & ExecOpts): Promise<void>;
1183
- /**
1184
- * Rebase commits
1185
- */
1186
- rebase(opts?: RebaseOpts & ExecOpts): Promise<void>;
1187
- /**
1188
- * Restore working tree files
1189
- */
1190
- restore(paths: string | Array<string>, opts?: RestoreOpts & ExecOpts): Promise<void>;
1191
- /**
1192
- * Revert commits
1193
- */
1194
- revert(commits: string | Array<string>, opts?: RevertOpts & ExecOpts): Promise<void>;
1195
- /**
1196
- * Show various types of objects
1197
- */
1198
- show(object: string, opts?: ShowOpts & ExecOpts): Promise<string>;
1199
- /**
1200
- * Parse revision specification and return the object name (SHA)
1201
- *
1202
- * Useful for resolving refs like HEAD, branch names, or relative refs like HEAD~1
1203
- *
1204
- * @example
1205
- * ```typescript
1206
- * const sha = await repo.revParse('HEAD');
1207
- * const parentSha = await repo.revParse('HEAD~1');
1208
- * const branchSha = await repo.revParse('main');
1209
- * ```
1210
- */
1211
- revParse(ref: string, opts?: ExecOpts): Promise<string>;
1212
- /**
1213
- * Count the number of commits reachable from a ref
1214
- *
1215
- * Equivalent to `git rev-list --count <ref>`
1216
- *
1217
- * @example
1218
- * ```typescript
1219
- * const count = await repo.revListCount('HEAD');
1220
- * const featureCommits = await repo.revListCount('main..feature');
1221
- * ```
1222
- */
1223
- revListCount(ref?: string, opts?: ExecOpts): Promise<number>;
1224
- /**
1225
- * Read or modify symbolic refs
1226
- *
1227
- * Without newRef: reads the symbolic ref (e.g., get what HEAD points to)
1228
- * With newRef: sets the symbolic ref to point to newRef
1229
- *
1230
- * @example
1231
- * ```typescript
1232
- * // Read what HEAD points to
1233
- * const branch = await repo.symbolicRef('HEAD');
1234
- *
1235
- * // Set HEAD to point to a branch
1236
- * await repo.symbolicRef('HEAD', 'refs/heads/main');
1237
- * ```
1238
- */
1239
- symbolicRef(name: string, newRef?: string, opts?: ExecOpts): Promise<string | undefined>;
1240
- /**
1241
- * Submodule operations
1242
- */
1243
- submodule: SubmoduleOperations;
1244
- /**
1245
- * Remote operations
1246
- */
1247
- remote: RemoteOperations;
1248
- /**
1249
- * Config operations (repository-level)
1250
- */
1251
- config: ConfigOperations;
1252
- }
1253
- /**
1254
- * Bare repository (no working directory)
1255
- */
1256
- export interface BareRepo extends RepoBase {
1257
- readonly gitDir: string;
1258
- /**
1259
- * Fetch from remote
1260
- */
1261
- fetch(opts?: FetchOpts & ExecOpts): Promise<void>;
1262
- /**
1263
- * Push to remote
1264
- */
1265
- push(opts?: PushOpts & ExecOpts): Promise<void>;
1266
- /**
1267
- * Remote operations
1268
- */
1269
- remote: RemoteOperations;
1270
- /**
1271
- * Config operations (repository-level)
1272
- */
1273
- config: ConfigOperations;
1274
- }
1275
- //# sourceMappingURL=repo.d.ts.map