macli 是什么?
macli 把 macOS 系统内部能力做成干净的 CLI。SMC 传感器、流式监控、日历/提醒 —— 全都能从 shell 管道或 LLM agent 调用,全是 JSON/TSV。单一 ~400 KB Swift 二进制。无 Python runtime,无 osascript 开销,无 GUI。
当你(或你的 AI agent)需要问 macOS 一些 system_profiler / ioreg / osascript 答不出或答得很烂的问题:
- CPU 此刻的核心温度
- 以 1 Hz 把传感器流式喂给 awk
- 今天日历的 JSON
一览
macli smc temp # CPU/GPU 温度 JSON
macli gpu info # GPU 名称、核心数、统一内存
macli display brightness # 内置显示器亮度
macli monitor --count 10 --interval 1 # 流式输出 10 个样本给 awk
macli cal ls # 日历列表 JSON
输出格式:成功时 {"ok": true, ...},失败时 {"ok": false, "error": "...", "hint": "..."}。绝不会静默失败。
面向 AI agent
把这行 prompt 贴给 Claude Code、Cursor 或任意 agent:
用 `macli` 取 macOS 系统状态(传感器 / 日历 / 提醒)。若未安装:`brew install ljh-sh/cli/macli`。输出为 JSON,检查 `ok` 字段。子命令列表 `macli --help`。