feat(workflow): add comprehensive planning, resumption, review, status, and test generation commands

- Implemented `/workflow:plan` for creating detailed implementation plans with task decomposition and context gathering.
- Added `/workflow:resume` for intelligent session resumption with automatic progress analysis.
- Introduced `/workflow:review` for executing the final phase of quality validation and generating review reports.
- Developed `/workflow:status` to provide on-demand views of workflow status and task progress.
- Created `/workflow:test-gen` to generate comprehensive test workflows based on completed implementation tasks, ensuring full test coverage.
This commit is contained in:
catlog22
2025-09-29 21:22:39 +08:00
parent 84f4e47a50
commit 8b907ac80f
20 changed files with 1801 additions and 1216 deletions

View File

@@ -2,184 +2,105 @@
name: complete
description: Mark the active workflow session as complete and remove active flag
usage: /workflow:session:complete
examples:
- /workflow:session:complete
- /workflow:session:complete --detailed
---
# Complete Workflow Session (/workflow:session:complete)
## Purpose
## Overview
Mark the currently active workflow session as complete, update its status, and remove the active flag marker.
## Usage
```bash
/workflow:session:complete
/workflow:session:complete # Complete current active session
/workflow:session:complete --detailed # Show detailed completion summary
```
## Behavior
## Implementation Flow
### Session Completion Process
1. **Locate Active Session**: Find current active session via `.workflow/.active-*` marker file
2. **Update Session Status**: Modify `workflow-session.json` with completion data
3. **Remove Active Flag**: Delete `.workflow/.active-[session-name]` marker file
4. **Generate Summary**: Display completion report and statistics
### Status Updates
Updates `workflow-session.json` with:
- **status**: "completed"
- **completed_at**: Current timestamp
- **final_phase**: Current phase at completion
- **completion_type**: "manual" (distinguishes from automatic completion)
### State Preservation
Preserves all session data:
- Implementation plans and documents
- Task execution history
- Generated artifacts and reports
- Session configuration and metadata
## Completion Summary Display
### Session Overview
```
✅ Session Completed: WFS-oauth-integration
Description: Implement OAuth2 authentication
Created: 2025-09-07 14:30:00
Completed: 2025-09-12 16:45:00
Duration: 5 days, 2 hours, 15 minutes
Final Phase: IMPLEMENTATION
```
### Progress Summary
```
📊 Session Statistics:
- Tasks completed: 5/5 (100%)
- Files modified: 12
- Tests created: 8
- Documentation updated: 3 files
- Average task duration: 2.5 hours
```
### Generated Artifacts
```
📄 Session Artifacts:
✅ IMPL_PLAN.md (Complete implementation plan)
✅ TODO_LIST.md (Final task status)
✅ .task/ (5 completed task files)
📊 reports/ (Session reports available)
```
### Archive Information
```
🗂️ Session Archive:
Directory: .workflow/WFS-oauth-integration/
Status: Completed and archived
Access: Use /context WFS-oauth-integration for review
```
## No Active Session
If no active session exists:
```
⚠️ No Active Session to Complete
Available Options:
- View all sessions: /workflow:session:list
- Start new session: /workflow:session:start "task description"
- Resume paused session: /workflow:session:resume
```
## Next Steps Suggestions
After completion, displays contextual actions:
```
🎯 What's Next:
- View session archive: /context WFS-oauth-integration
- Start related session: /workflow:session:start "build on OAuth work"
- Review all sessions: /workflow:session:list
- Create project report: /workflow/report
```
## Error Handling
### Common Error Scenarios
- **No active session**: Clear message with alternatives
- **Corrupted session state**: Validates before completion, offers recovery
- **File system issues**: Handles permissions and access problems
- **Incomplete tasks**: Warns about unfinished work, allows forced completion
### Validation Checks
Before completing, verifies:
- Session directory exists and is accessible
- `workflow-session.json` is valid and readable
- Marker file exists and matches session
- No critical errors in session state
### Forced Completion
For problematic sessions:
### Step 1: Find Active Session
```bash
# Option to force completion despite issues
/workflow:session:complete --force
ls .workflow/.active-* 2>/dev/null | head -1
```
## Integration with Workflow System
### Session Lifecycle
Completes the session workflow:
- INIT → PLAN → IMPLEMENT → **COMPLETE**
- Maintains session history for reference
- Preserves all artifacts and documentation
### TodoWrite Integration
- Synchronizes final TODO state
- Marks all remaining tasks as archived
- Preserves task history in session directory
### Context System
- Session remains accessible via `/context <session-id>`
- All documents and reports remain available
- Can be referenced for future sessions
## Command Variations
### Basic Completion
### Step 2: Get Session Name
```bash
/workflow:session:complete
basename .workflow/.active-WFS-session-name | sed 's/^\.active-//'
```
### With Summary Options
### Step 3: Update Session Status
```bash
/workflow:session:complete --detailed # Show detailed statistics
/workflow:session:complete --quiet # Minimal output
/workflow:session:complete --force # Force completion despite issues
jq '.status = "completed"' .workflow/WFS-session/workflow-session.json > temp.json
mv temp.json .workflow/WFS-session/workflow-session.json
```
## Session State After Completion
### Directory Structure Preserved
```
.workflow/WFS-[session-name]/
├── workflow-session.json # Updated with completion data
├── IMPL_PLAN.md # Preserved
├── TODO_LIST.md # Final state preserved
├── .task/ # All task files preserved
└── reports/ # Generated reports preserved
### Step 4: Add Completion Timestamp
```bash
jq '.completed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"' .workflow/WFS-session/workflow-session.json > temp.json
mv temp.json .workflow/WFS-session/workflow-session.json
```
### Session JSON Example
```json
{
"id": "WFS-oauth-integration",
"description": "Implement OAuth2 authentication",
"status": "completed",
"created_at": "2025-09-07T14:30:00Z",
"completed_at": "2025-09-12T16:45:00Z",
"completion_type": "manual",
"final_phase": "IMPLEMENTATION",
"tasks_completed": 5,
"tasks_total": 5
}
### Step 5: Count Final Statistics
```bash
ls .workflow/WFS-session/.task/*.json 2>/dev/null | wc -l
ls .workflow/WFS-session/.summaries/*.md 2>/dev/null | wc -l
```
---
### Step 6: Remove Active Marker
```bash
rm .workflow/.active-WFS-session-name
```
**Result**: Current active session is marked as complete, archived, and no longer active. All session data is preserved for future reference.
## Simple Bash Commands
### Basic Operations
- **Find active session**: `ls .workflow/.active-*`
- **Get session name**: `basename marker | sed 's/^\.active-//'`
- **Update status**: `jq '.status = "completed"' session.json > temp.json`
- **Add timestamp**: `jq '.completed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"'`
- **Count tasks**: `ls .task/*.json | wc -l`
- **Count completed**: `ls .summaries/*.md | wc -l`
- **Remove marker**: `rm .workflow/.active-session`
### Completion Result
```
Session WFS-user-auth completed
- Status: completed
- Started: 2025-09-15T10:00:00Z
- Completed: 2025-09-15T16:30:00Z
- Duration: 6h 30m
- Total tasks: 8
- Completed tasks: 8
- Success rate: 100%
```
### Detailed Summary (--detailed flag)
```
Session Completion Summary:
├── Session: WFS-user-auth
├── Project: User authentication system
├── Total time: 6h 30m
├── Tasks completed: 8/8 (100%)
├── Files generated: 24 files
├── Summaries created: 8 summaries
├── Status: All tasks completed successfully
└── Location: .workflow/WFS-user-auth/
```
### Error Handling
```bash
# No active session
ls .workflow/.active-* 2>/dev/null || echo "No active session found"
# Incomplete tasks
task_count=$(ls .task/*.json | wc -l)
summary_count=$(ls .summaries/*.md 2>/dev/null | wc -l)
test $task_count -eq $summary_count || echo "Warning: Not all tasks completed"
```
## Related Commands
- `/workflow:session:list` - View all sessions including completed
- `/workflow:session:start` - Start new session
- `/workflow:status` - Check completion status before completing