5_github_cli_usage.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <github_cli_usage>
  2. <overview>
  3. The GitHub CLI (gh) provides comprehensive tools for interacting with GitHub.
  4. Here's when and how to use each command in the issue creation workflow.
  5. Note: Issue body formatting should follow the templates defined in
  6. 2_github_issue_templates.xml, with different formats for problem reporters
  7. vs contributors.
  8. </overview>
  9. <pre_creation_commands>
  10. <command name="gh issue list">
  11. <when_to_use>
  12. ALWAYS use this FIRST before creating any issue to check for duplicates.
  13. Search for keywords from the user's problem description.
  14. </when_to_use>
  15. <example>
  16. <execute_command>
  17. <command>gh issue list --repo RooCodeInc/Roo-Code --search "dark theme button visibility" --state all --limit 20</command>
  18. </execute_command>
  19. </example>
  20. <options>
  21. --search: Search query for issue titles and bodies
  22. --state: all, open, or closed
  23. --label: Filter by specific labels
  24. --limit: Number of results to show
  25. --json: Get structured JSON output
  26. </options>
  27. </command>
  28. <command name="gh search issues">
  29. <when_to_use>
  30. Use for more advanced searches across issues and pull requests.
  31. Supports GitHub's advanced search syntax.
  32. </when_to_use>
  33. <example>
  34. <execute_command>
  35. <command>gh search issues --repo RooCodeInc/Roo-Code "dark theme button" --limit 10</command>
  36. </execute_command>
  37. </example>
  38. </command>
  39. <command name="gh issue view">
  40. <when_to_use>
  41. Use when you find a potentially related issue and need full details.
  42. Check if the user's issue is already reported or related.
  43. </when_to_use>
  44. <example>
  45. <execute_command>
  46. <command>gh issue view 123 --repo RooCodeInc/Roo-Code --comments</command>
  47. </execute_command>
  48. </example>
  49. <options>
  50. --comments: Include issue comments
  51. --json: Get structured data
  52. --web: Open in browser
  53. </options>
  54. </command>
  55. </pre_creation_commands>
  56. <contributor_only_commands>
  57. <note>
  58. These commands should ONLY be used if the user has indicated they want to
  59. contribute the implementation. Skip these for problem reporters.
  60. </note>
  61. <command name="gh repo view">
  62. <when_to_use>
  63. Get repository information and recent activity.
  64. </when_to_use>
  65. <example>
  66. <execute_command>
  67. <command>gh repo view RooCodeInc/Roo-Code --json defaultBranchRef,description,updatedAt</command>
  68. </execute_command>
  69. </example>
  70. </command>
  71. <command name="gh search prs">
  72. <when_to_use>
  73. Check recent PRs that might be related to the issue.
  74. Look for PRs that modified relevant code.
  75. </when_to_use>
  76. <example>
  77. <execute_command>
  78. <command>gh search prs --repo RooCodeInc/Roo-Code "dark theme" --limit 10 --state all</command>
  79. </execute_command>
  80. </example>
  81. </command>
  82. <command name="git log">
  83. <when_to_use>
  84. For bug reports from contributors, check recent commits that might have introduced the issue.
  85. Use after cloning the repository locally.
  86. </when_to_use>
  87. <example>
  88. <execute_command>
  89. <command>git log --oneline --grep="theme" -n 20</command>
  90. </execute_command>
  91. </example>
  92. </command>
  93. </contributor_only_commands>
  94. <issue_creation_command>
  95. <command name="gh issue create">
  96. <when_to_use>
  97. Only use after:
  98. 1. Confirming no duplicates exist
  99. 2. Gathering all required information
  100. 3. Determining if user is contributing or just reporting
  101. 4. Getting user confirmation
  102. </when_to_use>
  103. <bug_report_example>
  104. <execute_command>
  105. <command>gh issue create --repo RooCodeInc/Roo-Code --title "[Descriptive title of the bug]" --body-file /tmp/issue_body.md --label "bug"</command>
  106. </execute_command>
  107. </bug_report_example>
  108. <feature_request_example>
  109. <execute_command>
  110. <command>gh issue create --repo RooCodeInc/Roo-Code --title "[Problem-focused title]" --body-file /tmp/issue_body.md --label "proposal" --label "enhancement"</command>
  111. </execute_command>
  112. </feature_request_example>
  113. <options>
  114. --title: Issue title (required)
  115. --body: Issue body text
  116. --body-file: Read body from file
  117. --label: Add labels (can use multiple times)
  118. --assignee: Assign to user
  119. --project: Add to project
  120. --web: Open in browser to create
  121. </options>
  122. </command>
  123. </issue_creation_command>
  124. <post_creation_commands>
  125. <command name="gh issue comment">
  126. <when_to_use>
  127. ONLY use if user wants to add additional information after creation.
  128. </when_to_use>
  129. <example>
  130. <execute_command>
  131. <command>gh issue comment 456 --repo RooCodeInc/Roo-Code --body "Additional context or comments."</command>
  132. </execute_command>
  133. </example>
  134. </command>
  135. <command name="gh issue edit">
  136. <when_to_use>
  137. Use if user realizes they need to update the issue after creation.
  138. Can update title, body, or labels.
  139. </when_to_use>
  140. <example>
  141. <execute_command>
  142. <command>gh issue edit 456 --repo RooCodeInc/Roo-Code --title "[Updated title]" --body "[Updated body]"</command>
  143. </execute_command>
  144. </example>
  145. </command>
  146. </post_creation_commands>
  147. <workflow_integration>
  148. <step_1_integration>
  149. After user selects issue type, immediately search for related issues:
  150. 1. Use `gh issue list --search` with keywords from their description
  151. 2. Show any similar issues found
  152. 3. Ask if they want to continue or comment on existing issue
  153. </step_1_integration>
  154. <step_3_integration>
  155. When searching GitHub Discussions:
  156. 1. Note that GitHub CLI doesn't currently have full discussions support
  157. 2. Use web search or instruct user to manually search discussions at:
  158. https://github.com/RooCodeInc/Roo-Code/discussions/categories/feature-requests
  159. 3. Ask user to provide any related discussion numbers they find
  160. 4. Include these in the "Related Discussions" section of the issue
  161. </step_3_integration>
  162. <step_4_integration>
  163. Decision point for contribution:
  164. 1. Ask user if they want to contribute implementation
  165. 2. If yes: Use contributor commands for codebase investigation
  166. 3. If no: Skip directly to creating a problem-focused issue
  167. 4. This saves time for problem reporters
  168. </step_4_integration>
  169. <step_5_integration>
  170. During codebase exploration (CONTRIBUTORS ONLY):
  171. 1. Clone repo locally if needed: `gh repo clone RooCodeInc/Roo-Code`
  172. 2. Use `git log` to find recent changes to affected files
  173. 3. Use `gh search prs` for related pull requests
  174. 4. Include findings in the technical context section
  175. </step_5_integration>
  176. <step_6_integration>
  177. When creating the issue:
  178. 1. Format differently based on contributor vs problem reporter
  179. 2. Problem reporters: Simple problem description + context
  180. 3. Contributors: Full template with technical sections
  181. 4. Save formatted body to temporary file
  182. 5. Use `gh issue create` with appropriate labels
  183. 6. Capture the returned issue URL
  184. 7. Show user the created issue URL
  185. </step_6_integration>
  186. </workflow_integration>
  187. <best_practices>
  188. <practice name="file_handling">
  189. When creating issues with long bodies:
  190. 1. Save to temporary file: `cat > /tmp/issue_body.md << 'EOF'`
  191. 2. Use --body-file flag with gh issue create
  192. 3. Clean up after: `rm /tmp/issue_body.md`
  193. </practice>
  194. <practice name="search_efficiency">
  195. Use specific search terms:
  196. - Include error messages in quotes
  197. - Use label filters when appropriate
  198. - Limit results to avoid overwhelming output
  199. </practice>
  200. <practice name="json_output">
  201. Use --json flag for structured data when needed:
  202. - Easier to parse programmatically
  203. - Consistent format across commands
  204. - Example: `gh issue list --json number,title,state`
  205. </practice>
  206. </best_practices>
  207. <error_handling>
  208. <duplicate_found>
  209. If search finds exact duplicate:
  210. - Show the existing issue to user using `gh issue view`
  211. - Ask if they want to add a comment instead
  212. - Use `gh issue comment` if they agree
  213. </duplicate_found>
  214. <creation_failed>
  215. If `gh issue create` fails:
  216. - Check error message (auth, permissions, network)
  217. - Ensure gh is authenticated: `gh auth status`
  218. - Save the drafted issue content for user
  219. - Suggest using --web flag to create in browser
  220. </creation_failed>
  221. <authentication>
  222. Ensure GitHub CLI is authenticated:
  223. - Check status: `gh auth status`
  224. - Login if needed: `gh auth login`
  225. - Select appropriate scopes for issue creation
  226. </authentication>
  227. </error_handling>
  228. <command_reference>
  229. <issues>
  230. gh issue create - Create new issue
  231. gh issue list - List and search issues
  232. gh issue view - View issue details
  233. gh issue comment - Add comment to issue
  234. gh issue edit - Edit existing issue
  235. gh issue close - Close an issue
  236. gh issue reopen - Reopen closed issue
  237. </issues>
  238. <search>
  239. gh search issues - Search issues and PRs
  240. gh search prs - Search pull requests
  241. gh search repos - Search repositories
  242. </search>
  243. <repository>
  244. gh repo view - View repository info
  245. gh repo clone - Clone repository
  246. </repository>
  247. </command_reference>
  248. </github_cli_usage>