Repository navigation
Add browser Python editor, badge simulator, and USB app editing - #32
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Project transitions can destroy drafts, simulation can mask invalid hardware paths, and the bundled runtime lacks a required MicroPython notice.
4 open findings
What changed in this PR
Adds a browser-based Python editor, MicroPython badge simulator, bundled app examples, and verified USB project uploads.
Changes:
- Adds multi-file editing, simulation, drafts, and resizable panes.
- Adds transactional USB uploads with verification and rollback.
- Bundles simulator runtime, compatibility modules, examples, tests, documentation, and navigation.
| File | Description |
|---|---|
src/pages/editor.astro |
Editor and simulator interface |
src/lib/badge-editor.ts |
Editor workflow and runtime orchestration |
src/lib/badge-editor-project.ts |
Project loading, storage, and simulation staging |
src/lib/badge-editor-upload.ts |
Verified USB uploads and rollback |
src/lib/badge-editor-split.ts |
Resizable workspace behavior |
src/components/navigation.tsx |
Adds Editor navigation |
src/components/Footer.astro |
Adds Editor footer link |
scripts/sync-editor-apps.mjs |
Synchronizes upstream examples |
public/editor-apps/** |
Bundled app projects, assets, catalog, and license |
public/simulator/** |
MicroPython runtime and badge compatibility layer |
tests/badge-editor-*.test.mjs |
Project and upload tests |
package.json |
Editor dependencies and scripts |
.github/workflows/ci.yml |
Runs editor tests in CI |
docs/editor.md |
Documents behavior, limitations, and verification |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Added error handling for incomplete app catalog tree. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
avni
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Adds
/editorso users can write Python, test complete app projects in a browser simulator, and open installed badge apps over USB for editing and verified re-upload.The page follows the Badger theme and GitHub branding, runs previews automatically after edits, includes all 23 installable app examples with their modules and assets, and provides file navigation, Open/Download, Undo/Redo, and independently resizable pane widths and workspace height. Badge controls explain the connect, choose an app, edit, and upload workflow. Mobile navigation uses two rows with readable labels and targets at least 44px wide and tall.
Replacing an edited project requires confirmation, including projects with added empty files or a changed name. The guard survives draft restoration. Simulation stages files only at the current badge app's execution directory,
/system/apps/<name>. A renamed app that still references its original folder must have its source paths updated before running or uploading.The locally hosted MicroPython WASM runtime retains the upstream MIT notices and third-party runtime license documents.
public/simulator/THIRD_PARTY.mdrecords the dependency audit and artifact hashes. Updates to existing badge apps and examples upload only edited or added files, including after draft restoration. Unchanged files are not read or rewritten, and upload completion updates the cached app list without a full disk rescan. First installs copy every required file. The button shows the eligible file count, with filename progress during writes. Uploads preserve unrelated files, detect external changes to edited files, verify bytes after writing, and roll back failed writes. Only verified files become part of the persisted badge baseline, and UTF-8 byte-order marks are preserved. Simulator networking is unavailable and sensor values are synthetic; physical badge behavior still needs hardware testing.Validation:
npm run buildpasses.npm run test:editorpasses all 29 project and upload tests.npm run test:app-descriptionspasses all 11 existing tests.__init__.py, performs only its preflight and verification reads, and avoids an app-list rescan. This covers both opening a badge app and updating from an example.npx tsc --noEmitreports the three existing implicit-any errors inastro.config.mjs; no editor errors were reported.