Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a5aa06a
docs: add HA Controller design spec and implementation plans
KevinPy Nov 16, 2026
ac14103
chore: add repository conventions, docs skeleton and CI
KevinPy Nov 16, 2026
0d67763
feat(protocol): add protocol v1 contract, shared fixtures and guidance
KevinPy Nov 16, 2026
ab8b255
docs: keep the repository root free of tooling files
KevinPy Nov 16, 2026
de75766
docs: give each folder its own Python environment
KevinPy Nov 16, 2026
a8b3367
refactor: move tooling out of the repository root
KevinPy Nov 16, 2026
9735236
feat(integration): add integration skeleton and config flow
KevinPy Nov 16, 2026
a7013a2
feat(integration): validate layouts against protocol rules
KevinPy Nov 16, 2026
2f83d94
test(protocol): pin length counting to Unicode code points
KevinPy Nov 16, 2026
be7d0c5
test(integration): make layout fixture checks robust
KevinPy Nov 16, 2026
ef0bcc9
feat(integration): compile layouts into device payloads
KevinPy Nov 16, 2026
7b2b1cc
feat(integration): build screen state updates
KevinPy Nov 16, 2026
207c22d
fix(integration): reuse MAX_TEXT_LEN and cover °F and suggested preci…
KevinPy Nov 16, 2026
6bb7a48
feat(integration): sync layouts and states with the screen
KevinPy Nov 16, 2026
9e13b23
docs(protocol): resync states on the first hello after a restart
KevinPy Nov 16, 2026
e6ed360
fix(integration): resync states after restart and harden device calls
KevinPy Nov 16, 2026
d60b00a
feat(integration): map screen controls to service calls
KevinPy Nov 16, 2026
4fb6ee5
feat(integration): add websocket API for the panel
KevinPy Nov 16, 2026
2363c4e
feat(integration): register the sidebar panel
KevinPy Nov 16, 2026
94e9796
feat(panel): add panel tooling, grid model and validation
KevinPy Nov 16, 2026
f619031
feat(panel): add pure layout edit operations
KevinPy Nov 16, 2026
03f60e0
feat(panel): render the block map
KevinPy Nov 16, 2026
0fa933d
fix(panel): guard element definition and keep grid states visible
KevinPy Nov 16, 2026
239428d
feat(panel): add block and item editors
KevinPy Nov 16, 2026
b58f900
refactor(panel): move editor strings into messages.ts
KevinPy Nov 16, 2026
b0a6b8a
feat(panel): add panel root with save, status and dev harness
KevinPy Nov 17, 2026
58cdd1c
fix(panel): keep screen state consistent across saves, switches and f…
KevinPy Nov 17, 2026
874279f
docs(plan): build C++ host tests under esphome/tests/build
KevinPy Nov 17, 2026
ee9a323
feat(firmware): parse layout payloads on the screen
KevinPy Nov 17, 2026
8fea54c
feat(firmware): parse state updates and add knob helpers
KevinPy Nov 17, 2026
97e93cd
feat(firmware): model edge swipes
KevinPy Nov 17, 2026
9292fef
feat(firmware): bring up the Waveshare AMOLED 1.75 board
KevinPy Nov 17, 2026
638610b
feat(firmware): receive layouts and talk to Home Assistant
KevinPy Nov 17, 2026
ece2b16
feat(firmware): navigate between blocks with edge swipes
KevinPy Nov 17, 2026
a96361a
feat(firmware): render light, climate and custom blocks
KevinPy Nov 17, 2026
87b0afd
fix(firmware): give immediate tap feedback and keep custom controls i…
KevinPy Nov 17, 2026
bc7ed34
feat(firmware): sleep after the configured delay and wake on touch
KevinPy Nov 17, 2026
34948fd
feat(firmware): install firmware over the air on request
KevinPy Nov 17, 2026
8c34240
build: add single-version check and bump script
KevinPy Nov 17, 2026
e93d65a
fix(build): keep manifest formatting and document venv commands
KevinPy Nov 17, 2026
d1e5b33
feat(integration): keep screen firmware on the integration version
KevinPy Nov 17, 2026
9ca60c7
test(integration): pin the auto-update window and stop pending instal…
KevinPy Nov 17, 2026
7ad89ed
build: add release packaging scripts and web installer page
KevinPy Nov 17, 2026
fcd63a2
ci: release integration, firmware and web installer from tags
KevinPy Nov 17, 2026
f529cf2
docs(release): allow tag deployments to the github-pages environment
KevinPy Nov 17, 2026
ed3f5c0
test(integration): read the release version from the manifest
KevinPy Nov 17, 2026
3801216
ci(release): deploy Pages before publishing the release
KevinPy Nov 17, 2026
7424535
style(tests): apply ruff format
KevinPy Nov 17, 2026
2d30508
fix(ci): add Apache-2.0 license and empty services.yaml for HACS and …
KevinPy Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# HA Controller — guidance for Claude Code

HA Controller turns the Waveshare ESP32-S3-Touch-AMOLED-1.75 round touch screen into a Home Assistant remote.
It is a custom integration with a sidebar panel, an ESPHome firmware and a GitHub Pages web installer.

## Rules

- English only: code, comments, docs and commit messages.
- One version for the whole repository. Change it only with `.github/scripts/.venv/bin/python .github/scripts/versioning.py bump X.Y.Z`; `.github/scripts/.venv/bin/python .github/scripts/versioning.py check [--tag vX.Y.Z]` verifies it (CI job `versions`).
- The protocol is defined in `docs/protocol/README.md` and pinned by `docs/protocol/fixtures/`.
- The repository root holds no files except README.md, LICENSE, hacs.json and .gitignore. Put every new file in the folder that owns it (see the repository map).
- TDD: write the failing test first, then the code.
- Never commit `esphome/secrets.yaml`.
- Specs and plans live in `docs/superpowers/`.

## Repository map

| Path | Content |
|---|---|
| `docs/` | User and developer documentation. `docs/protocol/` holds the protocol doc (`README.md`) and its shared fixtures (`fixtures/`), the cross-language contract. `docs/superpowers/` holds this spec and the plans. |
| `custom_components/` | Everything for the Home Assistant integration. HACS allows a single directory here, so development files live inside it, or next to it as plain files. |
| `custom_components/ha_controller/` | The integration (Python). Also holds `emoji.json` (canonical emoji list, also read by the firmware build and the panel), `brand/`, `tests/` (pytest), and `frontend/` (panel source in TypeScript, Lit and Vite, built to `frontend/dist/`, which is git-ignored). |
| `custom_components/pyproject.toml`, `requirements_test.txt`, `__init__.py` | Python test and lint configuration for the integration. The empty `__init__.py` keeps test imports under `custom_components.ha_controller`. |
| `esphome/` | Everything for the firmware: device config, packages, simulator config, external components, C++ host tests, web installer page, `requirements.txt` (ESPHome version) and its venv (`esphome/.venv`, git-ignored) |
| `.github/workflows/` | CI, firmware CI, release |
| `.github/scripts/` | Release and repository-check tooling (versioning, packaging, GitHub Pages site builder, docs and fixture checks), with its own `pyproject.toml`, `requirements.txt` and `tests/` |
| `.claude/` | `CLAUDE.md`, Claude Code skills and agents |
| `3D_models/`, `files/` | Existing enclosure models (unchanged) |

## Commands

```bash
python3.14 -m venv .github/scripts/.venv
.github/scripts/.venv/bin/pip install -r .github/scripts/requirements.txt
.github/scripts/.venv/bin/pytest .github/scripts/tests
.github/scripts/.venv/bin/ruff check .github/scripts
.github/scripts/.venv/bin/python .github/scripts/make_brand_icon.py # regenerate brand icons
.github/scripts/.venv/bin/python .github/scripts/versioning.py check # verify the single repository version
.github/scripts/.venv/bin/python .github/scripts/versioning.py check --tag vX.Y.Z # also verify a release tag
.github/scripts/.venv/bin/python .github/scripts/versioning.py bump X.Y.Z # set the version in every source

# Integration (own venv, run from the repository root)
python3.14 -m venv custom_components/.venv
custom_components/.venv/bin/pip install -r custom_components/requirements_test.txt
custom_components/.venv/bin/pytest custom_components/ha_controller/tests
custom_components/.venv/bin/ruff check custom_components

# Firmware (own venv, run from the repository root)
python3.13 -m venv esphome/.venv
esphome/.venv/bin/pip install -r esphome/requirements.txt
cmake -S esphome/tests -B esphome/tests/build && cmake --build esphome/tests/build
ctest --test-dir esphome/tests/build --output-on-failure

# Firmware (needs SDL2 for the simulator: brew install sdl2 / apt install libsdl2-dev)
esphome/.venv/bin/esphome compile esphome/ha-controller.yaml
esphome/.venv/bin/esphome compile esphome/simulator.yaml
esphome/.venv/bin/esphome run esphome/simulator.yaml # desktop simulator, API on port 6053

# Panel (Node 24, run from the repository root)
npm --prefix custom_components/ha_controller/frontend ci
npm --prefix custom_components/ha_controller/frontend test
npm --prefix custom_components/ha_controller/frontend run typecheck
npm --prefix custom_components/ha_controller/frontend run build
npm --prefix custom_components/ha_controller/frontend run dev # panel against a mock hass
```

## Skills and agents

- Skill `protocol-change` (`.claude/skills/protocol-change/`): checklist for any change that crosses the Home Assistant ↔ screen boundary.
- Skill `firmware-dev` (`.claude/skills/firmware-dev/`): commands, simulator loop and rules for the ESPHome firmware and LVGL code.
- Skill `add-widget` (`.claude/skills/add-widget/`): end-to-end checklist for a new block widget or custom item kind.
- Skill `release` (`.claude/skills/release/`): cutting a release and changing the release pipeline (versions, workflow, Pages installer, HACS packaging, OTA URLs).
- Agent `firmware-reviewer` (`.claude/agents/firmware-reviewer.md`): reviews changes under `esphome/` for ESPHome/LVGL correctness, memory and hardware safety.
- Agent `protocol-guardian` (`.claude/agents/protocol-guardian.md`): reviews a diff for protocol consistency across docs, fixtures, Python, TypeScript and C++.
- Agent `ha-integration-reviewer` (`.claude/agents/ha-integration-reviewer.md`): reviews integration changes against Home Assistant development rules.
17 changes: 17 additions & 0 deletions .claude/agents/firmware-reviewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: firmware-reviewer
description: Reviews changes under esphome/ for ESPHome/LVGL correctness, memory and hardware safety. Use before merging firmware changes.
tools: Read, Grep, Glob, Bash
---

You review firmware changes. Read the diff (`git diff main...HEAD -- esphome`), then check:

- No blocking calls in `loop`, except the OTA action.
- LVGL objects are deleted with their views, with animations cancelled first.
- No ESPHome callbacks are registered per view.
- JSON is parsed defensively (missing keys, wrong types, oversized input).
- Pins and I²C addresses match `docs/hardware.md`.
- New pure logic has host tests in `esphome/tests/`.
- Both configs compile: `esphome/.venv/bin/esphome compile esphome/ha-controller.yaml` and `esphome/simulator.yaml`.

Report each finding as `file:line — issue — fix`. Say so when there is none.
19 changes: 19 additions & 0 deletions .claude/agents/ha-integration-reviewer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: ha-integration-reviewer
description: Reviews changes under custom_components/ha_controller and custom_components/ha_controller/tests against Home Assistant development rules. Use before merging integration changes.
tools: Read, Grep, Glob, Bash
---

You review changes to the Home Assistant integration. Read the diff (`git diff main...HEAD -- custom_components`), then check:

- Async only: no blocking I/O (file access, `requests`, `time.sleep`) in the event loop.
- State lives in `entry.runtime_data`; no new `hass.data` globals beyond the panel flags.
- Every listener and timer is removed on unload.
- Event handlers filter by `device_id`.
- Service call errors are caught.
- Constants come from `const.py`, not literals.
- User-facing strings are English and live in `strings.json` and `translations/en.json`.
- Every branch has a test.
- A change that crosses the Home Assistant ↔ screen boundary goes through the `protocol-change` skill.

Report findings as `file:line — issue — fix`, one per line. Say so when there are none.
15 changes: 15 additions & 0 deletions .claude/agents/protocol-guardian.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: protocol-guardian
description: Reviews a diff for consistency of the HA ↔ screen protocol across docs/protocol/README.md, docs/protocol/fixtures, the integration (Python), the panel model (TypeScript) and the firmware parsers (C++). Use after any protocol-related change and before merging.
tools: Read, Grep, Glob, Bash
---

You review protocol changes. Read the diff (`git diff main...HEAD`), then check:

- Field names, error codes, limits and constants are identical in `docs/protocol/README.md`, the Python integration, the TypeScript model and the C++ parsers.
- Fixtures under `docs/protocol/fixtures/` are updated, and each invalid layout fixture still breaks exactly one rule.
- Golden `rev` values are recomputed (see `docs/protocol/README.md`).
- `PROTOCOL_VERSION` is bumped in `const.py` and `ha_controller.h` on breaking changes.
- `docs/protocol/README.md` describes the new behaviour.

Output a list of `file:line — inconsistency — fix`, or "Protocol consistent".
23 changes: 23 additions & 0 deletions .claude/skills/add-widget/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: add-widget
description: Use when adding a new block widget or custom item kind (e.g. switch, cover, fan, media volume) end-to-end.
---

# Add a widget

A widget crosses the Home Assistant ↔ screen boundary, so start with the `protocol-change` skill and keep its checklist open. Then:

1. Protocol doc and fixtures: `docs/protocol/README.md` and `docs/protocol/fixtures/` (recompute golden `rev` values).
2. `ENTITY_BLOCK_DOMAINS` / `ITEM_KINDS` in `custom_components/ha_controller/const.py`, and the panel model in `custom_components/ha_controller/frontend/`.
3. The state builder and the control mapping in the integration.
4. The panel editor options and the preview.
5. The C++ parser enum and the view under `esphome/components/ha_controller/` (with host tests; see the `firmware-dev` skill).
6. `docs/configuration.md`.
7. Run all suites and both firmware compiles:
- `custom_components/.venv/bin/pytest custom_components/ha_controller/tests`
- `.github/scripts/.venv/bin/pytest .github/scripts/tests`
- `npm --prefix custom_components/ha_controller/frontend test`
- `ctest --test-dir esphome/tests/build --output-on-failure`
- `esphome compile` for `esphome/ha-controller.yaml` and `esphome/simulator.yaml`

Finish with the `protocol-guardian` and `firmware-reviewer` agents.
47 changes: 47 additions & 0 deletions .claude/skills/firmware-dev/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: firmware-dev
description: Use when building, flashing, simulating or changing the ESPHome firmware (esphome/), including LVGL UI code.
---

# Firmware development

The firmware is ESPHome with LVGL in `esphome/`. Hardware facts are in `docs/hardware.md`; the manual hardware checklist is in `docs/development.md`.

## Commands

Run from the repository root:

```bash
# Host tests (pure C++ logic)
cmake -S esphome/tests -B esphome/tests/build && cmake --build esphome/tests/build
ctest --test-dir esphome/tests/build --output-on-failure

# Compile both configs (long; run in the background)
esphome/.venv/bin/esphome compile esphome/ha-controller.yaml
esphome/.venv/bin/esphome compile esphome/simulator.yaml

# Flash over USB-C, or run the SDL simulator
esphome/.venv/bin/esphome run esphome/ha-controller.yaml
esphome/.venv/bin/esphome run esphome/simulator.yaml
```

The venv is Python 3.13 with `esphome/requirements.txt`. Never commit `esphome/secrets.yaml`.

## Simulator loop

1. Change the code and run the host tests.
2. `esphome run esphome/simulator.yaml` (an SDL window; mouse drags act as finger swipes).
3. Connect it to a development Home Assistant (see `docs/development.md`) and edit the layout in the panel.
4. Before finishing, compile both configs. `install_firmware` exists only in `ha-controller.yaml` (the simulator has no HTTP OTA).

## Rules

- Pure logic goes in host-tested headers or modules under `esphome/components/ha_controller/` with a test in `esphome/tests/`.
- LVGL is called on the main loop only.
- Views never register ESPHome callbacks; the component registers them once.
- Call `lv_refr_now` before blocking work (such as OTA), so the message is on the panel.
- LVGL is paused while the screen sleeps. Call `wake()` before showing anything the user must see (`show_message` already does).
- Fonts are declared in `esphome/packages/ui.yaml` and mapped in the `ha_controller:` block.
- A new LVGL widget type needs a hidden instance on `boot_page`, so ESPHome compiles it in.
- Controls stay inside radius 185 of the 466 px circle.
- Keep the `cst9217` external component pinned to its commit SHA.
13 changes: 13 additions & 0 deletions .claude/skills/protocol-change/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: protocol-change
description: "Use when changing anything that crosses the Home Assistant ↔ screen boundary: layout fields, validation rules, payload keys, state update fields, events, actions, emoji list or limits."
---

# Changing the HA ↔ screen protocol

1. Classify the change. The C++ parser rejects unknown `widget`/`kind`/`font` values, so any new value is breaking: bump `PROTOCOL_VERSION` in `custom_components/ha_controller/const.py` and in the firmware's `ha_controller.h`.
2. Edit `docs/protocol/README.md` first.
3. Update `docs/protocol/fixtures/`, keeping one rule per invalid fixture and regenerating golden `rev` values with the snippet in `docs/protocol/README.md`.
4. Update the Python code in `custom_components/ha_controller/` (`layout.py`, `compiler.py`, `states.py`, `controls.py`) with its tests in `custom_components/ha_controller/tests`, the TypeScript model (`custom_components/ha_controller/frontend/src/model/`), the C++ parsers (`esphome/components/ha_controller/layout.*`, `states.*`) and the renderers (`widgets.*`, panel editor).
5. Run `pytest custom_components/ha_controller/tests`, `pytest .github/scripts/tests`, `npm --prefix custom_components/ha_controller/frontend test`, the host C++ tests and `esphome compile`.
6. Ask the `protocol-guardian` agent to review.
32 changes: 32 additions & 0 deletions .claude/skills/release/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: release
description: "Use when cutting a release or changing the release pipeline: versions, release workflow, GitHub Pages installer, HACS packaging, firmware OTA URLs."
---

# Releasing HA Controller

- Never edit versions by hand. Use `.github/scripts/.venv/bin/python .github/scripts/versioning.py bump X.Y.Z`.

## Steps (from `docs/releasing.md`)

1. `.github/scripts/.venv/bin/python .github/scripts/versioning.py bump X.Y.Z`
2. Commit `chore: release X.Y.Z`.
3. `git tag vX.Y.Z && git push origin main vX.Y.Z`
4. Watch the "Release" workflow.
5. Check that the Pages page shows X.Y.Z and that HACS offers X.Y.Z.

Dry runs use `workflow_dispatch` (only the `build` job runs).

## What each job produces

- `build`: `dist/ha_controller.zip` (integration with the built panel, for HACS) and `dist/ha-controller-X.Y.Z.*` (factory image, OTA image and OTA md5), uploaded as the `dist` artifact.
- `pages`: the installer site, built from `esphome/web`, the firmware of this version (from `dist`) and the firmware of every earlier release (releases without firmware assets are skipped). Tag runs only, after `build`.
- `release`: the GitHub release with every file of `dist`. Tag runs only, after `pages`.

The order is `build` → `pages` → `release`. Pages is deployed before the release so the OTA URLs exist when HACS offers the new version.

## Rules

- The `github-pages` environment must allow tags `v*` (see the one-time setup in `docs/releasing.md`), or the `pages` job fails on tag runs.
- OTA URLs must stay stable (`firmware/<v>/ha-controller.ota.bin`), because integrations already installed depend on them.
- After any script change, run `.github/scripts/.venv/bin/pytest .github/scripts/tests`.
72 changes: 72 additions & 0 deletions .github/scripts/build_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""Build the GitHub Pages site: web installer, ESP Web Tools manifest and every OTA image."""

import argparse
import json
import shutil
from pathlib import Path

RELEASE_URL = "https://github.com/pyxel-dev/HA-controller/releases/tag/v{version}"


def build_site(web_dir: Path, releases_dir: Path, latest: str, out_dir: Path) -> None:
"""Write the site to out_dir from web_dir and releases_dir/<version>/ asset folders."""
latest_dir = releases_dir / latest
latest_factory = latest_dir / f"ha-controller-{latest}.factory.bin"
latest_ota = latest_dir / f"ha-controller-{latest}.ota.bin"
for required in (latest_factory, latest_ota):
if not required.is_file():
raise FileNotFoundError(f"Missing release asset: {required}")

firmware = out_dir / "firmware"
firmware.mkdir(parents=True, exist_ok=True)

page = (web_dir / "index.html").read_text(encoding="utf-8")
(out_dir / "index.html").write_text(page.replace("{{VERSION}}", latest), encoding="utf-8")
(out_dir / ".nojekyll").write_text("", encoding="utf-8")

for folder in sorted(p for p in releases_dir.iterdir() if p.is_dir()):
version = folder.name
ota = folder / f"ha-controller-{version}.ota.bin"
md5 = folder / f"ha-controller-{version}.ota.bin.md5"
if not (ota.is_file() and md5.is_file()):
continue
target = firmware / version
target.mkdir(parents=True, exist_ok=True)
shutil.copyfile(ota, target / "ha-controller.ota.bin")
shutil.copyfile(md5, target / "ha-controller.ota.bin.md5")

shutil.copyfile(latest_factory, firmware / "ha-controller.factory.bin")
md5_latest = (latest_dir / f"ha-controller-{latest}.ota.bin.md5").read_text().strip()
manifest = {
"name": "HA Controller",
"version": latest,
"home_assistant_domain": "esphome",
"new_install_prompt_erase": True,
"builds": [
{
"chipFamily": "ESP32-S3",
"parts": [{"path": "ha-controller.factory.bin", "offset": 0}],
"ota": {
"path": f"{latest}/ha-controller.ota.bin",
"md5": md5_latest,
"release_url": RELEASE_URL.format(version=latest),
},
}
],
}
(firmware / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")


def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--web", type=Path, required=True)
parser.add_argument("--releases", type=Path, required=True)
parser.add_argument("--latest", required=True)
parser.add_argument("--out", type=Path, required=True)
args = parser.parse_args(argv)
build_site(args.web, args.releases, args.latest, args.out)
return 0


if __name__ == "__main__":
raise SystemExit(main())
43 changes: 43 additions & 0 deletions .github/scripts/collect_firmware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Collect the ESPHome factory and OTA images into versioned release assets."""

import argparse
import hashlib
import shutil
from pathlib import Path


def _only(build_dir: Path, pattern: str) -> Path:
matches = sorted(build_dir.rglob(pattern))
if len(matches) != 1:
raise ValueError(f"Expected exactly one {pattern} under {build_dir}, found {len(matches)}")
return matches[0]


def collect(build_dir: Path, version: str, out_dir: Path) -> list[Path]:
"""Copy the images to out_dir as ha-controller-<version>.* and write the OTA md5."""
factory = _only(build_dir, "*.factory.bin")
ota = _only(build_dir, "*.ota.bin")
out_dir.mkdir(parents=True, exist_ok=True)

factory_out = out_dir / f"ha-controller-{version}.factory.bin"
ota_out = out_dir / f"ha-controller-{version}.ota.bin"
md5_out = out_dir / f"ha-controller-{version}.ota.bin.md5"
shutil.copyfile(factory, factory_out)
shutil.copyfile(ota, ota_out)
md5_out.write_text(hashlib.md5(ota.read_bytes()).hexdigest(), encoding="ascii")
return [factory_out, ota_out, md5_out]


def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--build-dir", type=Path, required=True)
parser.add_argument("--version", required=True)
parser.add_argument("--out", type=Path, required=True)
args = parser.parse_args(argv)
for path in collect(args.build_dir, args.version, args.out):
print(path)
return 0


if __name__ == "__main__":
raise SystemExit(main())
Loading
Loading