jira-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesejira-cli
jira-cli
Jira Data Center CLI for humans and AI Agents. Supports Jira DC only (self-hosted), not Jira Cloud.
面向人类和AI Agent的Jira Data Center CLI。仅支持Jira DC(自托管),不支持Jira Cloud。
Prerequisites
前提条件
Before using any command, authenticate with a Jira DC instance. Follow these steps in order:
- Ask the user for their Jira DC URL (e.g. ). It must start with
https://jira.company.com.https:// - Ask the user for a Personal Access Token (PAT). If they don't have one, guide them: "Log in to your Jira DC → click your profile avatar → Personal Access Tokens → Create token."
- Run to save credentials.
jira-cli login --host <URL> --token <PAT> - Run to verify connectivity. If
jira-cli doctor --jsonisauthValid, you're ready.true
Important: Credentials are saved locally at . Environment variables and override the config file — use them for CI or when the user prefers not to save credentials.
~/.jira-cli/config.jsonJIRA_HOSTJIRA_TOKENAlways use flag when parsing output. Without it, output is human-formatted and not suitable for programmatic use.
--json使用任何命令之前,请先通过Jira DC实例进行身份验证。按以下顺序操作:
- 向用户索要他们的Jira DC URL(例如 )。URL必须以
https://jira.company.com开头。https:// - 向用户索要个人访问令牌(PAT)。如果用户没有,请引导他们: "登录你的Jira DC → 点击个人资料头像 → 个人访问令牌 → 创建令牌。"
- 运行 保存凭证。
jira-cli login --host <URL> --token <PAT> - 运行 验证连接性。如果
jira-cli doctor --json为authValid,则准备就绪。true
重要提示: 凭证会本地保存至。环境变量和会覆盖配置文件——在CI环境中使用,或者当用户不想保存凭证时使用。
~/.jira-cli/config.jsonJIRA_HOSTJIRA_TOKEN解析输出时请始终使用标志。 不使用该标志时,输出为人类可读格式,不适合编程使用。
--jsonSafety
安全注意事项
- Do NOT use on destructive commands unless the user explicitly asks. Commands like
--forceprompt for confirmation by default. Skipping confirmation withissue deleteis irreversible.--force - Use before write operations to preview what will happen without executing. Example:
--dry-run.issue create --project PROJ --summary "test" --type Task --dry-run --json - AI Agents can make mistakes. Always confirm with the user before executing ,
issue delete,issue bulk-transition, or any operation that modifies multiple issues.sprint close - All write operations are recorded in for traceability.
~/.jira-cli/audit/
- 除非用户明确要求,否则不要在破坏性命令中使用。 诸如
--force之类的命令默认会提示确认。使用issue delete跳过确认操作是不可逆的。--force - 在执行写入操作前使用预览操作内容而不实际执行。示例:
--dry-run。issue create --project PROJ --summary "test" --type Task --dry-run --json - AI Agent可能会出错。 在执行、
issue delete、issue bulk-transition或任何修改多个Issue的操作之前,请始终与用户确认。sprint close - 所有写入操作都会记录在目录中,以便追溯。
~/.jira-cli/audit/
Issue Management
Issue管理
bash
undefinedbash
undefinedView issues (flat JSON by default — token-efficient)
查看Issue(默认输出扁平JSON格式——令牌使用更高效)
jira-cli issue get PROJ-123 --json
jira-cli issue get PROJ-123 --json --fields key,summary,status,assignee # Only specific fields
jira-cli issue get PROJ-123 --json --raw # Full Jira API response
jira-cli issue list --project PROJ --json
jira-cli issue list --project PROJ --status "In Progress" --assignee me --json
jira-cli issue list --project PROJ --type Bug --priority High --limit 20 --json
jira-cli issue get PROJ-123 --json
jira-cli issue get PROJ-123 --json --fields key,summary,status,assignee # 仅返回指定字段
jira-cli issue get PROJ-123 --json --raw # 返回完整的Jira API响应
jira-cli issue list --project PROJ --json
jira-cli issue list --project PROJ --status "In Progress" --assignee me --json
jira-cli issue list --project PROJ --type Bug --priority High --limit 20 --json
Create and edit
创建与编辑
jira-cli issue create --project PROJ --summary "Fix login bug" --type Bug --json
jira-cli issue create --project PROJ --summary "New feature" --type Story --assignee me --priority High --json
jira-cli issue create --project PROJ --summary "Sized story" --type Story --field "Story Points=5" --json
jira-cli issue edit PROJ-123 --summary "Updated summary" --priority Medium
jira-cli issue edit PROJ-123 --field "Story Points=8" --field "Team=Backend"
jira-cli issue delete PROJ-123 --force # Skip confirmation prompt
jira-cli issue create --project PROJ --summary "Fix login bug" --type Bug --json
jira-cli issue create --project PROJ --summary "New feature" --type Story --assignee me --priority High --json
jira-cli issue create --project PROJ --summary "Sized story" --type Story --field "Story Points=5" --json
jira-cli issue edit PROJ-123 --summary "Updated summary" --priority Medium
jira-cli issue edit PROJ-123 --field "Story Points=8" --field "Team=Backend"
jira-cli issue delete PROJ-123 --force # 跳过确认提示
Clone an issue
克隆Issue
jira-cli issue clone PROJ-123 --json # Clone with default summary
jira-cli issue clone PROJ-123 --summary "New title" --json # Clone with custom summary
jira-cli issue clone PROJ-123 --with-links --json # Clone with issue links
jira-cli issue clone PROJ-123 --json # 使用默认摘要克隆
jira-cli issue clone PROJ-123 --summary "New title" --json # 使用自定义摘要克隆
jira-cli issue clone PROJ-123 --with-links --json # 克隆时包含Issue链接
Status transitions
状态流转
jira-cli issue transitions PROJ-123 --json # List available transitions
jira-cli issue transition PROJ-123 "In Progress" # Transition to status (name required)
jira-cli issue transition PROJ-123 "Done" --json
jira-cli issue transitions PROJ-123 --json # 列出可用的流转状态
jira-cli issue transition PROJ-123 "In Progress" # 流转到指定状态(需提供状态名称)
jira-cli issue transition PROJ-123 "Done" --json
Bulk transition
批量流转
jira-cli issue bulk-transition "Done" --issues PROJ-1,PROJ-2,PROJ-3 --json
jira-cli issue bulk-transition "In Progress" --jql "project = PROJ AND sprint = 10 AND status = 'To Do'" --json
jira-cli issue bulk-transition "Done" --issues PROJ-1,PROJ-2,PROJ-3 --json
jira-cli issue bulk-transition "In Progress" --jql "project = PROJ AND sprint = 10 AND status = 'To Do'" --json
Assignment and watching
分配与关注
jira-cli issue assign PROJ-123 me # Assign to current user
jira-cli issue assign PROJ-123 johndoe # Assign by username (DC uses name, not accountId)
jira-cli issue unassign PROJ-123
jira-cli issue watch PROJ-123
jira-cli issue unwatch PROJ-123
jira-cli issue watchers PROJ-123 --json
jira-cli issue vote PROJ-123
jira-cli issue unvote PROJ-123
jira-cli issue assign PROJ-123 me # 分配给当前用户
jira-cli issue assign PROJ-123 johndoe # 通过用户名分配(DC使用名称而非accountId)
jira-cli issue unassign PROJ-123
jira-cli issue watch PROJ-123
jira-cli issue unwatch PROJ-123
jira-cli issue watchers PROJ-123 --json
jira-cli issue vote PROJ-123
jira-cli issue unvote PROJ-123
Comments
评论
jira-cli issue comment add PROJ-123 --body "Fixed in PR #42" --json
jira-cli issue comment list PROJ-123 --json
jira-cli issue comment delete PROJ-123 --id <commentId>
jira-cli issue comment add PROJ-123 --body "Fixed in PR #42" --json
jira-cli issue comment list PROJ-123 --json
jira-cli issue comment delete PROJ-123 --id <commentId>
Worklogs
工作日志
jira-cli issue worklog add PROJ-123 --time 2h --comment "Debugging session" --json
jira-cli issue worklog add PROJ-123 --time 1h30m --started "2024-01-15T10:00:00.000+0000"
jira-cli issue worklog list PROJ-123 --json
jira-cli issue worklog add PROJ-123 --time 2h --comment "Debugging session" --json
jira-cli issue worklog add PROJ-123 --time 1h30m --started "2024-01-15T10:00:00.000+0000"
jira-cli issue worklog list PROJ-123 --json
Links
链接
jira-cli issue link-types --json # List available link types
jira-cli issue link PROJ-123 --to PROJ-456 --type "blocks"
jira-cli issue unlink <linkId>
jira-cli issue remote-link PROJ-123 --url https://pr.url --title "PR #42"
jira-cli issue remote-links PROJ-123 --json
jira-cli issue link-types --json # 列出可用的链接类型
jira-cli issue link PROJ-123 --to PROJ-456 --type "blocks"
jira-cli issue unlink <linkId>
jira-cli issue remote-link PROJ-123 --url https://pr.url --title "PR #42"
jira-cli issue remote-links PROJ-123 --json
Attachments
附件
jira-cli issue attach PROJ-123 --file ./screenshot.png
jira-cli issue attachments PROJ-123 --json
undefinedjira-cli issue attach PROJ-123 --file ./screenshot.png
jira-cli issue attachments PROJ-123 --json
undefinedSearch (JQL)
搜索(JQL)
bash
undefinedbash
undefinedBasic search
基础搜索
jira-cli search "assignee = currentUser() AND status != Done" --json
jira-cli search "project = PROJ AND sprint in openSprints()" --json
jira-cli search "assignee = currentUser() AND status != Done" --json
jira-cli search "project = PROJ AND sprint in openSprints()" --json
Advanced options
高级选项
jira-cli search "project = PROJ" --limit 100 --json
jira-cli search "project = PROJ" --all --json # Fetch ALL results (auto-paginate)
jira-cli search "project = PROJ" --count # Only show total count
jira-cli search "project = PROJ" --order-by updated --json
jira-cli search "type = Bug AND priority = High" --fields key,summary,status --json
undefinedjira-cli search "project = PROJ" --limit 100 --json
jira-cli search "project = PROJ" --all --json # 获取所有结果(自动分页)
jira-cli search "project = PROJ" --count # 仅显示总数
jira-cli search "project = PROJ" --order-by updated --json
jira-cli search "type = Bug AND priority = High" --fields key,summary,status --json
undefinedSprint Management
Sprint管理
bash
jira-cli board list --json # Find board IDs first
jira-cli sprint list --board 42 --json
jira-cli sprint list --board 42 --state active --json
jira-cli sprint active --board 42 --json # Active sprint + issues
jira-cli sprint issues --sprint 10 --json
jira-cli sprint create --board 42 --name "Sprint 5" --start-date 2024-02-01 --end-date 2024-02-14 --json
jira-cli sprint update --sprint 10 --goal "Complete payment refactor"
jira-cli sprint move --sprint 10 --issues PROJ-123,PROJ-124,PROJ-125
jira-cli sprint close --sprint 10 --force # --force skips confirmationbash
jira-cli board list --json # 先查找看板ID
jira-cli sprint list --board 42 --json
jira-cli sprint list --board 42 --state active --json
jira-cli sprint active --board 42 --json # 获取活跃Sprint及其中的Issue
jira-cli sprint issues --sprint 10 --json
jira-cli sprint create --board 42 --name "Sprint 5" --start-date 2024-02-01 --end-date 2024-02-14 --json
jira-cli sprint update --sprint 10 --goal "Complete payment refactor"
jira-cli sprint move --sprint 10 --issues PROJ-123,PROJ-124,PROJ-125
jira-cli sprint close --sprint 10 --force # --force跳过确认Board & Backlog
看板与待办事项
bash
jira-cli board list --json
jira-cli board list --project PROJ --type scrum --json
jira-cli board get --board 42 --json
jira-cli board backlog --board 42 --json
jira-cli board epics --board 42 --json
jira-cli board sprints --board 42 --state active --jsonbash
jira-cli board list --json
jira-cli board list --project PROJ --type scrum --json
jira-cli board get --board 42 --json
jira-cli board backlog --board 42 --json
jira-cli board epics --board 42 --json
jira-cli board sprints --board 42 --state active --jsonEpic Management
Epic管理
bash
jira-cli epic list --board 42 --json
jira-cli epic list --board 42 --done --json # Completed epics only
jira-cli epic issues PROJ-1 --board 42 --jsonbash
jira-cli epic list --board 42 --json
jira-cli epic list --board 42 --done --json # 仅显示已完成的Epic
jira-cli epic issues PROJ-1 --board 42 --jsonProject Management
项目管理
bash
jira-cli project list --json
jira-cli project list --type software --json
jira-cli project get PROJ --json
jira-cli project components PROJ --json
jira-cli project versions PROJ --json
jira-cli project versions PROJ --unreleased --json
jira-cli project issue-types PROJ --json
jira-cli project fields --json # List all fields (system + custom)
jira-cli project fields --custom --json # List custom fields onlybash
jira-cli project list --json
jira-cli project list --type software --json
jira-cli project get PROJ --json
jira-cli project components PROJ --json
jira-cli project versions PROJ --json
jira-cli project versions PROJ --unreleased --json
jira-cli project issue-types PROJ --json
jira-cli project fields --json # 列出所有字段(系统字段+自定义字段)
jira-cli project fields --custom --json # 仅列出自定义字段User Search
用户搜索
bash
jira-cli user me --json # Current user info
jira-cli user search --query "john" --json
jira-cli user search --query "john" --assignable --project PROJ --jsonbash
jira-cli user me --json # 当前用户信息
jira-cli user search --query "john" --json
jira-cli user search --query "john" --assignable --project PROJ --jsonFilters
过滤器
bash
jira-cli filter list --json
jira-cli filter get <filterId> --json
jira-cli filter create --name "My Bugs" --jql "assignee = me AND type = Bug" --json
jira-cli filter run <filterId> --json
jira-cli filter delete <filterId>bash
jira-cli filter list --json
jira-cli filter get <filterId> --json
jira-cli filter create --name "My Bugs" --jql "assignee = me AND type = Bug" --json
jira-cli filter run <filterId> --json
jira-cli filter delete <filterId>Workflow Examples
工作流示例
Find and update an issue
查找并更新Issue
bash
undefinedbash
undefined1. Search for issues
1. 搜索Issue
jira-cli search "project = PROJ AND assignee = me AND status = 'In Progress'" --json
jira-cli search "project = PROJ AND assignee = me AND status = 'In Progress'" --json
2. Get issue details
2. 获取Issue详情
jira-cli issue get PROJ-123 --json
jira-cli issue get PROJ-123 --json
3. Check available transitions
3. 查看可用的流转状态
jira-cli issue transitions PROJ-123 --json
jira-cli issue transitions PROJ-123 --json
4. Transition to Done
4. 流转到Done状态
jira-cli issue transition PROJ-123 "Done"
jira-cli issue transition PROJ-123 "Done"
5. Add a comment
5. 添加评论
jira-cli issue comment add PROJ-123 --body "Completed and deployed to staging"
undefinedjira-cli issue comment add PROJ-123 --body "Completed and deployed to staging"
undefinedSprint planning workflow
Sprint规划工作流
bash
undefinedbash
undefined1. Find the board
1. 查找看板
jira-cli board list --json
jira-cli board list --json
2. Check active sprint
2. 查看活跃Sprint
jira-cli sprint active --board 42 --json
jira-cli sprint active --board 42 --json
3. View backlog
3. 查看待办事项
jira-cli board backlog --board 42 --json
jira-cli board backlog --board 42 --json
4. Create next sprint
4. 创建下一个Sprint
jira-cli sprint create --board 42 --name "Sprint 6" --start-date 2024-02-15 --end-date 2024-02-28 --json
jira-cli sprint create --board 42 --name "Sprint 6" --start-date 2024-02-15 --end-date 2024-02-28 --json
5. Move issues to sprint
5. 将Issue移入Sprint
jira-cli sprint move --sprint 11 --issues PROJ-200,PROJ-201,PROJ-202
undefinedjira-cli sprint move --sprint 11 --issues PROJ-200,PROJ-201,PROJ-202
undefinedGuardrails
防护措施
- Always run to verify auth before bulk operations
jira-cli doctor --json - requires typing the issue key to confirm. Use
issue deleteto skip confirmation in automated workflows--force - is irreversible. Use
sprint closeto skip confirmation--force - Use flag when parsing output in scripts or AI workflows
--json - Use to preview what a write command would do without executing it
--dry-run - Use with
--quietto suppress all non-JSON output (clean pipe-friendly output)--json - requires the status name as the second argument (no interactive selection)
issue transition - When searching for usernames to use with , use
issue assignfirstuser search --query <name> --json - DC uses username (not accountId) for user references. Use to find your username
jira-cli user me --json
- 执行批量操作前,务必运行验证身份验证
jira-cli doctor --json - 需要输入Issue键进行确认。在自动化工作流中使用
issue delete跳过确认--force - 操作不可逆。使用
sprint close跳过确认--force - 在脚本或AI工作流中解析输出时,请使用标志
--json - 使用预览写入命令的执行内容而不实际执行
--dry-run - 结合使用和
--quiet抑制所有非JSON输出(适合管道传输的整洁输出)--json - 需要将状态名称作为第二个参数(无交互式选择)
issue transition - 使用查找用户名时,请先运行
issue assignuser search --query <name> --json - DC使用用户名(而非accountId)引用用户。运行查找你的用户名
jira-cli user me --json
Global Flags
全局标志
- — Output as JSON (machine-readable, flat format by default)
--json - — Skip interactive confirmation prompts (for CI/Agent automation)
--force - — Suppress non-JSON stdout output (ideal for scripts and AI Agents)
--quiet - — Show what would be done without executing (write commands only)
--dry-run
- — 以JSON格式输出(机器可读,默认扁平格式)
--json - — 跳过交互式确认提示(适用于CI/Agent自动化)
--force - — 抑制非JSON标准输出(适用于脚本和AI Agent)
--quiet - — 显示操作内容但不执行(仅适用于写入命令)
--dry-run
Output Control Flags
输出控制标志
These flags are available on read commands (, , , , ):
issue getissue listsearchsprint listsprint issues- — Return the full raw Jira API response instead of the token-efficient flat format
--raw - — Output only the specified fields (flat JSON mode only)
--fields key,summary,status
这些标志适用于读取命令(、、、、):
issue getissue listsearchsprint listsprint issues- — 返回完整的原始Jira API响应,而非令牌高效的扁平格式
--raw - — 仅输出指定字段(仅扁平JSON模式可用)
--fields key,summary,status
JSON Output Schemas
JSON输出格式
Flat Issue (default with --json)
扁平Issue格式(使用--json时默认)
json
{
"key": "PROJ-123",
"summary": "Fix login bug",
"status": "In Progress",
"type": "Bug",
"assignee": "johndoe",
"reporter": "janedoe",
"priority": "High",
"created": "2024-01-15T10:30:00.000+0000",
"updated": "2024-01-16T14:20:00.000+0000",
"labels": "backend,urgent",
"component": "auth",
"parent": "PROJ-100"
}json
{
"key": "PROJ-123",
"summary": "Fix login bug",
"status": "In Progress",
"type": "Bug",
"assignee": "johndoe",
"reporter": "janedoe",
"priority": "High",
"created": "2024-01-15T10:30:00.000+0000",
"updated": "2024-01-16T14:20:00.000+0000",
"labels": "backend,urgent",
"component": "auth",
"parent": "PROJ-100"
}Flat Sprint
扁平Sprint格式
json
{
"id": 42,
"name": "Sprint 5",
"state": "active",
"startDate": "2024-02-01",
"endDate": "2024-02-14",
"goal": "Complete payment module"
}json
{
"id": 42,
"name": "Sprint 5",
"state": "active",
"startDate": "2024-02-01",
"endDate": "2024-02-14",
"goal": "Complete payment module"
}Error Response (with --json)
错误响应(使用--json时)
json
{
"error": "Jira API error 404: Issue does not exist",
"statusCode": 404,
"errorCode": "NOT_FOUND",
"hint": "Verify the issue key exists and you have permission to view it"
}json
{
"error": "Jira API error 404: Issue does not exist",
"statusCode": 404,
"errorCode": "NOT_FOUND",
"hint": "Verify the issue key exists and you have permission to view it"
}Error Codes
错误代码
| Code | Status | Hint |
|---|---|---|
| 401 | Run |
| 403 | Check your PAT scope and project permissions |
| 404 | Verify the resource key/ID exists |
| 429 | Wait and retry; reduce request frequency |
| 5xx | Jira server error; retry later |
| — | Check host URL and network connectivity |
| — | Run |
| 代码 | 状态 | 提示 |
|---|---|---|
| 401 | 运行 |
| 403 | 检查你的PAT权限范围和项目权限 |
| 404 | 验证资源键/ID是否存在 |
| 429 | 等待后重试;降低请求频率 |
| 5xx | Jira服务器错误;稍后重试 |
| — | 检查主机URL和网络连接 |
| — | 运行 |
Exit Codes
退出代码
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Bad arguments |
| 3 | Authentication error |
| 4 | Resource not found |
| 5 | Forbidden |
| 6 | Rate limited |
| 7 | Network/server error |
| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 2 | 参数错误 |
| 3 | 身份验证错误 |
| 4 | 资源未找到 |
| 5 | 权限不足 |
| 6 | 请求受限 |
| 7 | 网络/服务器错误 |
Audit Logging
审计日志
All write commands are automatically logged to in JSONL format (one file per month). Each entry records the command, arguments, exit code, and duration.
~/.jira-cli/audit/| Env var | Default | Description |
|---|---|---|
| (unset) | Set |
| | Auto-delete files older than N months ( |
所有写入命令都会自动记录到目录中,采用JSONL格式(每月一个文件)。每条记录包含命令、参数、退出代码和执行时长。
~/.jira-cli/audit/| 环境变量 | 默认值 | 描述 |
|---|---|---|
| (未设置) | 设置为 |
| | 自动删除超过N个月的文件( |
Self-Description
自我描述
bash
jira-cli reference # Print all commands, subcommands, and flags in structured markdownbash
jira-cli reference # 以结构化Markdown格式打印所有命令、子命令和标志