最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
CalDAV 日历:通过 CLI 同步和管理日历 - Openclaw Skills
时间:2026-08-18 16:24:01 编辑:袖梨 来源:一聚教程网
什么是 CalDAV 日历同步与管理?
该技能实现了远程 CalDAV 提供商与本地命令行环境之间的无缝集成。通过利用 Openclaw Skills,开发人员和高级用户可以直接从终端与 iCloud、Google、Fastmail 和 Nextcloud 日历进行交互。它利用 vdirsyncer 作为强大的同步引擎来处理本地目录与远程服务器之间的双向更新,而 khal 则提供用于列出、搜索和创建日历事件的主要界面。
该工具集专为 Linux 环境设计,在基于云的日程安排服务与基于终端的生产力工作流之间架起了一座桥梁。它允许通过本地 .ics 文件存储离线访问日历数据,确保 Openclaw Skills 即使在没有活动互联网连接的情况下也能通过与缓存数据交互来运行。
下载入口:https://github.com/openclaw/skills/tree/main/skills/asleep123/caldav-calendar安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install caldav-calendar
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 caldav-calendar。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
CalDAV 日历同步与管理 应用场景
- 在自定义 shell 脚本或代理工作流中自动进行日历查询和事件列表展示。
- 在一个终端界面中统一管理包括 iCloud、Google 和 Nextcloud 在内的多个日历提供商。
- 作为使用 Openclaw Skills 的开发人员生产力套件的一部分,以编程方式创建日历事件和会议。
- 无需打开沉重的浏览器或 GUI 应用程序即可快速搜索历史事件和未来预约。
- 工作流程从 vdirsyncer 开始,它连接到远程 CalDAV 服务器以获取事件并将其同步到本地 .ics 文件中。
- 用户使用 khal 与本地化数据进行交互,以列出、搜索或显示特定的日期范围和事件详情。
- 通过 khal 命令在本地创建新事件或编辑现有事件,这将更新本地文件系统存储。
- 使用 vdirsyncer 进行最终同步步骤,将本地修改推回远程服务器,以保持所有设备之间的一致性。
- Openclaw Skills 在本地 SQLite 数据库中维护内部缓存,以确保高性能的查询和搜索。
CalDAV 日历同步与管理 配置指南
要开始在 Linux 上使用此技能,请使用包管理器安装必要的二进制文件:
sudo apt update && sudo apt install vdirsyncer khal
- 在
~/.config/vdirsyncer/config创建配置文件,并为您的特定提供商(例如 iCloud 或 Google)定义storage和pair部分。 - 在
~/.config/khal/config创建 khal 配置,指向 vdirsyncer 使用的本地存储路径。 - 运行探索和初始同步命令以填充本地数据库。此设置对于启用 Openclaw Skills 访问您的日程表至关重要:
vdirsyncer discover
vdirsyncer sync
CalDAV 日历同步与管理 数据架构与分类体系
该技能通过配置文件、原始 .ics 文件和本地缓存数据库的组合来组织日历数据:
| 组件 | 用途 | 默认路径 |
|---|---|---|
| vdirsyncer 配置 | 定义远程同步配对和身份验证 | ~/.config/vdirsyncer/config |
| khal 配置 | 定义日历显示和区域设置 | ~/.config/khal/config |
| ICS 存储 | 原始日历事件文件 (.ics) | ~/.local/share/vdirsyncer/calendars/ |
| 元数据状态 | 跟踪同步状态 | ~/.local/share/vdirsyncer/status/ |
| 事件缓存 | khal 用于快速查找的 SQLite 数据库 | ~/.local/share/khal/khal.db |
name: caldav-calendar
description: Sync and query CalDAV calendars (iCloud, Google, Fastmail, Nextcloud, etc.) using vdirsyncer + khal. Works on Linux.
metadata: {"clawdbot":{"emoji":"??","os":["linux"],"requires":{"bins":["vdirsyncer","khal"]},"install":[{"id":"apt","kind":"apt","packages":["vdirsyncer","khal"],"bins":["vdirsyncer","khal"],"label":"Install vdirsyncer + khal via apt"}]}}
CalDAV Calendar (vdirsyncer + khal)
vdirsyncer syncs CalDAV calendars to local .ics files. khal reads and writes them.
Sync First
Always sync before querying or after making changes:
vdirsyncer sync
View Events
khal list # Today
khal list today 7d # Next 7 days
khal list tomorrow # Tomorrow
khal list 2026-01-15 2026-01-20 # Date range
khal list -a Work today # Specific calendar
Search
khal search "meeting"
khal search "dentist" --format "{start-date} {title}"
Create Events
khal new 2026-01-15 10:00 11:00 "Meeting title"
khal new 2026-01-15 "All day event"
khal new tomorrow 14:00 15:30 "Call" -a Work
khal new 2026-01-15 10:00 11:00 "With notes" :: Description goes here
After creating, sync to push changes:
vdirsyncer sync
Edit Events (interactive)
khal edit is interactive — requires a TTY. Use tmux if automating:
khal edit "search term"
khal edit -a CalendarName "search term"
khal edit --show-past "old event"
Menu options:
s→ edit summaryd→ edit descriptiont→ edit datetime rangel→ edit locationD→ delete eventn→ skip (save changes, next match)q→ quit
After editing, sync:
vdirsyncer sync
Delete Events
Use khal edit, then press D to delete.
Output Formats
For scripting:
khal list --format "{start-date} {start-time}-{end-time} {title}" today 7d
khal list --format "{uid} | {title} | {calendar}" today
Placeholders: {title}, {description}, {start}, {end}, {start-date}, {start-time}, {end-date}, {end-time}, {location}, {calendar}, {uid}
Caching
khal caches events in ~/.local/share/khal/khal.db. If data looks stale after syncing:
rm ~/.local/share/khal/khal.db
Initial Setup
1. Configure vdirsyncer (~/.config/vdirsyncer/config)
Example for iCloud:
[general]
status_path = "~/.local/share/vdirsyncer/status/"
[pair icloud_calendar]
a = "icloud_remote"
b = "icloud_local"
collections = ["from a", "from b"]
conflict_resolution = "a wins"
[storage icloud_remote]
type = "caldav"
url = "https://caldav.icloud.com/"
username = "[email protected]"
password.fetch = ["command", "cat", "~/.config/vdirsyncer/icloud_password"]
[storage icloud_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/calendars/"
fileext = ".ics"
Provider URLs:
- iCloud:
https://caldav.icloud.com/ - Google: Use
google_calendarstorage type - Fastmail:
https://caldav.fastmail.com/dav/calendars/user/EMAIL/ - Nextcloud:
https://YOUR.CLOUD/remote.php/dav/calendars/USERNAME/
2. Configure khal (~/.config/khal/config)
[calendars]
[[my_calendars]]
path = ~/.local/share/vdirsyncer/calendars/*
type = discover
[default]
default_calendar = Home
highlight_event_days = True
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
3. Discover and sync
vdirsyncer discover # First time only
vdirsyncer sync
相关文章
- 《黎明杀机》黑护符和白护手的效果解析 08-18
- 《黎明杀机》工具箱附加品搭配说明 08-18
- 《黎明杀机》大张伟传承技能详情说明 08-18
- 《黎明杀机》黑妹传承技能图文说明 08-18
- 黎明杀机会加入艾伦韦克这一可玩角色 08-18
- 《黎明杀机》《心灵杀手》即将联动 08-18