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

@@ -93,4 +93,40 @@ ls .workflow/active/WFS-* | wc -l
# Show recent sessions
ls -t .workflow/active/WFS-*/workflow-session.json | head -3
```
```
## session_manager Tool Alternative
Use `ccw tool exec session_manager` for simplified session listing:
### List All Sessions (Active + Archived)
```bash
ccw tool exec session_manager '{"operation":"list","location":"both","include_metadata":true}'
# Response:
# {
# "success": true,
# "result": {
# "active": [{"session_id":"WFS-xxx","metadata":{...}}],
# "archived": [{"session_id":"WFS-yyy","metadata":{...}}],
# "total": 2
# }
# }
```
### List Active Sessions Only
```bash
ccw tool exec session_manager '{"operation":"list","location":"active","include_metadata":true}'
```
### Read Specific Session
```bash
ccw tool exec session_manager '{"operation":"read","session_id":"WFS-xxx","content_type":"session"}'
```
### Operation Reference
| Old Pattern | session_manager |
|------------|-----------------|
| `ls .workflow/active/WFS-*` | `{"operation":"list","location":"active"}` |
| `find ... -type d` | `{"operation":"list"}` returns session_id list |
| `jq -r '.status' session.json` | `{"operation":"read","content_type":"session"}` |
| `cat workflow-session.json` | `{"operation":"read","content_type":"session"}` |