首页
看点啥
插画图片
首页 科技看点 CalDAV 日历:通过 CLI 同步和管理日历 - Openclaw Skills

CalDAV 日历:通过 CLI 同步和管理日历 - Openclaw Skills

2026-08-17 0

什么是 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/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 caldav-calendar。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

CalDAV 日历同步与管理 应用场景

CalDAV 日历同步与管理 工作原理
  1. 工作流程从 vdirsyncer 开始,它连接到远程 CalDAV 服务器以获取事件并将其同步到本地 .ics 文件中。
  2. 用户使用 khal 与本地化数据进行交互,以列出、搜索或显示特定的日期范围和事件详情。
  3. 通过 khal 命令在本地创建新事件或编辑现有事件,这将更新本地文件系统存储。
  4. 使用 vdirsyncer 进行最终同步步骤,将本地修改推回远程服务器,以保持所有设备之间的一致性。
  5. Openclaw Skills 在本地 SQLite 数据库中维护内部缓存,以确保高性能的查询和搜索。

CalDAV 日历同步与管理 配置指南

要开始在 Linux 上使用此技能,请使用包管理器安装必要的二进制文件:

sudo apt update && sudo apt install vdirsyncer khal
  1. ~/.config/vdirsyncer/config 创建配置文件,并为您的特定提供商(例如 iCloud 或 Google)定义 storagepair 部分。
  2. ~/.config/khal/config 创建 khal 配置,指向 vdirsyncer 使用的本地存储路径。
  3. 运行探索和初始同步命令以填充本地数据库。此设置对于启用 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
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:

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:

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
喜欢(0)

上一篇

低空经济适航破局:eVTOL电推进系统热管理攻坚、飞控冗余AI验证与城市空域运行安全体系实战

低空经济适航破局:eVTOL电推进系统热管理攻坚、飞控冗余AI验证与城市空域运行安全体系实战

下一篇

鹅鸭杀手游阵营与身份玩法是什么

鹅鸭杀手游阵营与身份玩法是什么
猜你喜欢