BMAD-METHOD/.bmad-core/tasks/doc-migration-task.md

144 lines
3.1 KiB
Markdown
Raw Normal View History

# Document Migration Task
## Purpose
2025-06-15 00:02:17 -05:00
Simple document migration that cleans up heading formats and adds epic structure for PRDs.
## Task Requirements
2025-06-15 00:02:17 -05:00
1. **Input**: User specifies the document to migrate (e.g., `docs/prd.md`)
2. **Detection**: Automatically determine if it's a PRD or other document type
3. **Migration**: Apply appropriate transformations
4. **Backup**: Create backup with `.bak` extension
## Migration Rules
2025-06-15 00:02:17 -05:00
### For PRDs
2025-06-15 00:02:17 -05:00
- Find all level 3 headings that appear to be epics
- Add a level 2 heading "## Epic #" (incrementing number) before each epic
- Also apply the heading cleanup rules below
2025-06-15 00:02:17 -05:00
### For All Documents
2025-06-15 00:02:17 -05:00
- Find all level 2 headings (`## ...`)
- Remove leading numbers and symbols
- Keep only alphabetic characters and spaces
2025-06-15 01:05:56 -05:00
- **CRITICAL**: Do not lose any information - preserve all content under appropriate headings
2025-06-15 00:02:17 -05:00
- Examples:
- `## 1. Foo & Bar``## Foo Bar`
- `## 2.1 Technical Overview``## Technical Overview`
- `## 3) User Experience``## User Experience`
2025-06-15 01:05:56 -05:00
### For Architecture Documents
2025-06-15 01:05:56 -05:00
- **PRIMARY GOAL**: Align level 2 headings to match template level 2 titles exactly
- **PRESERVE EVERYTHING**: Do not lose any information during migration
- Map existing content to the closest matching template section
- If content doesn't fit template sections, create appropriate level 3 subsections
2025-06-15 00:02:17 -05:00
## Detection Logic
2025-06-15 00:02:17 -05:00
A document is considered a PRD if:
2025-06-15 00:02:17 -05:00
- Filename contains "prd" (case insensitive)
- OR main title contains "Product Requirements" or "PRD"
- OR contains sections like "User Stories", "Functional Requirements", "Acceptance Criteria"
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## Implementation Steps
2025-06-15 00:02:17 -05:00
1. **Backup Original**: Copy `filename.md` to `filename.md.bak`
2. **Detect Type**: Check if document is a PRD
3. **Process Headings**:
2025-06-15 00:02:17 -05:00
- Clean all level 2 headings
- If PRD: Add epic structure before level 3 headings that look like epics
4. **Write Result**: Overwrite original file with migrated content
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## Epic Detection for PRDs
2025-06-15 00:02:17 -05:00
Level 3 headings are treated as epics if they:
2025-06-15 00:02:17 -05:00
- Describe features or functionality
- Are substantial sections (not just "Overview" or "Notes")
- Common epic patterns: "User Management", "Payment Processing", "Reporting Dashboard"
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
The epic numbering starts at 1 and increments for each epic found.
2025-06-15 00:02:17 -05:00
## Example
2025-06-15 00:02:17 -05:00
### Before (PRD):
`````markdown
2025-06-15 00:02:17 -05:00
# Product Requirements Document
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## 1. Executive Summary
2025-06-15 00:02:17 -05:00
Content here...
2025-06-15 00:02:17 -05:00
## 2.1 Functional Requirements & Specs
2025-06-15 00:02:17 -05:00
Content here...
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
### User Management System
2025-06-15 00:02:17 -05:00
Epic content...
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
### Payment Processing
2025-06-15 00:02:17 -05:00
Epic content...
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## 3) Success Metrics
2025-06-15 00:02:17 -05:00
Content here...
````text
2025-06-15 00:02:17 -05:00
### After (PRD):
```markdown
# Product Requirements Document
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## Executive Summary
Content here...
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## Functional Requirements Specs
Content here...
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## Epic 1
### User Management System
Epic content...
2025-06-14 18:11:16 -05:00
2025-06-15 00:02:17 -05:00
## Epic 2
### Payment Processing
Epic content...
2025-06-15 00:02:17 -05:00
## Success Metrics
Content here...
2025-06-15 01:05:56 -05:00
```text
2025-06-15 00:02:17 -05:00
### Before (Non-PRD):
```markdown
# Architecture Document
2025-06-15 00:02:17 -05:00
## 1. System Overview
Content...
2025-06-15 00:02:17 -05:00
## 2.1 Technical Stack & Tools
Content...
```text
2025-06-15 00:02:17 -05:00
### After (Non-PRD):
```markdown
# Architecture Document
2025-06-15 00:02:17 -05:00
## System Overview
Content...
2025-06-15 00:02:17 -05:00
## Technical Stack Tools
Content...
````
`````
```text
```