|
| 1 | +# BUILD_PR_SHARED_EXTRACTION_15_ALIAS_IMPORTS_ADVANCED_ONLY |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Introduce a safe alias-import proof point for shared helpers in the advanced layer only. |
| 5 | + |
| 6 | +## Single PR Purpose |
| 7 | +Switch shared-helper imports in these 2 files from relative paths to the `@shared/*` alias: |
| 8 | + |
| 9 | +1. `src/advanced/promotion/createPromotionGate.js` |
| 10 | +2. `src/advanced/state/createWorldGameStateSystem.js` |
| 11 | + |
| 12 | +This BUILD includes the minimum repo config needed to make `@shared/*` resolve for this proof-point scope. |
| 13 | + |
| 14 | +## Exact Files Allowed |
| 15 | +Edit only these files: |
| 16 | + |
| 17 | +1. `src/advanced/promotion/createPromotionGate.js` |
| 18 | +2. `src/advanced/state/createWorldGameStateSystem.js` |
| 19 | + |
| 20 | +Plus the minimum alias-config file(s) already present in the repo, chosen from this allowed set only if needed: |
| 21 | + |
| 22 | +3. `jsconfig.json` |
| 23 | +4. `tsconfig.json` |
| 24 | +5. `vite.config.js` |
| 25 | +6. `vite.config.mjs` |
| 26 | +7. `webpack.config.js` |
| 27 | + |
| 28 | +Do not edit any other file. |
| 29 | +Do not create a new config file if one suitable file already exists. |
| 30 | + |
| 31 | +## Alias Target |
| 32 | +Use this alias namespace only: |
| 33 | + |
| 34 | +```js |
| 35 | +@shared/ |
| 36 | +``` |
| 37 | + |
| 38 | +It must resolve to: |
| 39 | + |
| 40 | +```js |
| 41 | +src/shared/ |
| 42 | +``` |
| 43 | + |
| 44 | +## Fail-Fast Gate |
| 45 | +Before making source edits: |
| 46 | + |
| 47 | +1. Identify one existing config file from the allowed set that is actually used by the repo for import resolution. |
| 48 | +2. Confirm it can support the `@shared/*` alias with a minimal change. |
| 49 | + |
| 50 | +If no suitable existing config file is present or the resolution mechanism is unclear: |
| 51 | +- stop |
| 52 | +- report blocker |
| 53 | +- make no changes |
| 54 | +- do not create a delta ZIP |
| 55 | + |
| 56 | +Do **not** invent a new toolchain or add broad config in this PR. |
| 57 | + |
| 58 | +## Exact Source Changes |
| 59 | + |
| 60 | +### 1) `src/advanced/promotion/createPromotionGate.js` |
| 61 | +Replace only shared-helper relative imports with alias imports. |
| 62 | + |
| 63 | +Expected alias forms: |
| 64 | +```js |
| 65 | +import { asFiniteNumber } from '@shared/utils/numberUtils.js'; |
| 66 | +import { asPositiveInteger } from '@shared/utils/numberUtils.js'; |
| 67 | +import { isPlainObject } from '@shared/utils/objectUtils.js'; |
| 68 | +import { createPromotionStateSnapshot } from '@shared/state/createPromotionStateSnapshot.js'; |
| 69 | +``` |
| 70 | + |
| 71 | +Rules: |
| 72 | +- preserve current imported specifiers |
| 73 | +- if imports from the same aliased module can be combined without changing behavior/style, minimum-edit combination is allowed |
| 74 | +- do not touch unrelated imports |
| 75 | +- do not change logic |
| 76 | + |
| 77 | +### 2) `src/advanced/state/createWorldGameStateSystem.js` |
| 78 | +Replace only shared-helper relative imports with alias imports. |
| 79 | + |
| 80 | +Expected alias forms: |
| 81 | +```js |
| 82 | +import { asFiniteNumber } from '@shared/utils/numberUtils.js'; |
| 83 | +import { asPositiveInteger } from '@shared/utils/numberUtils.js'; |
| 84 | +import { isPlainObject } from '@shared/utils/objectUtils.js'; |
| 85 | +import { createPromotionStateSnapshot } from '@shared/state/createPromotionStateSnapshot.js'; |
| 86 | +``` |
| 87 | + |
| 88 | +Rules: |
| 89 | +- preserve current imported specifiers |
| 90 | +- if imports from the same aliased module can be combined without changing behavior/style, minimum-edit combination is allowed |
| 91 | +- do not touch unrelated imports |
| 92 | +- do not change logic |
| 93 | + |
| 94 | +## Exact Config Change Rules |
| 95 | +In the one chosen existing config file: |
| 96 | +- add the minimum alias mapping necessary for `@shared/*` -> `src/shared/*` |
| 97 | +- do not add unrelated aliases |
| 98 | +- do not reformat the whole config |
| 99 | +- do not change build behavior beyond what is needed for alias resolution |
| 100 | +- do not add testing, lint, or IDE settings beyond the single alias need in the chosen file |
| 101 | + |
| 102 | +## Hard Constraints |
| 103 | +- do not edit any file other than the 2 source files plus one chosen existing config file from the allowed set |
| 104 | +- do not touch engine files |
| 105 | +- do not touch sample files |
| 106 | +- do not migrate aliases repo-wide |
| 107 | +- do not remove `.js` extensions from imports |
| 108 | +- do not change helper behavior |
| 109 | +- keep one PR purpose only |
| 110 | + |
| 111 | +## Validation Checklist |
| 112 | +1. Confirm no more than 3 files changed |
| 113 | +2. Confirm exactly 2 advanced files now import shared helpers via `@shared/...` |
| 114 | +3. Confirm the chosen existing config file resolves `@shared/*` to `src/shared/*` |
| 115 | +4. Confirm no unrelated imports changed |
| 116 | +5. Confirm no logic changed |
| 117 | +6. Confirm no sample or engine file was touched |
| 118 | + |
| 119 | +## Non-Goals |
| 120 | +- no repo-wide alias migration |
| 121 | +- no alias rollout to samples |
| 122 | +- no alias rollout to engine |
| 123 | +- no path cleanup outside the 2 exact advanced files |
| 124 | +- no toolchain redesign |
0 commit comments