$npx -y skills add opendatahub-io/ai-helpers --skill jira-workitem-searchSearch Jira tickets using JQL queries. Provides common query templates and flexible output formats. Use when user needs to find or filter tickets.
| 1 | # Jira Workitem Search |
| 2 | |
| 3 | Search for Jira tickets using JQL (Jira Query Language) queries with the `acli` CLI. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | - `acli` must be installed and authenticated (`acli jira auth`) |
| 8 | |
| 9 | ## Implementation |
| 10 | |
| 11 | ### Step 1: Verify ACLi Setup |
| 12 | |
| 13 | Before proceeding, verify that acli is installed and authenticated by invoking the `acli-setup-check` skill: |
| 14 | |
| 15 | ``` |
| 16 | /acli-setup-check |
| 17 | ``` |
| 18 | |
| 19 | If the setup check fails, stop execution and guide the user to fix the issue. |
| 20 | |
| 21 | ### Step 2: Determine JQL Query |
| 22 | |
| 23 | 1. **Direct JQL**: If the user provides a JQL query, use it as-is |
| 24 | 2. **Natural Language**: Convert user's natural language request to JQL using templates below. **Extract project names, statuses, components, and other values from the user's request** and substitute them into the templates. |
| 25 | 3. **Interactive**: If unclear, ask the user what they want to find |
| 26 | |
| 27 | #### Input Validation |
| 28 | |
| 29 | Before substituting user-provided values into JQL templates, validate and sanitize the inputs: |
| 30 | |
| 31 | 1. **Project keys**: Validate against pattern `[A-Z]+` (e.g., AIPCC, RHOAIENG). |
| 32 | 2. **Status values**: Quote multi-word statuses (e.g., "In Progress", "Code Review"). Common statuses: To Do, In Progress, Code Review, Done, Blocked. |
| 33 | 3. **Ticket keys**: Validate against pattern `[A-Z]+-[0-9]+` (e.g., AIPCC-1234). |
| 34 | 4. **Numeric values**: Validate that N in `-<N>d` is a positive integer. |
| 35 | 5. **Issue types**: Whitelist common types: Bug, Story, Epic, Feature, Spike, Initiative, Task. |
| 36 | 6. **Components**: Quote multi-word components (e.g., "Wheel Package Index"). |
| 37 | |
| 38 | If validation fails, prompt the user with a clear error message explaining the expected format. |
| 39 | |
| 40 | #### Common JQL Templates |
| 41 | |
| 42 | Replace placeholders like `<PROJECT>`, `<STATUS>`, `<COMPONENT>` with actual values from the user's request or conversation context. |
| 43 | |
| 44 | **My open tickets:** |
| 45 | ```jql |
| 46 | assignee = currentUser() AND resolution = Unresolved ORDER BY updated DESC |
| 47 | ``` |
| 48 | |
| 49 | **Team backlog for a project:** |
| 50 | ```jql |
| 51 | project = <PROJECT> AND status != Done ORDER BY priority DESC, updated DESC |
| 52 | ``` |
| 53 | Example: `project = AIPCC AND status != Done ORDER BY priority DESC, updated DESC` |
| 54 | |
| 55 | **Recent updates in a project (last N days):** |
| 56 | ```jql |
| 57 | project = <PROJECT> AND updatedDate >= -<N>d ORDER BY updated DESC |
| 58 | ``` |
| 59 | Example: `project = RHOAIENG AND updatedDate >= -7d ORDER BY updated DESC` |
| 60 | |
| 61 | **Tickets by status:** |
| 62 | ```jql |
| 63 | project = <PROJECT> AND status = "<STATUS>" ORDER BY updated DESC |
| 64 | ``` |
| 65 | Example: `project = AIPCC AND status = "In Progress" ORDER BY updated DESC` |
| 66 | |
| 67 | **Tickets by type (single):** |
| 68 | ```jql |
| 69 | project = <PROJECT> AND type = <TYPE> ORDER BY updated DESC |
| 70 | ``` |
| 71 | Example: `project = AIPCC AND type = Feature ORDER BY updated DESC` |
| 72 | |
| 73 | **Tickets by type (multiple):** |
| 74 | ```jql |
| 75 | project = <PROJECT> AND type IN (<TYPE1>, <TYPE2>, ...) ORDER BY updated DESC |
| 76 | ``` |
| 77 | Example: `project = AIPCC AND type IN (Feature, Initiative) ORDER BY updated DESC` |
| 78 | |
| 79 | **Blocked tickets:** |
| 80 | ```jql |
| 81 | project = <PROJECT> AND status = Blocked ORDER BY priority DESC |
| 82 | ``` |
| 83 | |
| 84 | **Tickets due soon (next 7 days):** |
| 85 | ```jql |
| 86 | project = <PROJECT> AND dueDate >= now() AND dueDate <= endOfWeek() AND resolution = Unresolved ORDER BY dueDate ASC |
| 87 | ``` |
| 88 | |
| 89 | **Tickets by component:** |
| 90 | ```jql |
| 91 | project = <PROJECT> AND component = "<COMPONENT>" ORDER BY priority DESC |
| 92 | ``` |
| 93 | Example: `project = AIPCC AND component = "Wheel Package Index" ORDER BY priority DESC` |
| 94 | |
| 95 | **Epics and their children:** |
| 96 | ```jql |
| 97 | project = <PROJECT> AND type = Epic ORDER BY created DESC |
| 98 | ``` |
| 99 | |
| 100 | **Unassigned tickets:** |
| 101 | ```jql |
| 102 | project = <PROJECT> AND assignee is EMPTY AND resolution = Unresolved ORDER BY priority DESC |
| 103 | ``` |
| 104 | |
| 105 | **Tickets mentioned in conversation:** |
| 106 | Search conversation history for ticket keys, then query: |
| 107 | ```jql |
| 108 | key IN (<KEY1>, <KEY2>, ...) ORDER BY updated DESC |
| 109 | ``` |
| 110 | Example: `key IN (AIPCC-1234, AIPCC-5678, RHOAIENG-910) ORDER BY updated DESC` |
| 111 | |
| 112 | **Tips for extracting values:** |
| 113 | - If user says "AIPCC backlog", use `project = AIPCC` |
| 114 | - If user says "in progress tickets", use `status = "In Progress"` |
| 115 | - If user says "last week", use `updatedDate >= -7d` |
| 116 | - If user says "Wheel Package Index component", use `component = "Wheel Package Index"` |
| 117 | - If user says "features", use `type = Feature` |
| 118 | - If user says "features and initiatives", use `type IN (Feature, Initiative)` |
| 119 | - Common ticket types: Bug, Story, Epic, Feature, Spike, Initiative, Task |
| 120 | - If no project specified, ask the user or search conversation context for project references |
| 121 | |
| 122 | ### Step 3: Execute Search |
| 123 | |
| 124 | Build the JQL query from validated inputs and execute the search: |
| 125 | |
| 126 | ```bash |
| 127 | # Validate and sanitize inputs extracted from user request |
| 128 | PROJECT="<project-from-step-2>" |
| 129 | if [[ ! "$PROJECT" =~ ^[A-Z]+$ ]]; then |
| 130 | echo "Error: Invalid project key format. Expected uppercase letters only (e.g., AIPCC, RHOAIENG)" |
| 131 | exit 1 |
| 132 | fi |
| 133 | |
| 134 | # For status values w |