Jira Cloud by @altf1be
Manage Atlassian Jira Cloud issues, comments, attachments, and workflow transitions via the REST API.
Setup
- 1. Get an API token from https://id.atlassian.com/manage-profile/security/api-tokens
- Set environment variables (or create
.env in {baseDir}):
CODEBLOCK0
- 3. Install dependencies: INLINECODE2
Commands
Issues
CODEBLOCK1
Comments
CODEBLOCK2
Attachments
CODEBLOCK3
Workflow Transitions
CODEBLOCK4
Dependencies
- -
commander — CLI framework - INLINECODE4 — environment variable loading
- Node.js built-in
fetch (requires Node >= 18)
Security
- - Email + API token auth (Basic auth via base64 encoding)
- No secrets or tokens printed to stdout
- All delete operations require explicit
--confirm flag - Path traversal prevention for file uploads
- Built-in rate limiting with exponential backoff retry
- Lazy config validation (only checked when a command runs)
Author
Abdelkrim BOUJRAF — ALT-F1 SRL, Brussels 🇧🇪
X: @altf1be
@altf1be 的 Jira Cloud
通过 REST API 管理 Atlassian Jira Cloud 的问题、评论、附件和工作流转换。
设置
- 1. 从 https://id.atlassian.com/manage-profile/security/api-tokens 获取 API 令牌
- 设置环境变量(或在 {baseDir} 中创建 .env):
JIRA_HOST=yourcompany.atlassian.net
JIRA_EMAIL=you@example.com
JIRAAPITOKEN=your-api-token
JIRADEFAULTPROJECT=PROJ
- 3. 安装依赖:cd {baseDir} && npm install
命令
问题
bash
列出问题(可选按项目、状态、经办人筛选)
node {baseDir}/scripts/jira.mjs list --project PROJ --status 进行中 --assignee currentUser()
创建问题
node {baseDir}/scripts/jira.mjs create --project PROJ --type 任务 --summary 修复登录错误 --description 用户无法登录 --priority 高
读取问题详情
node {baseDir}/scripts/jira.mjs read --key PROJ-123
更新问题字段
node {baseDir}/scripts/jira.mjs update --key PROJ-123 --summary 新标题 --priority 低
删除问题(需要 --confirm)
node {baseDir}/scripts/jira.mjs delete --key PROJ-123 --confirm
使用 JQL 搜索
node {baseDir}/scripts/jira.mjs search --jql project = PROJ AND status = 开启 ORDER BY created DESC
评论
bash
列出问题上的评论
node {baseDir}/scripts/jira.mjs comment-list --key PROJ-123
添加评论
node {baseDir}/scripts/jira.mjs comment-add --key PROJ-123 --body 此问题已准备好审核
更新评论
node {baseDir}/scripts/jira.mjs comment-update --key PROJ-123 --comment-id 10001 --body 已更新的评论
删除评论(需要 --confirm)
node {baseDir}/scripts/jira.mjs comment-delete --key PROJ-123 --comment-id 10001 --confirm
附件
bash
列出问题上的附件
node {baseDir}/scripts/jira.mjs attachment-list --key PROJ-123
上传附件
node {baseDir}/scripts/jira.mjs attachment-add --key PROJ-123 --file ./screenshot.png
删除附件(需要 --confirm)
node {baseDir}/scripts/jira.mjs attachment-delete --attachment-id 10001 --confirm
工作流转换
bash
列出问题的可用转换
node {baseDir}/scripts/jira.mjs transitions --key PROJ-123
将问题移动到新状态(按转换 ID 或名称)
node {baseDir}/scripts/jira.mjs transition --key PROJ-123 --transition-id 31
node {baseDir}/scripts/jira.mjs transition --key PROJ-123 --transition-name 已完成
依赖
- - commander — CLI 框架
- dotenv — 环境变量加载
- Node.js 内置 fetch(需要 Node >= 18)
安全性
- - 邮箱 + API 令牌认证(通过 base64 编码的基本认证)
- 不会将密钥或令牌输出到标准输出
- 所有删除操作都需要显式的 --confirm 标志
- 文件上传的路径遍历防护
- 内置速率限制,支持指数退避重试
- 延迟配置验证(仅在命令运行时检查)
作者
Abdelkrim BOUJRAF — ALT-F1 SRL,布鲁塞尔 🇧🇪
X: @altf1be