feat(ccw): add session manager tool with auto workspace detection

- Add session_manager tool for workflow session lifecycle management
- Add ccw session CLI command with subcommands:
  - list, init, status, task, stats, delete, read, write, update, archive, mkdir
- Implement auto workspace detection (traverse up to find .workflow)
- Implement auto session location detection (active, archived, lite-plan, lite-fix)
- Add dashboard notifications for tool executions via WebSocket
- Add granular event types (SESSION_CREATED, TASK_UPDATED, etc.)
- Add status_history auto-tracking for task status changes
- Update workflow session commands to document ccw session usage

🤖 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 19:26:53 +08:00
parent df104d6e9b
commit 598bea9b21
11 changed files with 2003 additions and 6 deletions

View File

@@ -197,4 +197,44 @@ 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`)
- 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"}'
```
### Operation Reference
| Old Pattern | session_manager |
|------------|-----------------|
| `ls .workflow/active/` | `{"operation":"list","location":"active"}` |
| `mkdir -p .../.process .../.task .../.summaries` | `{"operation":"init","session_id":"WFS-xxx"}` |
| `echo '{...}' > workflow-session.json` | `{"operation":"write","content_type":"session","content":{...}}` |
| `cat workflow-session.json` | `{"operation":"read","content_type":"session"}` |