macos-calendar
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesemacOS Calendar
macOS 日历
Manage Apple Calendar events via . All date handling uses relative math () to avoid locale issues (FR/EN/DE date formats).
$SKILL_DIR/scripts/calendar.shcurrent date + N * days通过管理Apple Calendar事件。所有日期处理采用相对计算()以避免本地化问题(法/英/德日期格式差异)。
$SKILL_DIR/scripts/calendar.shcurrent date + N * daysQuick start
快速开始
List calendars
列出日历
Always list calendars first to find the correct calendar name:
bash
"$SKILL_DIR/scripts/calendar.sh" list-calendars请始终先查询日历列表,以找到正确的日历名称:
bash
"$SKILL_DIR/scripts/calendar.sh" list-calendarsCreate an event
创建事件
bash
echo '<json>' | "$SKILL_DIR/scripts/calendar.sh" create-eventJSON fields:
| Field | Required | Default | Description |
|---|---|---|---|
| yes | - | Event title |
| no | first calendar | Calendar name (from list-calendars) |
| no | "" | Event notes |
| no | 0 | Days from today (0=today, 1=tomorrow, 7=next week) |
| no | - | Absolute date |
| no | 9 | Start hour (0-23) |
| no | 0 | Start minute (0-59) |
| no | 30 | Duration |
| no | 0 | Alert N minutes before (0=no alarm) |
| no | false | All-day event |
| no | - | iCal RRULE string. See references/recurrence.md |
bash
echo '<json>' | "$SKILL_DIR/scripts/calendar.sh" create-eventJSON字段说明:
| 字段 | 必填 | 默认值 | 描述 |
|---|---|---|---|
| 是 | - | 事件标题 |
| 否 | 首个日历 | 日历名称(来自list-calendars返回结果) |
| 否 | "" | 事件备注 |
| 否 | 0 | 距离今日的天数(0=今日,1=明日,7=下周同日) |
| 否 | - | 绝对日期 |
| 否 | 9 | 开始小时(0-23) |
| 否 | 0 | 开始分钟(0-59) |
| 否 | 30 | 事件持续时长 |
| 否 | 0 | 事件前N分钟提醒(0=无提醒) |
| 否 | false | 全天事件 |
| 否 | - | iCal RRULE字符串。参考references/recurrence.md |
Interpreting natural language
自然语言解析
Map user requests to JSON fields:
| User says | JSON |
|---|---|
| "tomorrow at 2pm" | |
| "in 3 days" | |
| "next Monday at 10am" | Calculate offset_days from today to next Monday, |
| "February 25 at 3:30pm" | |
| "every weekday at 9am" | |
| "remind me 1 hour before" | |
| "all day event on March 1" | |
For "next Monday", "next Friday" etc: compute the day offset using the current date. Use command if needed:
datebash
undefined将用户请求映射到JSON字段:
| 用户表述 | 对应JSON字段 |
|---|---|
| “明天下午2点” | |
| “3天后” | |
| “下周一上午10点” | 计算今日到下周一的offset_days, |
| “2月25日下午3点30分” | |
| “每个工作日上午9点” | |
| “提前1小时提醒我” | |
| “3月1日的全天事件” | |
对于“下周一”、“下周五”这类表述:使用当前日期计算天数偏移。必要时可使用命令:
datebash
undefinedDays until next Monday (1=Monday)
距离下周一的天数(1=Monday)
target=1; today=$(date +%u); echo $(( (target - today + 7) % 7 ))
undefinedtarget=1; today=$(date +%u); echo $(( (target - today + 7) % 7 ))
undefinedExample prompts
示例提示
These are real user prompts and the commands you should run:
"Remind me to call the dentist in 2 days"
bash
"$SKILL_DIR/scripts/calendar.sh" list-calendarsThen:
bash
echo '{"calendar":"Personnel","summary":"Call dentist","offset_days":2,"hour":9,"duration_minutes":15,"alarm_minutes":30}' | "$SKILL_DIR/scripts/calendar.sh" create-event"Schedule a team sync every Tuesday at 2pm with a 10-min reminder"
bash
echo '{"calendar":"Work","summary":"Team sync","hour":14,"duration_minutes":60,"recurrence":"FREQ=WEEKLY;BYDAY=TU","alarm_minutes":10}' | "$SKILL_DIR/scripts/calendar.sh" create-event"Block July 15 as a vacation day"
bash
echo '{"calendar":"Personnel","summary":"Vacances","iso_date":"2026-07-15","all_day":true}' | "$SKILL_DIR/scripts/calendar.sh" create-event"I have a doctor appointment next Thursday at 3:30pm, remind me 1 hour before"
bash
undefined以下是真实用户请求以及对应应执行的命令:
“2天后提醒我给牙医打电话”
bash
"$SKILL_DIR/scripts/calendar.sh" list-calendars然后执行:
bash
echo '{"calendar":"Personnel","summary":"Call dentist","offset_days":2,"hour":9,"duration_minutes":15,"alarm_minutes":30}' | "$SKILL_DIR/scripts/calendar.sh" create-event“每周二下午2点安排团队同步会,提前10分钟提醒”
bash
echo '{"calendar":"Work","summary":"Team sync","hour":14,"duration_minutes":60,"recurrence":"FREQ=WEEKLY;BYDAY=TU","alarm_minutes":10}' | "$SKILL_DIR/scripts/calendar.sh" create-event“将7月15日标记为休息日”
bash
echo '{"calendar":"Personnel","summary":"Vacances","iso_date":"2026-07-15","all_day":true}' | "$SKILL_DIR/scripts/calendar.sh" create-event“我下周四下午3点30分有个医生预约,提前1小时提醒我”
bash
undefinedFirst compute offset_days to next Thursday (4=Thursday)
首先计算到下周四的offset_days(4=Thursday)
target=4; today=$(date +%u); offset=$(( (target - today + 7) % 7 )); [ "$offset" -eq 0 ] && offset=7
Then:
```bash
echo "{\"calendar\":\"Personnel\",\"summary\":\"Doctor appointment\",\"offset_days\":$offset,\"hour\":15,\"minute\":30,\"duration_minutes\":60,\"alarm_minutes\":60}" | "$SKILL_DIR/scripts/calendar.sh" create-event"Set up a daily standup at 9am on weekdays for the next 4 weeks"
bash
echo '{"calendar":"Work","summary":"Daily standup","hour":9,"duration_minutes":15,"recurrence":"FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;COUNT=20"}' | "$SKILL_DIR/scripts/calendar.sh" create-event"Add a biweekly 1-on-1 with my manager on Fridays at 11am"
bash
echo '{"calendar":"Work","summary":"1-on-1 Manager","hour":11,"duration_minutes":30,"recurrence":"FREQ=WEEKLY;INTERVAL=2;BYDAY=FR","alarm_minutes":5}' | "$SKILL_DIR/scripts/calendar.sh" create-eventtarget=4; today=$(date +%u); offset=$(( (target - today + 7) % 7 )); [ "$offset" -eq 0 ] && offset=7
然后执行:
```bash
echo "{\"calendar\":\"Personnel\",\"summary\":\"Doctor appointment\",\"offset_days\":$offset,\"hour\":15,\"minute\":30,\"duration_minutes\":60,\"alarm_minutes\":60}" | "$SKILL_DIR/scripts/calendar.sh" create-event“接下来4周的工作日上午9点设置每日站会”
bash
echo '{"calendar":"Work","summary":"Daily standup","hour":9,"duration_minutes":15,"recurrence":"FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;COUNT=20"}' | "$SKILL_DIR/scripts/calendar.sh" create-event“每两周周五上午11点添加和经理的1对1会议”
bash
echo '{"calendar":"Work","summary":"1-on-1 Manager","hour":11,"duration_minutes":30,"recurrence":"FREQ=WEEKLY;INTERVAL=2;BYDAY=FR","alarm_minutes":5}' | "$SKILL_DIR/scripts/calendar.sh" create-eventCritical rules
重要规则
- Always list calendars first if the user hasn't specified one — calendars marked cannot be used for event creation
[read-only] - Never use hardcoded date strings in AppleScript — always use or
offset_daysiso_date - Confirm the calendar name with the user if multiple personal calendars exist
- Never target a calendar — the script will reject it with an error
[read-only] - For recurring events, consult references/recurrence.md for RRULE syntax
- Pass JSON via stdin — never as a CLI argument (avoids leaking data in process list)
- All fields are validated by the script (type coercion, range checks, format validation) — invalid input is rejected with an error message
- All actions are logged to with timestamp, command, calendar, and summary
logs/calendar.log
- 如果用户未指定日历,请始终先列出所有日历——标记为的日历无法用于创建事件
[read-only] - 禁止在AppleScript中使用硬编码的日期字符串——始终使用或
offset_daysiso_date - 如果存在多个个人日历,请向用户确认要使用的日历名称
- 禁止选择的日历——脚本会报错拒绝请求
[read-only] - 对于重复事件,请参考references/recurrence.md查看RRULE语法
- 通过标准输入传递JSON——不要作为CLI参数传递(避免在进程列表中泄露数据)
- 脚本会校验所有字段(类型转换、范围检查、格式校验)——无效输入会被拒绝并返回错误信息
- 所有操作都会记录到,包含时间戳、命令、日历名称和事件标题
logs/calendar.log