介绍
# iCloud Calendar Sync Skill
在本地系统和 iCloud 之间同步日历事件。
## ⚠️ 安全要求
**关键 - 安装前必读:**
### 1. 仅使用专用密码
- 在 https://appleid.apple.com/account/security 生成 - **切勿使用您的 Apple ID 主密码** - 如果泄露可以随时撤销
### 2. 使用操作系统密钥环存储凭据
该技能将凭据安全地存储在您操作系统的密钥环中: - **macOS**: 钥匙串 - **Windows**: 凭据管理器 - **Linux**: Secret Service API
### 3. 对于无头/自动化环境
对于 Docker、CI/CD 或无法进行交互式输入的无头服务器:
**选项 A:环境变量**(标准、安全的方法) ```bash # Set credentials as environment variables export ICLOUD_USERNAME="[email protected]" export ICLOUD_APP_PASSWORD="xxxx-xxxx-xxxx-xxxx"
# Run setup python -m icalendar_sync setup --non-interactive ```
**选项 B:Docker/Kubernetes Secrets**(容器最安全的方法) ```bash # Docker secrets docker run --secret icloud_username --secret icloud_password ...
# Kubernetes secrets kubectl create secret generic icloud-credentials \ [email protected] \ --from-literal=password=xxxx-xxxx-xxxx-xxxx ```
凭据按以下顺序读取: 1. 操作系统密钥环(如果可用且已配置) 2. 环境变量(如果密钥环不可用) 3. 交互式提示(如果两者都不可用)
## 安装
```bash ./install.sh ```
## 用法
### 设置凭据(交互式)
```bash # Interactive mode - password prompted securely python -m icalendar_sync setup --username [email protected] ```
密码将通过交互式提示输入,并存储在操作系统密钥环中。
### 列出日历
```bash python -m icalendar_sync list ```
### 获取日历事件
```bash python -m icalendar_sync get --calendar "Personal" --days 7 ```
### 创建事件
```bash python -m icalendar_sync create \ --calendar "Personal" \ --json '{ "summary": "Meeting", "dtstart": "2026-02-15T14:00:00+03:00", "dtend": "2026-02-15T15:00:00+03:00" }' ```
### 更新事件
**更新简单事件:** ```bash python -m icalendar_sync update \ --calendar "Personal" \ --uid "event-uid-here" \ --json '{"summary": "Updated Meeting Title"}' ```
**更新循环事件的单个实例:** ```bash python -m icalendar_sync update \ --calendar "Work" \ --uid "recurring-event-uid" \ --recurrence-id "2026-02-20T09:00:00+03:00" \ --mode single \ --json '{"dtstart": "2026-02-21T09:00:00+03:00"}' ```
**更新所有实例:** ```bash python -m icalendar_sync update \ --calendar "Work" \ --uid "recurring-event-uid" \ --mode all \ --json '{"summary": "New Title for All Instances"}' ```
**更新此实例及未来实例:** ```bash python -m icalendar_sync update \ --calendar "Work" \ --uid "recurring-event-uid" \ --recurrence-id "2026-03-01T09:00:00+03:00" \ --mode future \ --json '{"dtstart": "2026-03-01T14:00:00+03:00"}' ```
### 删除事件
```bash python -m icalendar_sync delete --calendar "Personal" --uid "event-uid-here" ```
## 要求
- Python 3.9+ - iCloud 专用密码 - 能够访问 iCloud CalDAV 服务器 (caldav.icloud.com:443)
## 安全特性
- ✅ 集成操作系统密钥环用于凭据存储 - ✅ 要求使用专用密码(非主密码) - ✅ 强制执行 SSL/TLS 验证 - ✅ 速率限制(每 60 秒 10 次调用) - ✅ 日志中自动脱敏凭据 - ✅ 对所有用户输入进行验证
## 许可证
MIT