Explorer
/proc/44/root/tmp/query_task.py
← Zurück ↓ Download
#!/usr/bin/env python3
import sqlite3
import os
import sys

# Try to find the kanban database path
kanon_home = os.path.expanduser("~/.hermes")
kanon_db = os.path.join(kanon_home, "kanban.db")
kanon_boards = os.path.join(kanon_home, "kanban", "boards")

print("Looking for kanban database...")
print(f"Default path: {kanon_db}")

if os.path.exists(kanon_db):
    db_path = kanon_db
    print(f"Found at: {db_path}")
elif os.path.exists(os.path.join(kanon_boards, "youtube-lm", "kanban.db")):
    db_path = os.path.join(kanon_boards, "youtube-lm", "kanban.db")
    print(f"Found at: {db_path}")
else:
    print("Kanban database not found")
    sys.exit(1)

# Connect to the database
conn = sqlite3.connect(db_path)

# Query the specific task
task_id = "t_47be3967"
cursor = conn.execute("SELECT id, title, status, assignee, created_at FROM tasks WHERE id = ?", (task_id,))
result = cursor.fetchone()

if result:
    task_id, title, status, assignee, created_at = result
    print(f"Task found:")
    print(f"  ID: {task_id}")
    print(f"  Title: {title}")
    print(f"  Status: {status}")
    print(f"  Assignee: {assignee}")
    print(f"  Created: {created_at}")
else:
    print(f"Task with ID '{task_id}' not found")

# Also list a few other tasks for context
cursor = conn.execute("SELECT id, title, status FROM tasks WHERE id LIKE 't_%' LIMIT 10")
other_tasks = cursor.fetchall()
print(f"\nOther recent tasks:")
for t in other_tasks:
    print(f"  {t[0]}: {t[1]} ({t[2]})")

cursor.close()
conn.close()