/ .claude / commands / epic-complete.md
epic-complete.md
  1  ---
  2  allowed-tools: Bash(git:*), Bash(gh:*), Bash(npm:*), Read, Write, MultiEdit, Edit
  3  description: Complete epic development with quality assurance, documentation, versioning, and release
  4  ---
  5  
  6  # Epic Complete Workflow
  7  
  8  ## Usage
  9  Execute: `/epic-complete` (automatically detects current epic from branch)
 10  Optional: `/epic-complete additional context or instructions`
 11  
 12  ## Phase 1: Intelligent Epic Detection & Validation
 13  
 14  ### Epic Detection from Branch
 15  - **Current branch**: Run `git branch --show-current`
 16  - **Extract epic number**: Parse epic number from branch name (e.g., epic/6-dreamweaving-operations → 6)
 17  - **Additional context**: Process any user-provided context after command
 18  - **Git status**: Run `git status --short`
 19  - **Epic issue status**: Run `gh issue view DETECTED_EPIC_NUMBER` (using extracted number)
 20  
 21  ### Feature Completion Verification
 22  - **Epic features**: Run `gh issue list --label feature --search "epic DETECTED_EPIC_NUMBER" --state all`
 23  - **Verify all features closed**: Ensure no open features remain for this epic
 24  - **Epic specification status**: Confirm specification issue is complete
 25  
 26  ### Quality Gate Check
 27  - **Uncommitted changes**: Ensure clean git state before proceeding
 28  - **Epic branch sync**: Verify all feature merges complete
 29  
 30  ## Phase 2: Quality Assurance & Testing
 31  
 32  ### Comprehensive Code Validation
 33  - **Run all checks**: Run `npm run check-all`
 34  - **Zero warnings requirement**: Fix any lint errors, test failures, or type errors
 35  - **Test coverage review**: Ensure all new functions have appropriate tests
 36  
 37  #### If Quality Issues Found:
 38  1. **Stop epic completion** until issues resolved
 39  2. **Address each issue** systematically
 40  3. **Re-run checks**: Run `npm run check-all`
 41  4. **Commit fixes**: Run `git add -A && git commit -m "Fix quality issues for epic completion"`
 42  
 43  ### Epic Integration Testing
 44  - **Manual testing**: Verify epic functionality works end-to-end
 45  - **Integration points**: Test epic features work together correctly
 46  - **Performance check**: Ensure no regressions introduced
 47  
 48  ## Phase 3: Documentation Updates
 49  
 50  **Follow Documentation Architecture Pattern**: Root files + docs/ directory
 51  
 52  ### Required Documentation Updates
 53  
 54  #### 1. Project Memory (CLAUDE.md)
 55  - **Update epic status**: Mark epic as COMPLETE in Current Development Status
 56  - **Add epic achievements**: Document key technical innovations
 57  - **Update next epic status**: If applicable, mark next epic as active
 58  - **Update architecture notes**: Document any new patterns introduced
 59  
 60  #### 2. CHANGELOG.md Analysis & Update
 61  **Critical**: Review git commit history for precise documentation
 62  
 63  - **Analyze commits**: Run `git log main..HEAD --oneline` (current epic branch)
 64  - **Review detailed changes**: Run `git log main..HEAD --stat` (current epic branch)
 65  - **Create new version section**:
 66    ```markdown
 67    ## [X.Y.Z] - YYYY-MM-DD - Epic $ARGUMENTS: [EPIC_TITLE]
 68  
 69    ### Added
 70    - [List new features with issue numbers]
 71  
 72    ### Technical Achievements
 73    - [Key innovations and architecture changes]
 74  
 75    ### Enhanced
 76    - [Improvements to existing functionality]
 77  
 78    ### Fixed
 79    - [Bug fixes and technical debt resolution]
 80    ```
 81  
 82  #### 3. README.md Updates
 83  - **Update project status**: Reflect epic completion
 84  - **Update roadmap checkmarks**: Mark completed milestones
 85  - **Add epic completion notes**: Brief summary of achievements
 86  
 87  #### 4. Technical Documentation (docs/)
 88  - **Update docs/technical-patterns.md**: Add new algorithms/patterns discovered
 89  - **Update docs/architecture-details.md**: Document architectural changes
 90  - **Update docs/ux-specifications.md**: Document UX patterns and flows
 91  - **Ensure cross-references**: Verify all doc links remain accurate
 92  
 93  ## Phase 4: Version Release
 94  
 95  ### Version Bumping
 96  - **Read current version**: Run `cat package.json | grep '"version"'`
 97  - **Determine version increment**:
 98    - Major (X.0.0): Breaking changes or major new functionality
 99    - Minor (X.Y.0): New features, backwards compatible
100    - Patch (X.Y.Z): Bug fixes, minor improvements
101  
102  #### Update Version
103  - **Bump package.json**: Update version field to new version
104  - **Commit version bump**: Run `git add package.json && git commit -m "Release vX.Y.Z: Epic DETECTED_EPIC_NUMBER - [EPIC_TITLE]"` (detect epic from branch)
105  
106  ### Final Quality Check
107  - **Final validation**: Run `npm run check-all`
108  - **Ensure all changes committed**: Run `git status --short`
109  
110  ## Phase 5: Main Branch Integration
111  
112  **⚠️ CRITICAL: MAIN BRANCH IS THE ONLY BRANCH EVER PUSHED TO REMOTE ⚠️**
113  - **Epic and feature branches are LOCAL-ONLY**
114  - **ONLY main branch gets pushed after epic completion**
115  
116  ### Merge to Main
117  - **Switch to main**: Run `git checkout main`
118  - **Pull latest main**: Run `git pull origin main`
119  - **Merge epic branch**: Run `git merge CURRENT_EPIC_BRANCH --no-ff -m "Complete Epic DETECTED_EPIC_NUMBER: [EPIC_TITLE]"` (merge current epic branch)
120  - **Push main to remote**: Run `git push origin main` (ONLY TIME remote push happens)
121  
122  ### Create Git Tag
123  - **Create tag**: Run `git tag vX.Y.Z`
124  - **Push tag**: Run `git push origin vX.Y.Z`
125  
126  ## Phase 6: GitHub Release & Project Management
127  
128  ### Create GitHub Release
129  - **Create release**: Run `gh release create vX.Y.Z --title "Epic $ARGUMENTS: [EPIC_TITLE]" --notes-from-tag`
130  - **Reference CHANGELOG**: Include comprehensive notes from CHANGELOG.md section
131  
132  ### Epic Issue Management
133  - **Update epic issue**: Mark all success criteria as complete
134  - **Close epic issue**: Run `gh issue close DETECTED_EPIC_NUMBER --comment "Epic DETECTED_EPIC_NUMBER complete. All features implemented, tested, and released as vX.Y.Z."`
135  - **Update project board**: Reference @CLAUDE.md (lines 680-727) for GraphQL status update
136  
137  ### Specification Issue Closure
138  - **Close specification**: Close related specification issue with completion summary
139  - **Update parent-child links**: Ensure GitHub issue relationships properly closed
140  
141  ## Phase 7: Cleanup & Next Epic Preparation
142  
143  ### Branch Cleanup
144  - **Delete local epic branch**: Run `git branch -d CURRENT_EPIC_BRANCH` (delete current epic branch)
145  - **NO remote cleanup needed**: Epic branches never pushed to remote (local-only workflow)
146  
147  ### Project Memory Updates
148  - **Final CLAUDE.md update**: Reflect current project state post-epic
149  - **Update epic quick reference**: Mark epic complete, update active epic
150  - **Commit memory updates**: Run `git add CLAUDE.md && git commit -m "Update project memory after Epic DETECTED_EPIC_NUMBER completion"`
151  
152  ### Next Epic Planning
153  - **Identify next epic**: Review epic roadmap and priorities
154  - **Update development status**: Prepare for next development cycle
155  - **Archive lessons learned**: Document key insights for future epics
156  
157  ## Epic Completion Checklist
158  
159  ### Quality Standards
160  - [ ] **All tests passing**: `npm run check-all` shows zero warnings/errors
161  - [ ] **Zero lint warnings**: Clean code validation complete
162  - [ ] **Zero TypeScript errors**: Full type safety maintained
163  - [ ] **Clean git state**: No uncommitted changes
164  
165  ### Documentation Standards
166  - [ ] **CHANGELOG updated**: Comprehensive epic details from git history
167  - [ ] **README updated**: Project status and roadmap reflect completion
168  - [ ] **Technical docs updated**: New patterns and architectures documented
169  - [ ] **Project memory updated**: Epic status and achievements captured
170  
171  ### Release Standards
172  - [ ] **Version bumped**: Appropriate semantic version increment
173  - [ ] **Main branch merged**: Epic integrated to main with clean history
174  - [ ] **Git tag created**: Release tagged and pushed
175  - [ ] **GitHub release**: Comprehensive release notes published
176  
177  ### Project Management
178  - [ ] **Epic issue closed**: All success criteria marked complete
179  - [ ] **Specification closed**: Related spec issue properly closed
180  - [ ] **Project board updated**: All issues moved to Complete status
181  - [ ] **Branch cleanup**: Epic branch deleted from local and remote
182  
183  ### Next Cycle Preparation
184  - [ ] **Memory updated**: Current state accurately reflected
185  - [ ] **Next epic identified**: Development roadmap updated
186  - [ ] **Lessons documented**: Key insights preserved for future
187  
188  ## Success Criteria
189  
190  **Epic is complete when:**
191  ✅ All code quality standards met
192  ✅ Comprehensive documentation updated
193  ✅ Version released and tagged
194  ✅ GitHub project management complete
195  ✅ Clean development environment for next epic
196  
197  ## Reference Materials
198  
199  - **Epic Completion Requirements**: @CLAUDE.md (lines 484-496)
200  - **Documentation Architecture**: @CLAUDE.md (lines 881-897)
201  - **GitHub CLI Commands**: @CLAUDE.md (lines 610-767)
202  - **Quality Standards**: @CLAUDE.md (lines 853-868)
203  - **Version Release Process**: @CLAUDE.md (lines 899-914)
204  
205  ## Critical Success Factors
206  
207  **🎯 Quality Before Release**
208  - Never merge to main with failing tests or warnings
209  - Documentation must reflect actual implementation
210  - All acceptance criteria verified complete
211  
212  **🎯 Comprehensive Documentation**
213  - CHANGELOG based on actual git history, not just memory
214  - Technical patterns properly documented for future reference
215  - Project memory accurately reflects current state
216  
217  **🎯 Clean Project Management**
218  - All GitHub issues properly closed with summaries
219  - Project board reflects accurate completion status
220  - Development environment ready for next epic
221  
222  This command ensures systematic epic completion following the **Epic Completion Workflow** from project memory.