Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com> Co-authored-by: Thomas Nordquist <thomasnordquist@users.noreply.github.com>
3.6 KiB
3.6 KiB
copilot-instructions.md - Agent Long-Term Memory
META-INSTRUCTIONS (IMMUTABLE)
- Long-term memory: If you learn something during a session that would save time in future sessions, add it to
.github/copilot-instructions.md - Paper knowledge must go: If something is no longer true, update or remove it immediately
- Evaluate after every session: Consider whether the instructions need updates based on what you learned
- Concise and useful: All information must be actionable, current, and concise
Test Commands
Unit tests:
yarn test- All unit tests (app + backend)yarn test:app- Frontend tests onlyyarn test:backend- Backend tests only
Integration tests:
yarn test:ui- Browser tests (requiresyarn buildfirst)yarn test:demo-video- UI recording (requires Xvfb, mosquitto, tmux, ffmpeg)yarn test:mcp- Model Context Protocol testsyarn test:all- All tests (unit + demo-video)./scripts/runBrowserTests.sh- Browser mode UI tests (requires mosquitto service)
CI jobs: test, ui-tests, demo-video, test-browser, browser-ui-tests
Important: Browser UI tests require MQTT broker. In CI, GitHub Actions health checks ensure the mosquitto service is ready before tests run.
Browser Mode
Prerequisites: Node.js ≥24, Yarn, Mosquitto broker (for testing)
Development (hot reload):
export MQTT_EXPLORER_USERNAME=admin MQTT_EXPLORER_PASSWORD=yourpass
yarn dev:server
# Backend: http://localhost:3000, Frontend: http://localhost:8080 (use this one)
Production:
yarn build:server
export MQTT_EXPLORER_USERNAME=admin MQTT_EXPLORER_PASSWORD=yourpass
yarn start:server # http://localhost:3000
Build artifacts: dist/src/server.js, app/build/*.js, app/build/index.html
Debugging Browser Mode
DevTools checks:
- Console: JavaScript errors, CSP errors (security headers), WebSocket issues
- Network: Static asset loading, WebSocket status, API auth
Common issues:
- Blank page/CSP errors: Add
'unsafe-eval'toscriptSrcinsrc/server.tshelmet config - Auth loop: WebSocket auth failing - check Network → WS → Messages and server logs
- Theme errors: Verify both ThemeProvider and LegacyThemeProvider in
app/src/index.tsx
Expected warnings (non-fatal):
- React 18 + Material-UI v5 type warnings
- IpcRendererEventBus errors (no Electron IPC in browser mode)
- MUI locale, componentWillReceiveProps, ACE editor warnings
WebSocket debugging:
node dist/src/server.js 2>&1 | tee server.log
# Check DevTools → Network → WS → Messages for handshake
# CORS: check ALLOWED_ORIGINS env var
Security notes:
unsafe-evalin CSP required for webpack (security tradeoff)- Never hardcode credentials (use env vars)
- Production: use HTTPS with reverse proxy
- Rate limit: 5 auth attempts/15min/IP
- File upload limit: 16MB
Key files:
src/server.ts- Express server, security middlewareapp/webpack.browser.config.mjs- Browser webpack configapp/src/browserEventBus.ts- Socket.io clientapp/src/components/BrowserAuthWrapper.tsx- Auth dialogapp/src/index.tsx- React entry, theme providers
Styling Conventions
When modifying or creating UI components, follow the styling patterns documented in STYLING.md.
Key points for AI agents:
- Use Material-UI (MUI) v7 components with
withStylesHOC for styling - Access theme colors via
theme.palette.*, spacing viatheme.spacing(), typography viatheme.typography.* - Support both light and dark modes with theme-conditional styling
- Import Material-UI colors:
import { blueGrey, amber, green, red } from '@mui/material/colors'