from pathlib import Path
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
def read_text(path: str) -> str:
|
return (ROOT / path).read_text(encoding="utf-8")
|
|
|
def require(condition: bool, message: str) -> None:
|
if not condition:
|
raise SystemExit(message)
|
|
|
def main() -> None:
|
board = read_text("main/boards/sening-xiaozhi-s3/sening_xiaozhi_s3.cc")
|
alarm_block = board.split('mcp_server.AddTool("self.alarm.add"', 1)[1].split(
|
'mcp_server.AddTool("self.alarm.get_list"', 1
|
)[0]
|
|
require('Property("hour", kPropertyTypeInteger, 0, 23)' in alarm_block, "alarm.add must require hour")
|
require('Property("minute", kPropertyTypeInteger, 0, 59)' in alarm_block, "alarm.add must require minute")
|
require('Property("second", kPropertyTypeInteger, 0, 0, 59)' in alarm_block, "alarm.add must default second")
|
require('Property("trigger_time"' not in alarm_block, "alarm.add must not expose stale trigger_time schema")
|
require('Property("label"' not in alarm_block, "alarm.add must not expose stale label schema")
|
|
|
if __name__ == "__main__":
|
main()
|