siesa-agents 2.1.28 → 2.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,513 @@
1
+ <!-- Powered by BMAD™ Core -->
2
+
3
+ # Sync Epic Files to Jira Task
4
+
5
+ ## Purpose
6
+
7
+ Automatically synchronize individual epic files from `docs/prd/` directory to Jira. This task is designed for scenarios where epics and stories have been developed using BMAD but Jira was never updated. It scans for files starting with `epic-` and creates corresponding epics and stories in Jira.
8
+
9
+ ## When to Use This Task
10
+
11
+ **Use this task when:**
12
+
13
+ - You have already developed epics/stories in separate markdown files
14
+ - Jira was never synchronized during development
15
+ - You need to retroactively populate Jira from existing documentation
16
+ - Each epic has been "sharded" into individual files in `docs/prd/`
17
+
18
+ **Prerequisites:**
19
+
20
+ - Epic files in `docs/prd/` following naming pattern: `epic-*.md`
21
+ - Jira preferences configured in `.bmad-core/data/jira-preferences.md`
22
+ - Active Jira connection with appropriate permissions
23
+ - MCP Jira integration available
24
+
25
+ ## Instructions
26
+
27
+ ### Phase 1: Configuration & Validation
28
+
29
+ #### Step 0: Validate Jira Authentication (REQUIRED)
30
+
31
+ **CRITICAL:** Validate authentication BEFORE any Jira operations
32
+
33
+ **Action:** Execute authentication check
34
+
35
+ - [ ] Call `validate-jira-auth.md` task
36
+ - [ ] Verify authentication is active
37
+ - [ ] Only proceed if validation passes
38
+
39
+ **If validation fails:** HALT and instruct user to re-authenticate via MCP panel before continuing.
40
+
41
+ ---
42
+
43
+ #### Step 1: Load Jira Preferences
44
+
45
+ ```elicit
46
+ path: Load the Jira preferences file
47
+ format: |
48
+ Loading Jira configuration from: `.bmad-core/data/jira-preferences.md`
49
+
50
+ Please confirm the following settings:
51
+ - Provider: {{provider}}
52
+ - Project Key: {{project_key}}
53
+ - Create Epics First: {{create_epics_first}}
54
+ - Dry Run Mode: {{dry_run_mode}}
55
+
56
+ Type 'proceed' to continue, or 'edit' to modify preferences first.
57
+ ```
58
+
59
+ #### Step 2: Scan Epic Files
60
+
61
+ **Action:** Scan `docs/prd/` directory for epic files
62
+
63
+ - [ ] List all files in `docs/prd/` directory
64
+ - [ ] Filter files matching pattern `epic-*.md` (exclude `epic-list.md`)
65
+ - [ ] Sort files by epic number (epic-1, epic-2, etc.)
66
+ - [ ] Validate each file has valid epic structure
67
+
68
+ **Expected Output:**
69
+ ```markdown
70
+ ## Found Epic Files:
71
+
72
+ 1. docs/prd/epic-1-foundation-category-management-pm-6httpssiesa-test-sandboxatlassiannetbrowsepm-6.md
73
+ 2. docs/prd/epic-2-task-management-core-pm-7httpssiesa-test-sandboxatlassiannetbrowsepm-7.md
74
+ 3. docs/prd/epic-3-task-filtering-api-polish-pm-8httpssiesa-test-sandboxatlassiannetbrowsepm-8.md
75
+
76
+ Total: {{file_count}} epic files detected
77
+ ```
78
+
79
+ #### Step 3: Parse Epic Files
80
+
81
+ **For each epic file found:**
82
+
83
+ 1. **Read File Content:**
84
+ - Load markdown content
85
+ - Extract epic metadata from header/title
86
+ - Identify story sections within the file
87
+
88
+ 2. **Extract Epic Information:**
89
+ - Epic Name: From first `# Epic` header
90
+ - Epic Goal: From **Goal:** section
91
+ - Existing Jira Key: Check if already linked `[PM-XX]`
92
+ - Description: Content before first story
93
+
94
+ 3. **Extract Stories:**
95
+ - Parse each `## Story` section
96
+ - Extract story title, user story format, acceptance criteria
97
+ - Check if story already has Jira key `[PM-XX]`
98
+
99
+ **Expected Output:**
100
+ ```markdown
101
+ ## Parsed Epic Files:
102
+
103
+ ### Epic 1: Foundation & Category Management
104
+ - File: docs/prd/epic-1-foundation-category-management-pm-6httpssiesa-test-sandboxatlassiannetbrowsepm-6.md
105
+ - Existing Jira Key: PM-6 (SKIP if found)
106
+ - Stories: 4
107
+ - Story 1.1: Project Scaffolding and Clean Architecture Setup [PM-9]
108
+ - Story 1.2: PostgreSQL Database Configuration [PM-10]
109
+ - Story 1.3: Category Repository Setup [PM-11]
110
+ - Story 1.4: Category API Endpoints [PM-12]
111
+
112
+ ### Epic 2: Task Management Core
113
+ - File: docs/prd/epic-2-task-management-core-pm-7httpssiesa-test-sandboxatlassiannetbrowsepm-7.md
114
+ - Existing Jira Key: PM-7 (SKIP if found)
115
+ - Stories: 4
116
+ - Story 2.1: Task Entity and Database Configuration [PM-13]
117
+ - Story 2.2: Task Repository and Core Use Cases [PM-14]
118
+ - Story 2.3: Task Validation and Status Transitions [PM-15]
119
+ - Story 2.4: Task API Endpoints [PM-16]
120
+
121
+ Total: {{epic_count}} epics, {{story_count}} stories
122
+ Already synced: {{synced_epic_count}} epics, {{synced_story_count}} stories
123
+ To create: {{new_epic_count}} epics, {{new_story_count}} stories
124
+ ```
125
+
126
+ #### Step 4: Confirm Sync Plan
127
+
128
+ ```elicit
129
+ path: Review and confirm sync plan
130
+ format: |
131
+ The following items will be created in Jira ({{project_key}}):
132
+
133
+ {{Display parsed structure from Step 3}}
134
+
135
+ ⚠️ Items with existing Jira keys will be SKIPPED to avoid duplicates.
136
+
137
+ Options:
138
+ 1. Proceed with creation (skip existing)
139
+ 2. Force recreate all (ignore existing keys)
140
+ 3. Enable dry-run mode (preview only)
141
+ 4. Select specific epics to sync
142
+ 5. Cancel
143
+
144
+ Enter selection (1-5):
145
+ ```
146
+
147
+ ### Phase 2: Epic Creation
148
+
149
+ #### Step 5: Create Epics in Jira
150
+
151
+ **For each epic file:**
152
+
153
+ 1. **Check Existing Jira Key:**
154
+ - Search for `[PM-XX]` or similar pattern in epic header
155
+ - If found: SKIP this epic (already synced) UNLESS force mode enabled
156
+ - If not found: Proceed with creation
157
+
158
+ 2. **Extract Epic Data:**
159
+ - Epic Name: From file header
160
+ - Epic Goal: First paragraph after goal marker
161
+ - Description: Detailed content from file (excluding stories)
162
+ - Labels: `prd-sync`, `automated`, `epic-file-sync`, `{epic-slug}`
163
+
164
+ 3. **Map Custom Fields:**
165
+ ```
166
+ Based on jira-preferences.md:
167
+ - Epic Name (customfield_10011): {{epic_name}}
168
+ - Business Value (customfield_10020): {{if specified}}
169
+ - Target Quarter (customfield_10021): {{if specified}}
170
+ ```
171
+
172
+ 4. **Create Epic Issue:**
173
+ ```javascript
174
+ // Using MCP Jira - Pseudo-code for clarity
175
+ {
176
+ provider: "jira",
177
+ issue_type: "Epic",
178
+ summary: "[Epic] {{Epic Name}}",
179
+ description: "## Epic Goal\n{{goal}}\n\n## Details\n{{description}}\n\n---\n*Source: {{file_path}}*",
180
+ project_key: "{{from preferences}}",
181
+ priority: "{{from preferences}}",
182
+ labels: ["prd-sync", "automated", "epic-file-sync", "{{epic-slug}}"],
183
+ custom_fields: {
184
+ "customfield_10011": "{{epic_name}}"
185
+ // Additional custom fields from preferences
186
+ }
187
+ }
188
+ ```
189
+
190
+ 5. **Store Epic Key:**
191
+ - Save the created Jira epic key (e.g., `PM-123`)
192
+ - Maintain mapping: `Epic File` → `Jira Key`
193
+ - Prepare to update file with new key
194
+
195
+ **Progress Output:**
196
+ ```markdown
197
+ Creating Epics:
198
+ ⊘ Epic 1: Foundation & Category Management → PM-6 (already exists, skipped)
199
+ ✓ Epic 2: Task Management Core → PM-25 (created)
200
+ ✓ Epic 3: Task Filtering & API Polish → PM-26 (created)
201
+
202
+ Summary: 2 created, 1 skipped
203
+ ```
204
+
205
+ ### Phase 3: Story Creation
206
+
207
+ #### Step 6: Create Stories in Jira
208
+
209
+ **For each story in each epic file:**
210
+
211
+ 1. **Check Existing Jira Key:**
212
+ - Search for `[PM-XX]` in story header
213
+ - If found: SKIP this story UNLESS force mode enabled
214
+ - If not found: Proceed with creation
215
+
216
+ 2. **Extract Story Data:**
217
+ - Title: From story header or user story format
218
+ - User Story: "As a... I want... So that..." format
219
+ - Description: Detailed content from story section
220
+ - Acceptance Criteria: Extracted from AC sections
221
+ - Technical Notes: From implementation sections
222
+ - Parent Epic: Use epic key from Step 5 or existing key
223
+
224
+ 3. **Map Custom Fields:**
225
+ ```
226
+ Based on jira-preferences.md:
227
+ - Story Points (customfield_10016): {{if specified}}
228
+ - Acceptance Criteria (customfield_10017): {{extracted AC}}
229
+ - Technical Notes (customfield_10018): {{tech details}}
230
+ - Dependencies (customfield_10019): {{if specified}}
231
+ ```
232
+
233
+ 4. **Create Story Issue:**
234
+ ```javascript
235
+ // Using MCP Jira - Pseudo-code for clarity
236
+ {
237
+ provider: "jira",
238
+ issue_type: "Story",
239
+ summary: "{{Story Title}}",
240
+ description: "## User Story\n{{user_story}}\n\n## Description\n{{description}}\n\n## Acceptance Criteria\n{{ac}}\n\n---\n*Source: {{file_path}}*",
241
+ project_key: "{{from preferences}}",
242
+ priority: "{{from preferences}}",
243
+ labels: ["prd-sync", "automated", "epic-file-sync", "{{parent-epic-slug}}"],
244
+ epic_link: "{{parent_epic_key}}",
245
+ custom_fields: {
246
+ "customfield_10017": "{{acceptance_criteria}}",
247
+ "customfield_10018": "{{technical_notes}}"
248
+ // Additional custom fields from preferences
249
+ }
250
+ }
251
+ ```
252
+
253
+ 5. **Link to Epic:**
254
+ - Establish parent-child relationship with epic
255
+ - Use `epic_link` field with parent epic key
256
+
257
+ **Progress Output:**
258
+ ```markdown
259
+ Creating Stories for Epic PM-6:
260
+ ⊘ Story 1.1: Project Scaffolding → PM-9 (already exists, skipped)
261
+ ⊘ Story 1.2: PostgreSQL Database → PM-10 (already exists, skipped)
262
+ ⊘ Story 1.3: Category Repository → PM-11 (already exists, skipped)
263
+ ⊘ Story 1.4: Category API Endpoints → PM-12 (already exists, skipped)
264
+
265
+ Creating Stories for Epic PM-25:
266
+ ✓ Story 2.1: Task Entity → PM-27 (created)
267
+ ✓ Story 2.2: Task Repository → PM-28 (created)
268
+ ✓ Story 2.3: Task Validation → PM-29 (created)
269
+ ✓ Story 2.4: Task API → PM-30 (created)
270
+
271
+ Summary: 4 created, 4 skipped
272
+ ```
273
+
274
+ ### Phase 4: Update Epic Files with Jira Keys
275
+
276
+ #### Step 7: Update Epic Files
277
+
278
+ **CRITICAL:** Update each epic file with Jira references for traceability
279
+
280
+ **For each processed epic file:**
281
+
282
+ 1. **Update Epic Header:**
283
+ - Locate epic header line (e.g., `# Epic 1: Foundation...`)
284
+ - Add or update Jira key: `# Epic 1: Foundation... [PM-XX](https://...)`
285
+ - Preserve existing format if key already present
286
+
287
+ 2. **Update Story Headers:**
288
+ - Locate each story header (e.g., `## Story 1.1: ...`)
289
+ - Add or update Jira key: `## Story 1.1: ... [PM-XX](https://...)`
290
+ - Preserve existing format if key already present
291
+
292
+ 3. **Add/Update Sync Metadata:**
293
+ - At end of file, add or update sync information:
294
+
295
+ ```markdown
296
+ ---
297
+
298
+ ## Jira Synchronization
299
+
300
+ **Last Sync:** {{current_date}}
301
+ **Epic Key:** [{{EPIC_KEY}}]({{jira_url}}/browse/{{EPIC_KEY}})
302
+ **Project:** [{{project_key}}]({{jira_url}}/browse/{{project_key}})
303
+
304
+ ### Story Mappings
305
+
306
+ | Story | Jira Key | Link |
307
+ |-------|----------|------|
308
+ | Story {{N}}.1: {{Title}} | {{KEY}} | [View]({{jira_url}}/browse/{{KEY}}) |
309
+ | Story {{N}}.2: {{Title}} | {{KEY}} | [View]({{jira_url}}/browse/{{KEY}}) |
310
+
311
+ ---
312
+ *Synchronized by PM Agent - sync-epic-files-to-jira task on {{current_date}}*
313
+ ```
314
+
315
+ **Progress Output:**
316
+ ```markdown
317
+ Updating Epic Files:
318
+ ✓ epic-1-foundation-category-management.md (no changes, already synced)
319
+ ✓ epic-2-task-management-core.md (updated with 5 new Jira keys)
320
+ ✓ epic-3-task-filtering-api-polish.md (updated with 5 new Jira keys)
321
+
322
+ Total: 3 files processed, 2 files updated, 10 new keys added
323
+ ```
324
+
325
+ ### Phase 5: Verification & Reporting
326
+
327
+ #### Step 8: Generate Sync Report
328
+
329
+ **Create comprehensive summary report:**
330
+
331
+ ```markdown
332
+ # Epic Files to Jira Sync Report
333
+
334
+ **Source Directory:** docs/prd/
335
+ **Epic Files Processed:** {{file_count}}
336
+ **Jira Project:** {{project_key}}
337
+ **Sync Date:** {{timestamp}}
338
+ **Dry Run:** {{dry_run_mode}}
339
+
340
+ ## Summary
341
+
342
+ - **Total Epics Processed:** {{total_epics}}
343
+ - Created: {{created_epics}}
344
+ - Skipped (existing): {{skipped_epics}}
345
+ - **Total Stories Processed:** {{total_stories}}
346
+ - Created: {{created_stories}}
347
+ - Skipped (existing): {{skipped_stories}}
348
+ - **Failed Items:** {{failure_count}}
349
+ - **Files Updated:** {{updated_files}}/{{total_files}}
350
+
351
+ ## Created Items by Epic File
352
+
353
+ ### Epic File 1: {{filename}}
354
+
355
+ **Epic:** {{epic_name}} → {{epic_key}} {{status}}
356
+
357
+ **Stories:**
358
+
359
+ | Story Title | Jira Key | Status |
360
+ |-------------|----------|--------|
361
+ | {{title}} | {{key}} | ✓ Created |
362
+ | {{title}} | {{key}} | ⊘ Skipped |
363
+
364
+ ---
365
+
366
+ ### Epic File 2: {{filename}}
367
+
368
+ **Epic:** {{epic_name}} → {{epic_key}} {{status}}
369
+
370
+ **Stories:**
371
+
372
+ | Story Title | Jira Key | Status |
373
+ |-------------|----------|--------|
374
+ | {{title}} | {{key}} | ✓ Created |
375
+ | {{title}} | {{key}} | ✓ Created |
376
+
377
+ ---
378
+
379
+ ## Failed Items
380
+
381
+ {{If any items failed}}
382
+
383
+ | Item | Type | File | Error |
384
+ |------|------|------|-------|
385
+ | {{name}} | {{type}} | {{file}} | {{error}} |
386
+
387
+ ## Updated Files
388
+
389
+ | File | Epic Key | Stories Updated | Status |
390
+ |------|----------|-----------------|--------|
391
+ | {{file}} | {{key}} | {{count}} | ✓ Updated |
392
+
393
+ ## Next Steps
394
+
395
+ 1. Review created issues in Jira: {{jira_project_url}}
396
+ 2. {{If failures}} Retry failed items manually or after fixing configuration
397
+ 3. Verify all epic files have been updated with Jira keys
398
+ 4. Update story points and assignments as needed
399
+ 5. Add to sprint/backlog for planning
400
+
401
+ ## Traceability
402
+
403
+ Epic files have been mapped to Jira as follows:
404
+
405
+ | Epic File | Epic Key | Story Count |
406
+ |-----------|----------|-------------|
407
+ | {{file}} | {{key}} | {{count}} |
408
+
409
+ All epic files have been updated with inline Jira keys for future reference.
410
+
411
+ ---
412
+ *Generated by PM Agent - sync-epic-files-to-jira task*
413
+ ```
414
+
415
+ #### Step 9: Validation Checklist
416
+
417
+ **Manual verification steps:**
418
+
419
+ - [ ] All new epics created with correct information
420
+ - [ ] All new stories linked to appropriate epics
421
+ - [ ] Existing items were properly skipped (no duplicates)
422
+ - [ ] Custom fields populated correctly
423
+ - [ ] Labels applied for filtering
424
+ - [ ] Descriptions formatted correctly
425
+ - [ ] All epic files updated with Jira keys
426
+ - [ ] Sync metadata added to each file
427
+ - [ ] Links between files and Jira documented
428
+
429
+ #### Step 10: Handoff
430
+
431
+ ```elicit
432
+ path: Complete sync process
433
+ format: |
434
+ Epic files sync complete!
435
+
436
+ Summary:
437
+ - Epics Created: {{created_epics}}
438
+ - Stories Created: {{created_stories}}
439
+ - Files Updated: {{updated_files}}
440
+
441
+ Would you like to:
442
+ 1. View full sync report
443
+ 2. Open Jira project in browser
444
+ 3. Generate stakeholder notification
445
+ 4. Complete and exit
446
+
447
+ Enter selection (1-4):
448
+ ```
449
+
450
+ ## Error Handling
451
+
452
+ ### Common Issues and Solutions
453
+
454
+ **Issue:** Epic file has no valid epic header
455
+ - **Solution:** Verify file follows expected format with `# Epic N:` header
456
+ - **Action:** Skip file and log warning, or prompt user to fix format
457
+
458
+ **Issue:** Cannot determine story structure
459
+ - **Solution:** Check that stories follow `## Story N.M:` format
460
+ - **Action:** Skip stories without clear structure, log details
461
+
462
+ **Issue:** Duplicate epics detected (existing Jira key found)
463
+ - **Solution:** Default behavior is to skip existing items
464
+ - **Action:** Use force mode to recreate if needed
465
+
466
+ **Issue:** Epic link field not available
467
+ - **Solution:** Epic links may not be enabled in Jira project
468
+ - **Action:** Use labels or alternative linking method
469
+
470
+ **Issue:** File permission errors when updating epic files
471
+ - **Solution:** Check file permissions in docs/prd/ directory
472
+ - **Action:** Ensure write access to all epic files
473
+
474
+ **Issue:** Inconsistent file naming
475
+ - **Solution:** Files must start with `epic-` to be detected
476
+ - **Action:** Rename files or adjust scanning pattern
477
+
478
+ ## Tips for Success
479
+
480
+ 1. **Start with Dry Run:** Set `dry_run_mode: true` for first sync to preview results
481
+ 2. **Check Existing Keys:** Review epic files for existing `[PM-XX]` keys before syncing
482
+ 3. **Use Force Mode Carefully:** Only force recreate when necessary to avoid duplicates
483
+ 4. **Backup Files First:** Commit or backup epic files before running sync
484
+ 5. **Consistent Formatting:** Ensure all epic files follow similar structure
485
+ 6. **Review After Sync:** Manually verify a few items in Jira to ensure correct mapping
486
+ 7. **Version Control:** Commit updated epic files after successful sync
487
+ 8. **Use Labels:** Leverage `epic-file-sync` label for easy filtering in Jira
488
+
489
+ ## Integration with Other Tasks
490
+
491
+ - **Before:** Use `shard-prd` to split main PRD into individual epic files
492
+ - **Alternative:** Use `sync-prd-to-jira` for monolithic PRD documents
493
+ - **Complementary:** Use `create-story` for additional stories after initial sync
494
+ - **Related:** Use `validate-jira-auth` to check authentication before syncing
495
+
496
+ ## Configuration Reference
497
+
498
+ All configuration is managed in `.bmad-core/data/jira-preferences.md`. Key settings:
499
+
500
+ - **Provider Settings:** Jira, Azure DevOps, GitHub, GitLab, Linear
501
+ - **Project Configuration:** Project key, organization, default values
502
+ - **Field Mappings:** Standard and custom field IDs
503
+ - **Parsing Rules:** How to extract epics/stories from markdown files
504
+ - **Automation Preferences:** Batch creation, naming conventions, error handling
505
+ - **Skip Logic:** How to handle existing Jira keys in source files
506
+
507
+ Refer to the configuration file for detailed documentation of all available settings.
508
+
509
+ ---
510
+
511
+ **Task Version:** 1.0.0
512
+ **Last Updated:** 2025-12-11
513
+ **Dependencies:** MCP Jira Integration, jira-preferences.md, shard-prd task (optional)