refactor(session): migrate remaining bash commands to ccw session

Replace legacy bash operations in session commands with ccw session
commands for consistency and better maintainability.

Changes:
- session/list.md: Replace ls/wc with ccw session list
- session/complete.md: Replace bash marker/manifest ops with ccw session
- skills/command-guide reference docs: Mirror all changes

Commands replaced:
- `ls .workflow/active/WFS-*` → `ccw session list --location active`
- `test -f .archiving` → `ccw session read --type process --filename .archiving`
- `touch .archiving` → `ccw session write --type process --filename .archiving`
- `cat manifest.json` → `ccw session read manifest --type manifest`

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-11 15:08:55 +08:00
parent 0a4c205105
commit c256fd9379
4 changed files with 35 additions and 31 deletions

View File

@@ -34,7 +34,7 @@ ccw session list --location active
#### Step 1.2: Check for Existing Archiving Marker (Resume Detection)
```bash
# Check if session is already being archived (marker file exists)
bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW")
ccw session read WFS-session-name --type process --filename .archiving 2>/dev/null && echo "RESUMING" || echo "NEW"
```
**If RESUMING**:
@@ -47,7 +47,7 @@ bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" ||
#### Step 1.3: Create Archiving Marker
```bash
# Mark session as "archiving in progress"
bash(touch .workflow/active/WFS-session-name/.archiving)
ccw session write WFS-session-name --type process --filename .archiving --content ''
```
**Purpose**:
- Prevents concurrent operations on this session
@@ -171,8 +171,8 @@ ccw session archive WFS-session-name
#### Step 3.2: Update Manifest
```bash
# Read current manifest (or create empty array if not exists)
bash(test -f .workflow/archives/manifest.json && cat .workflow/archives/manifest.json || echo "[]")
# Read current manifest using ccw (or create empty array if not exists)
ccw session read manifest --type manifest --raw 2>/dev/null || echo "[]"
```
**JSON Update Logic**:
@@ -199,7 +199,8 @@ Write('.workflow/archives/manifest.json', JSON.stringify(manifest, null, 2));
#### Step 3.5: Remove Archiving Marker
```bash
bash(rm .workflow/archives/WFS-session-name/.archiving)
# Remove archiving marker from archived session (use bash rm as ccw has no delete)
rm .workflow/archives/WFS-session-name/.process/.archiving 2>/dev/null || true
```
**Result**: Clean archived session without temporary markers
@@ -220,7 +221,8 @@ bash(rm .workflow/archives/WFS-session-name/.archiving)
#### Step 4.1: Check Project State Exists
```bash
bash(test -f .workflow/project.json && echo "EXISTS" || echo "SKIP")
# Check project state using ccw
ccw session read project --type project 2>/dev/null && echo "EXISTS" || echo "SKIP"
```
**If SKIP**: Output warning and skip Phase 4
@@ -248,8 +250,8 @@ const featureId = title.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 5
#### Step 4.3: Update project.json
```bash
# Read current project state
bash(cat .workflow/project.json)
# Read current project state using ccw
ccw session read project --type project --raw
```
**JSON Update Logic**:
@@ -363,8 +365,8 @@ function getLatestCommitHash() {
**Recovery Steps**:
```bash
# Session still in .workflow/active/WFS-session-name
# Remove archiving marker
bash(rm .workflow/active/WFS-session-name/.archiving)
# Remove archiving marker using bash
rm .workflow/active/WFS-session-name/.process/.archiving 2>/dev/null || true
```
**User Notification**:

View File

@@ -77,11 +77,12 @@ Total: 3 sessions (1 active, 1 paused, 1 completed)
### Quick Commands
```bash
# Count all sessions
ls .workflow/active/WFS-* | wc -l
# Count active sessions using ccw
ccw session list --location active --no-metadata
# Returns session count in result.total
# Show recent sessions
ls -t .workflow/active/WFS-*/workflow-session.json | head -3
ccw session list --location active
```
## session_manager Tool Alternative

View File

@@ -35,8 +35,8 @@ bash(basename .workflow/active/WFS-session-name)
#### Step 1.2: Check for Existing Archiving Marker (Resume Detection)
```bash
# Check if session is already being archived
bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW")
# Check if session is already being archived (marker file exists)
ccw session read WFS-session-name --type process --filename .archiving 2>/dev/null && echo "RESUMING" || echo "NEW"
```
**If RESUMING**:
@@ -49,7 +49,7 @@ bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" ||
#### Step 1.3: Create Archiving Marker
```bash
# Mark session as "archiving in progress"
bash(touch .workflow/active/WFS-session-name/.archiving)
ccw session write WFS-session-name --type process --filename .archiving --content ''
```
**Purpose**:
- Prevents concurrent operations on this session
@@ -161,21 +161,20 @@ Analyze workflow session for archival preparation. Session is STILL in active lo
**Purpose**: Atomically commit all changes. Only execute if Phase 2 succeeds.
#### Step 3.1: Create Archive Directory
#### Step 3.1: Update Session Status and Archive
```bash
bash(mkdir -p .workflow/archives/)
```
#### Step 3.2: Move Session to Archive
```bash
bash(mv .workflow/active/WFS-session-name .workflow/archives/WFS-session-name)
# Archive session (updates status to "completed" and moves to archives)
ccw session archive WFS-session-name
# This operation atomically:
# 1. Updates workflow-session.json status to "completed"
# 2. Moves session from .workflow/active/ to .workflow/archives/
```
**Result**: Session now at `.workflow/archives/WFS-session-name/`
#### Step 3.3: Update Manifest
#### Step 3.2: Update Manifest
```bash
# Read current manifest (or create empty array if not exists)
bash(test -f .workflow/archives/manifest.json && cat .workflow/archives/manifest.json || echo "[]")
# Read current manifest using ccw (or create empty array if not exists)
ccw session read manifest --type manifest --raw 2>/dev/null || echo "[]"
```
**JSON Update Logic**:
@@ -200,9 +199,10 @@ manifest.push(archiveEntry);
Write('.workflow/archives/manifest.json', JSON.stringify(manifest, null, 2));
```
#### Step 3.4: Remove Archiving Marker
#### Step 3.3: Remove Archiving Marker
```bash
bash(rm .workflow/archives/WFS-session-name/.archiving)
# Remove archiving marker from archived session (use bash rm as ccw has no delete)
rm .workflow/archives/WFS-session-name/.process/.archiving 2>/dev/null || true
```
**Result**: Clean archived session without temporary markers

View File

@@ -88,9 +88,10 @@ Total: 3 sessions (1 active, 1 paused, 1 completed)
### Quick Commands
```bash
# Count all sessions
ls .workflow/active/WFS-* | wc -l
# Count active sessions using ccw
ccw session list --location active --no-metadata
# Returns session count in result.total
# Show recent sessions
ls -t .workflow/active/WFS-*/workflow-session.json | head -3
ccw session list --location active
```