feat(config): T-1275 — bare reach is discovery, so it exits 0

Bare `reach` and bare `reach <domain>` printed help and exited 2, Click's
usage-error convention. Running reach with no arguments is the DISCOVERY
action — it is how the tool gets learned from nothing — and a caller that
branches on exit status would read its own onboarding as a failure. Now they
exit 0.

D-263's exit-code contract is untouched: it governs failures, and printing a
command list is not one. Verified across the whole matrix, because this change
flirts with the exit-0 trap that record opens with — bare 0, bare domain 0,
--help 0, unknown domain 2, unknown verb 2, real failure 1. All five are now
pinned as a sixth conformance invariant, since an exit code regresses silently
and nothing else would notice. Proven to fail by putting the 2 back.

The implementation also collapses a duplicated class. core/cli.py holds
ReachGroup with both shared behaviours — no-args-prints-help-and-exits-0, and
unknown-name-enumerates — and LazyDomainGroup now extends it instead of
subclassing TyperGroup directly, keeping only the laziness and the
domain-specific wording. The enumeration logic previously existed twice in
slightly different forms, which is how the root and the domains would have
drifted into disagreeing about their own conventions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-31 15:49:08 +02:00
co-authored by Claude Opus 5
parent 91e25a3e7a
commit b5beda0df7
6 changed files with 105 additions and 9 deletions
+7 -2
View File
@@ -35,7 +35,8 @@ from __future__ import annotations
import importlib
import typer
from typer.core import TyperGroup
from tooling.core.cli import ReachGroup
# The domain registry: name -> (import target, one-line help).
#
@@ -53,9 +54,13 @@ DOMAINS: dict[str, tuple[str, str]] = {
}
class LazyDomainGroup(TyperGroup):
class LazyDomainGroup(ReachGroup):
"""Lists domains without importing them; imports exactly the one invoked.
Extends `ReachGroup`, so bare `reach` prints the domain list and exits 0
like every domain group does. Only the laziness and the domain-specific
wording live here.
Three overrides, and the third is the one that matters. `TyperGroup`'s own
`format_commands` loops over `list_commands` calling `get_command` on each,
just to read a short help string off the loaded command — which, with lazy