Skip to content

Commit 51165b6

Browse files
author
DavidQ
committed
PR 8.3: Generate sample palettes from actual sample colors
- Documented repo-realistic sample palette generation - Removed assumptions about nonexistent sample config/palette files - Added schema-compliant generated palette rules - Preserved schema-driven validation boundaries
1 parent f384f55 commit 51165b6

26 files changed

Lines changed: 1195 additions & 19 deletions

docs/dev/codex_commands.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,31 @@ MODEL: GPT-5.3-codex
22
REASONING: medium
33

44
TASK:
5-
- Add $schema to all sample JSON files
6-
- Align sample config.json to tool.schema.json
7-
- Align palette.json to shared schema
8-
- Remove any non-schema-compliant fields
9-
- Do NOT add validation utilities
10-
- Do NOT modify runtime logic
11-
12-
OUTPUT:
13-
- All samples schema-compliant
5+
Implement PR 8.3 as a docs-guided, schema-compliant palette generation cleanup.
6+
7+
REPO REALITY:
8+
- There are no samples/**/config.json files.
9+
- There are no samples/**/*.palette.json files in the current layout.
10+
- Do not assume either exists.
11+
- Generate palette documents from colors actually used by each sample.
12+
13+
STEPS:
14+
1. Read docs/pr/PR_8.3_SAMPLE_COLOR_PALETTE_GENERATION.md.
15+
2. Read docs/pr/sample_palette_generation_rules.md.
16+
3. Use workspace.manifest as the source of truth for sample/tool ownership.
17+
4. Scan sample folders for explicit color values in existing sample JSON and local sample asset metadata.
18+
5. Generate schema-compliant palette documents from discovered colors.
19+
6. Add $schema references to generated palette documents.
20+
7. Validate generated palette documents against tools/schemas/palette.schema.json.
21+
8. Remove or update any stale docs that refer to nonexistent samples/**/config.json or samples/**/*.palette.json.
22+
9. Do not add validation utility modules.
23+
10. Do not modify runtime behavior.
24+
11. Do not modify start_of_day.
25+
26+
ACCEPTANCE:
27+
- Generated palettes reflect actual colors used by samples.
28+
- No invented colors.
29+
- No stale config.json / palette.json assumptions.
30+
- No validation utilities added.
31+
- No runtime files modified.
32+
- No start_of_day files modified.

docs/dev/commit_comment.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
PR 8.2: Schema enforcement + sample compliance
1+
PR 8.3: Generate sample palettes from actual sample colors
22

3-
- Enforced $schema usage across samples
4-
- Aligned sample configs with tool schemas
5-
- Ensured palette schema compliance
3+
- Documented repo-realistic sample palette generation
4+
- Removed assumptions about nonexistent sample config/palette files
5+
- Added schema-compliant generated palette rules
6+
- Preserved schema-driven validation boundaries

docs/pr/PR_8.2_SCHEMA_ENFORCEMENT_SAMPLE_COMPLIANCE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ Enforce schema usage across all samples and ensure compliance with tool + shared
1515
- No fallback or normalization allowed
1616

1717
## Validation Targets
18-
- samples/**/config.json -> tool.schema.json
19-
- samples/**/palette.json -> palette.schema.json
20-
- workspace.manifest.json -> workspace.schema.json
18+
- samples/**/*.json -> sample.tool-payload.schema.json (for sample wrapper documents)
19+
- generated sample palette docs (for example `samples/phase-XX/XXXX/sample.palette.json`) -> palette.schema.json
20+
- workspace manifest documents embedded in sample payloads or workspace project files -> workspace.manifest.schema.json
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# PR 8.3 — Sample Color Palette Generation
2+
3+
## Purpose
4+
Generate schema-compliant sample palette documents from colors actually used by each sample.
5+
6+
## Scope
7+
- Do not assume `samples/**/config.json` exists.
8+
- Do not assume `samples/**/*.palette.json` exists.
9+
- Scan each sample's existing JSON payloads and related sample assets for color values.
10+
- Generate palette documents only from colors found in the sample.
11+
- Add `$schema` references to generated palette documents.
12+
- Keep `workspace.manifest` as source of truth.
13+
- Keep shared schemas in `tools/schemas/`.
14+
15+
## Required Output Shape
16+
Generated palette files must conform to:
17+
18+
`tools/schemas/palette.schema.json`
19+
20+
Expected shared palette document shape:
21+
22+
```json
23+
{
24+
"$schema": "../../../tools/schemas/palette.schema.json",
25+
"schema": "palette",
26+
"version": "1.0.0",
27+
"name": "Sample 0101 Palette",
28+
"source": "generated-from-sample-colors",
29+
"entries": [
30+
{
31+
"name": "color-001",
32+
"value": "#000000"
33+
}
34+
]
35+
}
36+
```
37+
38+
## Generation Rules
39+
- Extract only explicit color values used by the sample.
40+
- Supported color formats:
41+
- `#RGB`
42+
- `#RRGGBB`
43+
- `#RRGGBBAA`
44+
- `rgb(...)`
45+
- `rgba(...)`
46+
- named CSS colors only if already present in sample files
47+
- Normalize hex colors to uppercase `#RRGGBB` unless alpha is required.
48+
- Deduplicate colors per sample.
49+
- Preserve deterministic ordering.
50+
- Use stable generated names:
51+
- `color-001`
52+
- `color-002`
53+
- `color-003`
54+
- Do not invent colors.
55+
- Do not generate empty palettes unless the sample already has no color data and a manifest entry requires one.
56+
57+
## Non-Goals
58+
- No runtime validation utilities.
59+
- No implementation behavior changes.
60+
- No start_of_day changes.
61+
- No repo-wide architectural rewrite.
62+
- No sample gameplay changes.
63+
64+
## Acceptance
65+
- Palette files exist only where sample color data exists or where the manifest requires them.
66+
- Generated palettes validate against `tools/schemas/palette.schema.json`.
67+
- All generated palette files include `$schema`.
68+
- No references to nonexistent `samples/**/config.json` or `samples/**/*.palette.json` remain in PR docs.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Sample Compliance Checklist
22

3-
- [ ] All samples include config.json
4-
- [ ] config.json has $schema reference
5-
- [ ] palette.json has $schema reference
3+
- [ ] All sample wrapper JSON files include `$schema`
4+
- [ ] Generated `sample.palette.json` (when colors exist) includes `$schema`
65
- [ ] No extra fields outside schema
76
- [ ] No missing required fields
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Sample Palette Generation Rules
2+
3+
## Source of Truth
4+
Use the existing sample files and `workspace.manifest` to determine sample ownership and valid sample paths.
5+
6+
## Palette Discovery
7+
For each sample folder:
8+
1. Inspect existing sample JSON files.
9+
2. Inspect local sample asset metadata if present.
10+
3. Extract explicit color values.
11+
4. Generate a palette document only when colors are found or required by manifest.
12+
13+
## Output Naming
14+
Use the repo's existing sample naming convention. If no convention exists, write:
15+
16+
`sample.palette.json`
17+
18+
inside the sample folder.
19+
20+
## Schema
21+
Every generated palette document must include:
22+
23+
```json
24+
"$schema": "../../../tools/schemas/palette.schema.json"
25+
```
26+
27+
Adjust relative path depth if needed for the actual sample folder.
28+
29+
## Do Not
30+
- Do not create `config.json`.
31+
- Do not create fake colors.
32+
- Do not modify runtime files.
33+
- Do not add validators.
34+
- Do not touch `start_of_day`.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"$schema": "../../../tools/schemas/palette.schema.json",
3+
"schema": "html-js-gaming.palette",
4+
"version": 1,
5+
"name": "Sample 0207 Palette",
6+
"source": "generated-from-sample-colors",
7+
"entries": [
8+
{
9+
"symbol": "s001",
10+
"hex": "#1CAC78",
11+
"name": "color-001"
12+
},
13+
{
14+
"symbol": "s002",
15+
"hex": "#60A5FA",
16+
"name": "color-002"
17+
},
18+
{
19+
"symbol": "s003",
20+
"hex": "#1E1B4B",
21+
"name": "color-003"
22+
},
23+
{
24+
"symbol": "s004",
25+
"hex": "#34D399",
26+
"name": "color-004"
27+
},
28+
{
29+
"symbol": "s005",
30+
"hex": "#10B981",
31+
"name": "color-005"
32+
},
33+
{
34+
"symbol": "s006",
35+
"hex": "#F59E0B",
36+
"name": "color-006"
37+
},
38+
{
39+
"symbol": "s007",
40+
"hex": "#FFFFFFAA",
41+
"name": "color-007"
42+
},
43+
{
44+
"symbol": "s008",
45+
"hex": "#1F75FE",
46+
"name": "color-008"
47+
},
48+
{
49+
"symbol": "s009",
50+
"hex": "#FF7538",
51+
"name": "color-009"
52+
}
53+
]
54+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"$schema": "../../../tools/schemas/palette.schema.json",
3+
"schema": "html-js-gaming.palette",
4+
"version": 1,
5+
"name": "Sample 0213 Palette",
6+
"source": "generated-from-sample-colors",
7+
"entries": [
8+
{
9+
"symbol": "s001",
10+
"hex": "#1E1B4B",
11+
"name": "color-001"
12+
},
13+
{
14+
"symbol": "s002",
15+
"hex": "#1CAC78",
16+
"name": "color-002"
17+
},
18+
{
19+
"symbol": "s003",
20+
"hex": "#FF7538",
21+
"name": "color-003"
22+
},
23+
{
24+
"symbol": "s004",
25+
"hex": "#FCE883",
26+
"name": "color-004"
27+
},
28+
{
29+
"symbol": "s005",
30+
"hex": "#1F75FE",
31+
"name": "color-005"
32+
},
33+
{
34+
"symbol": "s006",
35+
"hex": "#1CAC78",
36+
"name": "color-006"
37+
},
38+
{
39+
"symbol": "s007",
40+
"hex": "#60A5FA",
41+
"name": "color-007"
42+
},
43+
{
44+
"symbol": "s008",
45+
"hex": "#FFFFFF",
46+
"name": "color-008"
47+
},
48+
{
49+
"symbol": "s009",
50+
"hex": "#1E1B4B",
51+
"name": "color-009"
52+
},
53+
{
54+
"symbol": "s010",
55+
"hex": "#F59E0B",
56+
"name": "color-010"
57+
},
58+
{
59+
"symbol": "s011",
60+
"hex": "#34D399",
61+
"name": "color-011"
62+
},
63+
{
64+
"symbol": "s012",
65+
"hex": "#1F75FE",
66+
"name": "color-012"
67+
},
68+
{
69+
"symbol": "s013",
70+
"hex": "#FF7538",
71+
"name": "color-013"
72+
}
73+
]
74+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "../../../tools/schemas/palette.schema.json",
3+
"schema": "html-js-gaming.palette",
4+
"version": 1,
5+
"name": "Sample 0214 Palette",
6+
"source": "generated-from-sample-colors",
7+
"entries": [
8+
{
9+
"symbol": "s001",
10+
"hex": "#1CAC78",
11+
"name": "color-001"
12+
},
13+
{
14+
"symbol": "s002",
15+
"hex": "#7DD3FC",
16+
"name": "color-002"
17+
},
18+
{
19+
"symbol": "s003",
20+
"hex": "#10B981",
21+
"name": "color-003"
22+
},
23+
{
24+
"symbol": "s004",
25+
"hex": "#60A5FA",
26+
"name": "color-004"
27+
},
28+
{
29+
"symbol": "s005",
30+
"hex": "#059669",
31+
"name": "color-005"
32+
},
33+
{
34+
"symbol": "s006",
35+
"hex": "#1F75FE",
36+
"name": "color-006"
37+
},
38+
{
39+
"symbol": "s007",
40+
"hex": "#FF7538",
41+
"name": "color-007"
42+
}
43+
]
44+
}

0 commit comments

Comments
 (0)