jira
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJira CLI
Jira CLI
Command-line tool for managing Jira issues via .
af jira一款通过命令管理Jira问题的命令行工具。
af jiraSetup
配置
Add the following environment variables to your project's file:
.env- — Your Jira instance URL (e.g.,
JIRA_BASE_URL)https://company.atlassian.net - — Your Atlassian account email
JIRA_EMAIL - — API token from https://id.atlassian.com/manage-profile/security/api-tokens
JIRA_API_TOKEN
将以下环境变量添加到项目的文件中:
.env- — 你的Jira实例URL(例如:
JIRA_BASE_URL)https://company.atlassian.net - — 你的Atlassian账户邮箱
JIRA_EMAIL - — 从https://id.atlassian.com/manage-profile/security/api-tokens获取的API令牌
JIRA_API_TOKEN
Quick Reference
快速参考
Run for all options.
af jira --help运行查看所有可用选项。
af jira --helpRead Operations
读取操作
- — Get issue details
af jira get <issue-key> - — List project issues
af jira list <project> [--limit N] - — Search with JQL
af jira search "<jql>" - — List projects
af jira projects - — List issue types
af jira types <project> - — List available transitions
af jira transitions <issue-key> - — List comments
af jira comment <issue-key>
- — 获取问题详情
af jira get <issue-key> - — 列出项目中的问题
af jira list <project> [--limit N] - — 使用JQL进行搜索
af jira search "<jql>" - — 列出所有项目
af jira projects - — 列出项目的问题类型
af jira types <project> - — 列出可用的状态流转
af jira transitions <issue-key> - — 列出问题评论
af jira comment <issue-key>
Write Operations
写入操作
af jira create --project <key> --type <type> --summary "<text>" [--description "<text>"] [--priority <name>] [--labels a,b,c] [--parent <key>]af jira update <issue-key> [--summary "<text>"] [--description "<text>"] [--priority <name>] [--labels a,b,c]af jira transition <issue-key> --to "<status>"- (use
af jira assign <issue-key> --to <email>to unassign)--to none af jira comment <issue-key> --add "<text>"- — Attach a file (images, PDFs, etc.)
af jira attach <issue-key> <file> af jira delete <issue-key>
af jira create --project <key> --type <type> --summary "<text>" [--description "<text>"] [--priority <name>] [--labels a,b,c] [--parent <key>]af jira update <issue-key> [--summary "<text>"] [--description "<text>"] [--priority <name>] [--labels a,b,c]af jira transition <issue-key> --to "<status>"- (使用
af jira assign <issue-key> --to <email>取消分配)--to none af jira comment <issue-key> --add "<text>"- — 上传附件(图片、PDF等)
af jira attach <issue-key> <file> af jira delete <issue-key>
Output Formats
输出格式
- Default: Markdown
- JSON: Add flag
--json
- 默认:Markdown
- JSON格式:添加参数
--json
Common Workflows
常见工作流
View my assigned issues
查看我负责的问题
bash
af jira search "assignee = currentUser() AND status != Done ORDER BY priority DESC"bash
af jira search "assignee = currentUser() AND status != Done ORDER BY priority DESC"Start working on an issue
开始处理某个问题
bash
af jira get PROJ-123
af jira transition PROJ-123 --to "In Progress"
af jira comment PROJ-123 --add "Starting work"bash
af jira get PROJ-123
af jira transition PROJ-123 --to "In Progress"
af jira comment PROJ-123 --add "Starting work"Complete an issue
完成某个问题
bash
af jira comment PROJ-123 --add "Done"
af jira transition PROJ-123 --to "Done"bash
af jira comment PROJ-123 --add "Done"
af jira transition PROJ-123 --to "Done"Create a bug with details
创建包含详细信息的Bug
bash
af jira create --project PROJ --type Bug --summary "Login fails on Safari" \
--description "Users cannot log in using Safari 17. Error: 'Invalid session'" \
--priority High --labels safari,auth,urgentbash
af jira create --project PROJ --type Bug --summary "Login fails on Safari" \
--description "Users cannot log in using Safari 17. Error: 'Invalid session'" \
--priority High --labels safari,auth,urgentCreate a subtask
创建子任务
bash
af jira create --project PROJ --type Sub-task --summary "Write unit tests" \
--parent PROJ-123bash
af jira create --project PROJ --type Sub-task --summary "Write unit tests" \
--parent PROJ-123Attach files to an issue
为问题添加附件
bash
undefinedbash
undefinedAttach a screenshot
上传截图
af jira attach PROJ-123 ./screenshot.png
af jira attach PROJ-123 ./screenshot.png
Attach multiple files
上传多个文件
for f in ./audit/*.png; do
af jira attach PROJ-123 "$f"
done
undefinedfor f in ./audit/*.png; do
af jira attach PROJ-123 "$f"
done
undefinedSearch examples
搜索示例
bash
undefinedbash
undefinedMy open issues
我的未完成问题
af jira search "assignee = currentUser() AND status != Done"
af jira search "assignee = currentUser() AND status != Done"
Recent bugs in project
项目中近期的Bug
af jira search "project = PROJ AND type = Bug ORDER BY created DESC" --limit 10
af jira search "project = PROJ AND type = Bug ORDER BY created DESC" --limit 10
Unassigned issues
未分配的问题
af jira search "project = PROJ AND assignee IS EMPTY"
af jira search "project = PROJ AND assignee IS EMPTY"
Issues updated this week
本周更新的问题
af jira search "project = PROJ AND updated >= -7d"
af jira search "project = PROJ AND updated >= -7d"
High priority blockers
高优先级阻塞问题
af jira search "priority = Highest AND status != Done"
undefinedaf jira search "priority = Highest AND status != Done"
undefinedTips
提示
- Discover valid values first: Run before transitioning,
af jira transitions <key>before creatingaf jira types <project> - Use for scripting: Pipe output to
--jsonfor automationjq - Quote JQL queries: Always wrap JQL in double quotes to handle spaces
- 先确认有效值:在执行状态流转前先运行,在创建问题前先运行
af jira transitions <key>af jira types <project> - 使用进行脚本开发:可将输出通过管道传递给
--json实现自动化jq - JQL查询需加引号:始终用双引号包裹JQL查询语句以处理空格
Error Handling
错误处理
- Errors print to stderr
- With :
--json{"error": "message"} - Exit codes: success,
0error1
- 错误信息会输出到stderr
- 使用参数时:
--json{"error": "message"} - 退出码:表示成功,
0表示错误1