flake-update-20260505
1#!/usr/bin/env bash
2# Jira search helper with common query patterns
3
4set -euo pipefail
5
6usage() {
7 cat <<EOF
8Usage: jira-search <pattern> [options]
9
10Common search patterns:
11 my-open My open issues
12 my-progress My in-progress issues
13 my-week My issues updated this week
14 my-blocked My blocked issues
15 team-bugs Unassigned team bugs
16 team-blocked All blocked team issues
17 stale Stale issues (>30 days no update)
18 high-priority High priority open issues
19 needs-review Issues in code/QE review
20
21Options:
22 --project PROJECT Filter by project (default: SRVKP)
23 --plain Plain text output
24 --paginate N Limit results (default: 20)
25
26Examples:
27 jira-search my-open
28 jira-search team-bugs --project SRVCOM
29 jira-search stale --plain
30EOF
31 exit 1
32}
33
34# Default options
35PROJECT="SRVKP"
36PLAIN=""
37PAGINATE=20
38
39# Parse pattern
40PATTERN="${1:-}"
41shift || true
42
43# Parse options
44while [[ $# -gt 0 ]]; do
45 case "$1" in
46 --project)
47 PROJECT="$2"
48 shift 2
49 ;;
50 --plain)
51 PLAIN="--plain"
52 shift
53 ;;
54 --paginate)
55 PAGINATE="$2"
56 shift 2
57 ;;
58 -h|--help)
59 usage
60 ;;
61 *)
62 echo "Unknown option: $1"
63 usage
64 ;;
65 esac
66done
67
68# Build JQL based on pattern
69ORDER_BY=""
70REVERSE=""
71
72case "$PATTERN" in
73 my-open)
74 JQL="assignee = currentUser() AND status NOT IN (Done, Closed)"
75 ORDER_BY="--order-by priority"
76 REVERSE="--reverse"
77 ;;
78 my-progress)
79 JQL="assignee = currentUser() AND status IN ('In Progress', 'Code Review', 'QE Review')"
80 ORDER_BY="--order-by priority"
81 REVERSE="--reverse"
82 ;;
83 my-week)
84 JQL="assignee = currentUser() AND updated >= startOfWeek()"
85 ORDER_BY="--order-by updated"
86 REVERSE="--reverse"
87 ;;
88 my-blocked)
89 JQL="assignee = currentUser() AND status = Blocked"
90 ORDER_BY="--order-by priority"
91 REVERSE="--reverse"
92 ;;
93 team-bugs)
94 JQL="project = $PROJECT AND type = Bug AND assignee is EMPTY"
95 ORDER_BY="--order-by priority"
96 REVERSE="--reverse"
97 ;;
98 team-blocked)
99 JQL="project = $PROJECT AND status = Blocked"
100 ORDER_BY="--order-by priority"
101 REVERSE="--reverse"
102 ;;
103 stale)
104 JQL="project = $PROJECT AND status NOT IN (Done, Closed) AND updated <= -30d"
105 ORDER_BY="--order-by updated"
106 ;;
107 high-priority)
108 JQL="project = $PROJECT AND priority IN (Critical, Blocker, High) AND status NOT IN (Done, Closed)"
109 ORDER_BY="--order-by priority"
110 REVERSE="--reverse"
111 ;;
112 needs-review)
113 JQL="project = $PROJECT AND status IN ('Code Review', 'QE Review')"
114 ORDER_BY="--order-by created"
115 ;;
116 "")
117 echo "Error: Pattern required"
118 usage
119 ;;
120 *)
121 echo "Error: Unknown pattern: $PATTERN"
122 usage
123 ;;
124esac
125
126# Execute search
127# shellcheck disable=SC2086
128exec jira issue list --jql "$JQL" $PLAIN --paginate "$PAGINATE" $ORDER_BY $REVERSE