docs/superpowers/plans/2026-10-16-part5-today-routine.md
99 lines · 10119 bytes
10 symbols in this file
Part 5: Today Routine Implementation PlanGlobal ConstraintsReview FocusTask 0: Branch and issueTask 1: Stickers and day pictures in the storeTask 2: Routine script and month gridTask 3: Day pictures for parents and on day cardsTask 4: Today routine screenTask 5: Sticker calendarTask 6: Reviews, MR, merge
Part 5: Today Routine Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: A short spoken morning routine (greeting, birthday line, today/yesterday/tomorrow, day picture, month, season, pick today's weather) that ends with a weather sticker on a browsable month calendar, per child, plus parent-set day pictures shown on day cards and in the routine.
Architecture: Two new SwiftData models, Sticker and DayPicture, reference a child by profileID instead of a relationship, so the existing Profile entity is unchanged and earlier stores open with a purely additive schema change; ProfileStore deletes them with the profile. The routine's lines come from a pure RoutineScript; the calendar layout from a pure MonthGrid. Views: TodayRoutineView (step cards, weather pick, sticker award) reached from the home banner, StickerCalendarView, and a day-pictures section in the profile editor.
Tech Stack: SwiftUI, SwiftData, Swift Testing, Xcode 27.
Spec: docs/superpowers/specs/2026-10-16-learning-games-design.md (part 5). Builds on the part 1–4 plans in this folder.
Global Constraints
- iOS 17.5 target; SF Symbols must be in SF Symbols 5; each new symbol gets a
UIImage(systemName:)test. SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; pure logicnonisolated.- No change to the
ProfileorAnswerRecordentities. New entities only. A store written by the current main build must open with the new container and keep its profiles (test in Task 1). - One sticker per child per calendar day; finishing the routine again that day replaces the sticker's weather.
- Weeks start on Sunday. Seasons as in
MonthOfYear.season. The weather pick is not a quiz: any choice is accepted. - Every prompt spoken; the child never needs to read. Flat fills; every new fill with white content ≥ 3:1 in
ContrastTests. - Lifecycle:
generationguard on everyasyncAfter;ZStackfor screen states; advance on speech completion with a step-scoped backstop. - Day pictures are set behind the parent gate (profile editor), per child.
- Branch
feat/today-routine. Every commitRef #N(lastCloses #N). No AI attribution. - Test command:
xcodebuild test -project DayByDay.xcodeproj -scheme DayByDay -destination 'platform=iOS Simulator,name=iPhone 18 Pro'(full suite ~10 min; run in background).
Review Focus
- Day boundaries: yesterday/tomorrow wrap at the week's ends and across month and year ends (Friday Jan 1, 2027 → "Yesterday was Thursday.", "It's January."). Test in Task 2.
- Birthday lines: Feb 29 birthdays in non-leap years get the month line all February and no "today" line; birthday today beats birthday month. Test in Task 2.
- Stickers: finishing twice the same day keeps one sticker; deleting a child removes their stickers and day pictures and no one else's. Test in Task 1.
- A store from the previous build (profiles and answers only) opens with the new schema and keeps its data. Test in Task 1.
- Calendar browsing never goes past the current month, and a month with no stickers still renders its grid. Test in Task 2 (
MonthGrid) and Task 5.
Task 0: Branch and issue
-
git checkout -b feat/today-routine main;gitbay issue create --title "Part 5: Today routine and sticker calendar" --json --file -; commit this plan withRef #N.
Task 1: Stickers and day pictures in the store
Files: Create DayByDay/Profiles/Sticker.swift, DayByDay/Profiles/DayPicture.swift. Modify ProfileStore.swift (container types, methods, delete). Test DayByDayTests/StickerStoreTests.swift.
Interfaces:
-
@Model final class Sticker { var profileID: UUID; var year: Int; var month: Int; var day: Int; var weatherRaw: Int; var createdAt: Date }. -
nonisolated enum DayPictureKind: String, CaseIterable { swim, school, grandma, park, music, soccer, library, dance }withname("swim day", "school day", "grandma day", "park day", "music day", "soccer day", "library day", "dance day") andsymbol(figure.pool.swim,backpack.fill,heart.fill,tree.fill,music.note,soccerball,books.vertical.fill,figure.dance). -
@Model final class DayPicture { var profileID: UUID; var weekdayRaw: Int; var kindRaw: String }. -
ProfileStore.makeContainerincludesStickerandDayPicture. New methods:addSticker(for: Profile, on: DateComponents (year, month, day), weather: LearnWeather)(upsert),stickers(for: Profile, year: Int, month: Int) -> [Sticker],sticker(for: Profile, on:) -> Sticker?,setPicture(_ kind: DayPictureKind?, on: DayOfWeek, for: Profile)(nil removes),picture(on: DayOfWeek, for: Profile) -> DayPictureKind?.delete(_:)also deletes the profile's stickers and pictures. -
Tests:
stickerUpsertsPerDay,stickersByMonth,picturesSetReplaceRemove,deleteRemovesOnlyThatChildsData,pictureSymbolsExist,oldStoreOpens(create an on-disk store at a temp URL with a container ofProfileandAnswerRecordonly, insert a profile and an answer, drop it, open the same URL withmakeContainer's full type list, expect the profile and answer). RED, implement, GREEN, commitfeat: stickers and day pictures.
Task 2: Routine script and month grid
Files: Create DayByDay/Today/RoutineScript.swift, DayByDay/Today/MonthGrid.swift. Test DayByDayTests/RoutineScriptTests.swift, DayByDayTests/MonthGridTests.swift.
Interfaces:
-
nonisolated struct RoutineScript { struct Line: Equatable { let text: String; let symbol: String } ; init(date: Date, calendar: Calendar, name: String?, birthday: (month: Int, day: Int)?, picture: DayPictureKind?); let lines: [Line] }. Order:"Hi, \(name)!"(or"Hi!"), symbolsun.max.fill.- Birthday today:
"Today is your birthday! Happy birthday!"(birthday.cake.fill); else birthday month:"Your birthday is in \(Month)!"(gift.fill). Feb 29 birthdays count as "today" only on Feb 29. "Today is \(Day)."(that day'sDayOfWeek.symbol); then, if a picture is set for today,"Today is \(picture.name)!"(picture symbol)."Yesterday was \(Day).", 5."Tomorrow is \(Day)."(day symbols)."It's \(Month)."(month symbol), 7."It's \(Season)."(season symbol).
-
nonisolated struct MonthGrid { init(year: Int, month: Int, calendar: Calendar); let leadingBlanks: Int (Sunday-first); let days: Int; var cells: [Int?] (blanks then 1…days); func shifted(by months: Int) -> MonthGrid }. -
Tests with a Gregorian calendar fixed to UTC:
fridayScript(2026-10-16, "Maya", no birthday, no picture → the 7 lines exactly),birthdayMonthLine,birthdayTodayBeatsMonth,leapBirthday(Feb 29 birthday on 2027-02-28 → month line only; on 2028-02-29 → today line),pictureLine,weekWraps(2026-10-18 Sunday → yesterday Saturday; 2026-10-17 Saturday → tomorrow Sunday),yearEnd(2027-01-01 → "It's January.", yesterday Thursday),octoberGrid(2026-10: 4 blanks, 31 days),februaryGrids(2027: 28, 2028: 29),shiftAcrossYear(2026-12 shifted by 1 → 2027-01). RED, implement, GREEN, commitfeat: routine script and month grid.
Task 3: Day pictures for parents and on day cards
Files: Modify DayByDay/Profiles/ProfileEditorView.swift (section), DayByDay/DayCard.swift (flat fill + badge), DayByDay/DaysOfWeekView.swift. Test ContrastTests.
Interfaces:
-
Profile editor (existing profiles only): section "Day pictures" with a picker per weekday (None + each kind, symbol and name), saving through
setPicture. -
DayCard(day:isHighlighted:picture:): flat fill;DayOfWeek.colorchanged to values ≥ 3:1 against white; whenpictureis set, a white badge circle with the picture symbol in the day color sits in the top-trailing corner, and tapping says"\(Day). It's \(picture.name)!"instead of the day name. -
DaysOfWeekViewreads the current profile's pictures from the session. -
Test
dayColorAgainstWhiteover all days. RED, implement, GREEN, render, commitfeat: day pictures.
Task 4: Today routine screen
Files: Create DayByDay/Today/TodayRoutineView.swift. Modify DayByDay/Home/HomeView.swift, DayByDay/Home/TodayBanner.swift.
Interfaces:
-
TodayRoutineView: one large step card at a time (symbol 120 pt, the line in large text on the today color), spoken on appear; a big "next" arrow button advances (and "Hear it again"). After the last line:"What's the weather like today?"withChoiceTiles for sunny, cloudy, rainy, snowy, windy. Any tap:.success,"It's \(weather) today! Here's your sticker!",addSticker(today, weather), thenStickerCalendarViewfor the current month with today's sticker, plus "Play again" style "Done" back navigation. Without a current profile (cannot happen past the picker) the routine still runs and skips the sticker. -
Home banner links to
TodayRoutineView; its subtitle line shows "Tap for your sticker!" until today's sticker exists, then a small sticker in today's weather. -
Build, render (steps and weather pick), commit
feat: today routine.
Task 5: Sticker calendar
Files: Create DayByDay/Today/StickerCalendarView.swift.
Interfaces:
-
StickerCalendarView(profile:, year:, month:): month name and year header with back/forward arrows (forward disabled at the current month); weekday initials row; 7-column grid fromMonthGrid; each day cell shows its number, today outlined, and a sticker (weather symbol, white, in a circle ofCategory.weather.color) when present. Tapping a stickered day says"On October 3, it was sunny.". -
Build, render a month with stickers and an empty month, commit
feat: sticker calendar.
Task 6: Reviews, MR, merge
- Extend
ReviewExport. Fresh art/sound reviewer (two rounds max). Fresh whole-branch code reviewer with this Review Focus. One fix pass, RED→GREEN. Full suite green. Push, MRCloses #N, squash-merge, delete branch.