Architecture pass: extract Calendar and Agenda modules #1

Merged
arne merged 2 commits from architecture-pass into main 2026-05-05 23:41:15 +02:00
Owner

Summary

Two deepening passes informed by the new CONTEXT.md:

  • internal/calendar — owns the Calendar aggregate (Local file as source of truth, optionally mirrored to a Remote). Verbs: Local, Fetch, Mutate, Edit, Roundtrip. Auto-pulls before mutations, auto-pushes after, auto-purges past events on save. Internal transport seam with HTTP and in-memory adapters. Subsumes the deleted internal/store and internal/remote packages and the sync-orchestration helpers previously stranded in cmd/cal/main.go.
  • internal/agenda — pure projection module (Week, Upcoming, Soonest) producing typed Day buckets. parse.Event.InProgress(now) replaces three duplicated predicates. internal/view and internal/htmlview become pure formatters.

cmd/cal/main.go shrinks from a hand-composed sync orchestrator to a thin cobra-to-Calendar shim.

Test plan

  • `go build ./...` passes
  • `go vet ./...` clean
  • `go test ./...` passes — 10 new calendar tests with in-memory transport (including the stale-local-mutation regression that was only verifiable by manual shell smoke before) and 8 new agenda projection tests
  • Manual smoke: `cal add` / `cal week` / `cal next` / `cal sync` against a real remote
  • Manual smoke: TTY optimistic refresh (UPDATED: only when the rendered table changes)
  • Manual smoke: non-TTY ASCII output for pipes
## Summary Two deepening passes informed by the new `CONTEXT.md`: - **`internal/calendar`** — owns the **Calendar** aggregate (Local file as source of truth, optionally mirrored to a Remote). Verbs: `Local`, `Fetch`, `Mutate`, `Edit`, `Roundtrip`. Auto-pulls before mutations, auto-pushes after, auto-purges past events on save. Internal `transport` seam with HTTP and in-memory adapters. Subsumes the deleted `internal/store` and `internal/remote` packages and the sync-orchestration helpers previously stranded in `cmd/cal/main.go`. - **`internal/agenda`** — pure projection module (`Week`, `Upcoming`, `Soonest`) producing typed `Day` buckets. `parse.Event.InProgress(now)` replaces three duplicated predicates. `internal/view` and `internal/htmlview` become pure formatters. `cmd/cal/main.go` shrinks from a hand-composed sync orchestrator to a thin cobra-to-Calendar shim. ## Test plan - [x] \`go build ./...\` passes - [x] \`go vet ./...\` clean - [x] \`go test ./...\` passes — 10 new calendar tests with in-memory transport (including the stale-local-mutation regression that was only verifiable by manual shell smoke before) and 8 new agenda projection tests - [ ] Manual smoke: \`cal add\` / \`cal week\` / \`cal next\` / \`cal sync\` against a real remote - [ ] Manual smoke: TTY optimistic refresh (UPDATED: only when the rendered table changes) - [ ] Manual smoke: non-TTY ASCII output for pipes
Two deepening passes informed by CONTEXT.md (added):

- internal/calendar — owns the Calendar aggregate (Local file as source of
  truth, optionally mirrored to a Remote). Verbs: Local, Fetch, Mutate, Edit,
  Roundtrip. Auto-pulls before mutations, auto-pushes after, auto-purges past
  events on save. Internal transport seam with HTTP and in-memory adapters.
  Subsumes the deleted internal/store and internal/remote packages and the
  sync-orchestration helpers previously stranded in cmd/cal/main.go.

- internal/agenda — pure projection module (Week, Upcoming, Soonest) producing
  typed Day buckets. parse.Event.InProgress(now) replaces three duplicated
  predicates. internal/view and internal/htmlview become pure formatters.

Test coverage previously absent: 10 calendar tests with an in-memory transport
(including the stale-local-mutation regression that was only verifiable by
manual shell smoke before) and 8 agenda projection tests.

cmd/cal/main.go shrinks from a hand-composed sync orchestrator to a thin
cobra-to-Calendar shim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Drop optimistic remote refresh from read paths (cal, cal week,
  cal next): always render from Local. Removes a network round-trip
  on every tmux status-line refresh.
- Remove now-unused Calendar.Fetch (and its tests).
- Wrap cobra with charmbracelet/fang for styled help/usage/errors,
  using AnsiColorScheme so colors inherit the terminal theme.
- Bump Version to 0.0.3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
arne merged commit ffec15c5c3 into main 2026-05-05 23:41:15 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
arne/cal!1
No description provided.