Files
Claude-Code-Workflow/.claude/commands/workflow/session/switch.md
catlog22 8b907ac80f 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.
2025-09-29 21:22:39 +08:00

2.3 KiB

name, description, usage, argument-hint, examples
name description usage argument-hint examples
switch Switch to a different workflow session /workflow:session:switch <session-id> session-id to switch to
/workflow:session:switch WFS-oauth-integration
/workflow:session:switch WFS-user-profile

Switch Workflow Session (/workflow:session:switch)

Overview

Switch the active session to a different workflow session.

Usage

/workflow:session:switch WFS-session-name     # Switch to specific session

Implementation Flow

Step 1: Validate Target Session

test -d .workflow/WFS-target-session && echo "Session exists"

Step 2: Pause Current Session

ls .workflow/.active-* 2>/dev/null | head -1
jq '.status = "paused"' .workflow/current-session/workflow-session.json > temp.json

Step 3: Remove Current Active Marker

rm .workflow/.active-* 2>/dev/null

Step 4: Activate Target Session

jq '.status = "active"' .workflow/WFS-target/workflow-session.json > temp.json
mv temp.json .workflow/WFS-target/workflow-session.json

Step 5: Create New Active Marker

touch .workflow/.active-WFS-target-session

Step 6: Add Switch Timestamp

jq '.switched_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"' .workflow/WFS-target/workflow-session.json > temp.json
mv temp.json .workflow/WFS-target/workflow-session.json

Simple Bash Commands

Basic Operations

  • Check session exists: test -d .workflow/WFS-session
  • Find current active: ls .workflow/.active-*
  • Pause current: jq '.status = "paused"' session.json > temp.json
  • Remove marker: rm .workflow/.active-*
  • Activate target: jq '.status = "active"' target.json > temp.json
  • Create marker: touch .workflow/.active-target

Switch Result

Switched to session: WFS-oauth-integration
- Previous: WFS-user-auth (paused)
- Current: WFS-oauth-integration (active)
- Switched at: 2025-09-15T15:45:00Z
- Ready for: /workflow:execute

Error Handling

# Session not found
test -d .workflow/WFS-nonexistent || echo "Error: Session not found"

# No sessions available
ls .workflow/WFS-* 2>/dev/null || echo "No sessions available"
  • /workflow:session:list - Show all available sessions
  • /workflow:session:pause - Pause current before switching
  • /workflow:execute - Continue with new active session