Skip to content

Commit bfee9fc

Browse files
committed
Add starter project template using shared project, asset, and palette references
1 parent 2f2b0b9 commit bfee9fc

11 files changed

Lines changed: 743 additions & 95 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,27 @@
1+
# Codex Commands
2+
13
MODEL: GPT-5.4
24
REASONING: high
35

46
COMMAND:
5-
Create BUILD_PR_PROJECT_SYSTEM as a docs-first but implementation-ready platform slice.
6-
7-
GOALS:
8-
1. Add a shared project system for all active first-class tools.
9-
2. Keep Sprite Editor first-class.
10-
3. Keep SpriteEditor_old_keep hidden legacy.
11-
4. Keep tools/index.html tool-only.
12-
5. Persist assets and palettes by shared references, not tool-local duplication.
13-
14-
IMPLEMENT:
15-
- shared project service/context
16-
- project manifest contract
17-
- serializer + validator + migration entry points
18-
- new/open/save/save-as/close flows in the shared shell
19-
- dirty-state tracking
20-
- project name in header
21-
- per-tool persistence adapters for active tools only
7+
Create `BUILD_PR_STARTER_PROJECT_TEMPLATE` as a docs-first implementation PR.
228

23-
ACTIVE TOOLS:
24-
- Vector Map Editor
25-
- Vector Asset Studio
26-
- Tilemap Studio
27-
- Parallax Scene Studio
28-
- Sprite Editor
29-
- Asset Browser / Import Hub
30-
- Palette Browser / Manager
9+
Requirements:
10+
- Add one starter project template only
11+
- Keep `Sprite Editor` first-class
12+
- Keep `SpriteEditor_old_keep` hidden legacy
13+
- Keep `tools/index.html` tool-only and sample-free
14+
- Use shared assets and palettes by reference
15+
- Do not add gameplay systems
16+
- Do not add samples back to the main tools surface
3117

32-
RULES:
33-
- no samples added back
34-
- no legacy tooling on active surface
35-
- no per-tool independent project roots
36-
- use engine theme for all project UI
37-
- preserve registry-driven tool surfacing
18+
Implement:
19+
1. Starter project template folder and manifest
20+
2. Shared asset references for acvector/tile/parallax/sprite validation
21+
3. Shared palette references
22+
4. Project open/save/reload compatibility
23+
5. Minimal README or inline project notes if helpful
24+
6. Validation pass for cross-tool loading
3825

39-
OUTPUT:
40-
<project folder>/tmp/BUILD_PR_PROJECT_SYSTEM.zip
26+
Package output to:
27+
`<project folder>/tmp/BUILD_PR_STARTER_PROJECT_TEMPLATE.zip`

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add shared project system across active tools with manifest, shell flows, adapter-based persistence, dirty-state tracking, and shared asset/palette references while keeping Sprite Editor first-class and legacy hidden.
1+
Add one starter project template with shared vector, tilemap, parallax, sprite, and palette references plus cross-tool validation
Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
BUILD_PR_PROJECT_SYSTEM change summary
1+
BUILD_PR_STARTER_PROJECT_TEMPLATE change summary
22

3-
- Added shared project manifest/version/migration contract under `tools/shared/`
4-
- Added project controller wiring to the shared engine-themed shell
5-
- Added shell actions:
6-
- New Project
7-
- Open Project
8-
- Save Project
9-
- Save Project As
10-
- Close Project
11-
- Added project name + dirty-state header/status rendering
12-
- Added active-tool adapters for:
13-
- Vector Map Editor
14-
- Vector Asset Studio
15-
- Tilemap Studio
16-
- Parallax Scene Studio
17-
- Sprite Editor
18-
- Asset Browser / Import Hub
19-
- Palette Browser / Manager
20-
- Added active-tool bootstrap globals needed by the shared adapter layer
21-
- Added project-system validator/report output
3+
- Added one starter template folder under `templates/starter-project-template/`
4+
- Added one shared project manifest at `templates/starter-project-template/config/starter.project.json`
5+
- Reused existing shared vector, tilemap, parallax, sprite, and palette assets by reference
6+
- Added a minimal template README with shared project open instructions
7+
- Added a dedicated starter template validator and report output
228
- Preserved current platform rules:
239
- Sprite Editor first-class and visible
2410
- SpriteEditor_old_keep hidden legacy
25-
- tools/index remains tool-only and sample-free
11+
- tools/index.html remains tool-only and sample-free

docs/dev/reports/file_tree.txt

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
docs/
2-
pr/
3-
BUILD_PR_PROJECT_SYSTEM.md
4-
specs/
5-
project_manifest_contract.md
6-
dev/
7-
COMMIT_COMMENT.txt
8-
reports/
9-
change_summary.txt
10-
file_tree.txt
11-
project_system_validation.txt
12-
validation_checklist.txt
13-
scripts/
14-
validate-project-system.mjs
15-
tools/
16-
shared/
17-
projectManifestContract.js
18-
projectSystem.js
19-
projectSystemAdapters.js
1+
BUILD_PR_STARTER_PROJECT_TEMPLATE/
2+
templates/
3+
starter-project-template/
4+
README.md
5+
config/
6+
starter.project.json
7+
docs/
8+
pr/
9+
BUILD_PR_STARTER_PROJECT_TEMPLATE.md
10+
dev/
11+
COMMIT_COMMENT.txt
12+
reports/
13+
change_summary.txt
14+
starter_project_template_validation.txt
15+
validation_checklist.txt
16+
file_tree.txt
17+
scripts/
18+
validate-starter-project-template.mjs
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
BUILD_PR_STARTER_PROJECT_TEMPLATE validation report
2+
3+
STATUS: PASS
4+
5+
Checks:
6+
- starter project manifest validates against shared project contract
7+
- shared vector/tilemap/parallax/sprite/palette references resolve on disk
8+
- starter project includes payloads for all active first-class tools
9+
- cross-tool loading payloads are structurally present
10+
- starter project serializes and reloads through shared project serializer
11+
- sprite tool visibility rules remain intact
12+
- tools/index.html remains tool-only and sample-free
13+
14+
Issues:
15+
- none
Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
BUILD_PR_PROJECT_SYSTEM validation checklist
2-
3-
[x] Project system lives in shared platform layer, not scattered across tools
4-
[x] New/Open/Save/Save As/Close flows exist in shared shell
5-
[x] Active project name is visible in header
6-
[x] Dirty-state indicator is visible in shared project chrome
7-
[x] Dirty-state prompt is wired for tool navigation, new/open, and close
8-
[x] Asset references are captured through shared project references
9-
[x] Palette references are captured through shared project references
10-
[x] Vector Map Editor has a shared project adapter
11-
[x] Vector Asset Studio has a shared project adapter
12-
[x] Tilemap Studio has a shared project adapter
13-
[x] Parallax Scene Studio has a shared project adapter
14-
[x] Sprite Editor has a shared project adapter
15-
[x] Asset Browser / Import Hub has a shared project adapter
16-
[x] Palette Browser / Manager has a shared project adapter
17-
[x] Project schema version is validated
18-
[x] Migration entry point exists for future versions
19-
[x] Sprite Editor remains first-class in registry/UI
20-
[x] SpriteEditor_old_keep remains hidden and excluded from active surface
1+
[x] Starter Project Template exists as one project template only
2+
[x] Template is not positioned as a sample pack or game
3+
[x] Shared vector/tilemap/parallax/sprite references resolve correctly
4+
[x] Shared palette reference resolves correctly
5+
[x] Project manifest validates through shared project serializer/validator
6+
[x] Vector Map Editor starter payload is present
7+
[x] Vector Asset Studio starter payload is present
8+
[x] Tilemap Studio starter payload is present
9+
[x] Parallax Scene Studio starter payload is present
10+
[x] Sprite Editor remains first-class
11+
[x] SpriteEditor_old_keep remains hidden legacy
2112
[x] tools/index.html remains tool-only and sample-free
22-
[x] Validation report emitted at docs/dev/reports/project_system_validation.txt
13+
[x] Validation report emitted at docs/dev/reports/starter_project_template_validation.txt
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# BUILD_PR_STARTER_PROJECT_TEMPLATE
2+
3+
## Scope
4+
- Add one starter project template folder under `templates/`
5+
- Add one shared project manifest that opens through the new shared project system
6+
- Reference existing shared vector, tilemap, parallax, sprite, and palette assets by id/path
7+
- Keep `tools/index.html` tool-only and sample-free
8+
- Keep `Sprite Editor` first-class and `SpriteEditor_old_keep` hidden legacy
9+
10+
## Delivered files
11+
- `templates/starter-project-template/README.md`
12+
- `templates/starter-project-template/config/starter.project.json`
13+
- `scripts/validate-starter-project-template.mjs`
14+
- `docs/dev/reports/starter_project_template_validation.txt`
15+
16+
## Implementation summary
17+
- Added a single starter template project folder with one manifest only
18+
- Reused existing shared content instead of adding duplicated starter assets
19+
- Added explicit shared references for:
20+
- vector asset
21+
- tilemap asset
22+
- parallax asset
23+
- sprite asset
24+
- palette asset
25+
- Added per-tool starter payloads so the project opens cleanly through the shared project contract
26+
- Preserved the current active tools surface without adding samples or gameplay content
27+
28+
## Shared references used
29+
- Vector: `templates/vector-native-arcade/assets/vectors/template-player.vector.json`
30+
- Tilemap: `templates/vector-native-arcade/assets/tilemaps/template-arena.tilemap.json`
31+
- Parallax: `templates/vector-native-arcade/assets/parallax/template-backdrop.parallax.json`
32+
- Sprite: `games/Asteroids/platform/assets/sprites/asteroids-demo.sprite.json`
33+
- Palette: `templates/vector-native-arcade/assets/palettes/vector-native-primary.palette.json`
34+
35+
## Validation performed
36+
- `node scripts/validate-tool-registry.mjs`
37+
- `node scripts/validate-active-tools-surface.mjs`
38+
- `node scripts/validate-project-system.mjs`
39+
- `node scripts/validate-starter-project-template.mjs`
40+
41+
## Notes
42+
- This slice adds one reusable starter project only
43+
- No gameplay systems were added
44+
- No samples were added back to `tools/index.html`
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import fs from "node:fs/promises";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import { getToolById } from "../tools/toolRegistry.js";
5+
import {
6+
PROJECT_MANIFEST_SCHEMA,
7+
PROJECT_MANIFEST_VERSION,
8+
serializeProjectManifest,
9+
validateProjectManifest
10+
} from "../tools/shared/projectManifestContract.js";
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = path.dirname(__filename);
14+
const repoRoot = path.resolve(__dirname, "..");
15+
16+
const TEMPLATE_MANIFEST_PATH = "templates/starter-project-template/config/starter.project.json";
17+
const REPORT_PATH = "docs/dev/reports/starter_project_template_validation.txt";
18+
19+
function assert(condition, message, issues) {
20+
if (!condition) {
21+
issues.push(message);
22+
}
23+
}
24+
25+
async function pathExists(repoRelativePath) {
26+
try {
27+
await fs.access(path.join(repoRoot, repoRelativePath));
28+
return true;
29+
} catch {
30+
return false;
31+
}
32+
}
33+
34+
async function main() {
35+
const issues = [];
36+
const notes = [];
37+
const raw = JSON.parse(await fs.readFile(path.join(repoRoot, TEMPLATE_MANIFEST_PATH), "utf8"));
38+
const validation = validateProjectManifest(raw);
39+
40+
assert(validation.valid, `Project manifest is invalid: ${validation.issues.join(" ")}`, issues);
41+
assert(validation.manifest.schema === PROJECT_MANIFEST_SCHEMA, "Starter project schema mismatch.", issues);
42+
assert(validation.manifest.version === PROJECT_MANIFEST_VERSION, "Starter project version mismatch.", issues);
43+
notes.push("starter project manifest validates against shared project contract");
44+
45+
const manifest = validation.manifest;
46+
const assets = Array.isArray(manifest.sharedLibrary?.assets) ? manifest.sharedLibrary.assets : [];
47+
const palettes = Array.isArray(manifest.sharedLibrary?.palettes) ? manifest.sharedLibrary.palettes : [];
48+
49+
const requiredTypes = ["vector", "tilemap", "parallax", "sprite"];
50+
for (const requiredType of requiredTypes) {
51+
assert(assets.some((entry) => entry?.type === requiredType), `Missing shared ${requiredType} reference in starter project sharedLibrary.assets.`, issues);
52+
}
53+
assert(palettes.length >= 1, "Missing shared palette reference in starter project sharedLibrary.palettes.", issues);
54+
55+
for (const entry of [...assets, ...palettes]) {
56+
assert(typeof entry?.sourcePath === "string" && entry.sourcePath.trim().length > 0, `Missing sourcePath for shared reference ${entry?.id || "unknown"}.`, issues);
57+
if (typeof entry?.sourcePath === "string" && entry.sourcePath.trim()) {
58+
assert(await pathExists(entry.sourcePath), `Referenced shared asset/palette path does not exist: ${entry.sourcePath}`, issues);
59+
}
60+
}
61+
notes.push("shared vector/tilemap/parallax/sprite/palette references resolve on disk");
62+
63+
const requiredTools = [
64+
"vector-map-editor",
65+
"vector-asset-studio",
66+
"tile-map-editor",
67+
"parallax-editor",
68+
"sprite-editor",
69+
"asset-browser",
70+
"palette-browser"
71+
];
72+
for (const toolId of requiredTools) {
73+
assert(manifest.tools && typeof manifest.tools[toolId] === "object", `Missing starter tool payload for ${toolId}.`, issues);
74+
}
75+
notes.push("starter project includes payloads for all active first-class tools");
76+
77+
assert(Boolean(manifest.tools?.["vector-map-editor"]?.snapshot?.documentData), "Vector Map Editor payload is missing snapshot.documentData.", issues);
78+
assert(typeof manifest.tools?.["vector-asset-studio"]?.svgText === "string", "Vector Asset Studio payload is missing svgText.", issues);
79+
assert(Boolean(manifest.tools?.["tile-map-editor"]?.documentModel?.assetRefs?.tilemapId), "Tilemap Studio payload is missing tilemap asset reference.", issues);
80+
assert(Array.isArray(manifest.tools?.["parallax-editor"]?.documentModel?.assetRefs?.parallaxSourceIds), "Parallax Scene Studio payload is missing parallax source ids.", issues);
81+
assert(Boolean(manifest.tools?.["sprite-editor"]?.project?.assetRefs?.spriteId), "Sprite Editor payload is missing sprite asset reference.", issues);
82+
notes.push("cross-tool loading payloads are structurally present");
83+
84+
const roundTripped = JSON.parse(serializeProjectManifest(manifest));
85+
assert(roundTripped.schema === PROJECT_MANIFEST_SCHEMA, "Serialized starter project lost schema.", issues);
86+
assert(roundTripped.name === manifest.name, "Serialized starter project changed project name.", issues);
87+
assert(Array.isArray(roundTripped.sharedLibrary?.assets), "Serialized starter project lost sharedLibrary assets.", issues);
88+
notes.push("starter project serializes and reloads through shared project serializer");
89+
90+
const spriteEditor = getToolById("sprite-editor");
91+
const legacySprite = getToolById("sprite-editor-old-keep");
92+
assert(spriteEditor?.active === true && spriteEditor?.visibleInToolsList === true, "Sprite Editor must remain first-class and visible.", issues);
93+
assert(legacySprite?.active !== true && legacySprite?.visibleInToolsList !== true, "SpriteEditor_old_keep must remain hidden legacy.", issues);
94+
notes.push("sprite tool visibility rules remain intact");
95+
96+
const toolsIndex = await fs.readFile(path.join(repoRoot, "tools/index.html"), "utf8");
97+
assert(!/samples\//i.test(toolsIndex), "tools/index.html must remain tool-only and sample-free.", issues);
98+
notes.push("tools/index.html remains tool-only and sample-free");
99+
100+
const reportLines = [
101+
"BUILD_PR_STARTER_PROJECT_TEMPLATE validation report",
102+
"",
103+
issues.length === 0 ? "STATUS: PASS" : "STATUS: FAIL",
104+
"",
105+
"Checks:",
106+
...notes.map((note) => `- ${note}`),
107+
"",
108+
"Issues:",
109+
...(issues.length > 0 ? issues.map((issue) => `- ${issue}`) : ["- none"])
110+
];
111+
112+
await fs.writeFile(path.join(repoRoot, REPORT_PATH), `${reportLines.join("\n")}\n`, "utf8");
113+
114+
if (issues.length > 0) {
115+
console.error("STARTER_PROJECT_TEMPLATE_INVALID");
116+
issues.forEach((issue) => console.error(`- ${issue}`));
117+
process.exitCode = 1;
118+
return;
119+
}
120+
121+
console.log("STARTER_PROJECT_TEMPLATE_VALID");
122+
console.log(`Report: ${REPORT_PATH}`);
123+
}
124+
125+
await main();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Starter Project Template
2+
3+
This template is a single reusable project manifest for the shared tools project system.
4+
5+
## Purpose
6+
- prove cross-tool open/save/reload compatibility
7+
- keep assets and palettes referenced by shared ids and paths
8+
- avoid introducing gameplay systems or sample cards
9+
10+
## Open flow
11+
1. Open any active first-class tool.
12+
2. Use the shared shell `Open Project` action.
13+
3. Select `templates/starter-project-template/config/starter.project.json`.
14+
15+
## Shared references used
16+
- vector: `templates/vector-native-arcade/assets/vectors/template-player.vector.json`
17+
- tilemap: `templates/vector-native-arcade/assets/tilemaps/template-arena.tilemap.json`
18+
- parallax: `templates/vector-native-arcade/assets/parallax/template-backdrop.parallax.json`
19+
- sprite: `games/Asteroids/platform/assets/sprites/asteroids-demo.sprite.json`
20+
- palette: `templates/vector-native-arcade/assets/palettes/vector-native-primary.palette.json`
21+
22+
## Notes
23+
- `Sprite Editor` remains first-class.
24+
- `SpriteEditor_old_keep` remains legacy and hidden.
25+
- `tools/index.html` remains tool-only and sample-free.

0 commit comments

Comments
 (0)