mirror of
https://github.com/Colorado-Mesh/meshcore-bot-firmware.git
synced 2026-08-11 08:10:29 +00:00
4.2 KiB
4.2 KiB
Step 1 Execution Plan: Bootstrap wrapper repository, upstream submodule, and patch workflow
Goal
Create a reproducible Colorado Mesh firmware wrapper that pins upstream MeshCore and can apply/export Colorado bot patches without relying on untracked submodule edits.
Current Code Observations
- Local MeshCore exists at
/Users/cjvana/Documents/GitHub/MeshCorecommit6b52fb32301c273fc78d96183501eb23ad33c5bb, but research recommends pinning the wrapper submodule independently. - MeshCore builds from its repo root with
build.sh build-firmware <env>and expectsFIRMWARE_VERSIONin the environment before building. - MeshCore
platformio.iniincludes all variant configs viavariants/*/platformio.iniand currently enablesENABLE_PRIVATE_KEY_IMPORT=1/ENABLE_PRIVATE_KEY_EXPORT=1; key hardening is a later step. - Representative environments exist in the local checkout:
Heltec_v3_companion_radio_usb,Heltec_v3_companion_radio_ble,RAK_4631_companion_radio_usb, andRAK_4631_companion_radio_ble. - PlatformIO is not installed locally right now, so Step 1 verification must be limited to git/submodule/script behavior and shell syntax.
Files to Change
.gitmodules— created bygit submodule add.vendor/MeshCore— submodule pointer to upstream MeshCore.scripts/meshcore-env.sh— shared wrapper environment variables and helper functions.scripts/apply-patches.sh— verify submodule state and apply sorted patch queue.scripts/export-patches.sh— regenerate patch queue from a named submodule branch/range.patches/meshcore/.gitkeep— keep empty patch queue directory tracked.colorado/README.md— short notes for Colorado overlay intent.README.md— wrapper workflow instructions for future contributors.
Ordered Implementation Checklist
- Add
vendor/MeshCoreas a git submodule fromhttps://github.com/meshcore-dev/MeshCore.gitand leave it pinned at the resolved commit. - Create
scripts/,patches/meshcore/, andcolorado/directories. - Implement
scripts/meshcore-env.shwith repo-root detection,MESHCORE_DIR,PATCH_DIR, representative env list, andmeshcore_commit()helper. - Implement
scripts/apply-patches.shwith strict shell settings, submodule existence check, dirty submodule check, empty-patch success path, sorted patch application, and clear status output. - Implement
scripts/export-patches.shwith strict shell settings, dirty submodule guidance, configurable base ref defaulting toorigin/main, deterministic patch regeneration, and refusal to export when there are no commits beyond the base. - Add minimal README/development notes describing submodule init, patch apply, patch export, and representative env names.
- Run shell syntax checks and
scripts/apply-patches.shwith the empty patch queue. - Stage only Step 1 files for review.
Interfaces and Data Contracts
scripts/meshcore-env.shcan be sourced by other scripts and must not execute builds itself.scripts/apply-patches.shexits 0 with an empty patch queue and exits non-zero if the submodule is missing, dirty, or patch application fails.scripts/export-patches.sh [base-ref]regeneratespatches/meshcore/*.patchfrom commits afterbase-ref; it does not export uncommitted submodule edits.- Representative env names are exposed as the shell array
REPRESENTATIVE_ENVS.
Verification Plan
- Automated:
git submodule statusbash -n scripts/meshcore-env.sh scripts/apply-patches.sh scripts/export-patches.shbash scripts/apply-patches.shgit status --short
- Manual:
- Confirm
vendor/MeshCorepoints to a real upstream commit. - Confirm an empty patch queue leaves the submodule unchanged.
- Confirm
- Regression:
- No firmware source files should be modified in Step 1.
.forge/artifacts are not staged as product source except required Forge documents remain available for review.
Stop Conditions
- Stop and ask if
git submodule addfails due to network/auth issues. - Stop and ask if
vendor/MeshCorealready exists with unexpected contents. - Stop and ask before deleting or overwriting any existing non-Forge files.
- Stop if the submodule checkout has unexpected dirty changes immediately after adding it.