|
| 1 | +# PR 8.11 — Sample Palette Strict Rule |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Tighten sample palette handling after the multi-file tool payload refactor. |
| 5 | + |
| 6 | +Samples now use one tool payload per file: |
| 7 | + |
| 8 | +`sample.<id>.<tool>.json` |
| 9 | + |
| 10 | +Palette handling must be explicit and deterministic. |
| 11 | + |
| 12 | +## Current Repo Reality |
| 13 | +- Sample tool payload files are manifest-style: |
| 14 | + - `$schema` |
| 15 | + - `tool` |
| 16 | + - `version` |
| 17 | + - `config` |
| 18 | +- Palette files are separate: |
| 19 | + - `sample.palette.json` |
| 20 | +- Runtime/docs references to old sample paths were intentionally not edited in the prior PR. |
| 21 | + |
| 22 | +## Required Rule |
| 23 | + |
| 24 | +If a sample uses colors, that sample folder MUST contain exactly one: |
| 25 | + |
| 26 | +`sample.palette.json` |
| 27 | + |
| 28 | +## Required Linkage |
| 29 | + |
| 30 | +Each `sample.<id>.<tool>.json` file in that sample folder MUST reference the palette when the palette exists. |
| 31 | + |
| 32 | +Use this field: |
| 33 | + |
| 34 | +```json |
| 35 | +{ |
| 36 | + "palette": "./sample.palette.json" |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +## Payload Shape |
| 41 | + |
| 42 | +Sample tool payload files may contain: |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "$schema": "../../../tools/schemas/tools/<tool>.schema.json", |
| 47 | + "tool": "<tool>", |
| 48 | + "version": 1, |
| 49 | + "palette": "./sample.palette.json", |
| 50 | + "config": {} |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +## Rules |
| 55 | +- One palette per sample folder. |
| 56 | +- Palette file name must be exactly `sample.palette.json`. |
| 57 | +- Palette must use `swatches`, not `entries`. |
| 58 | +- Each swatch must use a single-character `symbol`. |
| 59 | +- Each swatch must use uppercase `hex`. |
| 60 | +- If `sample.palette.json` exists, every tool payload file in that folder must reference it. |
| 61 | +- If no colors exist in the sample, do not create a palette. |
| 62 | + |
| 63 | +## Forbidden |
| 64 | +- Do not embed palette swatches inside tool payload files. |
| 65 | +- Do not create multiple palette files in one sample folder. |
| 66 | +- Do not use `entries`. |
| 67 | +- Do not use multi-character symbols like `s001`. |
| 68 | +- Do not add validators. |
| 69 | +- Do not modify runtime logic. |
| 70 | +- Do not modify `start_of_day`. |
| 71 | + |
| 72 | +## Acceptance |
| 73 | +- Every colored sample has exactly one `sample.palette.json`. |
| 74 | +- Every sample folder with `sample.palette.json` has all `sample.<id>.<tool>.json` files referencing `./sample.palette.json`. |
| 75 | +- No sample folder has duplicate palette files. |
| 76 | +- Palette schema remains `swatches` + single-character `symbol`. |
0 commit comments