Pre-Commit
Run all checks, fix any issues found, then present a summary table.
Checks
Rust checks
Run the following checks if there are changes in the tapo/, tapo-py/, or tapo-mcp/ directories. Fix all issues found. Run independent checks (cargo check, cargo clippy, cargo fmt, cargo test) in parallel.
Unless otherwise specified, run checks at the workspace level (no -p flags) with --all-features to ensure cross-crate issues are caught.
Link-free checks (check, clippy) take --workspace so they cover tapo-py too; cargo test must NOT — it links test binaries and examples, which fails with tapo-py's pyo3/extension-module, so it relies on default-members excluding tapo-py.
cargo check --workspace --all-features
cargo clippy --workspace --all-features
cargo fmt --all
cargo test --all-features
cargo clean --doc && RUSTDOCFLAGS="-D warnings" cargo doc -p tapo --no-deps --all-features
- No
unwrap() in non-test code without a // safe: comment
- No
unsafe in non-test code without a // SAFETY: comment
- No unnecessary clones
- No deeply nested
use (max one level of {} nesting)
Python checks
Run the following checks if there are changes in the tapo/ or tapo-py/ directories. Fix all issues found.
- Update
.pyi stubs if Python-exposed Rust types changed
- Verify new
#[pyclass] types are imported and registered in tapo-py/src/lib.rs
- Verify Python examples in
tapo-py/examples/ are updated to match corresponding Rust examples in tapo/examples/
cd tapo-py and activate the virtual environment
uv run mypy . — fix all type errors
uv run black . — fix all formatting issues
MCP checks
Run the following checks if there are changes in the tapo-mcp/ directory. Fix all issues found.
- Verify that all
#[derive(JsonSchema)] types have schemars annotations — including tool input params, response types, enums, and their fields/variants. Check for descriptions and range constraints where applicable.
- Verify that
tapo-mcp/README.md reflects any MCP API changes (tools, resources, capabilities, env vars, auth)
- Verify that the OpenClaw skill reflects any MCP API changes. The skill spans three files — check each:
tapo-mcp/openclaw-skill/SKILL.md — frontmatter (description, version, requires), Setup, Tools section with example npx mcporter call invocations
tapo-mcp/openclaw-skill/references/setup.md — verification table (tool, description, parameters)
tapo-mcp/openclaw-skill/references/tapo-mcp-setup.md — Tools table, Resources table, Configuration env vars, Authentication, Deployment (kept in sync with tapo-mcp/README.md)
- When device-support categories change (e.g. adding a new family like the H100 hub), verify the device-type enumeration is in sync across both surfaces that list it:
tapo-mcp/src/server.rs with_instructions(...) (e.g. "plugs, lights, power strips, hubs and their child sensors, cameras")
tapo-mcp/openclaw-skill/SKILL.md frontmatter description: (e.g. (lights, plugs, power strips, hubs and sensors, cameras))
Documentation checks
Run the following checks if there are changes in the tapo/ or tapo-py/ directories. Fix all issues found.
- Verify that
SUPPORTED_DEVICES.md is up to date: add, remove, or regroup rows/columns when a handler's public method list changed, a device model was added/removed, or a method's #[cfg(feature = "debug")] gating changed
Code Review
After fixing all issues found in the checks, review the code changes for correctness, readability, and maintainability and propose improvements.
Summarize the findings according to severity.
1---2name: pre-commit3description: Run Rust/Python/MCP checks, fix issues, then summarize findings before committing4---56# Pre-Commit78Run all checks, fix any issues found, then present a summary table.910## Checks1112### Rust checks1314Run the following checks if there are changes in the `tapo/`, `tapo-py/`, or `tapo-mcp/` directories. Fix all issues found. Run independent checks (`cargo check`, `cargo clippy`, `cargo fmt`, `cargo test`) in parallel.15Unless otherwise specified, run checks at the workspace level (no `-p` flags) with `--all-features` to ensure cross-crate issues are caught.16Link-free checks (`check`, `clippy`) take `--workspace` so they cover `tapo-py` too; `cargo test` must NOT — it links test binaries and examples, which fails with `tapo-py`'s `pyo3/extension-module`, so it relies on `default-members` excluding `tapo-py`.1718- `cargo check --workspace --all-features`19- `cargo clippy --workspace --all-features`20- `cargo fmt --all`21- `cargo test --all-features`22- `cargo clean --doc && RUSTDOCFLAGS="-D warnings" cargo doc -p tapo --no-deps --all-features`23- No `unwrap()` in non-test code without a `// safe:` comment24- No `unsafe` in non-test code without a `// SAFETY:` comment25- No unnecessary clones26- No deeply nested `use` (max one level of `{}` nesting)2728### Python checks2930Run the following checks if there are changes in the `tapo/` or `tapo-py/` directories. Fix all issues found.3132- Update `.pyi` stubs if Python-exposed Rust types changed33- Verify new `#[pyclass]` types are imported and registered in `tapo-py/src/lib.rs`34- Verify Python examples in `tapo-py/examples/` are updated to match corresponding Rust examples in `tapo/examples/`35- `cd tapo-py` and activate the virtual environment36- `uv run mypy .` — fix all type errors37- `uv run black .` — fix all formatting issues3839### MCP checks4041Run the following checks if there are changes in the `tapo-mcp/` directory. Fix all issues found.4243- Verify that **all** `#[derive(JsonSchema)]` types have `schemars` annotations — including tool input params, response types, enums, and their fields/variants. Check for descriptions and range constraints where applicable.44- Verify that `tapo-mcp/README.md` reflects any MCP API changes (tools, resources, capabilities, env vars, auth)45- Verify that the OpenClaw skill reflects any MCP API changes. The skill spans three files — check each:46 - `tapo-mcp/openclaw-skill/SKILL.md` — frontmatter (`description`, `version`, `requires`), Setup, Tools section with example `npx mcporter call` invocations47 - `tapo-mcp/openclaw-skill/references/setup.md` — verification table (tool, description, parameters)48 - `tapo-mcp/openclaw-skill/references/tapo-mcp-setup.md` — Tools table, Resources table, Configuration env vars, Authentication, Deployment (kept in sync with `tapo-mcp/README.md`)49- When device-support categories change (e.g. adding a new family like the H100 hub), verify the device-type enumeration is in sync across both surfaces that list it:50 - `tapo-mcp/src/server.rs` `with_instructions(...)` (e.g. `"plugs, lights, power strips, hubs and their child sensors, cameras"`)51 - `tapo-mcp/openclaw-skill/SKILL.md` frontmatter `description:` (e.g. `(lights, plugs, power strips, hubs and sensors, cameras)`)5253### Documentation checks5455Run the following checks if there are changes in the `tapo/` or `tapo-py/` directories. Fix all issues found.5657- Verify that `SUPPORTED_DEVICES.md` is up to date: add, remove, or regroup rows/columns when a handler's public method list changed, a device model was added/removed, or a method's `#[cfg(feature = "debug")]` gating changed5859## Code Review6061After fixing all issues found in the checks, review the code changes for correctness, readability, and maintainability and propose improvements.62Summarize the findings according to severity.