Skip to content

Doctor

proves the installation is real: policy parses, every declared enforcement is actually invoked by the hook it names without a swallowed exit code, every projection matches its own stamp, the always-loaded file is under budget

proves the installation is real: policy parses, every declared enforcement is actually invoked by the hook it names without a swallowed exit code, every projection matches its own stamp, the always-loaded file is under budget

Where it lives

The command that acts on it

majordomus doctor

Is Majordomus itself healthy, and is every enforcement it declares actually wired here?

  • read-only
  • active task optional
  • --json
majordomus doctor [--json]

See it refuse, and accept

doctor's primary guarantee is reconciliation: for each enforcement the policy declares, the path must exist, be executable, and be invoked by the artifact named in wired_by without its exit code being swallowed. Everything else it reports is secondary to that.

Given this repository

# A repository with Majordomus installed and projections generated, and one commit of work.
"$MJ" init >/dev/null
"$MJ" update >/dev/null
mkdir -p lib docs
echo a > lib/a
echo d > docs/d
git add . && git commit -qm base

Run

$ majordomus doctor

Output contains

  • FAIL wiring
  • doctor-on-commit

exit 10

This is the failure the tool exists to catch. The policy says a check runs on every commit; nothing runs it. Declared and unwired is worse than absent, because it reads as protection.

Given this repository

# Installed, and the two enforcements the policy declares are actually in place as hooks.
. "$FIXTURE_SETUP/installed.sh"
mkdir -p .githooks
printf '#!/bin/sh\n%s doctor || exit $?\n' "$MJ" > .githooks/pre-commit
printf '#!/bin/sh\n%s finish --check || exit $?\n' "$MJ" > .githooks/pre-push
chmod +x .githooks/pre-commit .githooks/pre-push
git config core.hooksPath .githooks

Run

$ majordomus doctor

Output contains

  • OK wiring
  • doctor: 0 failure

exit 0

doctor names the file that does the wiring, so the report is checkable rather than reassuring. A hook that invoked the command and discarded its exit code would still be reported as unwired.

What enforces it

What is guaranteed

Rules this command runs

Doctrines whose enforced_by names doctor. Enforcing a rule and being governed by one are different relations, so they are listed separately.

The moments this answers