diff --git a/.impeccable/design.json b/.impeccable/design.json index 94e40b0..e76e349 100644 --- a/.impeccable/design.json +++ b/.impeccable/design.json @@ -579,7 +579,7 @@ "Card stock on a textured linen board, meeting it at a 1px rule edge with a 2px corner.", "Blue means after, madder means before, everywhere: walk lines, chart bars, tree captions, the readout.", "One stroke weight (1.4) for every drawn line in every diagram.", - "Libre Caslon Text 700 for headings, numbers and labels on cards; its italic for names and the pitch; system-ui for reading.", + "Libre Caslon Text 700 for headings, numbers and labels on cards; its 400 italic for names and the pitch (the only two Caslon faces shipped); system-ui for reading.", "Ruled lists, field lists and tables carry the content; hairline rules separate every row." ], "rules": [ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8e7dcc5 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,154 @@ +# CLAUDE.md + +Optimized Local Housing: a standalone Timberborn 1.1 mod (C#, no Harmony, no Mod Settings) that re-houses adult +beavers once a day for the shortest total home-to-work route cost. Mod source in `OptimizedLocalHousing/`, game-free +tests in `OptimizedLocalHousing.Tests/`, packaging in `package.ps1`, the website in `docs/`. Changes land on main by +PR → merge. + +- **Tests (what CI runs, `.github/workflows/tests.yml`, SDK 8):** `dotnet run --project OptimizedLocalHousing.Tests -c Release` + must end with `40 checks passed.` (41 exist; the compiled-adapter check needs the built mod and the game, so it runs + only locally with two extra arguments; see README "Build and test"). +- **Build and package** (needs a local Timberborn install; never done in CI): see README "Build and test", then `./package.ps1`. + +## Standing rules + +- Never launch or drive Timberborn, and never touch installed mods or saves. The maintainer (Kyler) playtests himself. +- Commit on a branch and open a PR. Merge only when Kyler says so in the chat. +- Assume fresh games: no old-save compatibility notes on the site. Don't mention Incremental Housing (removed on purpose). +- Compare fairly with Bobingabout's Housing Optimize and Commute Balancer, by what their Workshop pages say. Never + "the best housing mod". The 25.6 vs 24.1 figure is a model with straight-line distances, not a benchmark. + +## Website + +- **Where:** `docs/`: `index.html`, `install.html`, `troubleshooting.html`, `faq.html`, `404.html`, `style.css`, + `site.js` (theme toggle, chart tooltip, opens the `
` a `#hash` names), `seating.js` (the hero demo), + `release.js`, `favicon.svg`, `.nojekyll`, `fonts/`, `textures/`. Live at https://timbermods.github.io/OptimizedLocalHousing/. +- **Published:** GitHub Pages serves `main:/docs` (legacy build), so merging to main publishes; a build takes about a minute. +- **Look:** "The Seating Chart". A host's planner's board: tented place cards and card stock pinned to linen, the hall + drafted in blue for the plan as arranged and madder for the plan as it was. The look is fixed: updates extend it and + never restyle it. +- **Design records (read these before any site change):** + - `PRODUCT.md`: the facts, voice, honest status and every site contract (Capabilities and Constraints). + - `DESIGN.md`: the visual system and its named rules, the source of truth for the look. + - `.impeccable/surfaces/docs-index-html.md`: the direction contract. + - `.impeccable/design.json`: tokens and component snippets. + - `.impeccable/critique/`: the pre-redesign critique. + +### Design rules (from DESIGN.md; keep them) + +- **The Before-and-After Rule**: madder is the plan as it was, drafting blue the plan as arranged, on every line, bar, + caption and readout. Never swap them or use either as decoration; anything else is ink (links, focus and pins excepted). +- **The Workplace Hues Stay in the Hall Rule**: lumber brown, farm green and water teal (`--w-L/F/W`) only tell the three + workplaces apart inside diagrams. Never on text, buttons or sections. +- **The Caslon for Things on Cards Rule**: headings, names, numbers and card lettering are Libre Caslon Text; reading + text is system-ui; guests' names are always Caslon italic. +- **The Numbers Are Figures Rule**: evidence is Caslon 700 with tabular figures in a labelled field list (`dl.fields`) + or the readout, never stat tiles. +- **The Only Pins Cast Shadows Rule**: cards meet the board at a 1px `--rule` edge and cast nothing. Shadows exist only on + the two 10px madder pins (`0 2px 2px rgba(0,0,0,.25)`) and the chart tooltip while it shows. +- Tokens live in `docs/style.css`: `:root` (light), then dark twice, under `@media (prefers-color-scheme: dark) + :root:not([data-theme="light"])` and under `:root[data-theme="dark"]`; change both dark blocks together. + Light / dark: ground `#e6e1d6` / `#1b1d21`, card `#fbf8f1` / `#26292e`, card back `#ebe4d4` / `#1f2226`, ink + `#23201b` / `#ece6da`, muted `#5a544a` / `#b3ab9e`, rule `#cfc7b8` / `#3b3f46`, blue `#2d5f9a` / `#8fb6e8` (hover + `#1f4677` / `#b3cdf0`), madder `#b4432f` / `#e98a74`, button ink `#fff` / `#10192a`; workplaces `#8a5a2b` `#5b7a24` + `#2a7390` (dark `#d19a63` `#a3c46a` `#74bdd8`). Band is ink at 4% / 3.5%. +- Shape and line: 2px corners (SVG cards 1.5px, bars 1px); circles only for tables, pins, kits, chips and step + numerals; every diagram stroke 1.4 (2.4 only on a moved or farther place card); dashes mean before (4 4) or never moves (2 2). +- Layout: 1160px column, gutter `clamp(16px, 4vw, 32px)`, sections split by a full-width ink rule (`section.ruled`), + content as ruled lists with hairlines, never tiles. Breakpoints 960 / 860 / 720 / 560px; at 720px the comparison + table stacks into a labelled block per row (`td[data-label]`), so every new cell needs its `data-label`. +- Fonts: Libre Caslon Text 700 and 400 italic only, self-hosted in `docs/fonts/` (OFL, `OFL-LibreCaslon.txt`); the 700 + is preloaded in each ``. No other webfonts, and nothing from a CDN at runtime. +- Textures: `docs/textures/{board,card}-{light,dark}.webp`, made by `docs/textures/make_textures.py` (numpy + Pillow, + fixed seeds; run `python make_textures.py` from that folder). Change the script and re-run it rather than editing + images. Every shipping raster carries provenance (the `.webp.json` sidecars): run the Impeccable `embed-prompt` + command on each new or changed image, and `embed-prompt --scan docs` to check none is missing. +- Themes: light and dark, from `prefers-color-scheme` plus the header toggle, stored in localStorage as `olh-theme` + (`data-theme` on ``); the one-line bootstrap in every `` sets it before the stylesheet. Check both. +- Phones: no horizontal scroll at 390px, and tap targets ≥ 44px. +- Motion: the day's pass on the seating plan: place cards move round their cycles over 900ms + `cubic-bezier(.45, 0, .2, 1)` with the walk lines hidden in transit. Buttons lift 1px over 150ms. Everything respects + `prefers-reduced-motion` (cards jump, the totals still update). +- Don't: bring back the Timbermods landing template (cream paper, icon tiles, stat tiles, pill badges, eyebrows); no + gradients; no shadows on cards, buttons or diagrams; no display face but Libre Caslon Text (not Fraunces); no + official Timberborn logos or key art (the marks are `favicon.svg` and simple line icons). +- New components: build them from the tokens and components above, match the neighbouring sections, and add them to DESIGN.md. + +### The seating demo (hero) and its diagrams + +- `seating.js` reads the hall from the SVG's data attributes (`data-station`/`data-x`/`data-y`, `.table` `data-beds`, + `.pc` `data-work`/`data-home`/`data-seat`), tries every arrangement (`solve()`, ties go to fewest movers) and reports + what it computes. Today: `185 → 144`, 3 beavers moved in 1 cycle, Maple (+4) walks farther. The static readout + (`185` in `[data-readout]`) and the move-cycle figure in `#how` (Birch B→A, Sorrel A→C, Maple C→B, and its + aria-label) must match what the code computes. Never type numbers the code doesn't produce. +- The hall SVG in `index.html` is hand-maintained (its generator was never committed). If you change a home, bed count, + guest or station, keep `CHAIRS` in `seating.js`, the static `x1..y2` walk lines and card transforms in step, then + re-check: in the preview run `document.querySelector('[data-pass]').click()`, wait a second, and read + `document.querySelector('[data-readout]').innerText`; update the static total and the cycle figure to match. + +### Content rules + +- Describe the mod as it is now. No "New in ", "added in …" or version history on player pages; that belongs + in the README changelog and the GitHub release notes. Upgrade steps players need are the only exception. +- The played and not-played status matches the README exactly: the 1.0 code (released as 1.0.0) ran 16 passes in a + live game, including one hosted co-op session; 1.1.0's changes and anything since are covered by automated tests but + not played; no live two-player session on 1.1.x; frame time, Iron Teeth, non-Windows and MultiColony live play untested. + Replay numbers always say "straight-line stand-in". Never invent numbers, reviews or screenshots. +- Keep the credits: MIT, maintained by Timbermods; Housing Optimize and Commute Balancer are Bobingabout's. Keep the + "unofficial, not affiliated with or endorsed by Mechanistry" line in every footer. +- Terminology: pass; move cycle; route cost / route-cost unit (the game's own, not straight-line); commute; adults, + children, homes, workplaces, districts; the 32 nearest homes; rejected, stale; Hungarian algorithm. +- `docs/release.js` is shared across timbermods sites and byte-identical: replace it, never edit it. Check: + `git hash-object docs/release.js` equals `gh api repos/timbermods/MixedStorage/contents/site/assets/release.js -q .sha`. +- `404.html` uses absolute `/OptimizedLocalHousing/` paths and loads no scripts (unstyled on the local preview; that's expected). + +### Update the website for a new release + +When asked to "update the website for the latest release, consistent with the design": +1. Read the release and the docs: `gh release list -R timbermods/OptimizedLocalHousing -L 5`, + `gh release view -R timbermods/OptimizedLocalHousing`, README (incl. Changelog and "What has not been + measured"), PRODUCT.md. List every player-facing change. +2. Update every place the site states a changed fact (`grep -rn "1\.1\.1" docs/` finds the version ones): + - Static release fallbacks: `data-release="tag"` / `"version"` (index hero and closing Download, install Download + and `loaded.` log line, troubleshooting log table and mod-list line), `data-release="asset-name"` and + `"sha256"` (install `#checksum`; take the hash from the release's SHA256SUMS asset). + - `data-release-pinned`: index `.status-note` and `#status` head, FAQ `#does-it-have-settings` and `#is-it-stable`; + bump after re-checking the text. + - Status: index `.status-note`, `#status` Tested / Not yet lists (incl. "41 automated checks: 40 run on every + change": match the test output), install `#multiplayer`, FAQ `#does-it-work-in-multiplayer` and `#is-it-stable`, + troubleshooting `#multiplayer`. + - Requirements and game version (built against 1.1.2.4, minimum 1.1.0.0): install `#requirements`, FAQ + `#which-game-versions-operating-systems`, troubleshooting `#update`, index hero lead and meta description. + - Behaviour: index `#features` (six rules; the head says "Six rules"), `#how` steps, `#rules` always / never, + `#compare` table, `#results`; FAQ `#does-it-have-settings` (tuning constants); log messages in troubleshooting + `#log` table and symptoms; install `#layout` (the `version-1.1` folder tree), `#update`, `#uninstall`. + - `` / `og:description` on every page, and PRODUCT.md's Operating Context. +3. Put new content into the existing components: a rule → `ul.rules-key` item (h3 + p); always / never → `ul.checks` / + `ul.checks.never`; tested / not yet → `.status-grid` `ul.checks` / `ul.checks.open`; a log message → a troubleshooting + table row plus a `details.q` with an `id`; a question → `details.q` with `div.answer` in the right FAQ group; + evidence → `dl.fields`; install steps → `ol.steps`. Don't restyle anything. +4. Test: `dotnet run --project OptimizedLocalHousing.Tests -c Release` (ends `40 checks passed.`). There is no site + test in CI; check the contracts in PRODUCT.md by hand, the release.js hash above, and the seating demo numbers. +5. Preview: `python -m http.server 8784 -d docs` (background), then open http://localhost:8784/. Capture light, dark + and a 390px phone. If the personal `impeccable-site-flow` skill is available, use + `python /scripts/capsite.py http://localhost:8784/ "" install.html troubleshooting.html faq.html` + (overflow must be 0); otherwise use the Browser pane in both colour schemes at desktop and mobile sizes. Check the + changed sections and that there's no horizontal scroll. Stop the server afterwards. +6. Optional but recommended: run the detector, + `"$(ls -d ~/.claude/plugins/cache/impeccable/impeccable/*/skills/impeccable | tail -1)/scripts/impeccable" detect --json docs` + (exits 2 when it finds anything; parse from the first `[`). Baseline is 23 findings, all known false positives: + `cramped-padding` on `.ruled`, `.page-head`, `.compare`, `.sheet`, `.stock` (padding via clamp and nesting); + `flat-type-hierarchy` (footer h2s); `design-system-color` rgb(0,0,0) on 404 (absolute CSS path it can't resolve); + `design-system-font-size` for 1.02rem, 1.16rem, .94rem, .82rem, 15px and `clamp(1.55rem, 2.8vw, 2rem)` (sizes + DESIGN.md gives as ranges). Anything new is real until shown otherwise. +7. If the look changed (a new component or layout), update DESIGN.md and `.impeccable/design.json`. +8. Update the README if it repeats the facts. +9. Ship: branch → commit → push → `gh pr create`. After Kyler says merge: `gh pr merge --merge` (that publishes), + then verify: + - `gh api repos/timbermods/OptimizedLocalHousing/pages/builds/latest -q .status` is `built`; + - `curl -s https://timbermods.github.io/OptimizedLocalHousing/ | grep -c ""` finds the change. + +### Full redesign + +A new look goes through the whole Impeccable flow (init → critique → audit → direction → build → finish review → +DESIGN.md). With the personal skill: "use the impeccable-site-flow skill to redesign this site". diff --git a/DESIGN.md b/DESIGN.md index 9f747be..02eee11 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -168,7 +168,7 @@ Confirmed rejections: the shared Timbermods landing template (cream paper, icon - Card stock on a textured linen board, meeting it at a 1px rule edge with a 2px corner. - Blue means after, madder means before, everywhere: walk lines, chart bars, tree captions, the readout. - One stroke weight (1.4) for every drawn line in every diagram. -- Libre Caslon Text 700 for headings, numbers and labels on cards; its italic for names and the pitch; system-ui for reading. +- Libre Caslon Text 700 for headings, numbers and labels on cards; its 400 italic for names and the pitch (the only two Caslon faces shipped); system-ui for reading. - Ruled lists, field lists and tables carry the content; hairline rules separate every row. ## Colors @@ -201,7 +201,7 @@ A quiet paper-and-ink palette with two drafting inks that carry meaning, plus th ## Typography -**Display Font:** Libre Caslon Text 400, 400 italic, 700 (self-hosted woff2, OFL), with Georgia, Times New Roman, serif +**Display Font:** Libre Caslon Text 700 and 400 italic only (self-hosted woff2 in `docs/fonts/`, OFL; there is no roman 400), with Georgia, Times New Roman, serif **Body Font:** system-ui stack **Label/Mono Font:** ui-monospace, Cascadia Mono, Consolas stack, for log lines and Pass-line field names diff --git a/PRODUCT.md b/PRODUCT.md index 81137c5..8b5b1cd 100644 --- a/PRODUCT.md +++ b/PRODUCT.md @@ -86,10 +86,11 @@ Success, in order: ## Capabilities and Constraints - **Stack and hosting:** plain static HTML, CSS and small vanilla JS in `docs/` on `main`, no build step. Pages: - `index.html` (hero, why, features, how a pass works, what it always / never does, results, tested vs not), - `install.html`, `troubleshooting.html`, `faq.html`, `404.html`, plus `style.css`, `site.js` (theme toggle stored as - `olh-theme`, the results-chart tooltip, and opening the `
` entry a `#hash` points at), `release.js`, - `favicon.svg` and `.nojekyll`. GitHub Pages serves **`main:/docs`** (legacy build) at + `index.html` (hero with the seating plan, why, features, how a pass works, what it always / never does, the + comparison, results, tested vs not), `install.html`, `troubleshooting.html`, `faq.html`, `404.html`, plus + `style.css`, `site.js` (theme toggle stored as `olh-theme`, the results-chart tooltip, and opening the `
` + entry a `#hash` points at), `seating.js` (the hero demo), `release.js`, `favicon.svg`, `fonts/` (Libre Caslon Text, + OFL), `textures/` and `.nojekyll`. GitHub Pages serves **`main:/docs`** (legacy build) at https://timbermods.github.io/OptimizedLocalHousing/, so a change is live once it is merged to `main`. One of the timbermods sites; https://timbermods.github.io/ is the catalog the footer links to. - **Site tests and CI:** none. Nothing in `OptimizedLocalHousing.Tests/` or `.github/workflows/tests.yml` checks @@ -131,16 +132,15 @@ Success, in order: in 20 cycles; a second pass changed nothing). Always say it's a stand-in. - Present it as "stable means this evidence plus the automated tests, not that every situation has been tried", without scaring people off. -- **Mismatches in the current site to fix, not copy:** - - The home page says "41 automated checks pass on every change": the suite has 41, but CI runs 40; the - compiled-adapter check runs only locally with the game. - - `install.html` (Multiplayer) and the FAQ multiplayer answer say only "1.1.0 hasn't yet been played live by two - players"; the truth is neither 1.1.0 nor 1.1.1 has (the home page already says so). - - The FAQ's "Is it stable?" answer walks through 1.0.0, 1.0.1, 1.1.0 and 1.1.1: version history that belongs in the - README changelog. Keep only the evidence. - - The Updating steps and the "Saved state ignored" answer mention saves from earlier versions and a pass that - restarts once; keep that to the one upgrade fact players need, or drop it. - - The README (not the site) still names MultiColony "1.4.0-alpha21" as the audited version. +- **How the shipped site states these facts (keep it this way):** + - The home page's Tested list says "41 automated checks: 40 run on every change, and one runs against the installed + game" (CI runs 40; the compiled-adapter check runs only locally with the game). + - The home status, `install.html` (Multiplayer), the FAQ multiplayer and "Is it stable?" answers and the + troubleshooting multiplayer entry say the live session ran the code the stable release started from, and that + this release hasn't been played live by two players. None of them walks through version history. + - The Updating steps and the "Saved state ignored" answer carry no old-save notes (fresh games are assumed). + - Neither the README nor the site names a MultiColony version: its code was audited against this mod, not played + with it. ## Brand Commitments @@ -155,12 +155,15 @@ Success, in order: ## Evidence on Hand -- **Images:** only `docs/favicon.svg`. There is no mod icon PNG, no Open Graph image, no `Media/` folder. -- **Diagrams drawn for the site:** the hero's before/after SVG (captioned "Illustration only, not real data") and the - move-cycle diagram. They are illustrations, not screenshots. +- **Images:** `docs/favicon.svg` and the procedural board and card textures in `docs/textures/` (made by + `make_textures.py`). There is no mod icon PNG, no Open Graph image, no `Media/` folder. +- **Diagrams drawn for the site:** the hero's seating plan (a toy hall of three homes, three workplaces and eight + made-up beavers; `seating.js` works out the best arrangement on the page, 185 → 144; captioned as an illustration + with straight-line distances) and the move-cycle figure, which redraws that same pass. They are illustrations, not + screenshots. - **Real data:** the replay results above (the bar chart and its table); the live log figures (16 passes, about 183 ticks and 5,350 route queries each, 0 to 4 cycles); two real `Pass` lines from the maintainer's log (Pass 26 and - Pass 34, quoted on the install and troubleshooting pages); the FAQ's measured "let adult counts change" experiment + Pass 34; Pass 26 is quoted on the home and install pages, Pass 34 on the troubleshooting page); the FAQ's measured "let adult counts change" experiment (average 24.0 to 23.1, about 4%, while homes able to have a baby fell from 11 to 1; one colony, straight-line stand-in); the tick and memory figures in the README (47 vs 157 solve ticks; 480 vs 1,118 ticks for 1,600 adults). - **Does not exist, and must not be faked:** in-game screenshots or clips of the mod at work (there is no UI to