|
| 1 | +# BUILD_PR — LEVEL 09_07 — TOOL BOUNDARY NORMALIZATION |
| 2 | + |
| 3 | +## Objective |
| 4 | +Normalize boundaries across active tools so `tools/shared` becomes the only approved shared surface for reusable tool logic, while each tool remains responsible only for its own UI and orchestration. |
| 5 | + |
| 6 | +## Why This PR Exists |
| 7 | +The prior lane completed: |
| 8 | +- asset structure simplification |
| 9 | +- shared asset handoff enforcement |
| 10 | +- tool launch contract alignment |
| 11 | + |
| 12 | +This PR is the next dependency-ordered step. The repo now needs a strict separation between: |
| 13 | +- tool-local UI / workflow code |
| 14 | +- shared tool utilities / state / IO helpers |
| 15 | + |
| 16 | +Without this pass, active tools risk continuing to: |
| 17 | +- duplicate helper logic |
| 18 | +- import across tool folders |
| 19 | +- hide reusable logic inside one tool and copy it elsewhere |
| 20 | +- blur the line between shared utility code and tool-specific implementation |
| 21 | + |
| 22 | +## In Scope |
| 23 | +- inventory reusable exact-clusters inside active tools |
| 24 | +- extract only proven multi-tool logic into `tools/shared` |
| 25 | +- replace cross-tool imports with `tools/shared` imports |
| 26 | +- document and enforce the rule that tools do not import other tools |
| 27 | +- normalize shared helper placement for tool-only utilities |
| 28 | +- add or update focused validation that guards tool-boundary rules |
| 29 | + |
| 30 | +## Out of Scope |
| 31 | +- no engine changes |
| 32 | +- no runtime/gameplay changes |
| 33 | +- no asset relocation |
| 34 | +- no feature additions |
| 35 | +- no UI redesign |
| 36 | +- no broad cleanup unrelated to tool boundaries |
| 37 | +- no speculative extraction without reuse evidence |
| 38 | + |
| 39 | +## Target Tools |
| 40 | +Primary active tools for this pass: |
| 41 | +- Tile Map Editor |
| 42 | +- Parallax Editor |
| 43 | +- Vector Map Editor |
| 44 | +- Vector Asset Studio |
| 45 | +- Sprite Editor |
| 46 | + |
| 47 | +Secondary tool shells to keep aligned if touched: |
| 48 | +- State Inspector |
| 49 | +- Replay Visualizer |
| 50 | +- Performance Profiler |
| 51 | + |
| 52 | +## Boundary Rules To Enforce |
| 53 | +1. A tool must not import code from another tool folder. |
| 54 | +2. Reusable tool logic must live under `tools/shared`. |
| 55 | +3. Tool entry files should orchestrate only: |
| 56 | + - boot |
| 57 | + - UI wiring |
| 58 | + - tool-local composition |
| 59 | +4. Shared logic extracted into `tools/shared` must be: |
| 60 | + - tool-agnostic |
| 61 | + - minimal |
| 62 | + - contractable |
| 63 | + - reused by 2+ active tools, or clearly required as the single approved shared surface |
| 64 | +5. Tool-specific workflow logic remains in the owning tool. |
| 65 | + |
| 66 | +## Extraction Heuristics |
| 67 | +Promote only exact clusters such as: |
| 68 | +- path / URL resolution helpers |
| 69 | +- manifest/sample loading helpers |
| 70 | +- palette serialization / normalization helpers |
| 71 | +- shared storage key helpers |
| 72 | +- common panel / layout state helpers |
| 73 | +- tool-local fetch / import/export wrappers with repeated usage |
| 74 | + |
| 75 | +Do not promote: |
| 76 | +- editor-specific commands |
| 77 | +- tool-specific scene behavior |
| 78 | +- one-off UI event flows |
| 79 | +- feature logic that belongs to a single editor |
| 80 | + |
| 81 | +## Expected Implementation Shape |
| 82 | +Preferred shared homes: |
| 83 | +- `tools/shared/io/...` |
| 84 | +- `tools/shared/state/...` |
| 85 | +- `tools/shared/utils/...` |
| 86 | +- `tools/shared/contracts/...` (only if needed by proven reuse) |
| 87 | +- `tools/shared/validation/...` (only if needed by focused checks) |
| 88 | + |
| 89 | +## Required Deliverables |
| 90 | +Codex should produce a small surgical delta containing: |
| 91 | +- exact-cluster extractions only |
| 92 | +- updated imports in affected tools |
| 93 | +- focused validation / test coverage for boundary rules |
| 94 | +- no unrelated file movement |
| 95 | + |
| 96 | +## Validation Requirements |
| 97 | +At minimum validate: |
| 98 | +- touched tool entry files parse successfully |
| 99 | +- no active tool imports another tool directly |
| 100 | +- extracted helpers resolve from `tools/shared` |
| 101 | +- prior launch-contract behavior still passes |
| 102 | +- asset/palette hook expectations are not regressed |
| 103 | + |
| 104 | +## Suggested Validation Commands |
| 105 | +Use the repo's existing validation style and keep it lightweight. Prefer focused checks such as: |
| 106 | +- node --check on touched files |
| 107 | +- focused tests for tool launch / boundary rules |
| 108 | +- existing asset usage / launch contract tests if present |
| 109 | + |
| 110 | +## Acceptance Criteria |
| 111 | +- active tools do not import one another |
| 112 | +- reusable exact-cluster helpers are centralized under `tools/shared` |
| 113 | +- no engine/runtime code is touched |
| 114 | +- no asset layout changes occur |
| 115 | +- tests/checks covering boundary rules pass |
| 116 | +- the delta remains small and purpose-specific |
| 117 | + |
| 118 | +## Implementation Notes |
| 119 | +- Keep this PR docs-first and surgical. |
| 120 | +- Favor exact-cluster extraction over broad reorganization. |
| 121 | +- If a candidate helper is only used once, leave it local. |
| 122 | +- If a helper contains UI assumptions from one tool, do not promote it until split cleanly. |
0 commit comments