Skip to content

Commit b67149e

Browse files
committed
fix(jira): address review comments on candidates-from-pr
- fetch_pr.py: guard against IndexError when gh stderr is whitespace-only - SKILL.md: add jq + Python 3.10+ to prerequisites - SKILL.md: 'highest' (not 'smallest') unreleased version for main/master, matching the command doc's wording - SKILL.md, candidates-from-pr.md: tag bare fenced blocks (MD040) - candidates-from-pr.md: align candidate `assignee` schema with SKILL.md (object with display_name/email, as returned by Jira) - bump jira plugin to 0.4.8 Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Enrique Llorente <ellorent@redhat.com>
1 parent 607e4b3 commit b67149e

6 files changed

Lines changed: 19 additions & 17 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"name": "jira",
2424
"source": "./plugins/jira",
2525
"description": "A plugin to automate tasks with Jira",
26-
"version": "0.4.7"
26+
"version": "0.4.8"
2727
},
2828
{
2929
"name": "ci",

docs/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@
322322
"name": "Jira Status Analysis Engine"
323323
}
324324
],
325-
"version": "0.4.7"
325+
"version": "0.4.8"
326326
},
327327
{
328328
"commands": [

plugins/jira/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jira",
33
"description": "A plugin to automate tasks with Jira",
4-
"version": "0.4.7",
4+
"version": "0.4.8",
55
"author": {
66
"name": "github.com/openshift-eng"
77
}

plugins/jira/commands/candidates-from-pr.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ argument-hint: "<pr-url-or-number> [--repo <org/repo>] [--project <key>] [--targ
77
jira:candidates-from-pr
88

99
## Synopsis
10-
```
10+
```text
1111
/jira:candidates-from-pr <pr-url-or-number> [options]
1212
```
1313

@@ -84,7 +84,7 @@ plugins/jira/skills/candidates-from-pr/SKILL.md
8484
- For OCPBUGS, target release is in `customfield_10855` (Target Version), not `fixVersions` (managed by release team — see `plugins/jira/reference/mcp-tools.md:295`). Query both for safety.
8585

8686
6. **Build JQL** and search for candidate Jiras:
87-
```
87+
```jql
8888
project = <KEY>
8989
AND statusCategory != Done
9090
AND component in (<COMPONENT(s)>)
@@ -109,29 +109,29 @@ plugins/jira/skills/candidates-from-pr/SKILL.md
109109
## Examples
110110

111111
1. **Basic usage with a PR URL**:
112-
```
112+
```text
113113
/jira:candidates-from-pr https://github.com/openshift/ovn-kubernetes/pull/4567
114114
```
115115

116116
2. **Override the target release** (e.g. when triaging a backport before the base branch is final):
117-
```
117+
```text
118118
/jira:candidates-from-pr https://github.com/openshift/ovn-kubernetes/pull/4567 --target-release 4.18
119119
```
120120

121121
3. **Restrict to a specific component**:
122-
```
122+
```text
123123
/jira:candidates-from-pr 4567 --repo openshift/ovn-kubernetes \
124124
--component "Networking / ovn-kubernetes" --project OCPBUGS
125125
```
126126

127127
4. **Tighter results, JSON output for downstream tooling**:
128-
```
128+
```text
129129
/jira:candidates-from-pr https://github.com/openshift/ovn-kubernetes/pull/4567 \
130130
--limit 5 --min-score 60 --output json
131131
```
132132

133133
5. **Re-score even keys already mentioned in the PR description**:
134-
```
134+
```text
135135
/jira:candidates-from-pr https://github.com/openshift/ovn-kubernetes/pull/4567 --include-explicit
136136
```
137137

@@ -156,7 +156,7 @@ plugins/jira/skills/candidates-from-pr/SKILL.md
156156
"status": "New",
157157
"issuetype": "Bug",
158158
"priority": "Major",
159-
"assignee": "Jane Doe",
159+
"assignee": { "display_name": "Jane Doe", "email": "jane@example.com" },
160160
"components": ["..."],
161161
"target_release": "4.18",
162162
"score": 78,

plugins/jira/skills/candidates-from-pr/SKILL.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ All scripts read JSON on stdin or via `--` flags and write JSON/text to stdout.
4242

4343
- `gh` CLI authenticated with read access to the target repo.
4444
- Jira MCP server configured (`plugins/jira/README.md`).
45-
- Python 3 (no third-party deps; standard library only).
45+
- Python 3.10+ (no third-party deps; standard library only).
46+
- `jq` CLI for JSON field extraction in shell snippets.
4647

4748
## Output Format
4849

@@ -93,7 +94,7 @@ scripts/extract_jira_keys.py --projects "$PROJECTS" < pr.json > explicit_keys.js
9394

9495
For each `key` in the output, call:
9596

96-
```
97+
```text
9798
mcp__atlassian__jira_get_issue(
9899
issue_key=<KEY>,
99100
fields="summary,status,issuetype,components,fixVersions,customfield_10855,assignee"
@@ -113,11 +114,11 @@ scripts/derive_filters.py \
113114

114115
If `filters.json.target_release_source == "needs_lookup"`:
115116

116-
```
117+
```text
117118
mcp__atlassian__jira_get_project_versions(project_key=<KEY>)
118119
```
119120

120-
Pick the **smallest** version where `released == false` and rewrite `filters.json` with it (set `target_release_source = "project_versions"`).
121+
Pick the **highest** unreleased numeric version where `released == false` (the current development release for `main`/`master`) and rewrite `filters.json` with it (set `target_release_source = "project_versions"`).
121122

122123
### 4. Build JQL and search
123124

@@ -127,7 +128,7 @@ scripts/build_jql.py --project "$PROJECT" < filters.json > jql.txt
127128

128129
Run the search:
129130

130-
```
131+
```text
131132
mcp__atlassian__jira_search(
132133
jql=<contents of jql.txt>,
133134
fields="summary,status,issuetype,priority,assignee,components,fixVersions,customfield_10855,description,updated,labels",

plugins/jira/skills/candidates-from-pr/scripts/fetch_pr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def main() -> None:
7474
# network glitch. Don't fail the whole pipeline — signals can still be
7575
# extracted from titles/bodies/file paths/commit messages.
7676
diff = ""
77-
diff_unavailable_reason = (diff_err or "unknown error").strip().splitlines()[-1]
77+
_err_lines = (diff_err or "").strip().splitlines()
78+
diff_unavailable_reason = _err_lines[-1] if _err_lines else "unknown error"
7879

7980
diff_lines = diff.splitlines()
8081
truncated = len(diff_lines) > args.diff_max_lines

0 commit comments

Comments
 (0)