Files
Claude-Code-Workflow/.claude/commands/workflow/session/list.md
catlog22 19ebb2dc82 fix(workflow): complete path migration and enhance session:complete
Comprehensive update to eliminate all old path references and implement transactional archival in session:complete.

## Part 1: Complete Path Migration (43 files)

### Files Updated
- action-plan-verify.md
- session/list.md, session/resume.md
- tdd-verify.md, tdd-plan.md, test-*.md
- All brainstorm/*.md files (13 files)
- All tools/*.md files (10 files)
- All ui-design/*.md files (10 files)
- lite-plan.md, lite-execute.md, plan.md

### Path Changes
- `.workflow/.active-*` → `find .workflow/sessions/ -name "WFS-*" -type d`
- `.workflow/WFS-{session}` → `.workflow/sessions/WFS-{session}`
- `.workflow/.archives/` → `.workflow/archives/`
- Removed all marker file operations (touch/rm .active-*)

### Verification
-  0 references to .active-* markers remain
-  0 references to direct .workflow/WFS-* paths
-  0 references to .workflow/.archives/ (dot prefix)

## Part 2: Transactional Archival Enhancement

### session/complete.md - Complete Rewrite

**New Four-Phase Architecture**:

1. **Phase 1: Pre-Archival Preparation**
   - Find active session in .workflow/sessions/
   - Check for existing .archiving marker (resume detection)
   - Create .archiving marker to prevent concurrent operations

2. **Phase 2: Agent Analysis (In-Place)**
   - Agent processes session WHILE STILL in sessions/ directory
   - Pure analysis - no file moves or manifest updates
   - Returns complete metadata package for atomic commit
   - Failure here → session remains active, safe to retry

3. **Phase 3: Atomic Commit**
   - Only executes if Phase 2 succeeds
   - Move session to archives/
   - Update manifest.json
   - Remove .archiving marker
   - All-or-nothing guarantee

4. **Phase 4: Project Registry Update**
   - Extract feature metadata and update project.json

**Key Improvements**:
- **Agent-first, move-second**: Prevents inconsistent states
- **Transactional guarantees**: All-or-nothing file operations
- **Resume capability**: .archiving marker enables safe retry
- **Error recovery**: Comprehensive failure handling documented

**Old Design Flaw (Fixed)**:
- Old: Move first → Agent processes → If agent fails, session moved but metadata incomplete
- New: Agent processes → If success, atomic commit → Guaranteed consistency

## Benefits

1. **Consistency**: All commands use identical path patterns
2. **Robustness**: Transactional archival prevents data loss
3. **Maintainability**: Single source of truth for directory structure
4. **Recoverability**: Failed operations can be safely retried
5. **Alignment**: Closer to OpenSpec's clean three-layer model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:39:23 +08:00

2.4 KiB

name, description, examples
name description examples
list List all workflow sessions with status filtering, shows session metadata and progress information
/workflow:session:list

List Workflow Sessions (/workflow:session:list)

Overview

Display all workflow sessions with their current status, progress, and metadata.

Usage

/workflow:session:list       # Show all sessions with status

Implementation Flow

Step 1: Find All Sessions

ls .workflow/sessions/WFS-* 2>/dev/null

Step 2: Check Active Session

find .workflow/sessions/ -name "WFS-*" -type d 2>/dev/null | head -1

Step 3: Read Session Metadata

jq -r '.session_id, .status, .project' .workflow/sessions/WFS-session/workflow-session.json

Step 4: Count Task Progress

find .workflow/sessions/WFS-session/.task/ -name "*.json" -type f 2>/dev/null | wc -l
find .workflow/sessions/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l

Step 5: Get Creation Time

jq -r '.created_at // "unknown"' .workflow/sessions/WFS-session/workflow-session.json

Simple Bash Commands

Basic Operations

  • List sessions: find .workflow/sessions/ -name "WFS-*" -type d
  • Find active: find .workflow/sessions/ -name "WFS-*" -type d
  • Read session data: jq -r '.session_id, .status' session.json
  • Count tasks: find .task/ -name "*.json" -type f | wc -l
  • Count completed: find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l
  • Get timestamp: jq -r '.created_at' session.json

Simple Output Format

Session List Display

Workflow Sessions:

[ACTIVE] WFS-oauth-integration
   Project: OAuth2 authentication system
   Status: active
   Progress: 3/8 tasks completed
   Created: 2025-09-15T10:30:00Z

[PAUSED] WFS-user-profile
   Project: User profile management
   Status: paused
   Progress: 1/5 tasks completed
   Created: 2025-09-14T14:15:00Z

[COMPLETED] WFS-database-migration
   Project: Database schema migration
   Status: completed
   Progress: 4/4 tasks completed
   Created: 2025-09-13T09:00:00Z

Total: 3 sessions (1 active, 1 paused, 1 completed)

Status Indicators

  • [ACTIVE]: Active session
  • [PAUSED]: Paused session
  • [COMPLETED]: Completed session
  • [ERROR]: Error/corrupted session

Quick Commands

# Count all sessions
ls .workflow/sessions/WFS-* | wc -l

# Show recent sessions
ls -t .workflow/sessions/WFS-*/workflow-session.json | head -3