issues
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInteract with GitHub issues - create, list, and view issues.
与GitHub Issues交互——创建、列出和查看议题。
Instructions
操作说明
This command helps you work with GitHub issues using the CLI.
gh本命令帮助你使用 CLI来处理GitHub Issues。
ghStep 1: Determine Action
步骤1:确定操作类型
Use AskUserQuestion to ask what the user wants to do:
Question:
- question: "What would you like to do with GitHub issues?"
- header: "Action"
- multiSelect: false
- options:
- label: "Create new issue" description: "Open a new issue with title, body, and optional labels"
- label: "List issues" description: "View open issues in the current repository"
- label: "View issue" description: "See details of a specific issue by number"
使用AskUserQuestion询问用户想要执行的操作:
问题:
- question: "你想要对GitHub Issues执行什么操作?"
- header: "操作类型"
- multiSelect: false
- options:
- label: "创建新议题" description: "创建包含标题、正文和可选标签的新议题"
- label: "列出议题" description: "查看当前仓库中的所有开放议题"
- label: "查看单个议题" description: "通过议题编号查看特定议题的详细信息"
If "Create new issue" selected:
若选择“创建新议题”:
Step 2a: Get Issue Title
步骤2a:获取议题标题
Use AskUserQuestion to get the issue title:
Question:
- question: "What's a short, scannable title for this issue? Keep it brief (5-10 words max) - details go in the body. (Use 'Other' to type your title)"
- header: "Title"
- multiSelect: false
- options:
- label: "I'll type a title" description: "Enter a concise title like 'Login button unresponsive' or 'Add dark mode support'"
Title guidelines:
- Keep titles SHORT and scannable (5-10 words max)
- Good: "Fix broken password reset flow"
- Bad: "When I try to reset my password and click the button nothing happens and I get an error"
- The description/body is where details belong, not the title
If the user provides a long title, help them shorten it and move the details to the body.
使用AskUserQuestion获取议题标题:
问题:
- question: "请为该议题提供一个简短、易读的标题。标题需简洁(最多5-10个词)——详细信息请放在正文中。(选择“其他”来输入自定义标题)"
- header: "标题"
- multiSelect: false
- options:
- label: "我将输入标题" description: "输入简洁的标题,例如“登录按钮无响应”或“添加深色模式支持”"
标题规范:
- 标题需简短且易读(最多5-10个词)
- 示例:
- 规范:“修复损坏的密码重置流程”
- 不规范:“当我尝试重置密码并点击按钮时,没有任何反应还出现了错误”
- 详细信息应放在描述/正文中,而非标题
如果用户提供的标题过长,帮助他们缩短标题,并将详细内容移至正文中。
Step 3a: Get Issue Body
步骤3a:获取议题正文
Use AskUserQuestion to gather the issue body content:
Question 1 - Issue type context:
- question: "What type of issue is this?"
- header: "Type"
- multiSelect: false
- options:
- label: "Bug" description: "Something broken that needs fixing"
- label: "Enhancement" description: "Improvement to existing functionality"
- label: "New feature" description: "Brand new functionality"
- label: "Task" description: "General work item or chore"
Question 2 - Description:
- question: "Now provide the full details. This is where you explain context, background, and specifics that didn't fit in the title. (Use 'Other' to type your description)"
- header: "Description"
- multiSelect: false
- options:
- label: "I'll describe it in detail" description: "Provide context, steps, examples, and any relevant information"
The user will select "Other" here to provide their full description.
Description guidelines:
- This is where ALL the detail goes - be thorough
- Include context: what were you doing, what's the background?
- Include specifics: error messages, URLs, versions, etc.
- The more detail here, the better - unlike the title which should be brief
Question 3 - For bugs, ask about reproduction:
If issue type is "Bug", use AskUserQuestion:
- question: "Can you provide steps to reproduce this bug? (Use 'Other' to type steps)"
- header: "Repro steps"
- multiSelect: false
- options:
- label: "Provide steps" description: "I'll describe how to reproduce the issue"
- label: "Not reproducible" description: "The bug is intermittent or hard to reproduce"
Question 4 - Expected vs actual behavior (for bugs):
If issue type is "Bug", use AskUserQuestion:
- question: "What did you expect to happen vs what actually happened? (Use 'Other' to describe)"
- header: "Behavior"
- multiSelect: false
- options:
- label: "Describe behavior" description: "I'll explain expected vs actual behavior"
使用AskUserQuestion收集议题正文内容:
问题1 - 议题类型上下文:
- question: "这是什么类型的议题?"
- header: "类型"
- multiSelect: false
- options:
- label: "Bug" description: "需要修复的问题"
- label: "功能优化" description: "对现有功能的改进"
- label: "新功能" description: "全新的功能需求"
- label: "任务" description: "常规工作项或杂务"
问题2 - 描述信息:
- question: "现在请提供完整的详细信息。在此处说明背景、上下文以及标题中无法容纳的具体内容。(选择“其他”来输入自定义描述)"
- header: "描述"
- multiSelect: false
- options:
- label: "我将详细描述" description: "提供上下文、步骤、示例以及任何相关信息"
用户将选择“其他”来提供完整描述。
描述规范:
- 所有详细信息都应放在此处——请尽可能详尽
- 包含上下文:你当时在做什么,背景是什么?
- 包含具体信息:错误信息、URL、版本号等
- 此处内容越详细越好——与标题的简洁要求相反
问题3 - 针对Bug,询问复现步骤:
如果议题类型为“Bug”,使用AskUserQuestion:
- question: "你能提供该Bug的复现步骤吗?(选择“其他”来输入步骤)"
- header: "复现步骤"
- multiSelect: false
- options:
- label: "提供复现步骤" description: "我将描述如何复现该问题"
- label: "无法复现" description: "该Bug是间歇性的或难以复现"
问题4 - 预期与实际行为(针对Bug):
如果议题类型为“Bug”,使用AskUserQuestion:
- question: "你预期会发生什么,实际又发生了什么?(选择“其他”来描述)"
- header: "行为对比"
- multiSelect: false
- options:
- label: "描述行为差异" description: "我将说明预期与实际行为的区别"
Step 4a: Get Labels (Optional)
步骤4a:获取标签(可选)
Use AskUserQuestion to select labels:
- question: "Which labels should we add? (if any)"
- header: "Labels"
- multiSelect: true
- options:
- label: "bug" description: "Something isn't working"
- label: "enhancement" description: "New feature or request"
- label: "documentation" description: "Improvements to docs"
- label: "good first issue" description: "Good for newcomers"
使用AskUserQuestion选择标签:
- question: "我们应该添加哪些标签?(可选)"
- header: "标签"
- multiSelect: true
- options:
- label: "bug" description: "功能异常"
- label: "enhancement" description: "新功能或需求"
- label: "documentation" description: "文档改进"
- label: "good first issue" description: "适合新手的任务"
Step 5a: Create the Issue
步骤5a:创建议题
Construct the issue body based on the type:
For Bug reports:
undefined根据议题类型构建正文:
针对Bug报告:
undefinedDescription
描述
[User's description]
[用户提供的描述]
Steps to Reproduce
复现步骤
[User's reproduction steps or "Not easily reproducible"]
[用户提供的复现步骤或“难以复现”]
Expected Behavior
预期行为
[What should happen]
[应该发生的情况]
Actual Behavior
实际行为
[What actually happens]
**For Feature requests/Enhancements:**[实际发生的情况]
**针对功能请求/优化:**Description
描述
[User's description]
[用户提供的描述]
Use Case
使用场景
[Why this would be useful]
**For Tasks/Other:**[该功能的实用价值]
**针对任务/其他类型:**Description
描述
[User's description]
Run the gh command to create the issue:
```bash
gh issue create --title "[title]" --body "[constructed body]" --label "[labels]"Report the issue URL back to the user.
[用户提供的描述]
运行gh命令创建议题:
```bash
gh issue create --title "[title]" --body "[constructed body]" --label "[labels]"将议题URL反馈给用户。
If "List issues" selected:
若选择“列出议题”:
Step 2b: Filter Options
步骤2b:筛选选项
Use AskUserQuestion to determine filtering:
- question: "How would you like to filter issues?"
- header: "Filter"
- multiSelect: false
- options:
- label: "All open issues" description: "Show all open issues"
- label: "Assigned to me" description: "Issues assigned to the current user"
- label: "Created by me" description: "Issues I created"
- label: "With specific label" description: "Filter by a label"
If "With specific label" selected, use AskUserQuestion:
- question: "Which label to filter by? (Use 'Other' for custom label)"
- header: "Label"
- multiSelect: false
- options:
- label: "bug" description: "Bug reports"
- label: "enhancement" description: "Feature requests"
- label: "documentation" description: "Documentation issues"
使用AskUserQuestion确定筛选条件:
- question: "你想要如何筛选议题?"
- header: "筛选条件"
- multiSelect: false
- options:
- label: "所有开放议题" description: "显示所有开放状态的议题"
- label: "分配给我的议题" description: "分配给当前用户的议题"
- label: "我创建的议题" description: "由当前用户创建的议题"
- label: "包含特定标签的议题" description: "按标签筛选议题"
如果选择“包含特定标签的议题”,使用AskUserQuestion:
- question: "要按哪个标签筛选?(选择“其他”来自定义标签)"
- header: "标签"
- multiSelect: false
- options:
- label: "bug" description: "Bug报告"
- label: "enhancement" description: "功能请求"
- label: "documentation" description: "文档相关议题"
Step 3b: List Issues
步骤3b:列出议题
Run the appropriate gh command:
- All open:
gh issue list - Assigned to me:
gh issue list --assignee @me - Created by me:
gh issue list --author @me - With label:
gh issue list --label "[label]"
Display the results in a clean format.
运行对应的gh命令:
- 所有开放议题:
gh issue list - 分配给我的议题:
gh issue list --assignee @me - 我创建的议题:
gh issue list --author @me - 按标签筛选:
gh issue list --label "[label]"
以清晰的格式展示结果。
If "View issue" selected:
若选择“查看单个议题”:
Step 2c: Get Issue Number
步骤2c:获取议题编号
Use AskUserQuestion:
- question: "Which issue number would you like to view? (Use 'Other' to enter the number)"
- header: "Issue #"
- multiSelect: false
- options:
- label: "Enter issue number" description: "I'll type the issue number"
使用AskUserQuestion:
- question: "你想要查看哪个编号的议题?(选择“其他”来输入编号)"
- header: "议题编号"
- multiSelect: false
- options:
- label: "输入议题编号" description: "我将输入议题编号"
Step 3c: View Issue
步骤3c:查看议题
Run:
gh issue view [number]Display the issue details including title, body, labels, assignees, and comments.
运行命令:
gh issue view [number]展示议题的详细信息,包括标题、正文、标签、经办人以及评论。
Error Handling
错误处理
If command fails:
gh- Check if user is authenticated:
gh auth status - If not authenticated, inform user to run
gh auth login - Check if in a git repository with a GitHub remote
- Report specific error message to user
如果命令执行失败:
gh- 检查用户是否已认证:
gh auth status - 若未认证,告知用户运行
gh auth login - 检查当前目录是否为带有GitHub远程仓库的git仓库
- 向用户反馈具体的错误信息
Important Notes
重要注意事项
- Titles should be succinct (5-10 words) - if a user provides a long title, help shorten it and move details to body
- Bodies should be detailed - encourage users to provide thorough context, steps, and specifics
- Always confirm the issue was created successfully by showing the URL
- For issue bodies, preserve user's formatting and newlines
- If the user provides minimal information, that's okay - create the issue with what they gave
- Use HEREDOC for the body to preserve formatting:
bash
gh issue create --title "Title" --body "$(cat <<'EOF' Body content here EOF )"
- 标题需简洁(5-10个词)——如果用户提供过长的标题,帮助他们缩短并将详细内容移至正文
- 正文需详尽——鼓励用户提供完整的上下文、步骤和具体信息
- 始终通过展示URL来确认议题已成功创建
- 对于议题正文,保留用户的格式和换行符
- 如果用户提供的信息较少,也可以接受——使用现有信息创建议题
- 使用HEREDOC来保留正文格式:
bash
gh issue create --title "Title" --body "$(cat <<'EOF' Body content here EOF )"