#!/usr/bin/env bash # doctor.sh — verify ~/.claude/ live state matches rulesets repo + settings.json. # # Read-only diagnostic. Reports drift line-by-line: ok / WARN / FAIL. # Exit 0 on clean, 1 if any FAIL was emitted. Warnings do not block. # # Run from the repo root via `make doctor`. set -uo pipefail REPO="$(cd "$(dirname "$0")/.." && pwd)" CLAUDE_DIR="$HOME/.claude" SETTINGS="$REPO/.claude/settings.json" ok_count=0 warn_count=0 fail_count=0 ok() { printf ' ok %s\n' "$1"; ok_count=$((ok_count+1)); } warn() { printf ' WARN %s\n' "$1"; warn_count=$((warn_count+1)); } fail() { printf ' FAIL %s\n' "$1"; fail_count=$((fail_count+1)); } require() { if ! command -v "$1" >/dev/null 2>&1; then echo "ERROR: required tool '$1' not found in PATH" >&2 exit 2 fi } is_live_symlink() { [ -L "$1" ] && [ -e "$1" ] } # Reports ok / dangling / missing for a single symlink. # Args: