calendar: use todoman for VTODO list/complete/delete/check

Replaces custom .ics parsing with todoman CLI (--porcelain for JSON).
todo add still uses icalendar directly (needs ICS creation + email).
Updates MIGRATION.md with todoman install/config instructions.
This commit is contained in:
Yanxin Lu
2026-03-22 15:00:20 -07:00
parent 1750a0d921
commit 383b33cc30
3 changed files with 171 additions and 196 deletions

View File

@@ -8,15 +8,52 @@
| `reminders/active.md` (markdown table) | `calendars/tasks/*.ics` (RFC 5545 VTODO) |
| Local only, no sync | CalDAV sync to all devices via vdirsyncer |
| No native reminders | VALARM triggers on phone/desktop |
| Cron reads markdown | Cron reads .ics files |
| Cron reads markdown | Cron reads .ics via todoman |
| Custom Python parsing | todoman for robust RFC 5545 VTODO handling |
## Prerequisites
- [ ] `calendar.sh todo add --dry-run` works (tested in current session)
- [ ] Install todoman (see below)
- [ ] Configure todoman (see below)
- [ ] `calendar.sh todo add --dry-run` works
- [ ] `~/.openclaw/workspace/calendars/tasks/` directory exists (auto-created by `todo add`)
- [ ] vdirsyncer has a `cal/tasks` pair configured
- [ ] Live tests 8-12 from `TESTING.md` pass on the Linux machine
## Step 0: Install and configure todoman
### Install
```bash
# Debian/Ubuntu (the agent's Linux machine)
pip install todoman
# macOS (Homebrew)
brew install todoman
```
The CLI command is `todo`.
### Configure
Create `~/.config/todoman/config.py`:
```python
path = "~/.openclaw/workspace/calendars/tasks/"
date_format = "%Y-%m-%d"
time_format = "%H:%M"
default_due = 24
default_priority = 0
humanize = True
```
### Verify
```bash
# Should list todos (or show empty list without errors)
todo list
```
## Step 1: Migrate pending reminders
Two items are pending in `reminders/active.md`:
@@ -37,6 +74,8 @@ $SKILL_DIR/scripts/calendar.sh todo add \
--description "询问iui报销相关事宜"
```
Note: `todo add` emails each item to `mail@luyx.org`. This is expected.
Verify:
```bash
$SKILL_DIR/scripts/calendar.sh todo list
@@ -50,27 +89,29 @@ Ask the agent to set up a daily cron job via `openclaw cron`:
> `~/.openclaw/workspace/skills/calendar/scripts/calendar.sh todo check`
> and emails the output to mail@luyx.org with subject "📋 今日待办清单"
The old `reminder_check.py` cron in `crontab.txt` should be removed by the agent at the same time.
The old `reminder_check.py` cron should be removed by the agent at the same time.
## Step 3: Verify
- [ ] `todo list` shows both migrated items
- [ ] `todo list` (todoman directly) shows both migrated items
- [ ] `calendar.sh todo list` shows both items with Chinese priority labels
- [ ] `vdirsyncer sync` completes without errors
- [ ] Todos appear on phone/CalDAV client
- [ ] Next morning's cron email arrives with the new format
## Step 4: Clean up (optional, after confidence period)
## Step 4: Clean up
After a few days of successful operation:
- `reminders/active.md` — can be archived or deleted
- `scripts/reminder_check.py` — can be removed
- `reminders/` directory — can be removed
- Old cron entry in `crontab.txt` — should already be gone
```bash
# Remove old reminder system
rm scripts/reminder_check.py
rm -r reminders/
```
## Rollback
If something goes wrong, the old system is still intact:
If something goes wrong, the old system is still intact until Step 4:
- `reminders/active.md` is unchanged
- `scripts/reminder_check.py` still works
- Re-add the old cron entry to restore the previous behavior