caldav-calendar について
vdirsyncer で CalDAV カレンダーを同期し、khal で予定を表示・変更するスキルです。検索や編集、スクリプト向けの出力を含むコマンドラインでのカレンダー管理に使えます。
主な機能
- 01CalDAV カレンダーをローカルの .ics ファイルに同期
- 02日付範囲やカレンダーを指定して予定を表示
- 03予定の検索と出力項目の指定
- 04予定の作成、編集、削除
- 05スクリプト向け形式で予定一覧を出力
活用シーン
- 01指定期間の予定を確認
- 02テキストで会議を検索
- 03予定を追加または更新して変更を同期
- 04スクリプトで扱いやすい形式で予定の詳細を出力
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ sundial-org/ awesome-openclaw-skills --skill caldav-calendarインストール後、Claude Code で/caldav-calendarを入力して読み込まれたか確認します。
詳細
CalDAV カレンダー(vdirsyncer + khal)
vdirsyncer は CalDAV カレンダーをローカルの .ics ファイルに同期します。khal はそれらの読み取りと書き込みを行います。
同期してから操作
検索する前、または変更を加えた後は、必ず同期してください。
vdirsyncer sync
イベントを表示
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}"
イベントを作成
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
作成後、変更を反映するために同期します。
vdirsyncer sync
イベントを編集(対話形式)
khal edit は対話形式のため、TTY が必要です。自動化する場合は tmux を使用してください。
khal edit "search term"
khal edit -a CalendarName "search term"
khal edit --show-past "old event"
メニューのオプション:
s→ 概要を編集d→ 説明を編集t→ 日時の範囲を編集l→ 場所を編集D→ イベントを削除n→ スキップ(変更を保存し、次の一致項目へ)q→ 終了
編集後、同期します。
vdirsyncer sync
イベントを削除
khal edit を使用し、D を押して削除します。
出力形式
スクリプトで使用する場合:
khal list --format "{start-date} {start-time}-{end-time} {title}" today 7d
khal list --format "{uid} | {title} | {calendar}" today
プレースホルダー:{title}、{description}、{start}、{end}、{start-date}、{start-time}、{end-date}、{end-time}、{location}、{calendar}、{uid}
キャッシュ
khal は ~/.local/share/khal/khal.db にイベントをキャッシュします。同期後もデータが古く見える場合:
rm ~/.local/share/khal/khal.db
初期設定
1. vdirsyncer を設定する(~/.config/vdirsyncer/config)
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"
プロバイダーの URL:
- iCloud:
https://caldav.icloud.com/ - Google:
google_calendarストレージタイプを使用 - Fastmail:
https://caldav.fastmail.com/dav/calendars/user/EMAIL/ - Nextcloud:
https://YOUR.CLOUD/remote.php/dav/calendars/USERNAME/
2. 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. 検出して同期する
vdirsyncer discover # First time only
vdirsyncer sync
コメント
Markdown 対応