feat: add Taskwarrior tasks to the kal today briefing #4

Merged
jmz merged 5 commits from feat/today-tasks into main 2026-10-09 18:58:32 +00:00
Owner

Summary

kal today now has a Taskwarrior block between the agenda and the birthdays:

  • Overdue (+OVERDUE status:pending): sorted by urgency, capped at tasks_overdue_max (default 10), with an … N more line for the rest
  • Due today (+DUETODAY status:pending): sorted by due time
  • Next: top tasks_next (default 5) by urgency from status:pending -WAITING -BLOCKED

A task shows up in only one part (overdue first, then due today, then next). Each line has a priority marker (!!!/!!/!), the description (cut at 60 chars), [project] and a relative due date (3d ago, today 19:00, tomorrow, in 4d).

Graceful degradation

  • kal runs task rc.hooks=0 rc.verbose=nothing rc.json.array=on <filter> export as an argv list (no shell), with stdin set to /dev/null and a 3s timeout.
  • If task is not installed, the block is left out without any message.
  • If the query times out, exits non-zero or prints output that can't be parsed, the block becomes one line: (unavailable: …). The first failure stops the remaining queries, so the worst case is one 3s wait.
  • Malformed task entries are skipped.

Config

[today]
tasks = true
tasks_next = 5
tasks_overdue_max = 10   # 0 = no cap

Invalid values fall back to the defaults. KalConfig.save() keeps the table, so hiding a calendar in the TUI does not wipe it. There is also a kal today --no-tasks flag for a single run.

Structure

  • New kal/tasks.py. It reads tasks through an injectable Runner (filter → export JSON), and the parse, collect and format steps are pure functions.
  • kal/today.py: format_briefing() and briefing() take optional tasks and now arguments.
  • kal/cli.py: _run_today reads KalConfig (honours KAL_CONFIG) and calls gather_tasks.
  • README: new "Daily briefing" section.

Tests

tests/test_today_tasks.py has 38 tests. They use a fake runner and fixture JSON instead of a real task DB, and cover:

  • parsing
  • deduplication and ordering
  • the subprocess argv and timeout
  • what happens on a non-zero exit, a missing binary or a timeout
  • relative due dates (fixed timezone offset)
  • formatting
  • the config round-trip
  • the CLI on/off paths

Full suite: 310 passed (also under TZ=UTC); ruff check . is clean.

🤖 Generated with Claude Code

## Summary `kal today` now has a Taskwarrior block between the agenda and the birthdays: - **Overdue** (`+OVERDUE status:pending`): sorted by urgency, capped at `tasks_overdue_max` (default 10), with an `… N more` line for the rest - **Due today** (`+DUETODAY status:pending`): sorted by due time - **Next**: top `tasks_next` (default 5) by urgency from `status:pending -WAITING -BLOCKED` A task shows up in only one part (overdue first, then due today, then next). Each line has a priority marker (`!!!`/`!!`/`!`), the description (cut at 60 chars), `[project]` and a relative due date (`3d ago`, `today 19:00`, `tomorrow`, `in 4d`). ## Graceful degradation - kal runs `task rc.hooks=0 rc.verbose=nothing rc.json.array=on <filter> export` as an argv list (no shell), with stdin set to /dev/null and a 3s timeout. - If `task` is not installed, the block is left out without any message. - If the query times out, exits non-zero or prints output that can't be parsed, the block becomes one line: `(unavailable: …)`. The first failure stops the remaining queries, so the worst case is one 3s wait. - Malformed task entries are skipped. ## Config ```toml [today] tasks = true tasks_next = 5 tasks_overdue_max = 10 # 0 = no cap ``` Invalid values fall back to the defaults. `KalConfig.save()` keeps the table, so hiding a calendar in the TUI does not wipe it. There is also a `kal today --no-tasks` flag for a single run. ## Structure - New `kal/tasks.py`. It reads tasks through an injectable `Runner` (filter → export JSON), and the parse, collect and format steps are pure functions. - `kal/today.py`: `format_briefing()` and `briefing()` take optional `tasks` and `now` arguments. - `kal/cli.py`: `_run_today` reads `KalConfig` (honours `KAL_CONFIG`) and calls `gather_tasks`. - README: new "Daily briefing" section. ## Tests `tests/test_today_tasks.py` has 38 tests. They use a fake runner and fixture JSON instead of a real task DB, and cover: - parsing - deduplication and ordering - the subprocess argv and timeout - what happens on a non-zero exit, a missing binary or a timeout - relative due dates (fixed timezone offset) - formatting - the config round-trip - the CLI on/off paths Full suite: 310 passed (also under `TZ=UTC`); `ruff check .` is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: add Taskwarrior tasks to the kal today briefing
All checks were successful
check / check (push) Successful in 1m23s
check / check (pull_request) Successful in 1m25s
3493c4c317
`kal today` now lists overdue, due-today and top-N next tasks (by urgency)
between the agenda and birthdays. Each line shows a priority marker,
description, project and relative due date.

Tasks come from `task rc.hooks=0 rc.verbose=nothing rc.json.array=on
<filter> export` through an injectable runner: no shell, 3s timeout, and
the first failure stops the remaining queries. A missing `task` binary
leaves the block out; a timeout or error prints a one-line note. Neither
can crash the briefing.

New [today] config table (tasks, tasks_next, tasks_overdue_max) is kept
when the config is saved, and there is a --no-tasks flag for one run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(notify): add due-soon Taskwarrior notifications
All checks were successful
check / check (push) Successful in 1m23s
check / check (pull_request) Successful in 1m23s
7e3d2d5faf
The notify daemon now also pings for pending Taskwarrior tasks a
configurable lead time before they are due ("due in 15 min · 21:00 ·
sospel"), reusing the read-only kal.tasks runner.

- Pure due_task_notifications(): fires once per task per due time
  (key task:{uuid}@{due}, so moving the due re-arms it); skips
  non-pending and still-waiting (snoozed) tasks.
- Date-only / end-of-day dues (local 00:00 or 23:59:59) get no 23:44
  lead ping; they get one "due today" ping from task_morning instead
  (key task-today:{uuid}@{date}). Wall-clock rules are DST-safe.
- run_once queries only the lead window plus +DUETODAY; any task
  failure is logged and swallowed so event notifications keep working.
- Config under [notify]: tasks = true, task_lead = "15m",
  task_morning = "09:00".
- Task gains status and wait fields parsed from the export.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(notify): treat UTC-midnight task dues as date-only
All checks were successful
check / check (push) Successful in 1m20s
check / check (pull_request) Successful in 1m22s
bc3b3189f9
A date-only due entered on a UTC host is stored as 00:00Z, which is 01:00 or
02:00 in Monaco: it would have pinged at night. Give it the morning
"due today" ping like local end-of-day dues.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(notify): log the daemon to ~/Library/Logs
All checks were successful
check / check (push) Successful in 1m23s
check / check (pull_request) Successful in 1m24s
7d8de94f25
The daemon's warnings went nowhere (no logging config, no launchd output
paths). Now --daemon logs to ~/Library/Logs/kal-notify.log (rotating, 1 MB x
2) including each sent notification, and the launchd plist sends
stdout/stderr (crashes) to kal-notify.err.log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge pull request 'feat(notify): due-soon Taskwarrior notifications' (#5) from feat/task-notify into feat/today-tasks
All checks were successful
check / check (push) Successful in 1m27s
check / check (pull_request) Successful in 1m25s
b734154501
jmz merged commit 5ae15d4065 into main 2026-10-09 18:58:32 +00:00
jmz deleted branch feat/today-tasks 2026-10-09 18:58:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/kal!4
No description provided.