Skip to content

Commit 9d442f6

Browse files
author
DavidQ
committed
Move JSON schema contracts under tools/schemas
Keeps schema ownership with the tool/workspace system instead of adding root-level schema files. Establishes shared manifest schemas under tools/schemas and tool-specific payload schemas under tools/schemas/tools.
1 parent 3588447 commit 9d442f6

17 files changed

Lines changed: 143 additions & 83 deletions

docs/dev/BUILD_PR.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# BUILD_PR: Schema location correction
2+
3+
## Codex task
4+
Move the schema contract plan from root-level schema files to `tools/schemas/`.
5+
6+
## Required changes
7+
1. Remove any planned or newly-added root-level `*.schema.json` files.
8+
2. Add schema contracts under `tools/schemas/` only.
9+
3. Put reusable manifest schemas directly under `tools/schemas/`.
10+
4. Put individual tool payload schemas under `tools/schemas/tools/`.
11+
5. Update any docs or references to point to the new schema paths.
12+
13+
## Do not
14+
- Do not write broad validation utilities as the primary deliverable.
15+
- Do not change sample payloads.
16+
- Do not unlock or mutate samples.
17+
- Do not create schema files at repository root.
18+
- Do not modify start_of_day folders.
19+
20+
## Validation command
21+
Search for misplaced schemas:
22+
23+
```powershell
24+
Get-ChildItem -Path . -Filter *.schema.json -Recurse | Select-Object FullName
25+
```
26+
27+
Expected result: all schema files are under `tools\schemas\`.

docs/dev/PLAN_PR.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# PLAN_PR: Move JSON schemas under tools ownership
2+
3+
## Purpose
4+
Move schema contracts out of the repository root and into the tools area so schema ownership matches the systems that load, edit, validate, and export tool/workspace/sample data.
5+
6+
## Scope
7+
- Do not change runtime behavior directly.
8+
- Do not edit locked samples.
9+
- Do not modify start_of_day folders.
10+
- Establish schema placement rules for Codex to implement in the next pass.
11+
12+
## Schema placement rule
13+
Use this structure:
14+
15+
```text
16+
tools/
17+
schemas/
18+
workspace.manifest.schema.json
19+
tool.manifest.schema.json
20+
palette.schema.json
21+
sample.tool-payload.schema.json
22+
tools/
23+
vector-map-editor.schema.json
24+
vector-asset-studio.schema.json
25+
sprite-editor.schema.json
26+
```
27+
28+
## Rationale
29+
Schemas belong near tool contracts, not at repository root. The root should stay clean and should not accumulate validation artifacts.
30+
31+
Shared schemas live at `tools/schemas/`.
32+
Tool-specific schemas live at `tools/schemas/tools/<tool>.schema.json`.
33+
34+
## Acceptance criteria
35+
- No new schema files are added at repository root.
36+
- All JSON schema files are under `tools/schemas/`.
37+
- Workspace manifest validation uses `tools/schemas/workspace.manifest.schema.json`.
38+
- Tool manifest validation uses `tools/schemas/tool.manifest.schema.json`.
39+
- Tool-specific payload validation uses `tools/schemas/tools/<tool>.schema.json`.
40+
- Samples reference the same tool schema contracts used by tool manifests.

docs/dev/codex_commands.md

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,8 @@
1-
# BUILD_PR: Codex Execution Notes
1+
# Codex Commands
22

3-
## Model
4-
5-
GPT-5.4 or GPT-5.3-codex
6-
7-
## Reasoning
8-
9-
High
10-
11-
## Codex Command
12-
13-
```bash
14-
codex
15-
```
16-
17-
## Task
18-
19-
Implement the PLAN_PR in `docs/dev/plan_pr_tool_workspace_schema_manifest_boundaries.md`.
20-
21-
## Constraints
22-
23-
- Smallest valid change.
24-
- One PR purpose only.
25-
- Docs-first schema/manifest boundary cleanup.
26-
- Do not modify `start_of_day`.
27-
- Do not delete preserved legacy folders.
28-
- Do not write broad custom validation code where `*.schema` files can define the contract.
29-
- Preserve existing sample behavior.
30-
- Samples must use named palettes only and remain locked.
31-
- Workspaces must use duplicated palettes and enforce used-palette replacement restrictions.
32-
- Workspace assets must live in `workspace.manifest`; only rendered/exportable artifacts such as PNG files may be saved separately.
33-
34-
## Suggested Implementation Order
35-
36-
1. Inventory only the specific files referencing:
37-
- `buildDefaultPayload`
38-
- 3D camera path editor payload setup
39-
- 3D JSON payload normalizer
40-
- viewer asset save/export paths
41-
- workspace/sample manifest loading
42-
- palette mutation rules
43-
2. Add schema files near the owning tool or manifest contract.
44-
3. Wire sample tool payloads to validate/load through the same tool schema.
45-
4. Wire workspace manifest validation through `workspace.manifest` schema.
46-
5. Centralize button/action enablement by loaded context:
47-
- tool context
48-
- workspace context
49-
6. Add/update minimal tests or fixtures proving:
50-
- sample palette lock
51-
- workspace palette duplication
52-
- used swatch replacement protection
53-
- workspace-owned assets persisted in manifest
54-
- PNG export still works
55-
7. Update roadmap/status markers only if the repo has an active roadmap file for this phase.
56-
57-
## Test Commands
58-
59-
Use the repo’s existing test commands. If none exist, run the smallest available smoke checks:
3+
Model: GPT-5.4-mini
4+
Reasoning: medium
605

616
```bash
62-
npm test
63-
npm run build
7+
codex exec "Apply BUILD_PR docs/dev/BUILD_PR.md. Keep the change docs-first and schema-location only. Do not add root-level schema files. Place all schema contracts under tools/schemas, with tool-specific schemas under tools/schemas/tools. Do not modify locked samples or start_of_day folders."
648
```
65-
66-
If the repo does not use npm for this area, document the actual commands run in the PR notes.
67-
68-
## Required Output From Codex
69-
70-
- List changed files.
71-
- List tests run.
72-
- Note any compatibility shims left in place.
73-
- Note any old references that were intentionally preserved.

docs/dev/commit_comment.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
Schema-backed tool/workspace manifest boundary cleanup
1+
Move JSON schema contracts under tools/schemas
22

3-
- Adds explicit schema contracts for tool/sample/workspace payloads
4-
- Locks sample palette behavior to named palettes
5-
- Keeps workspace-owned assets inside workspace.manifest
6-
- Gates valid UI actions by loaded context
3+
Keeps schema ownership with the tool/workspace system instead of adding root-level schema files. Establishes shared manifest schemas under tools/schemas and tool-specific payload schemas under tools/schemas/tools.

tests/tools/ToolWorkspaceSchemaManifestBoundaries.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ import { readFileSync } from "node:fs";
33
import {
44
createDefaultCameraPathPayload,
55
validateCameraPathPayload
6-
} from "../../tools/3D Camera Path Editor/cameraPathPayload.schema.js";
6+
} from "../../tools/schemas/tools/cameraPathPayload.schema.js";
77
import {
88
createDefaultMapPayload,
99
validateMapPayload
10-
} from "../../tools/3D JSON Payload Normalizer/mapPayload.schema.js";
10+
} from "../../tools/schemas/tools/mapPayload.schema.js";
1111
import {
1212
createDefaultAssetPayload,
1313
validateAssetPayload
14-
} from "../../tools/3D Asset Viewer/assetPayload.schema.js";
14+
} from "../../tools/schemas/tools/assetPayload.schema.js";
1515
import {
1616
validateWorkspaceManifestSchema,
1717
WORKSPACE_MANIFEST_SCHEMA,
1818
WORKSPACE_MANIFEST_VERSION,
1919
WORKSPACE_DOCUMENT_KIND
20-
} from "../../tools/shared/workspaceManifest.schema.js";
20+
} from "../../tools/schemas/workspaceManifest.schema.js";
2121

2222
export async function run() {
2323
const cameraValidation = validateCameraPathPayload(createDefaultCameraPathPayload(), {

tools/3D Asset Viewer/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ASSET_VIEWER_REPORT_SCHEMA,
55
createDefaultAssetPayload,
66
validateAssetPayload
7-
} from "./assetPayload.schema.js";
7+
} from "../schemas/tools/assetPayload.schema.js";
88

99
const refs = {
1010
inspectButton: document.getElementById("inspect3dAssetButton"),

tools/3D Camera Path Editor/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
createDefaultCameraPathPayload,
55
normalizeCameraPathPayload,
66
validateCameraPathPayload
7-
} from "./cameraPathPayload.schema.js";
7+
} from "../schemas/tools/cameraPathPayload.schema.js";
88

99
const refs = {
1010
addButton: document.getElementById("addCameraPointButton"),

tools/3D JSON Payload Normalizer/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
createDefaultMapPayload,
55
normalizeMapPayload,
66
validateMapPayload
7-
} from "./mapPayload.schema.js";
7+
} from "../schemas/tools/mapPayload.schema.js";
88

99
const refs = {
1010
normalizeButton: document.getElementById("normalize3dMapButton"),

tools/schemas/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Tool and Workspace Schemas
2+
3+
All JSON schema contracts for tools, samples, palettes, and workspace manifests belong here.
4+
5+
Root-level schema files should not be added.
6+
7+
## Layout
8+
9+
```text
10+
tools/schemas/
11+
workspace.manifest.schema.json
12+
tool.manifest.schema.json
13+
palette.schema.json
14+
sample.tool-payload.schema.json
15+
tools/
16+
<tool>.schema.json
17+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "tools/schemas/tool.manifest.schema.json",
4+
"title": "Tool Manifest",
5+
"type": "object",
6+
"required": ["tool", "schema", "data"],
7+
"additionalProperties": true,
8+
"properties": {
9+
"tool": { "type": "string" },
10+
"schema": { "type": "string" },
11+
"data": { "type": "object" }
12+
}
13+
}

0 commit comments

Comments
 (0)