Skill: freedompixels/cn-todo-tracker (version 1.2.5)

--- slug: cn-todo-tracker name: 任务清单追踪 version: "1.0.0" author: 千策 --- # ✅ CN Todo Tracker — 中文待办事项 管理你的待办，一件件搞定。 ## 核心功能 | 功能 | 说明 | |------|------| | 添加待办 | 一句话添加，自动识别优先级 | | 完成标记 | 标记完成，记录完成时间 | | 列表查看 | 按优先级排序，今日/本周/全部 | | 统计 | 完成率、待办趋势 | ## 使用方式 ```bash # 添加待办 python3 scripts/todo.py --add "完成周报" --priority high python3 scripts/todo.py --add "回复客户邮件" --priority medium python3 scripts/todo.py --add "整理桌面" # 完成待办 python3 scripts/todo.py --done 1 # 查看待办 python3 scripts/todo.py --list python3 scripts/todo.py --today # 统计 python3 scripts/todo.py --stats ``` ## 数据存储 本地 JSON：~/.qclaw/workspace/todos.json

path: scripts/todo.py
content: #!/usr/bin/env python3
"""中文待办事项 - cn-todo-tracker"""

import json, os, sys, argparse
from datetime import datetime

WORKSPACE = os.path.expanduser("~/.qclaw/workspace")
DATA_FILE = os.path.join(WORKSPACE, "todos.json")

PRIORITIES = {"high": "🔴", "medium": "🟡", "low": "🟢"}

def load():
    if os.path.exists(DATA_FILE):
        with open(DATA_FILE, "r", encoding="utf-8") as f:
            return json.load(f)
    return {"todos": [], "next_id": 1}

def save(data):
    with open(DATA_FILE, "w", encoding="utf-8") as f:
        json.dump(data, f, ensure_ascii=False, indent=2)

def add_todo(text, priority="medium"):
    data = load()
    todo = {
        "id": data["next_id"],
        "text": text,
        "priority": priority,
        "done": False,
        "created": datetime.now().isoformat(),
        "completed": None
    }
    data["todos"].append(todo)
    data["next_id"] += 1
    save(data)
    emoji = PRIORITIES.get(priority, "🟡")
    print(f"\n✅ {emoji} [{todo['id']}] {text}")

def done_todo(todo_id):
    data = load()
    for t in data["todos"]:
        if t["id"] == todo_id and not t["done"]:
            t["done"] = True
            t["completed"] = datetime.now().isoformat()
            save(data)
            print(f"\n🎉 完成待办 [{todo_id}] {t['text']}")
            return
    print(f"\n⚠️ 未找到待办 #{todo_id}")

def list_todos(show="all"):
    data = load()
    todos = data["todos"]
    if show == "today":
        today = datetime.now().strftime("%Y-%m-%d")
        todos = [t for t in todos if t["created"].startswith(today)]
    elif show == "pending":
        todos = [t for t in todos if not t["done"]]

    if not todos:
        print("\n📭 没有待办事项")
        return

    # 按优先级排序
    order = {"high": 0, "medium": 1, "low": 2}
    todos.sort(key=lambda t: (t["done"], order.get(t["priority"], 1)))

    print("\n✅ 待办事项")
    print("=" * 40)
    for t in todos:
        emoji = PRIORITIES.get(t["priority"], "🟡")
        status = "☑️" if t["done"] else "☐"
        print(f"  {status} {emoji} [{t['id']}] {t['text']}")

def stats():
    data = load()
    todos = data["todos"]
    total = len(todos)
    done = sum(1 for t in todos if t["done"])
    pending = total - done
    rate = done / total * 100 if total else 0
    bar = "▓" * int(rate / 10) + "░" * (10 - int(rate / 10))
    print(f"\n📊 待办统计")
    print(f"  总计: {total} | 完成: {done} | 待做: {pending}")
    print(f"  完成率: {rate:.0f}% {bar}")

def main():
    parser = argparse.ArgumentParser(description="✅ 中文待办事项")
    parser.add_argument("--add", help="添加待办")
    parser.add_argument("--priority", "-p", default="medium", choices=["high", "medium", "low"])
    parser.add_argument("--done", type=int, help="完成待办（ID）")
    parser.add_argument("--list", action="store_true", help="全部待办")
    parser.add_argument("--today", action="store_true", help="今日待办")
    parser.add_argument("--stats", action="store_true", help="统计")
    args = parser.parse_args()

    if args.add:
        add_todo(args.add, args.priority)
    elif args.done:
        done_todo(args.done)
    elif args.today:
        list_todos("today")
    elif args.stats:
        stats()
    else:
        list_todos("pending")

if __name__ == "__main__":
    main()

Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)