Install
openclaw skills install @myd2002/scan-updatesScan registered Gitea or Obsidian Git material sources manually or on a schedule, detect added modified or deleted files, create incremental compilation jobs, and update source fingerprints.
openclaw skills install @myd2002/scan-updates检查已接入的 Gitea/Obsidian Git 资料源是否有新增、修改、删除文件,并创建增量编译任务。
第一版不做 webhook,支持:
daily_scan_worker.py 触发Activate when:
Do NOT activate when:
batch_compileOpenClaw 字段映射:
SenderId:触发扫描的人 open_idChatType:direct 或 groupGroupSubject:群聊 chat_idMessageSid:消息 id,用于审计群聊手动扫描规则:
GroupSubject -> chat_bindings.json -> team_id 找到当前群绑定团队。SenderId 必须是该团队成员。python3 scripts/scan_updates.py --source_id <source_id> \
--sender_id <SenderId> \
--chat_type <ChatType> \
--chat_id <GroupSubject> \
--message_sid <MessageSid> \
--save_to /tmp/paperkb/updates.json
python3 scripts/run_incremental.py --source_id <source_id> \
--updates_file /tmp/paperkb/updates.json \
--created_by <SenderId> \
--chat_type <ChatType> \
--chat_id <GroupSubject> \
--message_sid <MessageSid>
规则:
<= 100:自动创建 incremental_compile job。> 100:创建确认任务,先给用户预览;如果脚本返回 interactive_card,优先用飞书互动卡片让用户点击确认或取消。python3 scripts/confirm_incremental.py --task_id <task_id> \
--confirmed_by <SenderId> \
--chat_type <ChatType> \
--chat_id <GroupSubject> \
--message_sid <MessageSid>
如果用户点击取消,调用:
python3 scripts/cancel_incremental.py --task_id <task_id> \
--sender_id <SenderId>
收到 scan_updates 卡片按钮回调时,也可以先调用 resolve_card_action.py --action_value <CardActionValue>,再按返回的 command 和 args 执行。
python3 scripts/execute_incremental_job.py --job_id <job_id>
该脚本会:
source_deleted=truedocument_filescode_filesbatch_compile 的分批流程继续处理第一版不在代码里自建定时器。需要在 OpenClaw 控制台配置一个定时任务,按固定频率调用:
python3 scripts/daily_scan_worker.py --threshold 100 --created_by system
它会遍历 sources.json 中 enabled=true 且 auto_update=true 的资料源。
如果 created_by 不是 system,脚本会按用户权限校验是否能扫描该资料源。
代码负责扫描、创建增量 job、记录结果;OpenClaw 控制台负责“几点运行、多久运行一次”。建议第一版配置每日一次,例如每天凌晨或低峰时间运行。
批量编译和增量编译的完成通知不放在 scan_updates 里发。另设一个 OpenClaw 控制定时任务调用 batch_compile/scripts/notify_jobs.py,发现 notify_status=pending 的终态 job 后再发飞书消息并标记 --mark_sent。
source_id + source_path 覆盖旧 summary。source_deleted=true。删除标记也可以单独调用:
python3 scripts/mark_source_deleted.py --owner <owner> --repo <repo> \
--source_id <source_id> --source_path "<path>"
scan_updates.py:扫描单个资料源变化chat_context.py:解析 OpenClaw 群聊上下文和群绑定run_incremental.py:根据变化数创建确认任务或增量 jobresolve_card_action.py:解析增量扫描卡片按钮confirm_incremental.py:确认大批量增量更新cancel_incremental.py:取消待确认的大批量增量更新execute_incremental_job.py:展开增量 job,处理删除标记和待编译队列daily_scan_worker.py:每日扫描 workermark_source_deleted.py:单独标记某个源文件已删除permissions.py:校验个人资料源 owner、团队成员和团队管理员权限cards.py:生成飞书互动卡片 payload