with one click
with one click
Automated build-flash-monitor-analyze development loop for TuyaOpen devices. Covers log analysis, error patterns, CLI testing, and iterative debugging. Use when the user mentions dev loop, automated testing, log analysis, debug cycle, iterative development, or CI loop. 开发闭环、自动化测试、日志分析、调试循环、迭代开发。
Set up and activate the TuyaOpen development environment, install system dependencies, and initialize tos.py. Use when the user mentions environment setup, activating the SDK, installing dependencies, export.sh, or when tos.py is not found. 环境搭建、环境初始化、激活开发环境、安装依赖。
Agent-friendly non-blocking serial log capture for TuyaOpen devices. Runs tos.py monitor in the background, writes logs to file, and lets the agent tail or stop it at any time. Use when the agent needs to capture device logs without blocking, run a debug session, or monitor UART output during a build-flash-analyze loop. 后台串口日志、非阻塞监控、设备日志捕获、agent日志分析。
Add new board (BSP) support to TuyaOpen, including board directory structure, Kconfig, drivers, and config files. Use when the user mentions adding a board, new board, BSP, board support, hardware adaptation, or tos.py new board. 添加开发板、板级适配、新增BSP、硬件适配。
Build and compile TuyaOpen projects, select build configurations, edit Kconfig options, clean artifacts, and run Linux ELF binaries. Use when the user mentions compiling, building, tos.py build, config choice, menuconfig, Kconfig, build error, or running a project. 项目编译、构建、编译配置、清理编译、编译错误、menuconfig、Kconfig。
Configure device authorization credentials (UUID, AuthKey, PID) and network provisioning for TuyaOpen devices. Use when the user mentions device auth, authorization, UUID, AuthKey, tuya_config.h, provisioning, pairing, or cloud connection. 设备授权、授权码、配网、UUID、AuthKey、云连接。
| name | tuyaopen/code-check |
| description | >- |
SDK root: All
$OPEN_SDK_PYTHON tools/check_format.pycommands must be run from the TuyaOpen SDK root ($OPEN_SDK_ROOT). The bundledcheck_files.pyscript resolves the SDK root automatically via$OPEN_SDK_ROOTor by walking upward for.clang-format.
tools/check_format.py validates C/C++ files (.c, .cpp, .h, .hpp, .cc, .cxx) against three rules:
.clang-format at the repo root (LLVM-based style with 4-space indent).@file, @brief, and @copyright (must include current year + "All Rights Reserved").Paths listed in .clang-format-ignore are excluded (third-party libraries: cJSON, FlashDB, lwip, coreMQTT, etc.).
clang-format must be installed. It is included in the system dependencies (sudo apt-get install clang-format). If missing, the format check will be skipped with a warning.
All commands must be run from the SDK root ($OPEN_SDK_ROOT, where .clang-format lives).
$OPEN_SDK_PYTHON tools/check_format.py --debug --files path/to/file.c path/to/file.h
Supports glob patterns: --files "src/tal_system/**/*.c"
$OPEN_SDK_PYTHON tools/check_format.py --debug --dir src/tal_system/
$OPEN_SDK_PYTHON tools/check_format.py --debug
When --debug is used without --files or --dir, it scans the current working directory recursively for all C/C++ files.
Checks files modified relative to a base branch (uses git diff):
$OPEN_SDK_PYTHON tools/check_format.py # default: --base master
$OPEN_SDK_PYTHON tools/check_format.py --base main # custom base branch
Add -v to any mode for detailed information:
$OPEN_SDK_PYTHON tools/check_format.py --debug --files foo.c -v
--files and --dir require --debug flag — they are ignored in PR mode..clang-format.0 = all checks pass, 1 = errors found.When editing C/C++ files in this repo:
$OPEN_SDK_PYTHON .agents/skills/tuyaopen/code-check/scripts/check_files.py <changed_files>
Or directly: $OPEN_SDK_PYTHON tools/check_format.py --debug --files <changed_files>clang-format -style=file -i <file> to auto-fix, then re-check.Before committing or pushing code, verify that no sensitive information is included:
UUID, AuthKey, TUYA_OPENSDK_UUID, TUYA_OPENSDK_AUTHKEY — must use placeholder values (e.g. "your_uuid_here"), never real credentials.TUYA_PRODUCT_ID — use a placeholder or a development-only PID.When generating or modifying code that involves tuya_config.h or similar credential files:
"your_uuid_here", "your_authkey_here".Every .c and .h file must start with a /** comment block containing @file, @brief, @version, @date, and @copyright:
/**
* @file filename.c
* @brief Brief description in English
* @version 1.0
* @date YYYY-MM-DD
* @copyright Copyright (c) 2025 Tuya Inc. All Rights Reserved.
*/
@copyright format: Copyright (c) <start_year>[-<end_year>] <holder> All Rights Reserved. — the year must include the current year (either as start or end year). This is enforced as an error by check_format.py.
.clang-format-ignore ExcludesThe following third-party paths are excluded from formatting checks:
src/libcjson/cJSON
src/tal_kv/FlashDB
src/tal_kv/littlefs
src/common/backoffAlgorithm
src/liblwip/lwip-2.1.2
src/libhttp/coreHTTP
src/libmqtt/coreMQTT
src/common/qrcode
Do not modify these third-party files for formatting. If you add new third-party code, add its path to .clang-format-ignore.
.clang-format config at SDK root defines the full formatting rules (LLVM-based, 4-space indent, brace after control statement, etc.)