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

# Navigate to the kanban directory
kanon_home = os.path.expanduser("~/.hermes")
kanon_boards = os.path.join(kanon_home, "kanban", "boards")

db_path = os.path.join(kanon_boards, "youtube-lm", "kanban.db")

print(f"Trying to access: {db_path}")
print(f"Exists: {os.path.exists(db_path)}")

if os.path.exists(db_path):
    try:
        # Connect to the database
        conn = sqlite3.connect(db_path)
        conn.row_factory = sqlite3.Row
        
        # Query the specific task
        task_id = "t_47be3967"
        cursor = conn.execute("SELECT id, title, status, assignee, created_at, body, priority FROM tasks WHERE id = ?", (task_id,))
        result = cursor.fetchone()
        
        if result:
            print(f"Task found:")
            print(f"  ID: {result['id']}")
            print(f"  Title: {result['title']}")
            print(f"  Status: {result['status']}")
            print(f"  Assignee: {result['assignee']}")
            print(f"  Created: {result['created_at']}")
            print(f"  Priority: {result['priority']}")
            print(f"  Body: {result['body'][:200] if result['body'] else 'None'}...")
        else:
            print(f"Task with ID '{task_id}' not found")
            
            # List some tasks from this board to see what's there
            cursor = conn.execute("SELECT id, title, status FROM tasks WHERE id LIKE 't_%' LIMIT 20")
            tasks = cursor.fetchall()
            print(f"\nSome tasks from this board:")
            for t in tasks:
                print(f"  {t['id']}: {t['title']} ({t['status']})")
            
    except Exception as e:
        print(f"Error accessing database: {e}")
        import traceback
        traceback.print_exc()
    finally:
        try:
            conn.close()
        except:
            pass
else:
    print(f"Database not found at: {db_path}")
    
    # List available boards
    if os.path.exists(kanon_boards):
        print(f"\nAvailable boards in {kanon_boards}:")
        for item in os.listdir(kanon_boards):
            board_path = os.path.join(kanon_boards, item)
            if os.path.isdir(board_path):
                db_file = os.path.join(board_path, "kanban.db")
                if os.path.exists(db_file):
                    print(f"  - {item}: {db_file}")