# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## What this is A collection of Matter commissioning QR decoders (the `MT:` URI format used by Matter/CHIP devices). Users either paste an `MT:` URI or scan a QR code; the result shows the decoded payload (version, vendor/product IDs, commissioning flow, discovery capabilities, discriminator, passcode). Three artifacts: - `matter-qr-decoder.html` — the single-file browser app (Vue 3 + Bootstrap). - `matter-decode.sh` — a pure-bash CLI port of the same decode logic (no camera scanning; takes a URI as an argument or on stdin). - `manufacturers.tsv` — `vendor ID → name` table (~900 rows), shared by both tools and optional (a missing file only drops the vendor-name lookup). - `gen-manufacturers.py` — Python 3 stdlib script that regenerates `manufacturers.tsv`. Default source is the upstream `manufacturers.xml` **fetched over the network** (via `curl`; a GitHub `blob/` URL is auto-rewritten to its `raw.githubusercontent.com` form). A positional arg overrides with another URL or a local XML file; passing `matter-qr-decoder.html` uses the embedded `` block as an offline fallback. Reproduces the committed TSV byte-for-byte. - `products.tsv` — 3-column `vendor ID → product ID → name` table, consumed by `matter-decode.sh`'s `get_product_name()`: when the decoded vendor ID (or an equivalent, see `vendor-equivalents.tsv`) is present, the product ID is resolved to a name and printed on the Product ID line. LIFX's rows are keyed under `4870`. Optional — a missing file only drops the product-name lookup. - `vendor-equivalents.tsv` — 2-column `alias vendor ID → canonical vendor ID` table, hand-edited, recording companies that are the same after a merger/acquisition (e.g. Feit `5155` → LIFX `4870`). Used by `matter-decode.sh` so a product resolves under either ID and the vendor name is annotated `(a.k.a. ...)`. `#`-comment lines are ignored. Optional. - `gen-lifx-products.py` — Python 3 stdlib script that regenerates LIFX's rows (vendor `4870`) in `products.tsv`. Default source is LIFX's upstream `products.json` **fetched over the network** (via `curl`, falling back to `urllib`); a positional arg overrides with another URL or a local `.json` file. It **merges** LIFX's rows into `products.tsv` (dropping LIFX's old rows, preserving every other vendor's), so re-running it is safe alongside other vendors' generators. Caveat: `products.json` carries only a `pid` per product (no separate Matter/CHIP product-id field), so the lookup assumes LIFX's Matter product ID equals their `pid`. - `README.md` — user-facing docs; this file documents the internals. ## Commands There is **no build, test, lint, or package step** — this is not a git repo and has no `package.json`. The entire app is one HTML file that runs in the browser: - Run/develop: open `matter-qr-decoder.html` in a modern browser and edit it directly. - Camera scanning (`getUserMedia`) requires a **secure context** — serve over HTTPS or `localhost` (e.g. `python3 -m http.server` then open `http://localhost:8000`). - The "Scan QR" feature uses the `BarcodeDetector` API, which is **Chromium-only** (Chrome/Edge). Firefox/Safari fall back to a "not supported" message; paste-input works everywhere. - The page loads Vue 3, Bootstrap 5.3, and Bootstrap Icons from CDNs, so it needs network access. ## Architecture Everything lives in `matter-qr-decoder.html` (~1500 lines). Two regions matter: 1. **App logic** (the `