refactor(commands): replace bash/jq operations with ccw session commands

- session/start.md: Replace find/mkdir/echo with ccw session list/init
- session/list.md: Replace find/jq with ccw session list/stats/read
- session/resume.md: Replace jq status updates with ccw session status
- session/complete.md: Replace jq/mv with ccw session archive
- execute.md: Replace session discovery with ccw session list/status
- code-developer.md: Replace jq context-package read with ccw session read

Benefits:
- Atomic operations (no temp files)
- Auto workspace detection (works from subdirectories)
- Auto session location detection (active/archived/lite)
- Status history auto-tracking for tasks
- Consistent error handling

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-10 23:31:51 +08:00
parent 598bea9b21
commit a667b7548c
6 changed files with 79 additions and 122 deletions

View File

@@ -25,17 +25,15 @@ Mark the currently active workflow session as complete, analyze it for lessons l
#### Step 1.1: Find Active Session and Get Name
```bash
# Find active session directory
bash(find .workflow/active/ -name "WFS-*" -type d | head -1)
# Extract session name from directory path
bash(basename .workflow/active/WFS-session-name)
# Find active session
ccw session list --location active
# Extract first session_id from result.active array
```
**Output**: Session name `WFS-session-name`
#### Step 1.2: Check for Existing Archiving Marker (Resume Detection)
```bash
# Check if session is already being archived
# Check if session is already being archived (marker file exists)
bash(test -f .workflow/active/WFS-session-name/.archiving && echo "RESUMING" || echo "NEW")
```
@@ -161,26 +159,17 @@ 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: Update Session Status to Completed
**Purpose**: Update workflow-session.json status to "completed" for dashboard display.
```bash
# Update status atomically using jq
bash(jq '.status = "completed"' .workflow/active/WFS-session-name/workflow-session.json > /tmp/ws.json && mv /tmp/ws.json .workflow/active/WFS-session-name/workflow-session.json)
```
#### Step 3.3: 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.4: 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 "[]")