|
| 1 | +# Canonical Repository Structure |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +Prevent technical debt by requiring all new and modified code to follow one repository structure. |
| 6 | + |
| 7 | +## Canonical Structure |
| 8 | + |
| 9 | +Tools: |
| 10 | +- toolbox/{tool-name}/index.html |
| 11 | + |
| 12 | +Tool assets: |
| 13 | +- assets/toolbox/{tool-name}/js/index.js |
| 14 | +- assets/toolbox/{tool-name}/css/index.css |
| 15 | + |
| 16 | +Themes: |
| 17 | +- assets/theme-v1/ |
| 18 | +- assets/theme-v2/ |
| 19 | + |
| 20 | +Shared JavaScript: |
| 21 | +- assets/js/shared/ |
| 22 | + |
| 23 | +Engine: |
| 24 | +- src/engine/{feature-name}/ |
| 25 | + |
| 26 | +API: |
| 27 | +- api/{feature-name}/ |
| 28 | + |
| 29 | +Server: |
| 30 | +- server/{feature-name}/ |
| 31 | + |
| 32 | +Tests: |
| 33 | +- tests/toolbox/{tool-name}/ |
| 34 | +- tests/engine/{feature-name}/ |
| 35 | +- tests/api/{feature-name}/ |
| 36 | +- tests/server/{feature-name}/ |
| 37 | +- tests/js/shared/ |
| 38 | +- tests/regression/ |
| 39 | + |
| 40 | +## Rules |
| 41 | + |
| 42 | +- Theme first. Use theme styles whenever possible. |
| 43 | +- Tool CSS is allowed only when a requirement cannot be satisfied by the active theme. |
| 44 | +- Every tool must be independently testable. |
| 45 | +- Regression tests do not replace tool-level tests. |
| 46 | +- Shared functionality belongs in assets/js/shared/. |
| 47 | +- New development must follow the canonical structure. |
| 48 | +- No new scattered JavaScript folders. |
| 49 | +- No new scattered CSS folders. |
| 50 | +- No new scattered test folders. |
| 51 | + |
| 52 | +## Legacy Migration |
| 53 | + |
| 54 | +When a tool is modified: |
| 55 | + |
| 56 | +1. Review JS location. |
| 57 | +2. Review CSS location. |
| 58 | +3. Review test location. |
| 59 | +4. Move touched files into the canonical structure. |
| 60 | +5. Update imports. |
| 61 | +6. Update tests. |
| 62 | +7. Remove legacy references. |
| 63 | + |
| 64 | +Legacy files may only be deleted when no active references remain. |
| 65 | + |
| 66 | +## Folder Ownership |
| 67 | + |
| 68 | +A folder may contain only assets related to that feature. |
| 69 | + |
| 70 | +Example: |
| 71 | + |
| 72 | +assets/toolbox/text-to-speech/ |
| 73 | + |
| 74 | +may not contain files used exclusively by another tool. |
| 75 | + |
| 76 | +Shared functionality must be moved to: |
| 77 | + |
| 78 | +assets/js/shared/ |
0 commit comments