Files
openclaw/tools/kanban.py
Clawd Bot ca9b510922 chore: align with upstream openclaw/openclaw and overlay local additions
- Reset master to upstream/main (16,697 commits)
- Overlay 2,271 local-only files (skills, tools, workspace, configs, apps)
- Restore IDENTITY.md and USER.md templates
- Build verified, gateway running, Discord working

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 07:40:46 +01:00

69 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Kanban API tool — opret, opdater og list opgaver på http://192.168.1.220:5003"""
import sys
import json
import requests
KANBAN = "http://192.168.1.220:5003/api/tasks"
HEADERS = {"X-API-Key": "openclaw-tasks-2026", "Content-Type": "application/json"}
def list_tasks(status=None):
params = {"status": status} if status else {}
return requests.get(KANBAN, headers=HEADERS, params=params).json()
def create(title, description="", status="queue", priority=1, tags=""):
t = requests.post(KANBAN, headers=HEADERS, json={
"title": title,
"description": description,
"status": status,
"priority": priority,
"tags": tags,
}).json()
print(f"✅ Oprettet #{t['id']} [{t['status']}] {t['title']}")
return t
def update(task_id, **fields):
t = requests.patch(f"{KANBAN}/{task_id}", headers=HEADERS, json=fields).json()
print(f"✅ #{t['id']}{t['status']} | {t['title']}")
return t
def done(task_id):
return update(task_id, status="done")
def cancel(task_id):
return update(task_id, status="cancelled")
def start(task_id):
return update(task_id, status="in_progress")
def show(status=None):
tasks = list_tasks(status)
if not tasks:
print("(ingen opgaver)")
return
for t in tasks:
tags = f" [{t['tags']}]" if t.get('tags') else ""
print(f" #{t['id']:>4} [{t['status']:<11}] {t['title']}{tags}")
if __name__ == "__main__":
cmd = sys.argv[1] if len(sys.argv) > 1 else "list"
if cmd == "list":
show(sys.argv[2] if len(sys.argv) > 2 else None)
elif cmd == "done" and len(sys.argv) > 2:
done(sys.argv[2])
elif cmd == "start" and len(sys.argv) > 2:
start(sys.argv[2])
elif cmd == "cancel" and len(sys.argv) > 2:
cancel(sys.argv[2])
else:
print("Brug: kanban.py [list|done|start|cancel] [id]")