Guidance for AI coding agents working in this repository.
Make safe, reviewable changes to hm2mqtt with minimal back-and-forth.
- Main runtime: TypeScript + Node.js
- Home Assistant add-on files:
ha_addon/ - User docs:
README.md - Release notes:
CHANGELOG.md
- Always branch from
developfor feature/fix work. - Always target PRs to
develop(notmain) unless explicitly instructed otherwise. - Keep PRs focused and small; avoid unrelated changes.
Run locally:
npm run lint # oxlint
npm run format:check # oxfmt
npm test -- --runInBand
npm run buildUse npm run lint:fix and npm run format to apply fixes.
Requires Node ^20.19.0 || >=22.12.0 (see engines in package.json).
Node 18 is not supported.
If add-on behavior/config was changed, also validate add-on config consistency:
ha_addon/config.yamloptions and schema are in sync- environment wiring in
ha_addon/run.shis in sync
When adding/changing configuration options (env vars or add-on options), update all relevant places:
- Runtime parsing (
src/index.ts,src/types.ts, constants if needed) - Add-on config (
ha_addon/config.yaml) - Add-on startup mapping (
ha_addon/run.sh) - Tests/fixtures (all
MqttConfigfixtures etc.) - Documentation (
README.md) - Translations (
ha_addon/translations/en.yaml,ha_addon/translations/de.yaml) CHANGELOG.mdunder[Next]
For every new or changed config option, treat the following as mandatory completion criteria:
- Add-on translations (
ha_addon/translations/en.yamlandha_addon/translations/de.yaml) - Changelog entry under
[Next]inCHANGELOG.md - Updates to all TypeScript test fixtures that construct
MqttConfig
CHANGELOG.md is read by users, not developers.
- Describe what the user saw and what changed for them, in a few sentences.
- No internals: file, function or symbol names, data structures, code paths. If a sentence only makes sense with the diff open, it belongs in the commit message instead.
- End with the issue reference, plus the PR number once it exists:
(fixes #123, PR #124).
- Prefer minimal, surgical changes over broad refactors.
- Keep naming aligned with existing style (
topicPrefix,...TopicPrefix, etc.). - Preserve backward compatibility unless the task explicitly requires breaking change.
- If a default value is introduced, define it once in constants where appropriate.
PR description should include:
- What changed
- Why it changed
- How it was validated (commands run)
- Linked issue (e.g.
Closes #248) when applicable
- Never commit secrets, tokens, or private credentials.
- Do not perform destructive operations unless explicitly requested.
- Do not silently modify unrelated files.