jevhooks.git / web / src / CLAUDE.md
1@README.md
2
3## Notes for agents
4
5**Keep `view::page` pure.** No `worker` type, no clock, no request in it: the tests call
6it natively and read the string, and that is the only test of the page there is.
7
8**A picture is added in `content.rs` and nowhere else.** `SHOTS` is what the page draws,
9`FILES` what the router serves and `Route::of` what the log names; all three read the
10same `Shot`s. Its `width` and `height` are the SVG's own (a test reads them back).
11
12**No inline script, ever.** `policy()` does not allow it and must not start to: the
13page needs none. If a feature needs script, it is a file the site serves.
14
15**`page.css` uses the shared sheet's tokens** (`var(--ink)`, `var(--display)`, ...). No
16colour written as a number, no font named here.
17
18**The card's size is declared twice on purpose**: `content::CARD_WIDTH`/`CARD_HEIGHT`
19are what the page's tags say, and `bin/card.rs` asserts the drawing is that size.
20
21**`src/bin/` has no chapter of its own.** It is one file, described here.
22
23**Never write a plan on the map that nobody wrote down.** `hooks.rs`'s `ideas` are
24ideas the owner has recorded; an event without one says "nothing yet", and that is the
25truth the page is for. Do not invent one to fill a row, and do not add a `_` arm to
26`hook`: a new event must stop the build until it is placed.
27
28**"Built" comes from `HookEvent::role`, never from this crate.** `Hook::state` derives
29it; a `today` sentence exists exactly for the events the plugin handles
30(`built_is_what_the_plugin_says_is_built`). Change what the plugin does in
31`jevhooks-events` and the page follows.
32
33**Never type how a case ends.** `rules.rs`'s cases give an answer and a sentence; the
34word on the chip is `ended(&next)`, from running the plugin's network on that answer.
35A case whose sentence no longer matches its chip means the rules changed: rewrite the
36sentence, never the outcome (`the_command_cases_end_every_way_a_command_can`,
37`the_other_cases_end_as_they_say`).
38
39**A case's numbers go through `Asked::made_up`**, which writes a response body and
40reads it the way a real one is read. Do not `learn` Jev's facts by hand here: the
41thresholds would be skipped, and the drawing could show a state no answer produces.
42
43**A rule's label has about 35 characters** before it runs under the number a deciding
44rule carries (`rete-draw`'s rule box is 262 wide at 11px mono), and a fact's name
45shares 150 with its value. Names are `jevhooks-rules`' (`RULES`, `fact_name`,
46`end_name`); when one is too long, shorten it there, never by changing `rete-draw`,
47whose markup lmjtfy holds byte for byte.