|
1 | 1 | # BUILD_PR: REPO_CLEANUP_PHASE_1B_ENGINE_BOUNDARY_AND_DUPLICATE_HELPER_SCAN |
2 | 2 |
|
3 | 3 | ## Execution Summary |
4 | | -- Docs-first scan completed across `src/engine/utils/**`, `src/engine/ui/**`, `games/**`, `tools/**`, and `samples/**`. |
| 4 | +- Docs-first scan completed across `src/shared/utils/**`, `src/engine/ui/**`, `games/**`, `tools/**`, and `samples/**`. |
5 | 5 | - This phase made no runtime/helper consolidation changes. |
6 | 6 | - Classification produced candidate groups for immediate low-risk cleanup and deferred manual review. |
7 | 7 |
|
8 | 8 | ## Findings: Already in engine, local duplicate |
9 | 9 | | path | responsibility | duplicate of | should be in engine | already in engine | canonical location | risk | recommendation | |
10 | 10 | |---|---|---|---|---|---|---|---| |
11 | | -| `games/Asteroids/utils/math.js` | wraps random/wrap helpers for Asteroids | `src/engine/utils/math.js` (`randomRange`, `wrap`) | no (wrapper can stay local) | yes | `src/engine/utils/math.js` | low | Keep only game-specific surface (`TAU`) or import engine helpers directly in consumers in a follow-up micro-PR. | |
12 | | -| `games/*/game/*` local `function clamp(...)` cluster | scalar clamp utility repeated in multiple game modules | `src/engine/utils/math.js` (`clamp`) | no | yes | `src/engine/utils/math.js` | medium | Migrate in small batches (one game at a time) to reduce behavior/regression risk. | |
| 11 | +| `games/Asteroids/utils/math.js` | wraps random/wrap helpers for Asteroids | `src/shared/utils/math.js` (`randomRange`, `wrap`) | no (wrapper can stay local) | yes | `src/shared/utils/math.js` | low | Keep only game-specific surface (`TAU`) or import engine helpers directly in consumers in a follow-up micro-PR. | |
| 12 | +| `games/*/game/*` local `function clamp(...)` cluster | scalar clamp utility repeated in multiple game modules | `src/shared/utils/math.js` (`clamp`) | no | yes | `src/shared/utils/math.js` | medium | Migrate in small batches (one game at a time) to reduce behavior/regression risk. | |
13 | 13 | | `tools/Vector Map Editor/editor/VectorMapFullscreenController.js` | fullscreen toggle + state sync | `src/engine/runtime/FullscreenService.js` | no | yes | `src/engine/runtime/FullscreenService.js` | low | Replace tool-local controller with engine runtime service adapter. | |
14 | 14 | | `tools/Vector Map Editor/editor/VectorMapSerializer.js` + `tools/Vector Map Editor/editor/VectorMapRuntimeExporter.js` | blob download orchestration | `src/engine/runtime/BrowserDownloadService.js` | no | yes | `src/engine/runtime/BrowserDownloadService.js` | low | Route downloads through `BrowserDownloadService` and keep only payload-building logic local. | |
15 | 15 | | `samples/_shared/platformerHelpers.js` (`overlap`) | AABB overlap predicate | `src/engine/collision/aabb.js` (`isColliding`) | no | yes | `src/engine/collision/index.js` | low | Import/alias `isColliding` in shared sample helper instead of redefining overlap math. | |
|
39 | 39 | | path | responsibility | duplicate of | should be in engine | already in engine | canonical location | risk | recommendation | |
40 | 40 | |---|---|---|---|---|---|---|---| |
41 | 41 | | `games/SpaceInvaders/game/WaveController.js` naming | helper name implies simulation controller but currently HUD/banner presenter | `games/SpaceDuel/game/WaveController.js` (name only) | no | no | likely rename to `WaveHudPresenter`/`WaveStatusPresenter` | low | Rename in a doc-safe or tiny code-safe follow-up with import-site checks. | |
42 | | -| `tools/SpriteEditor_old_keep/main.js` local `clamp` | overlaps engine clamp but file is a large patch/stabilization entrypoint | `src/engine/utils/math.js` (`clamp`) | uncertain | yes | evaluate per SpriteEditor stability plan | medium | Defer until SpriteEditor stabilization work is complete; avoid mixing concerns. | |
43 | | -| `samples/sample003-mouse-input/MouseInputScene.js`, `samples/sample004-gamepad-input/GamepadScene.js` class-local clamp methods | duplicates engine clamp, but potentially intentional pedagogy | `src/engine/utils/math.js` (`clamp`) | uncertain | yes | sample-specific decision | low | Keep as-is unless sample docs explicitly prefer engine helper usage. | |
44 | | -| Target path expectation: `src/engine/math/**` | scan target includes path that does not exist in repo (math lives under `src/engine/utils/math.js`) | N/A | N/A | N/A | `src/engine/utils/math.js` | low | Update future scan templates/docs to avoid path drift. | |
| 42 | +| `tools/SpriteEditor_old_keep/main.js` local `clamp` | overlaps engine clamp but file is a large patch/stabilization entrypoint | `src/shared/utils/math.js` (`clamp`) | uncertain | yes | evaluate per SpriteEditor stability plan | medium | Defer until SpriteEditor stabilization work is complete; avoid mixing concerns. | |
| 43 | +| `samples/sample003-mouse-input/MouseInputScene.js`, `samples/sample004-gamepad-input/GamepadScene.js` class-local clamp methods | duplicates engine clamp, but potentially intentional pedagogy | `src/shared/utils/math.js` (`clamp`) | uncertain | yes | sample-specific decision | low | Keep as-is unless sample docs explicitly prefer engine helper usage. | |
| 44 | +| Target path expectation: `src/engine/math/**` | scan target includes path that does not exist in repo (math lives under `src/shared/utils/math.js`) | N/A | N/A | N/A | `src/shared/utils/math.js` | low | Update future scan templates/docs to avoid path drift. | |
45 | 45 |
|
46 | 46 | ## Explicit File Lists |
47 | 47 |
|
|
114 | 114 | - Migrate `Asteroids`, `SpaceDuel`, `SpaceInvaders` services to thin adapters. |
115 | 115 | 4. `BUILD_PR: REPO_CLEANUP_PHASE_1F_NAMING_AND_TEMPLATE_ALIGNMENT` |
116 | 116 | - Resolve `WaveController` naming ambiguity in Space Invaders. |
117 | | - - Update cleanup template path expectation from `src/engine/math/**` to `src/engine/utils/math.js`. |
| 117 | + - Update cleanup template path expectation from `src/engine/math/**` to `src/shared/utils/math.js`. |
118 | 118 |
|
119 | 119 | ## Phase Status |
120 | 120 | - Classification and planning complete. |
|
0 commit comments