mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
6.1 KiB
6.1 KiB
REFACTOR RULES
- Do NOT change ANY functionality. All changes must be purely internal refactors.
- Refactor for simplification and maintainability.
- Remove unused files/code only when verified unused.
- No backwards compatability is needed anywhere. Clients and the server are both always up to date.
- Keep behavior/API contracts unchanged.
Required safety checks for every change
- Preserve imports/exports and call signatures unless internal-only and non-observable.
- Validate no runtime behavior changes (manual flow checks + targeted tests when available).
- Make small, reviewable commits per service/component area.
- Treat
npm run buildoutput files committed into this repo as intentional deployment artifacts; do not discard them as noise.
Server backend
- Every service must live in its own folder, even when it remains a single-file implementation.
- Convert every service into a folder-based structure.
- Split very large service files into smaller focused modules.
- Keep files concise and single-purpose.
- Add clear title comments at top of split files.
- Every service/module file should start with a descriptive comment header containing:
- a title line naming the service/module file
- a longer purpose/scope description (not a one-liner)
WebUI frontend
- Every component must live in its own folder, even when it remains a single-file implementation.
- Split large JSX/components and large backing JS files into folderized modules.
- Keep modules clear and focused, with title comments.
- Every component/module file should start with a descriptive comment header containing:
- a title line naming the file/module
- a longer purpose/scope description (not a one-liner)
- Each component must live entirely inside its own folder; do not leave wrapper/compatibility component files outside that folder.
- Remove stale compatibility/leftover code only after usage verification.
REFACTOR TRACKING
Current phase
- Phase 1: Inventory + usage mapping (server + webui)
- Phase 2: Refactor highest-impact offenders first
- Phase 3: Sweep remaining services/components
- Phase 4: Dead code/file removal pass
- Phase 5: Final regression validation
Server backend
BIGGEST OFFENDERS
- audio forward service
- button box service
- chat service
- discord bot service
- home assistant service
- llm commentary service
- private rover access request service
- replay services (already partly split; reformat consistently)
- room camera services (already partly split; reformat consistently)
- rover manager service
- session service
- turn service
- verification service
- video auth service
- All remaining services: reorganize to folder structure where needed
COMPLETED SERVICES
- turn service
- session service
LARGE CHANGES
- Folderized all files in
server/src/services/into per-service folders withindex.jsentrypoints and updated internal relative imports for new path depth. - Split
server/src/services/turnService/index.jsby extracting constants, shared state helpers, and side-effect action helpers intoturnService/constants.js,turnService/state.js, andturnService/actions.js. - Split
server/src/services/sessionService/index.jsby extracting config/timing constants, sync-throttle state storage, and visibility filter helpers intosessionService/constants.js,sessionService/state.js, andsessionService/filters.js.
WebUI frontend
BIGGEST OFFENDERS
- mini summary app
- spectator app
- vip audio upload card
- admin panel
- drive dock action
- gamepad mapping settings
- mobile controls
- top down map
- video tile
- Sweep
webuifor unused or unneeded files/code with verification
COMPLETED COMPONENTS
- mini summary app
- spectator app
- video tile
- vip audio upload card
- admin panel
- drive dock action
- gamepad mapping settings
- mobile controls
- top down map
LARGE CHANGES
- Split
webui/src/mini/MiniSummaryApp.jsxinto folderized modules underwebui/src/mini/MiniSummaryApp/with a compatibility entrypoint preserved. - Split
webui/src/spectate/SpectatorApp.jsxinto folderized modules underwebui/src/spectate/SpectatorApp/with a compatibility entrypoint preserved. - Split
webui/src/components/VideoTile.jsxby extracting HUD, overlays, chat input, and constants intowebui/src/components/VideoTile/while preserving the existingVideoTile.jsxpublic component API. - Split
webui/src/components/vip/VipAudioUploadCard.jsxby extracting transport/audio helpers and UI atoms intowebui/src/components/vip/VipAudioUploadCard/while preserving the existingVipAudioUploadCard.jsximport/export API. - Split
webui/src/components/AdminPanel.jsxintowebui/src/components/AdminPanel/and extracted monitor/health/log/LLM helper modules; updated consumers to folder entrypoint and removed external wrapper file. - Moved
DriveDockActiontowebui/src/components/DriveDockAction/index.jsxand updated all consumers to folder entrypoint imports. - Split
webui/src/components/GamepadMappingSettings.jsxintowebui/src/components/GamepadMappingSettings/with extracted constants/helpers/SliderField modules and removed the standalone component file. - Split
webui/src/components/MobileControls.jsxintowebui/src/components/MobileControls/with extracted joystick/aux/constants modules; preserved named exports and moved app import to folder entrypoint. - Split
webui/src/components/TopDownMap.jsxintowebui/src/components/TopDownMap/with extracted geometry/color helpers and visual SVG primitive modules; updated all consumers to folder entrypoint. - Folderized all remaining top-level files under
webui/src/components/into per-componentindex.jsxfolders and rewired component imports to match the new structure. - Removed unreferenced components
CameraServoPanelandControlSummaryafter dependency-map verification and successful rebuild.
Done criteria (per item)
- Folderized structure created.
- Large functions extracted into focused files.
- Imports/exports updated with no external behavior change.
- Verified references/usages still resolve.
- Passed targeted checks/tests for touched area.