feat: implement Token Horoscope daily satirical AI horoscope (Phase 3 PRD #1)#103
Conversation
… PRD #1) Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/f00ab819-68de-4607-b872-c314765f8507 Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/f00ab819-68de-4607-b872-c314765f8507 Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
📝 WalkthroughWalkthroughAdds a deterministic "Token Horoscope" feature: a 30-template pool and a pure function to select a daily template by UTC day, exposes them via DeathClockCore, wires a client UI (render, localStorage viewed-tracking, share), updates build order, styles, tests, and docs. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Browser
participant Core as DeathClockCore
participant Storage as localStorage
participant UI as DOM
participant Share as Share Popup
User->>Browser: Load page
Browser->>Core: Read HOROSCOPE_TEMPLATES & getDailyHoroscope
Browser->>Core: Call getDailyHoroscope(nowMs, templates)
Core-->>Browser: Return horoscope text
Browser->>Storage: Read tokenDeathclockHoroscopeDate
alt not viewed today
Browser->>UI: Render horoscope, set <details open>
Browser->>Storage: Write today's date
else already viewed
Browser->>UI: Render horoscope, ensure <details> closed
end
UI->>UI: Listen for toggle -> persist when opened
User->>UI: Click share
UI->>Share: openSharePopup(shareText)
Share-->>User: Show share dialog
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 242 247 +5
Branches 109 110 +1
=========================================
+ Hits 242 247 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/LEARNINGS.md`:
- Around line 146-151: Update the PR identifier in the LEARNINGS entry so it
correctly references this change: replace "PR `#95`" with "PR `#103`" (or explicitly
note it's a backfill referencing `#103`) in the header line of the horoscope entry
in docs/LEARNINGS.md, ensuring the rest of the entry (HOROSCOPE_TEMPLATES,
getDailyHoroscope, src/js/21-horoscope.js, PARTS renumbering note, and key files
list) remains unchanged for traceability.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1ab02bdb-e7e5-47ca-a06b-a7bbbacba182
📒 Files selected for processing (10)
death-clock-core.jsdocs/LEARNINGS.mdindex.htmlproject-stats.yamlscripts/build-js.jssrc/js/00-state.jssrc/js/21-horoscope.jssrc/js/22-boot.jsstyles/features.csstests/death-clock.test.js
Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/adcbfbe9-8f33-4cc9-8dfe-077823619d37 Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/LEARNINGS.md (1)
148-151: Consider adding this renumbering wisdom to the Categorised Learnings table, fool!I appreciate how you documented the renumbering pattern in the PR entry, but I pity the fool who makes the same mistake in the future without checking this specific PR log entry. The learning about renumbering source files when inserting between existing ones is gold, and it's related to but distinct from A1.
You could add a new row A5 to the "Architecture & Code Organisation" table (around line 105) to make this wisdom more discoverable:
| A5 | When inserting a new numbered source file between existing ones (e.g., adding `21-horoscope.js` between `20-tabs.js` and `21-boot.js`), renumber all subsequent files and update the `PARTS` array in `scripts/build-js.js` to maintain strict sequential order. Out-of-order names confuse future agents. | `#103` |This ain't mandatory since the guideline says "if it reveals a new recurring pattern" and this is the first occurrence, but I predict this pattern WILL recur, fool, so documenting it now would be helping your future self!
As per coding guidelines
docs/LEARNINGS.md: "add a row to the relevant categorised learnings table if it reveals a new recurring pattern"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/LEARNINGS.md` around lines 148 - 151, Add a new row A5 to the "Architecture & Code Organisation" categorised learnings table documenting the renumbering rule when inserting numbered source files: state that when adding a file like 21-horoscope.js between existing numbered modules you must renumber all subsequent files and update the PARTS array in scripts/build-js.js to preserve strict sequential order (include the short example and reference `#103`); place this new A5 entry near the other architecture rows so the renumbering wisdom is discoverable alongside A1.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/LEARNINGS.md`:
- Around line 148-151: Add a new row A5 to the "Architecture & Code
Organisation" categorised learnings table documenting the renumbering rule when
inserting numbered source files: state that when adding a file like
21-horoscope.js between existing numbered modules you must renumber all
subsequent files and update the PARTS array in scripts/build-js.js to preserve
strict sequential order (include the short example and reference `#103`); place
this new A5 entry near the other architecture rows so the renumbering wisdom is
discoverable alongside A1.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 62daf340-38dd-48f1-b48c-1773efcd572a
📒 Files selected for processing (1)
docs/LEARNINGS.md


docs/LEARNINGS.mdhasPR #95, needs to bePR #103Summary by CodeRabbit