diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-07 08:18:23 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-07 08:18:23 -0500 |
| commit | c84e8a03336f8d44301652aadc2b177a7f2502df (patch) | |
| tree | c0872a98be5099c35f450ad340f07428aa8a9222 /Makefile | |
| parent | e26264ac85ac07af8716770063e636abccf2d9fe (diff) | |
| download | rulesets-c84e8a03336f8d44301652aadc2b177a7f2502df.tar.gz rulesets-c84e8a03336f8d44301652aadc2b177a7f2502df.zip | |
feat(make): add doctor target for ~/.claude drift detection
=make doctor= scans =~/.claude/= and reports drift against the repo + settings.json. Read-only diagnostic. Eight checks cover skills, rules, default hooks, claude config, settings.json hook references, enabledPlugins, MCP server registrations, and dangling symlinks. Each line prints =ok= / =WARN= / =FAIL= with a final summary. Exit 1 on any FAIL.
A sweep last night found =~/.claude/hooks/= didn't exist on this machine even though =settings.json= referenced a PreCompact hook there. Compaction would have silently failed to invoke it. doctor catches that kind of drift in one command instead of relying on a manual look.
The MCP drift check reads =~/.claude.json= directly rather than parsing =claude mcp list=. The CLI has no JSON output and runs a per-server health probe (~10s). The JSON file is the user-scope source of truth for registrations and parses in well under a second.
I verified by injecting four drift scenarios — removed hook symlink, removed skill symlink, moved-aside plugin data dir, unregistered MCP server. Each produced the expected =FAIL= line and exit 1. After restoring state, doctor came back clean (33 ok).
Bundling four other improvement TODOs from the same sweep — =mcp/README.org=, =make uninstall-mcp= and =mcp/install.py --check=, a README.org section for the MCP install pipeline, and a token-rotation helper for =@a-bonus/google-docs-mcp= OAuth refresh. Plus a stale-bullet note on the existing =make remove= TODO (the bridge symlink it references was removed earlier).
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -62,7 +62,7 @@ endef .PHONY: help install uninstall list install-hooks uninstall-hooks \ install-lang install-elisp install-python list-languages \ - install-mcp diff lint deps + install-mcp diff lint doctor deps ##@ General @@ -333,3 +333,6 @@ diff: ## Show drift between installed ruleset and repo source ([LANG=<lang>] [PR lint: ## Validate ruleset structure (headings, Applies-to, shebangs, exec bits) @bash scripts/lint.sh + +doctor: ## Verify ~/.claude/ live state matches repo + settings.json (drift detector) + @bash scripts/doctor.sh |
