$ show 10000ge10000/luci-app-openclaw
This repository is the `luci-app-openclaw` package for OpenWrt routers, providing a complete web UI (via LuCI) and command-line management surface for the OpenClaw AI gateway. The system handles installation and lifecycle of a Node.js runtime and the OpenClaw npm package, configures AI model and messaging channel settings (Telegram, WeChat, etc.), manages device pairing approvals, offers an interactive terminal (xterm.js) via WebSocket, and supports backup/restore with atomic writes. The architecture is a monolithic OpenWrt plugin that integrates with procd for service management, UCI for configuration, and relies on external Node.js binaries plus the OpenClaw gateway software. The codebase exhibits strong engineering practices: a comprehensive contract-test suite with mutation testing, atomic configuration writes with pre-write backups, CSRF protection on all state-changing endpoints, a shell/JS menu engine for interactive configuration, and an upgrade state machine with rollback. It is actively maintained with frequent adjustments to upstream OpenClaw versions and security hardening.
The LLM identified 3 files worth highlighting for reuse:
A self-contained Node.js module providing interactive menu components (select, input, confirm, spinner) with arrow key navigation, search filtering, and raw mode management. It is completely independent of the rest of the repository and could be extracted and reused in any Node.js CLI tool requiring a terminal-based user interface with minimal adaptation.
A Lua module for normalizing and validating OpenClaw installation paths (strips trailing '/openclaw', rejects dangerous patterns, derives standard subpaths). It implements a simple, well-documented interface (`oc_load_paths`) that could be reused in other LuCI applications needing consistent path management without modification.
A standalone Node.js script that validates an OpenClaw `package.json` manifest against a strict contract (name, version, bin entries, scripts, optionalDependencies, engines.node) and checks the Node.js runtime version using semver. The pattern of enforcing a manifest contract with explicit rejection of unlisted keys is reusable across any Node.js-based delivery system.