Commit 1eee20805e6a
Changed files (2)
dots
pi
agent
extensions
jira
dots/pi/agent/extensions/jira/index.ts
@@ -445,13 +445,13 @@ export default function (pi: ExtensionAPI) {
// Track recent issues for auto-completion
for (const issue of issues) {
- if (!recentIssues.includes(issue.key)) {
- recentIssues.push(issue.key);
+ if (!recentIssues.find((i) => i.key === issue.key)) {
+ recentIssues.push({ key: issue.key, summary: issue.summary });
}
}
// Keep only last 20
if (recentIssues.length > 20) {
- recentIssues = recentIssues.slice(-20);
+ recentIssues.splice(0, recentIssues.length - 20);
}
// Display results directly (like org-todos)
@@ -491,9 +491,9 @@ export default function (pi: ExtensionAPI) {
const normalizedPrefix = prefix.trim().toUpperCase();
- const items = recentIssues.map((key) => ({
- value: key,
- label: `${key} - Recent issue`,
+ const items = recentIssues.map((issue) => ({
+ value: issue.key,
+ label: `${issue.key} - ${truncate(issue.summary, 60)}`,
}));
// If no prefix, show all. Otherwise filter by prefix.
@@ -527,21 +527,23 @@ export default function (pi: ExtensionAPI) {
}
// Track for auto-completion
- if (!recentIssues.includes(issueKey)) {
- recentIssues.push(issueKey);
+ // Extract summary from output first
+ let summary = "";
+ const summaryMatch = result.stdout.match(/^Summary:\s*(.+)$/m);
+ if (summaryMatch && summaryMatch[1]) {
+ summary = summaryMatch[1].trim();
+ }
+
+ if (!recentIssues.find((i) => i.key === issueKey)) {
+ recentIssues.push({ key: issueKey, summary: summary || issueKey });
}
// Keep only last 20
if (recentIssues.length > 20) {
- recentIssues = recentIssues.slice(-20);
+ recentIssues.splice(0, recentIssues.length - 20);
}
- // Extract summary from output for better heading
- let title = issueKey;
- const summaryMatch = result.stdout.match(/^Summary:\s*(.+)$/m);
- if (summaryMatch && summaryMatch[1]) {
- const summary = summaryMatch[1].trim();
- title = `${issueKey} - ${summary}`;
- }
+ // Build heading with summary
+ const title = summary ? `${issueKey} - ${summary}` : issueKey;
// Display result directly
pi.sendMessage({
@@ -727,13 +729,13 @@ export default function (pi: ExtensionAPI) {
// Track recent issues for auto-completion
for (const issue of issues) {
- if (!recentIssues.includes(issue.key)) {
- recentIssues.push(issue.key);
+ if (!recentIssues.find((i) => i.key === issue.key)) {
+ recentIssues.push({ key: issue.key, summary: issue.summary });
}
}
// Keep only last 20
if (recentIssues.length > 20) {
- recentIssues = recentIssues.slice(-20);
+ recentIssues.splice(0, recentIssues.length - 20);
}
// Display results directly
@@ -799,13 +801,13 @@ export default function (pi: ExtensionAPI) {
// Track recent issues for auto-completion
for (const issue of issues) {
- if (!recentIssues.includes(issue.key)) {
- recentIssues.push(issue.key);
+ if (!recentIssues.find((i) => i.key === issue.key)) {
+ recentIssues.push({ key: issue.key, summary: issue.summary });
}
}
// Keep only last 20
if (recentIssues.length > 20) {
- recentIssues = recentIssues.slice(-20);
+ recentIssues.splice(0, recentIssues.length - 20);
}
// Display results directly
@@ -868,13 +870,13 @@ export default function (pi: ExtensionAPI) {
// Track recent issues for auto-completion
for (const issue of issues) {
- if (!recentIssues.includes(issue.key)) {
- recentIssues.push(issue.key);
+ if (!recentIssues.find((i) => i.key === issue.key)) {
+ recentIssues.push({ key: issue.key, summary: issue.summary });
}
}
// Keep only last 20
if (recentIssues.length > 20) {
- recentIssues = recentIssues.slice(-20);
+ recentIssues.splice(0, recentIssues.length - 20);
}
// Display results directly
dots/pi/agent/extensions/jira/JQL-EXAMPLES.md
@@ -0,0 +1,454 @@
+# JQL Search Examples for `/jira-search`
+
+## Quick Reference
+
+The `/jira-search` command automatically prepends `project = SRVKP AND` to your query, so you can keep searches concise!
+
+```bash
+/jira-search status=Blocked
+→ Expands to: project = SRVKP AND status=Blocked
+```
+
+To search other projects, include `project` in your query:
+```bash
+/jira-search project=KONFLUX AND assignee=currentUser()
+```
+
+---
+
+## Common Searches
+
+### By Status
+
+**My open issues:**
+```bash
+/jira-search assignee=currentUser() AND status!=Done
+```
+
+**Blocked issues:**
+```bash
+/jira-search status=Blocked
+```
+
+**In code review:**
+```bash
+/jira-search status="Code Review"
+```
+
+**Multiple statuses:**
+```bash
+/jira-search status IN ("To Do", "In Progress", "Blocked")
+```
+
+**Not done:**
+```bash
+/jira-search status!=Done
+```
+
+### By Priority
+
+**Critical and blocker issues:**
+```bash
+/jira-search priority IN (Blocker, Critical)
+```
+
+**High priority open issues:**
+```bash
+/jira-search priority IN (Major, Critical) AND status!=Done
+```
+
+**Unassigned high priority:**
+```bash
+/jira-search priority=Critical AND assignee=EMPTY
+```
+
+### By Type
+
+**All bugs:**
+```bash
+/jira-search type=Bug
+```
+
+**Open epics:**
+```bash
+/jira-search type=Epic AND status!=Done
+```
+
+**Tasks and stories:**
+```bash
+/jira-search type IN (Task, Story)
+```
+
+**Not bugs:**
+```bash
+/jira-search type!=Bug
+```
+
+### By Assignee
+
+**My issues:**
+```bash
+/jira-search assignee=currentUser()
+```
+
+**Unassigned issues:**
+```bash
+/jira-search assignee=EMPTY
+```
+
+**Someone else's issues:**
+```bash
+/jira-search assignee="Vincent Demeester"
+```
+
+**Team issues (multiple people):**
+```bash
+/jira-search assignee IN ("Alice", "Bob", "Charlie")
+```
+
+### By Time
+
+**Created in last 7 days:**
+```bash
+/jira-search created >= -7d
+```
+
+**Updated in last week:**
+```bash
+/jira-search updated >= -1w
+```
+
+**Created this month:**
+```bash
+/jira-search created >= startOfMonth()
+```
+
+**Not updated in 30 days:**
+```bash
+/jira-search updated <= -30d
+```
+
+**Created between dates:**
+```bash
+/jira-search created >= "2026-01-01" AND created <= "2026-01-31"
+```
+
+### By Labels
+
+**Has specific label:**
+```bash
+/jira-search labels="2026-focus"
+```
+
+**Has any of these labels:**
+```bash
+/jira-search labels IN ("bug", "urgent", "security")
+```
+
+**Release notes pending:**
+```bash
+/jira-search labels="release-notes-pending"
+```
+
+**Documentation needed:**
+```bash
+/jira-search labels="docs-pending"
+```
+
+### By Reporter
+
+**Issues I reported:**
+```bash
+/jira-search reporter=currentUser()
+```
+
+**Customer-reported issues:**
+```bash
+/jira-search labels="customer-reported"
+```
+
+---
+
+## Advanced Searches
+
+### Epic Management
+
+**All issues in an epic:**
+```bash
+/jira-search "Epic Link"=SRVKP-1000
+```
+
+**Epics with no children:**
+```bash
+/jira-search type=Epic AND "Epic Link" IS EMPTY
+```
+
+**Issues not in any epic:**
+```bash
+/jira-search type!=Epic AND "Epic Link" IS EMPTY
+```
+
+### Stale Issues
+
+**Untouched in 60 days:**
+```bash
+/jira-search updated <= -60d AND status!=Done
+```
+
+**Old "To Do" items:**
+```bash
+/jira-search status="To Do" AND created <= -90d
+```
+
+**Stale in progress:**
+```bash
+/jira-search status="In Progress" AND updated <= -14d
+```
+
+### Workflow Issues
+
+**Stuck in code review:**
+```bash
+/jira-search status="Code Review" AND updated <= -7d
+```
+
+**Blocked for a while:**
+```bash
+/jira-search status=Blocked AND updated <= -3d
+```
+
+**Waiting on someone:**
+```bash
+/jira-search status=Waiting
+```
+
+### Team Planning
+
+**Unassigned open tasks:**
+```bash
+/jira-search type=Task AND assignee=EMPTY AND status!=Done
+```
+
+**High priority unassigned:**
+```bash
+/jira-search priority IN (Critical, Major) AND assignee=EMPTY
+```
+
+**Issues needing triage:**
+```bash
+/jira-search status="To Do" AND assignee=EMPTY AND created <= -7d
+```
+
+### Bug Tracking
+
+**Open bugs by priority:**
+```bash
+/jira-search type=Bug AND status!=Done ORDER BY priority DESC
+```
+
+**Recent bugs:**
+```bash
+/jira-search type=Bug AND created >= -7d
+```
+
+**Unassigned bugs:**
+```bash
+/jira-search type=Bug AND assignee=EMPTY AND status!=Done
+```
+
+**Critical bugs:**
+```bash
+/jira-search type=Bug AND priority IN (Blocker, Critical)
+```
+
+### Component Focus
+
+**Issues in specific component:**
+```bash
+/jira-search component="Pipelines"
+```
+
+**Issues with no component:**
+```bash
+/jira-search component IS EMPTY
+```
+
+### Text Searches
+
+**Search in summary:**
+```bash
+/jira-search summary ~ "authentication"
+```
+
+**Search in description:**
+```bash
+/jira-search description ~ "CVE"
+```
+
+**Search anywhere:**
+```bash
+/jira-search text ~ "security vulnerability"
+```
+
+---
+
+## Complex Queries
+
+### Sprint Planning
+
+**Ready for sprint:**
+```bash
+/jira-search status="To Do" AND assignee=EMPTY AND priority IN (Major, Critical) ORDER BY priority DESC
+```
+
+**Current work:**
+```bash
+/jira-search assignee=currentUser() AND status IN ("In Progress", "Code Review")
+```
+
+**Completed this week:**
+```bash
+/jira-search status=Done AND updated >= -7d AND assignee=currentUser()
+```
+
+### Release Planning
+
+**Issues for next release:**
+```bash
+/jira-search fixVersion="2.1.0" AND status!=Done
+```
+
+**Release blockers:**
+```bash
+/jira-search fixVersion="2.1.0" AND priority=Blocker
+```
+
+**Needs release notes:**
+```bash
+/jira-search labels="release-notes-pending" AND status=Done
+```
+
+### Quality Focus
+
+**Issues with no acceptance criteria:**
+```bash
+/jira-search type=Story AND description !~ "Acceptance Criteria"
+```
+
+**Long-running issues:**
+```bash
+/jira-search status="In Progress" AND created <= -30d
+```
+
+**Frequently reopened:**
+```bash
+/jira-search status changed to "To Do" AFTER -7d
+```
+
+---
+
+## JQL Operators
+
+| Operator | Meaning | Example |
+|----------|---------|---------|
+| `=` | Equals | `status = "To Do"` |
+| `!=` | Not equals | `status != Done` |
+| `>` | Greater than | `priority > Minor` |
+| `<` | Less than | `created < -30d` |
+| `>=` | Greater or equal | `updated >= -7d` |
+| `<=` | Less or equal | `created <= "2026-01-01"` |
+| `IN` | In list | `status IN ("To Do", "In Progress")` |
+| `NOT IN` | Not in list | `type NOT IN (Epic, Sub-task)` |
+| `~` | Contains | `summary ~ "authentication"` |
+| `!~` | Not contains | `description !~ "deprecated"` |
+| `IS EMPTY` | Field empty | `assignee IS EMPTY` |
+| `IS NOT EMPTY` | Field set | `"Epic Link" IS NOT EMPTY` |
+
+## JQL Functions
+
+| Function | Description | Example |
+|----------|-------------|---------|
+| `currentUser()` | Current user | `assignee = currentUser()` |
+| `startOfDay()` | Start of today | `created >= startOfDay()` |
+| `endOfDay()` | End of today | `created <= endOfDay()` |
+| `startOfWeek()` | Start of this week | `updated >= startOfWeek()` |
+| `startOfMonth()` | Start of this month | `created >= startOfMonth()` |
+| `now()` | Current time | `updated >= now() - 1h` |
+
+## Date Formats
+
+| Format | Example | Description |
+|--------|---------|-------------|
+| `-Nd` | `-7d` | N days ago |
+| `-Nw` | `-2w` | N weeks ago |
+| `-Nm` | `-1m` | N months ago |
+| `YYYY-MM-DD` | `2026-01-15` | Specific date |
+| `"YYYY-MM-DD HH:MM"` | `"2026-01-15 14:30"` | Date and time |
+
+## Sorting
+
+Add `ORDER BY` to sort results:
+
+```bash
+# By priority (highest first)
+/jira-search status!=Done ORDER BY priority DESC
+
+# By creation date (newest first)
+/jira-search assignee=currentUser() ORDER BY created DESC
+
+# Multiple fields
+/jira-search type=Bug ORDER BY priority DESC, created ASC
+```
+
+## Tips
+
+1. **Quote multi-word values:** `status = "Code Review"`
+2. **Quote field names with spaces:** `"Epic Link" = SRVKP-1000`
+3. **Use currentUser():** Instead of your username
+4. **Combine with AND/OR:** Build complex queries
+5. **Test incrementally:** Start simple, add conditions
+
+## Common Patterns
+
+**My work today:**
+```bash
+/jira-search assignee=currentUser() AND updated >= startOfDay()
+```
+
+**Needs attention:**
+```bash
+/jira-search assignee=currentUser() AND status IN (Blocked, Waiting, "Code Review")
+```
+
+**Team capacity:**
+```bash
+/jira-search assignee=EMPTY AND status="To Do" AND priority IN (Major, Critical)
+```
+
+**Cleanup candidates:**
+```bash
+/jira-search status="To Do" AND assignee=EMPTY AND created <= -90d
+```
+
+---
+
+## Project-Specific Searches
+
+Remember: These automatically get `project = SRVKP AND` prepended!
+
+**For other projects:**
+```bash
+/jira-search project=KONFLUX AND status=Blocked
+```
+
+**Multiple projects:**
+```bash
+/jira-search project IN (SRVKP, KONFLUX) AND assignee=currentUser()
+```
+
+---
+
+## Resources
+
+- Full JQL Reference: https://issues.redhat.com/secure/JiraJQLHelp.jspa
+- Jira CLI Docs: https://github.com/ankitpokhrel/jira-cli