|
| 1 | +# Next steps — handover to a fresh instance |
| 2 | + |
| 3 | +**Written:** 2026-07-25, at the end of a long session, by the instance that did |
| 4 | +the calendar beautification work below. Written *for the next instance* because |
| 5 | +this one's context was running out, not because the work is hard. |
| 6 | + |
| 7 | +**Read [`docs/CLAUDE.md`](../../CLAUDE.md) first.** It is the orientation and it |
| 8 | +is current. This file only adds *what to do next*, in order. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Where things stand (verified, not remembered) |
| 13 | + |
| 14 | +Verify before trusting any of this — the project's own rule is that a claim is |
| 15 | +backed by a command's output: |
| 16 | + |
| 17 | +```bash |
| 18 | +uv sync --extra dev && uv run pytest -q && uv run ruff check . |
| 19 | +``` |
| 20 | + |
| 21 | +At the time of writing: **1000 tests green, ruff clean**, working tree clean, |
| 22 | +`main` pushed to `github.com/DocAtPrompt/ctrlgrid` at `9ab9bbf`. The repository |
| 23 | +has its **first star** — which is why phase 0 below is the online presence and |
| 24 | +not a feature. |
| 25 | + |
| 26 | +### What that session changed (all pushed) |
| 27 | + |
| 28 | +A beautification pass over every calendar view, plus two real features. The |
| 29 | +thread running through nearly all of it: **positions were guessed instead of |
| 30 | +measured**, and each guess showed up as a misalignment. |
| 31 | + |
| 32 | +| Area | What changed | |
| 33 | +|---|---| |
| 34 | +| title page | `background_image` (PNG over the colour, `cover`/`contain`), opt-in `header`/`footer` | |
| 35 | +| header/footer | `Band.background` (full-width strip, band height only) + `Band.text_color` — tool-wide, every generator | |
| 36 | +| contents | one centred column, groups separated by whitespace, vertically centred, optional colour key (`legend`) | |
| 37 | +| full-year | one right edge per column, week numbers (linked when week pages exist), month name over its own column, grid sized from content | |
| 38 | +| half-year | day number centred in its row, optional `year_view.day_numbers: both` | |
| 39 | +| month + week | weekday left / number right-aligned, one shared `date_columns`/`date_label` | |
| 40 | +| day | schedule hours right-aligned (were space-padded), one shared left edge for all block rules, opt-in `half_hours` | |
| 41 | +| marked days | `Holiday.color` + `holiday_color`, shown behind the day in all five views | |
| 42 | +| notes | `notes` takes one pad **or a list**; each pad has its own count, surface, label, numbering from 1, and index; indexes link to each other | |
| 43 | +| everywhere | nav strip moved to the right edge (it fought the page title for the left corner) | |
| 44 | + |
| 45 | +Four new pre-flight refusals came with it (contents too tall, mini-month too |
| 46 | +wide, `half_hours` on a block with no hours, a legend line with no colour). If |
| 47 | +you add a content-sized layout, add its refusal too — that is the pattern. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Phase 0 — the online presence (do this first) |
| 52 | + |
| 53 | +A visitor arriving from that star sees the README and the gallery. Both are |
| 54 | +behind. **Two gaps found by inspection, both verified:** |
| 55 | + |
| 56 | +1. **`README.md` does not mention the calendar at all** (`grep -c calendar |
| 57 | + README.md` → 0). The largest feature in the project is invisible on its front |
| 58 | + page. The README's "What it generates" section lists the blades; the calendar |
| 59 | + is not a blade but a *document generator*, and it needs its own short section |
| 60 | + — a linked, write-on planner, one PDF, tap a date and land on that day. |
| 61 | + |
| 62 | +2. **There is no calendar example** (`ls examples/ | grep -c calendar` → 0). |
| 63 | + Thirteen examples exist, `01`–`11`, and none is the calendar. Add |
| 64 | + `12-calendar-year.yaml` + its rendered PDF + PNG preview, in the same shape |
| 65 | + as the others, and let `test_every_example_validates` cover it. Keep it |
| 66 | + small — a calendar with every view on is ~460 pages; consider a definition |
| 67 | + that shows the *look* (title page with a background, coloured bands, a couple |
| 68 | + of note pads, a legend) rather than a full year of day pages, or accept the |
| 69 | + size deliberately and say so in the file's comment. |
| 70 | + |
| 71 | +3. **`HANDBOOK.md` § "`calendar` — a linked, write-on planner" (around line 794) |
| 72 | + predates all of the above.** It documents `year`, the views and `calendar-a4`, |
| 73 | + but not: `holidays_file`, `Holiday.color`/`holiday_color`, `legend`, |
| 74 | + `title_page.background_image`/`background_fit`/`header`/`footer`, |
| 75 | + `year_view.day_numbers`, `half_hours`, or note **pads**. The band colours |
| 76 | + (`background`/`text_color`) belong in the handbook's header/footer section, |
| 77 | + not the calendar one — they are handle furniture and work for every generator. |
| 78 | + |
| 79 | +Also refresh the **rendered gallery**: several example PDFs predate the band |
| 80 | +colours and the nav move, so their PNG previews no longer match what the tool |
| 81 | +produces. Rebuild them from their own definitions. |
| 82 | + |
| 83 | +**Do not invent numbers for the README.** Run the suite and quote what it says. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Phase 1 — the first bulk, in this order |
| 88 | + |
| 89 | +### 1a. An edge ruler (small, high show-value) |
| 90 | + |
| 91 | +A printed centimetre/inch scale along one page edge, opt-in. Handle furniture, |
| 92 | +not a blade — it belongs beside `hole_marks` and `border` in `frame.py`, drawn |
| 93 | +from the sheet, and it is the only feature that *demonstrates the one promise on |
| 94 | +every sheet*: lay a real ruler against it. Cheap (`Segment` + `Text`), and the |
| 95 | +best screenshot the README could have. |
| 96 | + |
| 97 | +Decide with the user: which edges, whether it sits inside the margin or in it, |
| 98 | +and whether it is refused when the margin is too narrow for its labels (it |
| 99 | +should be — measure the label and refuse loudly rather than clipping). |
| 100 | + |
| 101 | +### 1b. Angled line families (the leveraged one) |
| 102 | + |
| 103 | +**`lines` has no angle** — verified, there is no `angle` anywhere in |
| 104 | +`ctrlgrid/generators/lines.py`. Adding a family of parallel lines at an angle |
| 105 | +unlocks two unrelated things at once, which is the signal that it is the right |
| 106 | +abstraction and not a special case: |
| 107 | + |
| 108 | +- **calligraphy and handwriting guides** — italic slant lines (typically 5° |
| 109 | + from vertical for the pen angle, 55° for the slant), plus baseline / x-height / |
| 110 | + ascender / descender rulings. § 15 open question 4 already asks about **nib |
| 111 | + widths** as a unit: "x-height = 4 nib widths" is a genuine measure, and would |
| 112 | + be a new unit in `units.py` the way `sp` (staff spaces) already is. |
| 113 | +- **origami pre-creasing** — the diagonals of phase 2c. |
| 114 | + |
| 115 | +Design note: the clipping is the interesting part. `perspective` already clips |
| 116 | +rays to the pattern area with Liang–Barsky (`ctrlgrid/generators/perspective.py`) |
| 117 | +— reuse that, do not write a second clipper. |
| 118 | + |
| 119 | +### 1c. International presets (cheapest reach) |
| 120 | + |
| 121 | +Pure preset work, no code: |
| 122 | +- **Genkō yōshi** — Japanese manuscript paper, 20×20 squares with a centre gutter. |
| 123 | +- **Séyès** — French ruling: 8 mm horizontals with 2 mm subdivisions and verticals. |
| 124 | +- **Knitting gauge** — stitches and rows are *not* square; two different axis |
| 125 | + spacings, which `dots`/`grid` already support. |
| 126 | + |
| 127 | +Each is a `.yaml` in `ctrlgrid/data/presets/` plus a line in the preset list. |
| 128 | +Presets are documentation (§ 9.3), so comment them the way the shipped ones are. |
| 129 | + |
| 130 | +### 1d. A `notebook` document generator (the big one) |
| 131 | + |
| 132 | +The calendar built the document-generator seam (`ctrlgrid/document.py`, |
| 133 | +`DocumentPage`, the `link` capability, the document page loop in `pages.py`) and |
| 134 | +is still its **only** user. Generalise it: |
| 135 | + |
| 136 | +```yaml |
| 137 | +generator: notebook |
| 138 | +sections: |
| 139 | + - { pages: 40, generator: dots, spacing: 5mm, label: "Bullet journal" } |
| 140 | + - { pages: 20, generator: grid, spacing: 5mm, label: "Sums" } |
| 141 | + - { pages: 10, generator: staves, label: "Music" } |
| 142 | +``` |
| 143 | +
|
| 144 | +One PDF, a linked contents page, each section filled by an existing blade. For |
| 145 | +an e-ink user this is the missing piece — one notebook on the device, not twelve |
| 146 | +PDFs. |
| 147 | +
|
| 148 | +The hard part is not the pages, it is the seam: a document generator currently |
| 149 | +produces marks itself, while a blade produces marks for *one pattern area*. A |
| 150 | +`notebook` has to call blades. Look at how `pages.py` drives a blade |
| 151 | +(`_page_marks`) and keep that on the handle side — the notebook should ask the |
| 152 | +handle to fill a section, not reach into blades itself. **Design this with the |
| 153 | +user before building it**; it is the one item here with a real architectural |
| 154 | +choice in it. |
| 155 | + |
| 156 | +Reuse the calendar's note-pad work: `notes` pads, their per-pad numbering and |
| 157 | +their cross-linked indexes are the same shape a notebook's sections need. |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## Phase 2 — the fold-adjacent ones |
| 162 | + |
| 163 | +These came from the user asking about paper-folding templates. **The scope call |
| 164 | +is already made, do not re-open it:** a specific paper aeroplane is a *drawing*, |
| 165 | +not a structure, and § 2 (line 60 of the spec) rules out a general drawing |
| 166 | +language. What follows is the part that is parametric. |
| 167 | + |
| 168 | +### 2a. Fold notation (naming, not new machinery) |
| 169 | + |
| 170 | +Origami's Yoshizawa–Randlett convention: valley fold dashed, mountain fold |
| 171 | +dash-dot, reference crease thin. The dash machinery already does this — |
| 172 | +`style: dashed | dotted`, `base_dash`, and custom `dash` cycles in |
| 173 | +`ctrlgrid/generators/common.py`; `dash: [3, 1, 1, 1]` *is* a dash-dot. What is |
| 174 | +missing is the name, not the capability. Consider a documented convention plus |
| 175 | +presets rather than new code. |
| 176 | + |
| 177 | +### 2b. Parametric nets — `net` (recommended as the next big blade) |
| 178 | + |
| 179 | +A box of 80×50×30 mm, an envelope for a given card: cut lines solid, fold lines |
| 180 | +dashed, glue tabs computed. This **is** a structure — measurements in, a law |
| 181 | +computes the net — and it lives or dies by millimetre accuracy: a box 2 mm out |
| 182 | +does not close. It demonstrates the promise in a way squared paper never can. |
| 183 | + |
| 184 | +Start with one box style (a simple tuck-top or a tray) and refuse the rest by |
| 185 | +name until built, the way every deferred feature in this codebase does. Check |
| 186 | +that the net fits the sheet in `check()` and refuse loudly with the size needed. |
| 187 | + |
| 188 | +### 2c. Pre-creasing grids for tessellations |
| 189 | + |
| 190 | +A 16×16 or 32×32 grid plus diagonals, in fold notation. `grid` does the |
| 191 | +orthogonal part today; the diagonals are 1b. Mostly a preset once 1b exists. |
| 192 | + |
| 193 | +--- |
| 194 | + |
| 195 | +## How to work here (short version — the long one is in `docs/CLAUDE.md`) |
| 196 | + |
| 197 | +- **Measure, never guess.** Almost every bug that session was a guessed |
| 198 | + position: a centred label over left-aligned numbers, a fixed inset in a |
| 199 | + variable-height row, a composed string that could not align, a space used as |
| 200 | + padding (a space is *half* a digit wide — that one shipped for months). |
| 201 | + `q.text_width(...)` is how you find out. |
| 202 | +- **One arithmetic, not two.** When drawing and checking both need a size, they |
| 203 | + share a function (`contents_height`, `mini_month_width`, `date_columns`, |
| 204 | + `notes_capacity`). Two copies drift. |
| 205 | +- **Test first, then implement.** Where a design is genuinely uncertain, the |
| 206 | + project's own precedent is: validate on a real rendered sheet, then codify it |
| 207 | + in tests (`pattern.align` was built that way, and so was every layout change |
| 208 | + in that session). |
| 209 | +- **Read the sheet back.** `pdftoppm -png -r 150 -f N -l N out.pdf crop` and |
| 210 | + actually look at it; `tests/pdfread.py` and `pypdf` for geometry. |
| 211 | +- **Fail loudly, before page one.** A content-sized layout needs a `check()` |
| 212 | + refusal naming the size needed and the size available. |
| 213 | +- **Commit messages via a file, not `-m`.** A backtick in a `-m` message gets |
| 214 | + executed by the shell — that happened, and ate part of a message. |
| 215 | +- Update the spec (`docs/pflichtenheft-vorlagengenerator.md`), `docs/CLAUDE.md` |
| 216 | + and the preset in the *same* commit as the code. |
| 217 | +- Push only on the user's word, and **never** `--tags`: an annotated `v0.1.0` |
| 218 | + sits locally and would fire the release workflow. |
0 commit comments