Probe.exitCode constructor

const Probe.exitCode(
  1. StackRun run
)

Zero is up, anything else is down. The command's last non-empty output line becomes the detail shown beside the status.

The floor, and it works today against minikube status, supabase status and any health check a project already has, without asking anyone to change anything.

The command has to say no when the stack is down, and a lister does not. docker compose ps --quiet exits 0 and prints nothing for a stopped project — it succeeded at listing zero containers — so a probe declared that way reads up forever, and the panel is confidently green with no Bring-up button on it. The same goes for anything whose exit code is about whether the tool ran rather than what it found: docker ps, kubectl get pods, ls. The question to ask of a candidate is not "does this tell me about the stack" but "does this fail when there is nothing there".

Where the answer is only in the output, the emptiness has to be turned into an exit code, and that needs a shell — a StackRun.command is spawned directly, so $(…), pipes and && exist only if sh -c is part of what you declared:

Probe.exitCode(StackRun.command([
  'sh',
  '-c',
  'test -n "$(docker compose ps --quiet --status running)"',
]))

That names a Unix shell and is as portable as one. A project that needs more than one platform is better off putting the check in a StackRun.script of its own — which is most of the work of earning a Probe.json, and gets the service list and the broken state with it.

And a lister exits 0 over someone else's stack, too. The example above is right about zero containers and still wrong in a worktree: docker compose resolves its project from the working directory, so a checkout that has never brought its own stack up reports up — describing the containers of the main checkout next door. Measured in exactly that shape: exit 0, eight containers, none of them the worktree's. This is the monorepo the plugin is aimed at, and the failure is silent and confident.

The reliable order is to answer from what identifies this checkout before asking the tool anything — no .env, no compose project name, no stack, answer down without spawning docker at all. That is a StackRun.script again, and one more reason the useful ceiling is Probe.json.

What it cannot do is tell down from broken: a health check that fails because Docker Desktop is asleep exits non-zero exactly like one that fails because nothing is up, and reporting "down" there offers a Bring-up button that cannot work. Use Probe.json where that distinction matters.

Implementation

const Probe.exitCode(this.run) : shape = ProbeShape.exitCode;