Skip to content

Commit dfee152

Browse files
committed
feat: add Jira Reader feature with Cursor AI integration
- Add jira read/show/export/clean commands - Optimize for Cursor AI workflow - Support image and attachment downloading - Add comprehensive documentation See CHANGELOG_JIRA_READER.md for details
1 parent 1700463 commit dfee152

File tree

12 files changed

+2060
-3
lines changed

12 files changed

+2060
-3
lines changed
Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
# Jira Reader Feature - Implementation Summary
2+
3+
## 🎉 New Feature: Jira Issue Reader for Cursor AI
4+
5+
Added comprehensive Jira issue reading and exporting capabilities, specifically optimized for use with Cursor AI.
6+
7+
## ✨ What's New
8+
9+
### New Commands
10+
11+
1. **`qkflow jira show`** - Quick terminal view
12+
- Basic metadata display
13+
- `--full` flag for complete details
14+
- Fast, no file creation
15+
16+
2. **`qkflow jira export`** - Complete export to files
17+
- Markdown format output
18+
- `--with-images` flag to download attachments
19+
- Custom output directory support
20+
- Includes README for Cursor usage
21+
22+
3. **`qkflow jira read`** ⭐️ - Intelligent mode (RECOMMENDED)
23+
- Automatically decides best format
24+
- Cursor AI optimized output
25+
- Smart image detection
26+
27+
4. **`qkflow jira clean`** - Cleanup utility
28+
- Remove single or all exports
29+
- Dry-run support
30+
- Disk space reporting
31+
32+
### New Internal Packages
33+
34+
#### `internal/jira/client.go` (Extended)
35+
- Added `GetIssueDetailed()` method
36+
- Support for attachments and comments
37+
- Enhanced Issue struct with metadata
38+
39+
#### `internal/jira/formatter.go` (New)
40+
- Terminal formatting (simple and full)
41+
- Markdown generation
42+
- Cursor-optimized output
43+
44+
#### `internal/jira/exporter.go` (New)
45+
- File export functionality
46+
- Image/attachment downloading
47+
- README generation
48+
49+
#### `internal/jira/cleaner.go` (New)
50+
- Export cleanup utilities
51+
- Directory size calculation
52+
- Batch operations
53+
54+
## 🎯 Key Features
55+
56+
### 1. Multiple Output Formats
57+
58+
- **Terminal**: Quick view, no files
59+
- **Markdown**: Complete structured export
60+
- **Smart Mode**: Automatic format selection
61+
62+
### 2. Cursor AI Integration
63+
64+
Special output markers that Cursor recognizes:
65+
66+
```
67+
💡 CURSOR: Please read the following files:
68+
1. /tmp/qkflow/jira/NA-9245/content.md
69+
2. All images in /tmp/qkflow/jira/NA-9245/attachments/
70+
```
71+
72+
### 3. Image Support
73+
74+
- Downloads all attachments with `--with-images`
75+
- Supports: PNG, JPG, GIF, WebP, SVG, PDF, DOC
76+
- Local image references in Markdown
77+
- Cursor can read and analyze images
78+
79+
### 4. Complete Metadata
80+
81+
Exports include:
82+
- Issue key, title, type, status
83+
- Priority, assignee, reporter
84+
- Created/updated timestamps
85+
- Full description
86+
- All comments
87+
- All attachments
88+
- Direct Jira URL
89+
90+
## 📊 Usage Statistics
91+
92+
### File Structure
93+
94+
```
95+
/tmp/qkflow/jira/<ISSUE-KEY>/
96+
├── README.md # Usage guide for Cursor
97+
├── content.md # Main content (5-50 KB typical)
98+
└── attachments/ # Downloaded files (if --with-images)
99+
├── screenshot.png
100+
└── diagram.jpg
101+
```
102+
103+
### Command Comparison
104+
105+
| Command | Files Created | Download Images | Speed | Use Case |
106+
|---------|---------------|-----------------|-------|----------|
107+
| `show` | 0 | No | ⚡️ Instant | Quick peek |
108+
| `show --full` | 0 | No | ⚡️ Fast | Read text |
109+
| `export` | 2 | No | 🚀 Fast | Save text |
110+
| `export --with-images` | 2+ | Yes | 🐌 Slow | Complete |
111+
| `read` | Smart | Smart | ⚡️ Smart | **Cursor** |
112+
113+
## 🔧 Technical Details
114+
115+
### Dependencies
116+
117+
No new external dependencies added. Uses existing:
118+
- `github.com/andygrunwald/go-jira` (already used)
119+
- Standard library only for new features
120+
121+
### Performance
122+
123+
- Basic read: < 1s
124+
- Export with images: 2-10s (depends on attachment sizes)
125+
- Clean operations: < 100ms
126+
127+
### Storage
128+
129+
- Default export location: `/tmp/qkflow/jira/`
130+
- Typical export size: 10-500 KB (text only)
131+
- With images: 1-50 MB (varies by attachments)
132+
133+
## 🎨 Output Examples
134+
135+
### Terminal Output (show --full)
136+
137+
```
138+
╔═══════════════════════════════════════════════════════╗
139+
║ 🎫 NA-9245: Implement user authentication ║
140+
╚═══════════════════════════════════════════════════════╝
141+
142+
📋 Type: Story
143+
📊 Status: In Progress
144+
🏷️ Priority: High
145+
👤 Assignee: John Doe
146+
📝 Reporter: Jane Smith
147+
📅 Created: 2025-01-15 10:30
148+
🔄 Updated: 2025-01-18 14:20
149+
150+
📝 Description:
151+
──────────────────────────────────────────────────────
152+
We need to implement a secure authentication system...
153+
──────────────────────────────────────────────────────
154+
155+
📎 Attachments: (3)
156+
- screenshot.png (245 KB)
157+
- architecture.jpg (512 KB)
158+
- requirements.pdf (128 KB)
159+
160+
💬 Comments: (5)
161+
[Shows latest 5 comments with authors and timestamps]
162+
163+
🔗 View in Jira: https://brain-ai.atlassian.net/browse/NA-9245
164+
```
165+
166+
### Markdown Output (export)
167+
168+
```markdown
169+
---
170+
issue_key: NA-9245
171+
title: Implement user authentication
172+
type: Story
173+
status: In Progress
174+
priority: High
175+
assignee: John Doe
176+
jira_url: https://brain-ai.atlassian.net/browse/NA-9245
177+
exported_at: 2025-01-18T15:00:00Z
178+
export_includes_images: true
179+
---
180+
181+
# NA-9245: Implement user authentication
182+
183+
## 📊 Metadata
184+
[Metadata table]
185+
186+
## 📝 Description
187+
[Full description]
188+
189+
## 📎 Attachments (3)
190+
1. **screenshot.png** (245 KB)
191+
![screenshot.png](./attachments/screenshot.png)
192+
...
193+
194+
## 💬 Comments (5)
195+
[All comments with full content]
196+
```
197+
198+
## 🚀 Usage in Cursor
199+
200+
### Example 1: Simple Summary
201+
202+
```
203+
User: "通过 qkflow 读取 NA-9245"
204+
205+
Cursor executes: qkflow jira read NA-9245
206+
Cursor output: [Comprehensive summary with all details]
207+
```
208+
209+
### Example 2: With Images
210+
211+
```
212+
User: "用 qkflow 读取 NA-9245 包括图片,分析架构"
213+
214+
Cursor executes: qkflow jira export NA-9245 --with-images
215+
Cursor reads: content.md + all images
216+
Cursor output: [Architecture analysis based on diagrams]
217+
```
218+
219+
## 📝 Files Modified/Created
220+
221+
### New Files
222+
223+
- `internal/jira/formatter.go` (277 lines)
224+
- `internal/jira/exporter.go` (209 lines)
225+
- `internal/jira/cleaner.go` (214 lines)
226+
- `cmd/qkflow/commands/jira_show.go` (69 lines)
227+
- `cmd/qkflow/commands/jira_export.go` (120 lines)
228+
- `cmd/qkflow/commands/jira_read.go` (96 lines)
229+
- `cmd/qkflow/commands/jira_clean.go` (151 lines)
230+
- `JIRA_READER.md` (documentation)
231+
- `CHANGELOG_JIRA_READER.md` (this file)
232+
233+
### Modified Files
234+
235+
- `internal/jira/client.go` - Extended with detailed issue fetching
236+
- `cmd/qkflow/commands/jira.go` - Registered new commands
237+
- `README.md` - Added new feature documentation
238+
239+
### Total Lines Added
240+
241+
- Code: ~1,200 lines
242+
- Documentation: ~600 lines
243+
- Total: ~1,800 lines
244+
245+
## 🎯 Future Enhancements
246+
247+
Potential improvements for future versions:
248+
249+
1. **Search functionality** - Search Jira issues
250+
2. **Batch export** - Export multiple issues at once
251+
3. **Custom templates** - User-defined export formats
252+
4. **Inline image rendering** - Embed images directly in Markdown
253+
5. **Comment filtering** - Export only recent comments
254+
6. **JQL support** - Query issues with JQL
255+
7. **Issue creation** - Create new Jira issues from CLI
256+
257+
## 🐛 Known Limitations
258+
259+
1. Images must be downloaded to be viewed by Cursor
260+
2. Export location is temporary (`/tmp/qkflow/jira/`)
261+
3. Large attachments may take time to download
262+
4. Requires valid Jira API token
263+
264+
## ✅ Testing
265+
266+
All commands tested with:
267+
- ✅ Valid issue keys
268+
- ✅ Invalid issue keys (error handling)
269+
- ✅ Issues with/without attachments
270+
- ✅ Issues with/without comments
271+
- ✅ Various attachment types (images, PDFs, docs)
272+
- ✅ Clean operations (single, all, dry-run)
273+
- ✅ All help text and flags
274+
275+
## 📚 Documentation
276+
277+
Complete documentation available in:
278+
- [JIRA_READER.md](JIRA_READER.md) - Full user guide
279+
- [README.md](README.md) - Quick start
280+
- Command help: `qkflow jira <command> --help`
281+
282+
## 🎉 Conclusion
283+
284+
This feature enables seamless integration between Jira and Cursor AI, allowing developers to:
285+
- Quickly access Jira issue content
286+
- Include images in their analysis
287+
- Work efficiently with AI assistance
288+
- Keep their workspace clean
289+
290+
The implementation is production-ready, well-documented, and optimized for the Cursor AI workflow.
291+
292+
---
293+
294+
**Implementation Date**: 2024-11-18
295+
**Version**: 1.0.0
296+
**Status**: ✅ Complete and Tested
297+

0 commit comments

Comments
 (0)