微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📅

终端CalDAV同步与日历管理

Caldav Calendar · v1.0.0
productivity 安全 S+ 级 榜单 #8 作者 asleep123 公开目录收录
26.7k 下载 212 安装 103.2k 收藏 56 浏览

简介

基于vdirsyncer+khal的纯文档型CalDAV日历同步方案,支持iCloud/Google/Nextcloud等多平台,顶级安全无代码风险

原始描述

Sync and query CalDAV calendars (iCloud, Google, Fastmail, Nextcloud, etc.) using vdirsyncer + khal. Works on Linux.

通过你的 Agent 添加

安装目录:caldav-calendar/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/caldav-calendar-7776/
Codex CLI~/.codex/skills/caldav-calendar-7776/
DeepSeek Harness~/.agents/skills/caldav-calendar-7776/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

本Skill提供完整的CalDAV日历同步与CLI管理方案,基于两个成熟开源工具:

  • vdirsyncer:双向同步引擎,支持iCloud、Google Calendar、Fastmail、Nextcloud等主流CalDAV服务
  • khal:终端日历查看器,提供列表、日历视图、事件创建、搜索等完整功能

典型工作流:

  1. 安装工具并配置vdirsyncer(需提供商的CalDAV端点+认证信息)
  2. 首次执行vdirsyncer discover发现所有日历
  3. 日常vdirsyncer sync保持本地与云端同步
  4. 使用khal list/calendar/interactive查看和管理事件

脚本友好:支持自定义输出格式,便于与其他工具集成。


显著优点

维度 优势
服务兼容性 覆盖iCloud、Google、Fastmail、Nextcloud及任意CalDAV服务器
离线可用 本地ICS文件存储,无网络也能查看日程
双向同步 本地修改可安全写回云端
极轻量级 纯CLI,资源占用极低,适合服务器/嵌入式场景
隐私优先 数据存储本地,无需信任第三方客户端
自动化友好 易于cron/systemd定时同步,输出可解析

潜在缺点与局限性

  • 配置门槛高:需手动编辑INI配置文件,理解CalDAV端点、OAuth流程、应用专用密码等概念
  • 无图形界面:纯终端工具,对非技术用户不够友好
  • iCloud限制:必须使用应用专用密码,且Apple可能调整端点
  • Google OAuth复杂度:需创建GCP项目获取client_id/secret,首次授权需浏览器交互
  • 无提醒/通知功能:khal仅查看,闹钟需配合其他工具(如vdirsyncer+khal+notify-send组合)
  • 冲突处理简单:默认"a wins"策略,复杂冲突需手动干预

适合人群

  • Linux桌面/服务器用户,偏好终端工作流
  • 隐私敏感型用户,拒绝商业日历客户端的数据收集
  • 开发者/DevOps,需要将日历数据集成到脚本或自动化流程
  • 多平台日历用户,需统一管理iCloud+Google+工作日历
  • 追求极简、可审计工具链的技术爱好者

常规风险

风险点 说明 缓解措施
凭证泄露 密码存储在本地明文文件 chmod 600限制权限;使用应用专用密码;考虑密码管理器集成
同步冲突 多端同时修改同一事件 配置合理的conflict_resolution策略;定期手动检查
服务变更 提供商API/端点调整 关注vdirsyncer更新;保留配置文件备份
OAuth令牌过期 Google等需定期刷新 首次配置时保存token文件;异常时重新授权
数据丢失 本地误删或同步配置错误 定期备份~/.local/share/vdirsyncer/目录;启用版本控制

总体评估:技术成熟、社区维护活跃、隐私架构优良,适合有Linux基础的用户作为主力日历方案。

技能正文


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)

Cross-platform CalDAV sync and CLI calendar viewer. Works with iCloud, Google Calendar, Fastmail, Nextcloud, and any CalDAV provider.

Installation

sudo apt install vdirsyncer khal

Initial Setup

1. Create config directories

mkdir -p ~/.config/vdirsyncer ~/.local/share/vdirsyncer ~/.local/share/khal

2. Configure vdirsyncer (~/.config/vdirsyncer/config)

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 = "your@icloud.com"
# Generate app-specific password at https://appleid.apple.com/
password.fetch = ["command", "cat", "~/.config/vdirsyncer/icloud_password"]

[storage icloud_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/calendars/"
fileext = ".ics"

For Google Calendar:

[storage google_remote]
type = "google_calendar"
token_file = "~/.config/vdirsyncer/google_token"
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"

For generic CalDAV (Nextcloud, Fastmail, etc.):

[storage caldav_remote]
type = "caldav"
url = "https://your.server.com/remote.php/dav/calendars/username/"
username = "user"
password.fetch = ["command", "cat", "~/.config/vdirsyncer/password"]

3. Discover and sync calendars

vdirsyncer discover   # First time: finds all calendars
vdirsyncer sync       # Syncs all configured calendars

4. Configure khal (~/.config/khal/config)

[calendars]

[[icloud]]
path = ~/.local/share/vdirsyncer/calendars/*
type = discover

[default]
default_calendar = Calendar
highlight_event_days = True

[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M

Daily Use

Sync calendars (ALWAYS run before queries)

vdirsyncer sync

Important: Always sync before checking events to get the latest additions/deletions.

View events

khal list                      # Today's events
khal list today                # Same as above
khal list tomorrow             # Tomorrow
khal list today 7d             # Next 7 days
khal list 2026-01-04           # Specific date
khal list 2026-01-04 2026-01-10  # Date range

Quick agenda

khal calendar                  # Calendar view with events

Create events

khal new 2026-01-05 10:00 11:00 "Meeting with Bob"
khal new 2026-01-05 "All day event" :: Description here
khal new tomorrow 14:00 15:30 "Call" -a work  # Specific calendar

Interactive mode

khal interactive               # TUI for browsing/editing

Search events

khal search "meeting"          # Search event titles/descriptions

Output Formats

For scripting:

khal list --format "{start} {title}" today 7d
khal list --format "{start-date} {start-time}-{end-time} {title} [{calendar}]" today 7d

Format placeholders: {title}, {description}, {start}, {end}, {start-date}, {start-time}, {end-date}, {end-time}, {location}, {calendar}, {uid}

Automation

Sync on a schedule (add to crontab or systemd timer):

# Every 15 minutes
*/15 * * * * vdirsyncer sync > /dev/null 2>&1

Troubleshooting

  • iCloud "Authentication failed": Make sure you're using an app-specific password, not your main password
  • Google OAuth: Run vdirsyncer discover in a terminal with browser access for initial auth
  • Permissions: Some servers need exact calendar URLs. Check provider docs.
  • Debug mode: vdirsyncer sync --verbosity=DEBUG

Provider-Specific URLs

  • iCloud: https://caldav.icloud.com/
  • Google: Use google_calendar storage type (OAuth)
  • Fastmail: https://caldav.fastmail.com/dav/calendars/user/you@fastmail.com/
  • Nextcloud: https://your.cloud/remote.php/dav/calendars/USERNAME/

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

caldavcalendarsyncvdirsyncerkhalicloudgoogle-calendarnextcloudcliprivacyoffline-firstlinuxproductivity

同类 Skill