feat(ocp): wire cmd_doctor into bash CLI; dispatch to scripts/doctor.mjs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 03:46:11 +10:00
co-authored by Claude Sonnet 4.6
parent b65201b395
commit 414b473eb7
+25
View File
@@ -794,6 +794,30 @@ cmd_update() {
echo "Done." echo "Done."
} }
cmd_doctor_help() {
cat <<'EOF'
ocp doctor — Health & upgrade-readiness check
Runs a series of checks (Node version, git state, service health,
OAuth token, plist customisation, OpenClaw provider) and emits either
human-readable PASS/WARN/FAIL output or a JSON next_action that
AI agents can execute.
Usage:
ocp doctor Human-readable output
ocp doctor --json JSON for AI agents and ocp update internal use
ocp doctor --check oauth Fast path: OAuth check only
EOF
}
cmd_doctor() {
local script_dir self
self="${BASH_SOURCE[0]}"
while [[ -L "$self" ]]; do self="$(readlink "$self")"; done
script_dir="$(cd "$(dirname "$self")" && pwd)"
exec node "$script_dir/scripts/doctor.mjs" "$@"
}
# ── help ───────────────────────────────────────────────────────────────── # ── help ─────────────────────────────────────────────────────────────────
cmd_help() { cmd_help() {
cat <<'EOF' cat <<'EOF'
@@ -859,6 +883,7 @@ case "$subcmd" in
lan) cmd_lan ;; lan) cmd_lan ;;
connect) cmd_connect "$@" ;; connect) cmd_connect "$@" ;;
restart) cmd_restart "${1:-}" ;; restart) cmd_restart "${1:-}" ;;
doctor) cmd_doctor "$@" ;;
update) cmd_update "${1:-}" ;; update) cmd_update "${1:-}" ;;
*) echo "Unknown command: $subcmd"; echo ""; cmd_help; exit 1 ;; *) echo "Unknown command: $subcmd"; echo ""; cmd_help; exit 1 ;;
esac esac