8.8 KiB
ImEX RPS Agent Guide
This file is the first stop for coding agents working in this repository. It is intentionally practical: read this before changing code, then use the deeper files in .ai/ when you need more context.
Project Snapshot
ImEX RPS is an Electron desktop app with a Vite/React renderer. It is used by body shops to import, inspect, report on, and audit repair estimate data. The app reads estimate files from configured local folders, decodes DBF-based estimate data in the Electron main process, stores jobs/joblines in Hasura/Postgres through GraphQL, and presents workflows for jobs, reporting, scanning, settings, admin work, audits, and estimate scrubbing.
Primary technologies:
- Electron 42, electron-builder 26, Vite 6, React 18
- Ant Design 5
- Redux 5, redux-saga, redux-persist, reselect
- Apollo Client 3 against a Hasura GraphQL endpoint
- Firebase authentication
- Sentry Electron 7
- Hasura metadata and SQL migrations under
hasura/
Fast Start
Use npm scripts, not the stale yarn commands in README.md.
npm install
npm run dev
Useful scripts:
npm run startstarts Vite onhttp://localhost:3006.npm run electronstarts Electron.npm run devruns Vite and Electron together withconcurrently.npm run buildbuilds the renderer tobuild/.npm run build:electronbundleselectron/main-src.jsandelectron/preload-src.jsintodist-electron/.npm run packperforms a local unpacked electron-builder package check with--publish never.npm run distppublishes. Do not run it unless the user explicitly asks to publish.npm run distnopublishbuilds a distributable with publish disabled.
Expected local runtime:
- Node must satisfy Electron 42 requirements. At the time of the upgrade, Node 22.22.1 was used successfully.
VITE_APP_GRAPHQL_ENDPOINTmust be available in the renderer environment.- Firebase config lives in
src/firebase/firebase.utils.js. - Electron dev mode loads
http://localhost:3006; packaged mode loadsbuild/index.html.
Important Safety Rules
- Do not publish releases unless the user explicitly says to publish.
npm run packis safe for local packaging checks because it includes--publish neverand useselectron-builder.pack-check.cjs.dist-electron/,build/, anddist/are generated artifacts and are ignored. Do not manually edit them.- Do not commit local secrets. The repo contains legacy-sensitive assets such as
certificate.p12, deployment notes, and Sentry/Firebase/AWS-related configuration. Treat them carefully. - Avoid broad refactors. This project has older patterns and domain-heavy workflows; make narrow changes and preserve behavior.
- Be careful with Electron main/renderer boundaries. Renderer code should use the exposed preload bridge on
window.ipcRenderer; main-process code should register IPC handlers underelectron/.
Architecture Map
Renderer entry:
src/index.jsxwires Redux, redux-persist,MemoryRouter, Sentry renderer, and<App />.src/App/App.jsxwires Apollo, AntDConfigProvider, AntDApp, auth session check, IPC setup, and authorized/unauthorized routing.src/components/pages/routes/routes.page.jsxdefines app pages: jobs, reporting, audit, scan, settings, admin.
Electron entry:
electron/main.jschooses source vs bundled Electron main file.electron/main-src.jsis the source of truth for main-process window creation, Sentry main, auto-updater, app menu, DevTools behavior, and global IPC initialization.electron/preload-src.jsexposeswindow.ipcRendererandwindow.logger.electron/ipc-main-handler.jsregisters shared IPC channels and imports file watcher, file scan, audit, decoder, and estimate scrubber handlers.scripts/build-electron.mjsproducesdist-electron/main.cjsanddist-electron/preload.cjs.
State/data:
src/redux/store.jsstill uses Redux core withlegacy_createStoreto avoid Redux's visual createStore deprecation.- Root reducers:
application,user,reporting,scan. - Sagas coordinate auth, user/shop setup, reporting, scanning, and application actions.
src/graphql/GraphQLClient.jssets Apollo auth, retry, Sentry, logger, error links, and cache field policies forjobsandsearch_jobs.- GraphQL operations live in
src/graphql/*.queries.js.
Domain logic:
electron/decoder/decoder.jsdecodes estimate files and applies MPI/SGI/ruleset logic.electron/file-watcher/watches configured estimate folders.electron/file-scan/scans configured folders for estimates.electron/audit/reads audit spreadsheets.electron/estimate-scrubber/sends estimate JSON to the external scrubber API and opens/sends report results.electron/claims-clerk/computes jobline alerts.
Current Conventions
Frontend:
- Components are organized by atomic-ish folders:
atoms,molecules,organisms,templates,pages. - File names generally follow
name.type.jsxand optionalname.type.styles.scss. - Use Ant Design 5 APIs. Avoid deprecated props such as
Dropdown overlay,Collapse.Panelchildren,expandIconPosition="left/right",RangePicker ranges, andTable rowKeyfunctions that rely on index. - Use
src/util/antdFeedback.jsfor message/notification calls outside React component context. Static AntDmessage/notificationcalls can miss dynamic theme context. - Keep UI state stable during data transitions. Job detail selection uses a short debounce/skeleton to avoid flashing stale detail content.
Electron:
electron-storev11 is ESM-only. UseinitializeStore()before modules that readstore, then accessstorethrough the proxy exported fromelectron/electron-store.js.electron-context-menuv4 is ESM-only. Import dynamically inapp.whenReady().- Do not reintroduce circular imports from
electron/main-src.jsinto IPC modules. IPC modules should useBrowserWindow.fromWebContents(event.sender)orBrowserWindow.getAllWindows()where needed. - Sentry main uses
ipcMode: Sentry.IPCMode.Protocol; keep this unless deliberately changing Sentry IPC behavior. - DevTools are enabled in dev and auto-open by default. Set
ELECTRON_OPEN_DEVTOOLS=0to suppress auto-open. In packaged builds DevTools are opt-in viaELECTRON_ENABLE_DEVTOOLS=1and auto-open viaELECTRON_OPEN_DEVTOOLS=1. - React DevTools extension install is opt-in with
ELECTRON_INSTALL_REACT_DEVTOOLS=1. It can trigger Chromium DevTools protocol noise.
GraphQL/Apollo:
- Default Apollo query/watchQuery fetch policy is
network-only; do not assume Apollo cache is the source of truth. - Apollo cache has custom offset merge functions for
Query.jobsandQuery.search_jobsto avoid cache replacement warnings during pagination. - Firebase current user token is attached as
Authorization: Bearer <token>throughauthLink.
Recent Maintenance Context
Recent warning/deprecation cleanup included:
- AntD v5 deprecations fixed for Collapse, Dropdown, RangePicker, Table rowKey, and static message/notification usage.
- Redux
createStoredeprecation warning avoided withlegacy_createStore. - Apollo cache warning fixed with field policies for
jobsandsearch_jobs. - Job detail left-panel flash reduced by debouncing selected job id and using a skeleton.
- Electron circular dependency warnings removed by avoiding
mainWindowexport/import. - Electron Sentry preload deprecation path avoided with protocol IPC mode.
- Electron package upgrades completed for
electron,electron-builder,electron-context-menu,electron-is-dev,electron-store, and@sentry/electron. dist-electron/is ignored and should remain generated only.
Verification Expectations
For most renderer/main changes:
npm run build
npm run build:electron
For Electron package or builder changes:
npm run pack
Remember: npm run pack is configured to avoid publishing. It may still perform local signing of the unpacked executable.
For AntD deprecation checks, if antd-style tooling is available:
npx antd-style-cli lint src --only deprecated
If a command is unavailable, report that clearly and run the nearest reliable build/check instead.
More Context
.ai/project-overview.md: product/domain summary..ai/architecture.md: process, renderer, state, and data architecture..ai/electron-main.md: Electron-specific lifecycle, packaging, IPC, and upgrade notes..ai/frontend.md: React/AntD/Redux conventions and common UI pitfalls..ai/data-graphql-hasura.md: GraphQL, Hasura, auth, cache, and schema notes..ai/workflows.md: development, packaging, release, and troubleshooting workflows..ai/recent-changes.md: migration and warning cleanup history..ai/file-map.md: important files and directories by responsibility..ai/domain-glossary.md: project/domain terms used across code and UI..github/copilot-instructions.md,CLAUDE.md, andGEMINI.mdall point agents back to this guide.