Revert: Remove ccw session management while keeping ccw cli exec

Selectively revert ccw session management commands back to commit 5114a94,
while preserving ccw cli exec improvements.

Changes:
- Session management commands (start, list, resume, complete): Full revert to bash commands
- execute.md: Full revert (only had ccw session changes)
- review.md: Reverted ccw session read, kept ccw cli exec
- docs.md: Reverted ccw session read/write, kept ccw cli exec
- lite-fix.md: Reverted ccw session init/read, kept other changes
- lite-plan.md: Reverted ccw session init/read, kept other changes
- lite-execute.md: No changes (kept ccw cli exec intact)
- code-developer.md: No changes (kept ccw cli exec intact)

All ccw session management operations replaced with bash commands.
All ccw cli exec commands preserved for unified CLI execution.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-17 22:52:12 +08:00
parent 474a1ce027
commit 44d84116c3
9 changed files with 147 additions and 373 deletions

View File

@@ -30,17 +30,10 @@ The `--type` parameter classifies sessions for CCW dashboard organization:
| `tdd` | TDD-based development | `/workflow:tdd-plan` |
| `test` | Test generation/fix sessions | `/workflow:test-fix-gen` |
| `docs` | Documentation sessions | `/memory:docs` |
| `lite-plan` | Lightweight planning workflow | `/workflow:lite-plan` |
| `lite-fix` | Lightweight bug fix workflow | `/workflow:lite-fix` |
**Special Behavior for `lite-plan` and `lite-fix`**:
- These types automatically infer the storage location (`.workflow/.lite-plan/` or `.workflow/.lite-fix/`)
- No need to specify `--location` parameter when using these types
- Alternative: Use `--location lite-plan` or `--location lite-fix` directly
**Validation**: If `--type` is provided with invalid value, return error:
```
ERROR: Invalid session type. Valid types: workflow, review, tdd, test, docs, lite-plan, lite-fix
ERROR: Invalid session type. Valid types: workflow, review, tdd, test, docs
```
## Step 0: Initialize Project State (First-time Only)
@@ -77,12 +70,12 @@ SlashCommand({command: "/workflow:init"});
### Step 1: List Active Sessions
```bash
ccw session list --location active
bash(ls -1 .workflow/active/ 2>/dev/null | head -5)
```
### Step 2: Display Session Metadata
```bash
ccw session WFS-promptmaster-platform read workflow-session.json
bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json)
```
### Step 4: User Decision
@@ -99,29 +92,34 @@ Present session information and wait for user to select or create session.
### Step 1: Check Active Sessions Count
```bash
ccw session list --location active
# Check result.total in response
bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | wc -l)
```
### Step 2a: No Active Sessions → Create New
```bash
# Generate session slug from description
# Pattern: WFS-{lowercase-slug-from-description}
# Generate session slug
bash(echo "implement OAuth2 auth" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
# Create session with ccw (creates directories + metadata atomically)
ccw session init WFS-implement-oauth2-auth --type workflow
# Create directory structure
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.process)
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.task)
bash(mkdir -p .workflow/active/WFS-implement-oauth2-auth/.summaries)
# Create metadata (include type field, default to "workflow" if not specified)
bash(echo '{"session_id":"WFS-implement-oauth2-auth","project":"implement OAuth2 auth","status":"planning","type":"workflow","created_at":"2024-12-04T08:00:00Z"}' > .workflow/active/WFS-implement-oauth2-auth/workflow-session.json)
```
**Output**: `SESSION_ID: WFS-implement-oauth2-auth`
### Step 2b: Single Active Session → Check Relevance
```bash
# Get session list with metadata
ccw session list --location active
# Extract session ID
bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
# Read session metadata for relevance check
ccw session WFS-promptmaster-platform read workflow-session.json
# Read project name from metadata
bash(cat .workflow/active/WFS-promptmaster-platform/workflow-session.json | grep -o '"project":"[^"]*"' | cut -d'"' -f4)
# Check keyword match (manual comparison)
# If task contains project keywords → Reuse session
# If task unrelated → Create new session (use Step 2a)
```
@@ -131,9 +129,8 @@ ccw session WFS-promptmaster-platform read workflow-session.json
### Step 2c: Multiple Active Sessions → Use First
```bash
# Get first active session from list
ccw session list --location active
# Use first session_id from result.active array
# Get first active session
bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null | head -1 | xargs basename)
# Output warning and session ID
# WARNING: Multiple active sessions detected
@@ -149,48 +146,26 @@ ccw session list --location active
### Step 1: Generate Unique Session Slug
```bash
# Convert description to slug: lowercase, alphanumeric + hyphen, max 50 chars
# Check if exists via ccw session list, add counter if collision
ccw session list --location active
# Convert to slug
bash(echo "fix login bug" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-50)
# Check if exists, add counter if needed
bash(ls .workflow/active/WFS-fix-login-bug 2>/dev/null && echo "WFS-fix-login-bug-2" || echo "WFS-fix-login-bug")
```
### Step 2: Create Session Structure
```bash
# Basic init - creates directories + default metadata
ccw session init WFS-fix-login-bug --type workflow
# Advanced init - with custom metadata
ccw session init WFS-oauth-implementation --type workflow --content '{"description":"OAuth2 authentication system","priority":"high","complexity":"medium"}'
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.process)
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.task)
bash(mkdir -p .workflow/active/WFS-fix-login-bug/.summaries)
```
**Default Metadata** (auto-generated):
```json
{
"session_id": "WFS-fix-login-bug",
"type": "workflow",
"status": "planning",
"created_at": "2025-12-17T..."
}
### Step 3: Create Metadata
```bash
# Include type field from --type parameter (default: "workflow")
bash(echo '{"session_id":"WFS-fix-login-bug","project":"fix login bug","status":"planning","type":"workflow","created_at":"2024-12-04T08:00:00Z"}' > .workflow/active/WFS-fix-login-bug/workflow-session.json)
```
**Custom Metadata** (merged with defaults):
```json
{
"session_id": "WFS-oauth-implementation",
"type": "workflow",
"status": "planning",
"created_at": "2025-12-17T...",
"description": "OAuth2 authentication system",
"priority": "high",
"complexity": "medium"
}
```
**Field Usage**:
- `description`: Displayed in dashboard (replaces session_id as title)
- `status`: Can override default "planning" (e.g., "active", "implementing")
- Custom fields: Any additional fields are saved and accessible programmatically
**Output**: `SESSION_ID: WFS-fix-login-bug`
## Execution Guideline
@@ -222,36 +197,4 @@ SESSION_ID: WFS-promptmaster-platform
- Pattern: `WFS-[lowercase-slug]`
- Characters: `a-z`, `0-9`, `-` only
- Max length: 50 characters
- Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`)
## session_manager Tool Alternative
The above bash commands can be replaced with `ccw tool exec session_manager`:
### List Sessions
```bash
# List active sessions with metadata
ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'
# Response: {"success":true,"result":{"active":[{"session_id":"WFS-xxx","metadata":{...}}],"total":1}}
```
### Create Session (replaces mkdir + echo)
```bash
# Single command creates directories + metadata
ccw tool exec session_manager '{
"operation": "init",
"session_id": "WFS-my-session",
"metadata": {
"project": "my project description",
"status": "planning",
"type": "workflow",
"created_at": "2025-12-10T08:00:00Z"
}
}'
```
### Read Session Metadata
```bash
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
```
- Uniqueness: Add numeric suffix if collision (`WFS-auth-2`, `WFS-auth-3`)