|
| 1 | +# PR 8.13 — Palette File Naming and Reference Cleanup |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Finish the palette/tool payload separation correctly. |
| 5 | + |
| 6 | +Tool payload files must not contain embedded palette data, palette references, or palette asset reference fields. |
| 7 | + |
| 8 | +Palette lock metadata belongs in the palette JSON file. |
| 9 | + |
| 10 | +Palette file names must follow the same sample naming convention as tool payload files. |
| 11 | + |
| 12 | +## Corrections |
| 13 | + |
| 14 | +### Palette File Naming |
| 15 | + |
| 16 | +#### Old |
| 17 | +```text |
| 18 | +sample.palette.json |
| 19 | +``` |
| 20 | + |
| 21 | +#### New |
| 22 | +```text |
| 23 | +sample.<id>.palette.json |
| 24 | +``` |
| 25 | + |
| 26 | +Examples: |
| 27 | +```text |
| 28 | +sample.0207.palette.json |
| 29 | +sample.0305.palette.json |
| 30 | +``` |
| 31 | + |
| 32 | +This matches: |
| 33 | +```text |
| 34 | +sample.0207.sprite-editor.json |
| 35 | +sample.0305.vector-map-editor.json |
| 36 | +``` |
| 37 | + |
| 38 | +## Required Tool Payload Cleanup |
| 39 | + |
| 40 | +Remove palette-related fields from all sample tool payload files, including nested config fields. |
| 41 | + |
| 42 | +Specifically remove occurrences like: |
| 43 | + |
| 44 | +```json |
| 45 | +"palette": [] |
| 46 | +``` |
| 47 | + |
| 48 | +```json |
| 49 | +"paletteRef": { |
| 50 | + "source": "engine/paletteList", |
| 51 | + "id": "crayola008", |
| 52 | + "locked": true |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +```json |
| 57 | +"assetRefs": { |
| 58 | + "paletteId": "", |
| 59 | + "spriteId": "" |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +If `assetRefs` contains only palette-related fields, remove `assetRefs`. |
| 64 | + |
| 65 | +If `assetRefs` contains non-palette asset references, remove only palette-related keys and preserve the rest. |
| 66 | + |
| 67 | +## Specific Known File |
| 68 | +Fix the remaining issue in: |
| 69 | + |
| 70 | +```text |
| 71 | +samples/phase-02/0207/sample.0208.sprite-editor.json |
| 72 | +``` |
| 73 | + |
| 74 | +Remove: |
| 75 | +- `palette` |
| 76 | +- `paletteRef` |
| 77 | +- `assetRefs.paletteId` |
| 78 | + |
| 79 | +Note: verify whether the file name `sample.0208.sprite-editor.json` belongs in folder `0207`. If it is a sample id mismatch, correct the file naming only if repo naming conventions confirm it should be `sample.0207.sprite-editor.json`. |
| 80 | + |
| 81 | +## Palette Lock Rule |
| 82 | + |
| 83 | +Palette lock metadata belongs in the palette file, not the tool payload. |
| 84 | + |
| 85 | +Example: |
| 86 | + |
| 87 | +```json |
| 88 | +{ |
| 89 | + "$schema": "../../../tools/schemas/palette.schema.json", |
| 90 | + "schema": "html-js-gaming.palette", |
| 91 | + "version": 1, |
| 92 | + "name": "Sample 0207 Palette", |
| 93 | + "source": "engine/paletteList", |
| 94 | + "sourceId": "crayola008", |
| 95 | + "locked": true, |
| 96 | + "swatches": [] |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +## Schema Update |
| 101 | + |
| 102 | +Update `tools/schemas/palette.schema.json` to allow optional top-level metadata: |
| 103 | + |
| 104 | +```json |
| 105 | +"sourceId": { |
| 106 | + "type": "string", |
| 107 | + "minLength": 1 |
| 108 | +}, |
| 109 | +"locked": { |
| 110 | + "type": "boolean" |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +Do not add these fields to swatches. |
| 115 | + |
| 116 | +## Rules |
| 117 | +- Tool payload files must match workspace `tools[]` item shape. |
| 118 | +- Tool payload files must not contain palette object data. |
| 119 | +- Tool payload files must not contain palette path refs. |
| 120 | +- Tool payload files must not contain palette lock metadata. |
| 121 | +- Palette files use `sample.<id>.palette.json`. |
| 122 | +- Palette files own `locked` and source metadata. |
| 123 | +- Palette files remain separate JSON objects passed beside the tool payload when opening a tool. |
| 124 | + |
| 125 | +## Non-Goals |
| 126 | +- No runtime changes. |
| 127 | +- No validators. |
| 128 | +- No `start_of_day` changes. |
| 129 | +- No broad sample gameplay edits. |
| 130 | + |
| 131 | +## Acceptance |
| 132 | +- No sample tool payload file contains `palette`. |
| 133 | +- No sample tool payload file contains `paletteRef`. |
| 134 | +- No sample tool payload file contains `assetRefs.paletteId`. |
| 135 | +- Palette files are named `sample.<id>.palette.json`. |
| 136 | +- No `sample.palette.json` files remain. |
| 137 | +- Locked palette metadata is present in the renamed palette JSON where applicable. |
| 138 | +- Palette schema allows top-level `locked` and `sourceId`. |
0 commit comments