Revise copilot-instructions.md: consolidate redundant sections, extract language-specific rules * Added comprehensive internal documentation files establishing coding standards and development workflows for C++, Web UI, CI/CD, and ESP-IDF components. * Implemented CodeRabbit configuration to enforce repository-specific code review guidance and quality standards across pull requests. * Documented development workflow procedures and contribution expectations to streamline the development process and improve code consistency. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
3.9 KiB
3.9 KiB
Agent-Mode Build & Test Instructions
Detailed build workflow, timeouts, and troubleshooting for making code changes in agent mode. Always reference these instructions first when running builds or validating changes.
Build Timing and Timeouts
Use these timeout values when running builds:
| Command | Typical Time | Minimum Timeout | Notes |
|---|---|---|---|
npm run build |
~3 s | 30 s | Web UI → wled00/html_*.h headers |
npm test |
~40 s | 2 min | Validates build system |
npm run dev |
continuous | — | Watch mode, auto-rebuilds on changes |
pio run -e <env> |
15–20 min | 30 min | First build downloads toolchains; subsequent builds are faster |
NEVER cancel long-running builds. PlatformIO downloads and compilation require patience.
Development Workflow
Web UI Changes
- Edit files in
wled00/data/ - Run
npm run buildto regeneratewled00/html_*.hheaders - Test with local HTTP server (see Manual Testing below)
- Run
npm testto validate
Firmware Changes
- Edit files in
wled00/(but neverhtml_*.hfiles) - Ensure web UI is built first:
npm run build - Build firmware:
pio run -e esp32_4MB_V4_M(set timeout ≥ 30 min) - Flash to device:
pio run -e [target] --target upload
Combined Web + Firmware Changes
- Always build web UI first
- Test web interface manually
- Then build and test firmware
Before Finishing Work
You MUST complete ALL of these before marking work as done:
- Run tests:
npm test— must pass - Build firmware:
pio run -e esp32_4MB_V4_M— must succeed- Set timeout to 30+ minutes, never cancel
- Choose
esp32_4MB_V4_Mas a common, representative environment - If the build fails, fix the issue before proceeding
- For web UI changes: manually test the interface (see below)
If any step fails, fix the issue. Do NOT mark work complete with failing builds or tests.
Manual Web UI Testing
Start a local server:
cd wled00/data && python3 -m http.server 8080
# Open http://localhost:8080/index.htm
Test these scenarios after every web UI change:
- Load:
index.htmloads without JavaScript errors (check browser console) - Navigation: switching between main page and settings pages works
- Color controls: color picker and brightness controls function correctly
- Effects: effect selection and parameter changes work
- Settings: form submission and validation work
Troubleshooting
Common Build Issues
| Problem | Solution |
|---|---|
Missing html_*.h |
Run npm ci; npm run build |
| Web UI looks broken | Check browser console for JS errors |
| PlatformIO network errors | Retry — downloads can be flaky |
| Node.js version mismatch | Ensure Node.js 20+ (check .nvmrc) |
Recovery Steps
- Force web UI rebuild:
npm run build -- -f - Clear generated files:
rm -f wled00/html_*.hthennpm run build - Clean PlatformIO cache:
pio run --target clean - Reinstall Node deps:
rm -rf node_modules && npm ci
CI/CD Validation
The GitHub Actions CI workflow will:
- Install Node.js and Python dependencies
- Run
npm test - Build web UI (automatic via PlatformIO)
- Compile firmware for all
default_envstargets
To ensure CI success, always validate locally:
- Run
npm testand ensure it passes - Run
pio run -e esp32_4MB_V4_M(or another common firmware environment, see next section) and ensure it completes successfully - If either fails locally, it WILL fail in CI
Match this workflow in local development to catch failures before pushing.
Important Reminders
- Never edit or commit
wled00/html_*.h— auto-generated fromwled00/data/ - Web UI rebuild is part of the PlatformIO firmware compilation pipeline
- Common firmware environments:
esp32_4MB_V4_M,esp32_16MB_V4_S_HUB75,esp32S3_8MB_PSRAM_M_qspi,esp32_16MB_V4_M_eth,esp8266_4MB_S(deprecated),esp32dev_compat - List all PlatformIO targets:
pio run --list-targets