Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d294096d9 | |||
| a200832cfb | |||
| b871ab9899 | |||
| 40f496d1ac | |||
| 3829058e2e | |||
| 68d9c60c14 | |||
| 12f5179688 | |||
| d11d2425ee |
+3
-1
@@ -5,4 +5,6 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
|
||||
|
||||
| Feature | Phase | Status | Analysis | Review |
|
||||
|:--|:--|:--|:--|:--|
|
||||
| Workspace, contracts, gates, PWA shell | 0 | Built on `feature/phase0-workspace`, not merged | [phase0-workspace.md](features/phase0-workspace.md) | [feature-phase0-workspace.md](reviews/feature-phase0-workspace.md) |
|
||||
| Workspace, contracts, gates, PWA shell | 0 | Merged to `main` 2026-11-01 (`d11d242`); built, not deployed. Phase 0 gate still open | [phase0-workspace.md](features/phase0-workspace.md) | [feature-phase0-workspace.md](reviews/feature-phase0-workspace.md) |
|
||||
| Roadmap and gameplay docs, read against the code | 0 | Merged 2026-11-01; Q1–Q7 answered by the author | — | [docs-roadmap-gameplay.md](reviews/docs-roadmap-gameplay.md) |
|
||||
| The Letter slot: page at `#letter`, empty `docs/LETTER.md` | 0 | Merged to `main`; built, not deployed. Invisible until the author writes | [letter-slot.md](features/letter-slot.md) | [feature-letter-slot.md](reviews/feature-letter-slot.md) |
|
||||
|
||||
+33
-7
@@ -3,11 +3,16 @@
|
||||
What the product needs that it does not have yet, and what was closed. A closed gap
|
||||
is struck through **with its evidence in the row** (CLAUDE.md §5.1).
|
||||
|
||||
Ids are `G<phase>.<n>`. `docs/ROADMAP.md` does not exist yet, so the phases here are
|
||||
provisional. Phase 0 is defined in
|
||||
[`features/phase0-workspace.md`](features/phase0-workspace.md).
|
||||
Ids are `G<phase>.<n>`. Phases follow [`docs/ROADMAP.md`](../docs/ROADMAP.md). The
|
||||
workspace part of Phase 0 is in
|
||||
[`features/phase0-workspace.md`](features/phase0-workspace.md). How the roadmap and
|
||||
`docs/GAMEPLAY.md` compare with the code, and the author's open questions:
|
||||
[`reviews/docs-roadmap-gameplay.md`](reviews/docs-roadmap-gameplay.md).
|
||||
|
||||
## Phase 0 — the workspace
|
||||
## Phase 0 — Foundations
|
||||
|
||||
**Gate open.** The workspace is merged (G0.1–G0.9). Still missing for the gate: the
|
||||
60 sentences (G0.18) and one illustration through the pipeline (G0.24).
|
||||
|
||||
| Id | Gap | Status / evidence |
|
||||
|:--|:--|:--|
|
||||
@@ -24,13 +29,34 @@ provisional. Phase 0 is defined in
|
||||
| G0.11 | IndexedDB eviction: no `navigator.storage.persist()`, no export-my-rose (§8) | Open. Arrives with `packages/storage`. |
|
||||
| G0.12 | The app cannot validate content in the browser | Open. Ajv compiles with `new Function`, which the CSP forbids. Needs standalone pre-compiled validators before the app reads the library. |
|
||||
| G0.13 | No GitHub remote, no Pages deploy workflow, no mirror check (§5.2) | Open. Only the Gitea remote exists. |
|
||||
| G0.14 | Author-owned docs missing: `docs/ROADMAP.md`, `docs/GAMEPLAY.md`, `docs/PRINCIPLES.md`, `docs/ART.md`, `art/STYLE.md`, `docs/LETTER.md`, `HANDOVER.md` predecessor | Open. **GAMEPLAY.md blocks all game code.** Agents scaffold LETTER.md; they never write its voice. |
|
||||
| G0.14 | Author-owned docs missing: `docs/PRINCIPLES.md`, `docs/ART.md`, `art/STYLE.md`, `docs/LETTER.md` | Open, narrowed 2026-11-01: `docs/ROADMAP.md` and `docs/GAMEPLAY.md` were added on `docs/roadmap-gameplay`, as the author gave them. Agents scaffold LETTER.md; they never write its voice. |
|
||||
| G0.15 | Deferred packages: `storage`, `identity`, `sync`, `services/lucerna`, `tools/art-prep` | Open by design (D1). Each arrives with its first feature. |
|
||||
| G0.16 | The outcome-phrase heuristic has no reviewed override | Open. A real sentence that trips it (a false positive) cannot enter the library. Design: a `reviewedBy` field on the entry, set only by a person. |
|
||||
| G0.17 | Manual: install on a phone, open in airplane mode | Open. Needs a hosted build (G0.13). |
|
||||
| G0.18 | The library is empty | Open by design (D4). Release needs ≥ 365 sunset sentences, each verified by the author. |
|
||||
| G0.19 | Event kinds other than `care` | Open. Wait for GAMEPLAY.md: their fields are game design. |
|
||||
| G0.18 | The library is empty | Open. **Phase 0 gate**: 60 sentences, each sourced and verified public domain (ROADMAP Phase 0). Release needs ≥ 365. `verifiedBy` is a person, so an agent may propose candidates but never mark one verified (D4). |
|
||||
| G0.19 | Event kinds other than `care` | Open. GAMEPLAY.md now exists; each kind arrives with the feature doc that uses it, starting in Phase 1. |
|
||||
| G0.20 | Node 22.11 on the dev machine is below what some pinned dependencies declare | Open. All gates pass on 22.11 today. Upgrade to ≥ 22.13 and unpin (D11). |
|
||||
| G0.21 | No PNG icons | Open (predicted trap). iOS ignores SVG for `apple-touch-icon`. Comes through the art pipeline. |
|
||||
| G0.22 | No CI | Open. Every gate ran on this machine only. With G0.13. |
|
||||
| G0.23 | Source maps are built and would be published | Open. `sourcemap: true`; maps are not precached. Decide with G0.13 whether the repository is public. If not, use `'hidden'`. |
|
||||
| G0.24 | No art pipeline: `docs/ART.md`, `art/STYLE.md` (drafted with the author), `art/manifest.json` for Phase 1 assets, SVG placeholders, `tools/art-prep` | Open. **Phase 0 gate**: one illustration goes through prompt, paste, automatic checks, review and the author's approval into `art/final/`. |
|
||||
| ~~G0.25~~ | ~~No slot for *A Letter from the Gardener*~~ | Closed 2026-11-01, merged to `main`. `docs/LETTER.md` holds slots as comments only; the page opens at `#letter` once it has words. 16 ui tests, and e2e on both the empty and a temporary written letter. Mutations caught: the link while empty, any link scheme, focus not moving, *heal* in the letter. |
|
||||
| G0.27 | The quiet door to real help has no numbers (§5.6 rule 5) | Open. The slot is in `docs/LETTER.md`. Support lines are real-world facts the author must verify, per country, so the door exists only once the letter does. |
|
||||
| ~~G0.26~~ | ~~Not decided: how the sunset invitation reaches the player on the web~~ | Closed 2026-11-01 by the author (Q6): in-app only on the web, no push server; local notifications through the Tauri shell in Phase 6. Recorded in ROADMAP Phase 0 and CLAUDE.md §8. |
|
||||
|
||||
## Design questions — answered
|
||||
|
||||
Raised by GAMEPLAY.md and ROADMAP.md, answered by the author 2026-11-01. Details in
|
||||
[`reviews/docs-roadmap-gameplay.md`](reviews/docs-roadmap-gameplay.md) §2.
|
||||
|
||||
| # | Question | Answer |
|
||||
|:--|:--|:--|
|
||||
| ~~Q1~~ | Fox food with no friends and no Lucerna | A wild bush beside the player's own rose; other roses only add |
|
||||
| ~~Q2~~ | What "real time" counts for bloom | Days on which care helped, never minutes on screen |
|
||||
| ~~Q3~~ | Lucerna and the lantern share a name | Keep both; the lantern never passes through Lucerna |
|
||||
| ~~Q4~~ | "Sent through Amicitia" | "A taste of Amicitia" |
|
||||
| ~~Q5~~ | *No extra creatures* vs visitors | Rule removed from GAMEPLAY §3 |
|
||||
| ~~Q6~~ | When the notification decision is due | Phase 0, in-app only (G0.26) |
|
||||
| ~~Q7~~ | Which phase holds the Amicitia bridge | Phase 3 |
|
||||
| Q8 | "Nearby days give a little more" | Open as a rule for the Phase 1 Soul review: a gap's cost is never shown |
|
||||
| Q9 | May the Letter name the book and its author for the one sentence of inspiration (GAMEPLAY §7)? | Open. `lint:copy` refuses those names in the letter as everywhere in the product. A yes needs a written, letter-only exemption. |
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# The Letter slot
|
||||
|
||||
Status: merged to `main`, reviewed in
|
||||
[`feature-letter-slot.md`](../reviews/feature-letter-slot.md). Gap: G0.25. Roadmap: Phase 0, *a slot for A Letter
|
||||
from the Gardener — the author writes it; agents only scaffold the page.*
|
||||
|
||||
---
|
||||
|
||||
## 1. Why and what, in the player's terms
|
||||
|
||||
*A Letter from the Gardener* is the help section. It holds the deeper why, it can be
|
||||
re-read at any time, and it is never needed to play (GAMEPLAY §4). It also holds the
|
||||
quiet door to real help (CLAUDE.md §5.6 rule 5).
|
||||
|
||||
This branch makes the place for it, not the letter itself. The author writes
|
||||
`docs/LETTER.md` in plain Markdown, and the app shows it as a page. **Until the author
|
||||
writes something, the player sees no change at all**: there is no link to an empty
|
||||
page, no "coming soon" and no dead control.
|
||||
|
||||
## 2. Technical architecture
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
letter[("docs/LETTER.md<br/>the author's words")]
|
||||
app["apps/rosea<br/>App.svelte<br/>imports it ?raw at build time"]
|
||||
ui["packages/ui<br/>letter/parse.ts → blocks<br/>Letter.svelte, Shell.svelte"]
|
||||
lint["scripts/lint-copy.ts"]
|
||||
letter -- "bundled, precached" --> app --> ui
|
||||
lint -. scans .-> letter
|
||||
```
|
||||
|
||||
### Decisions
|
||||
|
||||
| # | Decision | Why |
|
||||
|:--|:--|:--|
|
||||
| L1 | `docs/LETTER.md` is the only copy of the letter. The app imports it with Vite's `?raw` at build time. | No runtime fetch, so the letter is in the precached bundle and opens offline. One file means the author edits one place, in Markdown. |
|
||||
| L2 | The scaffold holds only HTML comments: one slot per thing the docs say the letter carries. Comments are dropped when the page is built, so the scaffold renders as nothing. | Agents never write the letter's voice. A heading is voice too, so the slots are comments, not headings. |
|
||||
| L3 | A small Markdown subset is parsed into blocks in `packages/ui/src/letter/parse.ts`: headings, paragraphs, lists, *emphasis* and links. Everything else is shown as plain text. The component renders the blocks with Svelte, **never `{@html}`**. | No HTML is ever built from text, so nothing in the file can inject markup or script, and the CSP stays `'self'`. The parser lives in `ui` because it is presentation, and `ui → content` is not an allowed dependency. |
|
||||
| L4 | Only `https:` and `tel:` become links. Anything else, including `http:`, `javascript:` and `data:`, stays text. External links open in a new tab, with `rel="noopener noreferrer"`. | The support door needs web and phone links. Nothing else does. |
|
||||
| L5 | The page is reached by a link on the home view, at `#letter`. The link exists **only when the letter has content**. With an empty letter, `#letter` shows the home view. | Hash routing works offline without a server rule. An entry point to an empty page is a dead control. |
|
||||
| L6 | `lint:copy` scans `docs/LETTER.md` with the full list, though it lives in `docs/`. | It is player-facing. The `docs/` exemption (§5.6 rule 4) is for design documents, where the words are being discussed. |
|
||||
| L7 | When the view changes, focus moves to the new view's heading. | A screen-reader user hears where they are. A hash change alone announces nothing. |
|
||||
| L8 | `docs/LETTER.md` is in turbo's `globalDependencies`. | Found in review: without it, a changed letter replayed the cached build (`lessons/technical.md`). |
|
||||
|
||||
## 3. Risk analysis
|
||||
|
||||
| Risk | Where | Defence |
|
||||
|:--|:--|:--|
|
||||
| A forbidden or medical word reaches a player through the letter | `docs/LETTER.md` | L6, with a test that the script reads the file. |
|
||||
| The letter names the book | The "one sentence of inspiration" (GAMEPLAY §7) | `lint:copy` refuses *Saint-Exupéry* and the title in the letter as everywhere else. If the author wants the letter to name its source, that is a decision to write down (Q9), not an exemption made by an agent. |
|
||||
| Markup or script injected through the file | The renderer | L3 and L4, with tests for `<script>`, `javascript:` and raw HTML. |
|
||||
| An empty page feels broken or turns the player away | Before the author writes | L5: there is no way to reach it. |
|
||||
| A link sends the player's address somewhere | Support links | `referrer: no-referrer` is already set, and `noreferrer` is on each link. Leaving the app is the player's own choice, made with a tap. |
|
||||
| Someone in crisis cannot find the door | Support lines | Not solved here: the numbers are real-world facts the author must verify. The slot exists, and G0.27 tracks the rest. |
|
||||
|
||||
Guilt, comparison, rejection, dependence: looked for and none found. The page asks
|
||||
nothing and counts nothing.
|
||||
|
||||
## 4. Gap analysis and the designed solution
|
||||
|
||||
| Gap | Solution |
|
||||
|:--|:--|
|
||||
| No page for the letter | `Letter.svelte`, reached at `#letter` (L5) |
|
||||
| No file for the author | `docs/LETTER.md`, slots only (L2) |
|
||||
| The letter escapes `lint:copy` | L6 |
|
||||
| No support lines | Slot only; verified numbers are the author's (G0.27) |
|
||||
|
||||
## 5. Verification matrix
|
||||
|
||||
| Case | Kind | Where |
|
||||
|:--|:--|:--|
|
||||
| The scaffold, being only comments, parses to zero blocks | unit | `packages/ui/test/letter-parse.test.ts` |
|
||||
| Headings, paragraphs across lines, lists, emphasis, links parse as blocks | unit | same |
|
||||
| `<script>` and raw HTML stay text; `javascript:`, `data:`, `http:` links stay text | unit | same |
|
||||
| `https:` and `tel:` links render as links with `noopener noreferrer` | unit | `packages/ui/test/Shell.test.ts` |
|
||||
| Empty letter: no link to it, and `#letter` shows home | unit + e2e | `Shell.test.ts`, `e2e/shell.spec.ts` |
|
||||
| A letter with content: the link appears, opens the page, *Back* returns, focus moves | unit | `Shell.test.ts` |
|
||||
| `lint:copy` reads `docs/LETTER.md` and fails on a forbidden word in it | script, run | the review |
|
||||
| The built app still renders, offline included | e2e, offline | existing suites |
|
||||
| The written-letter branch of the e2e test, with a temporary sample letter | e2e, run once | the review |
|
||||
| A changed letter rebuilds the app (`cache miss`) | e2e, run | the review |
|
||||
@@ -1,13 +1,14 @@
|
||||
# Phase 0 — the workspace
|
||||
|
||||
Status: **built on `feature/phase0-workspace`**, not yet merged. Review:
|
||||
Status: **merged to `main`** 2026-11-01 (`d11d242`), built, not deployed. This is the
|
||||
workspace part of ROADMAP Phase 0. **The Phase 0 gate is still open** (G0.18, G0.24). Review:
|
||||
[`feature-phase0-workspace.md`](../reviews/feature-phase0-workspace.md).
|
||||
Gates closed and still open: [`GAP_ANALYSIS.md`](../GAP_ANALYSIS.md).
|
||||
|
||||
`docs/ROADMAP.md` does not exist yet, so this document defines Phase 0 itself. It
|
||||
Written before `docs/ROADMAP.md` existed, so it defined its own scope. It
|
||||
covers what CLAUDE.md §2 calls "confirmed when Phase 0 scaffolds it" and what §3
|
||||
calls "proposed until Phase 0 scaffolds them", and nothing more. **No game code.**
|
||||
`docs/GAMEPLAY.md` must be read before any, and it has not been written.
|
||||
`docs/GAMEPLAY.md` was added later; it must be read before any.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ and **how to apply it**.
|
||||
| `architecture.md` | none yet | Layering, ownership, seams. |
|
||||
| `design.md` | none yet | Wording, silence, empty states. |
|
||||
| `art.md` | none yet | The image pipeline. |
|
||||
| [`code.md`](code.md) | 1 | TypeScript, Svelte, async ordering, Rust. |
|
||||
| [`technical.md`](technical.md) | 3 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 3 | What makes a test worth having, and how a passing test lies. |
|
||||
| [`code.md`](code.md) | 2 | TypeScript, Svelte, async ordering, Rust. |
|
||||
| [`technical.md`](technical.md) | 4 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 4 | What makes a test worth having, and how a passing test lies. |
|
||||
| `privacy.md` | none yet | What could leave the device or make a person findable. (The geocell finding is in the review, not here: it was caught before it cost anything.) |
|
||||
| [`process.md`](process.md) | 2 | Workflow, commits, credentials, honesty about what shipped. |
|
||||
|
||||
|
||||
@@ -20,3 +20,18 @@ fixed the same way. Check with `grep -n $'\xc2\xa0' file` (the two UTF-8 bytes)
|
||||
`sed -n Np file | od -c`. Do not use `grep -P '\xA0'`: it matches the last byte of `≠`
|
||||
and other characters, and raised a false alarm on the review document. Keep
|
||||
`no-irregular-whitespace` on.
|
||||
|
||||
## A Svelte 5 effect that short-circuits never tracks what it skipped
|
||||
|
||||
**What happened.** `Shell.svelte` moved focus with
|
||||
`$effect(() => { if (moved) heading?.focus(); })`. `moved` is a plain variable and was
|
||||
`false` on the first run, so the effect never read `heading` and had no dependencies.
|
||||
When the view changed and `heading` was bound to the new `<h1>`, nothing re-ran. The
|
||||
Shell test caught it: the focus stayed on `<body>`.
|
||||
|
||||
**Why it bit.** An effect tracks only the state it actually reads on each run. A
|
||||
condition that returns early hides every read after it.
|
||||
|
||||
**How to apply it.** In an effect, read the state you depend on before any early
|
||||
return or `&&` (`const target = heading; if (moved) target?.focus();`). Test the
|
||||
re-run, not just the first run.
|
||||
|
||||
@@ -40,3 +40,18 @@ needed for non-CSS style languages or TS features that emit code (enums, decorat
|
||||
|
||||
**How to apply it.** Leave `svelte.config.js` as `export default {}` until a component
|
||||
needs SCSS or emitted TS. Add the preprocessor in the same commit as that need.
|
||||
|
||||
## Turbo's cache does not see a file the app imports from outside its package
|
||||
|
||||
**What happened.** The app imports `docs/LETTER.md?raw`. With a sample letter written
|
||||
into the file, `pnpm test:e2e` printed `@rosea/app:build: cache hit` and tested the
|
||||
*old* bundle, so the link to the letter was missing. Turbo hashes a package's own
|
||||
files, and `docs/` belongs to no package. Adding `docs/LETTER.md` to
|
||||
`globalDependencies` in `turbo.json` turned it into a `cache miss`, and the test passed.
|
||||
|
||||
**Why it bit.** A build cache keyed on the wrong inputs gives a stale bundle that looks
|
||||
fresh. This is CLAUDE.md §5.4 again, caused by the build tool and not the service worker.
|
||||
|
||||
**How to apply it.** Any file the app bundles from outside its package goes into
|
||||
`globalDependencies` or the task's `inputs`, in the same commit as the import. To
|
||||
check, change the file, run the build, and look for `cache miss`.
|
||||
|
||||
@@ -43,3 +43,18 @@ firing has not been tested. Without the run, a review can only say "I believe".
|
||||
**How to apply it.** For every guard a branch adds, apply the inverse change, run the
|
||||
one suite that should catch it, record CAUGHT or MISSED, and restore the file with
|
||||
`git checkout`. Commit first, so the restore is exact.
|
||||
|
||||
## Fill an empty slot for one run, to test the state it will have later
|
||||
|
||||
**What happened.** The Letter's e2e test branches: no link while `docs/LETTER.md` is
|
||||
empty, and the page opens once it is written. Only the empty branch could run, because
|
||||
the author has not written the letter. One run with a temporary sample letter took the
|
||||
other branch. It found the stale-cache bug (`technical.md`), and then passed the
|
||||
written-letter page, axe included, in a real browser. The scaffold was restored
|
||||
afterwards.
|
||||
|
||||
**Why it bit.** A test written for a future state passes trivially until that state
|
||||
arrives. Then it fails for the first time on the author's machine, with the author's words.
|
||||
|
||||
**How to apply it.** When a test branches on content that does not exist yet, fill the
|
||||
content temporarily, run the suite, restore it, and record the run in the review.
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Review — `docs/roadmap-gameplay`
|
||||
|
||||
The author's `docs/ROADMAP.md` and `docs/GAMEPLAY.md`, added 2026-11-01, read against
|
||||
CLAUDE.md and what is on `main` (`12f5179`). Both documents are the author's: their
|
||||
words are kept as given (GAMEPLAY.md was pasted as plain text and only given Markdown
|
||||
headings and bullets). Where they disagree with each other or with the code, the
|
||||
question is written down here, not resolved by editing them.
|
||||
|
||||
No code changed, so the gates were not re-run.
|
||||
|
||||
## 1. Phase 0 is not done by the roadmap's definition
|
||||
|
||||
What was merged as "Phase 0" (`d11d242`) is the workspace and its contracts. The
|
||||
roadmap's Phase 0 is larger, and its **gate is not met**:
|
||||
|
||||
| Roadmap Phase 0 item | State |
|
||||
|:--|:--|
|
||||
| Repo, `.gitignore`, 5 MB hook, `CLAUDE.md`, this roadmap | Done (roadmap on this branch) |
|
||||
| Remotes | Gitea only; GitHub missing (G0.13) |
|
||||
| `ART.md` | Missing (G0.24) |
|
||||
| Schema contracts, validator with negative fixtures, `lint:copy` | Done (G0.2, G0.5, G0.6) |
|
||||
| **60 sentences**, sourced and verified public domain | **Missing**: 0 entries (G0.18). `verifiedBy` needs a person. |
|
||||
| `art/STYLE.md` drafted with the author, `art/manifest.json`, SVG placeholders, `tools/art-prep` end to end on one asset | **Missing** (G0.24) |
|
||||
| Slot for *A Letter from the Gardener* | Missing (G0.25) |
|
||||
| Decision: how the sunset invitation reaches the player on the web | **Decided** 2026-11-01: in-app only (Q6, G0.26) |
|
||||
|
||||
**Gate:** 60 sentences pass and every fixture fails (half met: the fixtures fail, but
|
||||
there are no sentences); one illustration through the full pipeline into `art/final/`
|
||||
(not started). The status docs now say *workspace merged, Phase 0 gate open* instead
|
||||
of *Phase 0 merged*.
|
||||
|
||||
## 2. Questions only the author can answer
|
||||
|
||||
Each one blocks the feature named in its row. None blocks the rest of Phase 0.
|
||||
|
||||
| # | Where | The conflict | Blocks |
|
||||
|:--|:--|:--|:--|
|
||||
| Q1 | GAMEPLAY §3 vs ROADMAP Phases 2–4, §5 | Berries come from *forgotten roses of other players*, so the fox's food needs other players. But the fox arrives in Phase 2, before friends (Phase 3). Cold start says Phases 1–2 must stand alone, and the Phase 4 gate says deleting `lucerna` leaves Phases 1–3 working. **Where does the fox's food come from with no friends and no Lucerna?** | Phase 2 fox |
|
||||
| Q2 | GAMEPLAY §1–2 vs ROADMAP §2, Phase 1 | *Short visits only hold her; real time brings full bloom*, plus *care hours* in the numbers. If "real time" means minutes on screen, bloom rewards staying in the app: the **dependence** risk, against *the best moments send the player away from the screen*. The roadmap says growth comes from **total days of care**. Proposed reading: calendar days with real care, where a long session is worth no more than a short one with the same care. Confirm. | Phase 1 growth |
|
||||
| Q3 | ROADMAP §1 vs GAMEPLAY §5 | Two lanterns. **Lucerna** (*lantern*) is the server, and the **lantern** is the device-to-device "I'd like to talk". A player, or a later agent, could take the lantern to go through Lucerna. Rename one, or write down that the lantern never touches Lucerna. | Naming; Phase 3–4 |
|
||||
| Q4 | GAMEPLAY §5 | Before a match, sentences carry *"sent through Amicitia"*. If the bytes go over Rosea's own sync, the label is untrue about where data went (Privacy: what was the player told). Either Amicitia carries them, or the wording changes, for example *a taste of Amicitia*. | The Amicitia bridge |
|
||||
| Q5 | GAMEPLAY §3 vs ROADMAP Phase 2 | *No extra creatures* vs visitors who leave mementos, rare visitors, and the sheep album. Is the rule about food and the fox's screen only? | Phase 2 collections |
|
||||
| Q6 | ROADMAP Phase 0 vs CLAUDE.md §8 | The notification decision is due in Phase 0 by the roadmap and in the Phase 1 feature doc by CLAUDE.md. Taken as Phase 0, since the roadmap is newer. An agent can write the options and their privacy cost; the author picks one. | G0.26 |
|
||||
| Q7 | GAMEPLAY §5 vs ROADMAP | The Amicitia bridge has no phase. It needs roads (Phase 3) and swapped keys (`packages/identity`). Phase 3, 5, or its own? | Planning |
|
||||
| Q8 | GAMEPLAY §1 | *Coming back on nearby days gives a little more.* This is not a streak, but a player back after a gap gets less than one back after a day. It is safe only if nobody ever sees what a gap cost them. Recorded for the Phase 1 Soul review; no answer needed now. | Phase 1 Soul review |
|
||||
|
||||
### Answers — the author, 2026-11-01
|
||||
|
||||
Written into `docs/GAMEPLAY.md`, `docs/ROADMAP.md` and CLAUDE.md, each marked
|
||||
*decided 2026-11-01* in the author's docs.
|
||||
|
||||
| # | Answer |
|
||||
|:--|:--|
|
||||
| Q1 | **Own bush first.** A wild bush beside the player's own rose ripens when the care helped. Friends' forgotten roses (Phase 3) and strangers' (Phase 4) add berries, never required. Phase 2 needs no other player and the Phase 4 gate holds. Farming limit: one harvest per bush per local day. |
|
||||
| Q2 | **Days of care.** Calendar days on which the care helped, never minutes on screen. The numbers panel shows *days of care* in place of *care hours* (an agent's reading of this answer; the author can reverse it). |
|
||||
| Q3 | **Keep both names.** The lantern travels device to device only and never passes through `lucerna`. Written in GAMEPLAY §5 and CLAUDE.md §1–2. |
|
||||
| Q4 | **"A taste of Amicitia"**, with the icon. |
|
||||
| Q5 | **The rule is removed.** GAMEPLAY §3 no longer says *no extra creatures*, so Phase 2's visitors stand. |
|
||||
| Q6 | **Phase 0, in-app only.** No push server on the web; local notifications come with the Tauri shell (Phase 6). Recorded in ROADMAP Phase 0 and CLAUDE.md §8. Closes G0.26. |
|
||||
| Q7 | **Phase 3.** Added to ROADMAP Phase 3 with the friends' berries. |
|
||||
| Q8 | No answer needed: a rule for the Phase 1 Soul review. |
|
||||
|
||||
## 3. Notes that need no answer
|
||||
|
||||
- **"treat."** GAMEPLAY §3 calls rose hips *the rare top treat*. That is fine in a
|
||||
design doc. In player copy `treat` is banned (D6), so the in-game words are
|
||||
different. `lint:copy` catches it.
|
||||
- **The planets.** *King*, *lamplighter*, *geographer* and similar are ordinary words
|
||||
and are not on the forbidden list, which is right: §7 allows the echo but never the
|
||||
name or text. *The Geographer's book* and the *sheep album* are the closest echoes.
|
||||
Each planet's feature doc gets a copyright line in its review.
|
||||
- **The drunkard's planet** is a Soul risk for a player who drinks. It goes into that
|
||||
planet's feature doc.
|
||||
- **Sunset from a time zone.** A zone is not a place, and sunset needs coordinates.
|
||||
Fallback: the zone's reference location from the tz database (`zone1970.tab`),
|
||||
bundled offline. This goes into the Phase 1 sun feature doc. It never asks for GPS
|
||||
and never makes a network call.
|
||||
- **Bubble copy** has the same rules as the hope library (GAMEPLAY §4). `lint:copy`
|
||||
already scans `packages/ui/src/copy/`. Whether bubbles also get ids and a validator
|
||||
is decided in Phase 1.
|
||||
|
||||
## 4. What already agrees
|
||||
|
||||
- The care acts *water, shade, weeds, petals* match the `care` schema's `act` enum (D5).
|
||||
- *Berries, never treats*, as in D6.
|
||||
- Book and Tolkien names are already forbidden in copy (`forbidden.ts`), and
|
||||
*Rosea Domi* / *Amicitia Domi* pass the Domi-alone rule.
|
||||
- CLAUDE.md §8 already names the **berry farming** trap (one harvest per forgotten
|
||||
rose per local day) and the **lantern as rejection** trap (one-sided lanterns are
|
||||
invisible).
|
||||
- "Never GPS" matches CLAUDE.md §4.
|
||||
|
||||
## What was NOT done
|
||||
|
||||
- The author's text was not changed, including where §2 shows a conflict.
|
||||
- No game code was written. GAMEPLAY.md now exists, but Phase 1 starts only after
|
||||
the Phase 0 gate (ROADMAP §4: *failing it means the next phase does not start*).
|
||||
@@ -0,0 +1,74 @@
|
||||
# Review — `feature/letter-slot`
|
||||
|
||||
Adversarial self-review (CLAUDE.md §5.3). Analysis:
|
||||
[`features/letter-slot.md`](../features/letter-slot.md). Reviewed 2026-11-01 on
|
||||
Node 22.11.0, Windows 10. There is no PR: the only remote is Gitea, and this session
|
||||
cannot open one there.
|
||||
|
||||
## Gates — counts, not exit codes
|
||||
|
||||
| Gate | Result |
|
||||
|:--|:--|
|
||||
| `pnpm lint` | exit 0 |
|
||||
| `pnpm typecheck` | exit 0; `svelte-check` 0 errors **0 warnings** in ui and app (a bare `href="#"` warning was fixed) |
|
||||
| `pnpm test` | **130 passed**: schema 15, content 47, engine 52, ui 16 (was 3) |
|
||||
| `pnpm lint:copy` | **12 files** checked (was 9: `parse.ts`, `Letter.svelte`, `docs/LETTER.md`), 0 problems |
|
||||
| `pnpm validate:library` | 0 entries; 13 of 13 fixtures rejected |
|
||||
| `pnpm test:e2e` | **7 passed** (was 6), on the scaffold letter |
|
||||
| `pnpm test:offline` | **1 passed** |
|
||||
|
||||
**Built, not deployed** (§5.4): there is no host. The change is **deliberately
|
||||
invisible**: with the scaffold letter, the built page looks exactly as before. The
|
||||
bundle is 8 precache entries, 42.74 KiB.
|
||||
|
||||
**The written-letter branch, run once.** `docs/LETTER.md` was given a temporary sample
|
||||
letter (headings, a paragraph across lines, *emphasis*, an `https:` and a `tel:` link).
|
||||
e2e: 7 passed, including the page opening from the link, axe with no violations, and
|
||||
*Back*. Offline: 1 passed. The scaffold was then restored and both suites ran again
|
||||
green. That run found finding 1.
|
||||
|
||||
## Test honesty — bugs put back
|
||||
|
||||
| Bug put back | Suite | Result |
|
||||
|:--|:--|:--|
|
||||
| `ALLOWED_HREF = /.*/` (any link scheme) | ui unit | CAUGHT: 2 failed |
|
||||
| The letter link shown while the letter is empty | ui unit | CAUGHT: 2 failed |
|
||||
| same | e2e | CAUGHT: `toHaveCount(0)` failed |
|
||||
| The focus effect reads `heading` only after `if (moved)` | ui unit | CAUGHT: focus stayed on `<body>`. This was the first draft's real bug (finding 2). |
|
||||
| *heal* in the body of `docs/LETTER.md` | `lint:copy` | CAUGHT: `docs/LETTER.md:36 'heal' (medical)` |
|
||||
| `docs/LETTER.md` missing from turbo's cache key | e2e, written letter | CAUGHT, as the real finding 1 |
|
||||
|
||||
Not caught by any test: removing `docs/LETTER.md` from `lint:copy`'s file list. Only
|
||||
the quoted file count (12) would show it. See finding 6.
|
||||
|
||||
## Findings
|
||||
|
||||
| # | Area | Finding | Resolution |
|
||||
|:--|:--|:--|:--|
|
||||
| 1 | **Correctness** | Turbo hashed only the app package, so after the letter changed, `test:e2e` printed `cache hit` and tested the **old bundle**. A deploy from a warm cache would ship the old letter. | **Fixed**: `docs/LETTER.md` is in `globalDependencies` (L8). Shown as `cache miss` after the change. Lesson: `technical.md`. |
|
||||
| 2 | Correctness | The first focus effect returned before reading `heading`, so it never re-ran and focus never moved. | **Fixed** before review, caught by the Shell test. Lesson: `code.md`. |
|
||||
| 3 | **Offline** | The letter opens offline, because it is bundled. A support line given as an `https:` link does **not** work offline, but a `tel:` link does. | **Deferred** to G0.27, with the advice that each support line has a phone number. |
|
||||
| 4 | **Privacy** | An `https:` link in the letter takes the player to another site. Nothing leaves without their tap, the referrer is stripped (`no-referrer` on the page and `noreferrer` on the link), and it opens in a new tab. Which sites the letter links to is the author's choice. | **Accepted.** |
|
||||
| 5 | Correctness | The parser has blind spots. A numbered list (`1. …`) without blank lines collapses into one paragraph, and `snake_case_word` makes *case* italic. | **Accepted.** The scaffold says which Markdown works, and anything else shows as text, never as markup. |
|
||||
| 6 | Test honesty | No test proves `lint:copy` reads `docs/LETTER.md`. It was shown by the *heal* mutation, but deleting the path from `FILES` would pass silently. | **Accepted for now**: the review quotes the file count. Revisit if `lint:copy` grows a file list worth testing. |
|
||||
| 7 | Correctness | *Back* leaves `#garden` in the address bar. A bookmark at `#garden` or any unknown hash opens the garden. | **Accepted**: harmless, and any hash but `#letter` is home by design. |
|
||||
| 8 | **Soul** | Once the letter exists, the home view offers one link, *A Letter from the Gardener*. Looked for guilt, comparison, rejection and dependence: the page asks nothing, counts nothing, and is never required (GAMEPLAY §4). Found none. | — |
|
||||
| 9 | Copyright | The scaffold's comments mention "the book". They are stripped before the page and skipped by `lint:copy`. Whether the letter's own words may name the book is **Q9**, for the author. | **Open**, Q9. |
|
||||
|
||||
Looked for and found none:
|
||||
|
||||
- **Reachability.** The letter is one-way, from the author to every player. There is
|
||||
no input.
|
||||
- **Injection.** No `{@html}` anywhere. Raw HTML and `<script>` stay text (tests), and
|
||||
only `https:` and `tel:` become links (tests, plus a mutation). Svelte escapes
|
||||
attribute values.
|
||||
- **Correctness cases from §5.3.** Clock, DST, partial write and two tabs do not apply:
|
||||
there is no state. A tab closed on `#letter` reopens on the letter (test: *opens
|
||||
straight at #letter*).
|
||||
|
||||
## What was NOT verified
|
||||
|
||||
- **A screen reader.** axe passes on both views, and the focus move is unit-tested.
|
||||
Nobody has listened to it.
|
||||
- **Firefox, WebKit and a phone.** Desktop Chromium only.
|
||||
- **The author's real letter.** Only a sample has rendered.
|
||||
@@ -88,8 +88,15 @@ mid-action and two tabs do not apply to a shell with no state. DST is covered fo
|
||||
Chromium only.
|
||||
- **Firefox and WebKit.** Not run.
|
||||
- **Screen reader.** axe passes. No one has listened to the page.
|
||||
- **`pnpm install --frozen-lockfile` from a fresh clone.** Not run. The lockfile is
|
||||
committed, but the install was done in place.
|
||||
- **A fresh clone.** `pnpm install --frozen-lockfile` passed on the merged `main`
|
||||
(`d11d242`), but in the existing checkout, not a new one.
|
||||
|
||||
## After merge
|
||||
|
||||
Merged with `--no-ff` as `d11d242` and pushed. Local `HEAD`, `origin/main` and
|
||||
`git ls-remote origin main` print one hash. Every gate ran again on the merged tree,
|
||||
with the same counts as above: 117 unit, 6 e2e, 1 offline, 13 of 13 fixtures.
|
||||
There is no GitHub remote yet, so no mirror to check (§5.2, G0.13).
|
||||
- **The setOffline lesson** is imported from Ludus and was not re-measured here.
|
||||
- **The rename-in-one-commit property.** Nobody has tried renaming. The name lives
|
||||
in `constants.ts` and `index.html`, the manifest is built from the constants, and
|
||||
|
||||
@@ -52,12 +52,14 @@ encouraging, never ruling), never a name or a quote.
|
||||
her. Care has a touch of skill: water by feel (too much is as bad as too little), shade her from wind,
|
||||
pull weeds, gather fallen petals. She grows from the **total** time of care, never from a streak.
|
||||
Neglect makes her **drift** — turn away, close a little — never break. Short visits hold her; real
|
||||
time brings full bloom. One tap shows her real numbers (water, warmth, care hours, trend).
|
||||
time — calendar days on which care helped, never minutes on screen — brings full bloom. One tap
|
||||
shows her real numbers (water, warmth, days of care, trend).
|
||||
- **The planets** — a journey through lonely grown-ups (the king, the vain man, the businessman, the
|
||||
lamplighter, the geographer…). Each planet lets the player feel one shape of loneliness.
|
||||
- **The fox** — follows at a distance from the first planet and comes closer through touch (pet,
|
||||
brush) and food. The rose tells you what he wants today. His food is **berries**, gathered by tending
|
||||
other players' forgotten roses (one harvest per forgotten rose per day, only when the care helped).
|
||||
brush) and food. The rose tells you what he wants today. His food is **berries**: first from the wild bush
|
||||
beside the player's own rose, later also from tending other players' forgotten roses — an addition,
|
||||
never a requirement (one harvest per bush per day, only when the care helped).
|
||||
Your own rose's growth sets berry quality: wild strawberries → blueberries → raspberries →
|
||||
blackberries → rose hips. After the taming he leads the player to real people.
|
||||
- **Teaching in play** — the rose and the fox explain and remind in speech bubbles, with text from the
|
||||
@@ -68,7 +70,8 @@ encouraging, never ruling), never a name or a quote.
|
||||
footprints, then a trail, then a road.
|
||||
- **The bridge to Amicitia** (promoted openly) — once a path is a road, either player may light a
|
||||
**lantern**. A one-sided lantern is invisible; when both are lit, the game says so and the two apps
|
||||
swap anonymous keys device to device. Players are known only by their rose's name. Free conversation
|
||||
swap anonymous keys device to device. The lantern never passes through `lucerna`. Before a match,
|
||||
sentences carry the Amicitia icon and *a taste of Amicitia* — never "sent through Amicitia". Players are known only by their rose's name. Free conversation
|
||||
happens only in Amicitia, never in Rosea. Rosea has no doors: paths only grow, a lit lantern stays lit.
|
||||
- **The shared sky** — every act of care toward someone else adds light to one night sky that all
|
||||
players share. The sky is the **real** sky: real constellations. Every day at local sunset a wave of
|
||||
@@ -161,7 +164,8 @@ content/
|
||||
docs/ # ROADMAP.md, ART.md, numbered milestone feature docs
|
||||
```
|
||||
|
||||
`lucerna` — *lantern*: it only ever shows that someone was there.
|
||||
`lucerna` — *lantern*: it only ever shows that someone was there. The lantern gesture (§1) shares the
|
||||
name and never passes through it.
|
||||
|
||||
**Dependency direction (never violate):**
|
||||
|
||||
@@ -363,7 +367,7 @@ happened twice.)*
|
||||
- **The engine gets property tests.** `fast-check`: growth is monotonic in total care and never
|
||||
decreases; fox distance never jumps more than one step per day; replaying the same log twice gives
|
||||
byte-identical `derived` state; a missed sunset never changes the rose's stage; an unopened
|
||||
sentence is never lost; at most one harvest per forgotten rose per local day, and none when the care
|
||||
sentence is never lost; at most one harvest per bush per local day, and none when the care
|
||||
did not help; drift never lowers the stage earned.
|
||||
- **Sun maths gets golden tests** against published sunrise/sunset tables for a spread of cities:
|
||||
Prague, Reykjavík, Tromsø (polar day and polar night), Quito, Sydney, Anchorage — including both DST
|
||||
@@ -434,7 +438,7 @@ player can send another player, and the sender picks one.
|
||||
"trace": "petal:<colour>", "messageId": "ps-23-4" | null, "clientVersion": "0.1.0" }
|
||||
// act applies to the player's own rose or another player's. (This example once
|
||||
// listed "wind" | "light"; §1's weeds and fallen petals won — phase0-workspace.md D5.)
|
||||
// Only "care" is in packages/schema so far; the other kinds wait for docs/GAMEPLAY.md.
|
||||
// Only "care" is in packages/schema so far; each other kind arrives with the feature doc that uses it.
|
||||
// other kinds: "sentence-opened", "sunset" (seen), "planet-step", "fox" (pet | brush | feed),
|
||||
// "harvest" (berry kind), "thanks", "lantern" (lit — never unlit)
|
||||
```
|
||||
@@ -463,7 +467,8 @@ No timestamp finer than a day, no precise location, no free text, no link to the
|
||||
- **Svelte 5 runes, no state library.** A component that decides growth, taming or anything in the sky
|
||||
is a layering violation and a review **blocker**.
|
||||
- **Three taps to action, one preferred.** From a cold open, tending the rose is one tap.
|
||||
- **Every string a player reads lives in `packages/ui/src/copy/`**, and passes `lint:copy`. The
|
||||
- **Every string a player reads lives in `packages/ui/src/copy/`**, and passes `lint:copy` — except
|
||||
the Letter, which is the author's Markdown in `docs/LETTER.md` and passes `lint:copy` too. The
|
||||
interface language is plain English (Czech later). Latin is for the brand only.
|
||||
- **Silence is a feature.** Sunset, the thanks visit and the end of a planet have moments with no
|
||||
buttons at all. Do not fill them.
|
||||
@@ -479,14 +484,14 @@ No timestamp finer than a day, no precise location, no free text, no link to the
|
||||
|
||||
| Trap | Why it bites |
|
||||
|:--|:--|
|
||||
| **A PWA cannot schedule a local notification** *(predicted — verify first)* | The sunset invitation is time-based. A web app generally cannot fire a notification at a set time while closed without a **push server** sending it, and a push server that knows when someone's sunset is knows roughly where they are. On iOS, web push works only for a site added to the home screen. Decide this in the Phase 1 feature doc: in-app sunset only for the web build, and local notifications through the Tauri shell later — or a push design whose privacy cost is written down. |
|
||||
| **A PWA cannot schedule a local notification** *(predicted — verify first)* | The sunset invitation is time-based. A web app generally cannot fire a notification at a set time while closed without a **push server** sending it, and a push server that knows when someone's sunset is knows roughly where they are. On iOS, web push works only for a site added to the home screen. **Decided in Phase 0 (2026-11-01):** in-app sunset only for the web build — no push server — and local notifications through the Tauri shell later (Phase 6). |
|
||||
| **Polar day and polar night** *(predicted)* | Above the Arctic Circle the sun does not set in summer or rise in winter. "Every day at sunset" has no answer there. The engine must return a defined state and the game must have a gentle alternative (e.g. the hour the light is lowest). |
|
||||
| **DST and the local day** *(predicted)* | Sunset jumps an hour twice a year under a player who did nothing; a day boundary computed in UTC records Monday-evening care as Tuesday's. One module computes the day. |
|
||||
| **Comfort becomes wallpaper** | The same words every day stop meaning anything. Comfort words are occasional; the real trace of a real person is constant. Track repetition in tests. |
|
||||
| **Guilt sneaks in through "gentle" reminders** | "Your rose misses you" is guilt wearing a ribbon. No notification ever refers to neglect — the player's or anyone else's. |
|
||||
| **Streak creep** | Someone will propose "just a small streak". Growth is from total care; a missed day never resets anything. |
|
||||
| **Drift that reads as blame** | A rose turned away can feel like an accusation. Drift is shown as waiting, never as hurt caused; she brightens on the first touch, and no copy ever says *you forgot*. |
|
||||
| **Berry farming** | Tending forgotten roses for food invites mindless tapping. One harvest per forgotten rose per local day, only when the care actually helped — enforced in `engine/forage`, property-tested. |
|
||||
| **Berry farming** | Tending roses for food invites mindless tapping. One harvest per bush per local day — the player's own and each forgotten rose's — only when the care actually helped, enforced in `engine/forage`, property-tested. |
|
||||
| **A lantern as rejection** | A lit lantern that is visibly unanswered is the rejection this game exists to avoid. One-sided lanterns are invisible to the other player, always. |
|
||||
| **Location makes people findable** | Coarse cells next to a sparse population identify a house. Cell size must adapt to density, traces must be delayed and auto-deleted, and stranger contact is consent-only (§5.6). |
|
||||
| **The library as a scam channel** | If any field lets a sender attach free text, a lonely recipient can be manipulated. The id-only contract (§6.1) is the defence. |
|
||||
|
||||
+23
-9
@@ -8,24 +8,38 @@ Rewritten at the end of each session (CLAUDE.md §5.1).
|
||||
|
||||
- **Repository:** the git repo exists, and `origin` is Gitea (`mnovak/Rosea`).
|
||||
`main` holds `CLAUDE.md` and `.gitignore` (`1e4c5a0`).
|
||||
- **Phase 0:** built on `feature/phase0-workspace` and pushed. **It is not merged.**
|
||||
Analysis: [`.agents/features/phase0-workspace.md`](.agents/features/phase0-workspace.md).
|
||||
- **Phase 0 workspace:** merged to `main` with `--no-ff` (`d11d242`) and pushed. Local and
|
||||
Gitea hashes match. Analysis: [`.agents/features/phase0-workspace.md`](.agents/features/phase0-workspace.md).
|
||||
Review, with counts and the mutation results:
|
||||
[`.agents/reviews/feature-phase0-workspace.md`](.agents/reviews/feature-phase0-workspace.md).
|
||||
- **Gates:** all pass on this machine. Unit tests: 117 (schema 15, content 47,
|
||||
engine 52, ui 3). E2E: 6. Offline: 1. `lint:copy`: 9 files, 0 problems.
|
||||
`validate:library`: 13 of 13 fixtures rejected.
|
||||
- **Built, not deployed:** there is no host yet.
|
||||
- **Roadmap and gameplay docs:** `docs/ROADMAP.md` and `docs/GAMEPLAY.md` are on
|
||||
`docs/roadmap-gameplay`, as the author gave them, together with a read against the
|
||||
code: [`.agents/reviews/docs-roadmap-gameplay.md`](.agents/reviews/docs-roadmap-gameplay.md).
|
||||
The author answered Q1–Q7, and the answers are written into both docs and CLAUDE.md.
|
||||
Merged to `main`.
|
||||
- **The Letter slot:** merged to `main`. `docs/LETTER.md`
|
||||
holds slots as comments only. Once the author writes in it, a link to the letter
|
||||
appears in the garden, and the page opens at `#letter`, offline too. Review:
|
||||
[`.agents/reviews/feature-letter-slot.md`](.agents/reviews/feature-letter-slot.md).
|
||||
|
||||
**Phase 0 is not finished.** The roadmap's Phase 0 is more than the workspace. Its
|
||||
gate needs 60 verified sentences (G0.18) and one illustration through the art
|
||||
pipeline (G0.24). Also open: a GitHub remote (G0.13). The Letter slot is built (G0.25).
|
||||
The notification decision is made: in-app only on the web (G0.26).
|
||||
|
||||
**Waiting on the author.**
|
||||
|
||||
1. **Merge** `feature/phase0-workspace` into `main` (with `--no-ff`, §5.3), or say what
|
||||
to change first.
|
||||
2. **`docs/GAMEPLAY.md`.** No game code can start without it (G0.14). `docs/ROADMAP.md`
|
||||
is needed to name Phase 1.
|
||||
3. **A GitHub repository** for Pages, and the decision whether it is public. That
|
||||
decides the source maps (G0.23), the deploy workflow and the mirror check (G0.13).
|
||||
4. **Upgrading Node** to ≥ 22.13 on this machine (G0.20).
|
||||
1. **The Letter:** the words in `docs/LETTER.md`, the verified support lines for the
|
||||
door to real help (G0.27), and Q9 (may the letter name the book).
|
||||
2. **Sentences:** an agent may propose public-domain candidates with their sources.
|
||||
Only the author can mark one verified.
|
||||
3. **`docs/ART.md` and `art/STYLE.md`**, which are needed before the art pipeline.
|
||||
4. **A GitHub repository** for Pages, and whether it is public (G0.13, G0.23).
|
||||
5. **Upgrading Node** to ≥ 22.13 on this machine (G0.20).
|
||||
|
||||
**How this machine works** (not in the code):
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Shell } from '@rosea/ui';
|
||||
// Bundled at build time, so the letter is precached and opens offline (letter-slot.md L1).
|
||||
import letter from '../../../docs/LETTER.md?raw';
|
||||
</script>
|
||||
|
||||
<Shell />
|
||||
<Shell {letter} />
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
# Rosea Domi — gameplay loop (decided 2026-10-28)
|
||||
|
||||
Rosea is still a game: every visit has real things to do. Art serves play, never replaces it. Core
|
||||
purpose: training for real relationships — the habits learned tending the rose and the fox are the
|
||||
habits Amicitia Domi needs with people. Amicitia is promoted openly (§5); its door opens when the fox
|
||||
starts leading to real people.
|
||||
|
||||
## 1. The rose
|
||||
|
||||
- Actions with a touch of skill (feel, not a button): water (pour slowly until the leaves lift; too
|
||||
much is as bad as too little), shade from wind at the right moment, pull overnight weeds, gather
|
||||
fallen petals.
|
||||
- She drifts, never breaks. Neglect makes her turn away and close a little (like a friend drifting to
|
||||
an outer circle in Amicitia). Nothing earned disappears.
|
||||
- Short visits only hold her; real time brings full bloom (mirrors Amicitia: check-ins freeze drift,
|
||||
real time climbs). *Real time* means calendar days on which the care actually helped — never minutes
|
||||
on screen. A long session is worth no more than a short one with the same care (decided 2026-11-01).
|
||||
- The daily sentence comes from the rose, not from the sunset clock. She waits with a folded petal;
|
||||
best given at sunset, but never missed. Coming back on nearby days gives a little more (e.g. an
|
||||
earlier sentence remembered). A gap is never punished; no streak counter exists.
|
||||
|
||||
## 2. Numbers — measured and transparent
|
||||
|
||||
Her face and posture are the surface. One tap opens the real numbers: water, warmth, days of care,
|
||||
trend. Everything measured is visible on request; nothing is hidden, nothing is shouted.
|
||||
|
||||
## 3. The fox
|
||||
|
||||
- Taming is touch and food: pet and brush the fox; feed it.
|
||||
- The rose tells you what the fox wants today.
|
||||
- Food = berries. Before there are friends, a wild berry bush beside the player's own rose ripens when
|
||||
their care actually helped her, so the fox is never hungry without other players (decided
|
||||
2026-11-01). Later, berries also come from tending forgotten roses of other players: friends'
|
||||
(Phase 3) and, with the shared sky, strangers' (Phase 4) — an addition, never a requirement. A
|
||||
forgotten rose stays theirs; tending it ripens the wild berry bush beside it. Anti-farming: one
|
||||
harvest per bush per day, and only when the care actually helped (e.g. water when she truly needed
|
||||
it).
|
||||
- Your own rose's growth decides berry quality: wild strawberries → blueberries → raspberries →
|
||||
blackberries → rose hips (the rare top treat; the rose's own fruit — ties rose and fox together).
|
||||
- No trees, no apples, no hunting. Keep the screen minimal.
|
||||
|
||||
## 4. Teaching the player
|
||||
|
||||
- The game is taught in play: the rose and the fox speak in speech bubbles — "this is what you need to
|
||||
do" — and remind the player when something is forgotten. Never assume the player read anything.
|
||||
- Bubble text comes from the curated copy library (no free text, same rules as the hope library).
|
||||
- A Letter from the Gardener holds the deeper why and can be re-read any time — it is never required
|
||||
to understand how to play.
|
||||
|
||||
## 5. From roses to real people — the bridge to Amicitia (decided)
|
||||
|
||||
- Amicitia Domi is promoted openly as the door to real contact.
|
||||
- Players are known only by the name they give their rose (a nickname; it may be their real name if
|
||||
they choose). Rosea never knows real names.
|
||||
- Lantern: once the path between two roses has grown into a road, either player may light a lantern
|
||||
("I'd like to talk"). A one-sided lantern is invisible to the other. When both have lit one, the
|
||||
game says so. The lantern travels only device to device and never passes through Lucerna, the
|
||||
discovery service, despite the shared name (decided 2026-11-01).
|
||||
- No personal data exchanged: the two apps swap anonymous keys device to device; each appears in
|
||||
Amicitia under their rose's name.
|
||||
- Before a match, curated sentences sent from the rose carry the Amicitia icon and "a taste of
|
||||
Amicitia" — a visible taste, no real contact. (Rosea's own sync carries them, so the label never
|
||||
says Amicitia sent them; decided 2026-11-01.) After a match, free conversation happens only in
|
||||
Amicitia, never in Rosea.
|
||||
- No doors, no closing. Rosea has no "close the door" action; paths only grow. A lit lantern stays
|
||||
lit. Whether a connection lives or fades is Amicitia's concern, not Rosea's.
|
||||
- Safety note (Claude's judgement): Rosea needs no block because it has no free text; Amicitia, where
|
||||
free text begins, must still have a quiet safety block for harassment — not promoted.
|
||||
|
||||
## 6. The first days, and the journey as the second pillar (decided)
|
||||
|
||||
- Main risk (Claude's view, agreed): lonely players are the ones who quietly drop off. The beauty is
|
||||
not the hard part; the first days must be rewarding enough that players stay long enough to be
|
||||
changed by the game.
|
||||
- Tending the rose and the fox alone is not yet enough gameplay. The second pillar is the journey:
|
||||
visiting the lonely grown-ups' planets (king, vain man, drunkard, businessman, lamplighter,
|
||||
geographer), each with its own real things to do — so there is always somewhere to go and something
|
||||
new to discover from day one.
|
||||
- Design rule: every early session ends with visible progress and a reason to return tomorrow (a new
|
||||
place glimpsed, a berry kind closer, the fox a step nearer) — never with guilt.
|
||||
|
||||
## 7. The first minutes — and what Rosea is (decided, corrected 2026-10-28)
|
||||
|
||||
- Rosea Domi is its own game, by purpose: it exists to lead players into Amicitia Domi. It is not a
|
||||
Little Prince game and never presents itself as one.
|
||||
- From Saint-Exupéry it takes one idea: taming/binding someone makes you responsible for them, and
|
||||
tending is how that responsibility is lived. The book is complementary inspiration, nothing more.
|
||||
- The planets and lonely grown-ups stay as a quiet, familiar echo that makes the first minutes feel
|
||||
recognisable — never named, never explained in-game as the book.
|
||||
- No text from the book; no title, names or "you may know this book" prompts in the game, its name,
|
||||
logo or marketing (the estate also holds trademarks on the title).
|
||||
- A Letter from the Gardener is where everything is taught: the one sentence of inspiration, the river
|
||||
of life, why the art looks as it does, and how the game leads to Amicitia.
|
||||
- The Letter is clear about the difference: Rosea's philosophy and many of its small things (berries
|
||||
and rose hips, the lanterns, the paths between roses, the real sunset, the shared sky, Amicitia)
|
||||
were never in the book. The familiarity is a doorway; what lies behind it is Rosea's own.
|
||||
|
||||
## 8. How much comes from the book — stated precisely (decided)
|
||||
|
||||
- Taken as reference: the book's structure and the shape of the gameplay loop (rose, fox, the journey
|
||||
through the lonely grown-ups' planets) — almost the whole book is echoed in the game.
|
||||
- Skipped: the pilot in the desert. It does not translate into play and has no place in Rosea.
|
||||
- Visual style: a direction only — never, ever copying the illustrations (see `art/STYLE.md`).
|
||||
- Rosea's own philosophy: the paths, and the river of life with its whirlpools, drawn from Pascal and
|
||||
Nietzsche and Mark's "vortex of continuum". These are explained in A Letter from the Gardener.
|
||||
- Idea, open: a companion book in which these philosophical concepts are evaluated and written out at
|
||||
length — the Letter is its short form.
|
||||
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
A Letter from the Gardener: the author's own words, signed by the author.
|
||||
Agents scaffold this file and never write in it (CLAUDE.md preamble and §1).
|
||||
|
||||
How it reaches the player: the app bundles this file at build time and shows
|
||||
it at #letter, offline included. While this file holds nothing but comments,
|
||||
the player sees no way to the page.
|
||||
|
||||
Markdown that works: # and ## headings, paragraphs, lists with - or *,
|
||||
*emphasis*, and links to https:// pages or tel: numbers. Anything else is
|
||||
shown as plain text. `pnpm lint:copy` checks every word outside comments,
|
||||
as it does for all player-facing text.
|
||||
|
||||
The slots below are what GAMEPLAY.md and CLAUDE.md say the letter carries.
|
||||
Keep, reorder or delete them as you like: comments never reach the player.
|
||||
-->
|
||||
|
||||
<!-- Slot: the one sentence of inspiration (GAMEPLAY §7). -->
|
||||
|
||||
<!-- Slot: the river of life and its whirlpools (GAMEPLAY §8, CLAUDE.md §1). -->
|
||||
|
||||
<!-- Slot: why the art looks as it does (GAMEPLAY §7). -->
|
||||
|
||||
<!-- Slot: what in Rosea was never in the book: berries and rose hips, the
|
||||
lanterns, the paths, the real sunset, the shared sky, Amicitia (GAMEPLAY §7). -->
|
||||
|
||||
<!-- Slot: every feature and every principle, taught (CLAUDE.md §1). -->
|
||||
|
||||
<!-- Slot: how the game leads to Amicitia Domi (GAMEPLAY §5, §7). -->
|
||||
|
||||
<!-- Slot: the quiet door to real help: verified support lines, as links
|
||||
(CLAUDE.md §5.6 rule 5, G0.27). Not advice, no clinical claim. -->
|
||||
|
||||
<!-- Slot: the signature. -->
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
# Rosea Domi — phase plan
|
||||
|
||||
Working document. Lives at `docs/ROADMAP.md`. Companion to [`CLAUDE.md`](../CLAUDE.md) (the operating
|
||||
manual) and [`ART.md`](ART.md) (the illustration pipeline).
|
||||
|
||||
---
|
||||
|
||||
## 0. The thing to decide before anything else
|
||||
|
||||
Rosea joins a queue that already holds NARTOR, Memoria, Ludus, Panda Domi and others. The failure mode
|
||||
is not "Rosea is a bad idea" — it is many products at 70%.
|
||||
|
||||
So **Phases 0–1 are a spike, not a commitment**: the rose alone, the sunset, the library, offline, on
|
||||
a real phone. At the end of Phase 1 there is one honest question — *did the real sunset become part of
|
||||
my day?* — and a no is a legitimate answer that leaves a reusable sentence library and a sun module
|
||||
behind.
|
||||
|
||||
Solo evenings-and-weekends pace. Durations are calendar estimates, not effort (assumption).
|
||||
|
||||
---
|
||||
|
||||
## 1. Naming
|
||||
|
||||
`Rosea` — Latin *rose-coloured*: the colour of the sky at sunset and of the rose. Working name.
|
||||
In public always **Rosea Domi**; *Domi* never stands alone. Final name, trademark and domain checks are
|
||||
open (§6). The help section is **A Letter from the Gardener**. The discovery service is **Lucerna**
|
||||
(*lantern*).
|
||||
|
||||
---
|
||||
|
||||
## 2. What makes this different
|
||||
|
||||
Most games for lonely people either pretend to be a friend or count everything. Rosea does neither.
|
||||
Its unit of value is **time given to someone else** — and its best moments send the player *away* from
|
||||
the screen: to the real sunset, the real sky, real people.
|
||||
|
||||
Three consequences run through every phase:
|
||||
|
||||
1. **Growth comes from total care, never from a streak.** Nothing earned ever disappears.
|
||||
2. **No free text, no counting of people.** Comfort is chosen from a curated library; friendship is
|
||||
shown as a path, never a number.
|
||||
3. **Every beauty has a real twin.** Sunset, sunrise and constellations are real, computed on device.
|
||||
|
||||
---
|
||||
|
||||
## 3. Architecture in one paragraph
|
||||
|
||||
A pnpm/Turbo monorepo in TypeScript. `packages/schema` holds the contracts and generates the types.
|
||||
`packages/engine` is pure — growth, taming, the shared sky, and the sun maths, with time as a
|
||||
parameter. `packages/content` holds the hope library and its validator. `packages/storage` is the only
|
||||
module that opens IndexedDB, `packages/identity` the only one that holds keys, `packages/sync` the only
|
||||
one that talks to friends (WebRTC, Phase 3). `apps/rosea` is a **Svelte 5 + Vite PWA** — web first,
|
||||
from a link, no store — built by GitHub Actions and hosted on **GitHub Pages**, with a Gitea mirror. **Rust** is used where it earns its place: `services/lucerna`, the optional
|
||||
anonymous discovery service (Axum + SQLite, Phase 4), and later a **Tauri 2** shell for Android and iOS
|
||||
that gives local notifications without a server (Phase 6). All player state is an append-only event log;
|
||||
every visible thing is a pure function of it.
|
||||
|
||||
---
|
||||
|
||||
## 4. Phases
|
||||
|
||||
Each phase has a gate: a question with an observable answer. Failing it means the next phase does not
|
||||
start.
|
||||
|
||||
### Phase 0 — Foundations · ~1–2 weeks
|
||||
|
||||
- Repo, `.gitignore`, the 5 MB pre-commit hook, remotes, `CLAUDE.md`, this roadmap, `ART.md`.
|
||||
- `packages/schema` with the hope-sentence and care-event contracts; the library validator with its
|
||||
**negative fixtures**; `lint:copy` with the forbidden-words list.
|
||||
- The first **60 sentences** of the library, each sourced and verified public domain.
|
||||
- **Art**: `art/STYLE.md` drafted with Mark, `art/manifest.json` for Phase 1 assets, Claude's SVG
|
||||
placeholders, and the **art preparation page** (`tools/art-prep`) working end to end on one asset.
|
||||
- A slot for *A Letter from the Gardener* — the author writes it; agents only scaffold the page.
|
||||
- **Decision recorded:** how the sunset invitation reaches the player on the web (see the notification
|
||||
trap in `CLAUDE.md` §8). *Decided 2026-11-01:* on the web the invitation lives inside the app only —
|
||||
no push server; real local notifications come with the Tauri shell (Phase 6).
|
||||
|
||||
**Gate:** `validate:library` passes on the 60 sentences and **fails on every negative fixture** with a
|
||||
message naming the problem; one illustration has gone through the full pipeline — prompt, paste,
|
||||
automatic checks, Claude's review, Mark's approval — into `art/final/`.
|
||||
|
||||
### Phase 1 — The rose alone · ~3–4 weeks · the spike
|
||||
|
||||
- One rose with her face: care with a touch of skill (water by feel, shade, weeds, petals), moods,
|
||||
thorns, growth from **total** days of care, drift instead of loss, her numbers one tap away, and
|
||||
speech-bubble teaching (`docs/GAMEPLAY.md` §1–2, §4).
|
||||
- **The sun**: real local sunset and sunrise, on device; polar day/night handled. Location: the player is asked *"Where do you want your sunset?"* (a city, skippable); if skipped, it is guessed from the device time zone. **Never GPS.** A finer guess (country from IP or carrier) is an open idea — it costs a network call, so it must be weighed against local-first.
|
||||
- **The in-game sunset** — move the chair, watch it again — as comfort and rehearsal; it tells the
|
||||
player when the real one is tonight.
|
||||
- **The day's sentence comes from the rose** (`docs/GAMEPLAY.md` §1): she waits with a folded petal;
|
||||
sunset is the best moment to open it, but it is never lost and no streak exists.
|
||||
- Installable PWA, fully offline, `navigator.storage.persist()`, export-my-rose.
|
||||
- The offline Playwright suite.
|
||||
|
||||
**Out of scope:** planets, fox, friends, any server.
|
||||
|
||||
**Gate — the spike's real question.** Mark plays it daily for two weeks on his phone. Then: *did he go
|
||||
and look at the real sunset without the game nagging him, and did the rose make him want to come back?*
|
||||
Yes on both is a go. Yes only on the second means a pleasant toy, not Rosea. No on both is a clean stop.
|
||||
|
||||
### Phase 2 — The planets and the fox · ~4–6 weeks
|
||||
|
||||
- The planets of lonely grown-ups, one at a time, each designed in its own feature doc (they need not
|
||||
all work the same way).
|
||||
- The fox follows at a distance and comes closer through **how the player acts**; short taming at the
|
||||
end of the journey. His berries come from the wild bush beside the player's own rose
|
||||
(`docs/GAMEPLAY.md` §3), so nothing here needs another player.
|
||||
- Collections: visitors who leave mementos while the player is away; the "sheep album" of the rose's
|
||||
strange requests; rare visitors with hidden conditions (sunrise-only visitors among them).
|
||||
- The *Geographer's book* — optional, private numbers about the player's own time.
|
||||
|
||||
**Gate:** a player who has never heard of the book finishes the first three planets and can say, in
|
||||
their own words, what one of them felt like.
|
||||
|
||||
### Phase 3 — Friends · ~4–6 weeks
|
||||
|
||||
- Tending a friend's rose; their fox brings them a real trace (a petal in your colour) and, now and
|
||||
then, a comfort line **you chose from the library**.
|
||||
- Thanks as one optional gesture — their fox visits your rose.
|
||||
- Paths between roses: footprints → trail → road.
|
||||
- Friend-to-friend sync over WebRTC: care travels like letters and merges when devices meet.
|
||||
- Invite by link; no account.
|
||||
- Forgotten friends' roses ripen berries for the fox (`docs/GAMEPLAY.md` §3).
|
||||
- The bridge to Amicitia: once a path is a road, lanterns, and the device-to-device key swap
|
||||
(`docs/GAMEPLAY.md` §5).
|
||||
|
||||
**Gate:** five friends, two weeks, no reminders from Mark. *Do they come back on their own, and does
|
||||
at least one of them describe a moment of being cared for?*
|
||||
|
||||
### Phase 4 — The shared sky · ~4–6 weeks · opt-in, separable
|
||||
|
||||
- `services/lucerna` in Rust: anonymous traces only (coarse cell, day bucket, gesture, auto-delete).
|
||||
- The shared night sky made of **real constellations**; acts of care light it; a completed
|
||||
constellation opens a new planet for everyone.
|
||||
- The lamplighter's wave: lamps following the sunset around the globe.
|
||||
- Keeping an absent stranger's rose alive with light — anonymous, no contact.
|
||||
- The consent ladder toward strangers: traces → a light → foxes meet only if both agree.
|
||||
|
||||
**Gate:** deleting `services/lucerna` leaves Phases 1–3 fully working, with no dead controls and no
|
||||
errors.
|
||||
|
||||
### Phase 5 — Real meetings and sharing · ~3–4 weeks
|
||||
|
||||
- One shared daily moment for everyone, and a spoiler-free image of your sky to share.
|
||||
- Group meetings in public places only (in the spirit of community days); never one-to-one.
|
||||
- The yearly moment on the anniversary of the player's first day.
|
||||
|
||||
**Gate:** a share image leaves the device containing nothing that identifies the player or anyone
|
||||
else.
|
||||
|
||||
### Phase 6 — Stores and money · ongoing
|
||||
|
||||
- Tauri 2 shell for Android and iOS: local sunset notifications without a server.
|
||||
- Monetisation — **not decided** (§6). Constraints already set: tending others is always free; no
|
||||
ads, no subscription-only, no sale of data.
|
||||
|
||||
---
|
||||
|
||||
## 5. Risks, stated as risks
|
||||
|
||||
| Risk | Why it could kill this | What reduces it |
|
||||
|:--|:--|:--|
|
||||
| **It makes a lonely person feel worse** | Guilt, comparison or an unanswered gesture hurts most the people this is for. | The Soul section in every review; `soul.md`; no counts, no streaks, no neglect notifications. |
|
||||
| **Cold start** | Phases 3–5 need people; Mark will have few players for months. | Phases 1–2 must stand alone; the fox's path to people comes after the game is already worth playing. |
|
||||
| **Content volume** | 365 sourced sentences and many planets is a lot of careful work. | Start with 60 sentences; library grows by tradition; the validator keeps quality. |
|
||||
| **Web notifications** | The sunset invitation may need a push server on the web, with a privacy cost. | Decided in Phase 0; the Tauri shell later removes the server. |
|
||||
| **Copyright** | The book and Tolkien are protected; a too-close image or line is a legal problem. | Forbidden-names lint; likeness check in the art pipeline; ideas only. |
|
||||
| **Medical-device scope** | Wellbeing claims can pull the app under medical rules. | Forbidden words in all copy, store text included. |
|
||||
| **Safety around strangers** | Lonely people are the people a scammer looks for. | No free text, ever; consent ladder; group meetings in public only. |
|
||||
| **One more product** | It competes for the same evenings as everything else in Domi. | The Phase 1 gate, treated as a real decision. |
|
||||
|
||||
---
|
||||
|
||||
## 6. Open questions
|
||||
|
||||
- **The sunrise mechanic** beyond sunrise-only visitors.
|
||||
- **The visual style.** Decided with Mark in `art/STYLE.md` before any final art is generated.
|
||||
- **The final name**, trademark and domain checks for Rosea Domi.
|
||||
- **Money.** Only the constraints are fixed (Phase 6).
|
||||
- **The Letter from the Gardener** — written by the author; its philosophy is his and is signed by him.
|
||||
@@ -2,6 +2,8 @@ import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test, type Page } from '@playwright/test';
|
||||
import { PRODUCT_NAME } from '@rosea/schema';
|
||||
import { en } from '@rosea/ui/copy';
|
||||
import { parseLetter } from '@rosea/ui/letter';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { BASE, startStaticServer, type StaticServer } from './static-server.js';
|
||||
|
||||
let server: StaticServer;
|
||||
@@ -104,3 +106,24 @@ test('the shell has no accessibility violations', async ({ page }) => {
|
||||
const results = await new AxeBuilder({ page }).analyze();
|
||||
expect(results.violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);
|
||||
});
|
||||
|
||||
// Tests whichever state docs/LETTER.md is in: empty now, the author's words later.
|
||||
test('the Letter: no way to it while empty, and it opens from the garden once written', async ({ page }) => {
|
||||
const written = parseLetter(readFileSync(new URL('../docs/LETTER.md', import.meta.url), 'utf8')).length > 0;
|
||||
await open(page);
|
||||
const link = page.getByRole('link', { name: en.letter.title });
|
||||
|
||||
if (!written) {
|
||||
await expect(link).toHaveCount(0);
|
||||
await page.goto(server.url + '#letter');
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveText(PRODUCT_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
await link.click();
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveText(en.letter.title);
|
||||
const results = await new AxeBuilder({ page }).analyze();
|
||||
expect(results.violations.map((v) => `${v.id}: ${v.help}`)).toEqual([]);
|
||||
await page.getByRole('link', { name: en.letter.back }).click();
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveText(PRODUCT_NAME);
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"default": "./src/index.ts"
|
||||
},
|
||||
"./copy": "./src/copy/en.ts",
|
||||
"./letter": "./src/letter/parse.ts",
|
||||
"./tokens.css": "./src/tokens.css"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,12 +1,55 @@
|
||||
<script lang="ts">
|
||||
import { PRODUCT_NAME } from '@rosea/schema';
|
||||
import { en } from './copy/en.js';
|
||||
import Letter from './letter/Letter.svelte';
|
||||
import { parseLetter } from './letter/parse.js';
|
||||
|
||||
/** The author's Markdown from docs/LETTER.md. Empty means there is no way to the page. */
|
||||
let { letter = '' }: { letter?: string } = $props();
|
||||
|
||||
const LETTER_HASH = '#letter';
|
||||
// Any hash but the letter's is the garden. A bare '#' is not a valid link target.
|
||||
const GARDEN_HASH = '#garden';
|
||||
|
||||
const blocks = $derived(parseLetter(letter));
|
||||
let hash = $state(location.hash);
|
||||
const view = $derived(hash === LETTER_HASH && blocks.length > 0 ? 'letter' : 'home');
|
||||
|
||||
let heading = $state<HTMLHeadingElement>();
|
||||
// Focus follows the view only after the player moved, never on the first load.
|
||||
let moved = false;
|
||||
|
||||
$effect(() => {
|
||||
const onChange = (): void => {
|
||||
moved = true;
|
||||
hash = location.hash;
|
||||
};
|
||||
window.addEventListener('hashchange', onChange);
|
||||
return () => window.removeEventListener('hashchange', onChange);
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
// Read `heading` first: an effect tracks only what it reads, and `moved` is not state.
|
||||
const target = heading;
|
||||
if (moved) target?.focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<main class="shell">
|
||||
<h1>{PRODUCT_NAME}</h1>
|
||||
<p>{en.shell.preparing}</p>
|
||||
</main>
|
||||
{#if view === 'letter'}
|
||||
<main class="shell page">
|
||||
<h1 bind:this={heading} tabindex="-1">{en.letter.title}</h1>
|
||||
<Letter {blocks} />
|
||||
<a href={GARDEN_HASH}>{en.letter.back}</a>
|
||||
</main>
|
||||
{:else}
|
||||
<main class="shell">
|
||||
<h1 bind:this={heading} tabindex="-1">{PRODUCT_NAME}</h1>
|
||||
<p>{en.shell.preparing}</p>
|
||||
{#if blocks.length > 0}
|
||||
<a href={LETTER_HASH}>{en.letter.title}</a>
|
||||
{/if}
|
||||
</main>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.shell {
|
||||
@@ -18,6 +61,11 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.page {
|
||||
place-content: start center;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-family: var(--font-display);
|
||||
@@ -27,8 +75,16 @@
|
||||
color: var(--rose);
|
||||
}
|
||||
|
||||
h1:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--rose);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,6 +9,11 @@ export const en = {
|
||||
shell: {
|
||||
/** The one line on the Phase 0 page. True, calm, and asks nothing. */
|
||||
preparing: 'The garden is being prepared.'
|
||||
},
|
||||
letter: {
|
||||
/** The help section's name (ROADMAP §1). The letter itself is the author's, in docs/LETTER.md. */
|
||||
title: 'A Letter from the Gardener',
|
||||
back: 'Back to the garden'
|
||||
}
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export { default as Shell } from './Shell.svelte';
|
||||
export { en, type Copy } from './copy/en.js';
|
||||
export { parseLetter, type Inline, type LetterBlock } from './letter/parse.js';
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<script lang="ts">
|
||||
import type { Inline, LetterBlock } from './parse.js';
|
||||
|
||||
let { blocks }: { blocks: readonly LetterBlock[] } = $props();
|
||||
</script>
|
||||
|
||||
{#snippet inlines(parts: readonly Inline[])}
|
||||
{#each parts as part, i (i)}
|
||||
{#if part.kind === 'link' && part.href.startsWith('tel:')}
|
||||
<a href={part.href}>{part.text}</a>
|
||||
{:else if part.kind === 'link'}
|
||||
<a href={part.href} target="_blank" rel="noopener noreferrer">{part.text}</a>
|
||||
{:else if part.kind === 'em'}
|
||||
<em>{part.text}</em>
|
||||
{:else}
|
||||
{part.text}
|
||||
{/if}
|
||||
{/each}
|
||||
{/snippet}
|
||||
|
||||
<article class="letter">
|
||||
{#each blocks as block, i (i)}
|
||||
{#if block.kind === 'heading' && block.level === 2}
|
||||
<h2>{@render inlines(block.inlines)}</h2>
|
||||
{:else if block.kind === 'heading'}
|
||||
<h3>{@render inlines(block.inlines)}</h3>
|
||||
{:else if block.kind === 'paragraph'}
|
||||
<p>{@render inlines(block.inlines)}</p>
|
||||
{:else}
|
||||
<ul>
|
||||
{#each block.items as item, j (j)}
|
||||
<li>{@render inlines(item)}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
{/each}
|
||||
</article>
|
||||
|
||||
<style>
|
||||
.letter {
|
||||
max-width: 38rem;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
h2,
|
||||
h3 {
|
||||
font-family: var(--font-display);
|
||||
font-weight: 400;
|
||||
color: var(--rose);
|
||||
margin: var(--space-4) 0 var(--space-2);
|
||||
}
|
||||
|
||||
p,
|
||||
ul {
|
||||
margin: 0 0 var(--space-3);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--rose);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* The Letter from the Gardener, from the author's Markdown to blocks the page
|
||||
* renders (.agents/features/letter-slot.md L3, L4).
|
||||
*
|
||||
* A deliberately small subset: headings, paragraphs, lists, *emphasis* and
|
||||
* links. Anything else is shown as the text it is. Nothing here builds HTML,
|
||||
* so nothing in the file can inject markup or script.
|
||||
*/
|
||||
|
||||
export type Inline =
|
||||
| { readonly kind: 'text'; readonly text: string }
|
||||
| { readonly kind: 'em'; readonly text: string }
|
||||
| { readonly kind: 'link'; readonly text: string; readonly href: string };
|
||||
|
||||
export type LetterBlock =
|
||||
| { readonly kind: 'heading'; readonly level: 2 | 3; readonly inlines: readonly Inline[] }
|
||||
| { readonly kind: 'paragraph'; readonly inlines: readonly Inline[] }
|
||||
| { readonly kind: 'list'; readonly items: readonly (readonly Inline[])[] };
|
||||
|
||||
/** The support door needs web and phone links, and nothing else does. */
|
||||
const ALLOWED_HREF = /^(?:https:\/\/\S+|tel:\+?[\d ()-]+)$/i;
|
||||
|
||||
// A link target may hold one level of brackets, as in tel:+420 (2) 123.
|
||||
const INLINE = /\[([^\]\n]+)\]\(((?:[^()\n]|\([^()\n]*\))+)\)|\*([^*\n]+)\*|_([^_\n]+)_/g;
|
||||
|
||||
function inlines(source: string): Inline[] {
|
||||
const parts: Inline[] = [];
|
||||
const text = (t: string): void => {
|
||||
if (t === '') return;
|
||||
const last = parts[parts.length - 1];
|
||||
if (last?.kind === 'text') parts[parts.length - 1] = { kind: 'text', text: last.text + t };
|
||||
else parts.push({ kind: 'text', text: t });
|
||||
};
|
||||
|
||||
let at = 0;
|
||||
for (const m of source.matchAll(INLINE)) {
|
||||
text(source.slice(at, m.index));
|
||||
const [, label, href, star, underscore] = m;
|
||||
if (label !== undefined && href !== undefined) {
|
||||
if (ALLOWED_HREF.test(href.trim())) parts.push({ kind: 'link', text: label, href: href.trim() });
|
||||
else text(label);
|
||||
} else {
|
||||
parts.push({ kind: 'em', text: star ?? underscore ?? '' });
|
||||
}
|
||||
at = m.index + m[0].length;
|
||||
}
|
||||
text(source.slice(at));
|
||||
return parts;
|
||||
}
|
||||
|
||||
export function parseLetter(markdown: string): LetterBlock[] {
|
||||
// Comments are the author's notes and the scaffold's slots, never the letter.
|
||||
const lines = markdown.replace(/\r\n?/g, '\n').replace(/<!--[\s\S]*?-->/g, '').split('\n');
|
||||
const blocks: LetterBlock[] = [];
|
||||
let paragraph: string[] = [];
|
||||
let list: Inline[][] = [];
|
||||
|
||||
const flush = (): void => {
|
||||
if (paragraph.length > 0) blocks.push({ kind: 'paragraph', inlines: inlines(paragraph.join(' ')) });
|
||||
if (list.length > 0) blocks.push({ kind: 'list', items: list });
|
||||
paragraph = [];
|
||||
list = [];
|
||||
};
|
||||
|
||||
for (const raw of lines) {
|
||||
const line = raw.trim();
|
||||
const heading = /^(#{1,6})\s+(.+)$/.exec(line);
|
||||
const item = /^[-*]\s+(.+)$/.exec(line);
|
||||
|
||||
if (line === '') {
|
||||
flush();
|
||||
} else if (heading !== null) {
|
||||
flush();
|
||||
blocks.push({ kind: 'heading', level: heading[1] === '#' ? 2 : 3, inlines: inlines(heading[2] ?? '') });
|
||||
} else if (item !== null) {
|
||||
if (paragraph.length > 0) flush();
|
||||
list.push(inlines(item[1] ?? ''));
|
||||
} else {
|
||||
if (list.length > 0) flush();
|
||||
paragraph.push(line);
|
||||
}
|
||||
}
|
||||
flush();
|
||||
return blocks;
|
||||
}
|
||||
@@ -1,10 +1,23 @@
|
||||
import { PRODUCT_NAME } from '@rosea/schema';
|
||||
import { cleanup, render, screen } from '@testing-library/svelte';
|
||||
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/svelte';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import Shell from '../src/Shell.svelte';
|
||||
import { en } from '../src/copy/en.js';
|
||||
|
||||
afterEach(cleanup);
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
window.location.hash = '';
|
||||
});
|
||||
|
||||
const LETTER = [
|
||||
'# Why',
|
||||
'',
|
||||
'A line.',
|
||||
'',
|
||||
'[Read](https://example.org) or [call](tel:+420123) or [not](javascript:alert(1)).'
|
||||
].join('\n');
|
||||
|
||||
const h1 = (): HTMLElement => screen.getByRole('heading', { level: 1 });
|
||||
|
||||
describe('Shell', () => {
|
||||
it('names the product in the page heading, from the schema constant', () => {
|
||||
@@ -24,3 +37,49 @@ describe('Shell', () => {
|
||||
expect(screen.getByRole('main')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Shell and the Letter', () => {
|
||||
it('with an empty letter offers no way to it, and #letter shows the garden', () => {
|
||||
window.location.hash = '#letter';
|
||||
render(Shell, { letter: '<!-- Slot: the signature. -->\n' });
|
||||
expect(h1().textContent).toBe(PRODUCT_NAME);
|
||||
expect(screen.queryAllByRole('link')).toEqual([]);
|
||||
});
|
||||
|
||||
it('with a letter, a link opens it, Back returns, and focus follows each heading', async () => {
|
||||
render(Shell, { letter: LETTER });
|
||||
expect(document.activeElement, 'nothing is focused on first load').toBe(document.body);
|
||||
|
||||
await fireEvent.click(screen.getByRole('link', { name: en.letter.title }));
|
||||
await waitFor(() => expect(h1().textContent).toBe(en.letter.title));
|
||||
await waitFor(() => expect(document.activeElement).toBe(h1()));
|
||||
expect(screen.getByRole('heading', { level: 2 }).textContent).toBe('Why');
|
||||
expect(screen.getByRole('main')).toBeTruthy();
|
||||
|
||||
await fireEvent.click(screen.getByRole('link', { name: en.letter.back }));
|
||||
await waitFor(() => expect(h1().textContent).toBe(PRODUCT_NAME));
|
||||
await waitFor(() => expect(document.activeElement).toBe(h1()));
|
||||
});
|
||||
|
||||
it('opens straight at #letter, as from a bookmark', () => {
|
||||
window.location.hash = '#letter';
|
||||
render(Shell, { letter: LETTER });
|
||||
expect(h1().textContent).toBe(en.letter.title);
|
||||
});
|
||||
|
||||
it('renders https links in a new tab with no referrer, tel links in place, and nothing else as a link', () => {
|
||||
window.location.hash = '#letter';
|
||||
render(Shell, { letter: LETTER });
|
||||
const read = screen.getByRole('link', { name: 'Read' });
|
||||
expect(read.getAttribute('href')).toBe('https://example.org');
|
||||
expect(read.getAttribute('target')).toBe('_blank');
|
||||
expect(read.getAttribute('rel')).toBe('noopener noreferrer');
|
||||
|
||||
const call = screen.getByRole('link', { name: 'call' });
|
||||
expect(call.getAttribute('href')).toBe('tel:+420123');
|
||||
expect(call.getAttribute('target')).toBeNull();
|
||||
|
||||
expect(screen.queryByRole('link', { name: 'not' })).toBeNull();
|
||||
expect(screen.getByText(/or not\./)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { parseLetter } from '../src/letter/parse.js';
|
||||
|
||||
describe('parseLetter', () => {
|
||||
it('reads a file of only comments as an empty letter', () => {
|
||||
const scaffold = '<!--\n A note for the author.\n-->\n\n<!-- Slot: one -->\n<!-- Slot: two -->\n';
|
||||
expect(parseLetter(scaffold)).toEqual([]);
|
||||
expect(parseLetter('')).toEqual([]);
|
||||
expect(parseLetter(' \n\n \r\n')).toEqual([]);
|
||||
});
|
||||
|
||||
it('reads headings, paragraphs joined across lines, and lists', () => {
|
||||
const md = '# Why\n\nOne line\nand the next.\n\n## How\n- first\n* second\n\nLast.';
|
||||
expect(parseLetter(md)).toEqual([
|
||||
{ kind: 'heading', level: 2, inlines: [{ kind: 'text', text: 'Why' }] },
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'text', text: 'One line and the next.' }] },
|
||||
{ kind: 'heading', level: 3, inlines: [{ kind: 'text', text: 'How' }] },
|
||||
{ kind: 'list', items: [[{ kind: 'text', text: 'first' }], [{ kind: 'text', text: 'second' }]] },
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'text', text: 'Last.' }] }
|
||||
]);
|
||||
});
|
||||
|
||||
it('maps every heading below the first level to h3', () => {
|
||||
expect(parseLetter('### Deep\n\n###### Deeper')).toEqual([
|
||||
{ kind: 'heading', level: 3, inlines: [{ kind: 'text', text: 'Deep' }] },
|
||||
{ kind: 'heading', level: 3, inlines: [{ kind: 'text', text: 'Deeper' }] }
|
||||
]);
|
||||
});
|
||||
|
||||
it('reads CRLF files the same as LF', () => {
|
||||
expect(parseLetter('# A\r\n\r\nB\r\nC')).toEqual(parseLetter('# A\n\nB\nC'));
|
||||
});
|
||||
|
||||
it('reads emphasis and links inside a paragraph', () => {
|
||||
expect(parseLetter('A *quiet* door: [call](tel:+420 123 456) or [read](https://example.org/x).')).toEqual([
|
||||
{
|
||||
kind: 'paragraph',
|
||||
inlines: [
|
||||
{ kind: 'text', text: 'A ' },
|
||||
{ kind: 'em', text: 'quiet' },
|
||||
{ kind: 'text', text: ' door: ' },
|
||||
{ kind: 'link', text: 'call', href: 'tel:+420 123 456' },
|
||||
{ kind: 'text', text: ' or ' },
|
||||
{ kind: 'link', text: 'read', href: 'https://example.org/x' },
|
||||
{ kind: 'text', text: '.' }
|
||||
]
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it('reads a phone number with brackets as one link', () => {
|
||||
expect(parseLetter('[call](tel:+420 (2) 123)')).toEqual([
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'link', text: 'call', href: 'tel:+420 (2) 123' }] }
|
||||
]);
|
||||
});
|
||||
|
||||
it('keeps only the label of a link whose scheme is not https: or tel:', () => {
|
||||
for (const href of ['javascript:alert(1)', 'data:text/html,x', 'http://example.org', '/relative', 'JavaScript:x']) {
|
||||
expect(parseLetter(`[label](${href})`), href).toEqual([
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'text', text: 'label' }] }
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
it('never produces markup: raw HTML stays text', () => {
|
||||
const blocks = parseLetter('<script>alert(1)</script>\n\n<b onclick="x">bold</b>');
|
||||
expect(blocks).toEqual([
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'text', text: '<script>alert(1)</script>' }] },
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'text', text: '<b onclick="x">bold</b>' }] }
|
||||
]);
|
||||
});
|
||||
|
||||
it('drops a comment in the middle of a paragraph and keeps the words around it', () => {
|
||||
expect(parseLetter('Before <!-- a note --> after.')).toEqual([
|
||||
{ kind: 'paragraph', inlines: [{ kind: 'text', text: 'Before after.' }] }
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,8 @@
|
||||
* @rosea/content (copy-lint.ts, forbidden.ts) and are tested there.
|
||||
*
|
||||
* Not scanned: .agents/ and docs/, where the forbidden words may appear because
|
||||
* they are being discussed (§5.6 rule 4).
|
||||
* they are being discussed (§5.6 rule 4). The one exception is docs/LETTER.md:
|
||||
* it lives with the docs but a player reads it (letter-slot.md L6).
|
||||
*/
|
||||
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
||||
import { extname, join, relative } from 'node:path';
|
||||
@@ -21,8 +22,8 @@ const TARGETS: readonly { dir: string; ext: readonly string[] }[] = [
|
||||
{ dir: 'store', ext: ['.md', '.txt', '.json'] }
|
||||
];
|
||||
|
||||
/** Single files: the page shell and the config that builds the web manifest. */
|
||||
const FILES: readonly string[] = ['apps/rosea/index.html', 'apps/rosea/vite.config.ts'];
|
||||
/** Single files: the page shell, the config that builds the web manifest, and the Letter. */
|
||||
const FILES: readonly string[] = ['apps/rosea/index.html', 'apps/rosea/vite.config.ts', 'docs/LETTER.md'];
|
||||
|
||||
function walk(dir: string, ext: readonly string[]): string[] {
|
||||
if (!existsSync(dir)) return [];
|
||||
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"ui": "stream",
|
||||
"globalDependencies": ["content/**"],
|
||||
// docs/LETTER.md is bundled into the app (letter-slot.md L1). Without it here a
|
||||
// changed letter replays the cached build and never reaches the player.
|
||||
"globalDependencies": ["content/**", "docs/LETTER.md"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
|
||||
Reference in New Issue
Block a user