Add Tools/scripts/allowed_subsystems.py, the single source of truth for
which subsystem prefixes are permitted in commit messages and which
subsystem(s) a changed file may belong to.
A subsystem is allowed if it is a directory under libraries/ (computed
dynamically), a libraries/ directory created by the commit itself, or one
of the curated non-library extras (vehicles, Tools, autotest, waf, hwdef,
modules, a few common class prefixes, ...). subsystems_for_path() returns
an ordered list of candidate subsystems for a path, since some files are
conventionally committed under more than one name (an autotest under
autotest or Tools; a ChibiOS hwdef file under hwdef or AP_HAL_ChibiOS).
suggest_subsystem() offers the closest allowed name for a mistyped prefix.
The functionality is exposed as an AllowedSubsystems object; running the
file directly prints every valid subsystem name. It is consumed by
check_branch_conventions.py, the git-subsystems-split tool and the sample
pre-commit hook.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>