claude fixoval /remind skill

This commit is contained in:
lachtan
2026-06-10 07:58:27 +02:00
parent f93c1cf88e
commit b773164bc8
3 changed files with 45 additions and 34 deletions

View File

@@ -288,17 +288,11 @@
"sessionKey": null
},
"state": {
"nextRunAtMs": 1781069612302,
"lastRunAtMs": 1781067812302,
"nextRunAtMs": 1781071412303,
"lastRunAtMs": 1781069612303,
"lastStatus": "ok",
"lastError": null,
"runHistory": [
{
"runAtMs": 1781033115995,
"status": "ok",
"durationMs": 0,
"error": null
},
{
"runAtMs": 1781034915997,
"status": "ok",
@@ -412,11 +406,17 @@
"status": "ok",
"durationMs": 0,
"error": null
},
{
"runAtMs": 1781069612303,
"status": "ok",
"durationMs": 0,
"error": null
}
]
},
"createdAtMs": 1780892715832,
"updatedAtMs": 1781067812302,
"updatedAtMs": 1781069612303,
"deleteAfterRun": false
}
]

View File

@@ -143,28 +143,41 @@ def cmd_list(_args: argparse.Namespace) -> int:
rows = conn.execute(
"SELECT id, text, enabled, timezone, created_at, updated_at, deleted_at FROM reminders WHERE deleted_at IS NULL ORDER BY id"
).fetchall()
reminders = []
for row in rows:
if not rows:
return 0
for idx, row in enumerate(rows, start=1):
reminder = dict(row)
rid = reminder["id"]
reminder["at"] = [
dict(r) for r in conn.execute(
"SELECT id, at_datetime FROM schedule_at WHERE reminder_id = ?", (rid,)
status = "enabled" if reminder["enabled"] else "disabled"
print(f"{idx}. {reminder['text']} ({status})")
at_rows = conn.execute(
"SELECT at_datetime FROM schedule_at WHERE reminder_id = ?", (rid,)
).fetchall()
]
reminder["cron"] = [
dict(r) for r in conn.execute(
"SELECT id, cron_expr FROM schedule_cron WHERE reminder_id = ?", (rid,)
for r in at_rows:
print(f" - at: {r['at_datetime']}")
cron_rows = conn.execute(
"SELECT cron_expr FROM schedule_cron WHERE reminder_id = ?", (rid,)
).fetchall()
]
reminder["random"] = [
dict(r) for r in conn.execute(
"SELECT id, times_per_day, window_start, window_end, days_filter, from_date, until_date FROM schedule_random WHERE reminder_id = ?",
for r in cron_rows:
print(f" - cron: {r['cron_expr']}")
random_rows = conn.execute(
"SELECT times_per_day, window_start, window_end, days_filter, from_date, until_date FROM schedule_random WHERE reminder_id = ?",
(rid,),
).fetchall()
]
reminders.append(reminder)
print(json.dumps({"reminders": reminders}, ensure_ascii=False))
for r in random_rows:
parts = [f"random: {r['times_per_day']}× daily {r['window_start']}{r['window_end']}"]
if r["days_filter"]:
parts.append(f"({r['days_filter']})")
if r["from_date"]:
parts.append(f"from {r['from_date']}")
if r["until_date"]:
parts.append(f"until {r['until_date']}")
print(f" - {' '.join(parts)}")
return 0
finally:
conn.close()

View File

@@ -39,9 +39,8 @@ def test_add_list(tmp_path, capsys):
ret = _run(db_path, ["list"])
captured = capsys.readouterr()
assert ret == 0
data = json.loads(captured.out)
assert len(data["reminders"]) == 1
assert data["reminders"][0]["text"] == "drink water"
assert "drink water" in captured.out
assert "cron: 0 9 * * *" in captured.out
def test_add_at_validation(tmp_path, capsys):
@@ -78,8 +77,7 @@ def test_remove(tmp_path, capsys):
ret = _run(db_path, ["list"])
captured = capsys.readouterr()
data = json.loads(captured.out)
assert len(data["reminders"]) == 0
assert captured.out.strip() == ""
def test_remove_no_match(tmp_path, capsys):