diff --git a/TOOLS.md b/TOOLS.md index 37a40d1..4a036dd 100644 --- a/TOOLS.md +++ b/TOOLS.md @@ -116,7 +116,8 @@ SKILL_DIR=~/.openclaw/workspace/skills/calendar $SKILL_DIR/scripts/calendar.sh send \ --to "friend@example.com" \ --subject "Lunch" --summary "Lunch at Tartine" \ - --start "2026-03-20T12:00:00" --end "2026-03-20T13:00:00" + --start "2026-03-20T12:00:00" --end "2026-03-20T13:00:00" \ + --alarm 1h # 提前1小时提醒(默认1d,支持 1d/2h/30m) # 发送周期性邀请(--start 必须落在 BYDAY 指定的那天!) $SKILL_DIR/scripts/calendar.sh send \ diff --git a/skills/calendar/SKILL.md b/skills/calendar/SKILL.md index 17b9683..559498e 100644 --- a/skills/calendar/SKILL.md +++ b/skills/calendar/SKILL.md @@ -63,7 +63,8 @@ $SKILL_DIR/scripts/calendar.sh send \ --summary "Lunch at Tartine" \ --start "2026-03-20T12:00:00" \ --end "2026-03-20T13:00:00" \ - --location "Tartine Bakery, SF" + --location "Tartine Bakery, SF" \ + --alarm 1h ``` ### Send Options @@ -82,6 +83,7 @@ $SKILL_DIR/scripts/calendar.sh send \ | `--organizer` | No | Organizer display name (defaults to `--from`) | | `--rrule` | No | Recurrence rule (e.g. `FREQ=WEEKLY;COUNT=13;BYDAY=TU`) | | `--uid` | No | Custom event UID (auto-generated if omitted) | +| `--alarm` | No | Reminder trigger: `1d`, `2h`, `30m` (default: `1d`) | | `--account` | No | Himalaya account name (if not default) | | `--dry-run` | No | Print ICS + MIME without sending | diff --git a/skills/calendar/TESTING.md b/skills/calendar/TESTING.md index bb28836..a21af78 100644 --- a/skills/calendar/TESTING.md +++ b/skills/calendar/TESTING.md @@ -18,8 +18,10 @@ Generates the ICS and MIME email without sending. Check that: - MIME has `Content-Type: text/calendar; method=REQUEST` - Only `--to` recipients appear as attendees - Times and timezone look correct +- ICS has `BEGIN:VALARM` with correct `TRIGGER` duration ```bash +# Default alarm (1 day before) $SKILL_DIR/scripts/calendar.sh send \ --to "mail@luyx.org" \ --subject "Test Invite" \ @@ -27,6 +29,16 @@ $SKILL_DIR/scripts/calendar.sh send \ --start "${TEST_DATE}T15:00:00" \ --end "${TEST_DATE}T16:00:00" \ --dry-run + +# Custom alarm (1 hour before) +$SKILL_DIR/scripts/calendar.sh send \ + --to "mail@luyx.org" \ + --subject "Test Invite (1h alarm)" \ + --summary "Test Event (1h alarm)" \ + --start "${TEST_DATE}T15:00:00" \ + --end "${TEST_DATE}T16:00:00" \ + --alarm 1h \ + --dry-run ``` ## 2. Live Send: Self-Invite diff --git a/skills/calendar/scripts/cal_tool.py b/skills/calendar/scripts/cal_tool.py index 31cf8b1..6826e6b 100644 --- a/skills/calendar/scripts/cal_tool.py +++ b/skills/calendar/scripts/cal_tool.py @@ -210,11 +210,20 @@ def cmd_send(args): _validate_rrule_dtstart(rrule, start) event.add("rrule", rrule) - # 1-day reminder + # Reminder alarm + alarm_trigger = timedelta(days=-1) # default + if args.alarm: + alarm_str = args.alarm + if alarm_str.endswith("d"): + alarm_trigger = timedelta(days=-int(alarm_str[:-1])) + elif alarm_str.endswith("h"): + alarm_trigger = timedelta(hours=-int(alarm_str[:-1])) + elif alarm_str.endswith("m"): + alarm_trigger = timedelta(minutes=-int(alarm_str[:-1])) alarm = Alarm() alarm.add("action", "DISPLAY") alarm.add("description", f"Reminder: {args.summary}") - alarm.add("trigger", timedelta(days=-1)) + alarm.add("trigger", alarm_trigger) event.add_component(alarm) cal.add_component(event) @@ -861,6 +870,7 @@ def main(): send_p.add_argument("--rrule", default="", help="RRULE string (e.g. FREQ=WEEKLY;COUNT=13;BYDAY=TU)") send_p.add_argument("--uid", default="", help="Custom event UID") send_p.add_argument("--account", default="", help="Himalaya account") + send_p.add_argument("--alarm", default="1d", help="Reminder trigger (e.g. 1d, 2h, 30m)") send_p.add_argument("--dry-run", action="store_true", help="Preview without sending") # --- reply ---