dLazy AIdLazy AI
参考

退出码

CLI 把失败映射到进程退出码的方式。

退出码含义
0成功 —— stdout 输出 { ok: true, result }
1运行时 / 网络失败 —— 如 task_failedtimeoutnetwork_errorunauthorizedinsufficient_balancecli_version_too_low
2输入 / 配置错误 —— 如 tool_not_foundmissing_fieldbad_refno_stdininput_file_not_foundinput_file_bad_json

退出码与 { ok: false, code, message, details? } 信封配合:机器看 code、人看 message、shell 用 $? 提前短路。

if ! dlazy gpt-image-2 --prompt "..." > out.json; then
  case $? in
    1) echo "运行时/网络失败" >&2 ;;
    2) echo "参数有问题" >&2 ;;
  esac
  exit 1
fi