Skip to content

Device types: TypeScript type file tools, device type file workflow, and the Device Types app - #21

Merged
robdobsn merged 2 commits into
mainfrom
feature/device-types-web
Oct 24, 2026
Merged

robdobsn merged 2 commits into
mainfrom
feature/device-types-web

Conversation

@robdobsn

Copy link
Copy Markdown
Owner

Device type management from raftjs and a web UI, as in devdocs/device-type-management-web-plan.md (phases 2–6). Pairs with robdobsn/RaftCore#18: the firmware's new status fields, _sources, the shared test vectors, and the Pages workflow that publishes the catalogue and this app.

Library (new modules, exported from main.ts)

TypeScript copies of RaftCore's Python device type tools. They give the same output and are checked against RaftCore's shared vectors (copied into testdata/).

  • RaftDeviceTypeJson: JSON as Python reads and writes it.
    • JSON.parse would reorder integer-like keys (LSM6DS3's rate map), and JavaScript writes floats differently from Python.
    • With this module a type file built here is byte for byte the Python's, so the device's CRC agrees.
  • RaftDeviceTypeGrammar: the command grammar.
  • RaftDeviceTypeFile: buildTypeFile and typeFileCrc.
  • RaftDeviceTypeSources: DeviceTypeSources.json merging, selection rules and provenance.
  • RaftDeviceTypeCatalogue: readers for RaftCore's catalogue on GitHub Pages, git sources on GitHub (via its API at the resolved commit), and local record files; plus the lock file writer.
  • RaftDeviceTypeFileManager: status, type table, device records, pull, and push (upload, check, confirm, apply, wait for the restart, verify).
  • RaftDeviceManager types: raftCore, recordFormat, decode and protected, all optional.

App (apps/devtypes)

React and Parcel. Tabs: Catalogue, Device, Sources, Type file, Export.

  • Connects by Bluetooth or serial. WiFi is offered only on http pages and localhost, because an https page can't open ws:// to a device.

Testing

  • raftjs: 370 tests pass. The every-record vector (63.7 KB) is built byte for byte. tsc (web and React Native) and eslint are clean.
    • One test is skipped when the RaftCore checkout next to raftjs lacks the vectors, i.e. before RaftCore#18 is merged. Against that branch it runs and passes.
  • App, in headless Chrome against a local copy of the site:
    • catalogue, search, selection and export work; phone width works;
    • importing a selection (RaftCore records, a live GitHub git source, local records, an exclude and two policies) gave the same type file (CRC 9796) and lock as AssembleDeviceTypes.py --typefile;
    • building the exported zip with the Python tool gave the same file again.
  • Not yet checked on hardware: connecting, the Device tab, push and pull.

Not in this PR

  • The dashboard's TypeFilePanel still has its own steps. Moving it onto DeviceTypeFileManager is left for later.

🤖 Generated with Claude Code

robdobsn and others added 2 commits October 24, 2026 10:35
…, catalogue and GitHub sources, device type file workflow

TypeScript copies of RaftCore's Python device type tools, giving the same output (checked against RaftCore's
shared vectors, copied into testdata/):
- RaftDeviceTypeJson: JSON as Python reads and writes it (key order kept, numbers as Python's repr,
  ensure_ascii), so a type file built here is byte for byte the Python's and the device's CRC agrees
- RaftDeviceTypeGrammar: the record command grammar (grammar_vectors.json)
- RaftDeviceTypeFile: buildTypeFile (new / override / unchanged / policy, decoders, init code, _sources)
- RaftDeviceTypeSources: DeviceTypeSources.json merge and selection rules, provenance (selection_vectors.json)
- RaftDeviceTypeCatalogue: RaftCore's catalogue on GitHub Pages, git sources on GitHub, record files, the lock
- RaftDeviceTypeFileManager: status, type table, device records, pull, and push (upload, check, confirm,
  apply, wait for the restart, verify)
- DevManTypeFileStatus: raftCore, recordFormat, decode; DevManTypes: protected

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment from raftjs and a web UI

A web app for Raft device type records, published on RaftCore's GitHub Pages site (devtypes/app/): browse
and search the catalogue; connect to a device by Bluetooth or USB serial (WiFi on http pages and localhost)
to see its devices, unidentified addresses and device types; build a type file from RaftCore's records,
GitHub sources and local files (or a project's imported DeviceTypeSources.json and lock); push it to the
device and read it back; download the setup as a project (DeviceTypeSources.json, lock, records, devlib.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robdobsn
robdobsn merged commit 14dbe25 into main Oct 24, 2026
1 check passed
@robdobsn
robdobsn deleted the feature/device-types-web branch October 25, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant