2.9 KiB
2.9 KiB
Repository Guidelines
Project Structure & Module Organization
- LuCI apps (
luci-app-secubox,luci-app-*) store views inhtdocs/luci-static/resourcesand RPC logic inroot/usr/libexec/rpcd;package/secubox/holds the SDK-ready copies of those modules. luci-theme-secubox,templates/, andplugins/provide shared CSS, gradients, and widgets that should be referenced viarequire secubox/*instead of duplicating assets.- Automation lives in
secubox-tools/,scripts/, and thedeploy-*.shwrappers, while documentation sits indocs/(MkDocs) andDOCS/(deep dives).
Build, Test & Development Commands
./secubox-tools/local-build.sh build <module>performs cached SDK builds; usemake package/<module>/compile V=swhen reproducing CI exactly../secubox-tools/validate-modules.shmust pass before commits; it checks RPC naming, menu paths, permissions, JSON, and orphaned views../secubox-tools/quick-deploy.sh --profile luci-app --src luci-app-secuboxsyncs bothroot/andhtdocs/trees to a router; add--list-appsto discover valid IDs or--app <name>to target one../deploy-to-router.shrebuildssecubox-core+luci-app-secubox-admin, uploads the latest IPKs to$ROUTER_IP, installs them, and restartsrpcd.
Coding Style & Naming Conventions
- LuCI views stick with ES5:
'use strict';, grouped'require ...', tab indentation, andreturn view.extend({ ... })+E('div', ...)rendering; move business logic into helpers likesecubox/api. - Menu JSON
"path": \"system-hub/overview\"must resolve tohtdocs/.../view/system-hub/overview.js, and RPC scripts insideroot/usr/libexec/rpcd/must match their ubus object names while shipping with executable (755) permissions. - Run
./secubox-tools/fix-permissions.sh --localto keep CSS/JS files at 644, and keep design vocabulary consistent (sh-*,sb-*, Inter/JetBrains fonts, gradients stored in theme files).
Testing Guidelines
- Run
./secubox-tools/validate-modules.shplusjsonlint file.jsonandshellcheck root/usr/libexec/rpcd/*for every touchpoint. - Execute
scripts/smoke_test.shon hardware to confirm Zigbee2MQTT services, container health, and MQTT. - Drop
test-direct.jsortest-modules-simple.jsinto LuCI to verify menu wiring, then remove the file and record anyubus -S call luci.secubox ...commands in the PR.
Commit & Pull Request Guidelines
- Follow the observed history style:
type(scope): change(e.g.,fix(luci-app-secubox-admin): add RPC fallback). - PRs must highlight the affected module, list the validation commands run, and attach screenshots for UI tweaks.
- Link issues or TODO entries, update
docs/+DOCS/when behavior or APIs change, and call out router IP assumptions.
Security & Deployment Tips
- Run the validator and
./secubox-tools/fix-permissions.sh --localbefore pushing to avoid HTTP 403s, and restartrpcdplus purge LuCI caches (rm -f /tmp/luci-*) if you skipdeploy-to-router.sh.