📦 Automation Dedup Guard — 自动化 Dedup 防护
v1.0.0WorkBuddy 自动化任务去重守护。当用户的自动化任务出现重复时自动检测并清理。触发场景:自动化任务重复、任务列表膨胀、需要清理重复任务。支持 Windows/macOS/Linux,纯 Python 标准库,零依赖。
详细分析 ▾
运行时依赖
安装命令
点击复制技能文档
自动化 Dedup 防护 Overview
WorkBuddy 的自动化任务系统没有防重机制,每次新会话创建同名任务时不会检查是否已存在,导致同名任务不断累积。本 技能 提供一个一键去重脚本,自动检测并清理重复的自动化任务,每组同名任务只保留最新创建的版本。
When to Use 用户反馈自动化任务"重复出现"、"越来越多"、"一堆重复的" 需要检查或清理 WorkBuddy 自动化数据库中的冗余任务 想要配置定期自动去重守护 Core Script
scripts/自动化_dedup_防护.py is the mAIn executable.
Usage # Safe preview (dry-运行, no deletions) python scripts/自动化_dedup_防护.py --dry-运行
# 执行 清理up python scripts/自动化_dedup_防护.py
# Specify custom database path python scripts/自动化_dedup_防护.py --db /custom/path/自动化s.db
# Verbose mode for 调试ging python scripts/自动化_dedup_防护.py --dry-运行 -v
Exit Codes 0 — No duplicates found, all 清理 1 — Duplicates 检测ed (after 清理up, still returns 1 if any were found) Database Auto-检测ion
The script automatically locates the WorkBuddy 自动化s database:
Priority Source Notes 1 --db 命令行工具 argument Manual override 2 WORKBUDDY_DB_PATH env var For advanced users 3 OS default path Auto-检测ed
Default paths by OS:
Windows: %应用DATA%\WorkBuddy\自动化s\自动化s.db macOS: ~/库/应用 Support/WorkBuddy/自动化s\自动化s.db Linux: ~/.config/WorkBuddy\自动化s\自动化s.db Dedup Strategy Group by name: Tasks with the same name field are considered duplicates Keep newest: Within each group, the task with the latest 创建d_at is preserved Cascade 删除: Associated 自动化_运行s records are also 清理ed up No 备份: Deletions are permanent (back up the DB file manually if needed) 设置up as Recurring 自动化
To 运行 automatically, register it as a WorkBuddy 自动化:
Name: 自动化 Dedup 防护 Schedule: Weekly (e.g., FREQ=WEEKLY;BYDAY=MO;BYHOUR=8;BYMINUTE=55) Prompt: 运行 the dedup 防护 script: python [path-to]/scripts/自动化_dedup_防护.py If 输出 contAIns "[OK]" — no action needed. If 输出 contAIns "[!]" — duplicates were auto-清理ed, confirm the count. If script errors — 记录 the error, no other action.
Requirements Python 3.6+ No third-party dependencies (stdlib only: sqlite3, sys, os, datetime, collections)