@abarcenas/ai-workflow-template 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.github/agents/implementation-plan.agent.md +192 -0
  2. package/.github/agents/plan.agent.md +135 -0
  3. package/.github/agents/research-spike.agent.md +204 -0
  4. package/.github/instructions/agent-safety.instructions.md +98 -0
  5. package/.github/instructions/agent-skill.instructions.md +272 -0
  6. package/.github/instructions/agent.instructions.md +1068 -0
  7. package/.github/instructions/ai-prompt-engineering-safety.instructions.md +991 -0
  8. package/.github/instructions/angular.instructions.md +116 -0
  9. package/.github/instructions/context7.instructions.md +109 -0
  10. package/.github/instructions/go.instructions.md +374 -0
  11. package/.github/instructions/html-to-css-guide.instructions.md +104 -0
  12. package/.github/instructions/instructions.instructions.md +264 -0
  13. package/.github/instructions/markdown.instructions.md +51 -0
  14. package/.github/instructions/memory-bank.instructions.md +322 -0
  15. package/.github/instructions/nodejs-vitest.instructions.md +34 -0
  16. package/.github/instructions/playwright-typescript.instructions.md +88 -0
  17. package/.github/instructions/prompt.instructions.md +99 -0
  18. package/.github/instructions/security-owasp.instructions.md +59 -0
  19. package/.github/instructions/shell.instructions.md +132 -0
  20. package/.github/instructions/task-implementation.instructions.md +203 -0
  21. package/.github/instructions/typescript.instructions.md +114 -0
  22. package/.github/prompts/copilot-instructions-blueprint-generator.prompt.md +317 -0
  23. package/.github/prompts/documentation-writer.prompt.md +46 -0
  24. package/.github/prompts/editconfig.prompt.md +64 -0
  25. package/.github/prompts/playwright-explore.prompt.md +39 -0
  26. package/.github/prompts/playwright-generate-test.prompt.md +39 -0
  27. package/.github/skills/agent-governance/SKILL.md +572 -0
  28. package/.github/skills/boost-prompt/SKILL.md +25 -0
  29. package/.github/skills/chrome-devtools/SKILL.md +97 -0
  30. package/.github/skills/context-map/SKILL.md +57 -0
  31. package/.github/skills/conventional-commit/SKILL.md +72 -0
  32. package/.github/skills/create-readme/SKILL.md +21 -0
  33. package/.github/skills/editorconfig/SKILL.md +63 -0
  34. package/.github/skills/gh-cli/SKILL.md +2188 -0
  35. package/.github/skills/git-commit/SKILL.md +124 -0
  36. package/.github/skills/github-issues/SKILL.md +134 -0
  37. package/.github/skills/github-issues/references/templates.md +110 -0
  38. package/.github/skills/microsoft-docs/SKILL.md +114 -0
  39. package/.github/skills/playwright-explore-website/SKILL.md +17 -0
  40. package/.github/skills/playwright-generate-test/SKILL.md +17 -0
  41. package/.github/skills/polygot-test-agent/SKILL.md +171 -0
  42. package/.github/skills/polygot-test-agent/unit-test-genearation.prompt.md +155 -0
  43. package/.github/skills/prompt-builder/SKILL.md +159 -0
  44. package/.github/workflows/npm-publish.yml +25 -0
  45. package/README.md +111 -0
  46. package/package.json +32 -0
  47. package/scripts/bump-version.js +29 -0
  48. package/scripts/sync.js +122 -0
@@ -0,0 +1,2188 @@
1
+ ---
2
+ name: gh-cli
3
+ description: GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line.
4
+ ---
5
+
6
+ # GitHub CLI (gh)
7
+
8
+ Comprehensive reference for GitHub CLI (gh) - work seamlessly with GitHub from the command line.
9
+
10
+ **Version:** 2.85.0 (current as of January 2026)
11
+
12
+ ## Prerequisites
13
+
14
+ ### Installation
15
+
16
+ ```bash
17
+ # macOS
18
+ brew install gh
19
+
20
+ # Linux
21
+ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
22
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
23
+ sudo apt update
24
+ sudo apt install gh
25
+
26
+ # Windows
27
+ winget install --id GitHub.cli
28
+
29
+ # Verify installation
30
+ gh --version
31
+ ```
32
+
33
+ ### Authentication
34
+
35
+ ```bash
36
+ # Interactive login (default: github.com)
37
+ gh auth login
38
+
39
+ # Login with specific hostname
40
+ gh auth login --hostname enterprise.internal
41
+
42
+ # Login with token
43
+ gh auth login --with-token < mytoken.txt
44
+
45
+ # Check authentication status
46
+ gh auth status
47
+
48
+ # Switch accounts
49
+ gh auth switch --hostname github.com --user username
50
+
51
+ # Logout
52
+ gh auth logout --hostname github.com --user username
53
+ ```
54
+
55
+ ### Setup Git Integration
56
+
57
+ ```bash
58
+ # Configure git to use gh as credential helper
59
+ gh auth setup-git
60
+
61
+ # View active token
62
+ gh auth token
63
+
64
+ # Refresh authentication scopes
65
+ gh auth refresh --scopes write:org,read:public_key
66
+ ```
67
+
68
+ ## CLI Structure
69
+
70
+ ```
71
+ gh # Root command
72
+ ├── auth # Authentication
73
+ │ ├── login
74
+ │ ├── logout
75
+ │ ├── refresh
76
+ │ ├── setup-git
77
+ │ ├── status
78
+ │ ├── switch
79
+ │ └── token
80
+ ├── browse # Open in browser
81
+ ├── codespace # GitHub Codespaces
82
+ │ ├── code
83
+ │ ├── cp
84
+ │ ├── create
85
+ │ ├── delete
86
+ │ ├── edit
87
+ │ ├── jupyter
88
+ │ ├── list
89
+ │ ├── logs
90
+ │ ├── ports
91
+ │ ├── rebuild
92
+ │ ├── ssh
93
+ │ ├── stop
94
+ │ └── view
95
+ ├── gist # Gists
96
+ │ ├── clone
97
+ │ ├── create
98
+ │ ├── delete
99
+ │ ├── edit
100
+ │ ├── list
101
+ │ ├── rename
102
+ │ └── view
103
+ ├── issue # Issues
104
+ │ ├── create
105
+ │ ├── list
106
+ │ ├── status
107
+ │ ├── close
108
+ │ ├── comment
109
+ │ ├── delete
110
+ │ ├── develop
111
+ │ ├── edit
112
+ │ ├── lock
113
+ │ ├── pin
114
+ │ ├── reopen
115
+ │ ├── transfer
116
+ │ ├── unlock
117
+ │ └── view
118
+ ├── org # Organizations
119
+ │ └── list
120
+ ├── pr # Pull Requests
121
+ │ ├── create
122
+ │ ├── list
123
+ │ ├── status
124
+ │ ├── checkout
125
+ │ ├── checks
126
+ │ ├── close
127
+ │ ├── comment
128
+ │ ├── diff
129
+ │ ├── edit
130
+ │ ├── lock
131
+ │ ├── merge
132
+ │ ├── ready
133
+ │ ├── reopen
134
+ │ ├── revert
135
+ │ ├── review
136
+ │ ├── unlock
137
+ │ ├── update-branch
138
+ │ └── view
139
+ ├── project # Projects
140
+ │ ├── close
141
+ │ ├── copy
142
+ │ ├── create
143
+ │ ├── delete
144
+ │ ├── edit
145
+ │ ├── field-create
146
+ │ ├── field-delete
147
+ │ ├── field-list
148
+ │ ├── item-add
149
+ │ ├── item-archive
150
+ │ ├── item-create
151
+ │ ├── item-delete
152
+ │ ├── item-edit
153
+ │ ├── item-list
154
+ │ ├── link
155
+ │ ├── list
156
+ │ ├── mark-template
157
+ │ ├── unlink
158
+ │ └── view
159
+ ├── release # Releases
160
+ │ ├── create
161
+ │ ├── list
162
+ │ ├── delete
163
+ │ ├── delete-asset
164
+ │ ├── download
165
+ │ ├── edit
166
+ │ ├── upload
167
+ │ ├── verify
168
+ │ ├── verify-asset
169
+ │ └── view
170
+ ├── repo # Repositories
171
+ │ ├── create
172
+ │ ├── list
173
+ │ ├── archive
174
+ │ ├── autolink
175
+ │ ├── clone
176
+ │ ├── delete
177
+ │ ├── deploy-key
178
+ │ ├── edit
179
+ │ ├── fork
180
+ │ ├── gitignore
181
+ │ ├── license
182
+ │ ├── rename
183
+ │ ├── set-default
184
+ │ ├── sync
185
+ │ ├── unarchive
186
+ │ └── view
187
+ ├── cache # Actions caches
188
+ │ ├── delete
189
+ │ └── list
190
+ ├── run # Workflow runs
191
+ │ ├── cancel
192
+ │ ├── delete
193
+ │ ├── download
194
+ │ ├── list
195
+ │ ├── rerun
196
+ │ ├── view
197
+ │ └── watch
198
+ ├── workflow # Workflows
199
+ │ ├── disable
200
+ │ ├── enable
201
+ │ ├── list
202
+ │ ├── run
203
+ │ └── view
204
+ ├── agent-task # Agent tasks
205
+ ├── alias # Command aliases
206
+ │ ├── delete
207
+ │ ├── import
208
+ │ ├── list
209
+ │ └── set
210
+ ├── api # API requests
211
+ ├── attestation # Artifact attestations
212
+ │ ├── download
213
+ │ ├── trusted-root
214
+ │ └── verify
215
+ ├── completion # Shell completion
216
+ ├── config # Configuration
217
+ │ ├── clear-cache
218
+ │ ├── get
219
+ │ ├── list
220
+ │ └── set
221
+ ├── extension # Extensions
222
+ │ ├── browse
223
+ │ ├── create
224
+ │ ├── exec
225
+ │ ├── install
226
+ │ ├── list
227
+ │ ├── remove
228
+ │ ├── search
229
+ │ └── upgrade
230
+ ├── gpg-key # GPG keys
231
+ │ ├── add
232
+ │ ├── delete
233
+ │ └── list
234
+ ├── label # Labels
235
+ │ ├── clone
236
+ │ ├── create
237
+ │ ├── delete
238
+ │ ├── edit
239
+ │ └── list
240
+ ├── preview # Preview features
241
+ ├── ruleset # Rulesets
242
+ │ ├── check
243
+ │ ├── list
244
+ │ └── view
245
+ ├── search # Search
246
+ │ ├── code
247
+ │ ├── commits
248
+ │ ├── issues
249
+ │ ├── prs
250
+ │ └── repos
251
+ ├── secret # Secrets
252
+ │ ├── delete
253
+ │ ├── list
254
+ │ └── set
255
+ ├── ssh-key # SSH keys
256
+ │ ├── add
257
+ │ ├── delete
258
+ │ └── list
259
+ ├── status # Status overview
260
+ └── variable # Variables
261
+ ├── delete
262
+ ├── get
263
+ ├── list
264
+ └── set
265
+ ```
266
+
267
+ ## Configuration
268
+
269
+ ### Global Configuration
270
+
271
+ ```bash
272
+ # List all configuration
273
+ gh config list
274
+
275
+ # Get specific configuration value
276
+ gh config list git_protocol
277
+ gh config get editor
278
+
279
+ # Set configuration value
280
+ gh config set editor vim
281
+ gh config set git_protocol ssh
282
+ gh config set prompt disabled
283
+ gh config set pager "less -R"
284
+
285
+ # Clear configuration cache
286
+ gh config clear-cache
287
+ ```
288
+
289
+ ### Environment Variables
290
+
291
+ ```bash
292
+ # GitHub token (for automation)
293
+ export GH_TOKEN=ghp_xxxxxxxxxxxx
294
+
295
+ # GitHub hostname
296
+ export GH_HOST=github.com
297
+
298
+ # Disable prompts
299
+ export GH_PROMPT_DISABLED=true
300
+
301
+ # Custom editor
302
+ export GH_EDITOR=vim
303
+
304
+ # Custom pager
305
+ export GH_PAGER=less
306
+
307
+ # HTTP timeout
308
+ export GH_TIMEOUT=30
309
+
310
+ # Custom repository (override default)
311
+ export GH_REPO=owner/repo
312
+
313
+ # Custom git protocol
314
+ export GH_ENTERPRISE_HOSTNAME=hostname
315
+ ```
316
+
317
+ ## Authentication (gh auth)
318
+
319
+ ### Login
320
+
321
+ ```bash
322
+ # Interactive login
323
+ gh auth login
324
+
325
+ # Web-based authentication
326
+ gh auth login --web
327
+
328
+ # With clipboard for OAuth code
329
+ gh auth login --web --clipboard
330
+
331
+ # With specific git protocol
332
+ gh auth login --git-protocol ssh
333
+
334
+ # With custom hostname (GitHub Enterprise)
335
+ gh auth login --hostname enterprise.internal
336
+
337
+ # Login with token from stdin
338
+ gh auth login --with-token < token.txt
339
+
340
+ # Insecure storage (plain text)
341
+ gh auth login --insecure-storage
342
+ ```
343
+
344
+ ### Status
345
+
346
+ ```bash
347
+ # Show all authentication status
348
+ gh auth status
349
+
350
+ # Show active account only
351
+ gh auth status --active
352
+
353
+ # Show specific hostname
354
+ gh auth status --hostname github.com
355
+
356
+ # Show token in output
357
+ gh auth status --show-token
358
+
359
+ # JSON output
360
+ gh auth status --json hosts
361
+
362
+ # Filter with jq
363
+ gh auth status --json hosts --jq '.hosts | add'
364
+ ```
365
+
366
+ ### Switch Accounts
367
+
368
+ ```bash
369
+ # Interactive switch
370
+ gh auth switch
371
+
372
+ # Switch to specific user/host
373
+ gh auth switch --hostname github.com --user monalisa
374
+ ```
375
+
376
+ ### Token
377
+
378
+ ```bash
379
+ # Print authentication token
380
+ gh auth token
381
+
382
+ # Token for specific host/user
383
+ gh auth token --hostname github.com --user monalisa
384
+ ```
385
+
386
+ ### Refresh
387
+
388
+ ```bash
389
+ # Refresh credentials
390
+ gh auth refresh
391
+
392
+ # Add scopes
393
+ gh auth refresh --scopes write:org,read:public_key
394
+
395
+ # Remove scopes
396
+ gh auth refresh --remove-scopes delete_repo
397
+
398
+ # Reset to default scopes
399
+ gh auth refresh --reset-scopes
400
+
401
+ # With clipboard
402
+ gh auth refresh --clipboard
403
+ ```
404
+
405
+ ### Setup Git
406
+
407
+ ```bash
408
+ # Setup git credential helper
409
+ gh auth setup-git
410
+
411
+ # Setup for specific host
412
+ gh auth setup-git --hostname enterprise.internal
413
+
414
+ # Force setup even if host not known
415
+ gh auth setup-git --hostname enterprise.internal --force
416
+ ```
417
+
418
+ ## Browse (gh browse)
419
+
420
+ ```bash
421
+ # Open repository in browser
422
+ gh browse
423
+
424
+ # Open specific path
425
+ gh browse script/
426
+ gh browse main.go:312
427
+
428
+ # Open issue or PR
429
+ gh browse 123
430
+
431
+ # Open commit
432
+ gh browse 77507cd94ccafcf568f8560cfecde965fcfa63
433
+
434
+ # Open with specific branch
435
+ gh browse main.go --branch bug-fix
436
+
437
+ # Open different repository
438
+ gh browse --repo owner/repo
439
+
440
+ # Open specific pages
441
+ gh browse --actions # Actions tab
442
+ gh browse --projects # Projects tab
443
+ gh browse --releases # Releases tab
444
+ gh browse --settings # Settings page
445
+ gh browse --wiki # Wiki page
446
+
447
+ # Print URL instead of opening
448
+ gh browse --no-browser
449
+ ```
450
+
451
+ ## Repositories (gh repo)
452
+
453
+ ### Create Repository
454
+
455
+ ```bash
456
+ # Create new repository
457
+ gh repo create my-repo
458
+
459
+ # Create with description
460
+ gh repo create my-repo --description "My awesome project"
461
+
462
+ # Create public repository
463
+ gh repo create my-repo --public
464
+
465
+ # Create private repository
466
+ gh repo create my-repo --private
467
+
468
+ # Create with homepage
469
+ gh repo create my-repo --homepage https://example.com
470
+
471
+ # Create with license
472
+ gh repo create my-repo --license mit
473
+
474
+ # Create with gitignore
475
+ gh repo create my-repo --gitignore python
476
+
477
+ # Initialize as template repository
478
+ gh repo create my-repo --template
479
+
480
+ # Create repository in organization
481
+ gh repo create org/my-repo
482
+
483
+ # Create without cloning locally
484
+ gh repo create my-repo --source=.
485
+
486
+ # Disable issues
487
+ gh repo create my-repo --disable-issues
488
+
489
+ # Disable wiki
490
+ gh repo create my-repo --disable-wiki
491
+ ```
492
+
493
+ ### Clone Repository
494
+
495
+ ```bash
496
+ # Clone repository
497
+ gh repo clone owner/repo
498
+
499
+ # Clone to specific directory
500
+ gh repo clone owner/repo my-directory
501
+
502
+ # Clone with different branch
503
+ gh repo clone owner/repo --branch develop
504
+ ```
505
+
506
+ ### List Repositories
507
+
508
+ ```bash
509
+ # List all repositories
510
+ gh repo list
511
+
512
+ # List repositories for owner
513
+ gh repo list owner
514
+
515
+ # Limit results
516
+ gh repo list --limit 50
517
+
518
+ # Public repositories only
519
+ gh repo list --public
520
+
521
+ # Source repositories only (not forks)
522
+ gh repo list --source
523
+
524
+ # JSON output
525
+ gh repo list --json name,visibility,owner
526
+
527
+ # Table output
528
+ gh repo list --limit 100 | tail -n +2
529
+
530
+ # Filter with jq
531
+ gh repo list --json name --jq '.[].name'
532
+ ```
533
+
534
+ ### View Repository
535
+
536
+ ```bash
537
+ # View repository details
538
+ gh repo view
539
+
540
+ # View specific repository
541
+ gh repo view owner/repo
542
+
543
+ # JSON output
544
+ gh repo view --json name,description,defaultBranchRef
545
+
546
+ # View in browser
547
+ gh repo view --web
548
+ ```
549
+
550
+ ### Edit Repository
551
+
552
+ ```bash
553
+ # Edit description
554
+ gh repo edit --description "New description"
555
+
556
+ # Set homepage
557
+ gh repo edit --homepage https://example.com
558
+
559
+ # Change visibility
560
+ gh repo edit --visibility private
561
+ gh repo edit --visibility public
562
+
563
+ # Enable/disable features
564
+ gh repo edit --enable-issues
565
+ gh repo edit --disable-issues
566
+ gh repo edit --enable-wiki
567
+ gh repo edit --disable-wiki
568
+ gh repo edit --enable-projects
569
+ gh repo edit --disable-projects
570
+
571
+ # Set default branch
572
+ gh repo edit --default-branch main
573
+
574
+ # Rename repository
575
+ gh repo rename new-name
576
+
577
+ # Archive repository
578
+ gh repo archive
579
+ gh repo unarchive
580
+ ```
581
+
582
+ ### Delete Repository
583
+
584
+ ```bash
585
+ # Delete repository
586
+ gh repo delete owner/repo
587
+
588
+ # Confirm without prompt
589
+ gh repo delete owner/repo --yes
590
+ ```
591
+
592
+ ### Fork Repository
593
+
594
+ ```bash
595
+ # Fork repository
596
+ gh repo fork owner/repo
597
+
598
+ # Fork to organization
599
+ gh repo fork owner/repo --org org-name
600
+
601
+ # Clone after forking
602
+ gh repo fork owner/repo --clone
603
+
604
+ # Remote name for fork
605
+ gh repo fork owner/repo --remote-name upstream
606
+ ```
607
+
608
+ ### Sync Fork
609
+
610
+ ```bash
611
+ # Sync fork with upstream
612
+ gh repo sync
613
+
614
+ # Sync specific branch
615
+ gh repo sync --branch feature
616
+
617
+ # Force sync
618
+ gh repo sync --force
619
+ ```
620
+
621
+ ### Set Default Repository
622
+
623
+ ```bash
624
+ # Set default repository for current directory
625
+ gh repo set-default
626
+
627
+ # Set default explicitly
628
+ gh repo set-default owner/repo
629
+
630
+ # Unset default
631
+ gh repo set-default --unset
632
+ ```
633
+
634
+ ### Repository Autolinks
635
+
636
+ ```bash
637
+ # List autolinks
638
+ gh repo autolink list
639
+
640
+ # Add autolink
641
+ gh repo autolink add \
642
+ --key-prefix JIRA- \
643
+ --url-template https://jira.example.com/browse/<num>
644
+
645
+ # Delete autolink
646
+ gh repo autolink delete 12345
647
+ ```
648
+
649
+ ### Repository Deploy Keys
650
+
651
+ ```bash
652
+ # List deploy keys
653
+ gh repo deploy-key list
654
+
655
+ # Add deploy key
656
+ gh repo deploy-key add ~/.ssh/id_rsa.pub \
657
+ --title "Production server" \
658
+ --read-only
659
+
660
+ # Delete deploy key
661
+ gh repo deploy-key delete 12345
662
+ ```
663
+
664
+ ### Gitignore and License
665
+
666
+ ```bash
667
+ # View gitignore template
668
+ gh repo gitignore
669
+
670
+ # View license template
671
+ gh repo license mit
672
+
673
+ # License with full name
674
+ gh repo license mit --fullname "John Doe"
675
+ ```
676
+
677
+ ## Issues (gh issue)
678
+
679
+ ### Create Issue
680
+
681
+ ```bash
682
+ # Create issue interactively
683
+ gh issue create
684
+
685
+ # Create with title
686
+ gh issue create --title "Bug: Login not working"
687
+
688
+ # Create with title and body
689
+ gh issue create \
690
+ --title "Bug: Login not working" \
691
+ --body "Steps to reproduce..."
692
+
693
+ # Create with body from file
694
+ gh issue create --body-file issue.md
695
+
696
+ # Create with labels
697
+ gh issue create --title "Fix bug" --labels bug,high-priority
698
+
699
+ # Create with assignees
700
+ gh issue create --title "Fix bug" --assignee user1,user2
701
+
702
+ # Create in specific repository
703
+ gh issue create --repo owner/repo --title "Issue title"
704
+
705
+ # Create issue from web
706
+ gh issue create --web
707
+ ```
708
+
709
+ ### List Issues
710
+
711
+ ```bash
712
+ # List all open issues
713
+ gh issue list
714
+
715
+ # List all issues (including closed)
716
+ gh issue list --state all
717
+
718
+ # List closed issues
719
+ gh issue list --state closed
720
+
721
+ # Limit results
722
+ gh issue list --limit 50
723
+
724
+ # Filter by assignee
725
+ gh issue list --assignee username
726
+ gh issue list --assignee @me
727
+
728
+ # Filter by labels
729
+ gh issue list --labels bug,enhancement
730
+
731
+ # Filter by milestone
732
+ gh issue list --milestone "v1.0"
733
+
734
+ # Search/filter
735
+ gh issue list --search "is:open is:issue label:bug"
736
+
737
+ # JSON output
738
+ gh issue list --json number,title,state,author
739
+
740
+ # Table view
741
+ gh issue list --json number,title,labels --jq '.[] | [.number, .title, .labels[].name] | @tsv'
742
+
743
+ # Show comments count
744
+ gh issue list --json number,title,comments --jq '.[] | [.number, .title, .comments]'
745
+
746
+ # Sort by
747
+ gh issue list --sort created --order desc
748
+ ```
749
+
750
+ ### View Issue
751
+
752
+ ```bash
753
+ # View issue
754
+ gh issue view 123
755
+
756
+ # View with comments
757
+ gh issue view 123 --comments
758
+
759
+ # View in browser
760
+ gh issue view 123 --web
761
+
762
+ # JSON output
763
+ gh issue view 123 --json title,body,state,labels,comments
764
+
765
+ # View specific fields
766
+ gh issue view 123 --json title --jq '.title'
767
+ ```
768
+
769
+ ### Edit Issue
770
+
771
+ ```bash
772
+ # Edit interactively
773
+ gh issue edit 123
774
+
775
+ # Edit title
776
+ gh issue edit 123 --title "New title"
777
+
778
+ # Edit body
779
+ gh issue edit 123 --body "New description"
780
+
781
+ # Add labels
782
+ gh issue edit 123 --add-label bug,high-priority
783
+
784
+ # Remove labels
785
+ gh issue edit 123 --remove-label stale
786
+
787
+ # Add assignees
788
+ gh issue edit 123 --add-assignee user1,user2
789
+
790
+ # Remove assignees
791
+ gh issue edit 123 --remove-assignee user1
792
+
793
+ # Set milestone
794
+ gh issue edit 123 --milestone "v1.0"
795
+ ```
796
+
797
+ ### Close/Reopen Issue
798
+
799
+ ```bash
800
+ # Close issue
801
+ gh issue close 123
802
+
803
+ # Close with comment
804
+ gh issue close 123 --comment "Fixed in PR #456"
805
+
806
+ # Reopen issue
807
+ gh issue reopen 123
808
+ ```
809
+
810
+ ### Comment on Issue
811
+
812
+ ```bash
813
+ # Add comment
814
+ gh issue comment 123 --body "This looks good!"
815
+
816
+ # Edit comment
817
+ gh issue comment 123 --edit 456789 --body "Updated comment"
818
+
819
+ # Delete comment
820
+ gh issue comment 123 --delete 456789
821
+ ```
822
+
823
+ ### Issue Status
824
+
825
+ ```bash
826
+ # Show issue status summary
827
+ gh issue status
828
+
829
+ # Status for specific repository
830
+ gh issue status --repo owner/repo
831
+ ```
832
+
833
+ ### Pin/Unpin Issues
834
+
835
+ ```bash
836
+ # Pin issue (pinned to repo dashboard)
837
+ gh issue pin 123
838
+
839
+ # Unpin issue
840
+ gh issue unpin 123
841
+ ```
842
+
843
+ ### Lock/Unlock Issue
844
+
845
+ ```bash
846
+ # Lock conversation
847
+ gh issue lock 123
848
+
849
+ # Lock with reason
850
+ gh issue lock 123 --reason off-topic
851
+
852
+ # Unlock
853
+ gh issue unlock 123
854
+ ```
855
+
856
+ ### Transfer Issue
857
+
858
+ ```bash
859
+ # Transfer to another repository
860
+ gh issue transfer 123 --repo owner/new-repo
861
+ ```
862
+
863
+ ### Delete Issue
864
+
865
+ ```bash
866
+ # Delete issue
867
+ gh issue delete 123
868
+
869
+ # Confirm without prompt
870
+ gh issue delete 123 --yes
871
+ ```
872
+
873
+ ### Develop Issue (Draft PR)
874
+
875
+ ```bash
876
+ # Create draft PR from issue
877
+ gh issue develop 123
878
+
879
+ # Create in specific branch
880
+ gh issue develop 123 --branch fix/issue-123
881
+
882
+ # Create with base branch
883
+ gh issue develop 123 --base main
884
+ ```
885
+
886
+ ## Pull Requests (gh pr)
887
+
888
+ ### Create Pull Request
889
+
890
+ ```bash
891
+ # Create PR interactively
892
+ gh pr create
893
+
894
+ # Create with title
895
+ gh pr create --title "Feature: Add new functionality"
896
+
897
+ # Create with title and body
898
+ gh pr create \
899
+ --title "Feature: Add new functionality" \
900
+ --body "This PR adds..."
901
+
902
+ # Fill body from template
903
+ gh pr create --body-file .github/PULL_REQUEST_TEMPLATE.md
904
+
905
+ # Set base branch
906
+ gh pr create --base main
907
+
908
+ # Set head branch (default: current branch)
909
+ gh pr create --head feature-branch
910
+
911
+ # Create draft PR
912
+ gh pr create --draft
913
+
914
+ # Add assignees
915
+ gh pr create --assignee user1,user2
916
+
917
+ # Add reviewers
918
+ gh pr create --reviewer user1,user2
919
+
920
+ # Add labels
921
+ gh pr create --labels enhancement,feature
922
+
923
+ # Link to issue
924
+ gh pr create --issue 123
925
+
926
+ # Create in specific repository
927
+ gh pr create --repo owner/repo
928
+
929
+ # Open in browser after creation
930
+ gh pr create --web
931
+ ```
932
+
933
+ ### List Pull Requests
934
+
935
+ ```bash
936
+ # List open PRs
937
+ gh pr list
938
+
939
+ # List all PRs
940
+ gh pr list --state all
941
+
942
+ # List merged PRs
943
+ gh pr list --state merged
944
+
945
+ # List closed (not merged) PRs
946
+ gh pr list --state closed
947
+
948
+ # Filter by head branch
949
+ gh pr list --head feature-branch
950
+
951
+ # Filter by base branch
952
+ gh pr list --base main
953
+
954
+ # Filter by author
955
+ gh pr list --author username
956
+ gh pr list --author @me
957
+
958
+ # Filter by assignee
959
+ gh pr list --assignee username
960
+
961
+ # Filter by labels
962
+ gh pr list --labels bug,enhancement
963
+
964
+ # Limit results
965
+ gh pr list --limit 50
966
+
967
+ # Search
968
+ gh pr list --search "is:open is:pr label:review-required"
969
+
970
+ # JSON output
971
+ gh pr list --json number,title,state,author,headRefName
972
+
973
+ # Show check status
974
+ gh pr list --json number,title,statusCheckRollup --jq '.[] | [.number, .title, .statusCheckRollup[]?.status]'
975
+
976
+ # Sort by
977
+ gh pr list --sort created --order desc
978
+ ```
979
+
980
+ ### View Pull Request
981
+
982
+ ```bash
983
+ # View PR
984
+ gh pr view 123
985
+
986
+ # View with comments
987
+ gh pr view 123 --comments
988
+
989
+ # View in browser
990
+ gh pr view 123 --web
991
+
992
+ # JSON output
993
+ gh pr view 123 --json title,body,state,author,commits,files
994
+
995
+ # View diff
996
+ gh pr view 123 --json files --jq '.files[].path'
997
+
998
+ # View with jq query
999
+ gh pr view 123 --json title,state --jq '"\(.title): \(.state)"'
1000
+ ```
1001
+
1002
+ ### Checkout Pull Request
1003
+
1004
+ ```bash
1005
+ # Checkout PR branch
1006
+ gh pr checkout 123
1007
+
1008
+ # Checkout with specific branch name
1009
+ gh pr checkout 123 --branch name-123
1010
+
1011
+ # Force checkout
1012
+ gh pr checkout 123 --force
1013
+ ```
1014
+
1015
+ ### Diff Pull Request
1016
+
1017
+ ```bash
1018
+ # View PR diff
1019
+ gh pr diff 123
1020
+
1021
+ # View diff with color
1022
+ gh pr diff 123 --color always
1023
+
1024
+ # Output to file
1025
+ gh pr diff 123 > pr-123.patch
1026
+
1027
+ # View diff of specific files
1028
+ gh pr diff 123 --name-only
1029
+ ```
1030
+
1031
+ ### Merge Pull Request
1032
+
1033
+ ```bash
1034
+ # Merge PR
1035
+ gh pr merge 123
1036
+
1037
+ # Merge with specific method
1038
+ gh pr merge 123 --merge
1039
+ gh pr merge 123 --squash
1040
+ gh pr merge 123 --rebase
1041
+
1042
+ # Delete branch after merge
1043
+ gh pr merge 123 --delete-branch
1044
+
1045
+ # Merge with comment
1046
+ gh pr merge 123 --subject "Merge PR #123" --body "Merging feature"
1047
+
1048
+ # Merge draft PR
1049
+ gh pr merge 123 --admin
1050
+
1051
+ # Force merge (skip checks)
1052
+ gh pr merge 123 --admin
1053
+ ```
1054
+
1055
+ ### Close Pull Request
1056
+
1057
+ ```bash
1058
+ # Close PR (as draft, not merge)
1059
+ gh pr close 123
1060
+
1061
+ # Close with comment
1062
+ gh pr close 123 --comment "Closing due to..."
1063
+ ```
1064
+
1065
+ ### Reopen Pull Request
1066
+
1067
+ ```bash
1068
+ # Reopen closed PR
1069
+ gh pr reopen 123
1070
+ ```
1071
+
1072
+ ### Edit Pull Request
1073
+
1074
+ ```bash
1075
+ # Edit interactively
1076
+ gh pr edit 123
1077
+
1078
+ # Edit title
1079
+ gh pr edit 123 --title "New title"
1080
+
1081
+ # Edit body
1082
+ gh pr edit 123 --body "New description"
1083
+
1084
+ # Add labels
1085
+ gh pr edit 123 --add-label bug,enhancement
1086
+
1087
+ # Remove labels
1088
+ gh pr edit 123 --remove-label stale
1089
+
1090
+ # Add assignees
1091
+ gh pr edit 123 --add-assignee user1,user2
1092
+
1093
+ # Remove assignees
1094
+ gh pr edit 123 --remove-assignee user1
1095
+
1096
+ # Add reviewers
1097
+ gh pr edit 123 --add-reviewer user1,user2
1098
+
1099
+ # Remove reviewers
1100
+ gh pr edit 123 --remove-reviewer user1
1101
+
1102
+ # Mark as ready for review
1103
+ gh pr edit 123 --ready
1104
+ ```
1105
+
1106
+ ### Ready for Review
1107
+
1108
+ ```bash
1109
+ # Mark draft PR as ready
1110
+ gh pr ready 123
1111
+ ```
1112
+
1113
+ ### Pull Request Checks
1114
+
1115
+ ```bash
1116
+ # View PR checks
1117
+ gh pr checks 123
1118
+
1119
+ # Watch checks in real-time
1120
+ gh pr checks 123 --watch
1121
+
1122
+ # Watch interval (seconds)
1123
+ gh pr checks 123 --watch --interval 5
1124
+ ```
1125
+
1126
+ ### Comment on Pull Request
1127
+
1128
+ ```bash
1129
+ # Add comment
1130
+ gh pr comment 123 --body "Looks good!"
1131
+
1132
+ # Comment on specific line
1133
+ gh pr comment 123 --body "Fix this" \
1134
+ --repo owner/repo \
1135
+ --head-owner owner --head-branch feature
1136
+
1137
+ # Edit comment
1138
+ gh pr comment 123 --edit 456789 --body "Updated"
1139
+
1140
+ # Delete comment
1141
+ gh pr comment 123 --delete 456789
1142
+ ```
1143
+
1144
+ ### Review Pull Request
1145
+
1146
+ ```bash
1147
+ # Review PR (opens editor)
1148
+ gh pr review 123
1149
+
1150
+ # Approve PR
1151
+ gh pr review 123 --approve \
1152
+ --approve-body "LGTM!"
1153
+
1154
+ # Request changes
1155
+ gh pr review 123 --request-changes \
1156
+ --body "Please fix these issues"
1157
+
1158
+ # Comment on PR
1159
+ gh pr review 123 --comment --body "Some thoughts..."
1160
+
1161
+ # Dismiss review
1162
+ gh pr review 123 --dismiss
1163
+ ```
1164
+
1165
+ ### Update Branch
1166
+
1167
+ ```bash
1168
+ # Update PR branch with latest base branch
1169
+ gh pr update-branch 123
1170
+
1171
+ # Force update
1172
+ gh pr update-branch 123 --force
1173
+
1174
+ # Use merge strategy
1175
+ gh pr update-branch 123 --merge
1176
+ ```
1177
+
1178
+ ### Lock/Unlock Pull Request
1179
+
1180
+ ```bash
1181
+ # Lock PR conversation
1182
+ gh pr lock 123
1183
+
1184
+ # Lock with reason
1185
+ gh pr lock 123 --reason off-topic
1186
+
1187
+ # Unlock
1188
+ gh pr unlock 123
1189
+ ```
1190
+
1191
+ ### Revert Pull Request
1192
+
1193
+ ```bash
1194
+ # Revert merged PR
1195
+ gh pr revert 123
1196
+
1197
+ # Revert with specific branch name
1198
+ gh pr revert 123 --branch revert-pr-123
1199
+ ```
1200
+
1201
+ ### Pull Request Status
1202
+
1203
+ ```bash
1204
+ # Show PR status summary
1205
+ gh pr status
1206
+
1207
+ # Status for specific repository
1208
+ gh pr status --repo owner/repo
1209
+ ```
1210
+
1211
+ ## GitHub Actions
1212
+
1213
+ ### Workflow Runs (gh run)
1214
+
1215
+ ```bash
1216
+ # List workflow runs
1217
+ gh run list
1218
+
1219
+ # List for specific workflow
1220
+ gh run list --workflow "ci.yml"
1221
+
1222
+ # List for specific branch
1223
+ gh run list --branch main
1224
+
1225
+ # Limit results
1226
+ gh run list --limit 20
1227
+
1228
+ # JSON output
1229
+ gh run list --json databaseId,status,conclusion,headBranch
1230
+
1231
+ # View run details
1232
+ gh run view 123456789
1233
+
1234
+ # View run with verbose logs
1235
+ gh run view 123456789 --log
1236
+
1237
+ # View specific job
1238
+ gh run view 123456789 --job 987654321
1239
+
1240
+ # View in browser
1241
+ gh run view 123456789 --web
1242
+
1243
+ # Watch run in real-time
1244
+ gh run watch 123456789
1245
+
1246
+ # Watch with interval
1247
+ gh run watch 123456789 --interval 5
1248
+
1249
+ # Rerun failed run
1250
+ gh run rerun 123456789
1251
+
1252
+ # Rerun specific job
1253
+ gh run rerun 123456789 --job 987654321
1254
+
1255
+ # Cancel run
1256
+ gh run cancel 123456789
1257
+
1258
+ # Delete run
1259
+ gh run delete 123456789
1260
+
1261
+ # Download run artifacts
1262
+ gh run download 123456789
1263
+
1264
+ # Download specific artifact
1265
+ gh run download 123456789 --name build
1266
+
1267
+ # Download to directory
1268
+ gh run download 123456789 --dir ./artifacts
1269
+ ```
1270
+
1271
+ ### Workflows (gh workflow)
1272
+
1273
+ ```bash
1274
+ # List workflows
1275
+ gh workflow list
1276
+
1277
+ # View workflow details
1278
+ gh workflow view ci.yml
1279
+
1280
+ # View workflow YAML
1281
+ gh workflow view ci.yml --yaml
1282
+
1283
+ # View in browser
1284
+ gh workflow view ci.yml --web
1285
+
1286
+ # Enable workflow
1287
+ gh workflow enable ci.yml
1288
+
1289
+ # Disable workflow
1290
+ gh workflow disable ci.yml
1291
+
1292
+ # Run workflow manually
1293
+ gh workflow run ci.yml
1294
+
1295
+ # Run with inputs
1296
+ gh workflow run ci.yml \
1297
+ --raw-field \
1298
+ version="1.0.0" \
1299
+ environment="production"
1300
+
1301
+ # Run from specific branch
1302
+ gh workflow run ci.yml --ref develop
1303
+ ```
1304
+
1305
+ ### Action Caches (gh cache)
1306
+
1307
+ ```bash
1308
+ # List caches
1309
+ gh cache list
1310
+
1311
+ # List for specific branch
1312
+ gh cache list --branch main
1313
+
1314
+ # List with limit
1315
+ gh cache list --limit 50
1316
+
1317
+ # Delete cache
1318
+ gh cache delete 123456789
1319
+
1320
+ # Delete all caches
1321
+ gh cache delete --all
1322
+ ```
1323
+
1324
+ ### Action Secrets (gh secret)
1325
+
1326
+ ```bash
1327
+ # List secrets
1328
+ gh secret list
1329
+
1330
+ # Set secret (prompts for value)
1331
+ gh secret set MY_SECRET
1332
+
1333
+ # Set secret from environment
1334
+ echo "$MY_SECRET" | gh secret set MY_SECRET
1335
+
1336
+ # Set secret for specific environment
1337
+ gh secret set MY_SECRET --env production
1338
+
1339
+ # Set secret for organization
1340
+ gh secret set MY_SECRET --org orgname
1341
+
1342
+ # Delete secret
1343
+ gh secret delete MY_SECRET
1344
+
1345
+ # Delete from environment
1346
+ gh secret delete MY_SECRET --env production
1347
+ ```
1348
+
1349
+ ### Action Variables (gh variable)
1350
+
1351
+ ```bash
1352
+ # List variables
1353
+ gh variable list
1354
+
1355
+ # Set variable
1356
+ gh variable set MY_VAR "some-value"
1357
+
1358
+ # Set variable for environment
1359
+ gh variable set MY_VAR "value" --env production
1360
+
1361
+ # Set variable for organization
1362
+ gh variable set MY_VAR "value" --org orgname
1363
+
1364
+ # Get variable value
1365
+ gh variable get MY_VAR
1366
+
1367
+ # Delete variable
1368
+ gh variable delete MY_VAR
1369
+
1370
+ # Delete from environment
1371
+ gh variable delete MY_VAR --env production
1372
+ ```
1373
+
1374
+ ## Projects (gh project)
1375
+
1376
+ ```bash
1377
+ # List projects
1378
+ gh project list
1379
+
1380
+ # List for owner
1381
+ gh project list --owner owner
1382
+
1383
+ # Open projects
1384
+ gh project list --open
1385
+
1386
+ # View project
1387
+ gh project view 123
1388
+
1389
+ # View project items
1390
+ gh project view 123 --format json
1391
+
1392
+ # Create project
1393
+ gh project create --title "My Project"
1394
+
1395
+ # Create in organization
1396
+ gh project create --title "Project" --org orgname
1397
+
1398
+ # Create with readme
1399
+ gh project create --title "Project" --readme "Description here"
1400
+
1401
+ # Edit project
1402
+ gh project edit 123 --title "New Title"
1403
+
1404
+ # Delete project
1405
+ gh project delete 123
1406
+
1407
+ # Close project
1408
+ gh project close 123
1409
+
1410
+ # Copy project
1411
+ gh project copy 123 --owner target-owner --title "Copy"
1412
+
1413
+ # Mark template
1414
+ gh project mark-template 123
1415
+
1416
+ # List fields
1417
+ gh project field-list 123
1418
+
1419
+ # Create field
1420
+ gh project field-create 123 --title "Status" --datatype single_select
1421
+
1422
+ # Delete field
1423
+ gh project field-delete 123 --id 456
1424
+
1425
+ # List items
1426
+ gh project item-list 123
1427
+
1428
+ # Create item
1429
+ gh project item-create 123 --title "New item"
1430
+
1431
+ # Add item to project
1432
+ gh project item-add 123 --owner-owner --repo repo --issue 456
1433
+
1434
+ # Edit item
1435
+ gh project item-edit 123 --id 456 --title "Updated title"
1436
+
1437
+ # Delete item
1438
+ gh project item-delete 123 --id 456
1439
+
1440
+ # Archive item
1441
+ gh project item-archive 123 --id 456
1442
+
1443
+ # Link items
1444
+ gh project link 123 --id 456 --link-id 789
1445
+
1446
+ # Unlink items
1447
+ gh project unlink 123 --id 456 --link-id 789
1448
+
1449
+ # View project in browser
1450
+ gh project view 123 --web
1451
+ ```
1452
+
1453
+ ## Releases (gh release)
1454
+
1455
+ ```bash
1456
+ # List releases
1457
+ gh release list
1458
+
1459
+ # View latest release
1460
+ gh release view
1461
+
1462
+ # View specific release
1463
+ gh release view v1.0.0
1464
+
1465
+ # View in browser
1466
+ gh release view v1.0.0 --web
1467
+
1468
+ # Create release
1469
+ gh release create v1.0.0 \
1470
+ --notes "Release notes here"
1471
+
1472
+ # Create release with notes from file
1473
+ gh release create v1.0.0 --notes-file notes.md
1474
+
1475
+ # Create release with target
1476
+ gh release create v1.0.0 --target main
1477
+
1478
+ # Create release as draft
1479
+ gh release create v1.0.0 --draft
1480
+
1481
+ # Create pre-release
1482
+ gh release create v1.0.0 --prerelease
1483
+
1484
+ # Create release with title
1485
+ gh release create v1.0.0 --title "Version 1.0.0"
1486
+
1487
+ # Upload asset to release
1488
+ gh release upload v1.0.0 ./file.tar.gz
1489
+
1490
+ # Upload multiple assets
1491
+ gh release upload v1.0.0 ./file1.tar.gz ./file2.tar.gz
1492
+
1493
+ # Upload with label (casing sensitive)
1494
+ gh release upload v1.0.0 ./file.tar.gz --casing
1495
+
1496
+ # Delete release
1497
+ gh release delete v1.0.0
1498
+
1499
+ # Delete with cleanup tag
1500
+ gh release delete v1.0.0 --yes
1501
+
1502
+ # Delete specific asset
1503
+ gh release delete-asset v1.0.0 file.tar.gz
1504
+
1505
+ # Download release assets
1506
+ gh release download v1.0.0
1507
+
1508
+ # Download specific asset
1509
+ gh release download v1.0.0 --pattern "*.tar.gz"
1510
+
1511
+ # Download to directory
1512
+ gh release download v1.0.0 --dir ./downloads
1513
+
1514
+ # Download archive (zip/tar)
1515
+ gh release download v1.0.0 --archive zip
1516
+
1517
+ # Edit release
1518
+ gh release edit v1.0.0 --notes "Updated notes"
1519
+
1520
+ # Verify release signature
1521
+ gh release verify v1.0.0
1522
+
1523
+ # Verify specific asset
1524
+ gh release verify-asset v1.0.0 file.tar.gz
1525
+ ```
1526
+
1527
+ ## Gists (gh gist)
1528
+
1529
+ ```bash
1530
+ # List gists
1531
+ gh gist list
1532
+
1533
+ # List all gists (including private)
1534
+ gh gist list --public
1535
+
1536
+ # Limit results
1537
+ gh gist list --limit 20
1538
+
1539
+ # View gist
1540
+ gh gist view abc123
1541
+
1542
+ # View gist files
1543
+ gh gist view abc123 --files
1544
+
1545
+ # Create gist
1546
+ gh gist create script.py
1547
+
1548
+ # Create gist with description
1549
+ gh gist create script.py --desc "My script"
1550
+
1551
+ # Create public gist
1552
+ gh gist create script.py --public
1553
+
1554
+ # Create multi-file gist
1555
+ gh gist create file1.py file2.py
1556
+
1557
+ # Create from stdin
1558
+ echo "print('hello')" | gh gist create
1559
+
1560
+ # Edit gist
1561
+ gh gist edit abc123
1562
+
1563
+ # Delete gist
1564
+ gh gist delete abc123
1565
+
1566
+ # Rename gist file
1567
+ gh gist rename abc123 --filename old.py new.py
1568
+
1569
+ # Clone gist
1570
+ gh gist clone abc123
1571
+
1572
+ # Clone to directory
1573
+ gh gist clone abc123 my-directory
1574
+ ```
1575
+
1576
+ ## Codespaces (gh codespace)
1577
+
1578
+ ```bash
1579
+ # List codespaces
1580
+ gh codespace list
1581
+
1582
+ # Create codespace
1583
+ gh codespace create
1584
+
1585
+ # Create with specific repository
1586
+ gh codespace create --repo owner/repo
1587
+
1588
+ # Create with branch
1589
+ gh codespace create --branch develop
1590
+
1591
+ # Create with specific machine
1592
+ gh codespace create --machine premiumLinux
1593
+
1594
+ # View codespace details
1595
+ gh codespace view
1596
+
1597
+ # SSH into codespace
1598
+ gh codespace ssh
1599
+
1600
+ # SSH with specific command
1601
+ gh codespace ssh --command "cd /workspaces && ls"
1602
+
1603
+ # Open codespace in browser
1604
+ gh codespace code
1605
+
1606
+ # Open in VS Code
1607
+ gh codespace code --codec
1608
+
1609
+ # Open with specific path
1610
+ gh codespace code --path /workspaces/repo
1611
+
1612
+ # Stop codespace
1613
+ gh codespace stop
1614
+
1615
+ # Delete codespace
1616
+ gh codespace delete
1617
+
1618
+ # View logs
1619
+ gh codespace logs
1620
+
1621
+ --tail 100
1622
+
1623
+ # View ports
1624
+ gh codespace ports
1625
+
1626
+ # Forward port
1627
+ gh codespace cp 8080:8080
1628
+
1629
+ # Rebuild codespace
1630
+ gh codespace rebuild
1631
+
1632
+ # Edit codespace
1633
+ gh codespace edit --machine standardLinux
1634
+
1635
+ # Jupyter support
1636
+ gh codespace jupyter
1637
+
1638
+ # Copy files to/from codespace
1639
+ gh codespace cp file.txt :/workspaces/file.txt
1640
+ gh codespace cp :/workspaces/file.txt ./file.txt
1641
+ ```
1642
+
1643
+ ## Organizations (gh org)
1644
+
1645
+ ```bash
1646
+ # List organizations
1647
+ gh org list
1648
+
1649
+ # List for user
1650
+ gh org list --user username
1651
+
1652
+ # JSON output
1653
+ gh org list --json login,name,description
1654
+
1655
+ # View organization
1656
+ gh org view orgname
1657
+
1658
+ # View organization members
1659
+ gh org view orgname --json members --jq '.members[] | .login'
1660
+ ```
1661
+
1662
+ ## Search (gh search)
1663
+
1664
+ ```bash
1665
+ # Search code
1666
+ gh search code "TODO"
1667
+
1668
+ # Search in specific repository
1669
+ gh search code "TODO" --repo owner/repo
1670
+
1671
+ # Search commits
1672
+ gh search commits "fix bug"
1673
+
1674
+ # Search issues
1675
+ gh search issues "label:bug state:open"
1676
+
1677
+ # Search PRs
1678
+ gh search prs "is:open is:pr review:required"
1679
+
1680
+ # Search repositories
1681
+ gh search repos "stars:>1000 language:python"
1682
+
1683
+ # Limit results
1684
+ gh search repos "topic:api" --limit 50
1685
+
1686
+ # JSON output
1687
+ gh search repos "stars:>100" --json name,description,stargazers
1688
+
1689
+ # Order results
1690
+ gh search repos "language:rust" --order desc --sort stars
1691
+
1692
+ # Search with extensions
1693
+ gh search code "import" --extension py
1694
+
1695
+ # Web search (open in browser)
1696
+ gh search prs "is:open" --web
1697
+ ```
1698
+
1699
+ ## Labels (gh label)
1700
+
1701
+ ```bash
1702
+ # List labels
1703
+ gh label list
1704
+
1705
+ # Create label
1706
+ gh label create bug --color "d73a4a" --description "Something isn't working"
1707
+
1708
+ # Create with hex color
1709
+ gh label create enhancement --color "#a2eeef"
1710
+
1711
+ # Edit label
1712
+ gh label edit bug --name "bug-report" --color "ff0000"
1713
+
1714
+ # Delete label
1715
+ gh label delete bug
1716
+
1717
+ # Clone labels from repository
1718
+ gh label clone owner/repo
1719
+
1720
+ # Clone to specific repository
1721
+ gh label clone owner/repo --repo target/repo
1722
+ ```
1723
+
1724
+ ## SSH Keys (gh ssh-key)
1725
+
1726
+ ```bash
1727
+ # List SSH keys
1728
+ gh ssh-key list
1729
+
1730
+ # Add SSH key
1731
+ gh ssh-key add ~/.ssh/id_rsa.pub --title "My laptop"
1732
+
1733
+ # Add key with type
1734
+ gh ssh-key add ~/.ssh/id_ed25519.pub --type "authentication"
1735
+
1736
+ # Delete SSH key
1737
+ gh ssh-key delete 12345
1738
+
1739
+ # Delete by title
1740
+ gh ssh-key delete --title "My laptop"
1741
+ ```
1742
+
1743
+ ## GPG Keys (gh gpg-key)
1744
+
1745
+ ```bash
1746
+ # List GPG keys
1747
+ gh gpg-key list
1748
+
1749
+ # Add GPG key
1750
+ gh gpg-key add ~/.ssh/id_rsa.pub
1751
+
1752
+ # Delete GPG key
1753
+ gh gpg-key delete 12345
1754
+
1755
+ # Delete by key ID
1756
+ gh gpg-key delete ABCD1234
1757
+ ```
1758
+
1759
+ ## Status (gh status)
1760
+
1761
+ ```bash
1762
+ # Show status overview
1763
+ gh status
1764
+
1765
+ # Status for specific repositories
1766
+ gh status --repo owner/repo
1767
+
1768
+ # JSON output
1769
+ gh status --json
1770
+ ```
1771
+
1772
+ ## Configuration (gh config)
1773
+
1774
+ ```bash
1775
+ # List all config
1776
+ gh config list
1777
+
1778
+ # Get specific value
1779
+ gh config get editor
1780
+
1781
+ # Set value
1782
+ gh config set editor vim
1783
+
1784
+ # Set git protocol
1785
+ gh config set git_protocol ssh
1786
+
1787
+ # Clear cache
1788
+ gh config clear-cache
1789
+
1790
+ # Set prompt behavior
1791
+ gh config set prompt disabled
1792
+ gh config set prompt enabled
1793
+ ```
1794
+
1795
+ ## Extensions (gh extension)
1796
+
1797
+ ```bash
1798
+ # List installed extensions
1799
+ gh extension list
1800
+
1801
+ # Search extensions
1802
+ gh extension search github
1803
+
1804
+ # Install extension
1805
+ gh extension install owner/extension-repo
1806
+
1807
+ # Install from branch
1808
+ gh extension install owner/extension-repo --branch develop
1809
+
1810
+ # Upgrade extension
1811
+ gh extension upgrade extension-name
1812
+
1813
+ # Remove extension
1814
+ gh extension remove extension-name
1815
+
1816
+ # Create new extension
1817
+ gh extension create my-extension
1818
+
1819
+ # Browse extensions
1820
+ gh extension browse
1821
+
1822
+ # Execute extension command
1823
+ gh extension exec my-extension --arg value
1824
+ ```
1825
+
1826
+ ## Aliases (gh alias)
1827
+
1828
+ ```bash
1829
+ # List aliases
1830
+ gh alias list
1831
+
1832
+ # Set alias
1833
+ gh alias set prview 'pr view --web'
1834
+
1835
+ # Set shell alias
1836
+ gh alias set co 'pr checkout' --shell
1837
+
1838
+ # Delete alias
1839
+ gh alias delete prview
1840
+
1841
+ # Import aliases
1842
+ gh alias import ./aliases.sh
1843
+ ```
1844
+
1845
+ ## API Requests (gh api)
1846
+
1847
+ ```bash
1848
+ # Make API request
1849
+ gh api /user
1850
+
1851
+ # Request with method
1852
+ gh api --method POST /repos/owner/repo/issues \
1853
+ --field title="Issue title" \
1854
+ --field body="Issue body"
1855
+
1856
+ # Request with headers
1857
+ gh api /user \
1858
+ --header "Accept: application/vnd.github.v3+json"
1859
+
1860
+ # Request with pagination
1861
+ gh api /user/repos --paginate
1862
+
1863
+ # Raw output (no formatting)
1864
+ gh api /user --raw
1865
+
1866
+ # Include headers in output
1867
+ gh api /user --include
1868
+
1869
+ # Silent mode (no progress output)
1870
+ gh api /user --silent
1871
+
1872
+ # Input from file
1873
+ gh api --input request.json
1874
+
1875
+ # jq query on response
1876
+ gh api /user --jq '.login'
1877
+
1878
+ # Field from response
1879
+ gh api /repos/owner/repo --jq '.stargazers_count'
1880
+
1881
+ # GitHub Enterprise
1882
+ gh api /user --hostname enterprise.internal
1883
+
1884
+ # GraphQL query
1885
+ gh api graphql \
1886
+ -f query='
1887
+ {
1888
+ viewer {
1889
+ login
1890
+ repositories(first: 5) {
1891
+ nodes {
1892
+ name
1893
+ }
1894
+ }
1895
+ }
1896
+ }'
1897
+ ```
1898
+
1899
+ ## Rulesets (gh ruleset)
1900
+
1901
+ ```bash
1902
+ # List rulesets
1903
+ gh ruleset list
1904
+
1905
+ # View ruleset
1906
+ gh ruleset view 123
1907
+
1908
+ # Check ruleset
1909
+ gh ruleset check --branch feature
1910
+
1911
+ # Check specific repository
1912
+ gh ruleset check --repo owner/repo --branch main
1913
+ ```
1914
+
1915
+ ## Attestations (gh attestation)
1916
+
1917
+ ```bash
1918
+ # Download attestation
1919
+ gh attestation download owner/repo \
1920
+ --artifact-id 123456
1921
+
1922
+ # Verify attestation
1923
+ gh attestation verify owner/repo
1924
+
1925
+ # Get trusted root
1926
+ gh attestation trusted-root
1927
+ ```
1928
+
1929
+ ## Completion (gh completion)
1930
+
1931
+ ```bash
1932
+ # Generate shell completion
1933
+ gh completion -s bash > ~/.gh-complete.bash
1934
+ gh completion -s zsh > ~/.gh-complete.zsh
1935
+ gh completion -s fish > ~/.gh-complete.fish
1936
+ gh completion -s powershell > ~/.gh-complete.ps1
1937
+
1938
+ # Shell-specific instructions
1939
+ gh completion --shell=bash
1940
+ gh completion --shell=zsh
1941
+ ```
1942
+
1943
+ ## Preview (gh preview)
1944
+
1945
+ ```bash
1946
+ # List preview features
1947
+ gh preview
1948
+
1949
+ # Run preview script
1950
+ gh preview prompter
1951
+ ```
1952
+
1953
+ ## Agent Tasks (gh agent-task)
1954
+
1955
+ ```bash
1956
+ # List agent tasks
1957
+ gh agent-task list
1958
+
1959
+ # View agent task
1960
+ gh agent-task view 123
1961
+
1962
+ # Create agent task
1963
+ gh agent-task create --description "My task"
1964
+ ```
1965
+
1966
+ ## Global Flags
1967
+
1968
+ | Flag | Description |
1969
+ | -------------------------- | -------------------------------------- |
1970
+ | `--help` / `-h` | Show help for command |
1971
+ | `--version` | Show gh version |
1972
+ | `--repo [HOST/]OWNER/REPO` | Select another repository |
1973
+ | `--hostname HOST` | GitHub hostname |
1974
+ | `--jq EXPRESSION` | Filter JSON output |
1975
+ | `--json FIELDS` | Output JSON with specified fields |
1976
+ | `--template STRING` | Format JSON using Go template |
1977
+ | `--web` | Open in browser |
1978
+ | `--paginate` | Make additional API calls |
1979
+ | `--verbose` | Show verbose output |
1980
+ | `--debug` | Show debug output |
1981
+ | `--timeout SECONDS` | Maximum API request duration |
1982
+ | `--cache CACHE` | Cache control (default, force, bypass) |
1983
+
1984
+ ## Output Formatting
1985
+
1986
+ ### JSON Output
1987
+
1988
+ ```bash
1989
+ # Basic JSON
1990
+ gh repo view --json name,description
1991
+
1992
+ # Nested fields
1993
+ gh repo view --json owner,name --jq '.owner.login + "/" + .name'
1994
+
1995
+ # Array operations
1996
+ gh pr list --json number,title --jq '.[] | select(.number > 100)'
1997
+
1998
+ # Complex queries
1999
+ gh issue list --json number,title,labels \
2000
+ --jq '.[] | {number, title: .title, tags: [.labels[].name]}'
2001
+ ```
2002
+
2003
+ ### Template Output
2004
+
2005
+ ```bash
2006
+ # Custom template
2007
+ gh repo view \
2008
+ --template '{{.name}}: {{.description}}'
2009
+
2010
+ # Multiline template
2011
+ gh pr view 123 \
2012
+ --template 'Title: {{.title}}
2013
+ Author: {{.author.login}}
2014
+ State: {{.state}}
2015
+ '
2016
+ ```
2017
+
2018
+ ## Common Workflows
2019
+
2020
+ ### Create PR from Issue
2021
+
2022
+ ```bash
2023
+ # Create branch from issue
2024
+ gh issue develop 123 --branch feature/issue-123
2025
+
2026
+ # Make changes, commit, push
2027
+ git add .
2028
+ git commit -m "Fix issue #123"
2029
+ git push
2030
+
2031
+ # Create PR linking to issue
2032
+ gh pr create --title "Fix #123" --body "Closes #123"
2033
+ ```
2034
+
2035
+ ### Bulk Operations
2036
+
2037
+ ```bash
2038
+ # Close multiple issues
2039
+ gh issue list --search "label:stale" \
2040
+ --json number \
2041
+ --jq '.[].number' | \
2042
+ xargs -I {} gh issue close {} --comment "Closing as stale"
2043
+
2044
+ # Add label to multiple PRs
2045
+ gh pr list --search "review:required" \
2046
+ --json number \
2047
+ --jq '.[].number' | \
2048
+ xargs -I {} gh pr edit {} --add-label needs-review
2049
+ ```
2050
+
2051
+ ### Repository Setup Workflow
2052
+
2053
+ ```bash
2054
+ # Create repository with initial setup
2055
+ gh repo create my-project --public \
2056
+ --description "My awesome project" \
2057
+ --clone \
2058
+ --gitignore python \
2059
+ --license mit
2060
+
2061
+ cd my-project
2062
+
2063
+ # Set up branches
2064
+ git checkout -b develop
2065
+ git push -u origin develop
2066
+
2067
+ # Create labels
2068
+ gh label create bug --color "d73a4a" --description "Bug report"
2069
+ gh label create enhancement --color "a2eeef" --description "Feature request"
2070
+ gh label create documentation --color "0075ca" --description "Documentation"
2071
+ ```
2072
+
2073
+ ### CI/CD Workflow
2074
+
2075
+ ```bash
2076
+ # Run workflow and wait
2077
+ RUN_ID=$(gh workflow run ci.yml --ref main --jq '.databaseId')
2078
+
2079
+ # Watch the run
2080
+ gh run watch "$RUN_ID"
2081
+
2082
+ # Download artifacts on completion
2083
+ gh run download "$RUN_ID" --dir ./artifacts
2084
+ ```
2085
+
2086
+ ### Fork Sync Workflow
2087
+
2088
+ ```bash
2089
+ # Fork repository
2090
+ gh repo fork original/repo --clone
2091
+
2092
+ cd repo
2093
+
2094
+ # Add upstream remote
2095
+ git remote add upstream https://github.com/original/repo.git
2096
+
2097
+ # Sync fork
2098
+ gh repo sync
2099
+
2100
+ # Or manual sync
2101
+ git fetch upstream
2102
+ git checkout main
2103
+ git merge upstream/main
2104
+ git push origin main
2105
+ ```
2106
+
2107
+ ## Environment Setup
2108
+
2109
+ ### Shell Integration
2110
+
2111
+ ```bash
2112
+ # Add to ~/.bashrc or ~/.zshrc
2113
+ eval "$(gh completion -s bash)" # or zsh/fish
2114
+
2115
+ # Create useful aliases
2116
+ alias gs='gh status'
2117
+ alias gpr='gh pr view --web'
2118
+ alias gir='gh issue view --web'
2119
+ alias gco='gh pr checkout'
2120
+ ```
2121
+
2122
+ ### Git Configuration
2123
+
2124
+ ```bash
2125
+ # Use gh as credential helper
2126
+ gh auth setup-git
2127
+
2128
+ # Set gh as default for repo operations
2129
+ git config --global credential.helper 'gh !gh auth setup-git'
2130
+
2131
+ # Or manually
2132
+ git config --global credential.helper github
2133
+ ```
2134
+
2135
+ ## Best Practices
2136
+
2137
+ 1. **Authentication**: Use environment variables for automation
2138
+
2139
+ ```bash
2140
+ export GH_TOKEN=$(gh auth token)
2141
+ ```
2142
+
2143
+ 2. **Default Repository**: Set default to avoid repetition
2144
+
2145
+ ```bash
2146
+ gh repo set-default owner/repo
2147
+ ```
2148
+
2149
+ 3. **JSON Parsing**: Use jq for complex data extraction
2150
+
2151
+ ```bash
2152
+ gh pr list --json number,title --jq '.[] | select(.title | contains("fix"))'
2153
+ ```
2154
+
2155
+ 4. **Pagination**: Use --paginate for large result sets
2156
+
2157
+ ```bash
2158
+ gh issue list --state all --paginate
2159
+ ```
2160
+
2161
+ 5. **Caching**: Use cache control for frequently accessed data
2162
+ ```bash
2163
+ gh api /user --cache force
2164
+ ```
2165
+
2166
+ ## Getting Help
2167
+
2168
+ ```bash
2169
+ # General help
2170
+ gh --help
2171
+
2172
+ # Command help
2173
+ gh pr --help
2174
+ gh issue create --help
2175
+
2176
+ # Help topics
2177
+ gh help formatting
2178
+ gh help environment
2179
+ gh help exit-codes
2180
+ gh help accessibility
2181
+ ```
2182
+
2183
+ ## References
2184
+
2185
+ - Official Manual: https://cli.github.com/manual/
2186
+ - GitHub Docs: https://docs.github.com/en/github-cli
2187
+ - REST API: https://docs.github.com/en/rest
2188
+ - GraphQL API: https://docs.github.com/en/graphql