gor-cli 0.2.0

A Rust CLI for GitHub — a 'gh' clone
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
//! CLI argument definitions using clap's derive API.
//!
//! Defines the top-level [`Args`] struct and the [`Command`] enum
//! for all subcommands.

use clap::{Parser, Subcommand};

/// A fast, self-contained GitHub CLI written in Rust.
#[derive(Parser, Debug)]
#[command(
    name = "gor",
    version,
    about = "GitHub on Rust — a fast, self-contained GitHub CLI",
    long_about = "A fast, self-contained GitHub CLI written in Rust. Equivalent to `gh` but with no external dependencies on `git` or OpenSSL."
)]
pub struct Args {
    /// GitHub hostname for GitHub Enterprise Server (default: github.com).
    #[arg(long, env = "GH_HOST", global = true)]
    pub hostname: Option<String>,

    /// Subcommand to execute.
    #[command(subcommand)]
    pub command: Command,
}

/// Top-level subcommands for `gor`.
#[derive(Subcommand, Debug)]
pub enum Command {
    /// Authenticate with a GitHub account.
    #[command(subcommand)]
    Auth(AuthCommand),
    /// Work with GitHub repositories.
    #[command(subcommand)]
    Repo(RepoCommand),
    /// Work with GitHub pull requests.
    #[command(subcommand)]
    Pr(PrCommand),
    /// Work with GitHub issues.
    #[command(subcommand)]
    Issue(IssueCommand),
    /// Make an authenticated GitHub API request.
    #[command(subcommand)]
    Api(ApiCommand),
    /// Manage configuration values.
    #[command(subcommand)]
    Config(ConfigCommand),
    /// Work with repository labels.
    #[command(subcommand)]
    Label(LabelCommand),
    /// Work with releases.
    #[command(subcommand)]
    Release(ReleaseCommand),
    /// Open a repository in the browser.
    Browse(BrowseCommand),
    /// Work with gists.
    #[command(subcommand)]
    Gist(GistCommand),
    /// Search GitHub.
    #[command(subcommand)]
    Search(SearchCommand),
    /// Work with GitHub Actions workflows.
    #[command(subcommand)]
    Workflow(WorkflowCommand),
    /// Manage command aliases.
    #[command(subcommand)]
    Alias(AliasCommand),
    /// Work with GitHub organizations.
    #[command(subcommand)]
    Org(OrgCommand),
    /// Manage SSH keys.
    #[command(subcommand)]
    SshKey(SshKeyCommand),
    /// Manage GPG keys.
    #[command(subcommand)]
    GpgKey(GpgKeyCommand),
    /// List and manage secrets.
    #[command(subcommand)]
    Secret(SecretCommand),
    /// List and manage Actions variables.
    #[command(subcommand)]
    Variable(VariableCommand),
    /// Work with GitHub Actions workflow runs.
    #[command(subcommand)]
    Run(RunCommand),
    /// List and manage repository caches.
    #[command(subcommand)]
    Cache(CacheCommand),
    /// Work with repository rulesets.
    #[command(subcommand)]
    Ruleset(RulesetCommand),
    /// Manage GitHub CLI extensions.
    #[command(subcommand)]
    Extension(ExtensionCommand),
    /// Work with GitHub Codespaces.
    #[command(subcommand)]
    Codespace(CodespaceCommand),
    /// List and manage GitHub Projects.
    #[command(subcommand)]
    Project(ProjectCommand),
    /// Verify artifact attestations.
    #[command(subcommand)]
    Attestation(AttestationCommand),
    /// Work with GitHub Classroom.
    #[command(subcommand)]
    Classroom(ClassroomCommand),
    /// Manage GitHub Copilot.
    #[command(subcommand)]
    Copilot(CopilotCommand),
    /// Generate shell completion scripts.
    Completion {
        /// Shell type: bash, zsh, fish, or powershell.
        shell: String,
    },
}

/// Arguments for `gor api`.
#[derive(clap::Subcommand, Debug)]
pub enum ApiCommand {
    /// Make a REST API request to a GitHub endpoint.
    Rest {
        /// The API endpoint path (e.g. /repos/owner/repo).
        endpoint: String,

        /// HTTP method (default: GET).
        #[arg(short = 'X', long, default_value = "GET")]
        method: String,

        /// Add a typed field parameter (key=value) for the request body.
        #[arg(short = 'F', long = "field")]
        fields: Vec<String>,

        /// Add a raw field parameter (key=value) for the request body.
        #[arg(short = 'f', long = "raw-field")]
        raw_fields: Vec<String>,

        /// Add a custom HTTP header (key: value).
        #[arg(short = 'H', long = "header")]
        headers: Vec<String>,

        /// Read the request body from a file (use @- for stdin).
        #[arg(long)]
        input: Option<String>,

        /// Follow Link headers to fetch all pages.
        #[arg(long)]
        paginate: bool,

        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,

        /// Filter JSON output with a jq expression.
        #[arg(long)]
        jq: Option<String>,

        /// Format output via a Go/Handlebars template.
        #[arg(long)]
        template: Option<String>,

        /// Suppress status output.
        #[arg(long)]
        silent: bool,

        /// Include response headers in the output.
        #[arg(short = 'i', long)]
        include: bool,
    },
    /// Make a GraphQL API request.
    Graphql {
        /// The GraphQL query string. Reads from stdin if omitted.
        #[arg(short = 'q', long = "query")]
        query: Option<String>,

        /// GraphQL variables as key=value pairs (repeatable).
        #[arg(short = 'F', long = "field")]
        fields: Vec<String>,

        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,

        /// Filter JSON output with a jq expression.
        #[arg(long)]
        jq: Option<String>,

        /// Format output via a Go/Handlebars template.
        #[arg(long)]
        template: Option<String>,
    },
}

/// Subcommands for `gor repo`.
#[derive(Subcommand, Debug)]
pub enum RepoCommand {
    /// View a repository's description, stats, and metadata.
    View {
        /// Repository to view (OWNER/REPO format). Auto-detected from git remote if omitted.
        owner_repo: Option<String>,
        /// Open the repository in the default browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// List repositories for a user or organization.
    List {
        /// Owner to list repos for (username or org). Defaults to authenticated user.
        #[arg(long)]
        owner: Option<String>,
        /// Filter by visibility: public, private, or all (default: all).
        #[arg(long, default_value = "all")]
        visibility: String,
        /// Filter by fork status: include, exclude, or only (default: include).
        #[arg(long, default_value = "include")]
        fork: String,
        /// Filter by primary language.
        #[arg(short = 'l', long)]
        language: Option<String>,
        /// Maximum number of repos to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Clone a repository locally.
    Clone {
        /// Repository to clone (OWNER/REPO format or full URL).
        owner_repo: String,
        /// Target directory name.
        #[arg(short = 'd', long)]
        directory: Option<String>,
        /// Name of the upstream remote (default: upstream).
        #[arg(long, default_value = "upstream")]
        upstream_remote_name: String,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create a repository.
    Create {
        /// Repository name.
        name: String,
        /// Repository description.
        #[arg(long)]
        description: Option<String>,
        /// Create a private repository.
        #[arg(long)]
        private: bool,
        /// Create an internal repository (GHES only).
        #[arg(long)]
        internal: bool,
        /// Organization to create the repository under.
        #[arg(long)]
        org: Option<String>,
        /// Template repository (OWNER/REPO).
        #[arg(long)]
        template: Option<String>,
        /// Clone the new repository locally after creation.
        #[arg(long)]
        clone: bool,
        /// Remote name when cloning (default: origin).
        #[arg(long, default_value = "origin")]
        remote: String,
        /// Push local content to the new repository.
        #[arg(long)]
        push: bool,
        /// Disable the wiki.
        #[arg(long)]
        disable_wiki: bool,
        /// Disable the issue tracker.
        #[arg(long)]
        disable_issues: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Fork a repository.
    Fork {
        /// Repository to fork (OWNER/REPO format).
        owner_repo: String,
        /// Organization to fork into.
        #[arg(long)]
        org: Option<String>,
        /// Clone the fork locally after creation.
        #[arg(long)]
        clone: bool,
        /// Remote name when cloning (default: origin).
        #[arg(long, default_value = "origin")]
        remote: String,
        /// Custom name for the fork.
        #[arg(long)]
        fork_name: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a repository.
    Delete {
        /// Repository to delete (OWNER/REPO format).
        owner_repo: String,
        /// Skip confirmation prompt.
        #[arg(long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Edit a repository's settings.
    Edit {
        /// Repository to edit (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Repository description.
        #[arg(long)]
        description: Option<String>,
        /// Repository visibility: public, private, or internal.
        #[arg(long, value_parser = ["public", "private", "internal"])]
        visibility: Option<String>,
        /// Add a topic (repeatable).
        #[arg(long = "add-topic")]
        add_topic: Vec<String>,
        /// Remove a topic (repeatable).
        #[arg(long = "remove-topic")]
        remove_topic: Vec<String>,
        /// Default branch name.
        #[arg(long)]
        default_branch: Option<String>,
        /// Enable wiki (true/false).
        #[arg(long, value_parser = ["true", "false"])]
        enable_wiki: Option<String>,
        /// Enable issues (true/false).
        #[arg(long, value_parser = ["true", "false"])]
        enable_issues: Option<String>,
        /// Enable projects (true/false).
        #[arg(long, value_parser = ["true", "false"])]
        enable_projects: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Transfer a repository to another user or organization.
    Transfer {
        /// Target user or organization.
        target: String,
        /// Repository to transfer (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// New name for the repository after transfer.
        #[arg(long)]
        new_name: Option<String>,
        /// Team slug to grant access in the new organization (repeatable).
        #[arg(long)]
        team: Vec<String>,
        /// Skip confirmation prompt.
        #[arg(long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Sync a fork with its upstream repository.
    Sync {
        /// Repository to sync (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Branch to sync into (default: the fork's default branch).
        #[arg(short = 'b', long)]
        branch: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor auth`.
#[derive(Subcommand, Debug)]
pub enum AuthCommand {
    /// Log in to a GitHub account using the OAuth device flow.
    Login {
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
        /// Request specific OAuth scopes (comma-separated).
        /// Default: repo,read:org,workflow,gist
        #[arg(long)]
        scopes: Option<String>,
        /// Read token from stdin instead of starting the device flow.
        #[arg(long, conflicts_with = "scopes")]
        with_token: bool,
    },
    /// Log out of a GitHub account.
    Logout {
        /// GitHub hostname (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Show the current authentication status.
    Status {
        /// GitHub hostname (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Configure git to use gor as a credential helper.
    SetupGit {
        /// GitHub hostname (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Print or refresh the authentication token.
    Token {
        /// GitHub hostname (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
        /// Refresh the stored token via the OAuth device flow.
        #[arg(long)]
        refresh: bool,
        /// Request additional OAuth scopes during refresh (repeatable).
        #[arg(short = 's', long)]
        scopes: Vec<String>,
        /// Mask the token output (show only first and last few characters).
        #[arg(long)]
        secure: bool,
    },
}

/// Subcommands for `gor pr`.
#[derive(Subcommand, Debug)]
pub enum PrCommand {
    /// List pull requests in a repository.
    List {
        /// Repository to list PRs for (OWNER/REPO format). Auto-detected from git remote if omitted.
        owner_repo: Option<String>,
        /// Filter by state: open, closed, merged, or all (default: open).
        #[arg(long, default_value = "open")]
        state: String,
        /// Filter by base branch.
        #[arg(long)]
        base: Option<String>,
        /// Filter by head branch.
        #[arg(long)]
        head: Option<String>,
        /// Filter by PR author login.
        #[arg(long)]
        author: Option<String>,
        /// Filter by label (repeatable).
        #[arg(long = "label")]
        labels: Vec<String>,
        /// Filter by assignee login.
        #[arg(long)]
        assignee: Option<String>,
        /// Maximum number of PRs to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Open the PR list in the default browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View details of a pull request.
    View {
        /// Pull request number.
        number: u64,
        /// Repository to view PR from (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Open the PR in the default browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Include the PR's comment thread.
        #[arg(long)]
        comments: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create a pull request.
    Create {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// PR title.
        #[arg(long)]
        title: Option<String>,
        /// PR body (markdown).
        #[arg(long)]
        body: Option<String>,
        /// Base branch to merge into. Auto-detected from the repo's default branch.
        #[arg(long)]
        base: Option<String>,
        /// Head branch. Auto-detected from the current branch.
        #[arg(long)]
        head: Option<String>,
        /// Create as a draft PR.
        #[arg(long)]
        draft: bool,
        /// Add labels (repeatable).
        #[arg(long = "label")]
        labels: Vec<String>,
        /// Assign people by login (repeatable).
        #[arg(long)]
        assignee: Vec<String>,
        /// Milestone ID or title.
        #[arg(long)]
        milestone: Option<String>,
        /// Add to project board by number.
        #[arg(long)]
        project: Option<u32>,
        /// Open the PR in the default browser after creation.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Close a pull request.
    Close {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Add a closing comment.
        #[arg(long)]
        comment: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Reopen a closed pull request.
    Reopen {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Add a comment when reopening.
        #[arg(long)]
        comment: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Add a comment to a pull request.
    Comment {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Comment body (markdown supported).
        #[arg(long, conflicts_with = "body_file")]
        body: Option<String>,
        /// Read comment body from file (use @- for stdin).
        #[arg(long, conflicts_with = "body")]
        body_file: Option<String>,
        /// Open the PR in the default browser after commenting.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Merge a pull request.
    Merge {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Merge with a merge commit (default).
        #[arg(long, conflicts_with_all = &["squash", "rebase"])]
        merge: bool,
        /// Squash commits into one.
        #[arg(long, conflicts_with_all = &["merge", "rebase"])]
        squash: bool,
        /// Rebase commits onto the base branch.
        #[arg(long, conflicts_with_all = &["merge", "squash"])]
        rebase: bool,
        /// Merge commit message body.
        #[arg(long)]
        body: Option<String>,
        /// Merge commit subject.
        #[arg(long)]
        subject: Option<String>,
        /// Delete the head branch after merging.
        #[arg(long)]
        delete_branch: bool,
        /// Use admin privileges to bypass branch protection.
        #[arg(long)]
        admin: bool,
        /// Enable auto-merge (merge when all checks pass).
        #[arg(long)]
        auto: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Check out a pull request's head branch locally.
    Checkout {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Custom local branch name.
        #[arg(short = 'b', long)]
        branch: Option<String>,
        /// Initialize and update submodules.
        #[arg(long)]
        recurse_submodules: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View the diff of a pull request.
    Diff {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Control colorized output: always, never, auto.
        #[arg(long, default_value = "auto")]
        color: String,
        /// Show only the names of changed files.
        #[arg(long)]
        name_only: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Edit a pull request.
    Edit {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// New PR title.
        #[arg(long)]
        title: Option<String>,
        /// New PR body (markdown).
        #[arg(long)]
        body: Option<String>,
        /// Change the base branch.
        #[arg(long)]
        base: Option<String>,
        /// Add labels (repeatable).
        #[arg(long = "add-label")]
        add_label: Vec<String>,
        /// Remove labels (repeatable).
        #[arg(long = "remove-label")]
        remove_label: Vec<String>,
        /// Add assignees by login (repeatable).
        #[arg(long = "add-assignee")]
        add_assignee: Vec<String>,
        /// Remove assignees by login (repeatable).
        #[arg(long = "remove-assignee")]
        remove_assignee: Vec<String>,
        /// Milestone ID or title.
        #[arg(long)]
        milestone: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Review a pull request.
    Review {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Submit an approving review.
        #[arg(long)]
        approve: bool,
        /// Request changes.
        #[arg(long)]
        request_changes: bool,
        /// Leave a general comment (default).
        #[arg(long)]
        comment: bool,
        /// Review body text.
        #[arg(long)]
        body: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View CI checks for a pull request.
    Checks {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Poll until all checks complete.
        #[arg(long)]
        watch: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Mark a draft pull request as ready for review.
    Ready {
        /// Pull request number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor issue`.
#[derive(Subcommand, Debug)]
pub enum IssueCommand {
    /// List issues in a repository.
    List {
        /// Repository to list issues for (OWNER/REPO format). Auto-detected from git remote if omitted.
        owner_repo: Option<String>,
        /// Filter by state: open, closed, or all (default: open).
        #[arg(long, default_value = "open")]
        state: String,
        /// Filter by label (repeatable).
        #[arg(long = "label")]
        labels: Vec<String>,
        /// Filter by assignee login.
        #[arg(long)]
        assignee: Option<String>,
        /// Filter by issue author login.
        #[arg(long)]
        author: Option<String>,
        /// Filter by @mention.
        #[arg(long)]
        mention: Option<String>,
        /// Filter by milestone title or number.
        #[arg(long)]
        milestone: Option<String>,
        /// Maximum number of issues to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Open the issue list in the default browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View details of an issue.
    View {
        /// Issue number.
        number: u64,
        /// Repository to view issue from (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Open the issue in the default browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Include the issue's comment thread.
        #[arg(long)]
        comments: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Close an issue.
    Close {
        /// Issue number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Add a closing comment.
        #[arg(long)]
        comment: Option<String>,
        /// Reason for closing: completed or not_planned.
        #[arg(long, value_parser = ["completed", "not_planned"])]
        reason: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Reopen a closed issue.
    Reopen {
        /// Issue number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Add a comment when reopening.
        #[arg(long)]
        comment: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Add a comment to an issue.
    Comment {
        /// Issue number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Comment body (markdown supported).
        #[arg(long, conflicts_with = "body_file")]
        body: Option<String>,
        /// Read comment body from file (use @- for stdin).
        #[arg(long, conflicts_with = "body")]
        body_file: Option<String>,
        /// Open the issue in the default browser after commenting.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create an issue.
    Create {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Issue title (required).
        #[arg(long)]
        title: Option<String>,
        /// Issue body (markdown).
        #[arg(long)]
        body: Option<String>,
        /// Add labels (repeatable).
        #[arg(long = "label")]
        labels: Vec<String>,
        /// Assign users by login (repeatable).
        #[arg(long)]
        assignee: Vec<String>,
        /// Milestone ID or title.
        #[arg(long)]
        milestone: Option<String>,
        /// Add to project board by number.
        #[arg(long)]
        project: Option<u32>,
        /// Open the issue in the default browser after creation.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Edit an issue.
    Edit {
        /// Issue number.
        number: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// New issue title.
        #[arg(long)]
        title: Option<String>,
        /// New issue body (markdown).
        #[arg(long)]
        body: Option<String>,
        /// Add labels (repeatable).
        #[arg(long = "add-label")]
        add_label: Vec<String>,
        /// Remove labels (repeatable).
        #[arg(long = "remove-label")]
        remove_label: Vec<String>,
        /// Add assignees by login (repeatable).
        #[arg(long = "add-assignee")]
        add_assignee: Vec<String>,
        /// Remove assignees by login (repeatable).
        #[arg(long = "remove-assignee")]
        remove_assignee: Vec<String>,
        /// Milestone ID or title.
        #[arg(long)]
        milestone: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Transfer an issue to another repository.
    Transfer {
        /// Issue number.
        number: u64,
        /// Destination repository (OWNER/REPO format).
        destination: String,
        /// Source repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor config`.
#[derive(Subcommand, Debug)]
pub enum ConfigCommand {
    /// Get a config value.
    Get {
        /// Config key to read.
        key: String,
    },
    /// Set a config value.
    Set {
        /// Config key to set.
        key: String,
        /// Value to set.
        value: String,
    },
    /// List all config values.
    List,
}

/// Subcommands for `gor label`.
#[derive(Subcommand, Debug)]
pub enum LabelCommand {
    /// List labels in a repository.
    List {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Filter labels by name substring.
        #[arg(long)]
        search: Option<String>,
        /// Maximum number of labels to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create a label.
    Create {
        /// Label name.
        name: String,
        /// Label color (hex, without #). Auto-generated if omitted.
        #[arg(long)]
        color: Option<String>,
        /// Label description.
        #[arg(long)]
        description: Option<String>,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Edit a label.
    Edit {
        /// Current label name.
        name: String,
        /// New label name.
        #[arg(long)]
        rename: Option<String>,
        /// New label color (hex, without #).
        #[arg(long)]
        color: Option<String>,
        /// New label description.
        #[arg(long)]
        description: Option<String>,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a label.
    Delete {
        /// Label name.
        name: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Skip the confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Clone labels from another repository.
    Clone {
        /// Source repository to clone labels from (OWNER/REPO format).
        source: String,
        /// Target repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Overwrite existing labels in the target repo.
        #[arg(long)]
        force: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor release`.
#[derive(Subcommand, Debug)]
pub enum ReleaseCommand {
    /// List releases in a repository.
    List {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Maximum number of releases to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Exclude draft releases.
        #[arg(long)]
        exclude_drafts: bool,
        /// Exclude prereleases.
        #[arg(long)]
        exclude_prereleases: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View details of a release.
    View {
        /// Tag name or release ID.
        release: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Open the release in the default browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a release.
    Delete {
        /// Tag name or release ID.
        release: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Skip the confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// Keep the associated git tag (do not delete it).
        #[arg(long)]
        skip_tag: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Edit a release.
    Edit {
        /// Tag name or release ID.
        release: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// New release title.
        #[arg(long)]
        title: Option<String>,
        /// New release body (markdown).
        #[arg(long)]
        notes: Option<String>,
        /// Read release body from a file (use "-" for stdin).
        #[arg(long)]
        notes_file: Option<String>,
        /// Set draft status (true or false).
        #[arg(long)]
        draft: Option<bool>,
        /// Set prerelease status (true or false).
        #[arg(long)]
        prerelease: Option<bool>,
        /// Change the tag the release points to.
        #[arg(long)]
        tag: Option<String>,
        /// Change the target commitish (branch or commit SHA).
        #[arg(long)]
        target: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Upload assets to a release.
    Upload {
        /// Tag name or release ID.
        release: String,
        /// Asset files to upload.
        files: Vec<String>,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Override the asset name (only meaningful for a single asset upload).
        #[arg(long)]
        name: Option<String>,
        /// Override the auto-detected MIME type.
        #[arg(long = "mime-type")]
        mime_type: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create a new release.
    Create {
        /// Tag name for the release (must already exist).
        tag: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Release title (defaults to tag name).
        #[arg(long)]
        title: Option<String>,
        /// Release body (markdown).
        #[arg(long)]
        notes: Option<String>,
        /// Read release notes from a file (use "-" for stdin).
        #[arg(long)]
        notes_file: Option<String>,
        /// Create as a draft release.
        #[arg(long)]
        draft: bool,
        /// Mark as a prerelease.
        #[arg(long)]
        prerelease: bool,
        /// Target commitish (branch or commit SHA).
        #[arg(long)]
        target: Option<String>,
        /// Discussion category for the release.
        #[arg(long)]
        discussion_category: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Download release assets.
    Download {
        /// Tag name or release ID.
        release: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Filter assets by glob pattern (repeatable).
        #[arg(long = "pattern")]
        patterns: Vec<String>,
        /// Output directory (default: current directory).
        #[arg(short = 'D', long, default_value = ".")]
        dir: String,
        /// Skip assets whose file already exists.
        #[arg(long)]
        skip_existing: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a release asset.
    DeleteAsset {
        /// Asset ID to delete.
        asset_id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Skip confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Arguments for `gor browse`.
#[derive(clap::Args, Debug)]
pub struct BrowseCommand {
    /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
    #[arg(short = 'R', long)]
    pub repo: Option<String>,
    /// Open a specific branch or tree.
    #[arg(short = 'b', long)]
    pub branch: Option<String>,
    /// Open a specific commit.
    #[arg(short = 'c', long)]
    pub commit: Option<String>,
    /// Open the projects tab.
    #[arg(long)]
    pub projects: bool,
    /// Open the wiki.
    #[arg(long)]
    pub wiki: bool,
    /// Open the settings page.
    #[arg(long)]
    pub settings: bool,
    /// Open a specific issue by number.
    #[arg(short = 'i', long)]
    pub issue: Option<u64>,
    /// Open a specific pull request by number.
    #[arg(short = 'p', long)]
    pub pr: Option<u64>,
    /// GitHub hostname for GitHub Enterprise Server (default: github.com).
    #[arg(long, env = "GH_HOST")]
    pub hostname: Option<String>,
}

/// Subcommands for `gor gist`.
#[derive(Subcommand, Debug)]
pub enum GistCommand {
    /// List gists.
    List {
        /// List public gists.
        #[arg(long)]
        public: bool,
        /// List secret gists.
        #[arg(long)]
        secret: bool,
        /// List gists for a specific user (public only).
        #[arg(long)]
        user: Option<String>,
        /// Maximum number of gists to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create a gist.
    Create {
        /// Files to include in the gist.
        files: Vec<String>,
        /// Gist description.
        #[arg(long)]
        desc: Option<String>,
        /// Create a public gist (default: secret).
        #[arg(long)]
        public: bool,
        /// Override the filename in the gist.
        #[arg(long)]
        filename: Option<String>,
        /// Open the new gist in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View a gist's content and metadata.
    View {
        /// Gist ID to view.
        gist_id: String,
        /// Output the raw content of the gist.
        #[arg(long)]
        raw: bool,
        /// Select a specific file to view.
        #[arg(long)]
        filename: Option<String>,
        /// Open the gist in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Edit a gist.
    Edit {
        /// Gist ID to edit.
        gist_id: String,
        /// New description for the gist.
        #[arg(long)]
        desc: Option<String>,
        /// Add a file to the gist (path=content or file path).
        #[arg(long)]
        add: Vec<String>,
        /// Rename a file (old:new).
        #[arg(long)]
        filename: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a gist.
    Delete {
        /// Gist ID to delete.
        gist_id: String,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor search`.
#[derive(Subcommand, Debug)]
pub enum SearchCommand {
    /// Search repositories.
    Repos {
        /// Search query.
        query: Vec<String>,
        /// Filter by primary language.
        #[arg(long)]
        language: Option<String>,
        /// Filter by repository topic.
        #[arg(long)]
        topic: Option<String>,
        /// Filter by star count range (e.g., ">100", "10..50").
        #[arg(long)]
        stars: Option<String>,
        /// Sort by: stars, forks, updated, best-match.
        #[arg(long, default_value = "best-match")]
        sort: String,
        /// Sort order: asc or desc.
        #[arg(long, default_value = "desc")]
        order: String,
        /// Maximum number of results (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// Open the search results in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Search code.
    Code {
        /// Search query.
        query: Vec<String>,
        /// Filter by language.
        #[arg(long)]
        language: Option<String>,
        /// Search within a specific repository (OWNER/REPO).
        #[arg(long)]
        repo: Option<String>,
        /// Maximum number of results (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// Open the search results in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Search issues and pull requests.
    Issues {
        /// Search query.
        query: Vec<String>,
        /// Filter by type: issue, pr.
        #[arg(long)]
        r#type: Option<String>,
        /// Filter by state: open, closed.
        #[arg(long)]
        state: Option<String>,
        /// Filter by labels (comma-separated).
        #[arg(long)]
        labels: Option<String>,
        /// Maximum number of results (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// Open the search results in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Search commits.
    Commits {
        /// Search query.
        query: Vec<String>,
        /// Filter by author.
        #[arg(long)]
        author: Option<String>,
        /// Search within a specific repository (OWNER/REPO).
        #[arg(long)]
        repo: Option<String>,
        /// Maximum number of results (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// Open the search results in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor workflow`.
#[derive(Subcommand, Debug)]
pub enum WorkflowCommand {
    /// List workflows in a repository.
    List {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Maximum number of workflows to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View a workflow's details.
    View {
        /// Workflow ID, filename (e.g. deploy.yml), or name.
        workflow: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Enable a workflow.
    Enable {
        /// Workflow ID, filename (e.g. deploy.yml), or name.
        workflow: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Disable a workflow.
    Disable {
        /// Workflow ID, filename (e.g. deploy.yml), or name.
        workflow: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Run a workflow.
    Run {
        /// Workflow ID, filename (e.g. deploy.yml), or name.
        workflow: String,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Branch to run the workflow on.
        #[arg(short = 'b', long)]
        branch: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor org`.
#[derive(Subcommand, Debug)]
pub enum OrgCommand {
    /// List organizations for the authenticated user.
    List {
        /// Maximum number of organizations to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View an organization's profile.
    View {
        /// Organization name.
        org: String,
        /// Open the organization in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor ssh-key`.
#[derive(Subcommand, Debug)]
pub enum SshKeyCommand {
    /// List SSH keys.
    List {
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Add an SSH key.
    Add {
        /// Title for the key.
        #[arg(short = 't', long)]
        title: String,
        /// Read the public key from a file.
        #[arg(short = 'f', long)]
        file: Option<String>,
        /// Provide the public key inline.
        #[arg(short = 'b', long)]
        body: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete an SSH key.
    Delete {
        /// SSH key database ID to delete.
        key_id: String,
        /// Skip confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor gpg-key`.
#[derive(Subcommand, Debug)]
pub enum GpgKeyCommand {
    /// List GPG keys.
    List {
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Add a GPG key.
    Add {
        /// Read the armored public key from a file.
        #[arg(short = 'f', long)]
        file: Option<String>,
        /// Provide the armored key inline.
        #[arg(short = 'b', long)]
        body: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a GPG key.
    Delete {
        /// GPG key ID to delete.
        key_id: String,
        /// Skip confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor secret`.
#[derive(Subcommand, Debug)]
pub enum SecretCommand {
    /// List secrets.
    List {
        /// Organization to list secrets for.
        #[arg(long)]
        org: Option<String>,
        /// Environment name for environment-scoped secrets.
        #[arg(short = 'e', long)]
        env: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Set a secret.
    Set {
        /// Secret name.
        name: String,
        /// Secret value body.
        #[arg(short = 'b', long)]
        body: Option<String>,
        /// Read secret value from a file.
        #[arg(short = 'f', long)]
        file: Option<String>,
        /// Organization to set the secret for.
        #[arg(long)]
        org: Option<String>,
        /// Environment name for environment-scoped secrets.
        #[arg(short = 'e', long)]
        env: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a secret.
    Delete {
        /// Secret name to delete.
        name: String,
        /// Delete at the organization level.
        #[arg(long)]
        org: Option<String>,
        /// Environment name for environment-scoped secrets.
        #[arg(short = 'e', long)]
        env: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor variable`.
#[derive(Subcommand, Debug)]
pub enum VariableCommand {
    /// List variables.
    List {
        /// Organization to list variables for.
        #[arg(long)]
        org: Option<String>,
        /// Environment name for environment-scoped variables.
        #[arg(short = 'e', long)]
        env: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Set a variable.
    Set {
        /// Variable name.
        name: String,
        /// Variable value.
        #[arg(short = 'b', long)]
        body: Option<String>,
        /// Read variable value from a file.
        #[arg(short = 'f', long)]
        file: Option<String>,
        /// Organization to set the variable for.
        #[arg(long)]
        org: Option<String>,
        /// Environment name for environment-scoped variables.
        #[arg(short = 'e', long)]
        env: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a variable.
    Delete {
        /// Variable name to delete.
        name: String,
        /// Delete at the organization level.
        #[arg(long)]
        org: Option<String>,
        /// Environment name for environment-scoped variables.
        #[arg(short = 'e', long)]
        env: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor run`.
#[derive(Subcommand, Debug)]
pub enum RunCommand {
    /// List workflow runs.
    List {
        /// Workflow filename or ID to filter by.
        #[arg(short = 'w', long)]
        workflow: Option<String>,
        /// Branch to filter by.
        #[arg(short = 'b', long)]
        branch: Option<String>,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Maximum number of runs to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View a workflow run's details and jobs.
    View {
        /// Run ID.
        id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Open the run in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Show logs for a specific job.
        #[arg(long)]
        log: Option<u64>,
        /// Show logs only for failed jobs.
        #[arg(long)]
        log_failed: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Cancel a workflow run.
    Cancel {
        /// Run ID.
        id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Download artifacts from a workflow run.
    Download {
        /// Run ID.
        id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Output directory (default: current directory).
        #[arg(short = 'D', long, default_value = ".")]
        dir: String,
        /// Filter artifacts by name (repeatable).
        #[arg(long = "name")]
        names: Vec<String>,
        /// Download job logs instead of artifacts.
        #[arg(long)]
        log: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Rerun a workflow run.
    Rerun {
        /// Run ID.
        id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Rerun only failed jobs.
        #[arg(long)]
        failed_jobs: bool,
        /// Enable debug logging for the rerun.
        #[arg(long)]
        debug: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Watch a workflow run until completion.
    Watch {
        /// Run ID.
        id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Poll interval in seconds (default: 3).
        #[arg(long, default_value = "3")]
        interval: u64,
        /// Exit with the run's conclusion code.
        #[arg(long)]
        exit_status: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a workflow run.
    Delete {
        /// Run ID to delete.
        id: u64,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Skip confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor cache`.
#[derive(Subcommand, Debug)]
pub enum CacheCommand {
    /// List caches.
    List {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete caches.
    Delete {
        /// Cache key to delete (exact match).
        key: Option<String>,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Delete all caches in the repository.
        #[arg(long, conflicts_with = "key", conflicts_with = "key_prefix")]
        all: bool,
        /// Delete caches whose keys start with this prefix.
        #[arg(long, conflicts_with = "key", conflicts_with = "all")]
        key_prefix: Option<String>,
        /// Scope deletion to a specific branch/tag ref.
        #[arg(long, name = "ref")]
        ref_: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor ruleset`.
#[derive(Subcommand, Debug)]
pub enum RulesetCommand {
    /// List rulesets.
    List {
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View a ruleset's details.
    View {
        /// Ruleset ID.
        id: u32,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Open the ruleset in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor extension`.
#[derive(Subcommand, Debug)]
pub enum ExtensionCommand {
    /// List installed extensions.
    List {
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Install an extension.
    Install {
        /// Extension name or URL.
        name: String,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Remove an extension.
    Remove {
        /// Extension name to remove.
        name: String,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Upgrade extensions.
    Upgrade {
        /// Extension name to upgrade. If omitted with --all, upgrades all.
        name: Option<String>,
        /// Upgrade all installed extensions.
        #[arg(long, conflicts_with = "name")]
        all: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor codespace`.
#[derive(Subcommand, Debug)]
pub enum CodespaceCommand {
    /// List codespaces.
    List {
        /// Repository (OWNER/REPO format).
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Create a codespace.
    Create {
        /// Repository (OWNER/REPO format).
        repo: String,
        /// Branch to create the codespace from.
        #[arg(short = 'b', long)]
        branch: Option<String>,
        /// Machine type.
        #[arg(long)]
        machine: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete a codespace.
    Delete {
        /// Codespace name to delete.
        name: String,
        /// Repository to scope selection (OWNER/REPO format).
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Skip confirmation prompt.
        #[arg(long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View codespace logs.
    Logs {
        /// Codespace name.
        name: String,
        /// Repository to scope selection (OWNER/REPO format).
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// Follow log output until the codespace is ready.
        #[arg(short = 'f', long)]
        follow: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// SSH into a codespace.
    Ssh {
        /// Codespace name.
        name: String,
        /// Repository to scope selection (OWNER/REPO format).
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// SSH config profile.
        #[arg(long)]
        profile: Option<String>,
        /// Print SSH connection config instead of connecting.
        #[arg(long)]
        config: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Stop a codespace.
    Stop {
        /// Codespace name to stop.
        name: Option<String>,
        /// Repository to scope selection (OWNER/REPO format).
        #[arg(short = 'R', long)]
        repo: Option<String>,
        /// Stop all codespaces owned by the user.
        #[arg(long, conflicts_with = "name")]
        all: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Copy files between local and remote codespace.
    Cp {
        /// Codespace name.
        name: String,
        /// Source and destination paths (use `remote:` prefix for codespace paths).
        /// The last path is the destination, all others are sources.
        #[arg(required = true)]
        paths: Vec<String>,
        /// Recursively copy directories.
        #[arg(short = 'r', long)]
        recursive: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// List forwarded ports for a codespace.
    Ports {
        /// Codespace name.
        name: String,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Rebuild a codespace from its devcontainer configuration.
    Rebuild {
        /// Codespace name.
        name: String,
        /// Skip confirmation prompt.
        #[arg(short = 'y', long)]
        yes: bool,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor alias`.
#[derive(Subcommand, Debug)]
pub enum AliasCommand {
    /// List aliases.
    List {
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Set an alias.
    Set {
        /// Alias name.
        name: String,
        /// Command to alias (with arguments).
        command: Vec<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Delete an alias.
    Delete {
        /// Alias name to delete.
        name: String,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor project`.
#[derive(Subcommand, Debug)]
pub enum ProjectCommand {
    /// List projects.
    List {
        /// Organization to list projects for.
        #[arg(long, conflicts_with_all = ["owner", "repo"])]
        org: Option<String>,
        /// User to list projects for.
        #[arg(long, conflicts_with_all = ["org", "repo"])]
        owner: Option<String>,
        /// Repository (OWNER/REPO format). Auto-detected from git remote if omitted.
        #[arg(short = 'R', long, conflicts_with_all = ["org", "owner"])]
        repo: Option<String>,
        /// Use Projects V2 (GraphQL) instead of classic Projects (REST).
        #[arg(long)]
        v2: bool,
        /// Maximum number of projects to show (default: 30).
        #[arg(short = 'L', long, default_value = "30")]
        limit: u32,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// View a project's details.
    View {
        /// Project number.
        number: u64,
        /// Organization that owns the project.
        #[arg(long, conflicts_with = "owner")]
        org: Option<String>,
        /// User that owns the project.
        #[arg(long, conflicts_with = "org")]
        owner: Option<String>,
        /// Open the project in the browser.
        #[arg(short = 'w', long)]
        web: bool,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Add an item to a project.
    ItemAdd {
        /// Project number.
        #[arg(long)]
        project: u64,
        /// Issue number to add.
        #[arg(long, conflicts_with = "pull_request")]
        issue: Option<u64>,
        /// Pull request number to add.
        #[arg(long = "pr", conflicts_with = "issue")]
        pull_request: Option<u64>,
        /// Organization that owns the project.
        #[arg(long, conflicts_with = "owner")]
        org: Option<String>,
        /// User that owns the project.
        #[arg(long, conflicts_with = "org")]
        owner: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor attestation`.
#[derive(Subcommand, Debug)]
pub enum AttestationCommand {
    /// Verify an artifact attestation.
    Verify {
        /// File to verify.
        file: String,
        /// Expected artifact owner/organization.
        #[arg(long)]
        owner: Option<String>,
        /// Repository to scope verification to.
        #[arg(long)]
        repo: Option<String>,
        /// Local Sigstore bundle file instead of fetching from API.
        #[arg(long)]
        bundle: Option<String>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor classroom`.
#[derive(Subcommand, Debug)]
pub enum ClassroomCommand {
    /// List classrooms.
    List {
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// List assignments for a classroom.
    Assignments {
        /// Classroom ID.
        id: u64,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}

/// Subcommands for `gor copilot`.
#[derive(Subcommand, Debug)]
pub enum CopilotCommand {
    /// Show Copilot subscription status.
    Status {
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
    /// Show Copilot usage statistics for an organization.
    Usage {
        /// Organization to query usage for.
        #[arg(long)]
        org: Option<String>,
        /// Output as JSON. Optionally specify comma-separated field names.
        #[arg(long, num_args = 0.., value_delimiter = ',')]
        json: Option<Vec<String>>,
        /// GitHub hostname for GitHub Enterprise Server (default: github.com).
        #[arg(long, env = "GH_HOST")]
        hostname: Option<String>,
    },
}