isMetadataPath function
Whether path is a METADATA path — prose or configuration, never source.
A strict SUPERSET of isDocsPath: every docs path is metadata, plus any
file whose extension is in kMetadataPathExtensions (CHANGELOG.md,
pubspec.yaml, example-config.json, Cargo.toml) and any file whose
name is in kMetadataPathFilenames (LICENSE).
An ALLOW-list, never a deny-list of source extensions: a .dart / .swift
/ .kt / .go / .py / .js / .ts file is not metadata because it is
not LISTED — and neither is an unlisted surface nobody thought of (a
tool/release.sh, a template, an extension-less script). That keeps
changeShapeOf's fail-to-code posture: an unknown surface meets the CODE
committee rather than sneaking past a prose one.
Implementation
bool isMetadataPath(String path) {
if (isDocsPath(path)) return true;
final normalized = p.posix.normalize(path.trim());
if (normalized.isEmpty || normalized == '.') return false;
final name = p.posix.basename(normalized);
if (kMetadataPathFilenames.contains(name)) return true;
final extension = p.posix.extension(name).toLowerCase();
return extension.isNotEmpty && kMetadataPathExtensions.contains(extension);
}