gitflash 0.5.1 → 0.7.0.beta1

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +69 -2
  4. data/bin/gitflash +10 -0
  5. data/command_descriptions.yml +99 -0
  6. data/lib/gitflash/branch.rb +14 -2
  7. data/lib/gitflash/cherry_pick.rb +128 -0
  8. data/lib/gitflash/cleanup.rb +70 -0
  9. data/lib/gitflash/cli.rb +72 -21
  10. data/lib/gitflash/command_runner.rb +23 -0
  11. data/lib/gitflash/commands/base.rb +15 -0
  12. data/lib/gitflash/commands/branches.rb +1 -0
  13. data/lib/gitflash/commands/checkout.rb +2 -1
  14. data/lib/gitflash/commands/clean.rb +51 -0
  15. data/lib/gitflash/commands/clean_criteria.rb +29 -0
  16. data/lib/gitflash/commands/delete.rb +23 -8
  17. data/lib/gitflash/commands/gc.rb +41 -0
  18. data/lib/gitflash/commands/hook_install.rb +77 -0
  19. data/lib/gitflash/commands/hook_status.rb +80 -0
  20. data/lib/gitflash/commands/mark.rb +85 -0
  21. data/lib/gitflash/commands/pick.rb +131 -0
  22. data/lib/gitflash/commands/pick_control.rb +67 -0
  23. data/lib/gitflash/commands/pick_outcome.rb +52 -0
  24. data/lib/gitflash/commands/removal_report.rb +65 -0
  25. data/lib/gitflash/commands/reset.rb +7 -1
  26. data/lib/gitflash/commands/snapshot_create.rb +30 -0
  27. data/lib/gitflash/commands/snapshot_list.rb +20 -0
  28. data/lib/gitflash/commands/undo.rb +131 -0
  29. data/lib/gitflash/commands/worktree_add.rb +98 -0
  30. data/lib/gitflash/commands/worktree_clean.rb +49 -0
  31. data/lib/gitflash/commands/worktree_command.rb +28 -0
  32. data/lib/gitflash/commands/worktree_list.rb +48 -0
  33. data/lib/gitflash/commands/worktree_lock.rb +54 -0
  34. data/lib/gitflash/commands/worktree_move.rb +47 -0
  35. data/lib/gitflash/commands/worktree_prune.rb +41 -0
  36. data/lib/gitflash/commands/worktree_remove.rb +119 -0
  37. data/lib/gitflash/commands/worktree_unlock.rb +12 -0
  38. data/lib/gitflash/config.rb +95 -0
  39. data/lib/gitflash/config_keys.rb +19 -0
  40. data/lib/gitflash/git/bash_command.rb +5 -4
  41. data/lib/gitflash/git/in_directory.rb +29 -0
  42. data/lib/gitflash/hook/branch_marker.rb +52 -0
  43. data/lib/gitflash/hook/claude.rb +126 -0
  44. data/lib/gitflash/hook/command_parser.rb +121 -0
  45. data/lib/gitflash/hook/creations.rb +85 -0
  46. data/lib/gitflash/hook/rules.rb +108 -0
  47. data/lib/gitflash/hook/settings.rb +73 -0
  48. data/lib/gitflash/hook_cli.rb +77 -0
  49. data/lib/gitflash/ownership.rb +59 -0
  50. data/lib/gitflash/protection.rb +19 -0
  51. data/lib/gitflash/repo.rb +12 -3
  52. data/lib/gitflash/restore.rb +141 -0
  53. data/lib/gitflash/snapshot.rb +47 -0
  54. data/lib/gitflash/snapshots.rb +70 -0
  55. data/lib/gitflash/state_capture.rb +129 -0
  56. data/lib/gitflash/ui.rb +7 -5
  57. data/lib/gitflash/version.rb +1 -1
  58. data/lib/gitflash/worktree.rb +32 -0
  59. data/lib/gitflash/worktree_cli.rb +115 -0
  60. data/lib/gitflash/worktree_revival.rb +55 -0
  61. data/lib/gitflash/worktrees.rb +147 -0
  62. data/schema/v1.json +1885 -102
  63. metadata +46 -1
data/schema/v1.json CHANGED
@@ -4,168 +4,1951 @@
4
4
  "title": "gitflash --json output, schema version 1",
5
5
  "description": "Every gitflash command run with --json prints exactly one object in this envelope. `ok` is true for the statuses done, planned, noop and cancelled. Fields may be added in later releases of version 1; existing fields keep their meaning.",
6
6
  "type": "object",
7
- "required": ["schema", "command", "ok", "status", "dry_run"],
7
+ "required": [
8
+ "schema",
9
+ "command",
10
+ "ok",
11
+ "status",
12
+ "dry_run"
13
+ ],
8
14
  "properties": {
9
- "schema": { "const": 1 },
10
- "command": { "enum": ["branches", "checkout", "delete", "reset"] },
11
- "ok": { "type": "boolean" },
15
+ "schema": {
16
+ "const": 1
17
+ },
18
+ "command": {
19
+ "enum": [
20
+ "branches",
21
+ "checkout",
22
+ "delete",
23
+ "reset",
24
+ "undo",
25
+ "snapshots",
26
+ "snapshot",
27
+ "gc",
28
+ "hook install",
29
+ "hook status",
30
+ "worktree list",
31
+ "worktree add",
32
+ "worktree remove",
33
+ "worktree prune",
34
+ "worktree lock",
35
+ "worktree unlock",
36
+ "worktree move",
37
+ "clean",
38
+ "worktree clean",
39
+ "pick",
40
+ "mark"
41
+ ]
42
+ },
43
+ "ok": {
44
+ "type": "boolean"
45
+ },
12
46
  "status": {
13
47
  "description": "done: the change was made. planned: --dry-run, nothing changed. noop: nothing to do. cancelled: the user declined. failed: git refused part of the change. confirmation_required: re-run with --yes after reviewing `plan`. error: invalid input or environment.",
14
- "enum": ["done", "planned", "noop", "cancelled", "failed", "confirmation_required", "error"]
48
+ "enum": [
49
+ "done",
50
+ "planned",
51
+ "noop",
52
+ "cancelled",
53
+ "failed",
54
+ "confirmation_required",
55
+ "error"
56
+ ]
57
+ },
58
+ "dry_run": {
59
+ "type": "boolean"
60
+ },
61
+ "plan": {
62
+ "type": "object",
63
+ "description": "The change that will be, would be or was made."
64
+ },
65
+ "result": {
66
+ "type": "object",
67
+ "description": "What happened, including what is needed to revert it."
68
+ },
69
+ "error": {
70
+ "$ref": "#/$defs/error"
71
+ },
72
+ "undo": {
73
+ "type": "object",
74
+ "description": "The snapshot saved before the change. Run `command` to revert it.",
75
+ "required": [
76
+ "snapshot",
77
+ "command"
78
+ ],
79
+ "properties": {
80
+ "snapshot": {
81
+ "type": "string"
82
+ },
83
+ "command": {
84
+ "type": "string"
85
+ }
86
+ }
87
+ }
88
+ },
89
+ "allOf": [
90
+ {
91
+ "if": {
92
+ "properties": {
93
+ "status": {
94
+ "enum": [
95
+ "done",
96
+ "planned",
97
+ "noop",
98
+ "cancelled"
99
+ ]
100
+ }
101
+ }
102
+ },
103
+ "then": {
104
+ "properties": {
105
+ "ok": {
106
+ "const": true
107
+ }
108
+ },
109
+ "not": {
110
+ "required": [
111
+ "error"
112
+ ]
113
+ }
114
+ },
115
+ "else": {
116
+ "properties": {
117
+ "ok": {
118
+ "const": false
119
+ }
120
+ },
121
+ "required": [
122
+ "error"
123
+ ]
124
+ }
125
+ },
126
+ {
127
+ "if": {
128
+ "properties": {
129
+ "status": {
130
+ "const": "confirmation_required"
131
+ }
132
+ }
133
+ },
134
+ "then": {
135
+ "required": [
136
+ "plan"
137
+ ]
138
+ }
139
+ },
140
+ {
141
+ "if": {
142
+ "properties": {
143
+ "command": {
144
+ "const": "branches"
145
+ }
146
+ }
147
+ },
148
+ "then": {
149
+ "properties": {
150
+ "result": {
151
+ "$ref": "#/$defs/branches_result"
152
+ }
153
+ }
154
+ }
155
+ },
156
+ {
157
+ "if": {
158
+ "properties": {
159
+ "command": {
160
+ "const": "checkout"
161
+ }
162
+ }
163
+ },
164
+ "then": {
165
+ "properties": {
166
+ "plan": {
167
+ "$ref": "#/$defs/checkout_plan"
168
+ },
169
+ "result": {
170
+ "$ref": "#/$defs/checkout_result"
171
+ }
172
+ }
173
+ }
174
+ },
175
+ {
176
+ "if": {
177
+ "properties": {
178
+ "command": {
179
+ "const": "delete"
180
+ }
181
+ }
182
+ },
183
+ "then": {
184
+ "properties": {
185
+ "plan": {
186
+ "$ref": "#/$defs/delete_plan"
187
+ },
188
+ "result": {
189
+ "$ref": "#/$defs/delete_result"
190
+ }
191
+ }
192
+ }
193
+ },
194
+ {
195
+ "if": {
196
+ "properties": {
197
+ "command": {
198
+ "const": "reset"
199
+ }
200
+ }
201
+ },
202
+ "then": {
203
+ "properties": {
204
+ "plan": {
205
+ "$ref": "#/$defs/reset_plan"
206
+ },
207
+ "result": {
208
+ "$ref": "#/$defs/reset_result"
209
+ }
210
+ }
211
+ }
212
+ },
213
+ {
214
+ "if": {
215
+ "properties": {
216
+ "command": {
217
+ "const": "undo"
218
+ }
219
+ }
220
+ },
221
+ "then": {
222
+ "properties": {
223
+ "plan": {
224
+ "$ref": "#/$defs/undo_plan"
225
+ },
226
+ "result": {
227
+ "$ref": "#/$defs/undo_result"
228
+ }
229
+ }
230
+ }
231
+ },
232
+ {
233
+ "if": {
234
+ "properties": {
235
+ "command": {
236
+ "const": "snapshots"
237
+ }
238
+ }
239
+ },
240
+ "then": {
241
+ "properties": {
242
+ "result": {
243
+ "$ref": "#/$defs/snapshots_result"
244
+ }
245
+ }
246
+ }
247
+ },
248
+ {
249
+ "if": {
250
+ "properties": {
251
+ "command": {
252
+ "const": "snapshot"
253
+ }
254
+ }
255
+ },
256
+ "then": {
257
+ "properties": {
258
+ "result": {
259
+ "$ref": "#/$defs/snapshot_result"
260
+ }
261
+ }
262
+ }
263
+ },
264
+ {
265
+ "if": {
266
+ "properties": {
267
+ "command": {
268
+ "const": "gc"
269
+ }
270
+ }
271
+ },
272
+ "then": {
273
+ "properties": {
274
+ "plan": {
275
+ "$ref": "#/$defs/gc_plan"
276
+ },
277
+ "result": {
278
+ "$ref": "#/$defs/gc_result"
279
+ }
280
+ }
281
+ }
282
+ },
283
+ {
284
+ "if": {
285
+ "properties": {
286
+ "command": {
287
+ "const": "hook install"
288
+ }
289
+ }
290
+ },
291
+ "then": {
292
+ "properties": {
293
+ "plan": {
294
+ "$ref": "#/$defs/hook_install"
295
+ },
296
+ "result": {
297
+ "$ref": "#/$defs/hook_install"
298
+ }
299
+ }
300
+ }
301
+ },
302
+ {
303
+ "if": {
304
+ "properties": {
305
+ "command": {
306
+ "const": "hook status"
307
+ }
308
+ }
309
+ },
310
+ "then": {
311
+ "properties": {
312
+ "result": {
313
+ "$ref": "#/$defs/hook_status"
314
+ }
315
+ }
316
+ }
317
+ },
318
+ {
319
+ "if": {
320
+ "properties": {
321
+ "command": {
322
+ "const": "worktree list"
323
+ }
324
+ }
325
+ },
326
+ "then": {
327
+ "properties": {
328
+ "result": {
329
+ "$ref": "#/$defs/worktree_list_result"
330
+ }
331
+ }
332
+ }
333
+ },
334
+ {
335
+ "if": {
336
+ "properties": {
337
+ "command": {
338
+ "const": "worktree add"
339
+ }
340
+ }
341
+ },
342
+ "then": {
343
+ "properties": {
344
+ "plan": {
345
+ "$ref": "#/$defs/worktree_add_plan"
346
+ },
347
+ "result": {
348
+ "$ref": "#/$defs/worktree_add_result"
349
+ }
350
+ }
351
+ }
352
+ },
353
+ {
354
+ "if": {
355
+ "properties": {
356
+ "command": {
357
+ "const": "worktree remove"
358
+ }
359
+ }
360
+ },
361
+ "then": {
362
+ "properties": {
363
+ "plan": {
364
+ "$ref": "#/$defs/worktree_remove_plan"
365
+ },
366
+ "result": {
367
+ "$ref": "#/$defs/worktree_remove_result"
368
+ }
369
+ }
370
+ }
371
+ },
372
+ {
373
+ "if": {
374
+ "properties": {
375
+ "command": {
376
+ "const": "worktree prune"
377
+ }
378
+ }
379
+ },
380
+ "then": {
381
+ "properties": {
382
+ "plan": {
383
+ "$ref": "#/$defs/worktree_prune_plan"
384
+ },
385
+ "result": {
386
+ "$ref": "#/$defs/worktree_prune_result"
387
+ }
388
+ }
389
+ }
390
+ },
391
+ {
392
+ "if": {
393
+ "properties": {
394
+ "command": {
395
+ "const": "worktree lock"
396
+ }
397
+ }
398
+ },
399
+ "then": {
400
+ "properties": {
401
+ "plan": {
402
+ "$ref": "#/$defs/worktree_lock_plan"
403
+ },
404
+ "result": {
405
+ "$ref": "#/$defs/worktree_lock_result"
406
+ }
407
+ }
408
+ }
409
+ },
410
+ {
411
+ "if": {
412
+ "properties": {
413
+ "command": {
414
+ "const": "worktree unlock"
415
+ }
416
+ }
417
+ },
418
+ "then": {
419
+ "properties": {
420
+ "plan": {
421
+ "$ref": "#/$defs/worktree_unlock_plan"
422
+ },
423
+ "result": {
424
+ "$ref": "#/$defs/worktree_unlock_result"
425
+ }
426
+ }
427
+ }
428
+ },
429
+ {
430
+ "if": {
431
+ "properties": {
432
+ "command": {
433
+ "const": "worktree move"
434
+ }
435
+ }
436
+ },
437
+ "then": {
438
+ "properties": {
439
+ "plan": {
440
+ "$ref": "#/$defs/worktree_move_plan"
441
+ },
442
+ "result": {
443
+ "$ref": "#/$defs/worktree_move_result"
444
+ }
445
+ }
446
+ }
447
+ },
448
+ {
449
+ "if": {
450
+ "properties": {
451
+ "command": {
452
+ "const": "clean"
453
+ }
454
+ }
455
+ },
456
+ "then": {
457
+ "properties": {
458
+ "plan": {
459
+ "$ref": "#/$defs/clean_plan"
460
+ },
461
+ "result": {
462
+ "$ref": "#/$defs/delete_result"
463
+ }
464
+ }
465
+ }
466
+ },
467
+ {
468
+ "if": {
469
+ "properties": {
470
+ "command": {
471
+ "const": "worktree clean"
472
+ }
473
+ }
474
+ },
475
+ "then": {
476
+ "properties": {
477
+ "plan": {
478
+ "$ref": "#/$defs/worktree_clean_plan"
479
+ },
480
+ "result": {
481
+ "$ref": "#/$defs/worktree_remove_result"
482
+ }
483
+ }
484
+ }
485
+ },
486
+ {
487
+ "if": {
488
+ "properties": {
489
+ "command": {
490
+ "const": "pick"
491
+ }
492
+ }
493
+ },
494
+ "then": {
495
+ "properties": {
496
+ "plan": {
497
+ "$ref": "#/$defs/pick_plan"
498
+ },
499
+ "result": {
500
+ "if": {
501
+ "required": [
502
+ "commits"
503
+ ]
504
+ },
505
+ "then": {
506
+ "$ref": "#/$defs/pick_list_result"
507
+ },
508
+ "else": {
509
+ "$ref": "#/$defs/pick_result"
510
+ }
511
+ }
512
+ }
513
+ }
514
+ },
515
+ {
516
+ "if": {
517
+ "properties": {
518
+ "command": {
519
+ "const": "mark"
520
+ }
521
+ }
522
+ },
523
+ "then": {
524
+ "properties": {
525
+ "plan": {
526
+ "$ref": "#/$defs/mark_plan"
527
+ },
528
+ "result": {
529
+ "$ref": "#/$defs/mark_result"
530
+ }
531
+ }
532
+ }
533
+ }
534
+ ],
535
+ "$defs": {
536
+ "sha": {
537
+ "type": "string",
538
+ "pattern": "^[0-9a-f]{4,64}$"
539
+ },
540
+ "error": {
541
+ "type": "object",
542
+ "required": [
543
+ "code",
544
+ "message",
545
+ "exit_code"
546
+ ],
547
+ "properties": {
548
+ "code": {
549
+ "description": "Stable identifier to branch on; the message is for humans.",
550
+ "enum": [
551
+ "not_a_repository",
552
+ "input_required",
553
+ "invalid_usage",
554
+ "invalid_options",
555
+ "unknown_branch",
556
+ "unknown_commit",
557
+ "protected_branch",
558
+ "confirmation_required",
559
+ "git_failed",
560
+ "failed",
561
+ "unknown_snapshot",
562
+ "wrong_worktree",
563
+ "invalid_settings",
564
+ "invalid_config",
565
+ "unknown_worktree",
566
+ "protected_worktree",
567
+ "conflict"
568
+ ]
569
+ },
570
+ "message": {
571
+ "type": "string"
572
+ },
573
+ "exit_code": {
574
+ "enum": [
575
+ 1,
576
+ 2
577
+ ]
578
+ }
579
+ }
580
+ },
581
+ "branch": {
582
+ "type": "object",
583
+ "required": [
584
+ "name",
585
+ "sha",
586
+ "current",
587
+ "default",
588
+ "upstream",
589
+ "upstream_gone",
590
+ "ahead",
591
+ "behind",
592
+ "merged",
593
+ "last_commit_at",
594
+ "last_commit_author",
595
+ "last_commit_subject"
596
+ ],
597
+ "properties": {
598
+ "name": {
599
+ "type": "string"
600
+ },
601
+ "sha": {
602
+ "$ref": "#/$defs/sha"
603
+ },
604
+ "current": {
605
+ "type": "boolean"
606
+ },
607
+ "default": {
608
+ "type": "boolean",
609
+ "description": "The branch origin/HEAD points to, else main or master."
610
+ },
611
+ "upstream": {
612
+ "type": [
613
+ "string",
614
+ "null"
615
+ ]
616
+ },
617
+ "upstream_gone": {
618
+ "type": "boolean",
619
+ "description": "The upstream branch was deleted on the remote."
620
+ },
621
+ "ahead": {
622
+ "type": "integer",
623
+ "minimum": 0
624
+ },
625
+ "behind": {
626
+ "type": "integer",
627
+ "minimum": 0
628
+ },
629
+ "merged": {
630
+ "type": [
631
+ "boolean",
632
+ "null"
633
+ ],
634
+ "description": "Merged into the default branch; null when there is no default branch."
635
+ },
636
+ "last_commit_at": {
637
+ "type": "string",
638
+ "format": "date-time"
639
+ },
640
+ "last_commit_author": {
641
+ "type": "string"
642
+ },
643
+ "last_commit_subject": {
644
+ "type": "string"
645
+ },
646
+ "owner": {
647
+ "enum": [
648
+ "agent",
649
+ "human",
650
+ null
651
+ ],
652
+ "description": "Who created the branch; null when unmarked (treated as human)."
653
+ }
654
+ }
655
+ },
656
+ "branches_result": {
657
+ "type": "object",
658
+ "required": [
659
+ "default_branch",
660
+ "branches"
661
+ ],
662
+ "properties": {
663
+ "default_branch": {
664
+ "type": [
665
+ "string",
666
+ "null"
667
+ ]
668
+ },
669
+ "branches": {
670
+ "type": "array",
671
+ "items": {
672
+ "$ref": "#/$defs/branch"
673
+ }
674
+ }
675
+ }
676
+ },
677
+ "checkout_plan": {
678
+ "type": "object",
679
+ "required": [
680
+ "branch"
681
+ ],
682
+ "properties": {
683
+ "branch": {
684
+ "type": "string"
685
+ }
686
+ }
687
+ },
688
+ "checkout_result": {
689
+ "type": "object",
690
+ "required": [
691
+ "branch",
692
+ "previous_branch"
693
+ ],
694
+ "properties": {
695
+ "branch": {
696
+ "type": [
697
+ "string",
698
+ "null"
699
+ ]
700
+ },
701
+ "previous_branch": {
702
+ "type": [
703
+ "string",
704
+ "null"
705
+ ],
706
+ "description": "Check this out to go back; null on a detached HEAD."
707
+ }
708
+ }
709
+ },
710
+ "delete_plan": {
711
+ "type": "object",
712
+ "required": [
713
+ "branches",
714
+ "force"
715
+ ],
716
+ "properties": {
717
+ "branches": {
718
+ "type": "array",
719
+ "items": {
720
+ "type": "string"
721
+ }
722
+ },
723
+ "force": {
724
+ "type": "boolean"
725
+ }
726
+ }
727
+ },
728
+ "delete_result": {
729
+ "type": "object",
730
+ "required": [
731
+ "deleted",
732
+ "failed"
733
+ ],
734
+ "properties": {
735
+ "deleted": {
736
+ "type": "array",
737
+ "description": "Recreate a branch with: git branch NAME SHA",
738
+ "items": {
739
+ "type": "object",
740
+ "required": [
741
+ "branch",
742
+ "sha"
743
+ ],
744
+ "properties": {
745
+ "branch": {
746
+ "type": "string"
747
+ },
748
+ "sha": {
749
+ "$ref": "#/$defs/sha"
750
+ }
751
+ }
752
+ }
753
+ },
754
+ "failed": {
755
+ "type": "array",
756
+ "items": {
757
+ "type": "object",
758
+ "required": [
759
+ "branch",
760
+ "error"
761
+ ],
762
+ "properties": {
763
+ "branch": {
764
+ "type": "string"
765
+ },
766
+ "error": {
767
+ "type": "string"
768
+ }
769
+ }
770
+ }
771
+ }
772
+ }
773
+ },
774
+ "reset_plan": {
775
+ "type": "object",
776
+ "required": [
777
+ "commit",
778
+ "mode"
779
+ ],
780
+ "properties": {
781
+ "commit": {
782
+ "$ref": "#/$defs/sha"
783
+ },
784
+ "mode": {
785
+ "enum": [
786
+ "soft",
787
+ "mixed",
788
+ "hard"
789
+ ]
790
+ }
791
+ }
792
+ },
793
+ "reset_result": {
794
+ "type": "object",
795
+ "required": [
796
+ "commit",
797
+ "mode",
798
+ "previous_commit"
799
+ ],
800
+ "properties": {
801
+ "commit": {
802
+ "$ref": "#/$defs/sha"
803
+ },
804
+ "mode": {
805
+ "enum": [
806
+ "soft",
807
+ "mixed",
808
+ "hard"
809
+ ]
810
+ },
811
+ "previous_commit": {
812
+ "$ref": "#/$defs/sha",
813
+ "description": "Reset to this commit to go back. Uncommitted changes lost by a hard reset cannot be restored this way."
814
+ }
815
+ }
816
+ },
817
+ "snapshot": {
818
+ "type": "object",
819
+ "required": [
820
+ "id",
821
+ "created_at",
822
+ "reason",
823
+ "scope",
824
+ "worktree_path",
825
+ "head",
826
+ "branches",
827
+ "stashes",
828
+ "index",
829
+ "worktree",
830
+ "skipped_files"
831
+ ],
832
+ "properties": {
833
+ "id": {
834
+ "type": "string"
835
+ },
836
+ "created_at": {
837
+ "type": "string",
838
+ "format": "date-time"
839
+ },
840
+ "reason": {
841
+ "type": "string"
842
+ },
843
+ "scope": {
844
+ "type": "array",
845
+ "items": {
846
+ "enum": [
847
+ "branches",
848
+ "head",
849
+ "worktree",
850
+ "stashes"
851
+ ]
852
+ }
853
+ },
854
+ "worktree_path": {
855
+ "type": "string"
856
+ },
857
+ "head": {
858
+ "type": "object",
859
+ "required": [
860
+ "branch",
861
+ "sha"
862
+ ],
863
+ "properties": {
864
+ "branch": {
865
+ "type": [
866
+ "string",
867
+ "null"
868
+ ]
869
+ },
870
+ "sha": {
871
+ "type": [
872
+ "string",
873
+ "null"
874
+ ],
875
+ "pattern": "^[0-9a-f]{4,64}$"
876
+ }
877
+ }
878
+ },
879
+ "branches": {
880
+ "type": "object",
881
+ "additionalProperties": {
882
+ "$ref": "#/$defs/sha"
883
+ }
884
+ },
885
+ "stashes": {
886
+ "type": "array",
887
+ "items": {
888
+ "$ref": "#/$defs/sha"
889
+ }
890
+ },
891
+ "index": {
892
+ "type": [
893
+ "string",
894
+ "null"
895
+ ],
896
+ "pattern": "^[0-9a-f]{4,64}$"
897
+ },
898
+ "worktree": {
899
+ "type": [
900
+ "string",
901
+ "null"
902
+ ],
903
+ "pattern": "^[0-9a-f]{4,64}$"
904
+ },
905
+ "skipped_files": {
906
+ "type": "array",
907
+ "items": {
908
+ "type": "string"
909
+ },
910
+ "description": "Untracked files not saved because they are larger than 50 MB."
911
+ }
912
+ }
913
+ },
914
+ "undo_plan": {
915
+ "type": "object",
916
+ "required": [
917
+ "snapshot",
918
+ "branches",
919
+ "head",
920
+ "worktree",
921
+ "stashes"
922
+ ],
923
+ "properties": {
924
+ "snapshot": {
925
+ "type": "string"
926
+ },
927
+ "branches": {
928
+ "type": "array",
929
+ "items": {
930
+ "type": "object",
931
+ "required": [
932
+ "branch",
933
+ "from",
934
+ "to"
935
+ ],
936
+ "properties": {
937
+ "branch": {
938
+ "type": "string"
939
+ },
940
+ "from": {
941
+ "type": [
942
+ "string",
943
+ "null"
944
+ ],
945
+ "pattern": "^[0-9a-f]{4,64}$"
946
+ },
947
+ "to": {
948
+ "$ref": "#/$defs/sha"
949
+ }
950
+ }
951
+ }
952
+ },
953
+ "head": {
954
+ "type": [
955
+ "object",
956
+ "null"
957
+ ],
958
+ "required": [
959
+ "from",
960
+ "to"
961
+ ],
962
+ "properties": {
963
+ "from": {
964
+ "type": [
965
+ "string",
966
+ "null"
967
+ ]
968
+ },
969
+ "to": {
970
+ "type": [
971
+ "string",
972
+ "null"
973
+ ]
974
+ }
975
+ }
976
+ },
977
+ "worktree": {
978
+ "type": "boolean",
979
+ "description": "Tracked, staged and untracked files are restored."
980
+ },
981
+ "stashes": {
982
+ "type": "array",
983
+ "items": {
984
+ "$ref": "#/$defs/sha"
985
+ }
986
+ },
987
+ "recreate_worktree": {
988
+ "type": [
989
+ "string",
990
+ "null"
991
+ ],
992
+ "description": "Directory of a removed worktree that undo adds again before restoring it."
993
+ }
994
+ }
995
+ },
996
+ "undo_result": {
997
+ "type": "object",
998
+ "required": [
999
+ "snapshot"
1000
+ ],
1001
+ "properties": {
1002
+ "snapshot": {
1003
+ "type": [
1004
+ "string",
1005
+ "null"
1006
+ ]
1007
+ }
1008
+ }
1009
+ },
1010
+ "snapshots_result": {
1011
+ "type": "object",
1012
+ "required": [
1013
+ "snapshots"
1014
+ ],
1015
+ "properties": {
1016
+ "snapshots": {
1017
+ "type": "array",
1018
+ "items": {
1019
+ "$ref": "#/$defs/snapshot"
1020
+ }
1021
+ }
1022
+ }
1023
+ },
1024
+ "snapshot_result": {
1025
+ "type": "object",
1026
+ "required": [
1027
+ "snapshot"
1028
+ ],
1029
+ "properties": {
1030
+ "snapshot": {
1031
+ "$ref": "#/$defs/snapshot"
1032
+ }
1033
+ }
1034
+ },
1035
+ "gc_plan": {
1036
+ "type": "object",
1037
+ "required": [
1038
+ "older_than_days",
1039
+ "snapshots"
1040
+ ],
1041
+ "properties": {
1042
+ "older_than_days": {
1043
+ "type": "number"
1044
+ },
1045
+ "snapshots": {
1046
+ "type": "array",
1047
+ "items": {
1048
+ "type": "string"
1049
+ }
1050
+ }
1051
+ }
1052
+ },
1053
+ "gc_result": {
1054
+ "type": "object",
1055
+ "required": [
1056
+ "deleted"
1057
+ ],
1058
+ "properties": {
1059
+ "deleted": {
1060
+ "type": "array",
1061
+ "items": {
1062
+ "type": "string"
1063
+ }
1064
+ }
1065
+ }
1066
+ },
1067
+ "hook_install": {
1068
+ "type": "object",
1069
+ "required": [
1070
+ "scope",
1071
+ "file",
1072
+ "command",
1073
+ "applies_to"
1074
+ ],
1075
+ "properties": {
1076
+ "scope": {
1077
+ "enum": [
1078
+ "local",
1079
+ "project",
1080
+ "user"
1081
+ ]
1082
+ },
1083
+ "file": {
1084
+ "type": "string"
1085
+ },
1086
+ "command": {
1087
+ "type": "string"
1088
+ },
1089
+ "applies_to": {
1090
+ "type": "string",
1091
+ "description": "Which Claude Code sessions read this file. Running sessions reload it."
1092
+ },
1093
+ "marking_command": {
1094
+ "type": "string",
1095
+ "description": "The PostToolUse command that marks branches an agent creates as agent work."
1096
+ }
1097
+ }
1098
+ },
1099
+ "hook_status": {
1100
+ "type": "object",
1101
+ "required": [
1102
+ "active",
1103
+ "executable",
1104
+ "files"
1105
+ ],
1106
+ "properties": {
1107
+ "active": {
1108
+ "type": "boolean",
1109
+ "description": "The hook is in at least one settings file that applies here and the gitflash executable is on PATH."
1110
+ },
1111
+ "executable": {
1112
+ "type": [
1113
+ "string",
1114
+ "null"
1115
+ ]
1116
+ },
1117
+ "files": {
1118
+ "type": "array",
1119
+ "items": {
1120
+ "type": "object",
1121
+ "required": [
1122
+ "scope",
1123
+ "file",
1124
+ "installed",
1125
+ "command",
1126
+ "applies_to"
1127
+ ],
1128
+ "properties": {
1129
+ "scope": {
1130
+ "enum": [
1131
+ "local",
1132
+ "project",
1133
+ "user"
1134
+ ]
1135
+ },
1136
+ "file": {
1137
+ "type": "string"
1138
+ },
1139
+ "installed": {
1140
+ "type": "boolean"
1141
+ },
1142
+ "command": {
1143
+ "type": [
1144
+ "string",
1145
+ "null"
1146
+ ]
1147
+ },
1148
+ "applies_to": {
1149
+ "type": "string"
1150
+ },
1151
+ "marking": {
1152
+ "type": "boolean",
1153
+ "description": "This file has the PostToolUse hook."
1154
+ }
1155
+ }
1156
+ }
1157
+ },
1158
+ "marking": {
1159
+ "type": "boolean",
1160
+ "description": "A settings file that applies here also has the PostToolUse hook that marks agent branches."
1161
+ }
1162
+ }
1163
+ },
1164
+ "worktree": {
1165
+ "type": "object",
1166
+ "required": [
1167
+ "path",
1168
+ "head",
1169
+ "branch",
1170
+ "main",
1171
+ "bare",
1172
+ "locked",
1173
+ "lock_reason",
1174
+ "missing",
1175
+ "dirty",
1176
+ "ahead",
1177
+ "behind",
1178
+ "merged"
1179
+ ],
1180
+ "properties": {
1181
+ "path": {
1182
+ "type": "string",
1183
+ "description": "Absolute path of the worktree directory."
1184
+ },
1185
+ "head": {
1186
+ "type": [
1187
+ "string",
1188
+ "null"
1189
+ ]
1190
+ },
1191
+ "branch": {
1192
+ "type": [
1193
+ "string",
1194
+ "null"
1195
+ ],
1196
+ "description": "null for a detached HEAD."
1197
+ },
1198
+ "main": {
1199
+ "type": "boolean"
1200
+ },
1201
+ "bare": {
1202
+ "type": "boolean"
1203
+ },
1204
+ "locked": {
1205
+ "type": "boolean"
1206
+ },
1207
+ "lock_reason": {
1208
+ "type": [
1209
+ "string",
1210
+ "null"
1211
+ ]
1212
+ },
1213
+ "missing": {
1214
+ "type": "boolean",
1215
+ "description": "The directory no longer exists."
1216
+ },
1217
+ "dirty": {
1218
+ "type": [
1219
+ "boolean",
1220
+ "null"
1221
+ ],
1222
+ "description": "Uncommitted or untracked files; null when unknown."
1223
+ },
1224
+ "ahead": {
1225
+ "type": [
1226
+ "integer",
1227
+ "null"
1228
+ ],
1229
+ "minimum": 0
1230
+ },
1231
+ "behind": {
1232
+ "type": [
1233
+ "integer",
1234
+ "null"
1235
+ ],
1236
+ "minimum": 0
1237
+ },
1238
+ "merged": {
1239
+ "type": [
1240
+ "boolean",
1241
+ "null"
1242
+ ],
1243
+ "description": "Branch merged into the default branch; null without a branch."
1244
+ },
1245
+ "owner": {
1246
+ "enum": [
1247
+ "agent",
1248
+ "human",
1249
+ null
1250
+ ],
1251
+ "description": "Who created the branch; null when unmarked (treated as human)."
1252
+ }
1253
+ }
15
1254
  },
16
- "dry_run": { "type": "boolean" },
17
- "plan": { "type": "object", "description": "The change that will be, would be or was made." },
18
- "result": { "type": "object", "description": "What happened, including what is needed to revert it." },
19
- "error": { "$ref": "#/$defs/error" }
20
- },
21
- "allOf": [
22
- {
23
- "if": { "properties": { "status": { "enum": ["done", "planned", "noop", "cancelled"] } } },
24
- "then": { "properties": { "ok": { "const": true } }, "not": { "required": ["error"] } },
25
- "else": { "properties": { "ok": { "const": false } }, "required": ["error"] }
1255
+ "worktree_list_result": {
1256
+ "type": "object",
1257
+ "required": [
1258
+ "worktrees"
1259
+ ],
1260
+ "properties": {
1261
+ "worktrees": {
1262
+ "type": "array",
1263
+ "items": {
1264
+ "$ref": "#/$defs/worktree"
1265
+ }
1266
+ }
1267
+ }
26
1268
  },
27
- {
28
- "if": { "properties": { "status": { "const": "confirmation_required" } } },
29
- "then": { "required": ["plan"] }
1269
+ "worktree_add_plan": {
1270
+ "type": "object",
1271
+ "required": [
1272
+ "branch",
1273
+ "path",
1274
+ "source",
1275
+ "from",
1276
+ "owner"
1277
+ ],
1278
+ "properties": {
1279
+ "branch": {
1280
+ "type": "string"
1281
+ },
1282
+ "path": {
1283
+ "type": "string"
1284
+ },
1285
+ "source": {
1286
+ "enum": [
1287
+ "existing",
1288
+ "remote",
1289
+ "new"
1290
+ ]
1291
+ },
1292
+ "from": {
1293
+ "type": [
1294
+ "string",
1295
+ "null"
1296
+ ]
1297
+ },
1298
+ "owner": {
1299
+ "enum": [
1300
+ "agent",
1301
+ "human",
1302
+ null
1303
+ ],
1304
+ "description": "Mark given to a branch created here; null for an existing branch."
1305
+ }
1306
+ }
30
1307
  },
31
- {
32
- "if": { "properties": { "command": { "const": "branches" } } },
33
- "then": { "properties": { "result": { "$ref": "#/$defs/branches_result" } } }
1308
+ "worktree_add_result": {
1309
+ "type": "object",
1310
+ "required": [
1311
+ "branch",
1312
+ "path",
1313
+ "source",
1314
+ "owner",
1315
+ "head"
1316
+ ],
1317
+ "properties": {
1318
+ "branch": {
1319
+ "type": "string"
1320
+ },
1321
+ "path": {
1322
+ "type": "string"
1323
+ },
1324
+ "source": {
1325
+ "enum": [
1326
+ "existing",
1327
+ "remote",
1328
+ "new"
1329
+ ]
1330
+ },
1331
+ "owner": {
1332
+ "enum": [
1333
+ "agent",
1334
+ "human",
1335
+ null
1336
+ ]
1337
+ },
1338
+ "head": {
1339
+ "$ref": "#/$defs/sha"
1340
+ }
1341
+ }
34
1342
  },
35
- {
36
- "if": { "properties": { "command": { "const": "checkout" } } },
37
- "then": {
38
- "properties": {
39
- "plan": { "$ref": "#/$defs/checkout_plan" },
40
- "result": { "$ref": "#/$defs/checkout_result" }
1343
+ "worktree_remove_plan": {
1344
+ "type": "object",
1345
+ "required": [
1346
+ "worktrees",
1347
+ "force"
1348
+ ],
1349
+ "properties": {
1350
+ "worktrees": {
1351
+ "type": "array",
1352
+ "items": {
1353
+ "type": "object",
1354
+ "required": [
1355
+ "path",
1356
+ "branch",
1357
+ "dirty",
1358
+ "locked"
1359
+ ],
1360
+ "properties": {
1361
+ "path": {
1362
+ "type": "string"
1363
+ },
1364
+ "branch": {
1365
+ "type": [
1366
+ "string",
1367
+ "null"
1368
+ ]
1369
+ },
1370
+ "dirty": {
1371
+ "type": [
1372
+ "boolean",
1373
+ "null"
1374
+ ]
1375
+ },
1376
+ "locked": {
1377
+ "type": "boolean"
1378
+ },
1379
+ "ignored_count": {
1380
+ "type": "integer",
1381
+ "minimum": 0,
1382
+ "description": "Ignored files and directories that snapshots do not save and removal deletes for good."
1383
+ },
1384
+ "ignored": {
1385
+ "type": "array",
1386
+ "items": {
1387
+ "type": "string"
1388
+ },
1389
+ "description": "The first few of them."
1390
+ }
1391
+ }
1392
+ }
1393
+ },
1394
+ "force": {
1395
+ "type": "boolean"
41
1396
  }
42
1397
  }
43
1398
  },
44
- {
45
- "if": { "properties": { "command": { "const": "delete" } } },
46
- "then": {
47
- "properties": {
48
- "plan": { "$ref": "#/$defs/delete_plan" },
49
- "result": { "$ref": "#/$defs/delete_result" }
1399
+ "worktree_remove_result": {
1400
+ "type": "object",
1401
+ "required": [
1402
+ "removed",
1403
+ "failed"
1404
+ ],
1405
+ "properties": {
1406
+ "removed": {
1407
+ "type": "array",
1408
+ "description": "Bring one back with the undo command in its row.",
1409
+ "items": {
1410
+ "type": "object",
1411
+ "required": [
1412
+ "path",
1413
+ "branch",
1414
+ "head",
1415
+ "snapshot",
1416
+ "undo"
1417
+ ],
1418
+ "properties": {
1419
+ "path": {
1420
+ "type": "string"
1421
+ },
1422
+ "branch": {
1423
+ "type": [
1424
+ "string",
1425
+ "null"
1426
+ ]
1427
+ },
1428
+ "head": {
1429
+ "type": [
1430
+ "string",
1431
+ "null"
1432
+ ]
1433
+ },
1434
+ "snapshot": {
1435
+ "type": "string"
1436
+ },
1437
+ "undo": {
1438
+ "type": "string"
1439
+ }
1440
+ }
1441
+ }
1442
+ },
1443
+ "failed": {
1444
+ "type": "array",
1445
+ "items": {
1446
+ "type": "object",
1447
+ "required": [
1448
+ "path",
1449
+ "error"
1450
+ ],
1451
+ "properties": {
1452
+ "path": {
1453
+ "type": "string"
1454
+ },
1455
+ "error": {
1456
+ "type": "string"
1457
+ }
1458
+ }
1459
+ }
50
1460
  }
51
1461
  }
52
1462
  },
53
- {
54
- "if": { "properties": { "command": { "const": "reset" } } },
55
- "then": {
56
- "properties": {
57
- "plan": { "$ref": "#/$defs/reset_plan" },
58
- "result": { "$ref": "#/$defs/reset_result" }
1463
+ "worktree_prune_plan": {
1464
+ "type": "object",
1465
+ "required": [
1466
+ "worktrees"
1467
+ ],
1468
+ "properties": {
1469
+ "worktrees": {
1470
+ "type": "array",
1471
+ "items": {
1472
+ "type": "string"
1473
+ }
59
1474
  }
60
1475
  }
61
- }
62
- ],
63
- "$defs": {
64
- "sha": { "type": "string", "pattern": "^[0-9a-f]{4,64}$" },
65
- "error": {
1476
+ },
1477
+ "worktree_prune_result": {
66
1478
  "type": "object",
67
- "required": ["code", "message", "exit_code"],
1479
+ "required": [
1480
+ "pruned"
1481
+ ],
68
1482
  "properties": {
69
- "code": {
70
- "description": "Stable identifier to branch on; the message is for humans.",
71
- "enum": [
72
- "not_a_repository", "input_required", "invalid_usage", "invalid_options",
73
- "unknown_branch", "unknown_commit", "protected_branch",
74
- "confirmation_required", "git_failed", "failed"
75
- ]
1483
+ "pruned": {
1484
+ "type": "array",
1485
+ "items": {
1486
+ "type": "string"
1487
+ }
1488
+ }
1489
+ }
1490
+ },
1491
+ "worktree_lock_plan": {
1492
+ "type": "object",
1493
+ "required": [
1494
+ "path"
1495
+ ],
1496
+ "properties": {
1497
+ "path": {
1498
+ "type": "string"
76
1499
  },
77
- "message": { "type": "string" },
78
- "exit_code": { "enum": [1, 2] }
1500
+ "reason": {
1501
+ "type": "string"
1502
+ }
79
1503
  }
80
1504
  },
81
- "branch": {
1505
+ "worktree_unlock_plan": {
82
1506
  "type": "object",
83
1507
  "required": [
84
- "name", "sha", "current", "default", "upstream", "upstream_gone", "ahead", "behind",
85
- "merged", "last_commit_at", "last_commit_author", "last_commit_subject"
1508
+ "path"
86
1509
  ],
87
1510
  "properties": {
88
- "name": { "type": "string" },
89
- "sha": { "$ref": "#/$defs/sha" },
90
- "current": { "type": "boolean" },
91
- "default": { "type": "boolean", "description": "The branch origin/HEAD points to, else main or master." },
92
- "upstream": { "type": ["string", "null"] },
93
- "upstream_gone": { "type": "boolean", "description": "The upstream branch was deleted on the remote." },
94
- "ahead": { "type": "integer", "minimum": 0 },
95
- "behind": { "type": "integer", "minimum": 0 },
96
- "merged": { "type": ["boolean", "null"], "description": "Merged into the default branch; null when there is no default branch." },
97
- "last_commit_at": { "type": "string", "format": "date-time" },
98
- "last_commit_author": { "type": "string" },
99
- "last_commit_subject": { "type": "string" }
1511
+ "path": {
1512
+ "type": "string"
1513
+ }
100
1514
  }
101
1515
  },
102
- "branches_result": {
1516
+ "worktree_lock_result": {
103
1517
  "type": "object",
104
- "required": ["default_branch", "branches"],
1518
+ "required": [
1519
+ "path",
1520
+ "locked"
1521
+ ],
105
1522
  "properties": {
106
- "default_branch": { "type": ["string", "null"] },
107
- "branches": { "type": "array", "items": { "$ref": "#/$defs/branch" } }
1523
+ "path": {
1524
+ "type": "string"
1525
+ },
1526
+ "reason": {
1527
+ "type": "string"
1528
+ },
1529
+ "locked": {
1530
+ "type": "boolean"
1531
+ }
108
1532
  }
109
1533
  },
110
- "checkout_plan": {
1534
+ "worktree_unlock_result": {
111
1535
  "type": "object",
112
- "required": ["branch"],
113
- "properties": { "branch": { "type": "string" } }
1536
+ "required": [
1537
+ "path",
1538
+ "locked"
1539
+ ],
1540
+ "properties": {
1541
+ "path": {
1542
+ "type": "string"
1543
+ },
1544
+ "reason": {
1545
+ "type": "string"
1546
+ },
1547
+ "locked": {
1548
+ "type": "boolean"
1549
+ }
1550
+ }
114
1551
  },
115
- "checkout_result": {
1552
+ "worktree_move_plan": {
1553
+ "type": "object",
1554
+ "required": [
1555
+ "from",
1556
+ "to",
1557
+ "force"
1558
+ ],
1559
+ "properties": {
1560
+ "from": {
1561
+ "type": "string"
1562
+ },
1563
+ "to": {
1564
+ "type": "string"
1565
+ },
1566
+ "force": {
1567
+ "type": "boolean"
1568
+ }
1569
+ }
1570
+ },
1571
+ "worktree_move_result": {
116
1572
  "type": "object",
117
- "required": ["branch", "previous_branch"],
1573
+ "required": [
1574
+ "from",
1575
+ "to"
1576
+ ],
118
1577
  "properties": {
119
- "branch": { "type": ["string", "null"] },
120
- "previous_branch": { "type": ["string", "null"], "description": "Check this out to go back; null on a detached HEAD." }
1578
+ "from": {
1579
+ "type": "string"
1580
+ },
1581
+ "to": {
1582
+ "type": "string"
1583
+ }
121
1584
  }
122
1585
  },
123
- "delete_plan": {
1586
+ "clean_plan": {
124
1587
  "type": "object",
125
- "required": ["branches", "force"],
1588
+ "required": [
1589
+ "branches",
1590
+ "force",
1591
+ "reasons",
1592
+ "skipped"
1593
+ ],
126
1594
  "properties": {
127
- "branches": { "type": "array", "items": { "type": "string" } },
128
- "force": { "type": "boolean" }
1595
+ "branches": {
1596
+ "type": "array",
1597
+ "items": {
1598
+ "type": "string"
1599
+ }
1600
+ },
1601
+ "force": {
1602
+ "type": "boolean"
1603
+ },
1604
+ "reasons": {
1605
+ "type": "object",
1606
+ "description": "Why each branch was chosen, by branch name.",
1607
+ "additionalProperties": {
1608
+ "type": "array",
1609
+ "items": {
1610
+ "type": "string"
1611
+ }
1612
+ }
1613
+ },
1614
+ "skipped": {
1615
+ "type": "array",
1616
+ "description": "Matching branches that were kept.",
1617
+ "items": {
1618
+ "type": "object",
1619
+ "required": [
1620
+ "branch",
1621
+ "reason"
1622
+ ],
1623
+ "properties": {
1624
+ "branch": {
1625
+ "type": "string"
1626
+ },
1627
+ "reason": {
1628
+ "type": "string"
1629
+ }
1630
+ }
1631
+ }
1632
+ }
129
1633
  }
130
1634
  },
131
- "delete_result": {
1635
+ "worktree_clean_plan": {
132
1636
  "type": "object",
133
- "required": ["deleted", "failed"],
1637
+ "required": [
1638
+ "worktrees",
1639
+ "force",
1640
+ "skipped"
1641
+ ],
134
1642
  "properties": {
135
- "deleted": {
1643
+ "worktrees": {
136
1644
  "type": "array",
137
- "description": "Recreate a branch with: git branch NAME SHA",
138
1645
  "items": {
139
1646
  "type": "object",
140
- "required": ["branch", "sha"],
141
- "properties": { "branch": { "type": "string" }, "sha": { "$ref": "#/$defs/sha" } }
1647
+ "required": [
1648
+ "path",
1649
+ "branch",
1650
+ "dirty",
1651
+ "locked"
1652
+ ],
1653
+ "properties": {
1654
+ "path": {
1655
+ "type": "string"
1656
+ },
1657
+ "branch": {
1658
+ "type": [
1659
+ "string",
1660
+ "null"
1661
+ ]
1662
+ },
1663
+ "dirty": {
1664
+ "type": [
1665
+ "boolean",
1666
+ "null"
1667
+ ]
1668
+ },
1669
+ "locked": {
1670
+ "type": "boolean"
1671
+ },
1672
+ "reasons": {
1673
+ "type": "array",
1674
+ "items": {
1675
+ "type": "string"
1676
+ }
1677
+ },
1678
+ "ignored_count": {
1679
+ "type": "integer",
1680
+ "minimum": 0
1681
+ },
1682
+ "ignored": {
1683
+ "type": "array",
1684
+ "items": {
1685
+ "type": "string"
1686
+ }
1687
+ }
1688
+ }
142
1689
  }
143
1690
  },
144
- "failed": {
1691
+ "force": {
1692
+ "type": "boolean"
1693
+ },
1694
+ "skipped": {
145
1695
  "type": "array",
1696
+ "description": "Matching worktrees that were kept, with the reason.",
146
1697
  "items": {
147
1698
  "type": "object",
148
- "required": ["branch", "error"],
149
- "properties": { "branch": { "type": "string" }, "error": { "type": "string" } }
1699
+ "required": [
1700
+ "path",
1701
+ "branch",
1702
+ "reason"
1703
+ ],
1704
+ "properties": {
1705
+ "path": {
1706
+ "type": "string"
1707
+ },
1708
+ "branch": {
1709
+ "type": [
1710
+ "string",
1711
+ "null"
1712
+ ]
1713
+ },
1714
+ "reason": {
1715
+ "type": "string"
1716
+ }
1717
+ }
150
1718
  }
151
1719
  }
152
1720
  }
153
1721
  },
154
- "reset_plan": {
1722
+ "pick_candidate": {
155
1723
  "type": "object",
156
- "required": ["commit", "mode"],
1724
+ "required": [
1725
+ "sha",
1726
+ "short_sha",
1727
+ "subject",
1728
+ "author",
1729
+ "date",
1730
+ "status",
1731
+ "files",
1732
+ "insertions",
1733
+ "deletions"
1734
+ ],
157
1735
  "properties": {
158
- "commit": { "$ref": "#/$defs/sha" },
159
- "mode": { "enum": ["soft", "mixed", "hard"] }
1736
+ "sha": {
1737
+ "$ref": "#/$defs/sha"
1738
+ },
1739
+ "short_sha": {
1740
+ "type": "string"
1741
+ },
1742
+ "subject": {
1743
+ "type": "string"
1744
+ },
1745
+ "author": {
1746
+ "type": "string"
1747
+ },
1748
+ "date": {
1749
+ "type": "string",
1750
+ "format": "date-time"
1751
+ },
1752
+ "status": {
1753
+ "enum": [
1754
+ "new",
1755
+ "applied"
1756
+ ],
1757
+ "description": "applied: an equivalent change is already on the current branch."
1758
+ },
1759
+ "files": {
1760
+ "type": "integer",
1761
+ "minimum": 0
1762
+ },
1763
+ "insertions": {
1764
+ "type": "integer",
1765
+ "minimum": 0
1766
+ },
1767
+ "deletions": {
1768
+ "type": "integer",
1769
+ "minimum": 0
1770
+ }
160
1771
  }
161
1772
  },
162
- "reset_result": {
1773
+ "pick_list_result": {
1774
+ "type": "object",
1775
+ "required": [
1776
+ "source",
1777
+ "commits"
1778
+ ],
1779
+ "properties": {
1780
+ "source": {
1781
+ "type": "string"
1782
+ },
1783
+ "commits": {
1784
+ "type": "array",
1785
+ "description": "Oldest first.",
1786
+ "items": {
1787
+ "$ref": "#/$defs/pick_candidate"
1788
+ }
1789
+ }
1790
+ }
1791
+ },
1792
+ "pick_plan": {
1793
+ "type": "object",
1794
+ "description": "A new pick, or --continue / --skip / --abort of one in progress.",
1795
+ "properties": {
1796
+ "source": {
1797
+ "type": "string"
1798
+ },
1799
+ "commits": {
1800
+ "type": "array",
1801
+ "items": {
1802
+ "$ref": "#/$defs/sha"
1803
+ }
1804
+ },
1805
+ "skipped": {
1806
+ "type": "array",
1807
+ "items": {
1808
+ "type": "object",
1809
+ "required": [
1810
+ "sha",
1811
+ "reason"
1812
+ ],
1813
+ "properties": {
1814
+ "sha": {
1815
+ "$ref": "#/$defs/sha"
1816
+ },
1817
+ "reason": {
1818
+ "type": "string"
1819
+ }
1820
+ }
1821
+ }
1822
+ },
1823
+ "commit": {
1824
+ "type": "boolean"
1825
+ },
1826
+ "action": {
1827
+ "enum": [
1828
+ "continue",
1829
+ "skip",
1830
+ "abort"
1831
+ ]
1832
+ },
1833
+ "current": {
1834
+ "type": [
1835
+ "string",
1836
+ "null"
1837
+ ]
1838
+ },
1839
+ "conflicted": {
1840
+ "type": "array",
1841
+ "items": {
1842
+ "type": "string"
1843
+ }
1844
+ },
1845
+ "remaining": {
1846
+ "type": "array",
1847
+ "items": {
1848
+ "$ref": "#/$defs/sha"
1849
+ }
1850
+ }
1851
+ }
1852
+ },
1853
+ "pick_result": {
1854
+ "type": "object",
1855
+ "description": "done or noop: applied and head (or action and head); failed on conflicts: applied, current, conflicted, remaining.",
1856
+ "properties": {
1857
+ "applied": {
1858
+ "type": "array",
1859
+ "items": {
1860
+ "$ref": "#/$defs/sha"
1861
+ }
1862
+ },
1863
+ "head": {
1864
+ "$ref": "#/$defs/sha"
1865
+ },
1866
+ "action": {
1867
+ "enum": [
1868
+ "continue",
1869
+ "skip",
1870
+ "abort"
1871
+ ]
1872
+ },
1873
+ "current": {
1874
+ "type": [
1875
+ "string",
1876
+ "null"
1877
+ ]
1878
+ },
1879
+ "conflicted": {
1880
+ "type": "array",
1881
+ "items": {
1882
+ "type": "string"
1883
+ }
1884
+ },
1885
+ "remaining": {
1886
+ "type": "array",
1887
+ "items": {
1888
+ "$ref": "#/$defs/sha"
1889
+ }
1890
+ }
1891
+ }
1892
+ },
1893
+ "mark_plan": {
1894
+ "type": "object",
1895
+ "required": [
1896
+ "branches",
1897
+ "owner"
1898
+ ],
1899
+ "properties": {
1900
+ "branches": {
1901
+ "type": "array",
1902
+ "items": {
1903
+ "type": "string"
1904
+ }
1905
+ },
1906
+ "owner": {
1907
+ "enum": [
1908
+ "agent",
1909
+ "human",
1910
+ null
1911
+ ],
1912
+ "description": "The owner to set; null clears the mark."
1913
+ }
1914
+ }
1915
+ },
1916
+ "mark_result": {
163
1917
  "type": "object",
164
- "required": ["commit", "mode", "previous_commit"],
1918
+ "required": [
1919
+ "branches"
1920
+ ],
165
1921
  "properties": {
166
- "commit": { "$ref": "#/$defs/sha" },
167
- "mode": { "enum": ["soft", "mixed", "hard"] },
168
- "previous_commit": { "$ref": "#/$defs/sha", "description": "Reset to this commit to go back. Uncommitted changes lost by a hard reset cannot be restored this way." }
1922
+ "branches": {
1923
+ "type": "array",
1924
+ "items": {
1925
+ "type": "object",
1926
+ "required": [
1927
+ "branch",
1928
+ "owner",
1929
+ "previous"
1930
+ ],
1931
+ "properties": {
1932
+ "branch": {
1933
+ "type": "string"
1934
+ },
1935
+ "owner": {
1936
+ "enum": [
1937
+ "agent",
1938
+ "human",
1939
+ null
1940
+ ]
1941
+ },
1942
+ "previous": {
1943
+ "enum": [
1944
+ "agent",
1945
+ "human",
1946
+ null
1947
+ ]
1948
+ }
1949
+ }
1950
+ }
1951
+ }
169
1952
  }
170
1953
  }
171
1954
  }