@oh-my-pi/pi-git-tool 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts ADDED
@@ -0,0 +1,668 @@
1
+ export type Operation =
2
+ | "status"
3
+ | "diff"
4
+ | "log"
5
+ | "show"
6
+ | "blame"
7
+ | "branch"
8
+ | "add"
9
+ | "restore"
10
+ | "commit"
11
+ | "checkout"
12
+ | "merge"
13
+ | "rebase"
14
+ | "stash"
15
+ | "cherry-pick"
16
+ | "fetch"
17
+ | "pull"
18
+ | "push"
19
+ | "tag"
20
+ | "pr"
21
+ | "issue"
22
+ | "ci"
23
+ | "release";
24
+
25
+ export interface ToolResult<T> {
26
+ data: T;
27
+ _rendered: string;
28
+ }
29
+
30
+ export interface ToolConfirm {
31
+ confirm: string;
32
+ override: string;
33
+ _rendered?: string;
34
+ }
35
+
36
+ export interface ToolError {
37
+ error: string;
38
+ code?: string;
39
+ suggestion?: string;
40
+ _rendered?: string;
41
+ }
42
+
43
+ export type ToolResponse<T> = ToolResult<T> | ToolConfirm | ToolError;
44
+
45
+ export interface FileStatus {
46
+ path: string;
47
+ status: "added" | "modified" | "deleted" | "renamed" | "copied";
48
+ oldPath?: string;
49
+ }
50
+
51
+ export interface StatusParams {
52
+ operation: "status";
53
+ only?: "branch" | "modified" | "staged" | "untracked" | "conflicts" | "sync";
54
+ ignored?: boolean;
55
+ }
56
+
57
+ export interface StatusResult {
58
+ branch: string;
59
+ upstream: string | null;
60
+ ahead: number;
61
+ behind: number;
62
+ staged: FileStatus[];
63
+ modified: FileStatus[];
64
+ untracked: string[];
65
+ conflicts: string[];
66
+ ignored?: string[];
67
+ }
68
+
69
+ export type DiffTarget =
70
+ | "unstaged"
71
+ | "staged"
72
+ | "head"
73
+ | {
74
+ from: string;
75
+ to?: string;
76
+ };
77
+
78
+ export interface DiffParams {
79
+ operation: "diff";
80
+ target?: DiffTarget;
81
+ paths?: string[];
82
+ stat_only?: boolean;
83
+ name_only?: boolean;
84
+ context?: number;
85
+ max_lines?: number;
86
+ ignore_whitespace?: boolean;
87
+ }
88
+
89
+ export interface DiffLine {
90
+ type: "context" | "add" | "delete";
91
+ content: string;
92
+ oldLineNo?: number;
93
+ newLineNo?: number;
94
+ }
95
+
96
+ export interface Hunk {
97
+ oldStart: number;
98
+ oldCount: number;
99
+ newStart: number;
100
+ newCount: number;
101
+ header: string;
102
+ lines: DiffLine[];
103
+ }
104
+
105
+ export interface FileDiff {
106
+ path: string;
107
+ oldPath?: string;
108
+ status: "added" | "modified" | "deleted" | "renamed" | "copied";
109
+ binary: boolean;
110
+ additions: number;
111
+ deletions: number;
112
+ hunks?: Hunk[];
113
+ }
114
+
115
+ export interface DiffResult {
116
+ files: FileDiff[];
117
+ stats: {
118
+ filesChanged: number;
119
+ insertions: number;
120
+ deletions: number;
121
+ };
122
+ truncated: boolean;
123
+ truncatedFiles?: string[];
124
+ }
125
+
126
+ export interface LogParams {
127
+ operation: "log";
128
+ limit?: number;
129
+ ref?: string;
130
+ author?: string;
131
+ since?: string;
132
+ until?: string;
133
+ paths?: string[];
134
+ grep?: string;
135
+ format?: "oneline" | "short" | "full";
136
+ stat?: boolean;
137
+ merges?: boolean;
138
+ first_parent?: boolean;
139
+ }
140
+
141
+ export interface CommitAuthor {
142
+ name: string;
143
+ email: string;
144
+ date: string;
145
+ }
146
+
147
+ export interface Commit {
148
+ sha: string;
149
+ shortSha: string;
150
+ author: CommitAuthor;
151
+ committer: CommitAuthor;
152
+ message: string;
153
+ subject: string;
154
+ parents: string[];
155
+ stats?: { additions: number; deletions: number; files: number };
156
+ }
157
+
158
+ export interface LogResult {
159
+ commits: Commit[];
160
+ hasMore: boolean;
161
+ }
162
+
163
+ export interface ShowParams {
164
+ operation: "show";
165
+ ref: string;
166
+ path?: string;
167
+ diff?: boolean;
168
+ stat?: boolean;
169
+ lines?: { start: number; end: number };
170
+ }
171
+
172
+ export interface ShowCommitResult {
173
+ commit: Commit;
174
+ diff?: DiffResult;
175
+ }
176
+
177
+ export interface ShowFileResult {
178
+ path: string;
179
+ ref: string;
180
+ content: string;
181
+ truncated: boolean;
182
+ }
183
+
184
+ export interface BlameParams {
185
+ operation: "blame";
186
+ path: string;
187
+ lines?: { start: number; end: number };
188
+ root?: boolean;
189
+ ignore_whitespace?: boolean;
190
+ }
191
+
192
+ export interface BlameLine {
193
+ lineNo: number;
194
+ sha: string;
195
+ shortSha: string;
196
+ author: string;
197
+ date: string;
198
+ content: string;
199
+ original?: {
200
+ sha: string;
201
+ path: string;
202
+ lineNo: number;
203
+ };
204
+ }
205
+
206
+ export interface BlameResult {
207
+ lines: BlameLine[];
208
+ }
209
+
210
+ export interface BranchParams {
211
+ operation: "branch";
212
+ action?: "list" | "create" | "delete" | "rename" | "current";
213
+ name?: string;
214
+ newName?: string;
215
+ startPoint?: string;
216
+ remotes?: boolean;
217
+ force?: boolean;
218
+ }
219
+
220
+ export interface BranchInfo {
221
+ name: string;
222
+ sha: string;
223
+ upstream?: string;
224
+ ahead?: number;
225
+ behind?: number;
226
+ gone?: boolean;
227
+ }
228
+
229
+ export interface BranchListResult {
230
+ current: string;
231
+ local: BranchInfo[];
232
+ remote?: BranchInfo[];
233
+ }
234
+
235
+ export interface AddParams {
236
+ operation: "add";
237
+ paths?: string[];
238
+ update?: boolean;
239
+ all?: boolean;
240
+ dry_run?: boolean;
241
+ }
242
+
243
+ export interface AddResult {
244
+ staged: string[];
245
+ }
246
+
247
+ export interface RestoreParams {
248
+ operation: "restore";
249
+ paths: string[];
250
+ staged?: boolean;
251
+ worktree?: boolean;
252
+ source?: string;
253
+ }
254
+
255
+ export interface RestoreResult {
256
+ restored: string[];
257
+ }
258
+
259
+ export interface CommitParams {
260
+ operation: "commit";
261
+ message: string;
262
+ all?: boolean;
263
+ allow_empty?: boolean;
264
+ sign?: boolean;
265
+ no_verify?: boolean;
266
+ amend?: boolean;
267
+ }
268
+
269
+ export interface CommitResult {
270
+ sha: string;
271
+ shortSha: string;
272
+ subject: string;
273
+ stats: { additions: number; deletions: number; files: number };
274
+ }
275
+
276
+ export interface CheckoutParams {
277
+ operation: "checkout";
278
+ ref?: string;
279
+ create?: boolean;
280
+ paths?: string[];
281
+ force?: boolean;
282
+ }
283
+
284
+ export interface CheckoutResult {
285
+ branch?: string;
286
+ previous?: string;
287
+ restoredFiles?: string[];
288
+ }
289
+
290
+ export interface MergeParams {
291
+ operation: "merge";
292
+ ref: string;
293
+ message?: string;
294
+ no_ff?: boolean;
295
+ ff_only?: boolean;
296
+ squash?: boolean;
297
+ abort?: boolean;
298
+ continue?: boolean;
299
+ }
300
+
301
+ export interface MergeResult {
302
+ status: "success" | "conflict" | "up-to-date" | "fast-forward";
303
+ sha?: string;
304
+ conflicts?: string[];
305
+ mergedCommits?: number;
306
+ }
307
+
308
+ export interface RebaseParams {
309
+ operation: "rebase";
310
+ onto?: string;
311
+ upstream?: string;
312
+ abort?: boolean;
313
+ continue?: boolean;
314
+ skip?: boolean;
315
+ }
316
+
317
+ export interface RebaseResult {
318
+ status: "success" | "conflict" | "up-to-date";
319
+ conflicts?: string[];
320
+ rebasedCommits?: number;
321
+ }
322
+
323
+ export interface StashParams {
324
+ operation: "stash";
325
+ action?: "push" | "pop" | "apply" | "drop" | "list" | "show";
326
+ message?: string;
327
+ include_untracked?: boolean;
328
+ index?: number;
329
+ keep_index?: boolean;
330
+ }
331
+
332
+ export interface StashEntry {
333
+ index: number;
334
+ message: string;
335
+ branch: string;
336
+ date: string;
337
+ }
338
+
339
+ export interface StashListResult {
340
+ stashes: StashEntry[];
341
+ }
342
+
343
+ export interface StashShowResult {
344
+ stats: { additions: number; deletions: number; files: number };
345
+ files: string[];
346
+ }
347
+
348
+ export interface StashActionResult {
349
+ status: "success";
350
+ }
351
+
352
+ export type StashResult = StashListResult | StashShowResult | StashActionResult;
353
+
354
+ export interface CherryPickParams {
355
+ operation: "cherry-pick";
356
+ commits: string[];
357
+ no_commit?: boolean;
358
+ abort?: boolean;
359
+ continue?: boolean;
360
+ }
361
+
362
+ export interface CherryPickResult {
363
+ status: "success" | "conflict";
364
+ appliedCommits?: string[];
365
+ conflicts?: string[];
366
+ }
367
+
368
+ export interface FetchParams {
369
+ operation: "fetch";
370
+ remote?: string;
371
+ branch?: string;
372
+ all?: boolean;
373
+ prune?: boolean;
374
+ tags?: boolean;
375
+ }
376
+
377
+ export interface FetchResult {
378
+ updated: { ref: string; oldSha: string; newSha: string }[];
379
+ pruned?: string[];
380
+ }
381
+
382
+ export interface PullParams {
383
+ operation: "pull";
384
+ remote?: string;
385
+ branch?: string;
386
+ rebase?: boolean;
387
+ ff_only?: boolean;
388
+ }
389
+
390
+ export interface PullResult {
391
+ status: "success" | "conflict" | "up-to-date";
392
+ commits?: number;
393
+ conflicts?: string[];
394
+ }
395
+
396
+ export interface PushParams {
397
+ operation: "push";
398
+ remote?: string;
399
+ branch?: string;
400
+ set_upstream?: boolean;
401
+ tags?: boolean;
402
+ force?: boolean;
403
+ force_with_lease?: boolean;
404
+ delete?: boolean;
405
+ force_override?: boolean;
406
+ }
407
+
408
+ export interface PushResult {
409
+ remote: string;
410
+ branch: string;
411
+ commits: number;
412
+ newBranch: boolean;
413
+ }
414
+
415
+ export interface TagParams {
416
+ operation: "tag";
417
+ action?: "list" | "create" | "delete" | "push";
418
+ name?: string;
419
+ message?: string;
420
+ ref?: string;
421
+ force?: boolean;
422
+ sign?: boolean;
423
+ }
424
+
425
+ export interface TagInfo {
426
+ name: string;
427
+ sha: string;
428
+ message?: string;
429
+ tagger?: { name: string; date: string };
430
+ annotated: boolean;
431
+ }
432
+
433
+ export interface TagListResult {
434
+ tags: TagInfo[];
435
+ }
436
+
437
+ export interface TagActionResult {
438
+ status: "success";
439
+ }
440
+
441
+ export type TagResult = TagListResult | TagActionResult;
442
+
443
+ export interface PRParams {
444
+ operation: "pr";
445
+ action: "list" | "view" | "create" | "checkout" | "diff" | "merge" | "close" | "ready" | "review";
446
+ number?: number;
447
+ title?: string;
448
+ body?: string;
449
+ base?: string;
450
+ head?: string;
451
+ draft?: boolean;
452
+ state?: "open" | "closed" | "merged" | "all";
453
+ author?: string;
454
+ limit?: number;
455
+ merge_method?: "merge" | "squash" | "rebase";
456
+ review_action?: "approve" | "request-changes" | "comment";
457
+ review_body?: string;
458
+ }
459
+
460
+ export interface PRInfo {
461
+ number: number;
462
+ title: string;
463
+ state: string;
464
+ author: string;
465
+ branch: string;
466
+ base: string;
467
+ url: string;
468
+ createdAt: string;
469
+ updatedAt: string;
470
+ additions: number;
471
+ deletions: number;
472
+ commits: number;
473
+ reviewDecision?: string;
474
+ checks?: { passing: number; failing: number; pending: number };
475
+ }
476
+
477
+ export interface PRListResult {
478
+ prs: PRInfo[];
479
+ }
480
+
481
+ export interface PRCreateResult {
482
+ number: number;
483
+ url: string;
484
+ }
485
+
486
+ export interface PRActionResult {
487
+ status: "success";
488
+ diff?: string;
489
+ }
490
+
491
+ export type PRResult = PRListResult | PRCreateResult | PRActionResult | { pr: PRInfo };
492
+
493
+ export interface IssueParams {
494
+ operation: "issue";
495
+ action: "list" | "view" | "create" | "close" | "reopen" | "comment";
496
+ number?: number;
497
+ title?: string;
498
+ body?: string;
499
+ state?: "open" | "closed" | "all";
500
+ labels?: string[];
501
+ assignee?: string;
502
+ limit?: number;
503
+ comment_body?: string;
504
+ }
505
+
506
+ export interface IssueInfo {
507
+ number: number;
508
+ title: string;
509
+ state: string;
510
+ author: string;
511
+ body: string;
512
+ labels: string[];
513
+ assignees: string[];
514
+ url: string;
515
+ createdAt: string;
516
+ comments: number;
517
+ }
518
+
519
+ export interface IssueListResult {
520
+ issues: IssueInfo[];
521
+ }
522
+
523
+ export interface IssueCreateResult {
524
+ number: number;
525
+ url: string;
526
+ }
527
+
528
+ export interface IssueActionResult {
529
+ status: "success";
530
+ }
531
+
532
+ export type IssueResult = IssueListResult | IssueCreateResult | IssueActionResult | { issue: IssueInfo };
533
+
534
+ export interface CIParams {
535
+ operation: "ci";
536
+ action: "list" | "view" | "watch" | "run" | "cancel" | "rerun";
537
+ workflow?: string;
538
+ run_id?: number;
539
+ limit?: number;
540
+ branch?: string;
541
+ inputs?: Record<string, string>;
542
+ logs_failed?: boolean;
543
+ }
544
+
545
+ export interface RunInfo {
546
+ id: number;
547
+ name: string;
548
+ status: "queued" | "in_progress" | "completed";
549
+ conclusion?: "success" | "failure" | "cancelled" | "skipped";
550
+ branch: string;
551
+ sha: string;
552
+ url: string;
553
+ createdAt: string;
554
+ updatedAt: string;
555
+ }
556
+
557
+ export interface RunListResult {
558
+ runs: RunInfo[];
559
+ }
560
+
561
+ export interface JobInfo {
562
+ id: number;
563
+ name: string;
564
+ status: string;
565
+ conclusion?: string;
566
+ steps: { name: string; status: string; conclusion?: string }[];
567
+ }
568
+
569
+ export interface RunViewResult {
570
+ run: RunInfo;
571
+ jobs: JobInfo[];
572
+ logs?: string;
573
+ }
574
+
575
+ export interface CIActionResult {
576
+ status: "success";
577
+ }
578
+
579
+ export type CIResult = RunListResult | RunViewResult | CIActionResult;
580
+
581
+ export interface ReleaseParams {
582
+ operation: "release";
583
+ action: "list" | "view" | "create" | "delete" | "upload";
584
+ tag?: string;
585
+ title?: string;
586
+ notes?: string;
587
+ generate_notes?: boolean;
588
+ draft?: boolean;
589
+ prerelease?: boolean;
590
+ target?: string;
591
+ assets?: string[];
592
+ limit?: number;
593
+ }
594
+
595
+ export interface ReleaseInfo {
596
+ tag: string;
597
+ name: string;
598
+ body: string;
599
+ draft: boolean;
600
+ prerelease: boolean;
601
+ createdAt: string;
602
+ publishedAt: string;
603
+ url: string;
604
+ assets: { name: string; size: number; downloadCount: number }[];
605
+ }
606
+
607
+ export interface ReleaseListResult {
608
+ releases: ReleaseInfo[];
609
+ }
610
+
611
+ export interface ReleaseActionResult {
612
+ status: "success";
613
+ url?: string;
614
+ }
615
+
616
+ export type ReleaseResult = ReleaseListResult | ReleaseInfo | ReleaseActionResult;
617
+
618
+ export type GitParams =
619
+ | StatusParams
620
+ | DiffParams
621
+ | LogParams
622
+ | ShowParams
623
+ | BlameParams
624
+ | BranchParams
625
+ | AddParams
626
+ | RestoreParams
627
+ | CommitParams
628
+ | CheckoutParams
629
+ | MergeParams
630
+ | RebaseParams
631
+ | StashParams
632
+ | CherryPickParams
633
+ | FetchParams
634
+ | PullParams
635
+ | PushParams
636
+ | TagParams
637
+ | PRParams
638
+ | IssueParams
639
+ | CIParams
640
+ | ReleaseParams;
641
+
642
+ export type SafetyLevel = "safe" | "warn" | "confirm" | "block";
643
+
644
+ export interface SafetyPolicy {
645
+ forcePush: SafetyLevel;
646
+ forcePushMain: SafetyLevel;
647
+ hardReset: SafetyLevel;
648
+ discardChanges: SafetyLevel;
649
+ deleteBranch: SafetyLevel;
650
+ amendPushed: SafetyLevel;
651
+ rebasePushed: SafetyLevel;
652
+ }
653
+
654
+ export interface SafetyCheck {
655
+ level: SafetyLevel;
656
+ message: string;
657
+ suggestion?: string;
658
+ override?: string;
659
+ }
660
+
661
+ export interface SafetyResult {
662
+ blocked: boolean;
663
+ confirm: boolean;
664
+ message?: string;
665
+ suggestion?: string;
666
+ override?: string;
667
+ warnings: string[];
668
+ }