jira-ticket-prioritizer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJIRA Ticket Prioritizer
JIRA工单优先级排序器
Analyze a set of JIRA tickets to determine optimal execution order based on dependencies and priority. Produces an ordered list usable standalone or as a pre-step before /.
implementforge分析一组JIRA工单,基于依赖关系和优先级确定最优执行顺序。生成的有序列表可独立使用,也可作为/执行前的前置步骤。
implementforgeArguments
参数
- — Comma-separated ticket keys (e.g.
$ARGUMENTS[0]) OR a JQL query (detected by presence ofEC-100,EC-101,EC-102,=,AND)OR - — (optional) Additional context for prioritization (e.g. "focus on backend", "frontend first")
$ARGUMENTS[1]
- — 逗号分隔的工单key(例如
$ARGUMENTS[0]),或是一个JQL查询(通过是否包含EC-100,EC-101,EC-102、=、AND来检测)OR - — (可选)优先级排序的额外上下文(例如「优先关注后端」、「前端优先」)
$ARGUMENTS[1]
System Requirements
系统要求
- CLI installed and configured (https://github.com/ankitpokhrel/jira-cli)
jira - Environment variable set with a valid Jira API token. Important: When checking this variable, verify at least 2 times before concluding it is not set. Never expose the value — use existence checks only.
JIRA_API_TOKEN
- 已安装并配置CLI(https://github.com/ankitpokhrel/jira-cli)
jira - 已设置环境变量,值为有效的Jira API token。重要提示: 检查该变量时,至少验证2次再判定其未设置。绝对不要暴露变量值 — 仅做存在性检查即可。
JIRA_API_TOKEN
Execution
执行
Step 1 — Parse Input
步骤1 — 解析输入
- Check if contains
$ARGUMENTS[0],=, orAND(case-insensitive) to detect JQLOR - If JQL detected: run to resolve to ticket keys
jira issue list --jql "$ARGUMENTS[0]" --plain --columns key --no-headers - If comma-separated: split on and trim whitespace
, - Validate each key matches
[A-Z]+-\d+ - If fewer than 2 valid tickets, report the single ticket and exit
- 检查是否包含
$ARGUMENTS[0]、=或AND(不区分大小写),以此检测是否为JQLOR - 如果检测到JQL:运行解析出工单key
jira issue list --jql "$ARGUMENTS[0]" --plain --columns key --no-headers - 如果为逗号分隔格式:按拆分并去除空格
, - 验证每个key匹配格式
[A-Z]+-\d+ - 如果有效工单数量少于2个,返回单个工单信息后退出
Step 2 — Fetch All Tickets
步骤2 — 拉取所有工单
- Create temp directory:
mkdir -p .jira-ticket-prioritizer-tmp/tickets - For each ticket key, fetch via jira CLI:
jira issue view {KEY} --raw > .jira-ticket-prioritizer-tmp/tickets/{KEY}.json - Parse each ticket using the jira-ticket-viewer parse script:
node ../jira-ticket-viewer/scripts/parse-ticket.js < .jira-ticket-prioritizer-tmp/tickets/{KEY}.json > .jira-ticket-prioritizer-tmp/tickets/{KEY}-parsed.json - Collect all parsed outputs into a single JSON array and write to
.jira-ticket-prioritizer-tmp/all-tickets.json
- 创建临时目录:
mkdir -p .jira-ticket-prioritizer-tmp/tickets - 对每个工单key,通过jira CLI拉取信息:
jira issue view {KEY} --raw > .jira-ticket-prioritizer-tmp/tickets/{KEY}.json - 使用jira-ticket-viewer解析脚本解析每个工单:
node ../jira-ticket-viewer/scripts/parse-ticket.js < .jira-ticket-prioritizer-tmp/tickets/{KEY}.json > .jira-ticket-prioritizer-tmp/tickets/{KEY}-parsed.json - 将所有解析后的输出汇总为单个JSON数组,写入
.jira-ticket-prioritizer-tmp/all-tickets.json
Step 3 — Build Dependency Graph
步骤3 — 构建依赖图
- Run:
node ./scripts/build-dependency-graph.js < .jira-ticket-prioritizer-tmp/all-tickets.json > .jira-ticket-prioritizer-tmp/graph.json - Review graph output for cycles or warnings
- See references/dependency-analysis.md for relationship mapping rules
- 运行:
node ./scripts/build-dependency-graph.js < .jira-ticket-prioritizer-tmp/all-tickets.json > .jira-ticket-prioritizer-tmp/graph.json - 检查图输出中是否存在循环或警告
- 关联映射规则可查看references/dependency-analysis.md
Step 4 — Semantic Dependency Analysis
步骤4 — 语义依赖分析
- For tickets flagged with links or no explicit links in the graph output, analyze their
"relates to",description, andsummaryfor implicit dependenciescommentSummary - Look for:
- References to other ticket keys in the input set
- Shared component or module mentions
- Functional ordering hints ("builds on", "requires", "after", "depends on")
- Add soft edges with confidence levels (high/medium/low) to the graph
- Re-run topological sort if new edges were added:
- Update with additional
all-tickets.jsonand re-runsoftEdgesbuild-dependency-graph.js
- Update
- 对于图输出中标记有链接、或没有显式链接的工单,分析其
"relates to"、description和summary以识别隐式依赖commentSummary - 查找以下内容:
- 输入集合中其他工单key的引用
- 共享组件或模块的提及
- 功能顺序提示("builds on"、"requires"、"after"、"depends on")
- 为图添加带置信度等级(高/中/低)的软边
- 如果添加了新边,重新运行拓扑排序:
- 用新增的更新
softEdges,重新运行all-tickets.jsonbuild-dependency-graph.js
- 用新增的
Step 5 — Priority Scoring
步骤5 — 优先级评分
- For tickets at the same dependency layer, score using weights from references/priority-weights.md
- Skip tickets with status "Done" — list them as excluded in the report
- Sort within each layer by descending score
- Apply context as a tiebreaker or boost (e.g. "focus on backend" boosts tickets with backend labels/components)
$ARGUMENTS[1]
- 对处于同一依赖层的工单,使用references/priority-weights.md中的权重进行评分
- 跳过状态为"Done"的工单 — 在报告中将其列为已排除
- 每个层级内按分数降序排序
- 应用的上下文作为平局决胜项或权重加成(例如「优先关注后端」会给带有后端标签/组件的工单加分)
$ARGUMENTS[1]
Step 6 — Generate Output
步骤6 — 生成输出
- Write — full details including scores, justifications, dependency graph, excluded tickets, and warnings (see references/output-format.md for schema)
.jira-ticket-prioritizer-tmp/detailed-report.json - Write — ticket keys grouped by dependency layer (array of arrays), sorted by priority score within each layer
.jira-ticket-prioritizer-tmp/output.json - Present only (the simple sorted array) to the user. The detailed report is saved for reference but not displayed.
output.json
- 写入— 包含分数、判定依据、依赖图、已排除工单和警告在内的完整详情(schema可查看references/output-format.md)
.jira-ticket-prioritizer-tmp/detailed-report.json - 写入— 按依赖层分组的工单key(二维数组),每层内按优先级分数排序
.jira-ticket-prioritizer-tmp/output.json - 仅向用户展示(简单排序数组)。详细报告仅保存用于参考,不对外展示。
output.json
Reference Files
参考文件
| Name | When to Read |
|---|---|
| references/priority-weights.md | Step 5 — scoring rules and factor weights |
| references/output-format.md | Step 6 — report template and JSON schema |
| references/dependency-analysis.md | Steps 3-4 — dependency detection rules |
| 名称 | 阅读时机 |
|---|---|
| references/priority-weights.md | 步骤5 — 评分规则和因子权重 |
| references/output-format.md | 步骤6 — 报告模板和JSON schema |
| references/dependency-analysis.md | 步骤3-4 — 依赖检测规则 |