|
| 1 | +# AGENTS.md — PyBLE contributor guidelines |
| 2 | + |
| 3 | +These rules apply to humans and automated contributors working in this |
| 4 | +repository. |
| 5 | + |
| 6 | +## Project identity |
| 7 | + |
| 8 | +**PyBLE** (“Python over BLE”) is a free, MIT-licensed, tablet-first |
| 9 | +MicroPython IDE. The Flutter app communicates over Bluetooth Low Energy with a |
| 10 | +compatible board running MicroPython and the portable PyBLE agent. |
| 11 | + |
| 12 | +- App: `app/` |
| 13 | +- Agent firmware: `firmware/` |
| 14 | +- Open wire protocol: PBLE/1, specified in |
| 15 | + `docs/specifications/protocol.md` |
| 16 | +- Initial validated ports: `esp32`, `esp32-s3`, and `esp32-c3` |
| 17 | + |
| 18 | +Support is capability-defined, not tied to one chip family. A new port needs a |
| 19 | +maintained PBLE/1 agent, BLE GATT peripheral support, sufficient resources, and |
| 20 | +the project’s conformance and hardware-validation gates. |
| 21 | + |
| 22 | +## Open-source and clean-room boundary |
| 23 | + |
| 24 | +1. All PyBLE-authored source is MIT licensed. |
| 25 | +2. Author changes fresh. Do not paste proprietary or unknown-licensed source, |
| 26 | + protocols, UUIDs, board profiles, examples, or product-specific pedagogy. |
| 27 | +3. Keep PyBLE identifiers independent: `PBLE/1`, `pble_*`, `pyble_*`, the |
| 28 | + PyBLE UUID base, and the `PyBLE-` advertising prefix. |
| 29 | +4. Run `tools/ci/no_leak.sh` before committing. The gate is the canonical, |
| 30 | + tested list of prohibited identifiers in shippable source. |
| 31 | +5. Third-party dependencies remain under their own licenses and must be |
| 32 | + recorded in the relevant dependency and notice files. |
| 33 | + |
| 34 | +The pinned, gitignored compiler/tool trees at `firmware/.esp-idf`, |
| 35 | +`firmware/.arm-gnu`, and `firmware/.picotool` are third-party build inputs, |
| 36 | +not shippable source. Source gates prune those exact roots while continuing to |
| 37 | +scan similarly named authored directories. |
| 38 | + |
| 39 | +## Spec-driven and test-driven development |
| 40 | + |
| 41 | +1. `docs/specifications/` defines public behavior and architecture. |
| 42 | +2. Change the relevant specification before implementation when a contract |
| 43 | + changes. |
| 44 | +3. Work red → green → refactor: |
| 45 | + - add a failing test in a `[red]` commit; |
| 46 | + - implement the minimum passing change in a `[green]` commit; |
| 47 | + - clean up in a `[refactor]` commit while tests remain green. |
| 48 | +4. No behavior is complete without an automated test. Hardware behavior also |
| 49 | + needs the documented HIL evidence. |
| 50 | +5. Sign off every commit for DCO compliance: `git commit -s`. |
| 51 | + |
| 52 | +Allowed commit prefixes are `[red]`, `[green]`, `[refactor]`, `[docs]`, |
| 53 | +`[build]`, and `[chore]`. |
| 54 | + |
| 55 | +## Repository layout |
| 56 | + |
| 57 | +Keep the repository root limited to governance files and these directories: |
| 58 | + |
| 59 | +```text |
| 60 | +.github/ app/ docs/ firmware/ protocol/ examples/ tests/ tools/ |
| 61 | +``` |
| 62 | + |
| 63 | +Root governance files are: |
| 64 | + |
| 65 | +```text |
| 66 | +README.md LICENSE CONTRIBUTING.md CODE_OF_CONDUCT.md SECURITY.md |
| 67 | +CHANGELOG.md CITATION.cff AGENTS.md CLAUDE.md .gitignore .gitmodules |
| 68 | +``` |
| 69 | + |
| 70 | +Put specifications and decisions under `docs/`, scripts under `tools/` or |
| 71 | +`firmware/scripts/`, and examples under `examples/`. Keep raw or unreviewed |
| 72 | +screenshots, signing material, builds, assistant state, and local notes out of |
| 73 | +Git. A deliberately reviewed, provenance-recorded image used by the public |
| 74 | +website may live below `tools/web/public/`; its raw capture must remain in an |
| 75 | +ignored workspace. |
| 76 | + |
| 77 | +## Naming |
| 78 | + |
| 79 | +- Product and wordmark: **PyBLE** |
| 80 | +- Domain: `pyble.dev` |
| 81 | +- Protocol: **PBLE/1** |
| 82 | +- Native modules: `pyble_agent`, `pyble_ble`, `pyble_runner`, `pyble_fs`, |
| 83 | + and related `pyble_*` / `pble_*` files |
| 84 | +- Flutter packages: `lib/ble/`, `lib/pble/`, `lib/editor/`, `lib/console/`, |
| 85 | + `lib/files/`, `lib/blocks/`, and `lib/localization/` |
| 86 | + |
| 87 | +## Hard boundaries |
| 88 | + |
| 89 | +- Do not edit upstream MicroPython or Blockly in place. Pin upstream as |
| 90 | + submodules; isolate any unavoidable MicroPython patch under |
| 91 | + `firmware/patches/` with a written reason. |
| 92 | +- Do not make USB serial or Wi-Fi the primary workflow. PyBLE is BLE-first. |
| 93 | +- Do not introduce paid or closed features. |
| 94 | +- Do not ship compiled `.mpy` examples; use readable `.py` files. |
| 95 | +- Do not commit credentials, signing assets, firmware binaries, IPA files, or |
| 96 | + generated build directories. |
0 commit comments