blob: 7f7d59f73a3d1737662a3e3d5a0ea8f3348e2ddf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env python3
"""
Example CTASK_SESSIONS script in Python
Usage:
export CTASK_SESSIONS=/path/to/this/script
ctask select
"""
import json
from pathlib import Path
def get_sessions():
sessions_dir = Path.home() / ".claude" / "tasks"
sessions = []
if not sessions_dir.exists():
return sessions
for session_dir in sorted(sessions_dir.iterdir(), key=lambda p: p.stat().st_mtime, reverse=True):
if session_dir.is_dir():
task_files = list(session_dir.glob("*.json"))
if task_files:
sessions.append({
"name": session_dir.name,
"path": str(session_dir),
"description": f"Session with {len(task_files)} task(s)"
})
return sessions
if __name__ == "__main__":
sessions = get_sessions()
print(json.dumps(sessions, indent=2))
|